mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-02-03 21:24:35 +03:00
Use localStorage for the selected theme in the docs
This commit is contained in:
parent
4be248932d
commit
a1799ee74b
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
// setTheme(<link />, 'light' / 'dark')
|
// setTheme(<link />, 'light' / 'dark')
|
||||||
function setTheme(theme) {
|
function setTheme(theme) {
|
||||||
document.cookie = 'css=' + theme + '; path=/';
|
localStorage.setItem('theme', theme);
|
||||||
return style.href = 'css/docs.' + theme + '.css';
|
return style.href = 'css/docs.' + theme + '.css';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,9 +24,7 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
setTheme(document.cookie
|
setTheme(localStorage.getItem('theme') || 'light');
|
||||||
.split(';')[0]
|
|
||||||
.split('=')[1] || 'light');
|
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', function () {
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
setThemeOnClick('light', document.getElementById('themeLight'));
|
setThemeOnClick('light', document.getElementById('themeLight'));
|
||||||
|
|
|
@ -45,7 +45,7 @@ class DocsWriter:
|
||||||
<link id="style" href="{rel_css}/docs.{def_css}.css" rel="stylesheet">
|
<link id="style" href="{rel_css}/docs.{def_css}.css" rel="stylesheet">
|
||||||
<script>
|
<script>
|
||||||
document.getElementById("style").href = "{rel_css}/docs."
|
document.getElementById("style").href = "{rel_css}/docs."
|
||||||
+ (document.cookie.split(";")[0].split("=")[1] || "{def_css}")
|
+ (localStorage.getItem("theme") || "{def_css}")
|
||||||
+ ".css";
|
+ ".css";
|
||||||
</script>
|
</script>
|
||||||
<link href="https://fonts.googleapis.com/css?family=Nunito|Source+Code+Pro"
|
<link href="https://fonts.googleapis.com/css?family=Nunito|Source+Code+Pro"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user