File tree Expand file tree Collapse file tree 1 file changed +18
-3
lines changed
Expand file tree Collapse file tree 1 file changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ import toMarkdown from 'to-markdown'
1616
1717import { saveAs } from 'file-saver'
1818import randomColor from 'randomcolor'
19+ import store from 'store'
1920
2021import _ from 'lodash'
2122
@@ -431,11 +432,12 @@ $(document).ready(function () {
431432 clearMap ( )
432433 }
433434 checkEditorStyle ( )
435+
436+ /* cache dom references */
437+ var $body = $ ( 'body' )
438+
434439 /* we need this only on touch devices */
435440 if ( isTouchDevice ) {
436- /* cache dom references */
437- var $body = $ ( 'body' )
438-
439441 /* bind events */
440442 $ ( document )
441443 . on ( 'focus' , 'textarea, input' , function ( ) {
@@ -445,6 +447,12 @@ $(document).ready(function () {
445447 $body . removeClass ( 'fixfixed' )
446448 } )
447449 }
450+
451+ // Re-enable nightmode
452+ if ( store . get ( 'nightMode' ) || Cookies . get ( 'nightMode' ) ) {
453+ $body . addClass ( 'night' )
454+ }
455+
448456 // showup
449457 $ ( ) . showUp ( '.navbar' , {
450458 upClass : 'navbar-hide' ,
@@ -1680,6 +1688,13 @@ function toggleNightMode () {
16801688 $body . addClass ( 'night' )
16811689 appState . nightMode = true
16821690 }
1691+ if ( store . enabled ) {
1692+ store . set ( 'nightMode' , ! isActive )
1693+ } else {
1694+ Cookies . set ( 'nightMode' , ! isActive , {
1695+ expires : 365
1696+ } )
1697+ }
16831698}
16841699function emitPermission ( _permission ) {
16851700 if ( _permission !== permission ) {
You can’t perform that action at this time.
0 commit comments