@@ -84,6 +84,7 @@ const mDbug = mcStatus + mdLog + mdConsole;
84
84
const mDeep = mcVerbose + mdConsole ;
85
85
const mAll = mcUser + mdDisplay + mdLog + mdConsole ;
86
86
87
+ let logLines = [ ] ;
87
88
//TODO determine if more messages should be converted to mUser - instead of manually socket.send()'ing them
88
89
//TODO allow this to be further filtered with includes/excludes set by app options at runtime
89
90
//TODO provide mechanism for this to be a downloadable date-stamped file.
@@ -116,9 +117,14 @@ function log(text = "", type = mStat, socket = null, direction = 0) {
116
117
//Send to Launcher log view
117
118
let logView = $ ( 'log' ) ;
118
119
//Note scroll position (to see if user has scrolled up), append message, then auto-scroll (down) if bottom was previously in view
119
- let scroll = ( logView . scrollTop + 1 >= logView . scrollHeight - logView . clientHeight ) ;
120
- logView . innerHTML += stamp ( verboseLogging ) + text + '<br>' ;
121
- if ( scroll ) { logView . scrollTo ( 0 , logView . scrollHeight ) }
120
+ console . log ( logView . scrollTop ) ;
121
+ let scrollTop = logView . scrollTop ;
122
+ let scroll = ( scrollTop + 1 >= logView . scrollHeight - logView . clientHeight ) ;
123
+ logLines . push ( stamp ( verboseLogging ) + text + '<br>' ) ;
124
+ if ( logLines . length > 40 ) { logLines . shift ( ) }
125
+ logView . innerHTML = logLines . join ( '' ) ;
126
+ if ( scroll ) { logView . scrollTo ( 0 , logView . scrollHeight ) } else { if ( scrollTop !== logView . ScrollTop ) { logView . scrollTo ( 0 , scrollTop - ( logView . scrollTop - scrollTop ) ) } }
127
+ logView . style .
122
128
}
123
129
//Send to Launcher console window
124
130
if ( type & mdConsole ) { console . log ( stamp ( true ) + text ) }
@@ -228,12 +234,13 @@ document.addEventListener('DOMContentLoaded', function() {
228
234
229
235
// TODO: re-write this to use onblur and/or onchange to auto-save.
230
236
$ ( 'refresh-connection' ) . onclick = function ( ) {
231
- disconnect ( ) ;
232
- closeServer ( ) ;
233
- if ( chrome . storage ) {
234
- chrome . storage . sync . set ( { 's_port' :$ ( 'bpc-port' ) . value , 's_url' :$ ( 'bpc-url' ) . value } , function ( ) { if ( chrome . runtime . lastError ) { storageError ( ) } } ) ;
235
- }
236
- connect ( ) ;
237
+ $ ( 'log' ) . innerHTML = '' ;
238
+ // disconnect();
239
+ // closeServer();
240
+ // if(chrome.storage) {
241
+ // chrome.storage.sync.set({'s_port':$('bpc-port').value, 's_url':$('bpc-url').value}, function() {if (chrome.runtime.lastError) {storageError()}});
242
+ // }
243
+ // connect();
237
244
} ;
238
245
239
246
$ ( 'netmask' ) . addEventListener ( "blur" , function ( ) {
0 commit comments