GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — doc: remove flicker on page load on dark theme · nodejs/node@ec74b93

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • doc
    • api_assets
      • api.js
    • template.html
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎doc/api_assets/api.js‎

Copy file name to clipboardExpand all lines: doc/api_assets/api.js
-6Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,6 @@
2424
);
2525
}
2626
}
27-
28-
if (mq.matches) {
29-
document.documentElement.classList.add('dark-mode');
30-
}
31-
} else if (storedTheme === 'dark') {
32-
document.documentElement.classList.add('dark-mode');
3327
}
3428

3529
if (themeToggleButton) {
Collapse file

‎doc/template.html‎

Copy file name to clipboardExpand all lines: doc/template.html
+13Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,19 @@
1010
<link rel="stylesheet" href="assets/hljs.css">
1111
<link rel="canonical" href="https://nodejs.org/api/__FILENAME__.html">
1212
<script async defer src="assets/api.js" type="text/javascript"></script>
13+
<script>
14+
const storedTheme = localStorage.getItem('theme');
15+
16+
// Follow operating system theme preference
17+
if (storedTheme === null && window.matchMedia) {
18+
const mq = window.matchMedia('(prefers-color-scheme: dark)');
19+
if (mq.matches) {
20+
document.documentElement.classList.add('dark-mode');
21+
}
22+
} else if (storedTheme === 'dark') {
23+
document.documentElement.classList.add('dark-mode');
24+
}
25+
</script>
1326
__JS_FLAVORED_DYNAMIC_CSS__
1427
</head>
1528
<body class="alt apidoc" id="api-section-__FILENAME__">

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.