-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconsole.js
More file actions
41 lines (33 loc) · 806 Bytes
/
console.js
File metadata and controls
41 lines (33 loc) · 806 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
"use strict";
console.cbSetup = function ( entry )
{
entry.checked = (console.org_log != undefined);
};
console.cbChange = function ( entry )
{
console.redirect(entry.checked);
};
// Replace log and clear functions.
//
console.redirect = function ( v )
{
if ( v==true ) {
console.org_log = console.log ;
console.log = function ( s ) {
let c = document.getElementById("console");
c.textContent += s+"\n" ;
c.scrollTop = c.scrollHeight ;
};
console.org_clear = console.clear ;
console.clear = function ( ) {
let c = document.getElementById("console");
c.textContent="";
};
}
else {
console.log = console.org_log ;
console.org_log = undefined ;
console.clear = console.org_clear ;
console.org_clear = undefined ;
}
};