|
3 | 3 | <head> |
4 | 4 | <title>Arduino Create Agent Debug Console</title> |
5 | 5 | <link href="https://fonts.googleapis.com/css?family=Open+Sans:400,600,700&display=swap" rel="stylesheet"> |
6 | | -<link href="https://fonts.googleapis.com/css?family=Roboto:400,600,700&display=swap" rel="stylesheet"> |
| 6 | +<link href="https://fonts.googleapis.com/css?family=Roboto+Mono:400,600,700&display=swap" rel="stylesheet"> |
7 | 7 | <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> |
8 | 8 | <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/1.3.5/socket.io.min.js"></script> |
9 | 9 | <script type="text/javascript"> |
|
14 | 14 | var autoscroll = document.getElementById('autoscroll'); |
15 | 15 | var listenabled = document.getElementById('list'); |
16 | 16 | var messages = []; |
| 17 | + var MESSAGES_MAX_COUNT = 2000; |
17 | 18 |
|
18 | 19 | function appendLog(msg) { |
19 | | - if (listenabled.checked || (typeof msg === 'string' && msg.indexOf('{') !== 0 && msg.indexOf('list') !== 0)) { |
| 20 | + var startsWithBracked = msg.indexOf('{') == 0; |
| 21 | + var startsWithList = msg.indexOf('list') == 0; |
| 22 | + |
| 23 | + if (listenabled.checked || (typeof msg === 'string' && !startsWithBracked && !startsWithList)) { |
20 | 24 | messages.push(msg); |
21 | | - if (messages.length > 2000) { |
| 25 | + if (messages.length > MESSAGES_MAX_COUNT) { |
22 | 26 | messages.shift(); |
23 | 27 | } |
24 | 28 | log.innerHTML = messages.join('<br>'); |
|
61 | 65 | }); |
62 | 66 | } else { |
63 | 67 | appendLog($('<div><b>Your browser does not support WebSockets.</b></div>')) |
64 | | - } |
| 68 | + } |
| 69 | + |
| 70 | + $("#input").focus(); |
65 | 71 | }); |
66 | 72 | </script> |
67 | 73 | <style type="text/css"> |
68 | | -html { |
| 74 | +html, body { |
69 | 75 | overflow: hidden; |
| 76 | + height: 100%; |
70 | 77 | } |
71 | 78 |
|
72 | | -body { |
73 | | - overflow: hidden; |
74 | | - padding: 0; |
75 | | - margin: 0; |
76 | | - width: 100%; |
77 | | - height: 100%; |
| 79 | +body { |
| 80 | + margin: 0px; |
| 81 | + padding: 0px; |
78 | 82 | background: #F8F9F9; |
79 | 83 | font-size: 16px; |
80 | 84 | font-family: "Open Sans", "Lucida Grande", Lucida, Verdana, sans-serif; |
81 | 85 | } |
82 | 86 |
|
| 87 | +#container { |
| 88 | + display: flex; |
| 89 | + flex-direction: column; |
| 90 | + height: 100%; |
| 91 | + width: 100%; |
| 92 | +} |
| 93 | + |
83 | 94 | #log { |
84 | | - font-family: "Roboto", "Lucida Grande", Lucida, Verdana, sans-serif; |
| 95 | + flex-grow: 1; |
| 96 | + font-family: "Roboto Mono", "Courier", "Lucida Grande", Verdana, sans-serif; |
85 | 97 | background: #DAE3E3; |
86 | | - margin: 0; |
87 | | - padding: .5em; |
88 | | - position: absolute; |
89 | | - top: .5em; |
90 | | - left: .5em; |
91 | | - right: .5em; |
92 | | - bottom: 3em; |
93 | | - overflow: auto; |
| 98 | + margin: 15px 15px 0px; |
| 99 | + padding: 8px 10px; |
| 100 | + overflow-y: auto; |
94 | 101 | } |
95 | 102 |
|
96 | | -.buttons { |
97 | | - align-items: center; |
| 103 | +#footer { |
| 104 | + flex-shrink: 0; |
98 | 105 | display: flex; |
99 | | - padding: 0 .5em; |
100 | | - margin: 0; |
101 | | - position: absolute; |
102 | | - bottom: 1em; |
103 | | - left: 0; |
104 | | - width: calc(100% - 1em); |
| 106 | + align-items: center; |
| 107 | + justify-content: space-between; |
| 108 | + margin: 10px 15px 10px; |
105 | 109 | overflow: hidden; |
106 | 110 | } |
107 | 111 |
|
|
116 | 120 |
|
117 | 121 | #autoscroll, |
118 | 122 | #list { |
119 | | - margin-left: 2em; |
120 | | - vertical-align: middle; |
| 123 | + margin-left: 10px; |
| 124 | + vertical-align: middle; |
| 125 | + width: 20px; |
| 126 | + height: 20px; |
121 | 127 | } |
122 | 128 |
|
| 129 | +.button { |
| 130 | + background-color: #b5c8c9; |
| 131 | + border: 1px solid #b5c8c9; |
| 132 | + border-radius: 2px 2px 0 0; |
| 133 | + box-shadow: 0 4px #95a5a6; |
| 134 | + color: #000; |
| 135 | + cursor: pointer; |
| 136 | + font-size: 14px; |
| 137 | + letter-spacing: 1.28px; |
| 138 | + line-height: normal; |
| 139 | + outline: none; |
| 140 | + padding: 9px 18px; |
| 141 | + text-align: center; |
| 142 | + text-transform: uppercase; |
| 143 | + transition: box-shadow .1s ease-out, transform .1s ease-out; |
| 144 | +} |
| 145 | + |
| 146 | +.button:hover { |
| 147 | + box-shadow: 0 2px #95a5a6; |
| 148 | + outline: none; |
| 149 | + transform: translateY(2px); |
| 150 | +} |
| 151 | + |
| 152 | +.button:active { |
| 153 | + box-shadow: none; |
| 154 | + transform: translateY(4px); |
| 155 | +} |
| 156 | + |
| 157 | +.textfield { |
| 158 | + background-color: #dae3e3; |
| 159 | + width: auto; |
| 160 | + height: auto; |
| 161 | + padding: 10px 8px; |
| 162 | + margin-left: 8px; |
| 163 | + vertical-align: top; |
| 164 | + border: none; |
| 165 | + font-family: "Open Sans", "Lucida Grande", Lucida, Verdana, sans-serif; |
| 166 | + font-size: 1em; |
| 167 | + outline: none; |
| 168 | +} |
| 169 | + |
| 170 | +/* |
123 | 171 | @media screen and (max-width: 950px) { |
124 | 172 | #form { |
125 | 173 | max-width: 60%; |
|
137 | 185 | #log { |
138 | 186 | bottom: 7em; |
139 | 187 | } |
140 | | - |
141 | | - #autoscroll, |
142 | | - #list { |
143 | | - margin-left: 0; |
144 | | - margin-top: .5em; |
145 | | - } |
146 | | -} |
| 188 | + |
| 189 | +} */ |
147 | 190 | </style> |
148 | 191 | </head> |
149 | | -<body> |
150 | | -<div id="log"></div> |
151 | | -<div class="buttons"> |
152 | | - <form id="form"> |
153 | | - <input type="submit" value="Send" /> |
154 | | - <input type="text" id="input" size="64"/> |
155 | | - </form> |
156 | | - <div><input name="pause" type="checkbox" checked id="autoscroll"/> Autoscroll</div> |
157 | | - <div><input name="list" type="checkbox" checked id="list"/> Toggle List</div> |
158 | | - <button id="export">Export Log</button> |
159 | | -</div> |
160 | | -</body> |
| 192 | + <body> |
| 193 | + <div id="container"> |
| 194 | + <div id="log">This is some random text This is some random textThis is some random textThis is some random textThis is some random textThis is some random textThis is some random text<br />This is some random text<br />This is some random text<br /></div> |
| 195 | + <div id="footer"> |
| 196 | + <form id="form"> |
| 197 | + <input type="submit" class="button" value="Send" /> |
| 198 | + <input type="text" id="input" class="textfield" size="64" /> |
| 199 | + </form> |
| 200 | + <div id="options"> |
| 201 | + <input name="pause" type="checkbox" checked id="autoscroll" /> |
| 202 | + <label for="autoscroll">Autoscroll</label> |
| 203 | + <input name="list" type="checkbox" checked id="list" /> |
| 204 | + <label for="list">List Command Enabled</label> |
| 205 | + </div> |
| 206 | + <button id="export" class="button">Export Log</button> |
| 207 | + </div> |
| 208 | + </div> |
| 209 | + </body> |
161 | 210 | </html> |
0 commit comments