mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-02-03 13:14:31 +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')
|
||||
function setTheme(theme) {
|
||||
document.cookie = 'css=' + theme + '; path=/';
|
||||
localStorage.setItem('theme', theme);
|
||||
return style.href = 'css/docs.' + theme + '.css';
|
||||
}
|
||||
|
||||
|
@ -24,9 +24,7 @@
|
|||
});
|
||||
}
|
||||
|
||||
setTheme(document.cookie
|
||||
.split(';')[0]
|
||||
.split('=')[1] || 'light');
|
||||
setTheme(localStorage.getItem('theme') || 'light');
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
setThemeOnClick('light', document.getElementById('themeLight'));
|
||||
|
|
|
@ -45,7 +45,7 @@ class DocsWriter:
|
|||
<link id="style" href="{rel_css}/docs.{def_css}.css" rel="stylesheet">
|
||||
<script>
|
||||
document.getElementById("style").href = "{rel_css}/docs."
|
||||
+ (document.cookie.split(";")[0].split("=")[1] || "{def_css}")
|
||||
+ (localStorage.getItem("theme") || "{def_css}")
|
||||
+ ".css";
|
||||
</script>
|
||||
<link href="https://fonts.googleapis.com/css?family=Nunito|Source+Code+Pro"
|
||||
|
|
Loading…
Reference in New Issue
Block a user