File tree Expand file tree Collapse file tree 2 files changed +23
-4
lines changed Expand file tree Collapse file tree 2 files changed +23
-4
lines changed Original file line number Diff line number Diff line change 1
- //http://stackoverflow.com/a/2091331
1
+ var hours = new Date ( ) . getHours ( ) ;
2
+
3
+ var isDarkTheme = false ;
2
4
5
+ if ( hours > 21 || hours < 6 ) {
6
+ isDarkTheme = true ;
7
+
8
+ document . body . classList . add ( "dark-theme" )
9
+ }
10
+
11
+ //http://stackoverflow.com/a/2091331
3
12
4
13
function getQueryVariable ( variable ) {
5
14
var query = window . location . search . substring ( 1 ) ;
@@ -15,8 +24,6 @@ function getQueryVariable(variable) {
15
24
16
25
var backbutton = document . getElementById ( "backtoarticle" ) ;
17
26
18
- var emptyHTMLdocument = "<!DOCTYPE html><html><head></head><body></body></html>"
19
-
20
27
function startReaderView ( article ) {
21
28
22
29
document . body . removeChild ( parserframe ) ;
@@ -46,6 +53,10 @@ function startReaderView(article) {
46
53
47
54
rframe . onload = function ( ) {
48
55
56
+ if ( isDarkTheme ) {
57
+ rframe . contentDocument . body . classList . add ( "dark-theme" ) ;
58
+ }
59
+
49
60
requestAnimationFrame ( function ( ) {
50
61
rframe . height = rframe . contentDocument . body . querySelector ( ".reader-main" ) . scrollHeight + "px" ;
51
62
requestAnimationFrame ( function ( ) {
Original file line number Diff line number Diff line change @@ -108,10 +108,11 @@ a {
108
108
color : inherit;
109
109
font-size : 1em ;
110
110
text-decoration : none;
111
- color : # 777 ;
111
+ opacity : 0.6 ;
112
112
}
113
113
a : hover {
114
114
color : # 2196F3 ;
115
+ opacity : 1.0 ;
115
116
}
116
117
figure {
117
118
max-width : 50% ;
@@ -147,6 +148,13 @@ blockquote {
147
148
margin : 1.5em 0 ;
148
149
}
149
150
151
+ /* dark theme */
152
+
153
+ body .dark-theme {
154
+ background-color : # 000 ;
155
+ color : # fff ;
156
+ }
157
+
150
158
/* site-specific styles */
151
159
152
160
You can’t perform that action at this time.
0 commit comments