Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/g1eny0ung/hugo-theme-dream.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/static
diff options
context:
space:
mode:
authorYue Yang <g1enyy0ung@gmail.com>2020-08-20 19:00:37 +0300
committerYue Yang <g1enyy0ung@gmail.com>2020-08-20 19:00:37 +0300
commit37f5d4d2a9d58048e14348131b2e7beebab92027 (patch)
tree96f6220cf69f25f26d935c8f6d78fbb390176fe3 /static
parent49187f43840191eef3f57df8830de3b3c54db761 (diff)
Update something related to dark theme
Diffstat (limited to 'static')
-rw-r--r--static/js/main.js2
-rw-r--r--static/js/theme.js2
2 files changed, 2 insertions, 2 deletions
diff --git a/static/js/main.js b/static/js/main.js
index 9e91f5b..fac9f61 100644
--- a/static/js/main.js
+++ b/static/js/main.js
@@ -1 +1 @@
-"use strict";function initFilp(){$(".dream-flip-toggle").click(function(){$(".flip-container").toggleClass("flip-it")})}$(document).ready(function(){$("body").overlayScrollbars({}),initFilp()}); \ No newline at end of file
+"use strict";function initFilp(){$(".dream-flip-toggle").click(function(){$(".flip-container").toggleClass("flip-it")})}$(document).ready(function(){$("body").overlayScrollbars({className:window.darkNav?"os-theme-light":"os-theme-dark",nativeScrollbarsOverlaid:{initialize:!1}}),initFilp()}); \ No newline at end of file
diff --git a/static/js/theme.js b/static/js/theme.js
index 291e8a8..33af945 100644
--- a/static/js/theme.js
+++ b/static/js/theme.js
@@ -1 +1 @@
-"use strict";var dark="inverted",localStore=window.localStorage,setThemeForUtterances=function(e){var t=document.querySelector("iframe.utterances-frame");t&&t.contentWindow.postMessage({type:"set-theme",theme:e?"github-dark":"github-light"},"https://utteranc.es")},darkHeaderElements=function(){if($(".dream-header").length){var e=$(".dream-header .ui.segment"),t=$(".dream-header .ui.top.segment .ui.header"),a=$(".dream-header .ui.top.segment .ui.list"),r=$(".dream-header .ui.segment .ui.accordion");e.map(function(){$(this).toggleClass(dark)}),t.toggleClass(dark),a.toggleClass(dark),r.toggleClass(dark)}},darkBack=function(){var e=$(".dream-back .ui.segment");e.length&&e.map(function(){$(this).toggleClass(dark)})},darkPostsSection=function(){var e=$(".ui.segment.dream-posts-section");e.length&&e.toggleClass(dark)},darkTagsSection=function(){var e=$(".ui.segment.dream-tags-section");e.length&&e.toggleClass(dark)},darkCategoriesSection=function(){var e=$(".ui.segment.dream-categories-section");e.length&&e.toggleClass(dark)},darkSingle=function(){var e=$(".dream-single .ui.segment");e.length&&(e.map(function(){$(this).toggleClass(dark)}),$(".dream-single .ui.top.segment .ui.header").toggleClass(dark),setThemeForUtterances(localStore.getItem("hugo-theme-dream-is-dark")),"function"==typeof setHighlightTheme&&setHighlightTheme())},darkCards=function(){var e=$(".dream-card");e.length&&e.map(function(){$(this).toggleClass(dark)})},darkTables=function(){var e=$(".dream-single table");e.length&&e.map(function(){this.style.color?this.style.color="":this.style.color="black"})};function toggleDark(){darkHeaderElements(),darkCards(),darkSingle(),darkTables(),darkPostsSection(),darkTagsSection(),darkCategoriesSection(),darkBack()}var isDark=localStore.getItem("hugo-theme-dream-is-dark"),iconSwitchs=$(".theme-switch").toArray();isDark?(iconSwitchs.forEach(function(e){return $(e).addClass("moon")}),toggleDark()):iconSwitchs.forEach(function(e){return $(e).addClass("sun")}),window.addEventListener("message",function(e){"https://utteranc.es"===e.origin&&setThemeForUtterances(isDark)});var themeSwitch=function(){isDark=isDark?(iconSwitchs.forEach(function(e){return $(e).removeClass("moon")}),iconSwitchs.forEach(function(e){return $(e).addClass("sun")}),localStore.removeItem("hugo-theme-dream-is-dark"),null):(iconSwitchs.forEach(function(e){return $(e).removeClass("sun")}),iconSwitchs.forEach(function(e){return $(e).addClass("moon")}),localStore.setItem("hugo-theme-dream-is-dark","y"),"y"),toggleDark()}; \ No newline at end of file
+"use strict";var dark="inverted",localStore=window.localStorage,isDark=localStore.getItem("hugo-theme-dream-is-dark"),setThemeForUtterances=function(){var e=document.querySelector("iframe.utterances-frame");e&&e.contentWindow.postMessage({type:"set-theme",theme:isDark?"github-dark":"github-light"},"https://utteranc.es")},darkHeaderElements=function(){if($(".dream-header").length){var e=$(".dream-header .ui.segment"),t=$(".dream-header .ui.top.segment .ui.header"),a=$(".dream-header .ui.top.segment .ui.list"),r=$(".dream-header .ui.segment .ui.accordion");e.map(function(){$(this).toggleClass(dark)}),t.toggleClass(dark),a.toggleClass(dark),r.toggleClass(dark)}},darkBack=function(){var e=$(".dream-back .ui.segment");e.length&&e.map(function(){$(this).toggleClass(dark)})},darkPostsSection=function(){var e=$(".ui.segment.dream-posts-section");e.length&&e.toggleClass(dark)},darkTagsSection=function(){var e=$(".ui.segment.dream-tags-section");e.length&&e.toggleClass(dark)},darkCategoriesSection=function(){var e=$(".ui.segment.dream-categories-section");e.length&&e.toggleClass(dark)},darkSingle=function(){var e=$(".dream-single .ui.segment");e.length&&(e.map(function(){$(this).toggleClass(dark)}),$(".dream-single .ui.top.segment .ui.header").toggleClass(dark),setThemeForUtterances(),"function"==typeof setHighlightTheme&&setHighlightTheme())},darkCards=function(){var e=$(".dream-card");e.length&&e.map(function(){$(this).toggleClass(dark)})},darkTables=function(){var e=$(".dream-single table");e.length&&e.map(function(){this.style.color?this.style.color="":this.style.color="black"})};function toggleDark(){darkHeaderElements(),darkCards(),darkSingle(),darkTables(),darkPostsSection(),darkTagsSection(),darkCategoriesSection(),darkBack()}var iconSwitchs=$(".theme-switch").toArray();isDark?(iconSwitchs.forEach(function(e){return $(e).addClass("moon")}),toggleDark()):iconSwitchs.forEach(function(e){return $(e).addClass("sun")}),window.addEventListener("message",function(e){"https://utteranc.es"===e.origin&&setThemeForUtterances()});var themeSwitch=function(){isDark=isDark?(iconSwitchs.forEach(function(e){return $(e).removeClass("moon")}),iconSwitchs.forEach(function(e){return $(e).addClass("sun")}),localStore.removeItem("hugo-theme-dream-is-dark"),null):(iconSwitchs.forEach(function(e){return $(e).removeClass("sun")}),iconSwitchs.forEach(function(e){return $(e).addClass("moon")}),localStore.setItem("hugo-theme-dream-is-dark","y"),"y"),toggleDark()}; \ No newline at end of file