@@ -10,13 +10,80 @@ function ping() {
1010ping ( ) ; // inject version info
1111
1212
13-
13+ let darkMode = false
1414let msgbox = document . getElementById ( 'outputMsg' )
1515let ssabox = document . getElementById ( 'ssa' )
1616ssabox . addEventListener ( 'load' , ( ) => {
17+ if ( darkMode ) {
18+ ssabox . contentWindow . document . getElementById ( 'dark-mode-button' ) . click ( )
19+ }
20+
1721 // inject ssa style
1822 $ ( "iframe" ) . contents ( ) . find ( "head" ) . append ( $ ( "<link/>" , { rel : 'stylesheet' , href : '/gossa/scrollbar.css' , type : 'text/css' } ) ) ;
1923 setMessageBox ( '' , true )
24+ ssabox . contentWindow . document
25+ . getElementById ( 'dark-mode-button' )
26+ . addEventListener ( 'click' , function ( ) {
27+ const banner = document . getElementById ( 'banner' )
28+ const snippet = document . getElementById ( 'snippet' )
29+ const about = document . getElementById ( 'about' )
30+ const funcname = document . getElementById ( 'funcname' )
31+ const gcflags = document . getElementById ( 'gcflags' )
32+ const horiz = document . querySelectorAll ( '.gutter.gutter-horizontal' )
33+ const btns = document . querySelectorAll ( 'input[type=button]' )
34+ const code = document . getElementById ( 'code' )
35+ const links = document . querySelectorAll ( '#about a' )
36+
37+ if ( darkMode ) {
38+ banner . style . backgroundColor = '#E0EBF5'
39+ snippet . style . backgroundColor = 'rgba(255, 252, 221, 0.81)'
40+ about . style . backgroundColor = '#FFD'
41+ funcname . style . backgroundColor = '#fff'
42+ funcname . style . border = '1px solid #ccc'
43+ funcname . style . color = ''
44+ gcflags . style . backgroundColor = '#fff'
45+ gcflags . style . border = '1px solid #ccc'
46+ gcflags . style . color = ''
47+ horiz . forEach ( ( v ) => {
48+ v . style . filter = ''
49+ } )
50+ btns . forEach ( ( v ) => {
51+ v . style . backgroundColor = '#375EAB'
52+ v . style . color = '#fff'
53+ } )
54+ code . style . color = 'black'
55+ links . forEach ( v => {
56+ v . style . color = ''
57+ } )
58+ document . body . style . color = 'black'
59+
60+ darkMode = false
61+ } else {
62+ banner . style . backgroundColor = '#566'
63+ snippet . style . backgroundColor = '#665'
64+ about . style . backgroundColor = '#665'
65+ funcname . style . backgroundColor = '#343'
66+ funcname . style . border = '1px solid #454'
67+ funcname . style . color = 'lightgray'
68+ gcflags . style . backgroundColor = '#343'
69+ gcflags . style . border = '1px solid #454'
70+ gcflags . style . color = 'lightgray'
71+ horiz . forEach ( ( v ) => {
72+ v . style . filter = 'invert(.7)'
73+ } )
74+ btns . forEach ( ( v ) => {
75+ v . style . backgroundColor = '#0044cb'
76+ v . style . color = 'lightgray'
77+ } )
78+ code . style . color = 'rgb(230, 255, 255)'
79+ links . forEach ( v => {
80+ v . style . color = '#809fff'
81+ } )
82+ document . body . style . color = 'lightgray'
83+
84+ darkMode = true
85+ }
86+ } )
2087} ) ;
2188
2289let lastFuncName , lastCode , lastGcflags ;
0 commit comments