@@ -17,14 +17,16 @@ try {
17
17
catch ( e ) {
18
18
data = {
19
19
"bounds" : { "x" :100 , "y" :100 , "width" :1024 , "height" :768 } ,
20
- "minTray" :false
20
+ "minTray" :false ,
21
+ "useCSS" :false
21
22
} ;
22
23
}
23
24
24
25
var menu = new Menu ( ) ;
25
26
var minToTray ;
27
+ var useCustomCSS ;
26
28
minToTray = data . minTray ;
27
-
29
+ useCustomCSS = data . useCSS ;
28
30
var updateReady = false ;
29
31
var quitForReal = false ; // Dirty
30
32
@@ -69,8 +71,9 @@ app.on('ready', function() {
69
71
//Save settings when app is closed.
70
72
mainWindow . on ( 'close' , function ( ) {
71
73
var data = {
72
- bounds : mainWindow . getBounds ( ) ,
73
- minTray : minToTray
74
+ bounds : mainWindow . getBounds ( ) ,
75
+ minTray : minToTray ,
76
+ useCSS : useCustomCSS
74
77
} ;
75
78
fs . writeFileSync ( initPath , JSON . stringify ( data ) ) ;
76
79
} ) ;
@@ -104,6 +107,25 @@ app.on('ready', function() {
104
107
}
105
108
} ) ;
106
109
110
+ //Toggle CSS (Only works on some OSs?)
111
+ var toggleCSS = new MenuItem ( {
112
+ label : 'Use Custom CSS' ,
113
+ type : 'checkbox' ,
114
+ checked : useCustomCSS ,
115
+ click : function ( ) {
116
+ if ( toggleCSS . checked == true ) {
117
+ useCustomCSS = true ;
118
+ console . log ( "Disabled useCustomCSS" ) ;
119
+ } else if ( toggleCSS . checked == false ) {
120
+ useCustomCSS = false ;
121
+ console . log ( "Enabled useCustomCSS" ) ;
122
+ }
123
+
124
+ toggleCSS . checked = useCustomCSS ;
125
+
126
+ }
127
+ } ) ;
128
+
107
129
mainWindow . on ( 'close' , function ( event ) {
108
130
if ( minToTray && ! quitForReal ) {
109
131
event . preventDefault ( ) ;
@@ -122,6 +144,7 @@ app.on('ready', function() {
122
144
menu . append ( new MenuItem ( { label : 'Refresh Discord' , type : 'normal' , click : function ( ) { mainWindow . reload ( ) ; } } ) ) ;
123
145
menu . append ( new MenuItem ( { type : 'separator' } ) ) ;
124
146
menu . append ( disMinButton ) ;
147
+ menu . append ( toggleCSS ) ;
125
148
menu . append ( new MenuItem ( { type : 'separator' } ) ) ;
126
149
menu . append ( new MenuItem ( { label : 'Quit Discord' , type : 'normal' , click : function ( ) { quitForReal = true ; app . quit ( ) ; } } ) ) ;
127
150
@@ -153,5 +176,8 @@ app.on('ready', function() {
153
176
globalShortcut . unregister ( 'ctrl+r' ) ;
154
177
} ) ;
155
178
179
+ mainWindow . webContents . on ( 'will-navigate' , function ( event ) {
180
+ event . preventDefault ( ) ;
181
+ } ) ;
156
182
157
183
} ) ;
0 commit comments