From 89fc2917985d3da944af8116e101748267d66104 Mon Sep 17 00:00:00 2001 From: amzrk2 Date: Sun, 14 Jun 2020 23:17:37 +0800 Subject: Remove medium-zoom --- assets/js/fuji.js | 31 ----------------------------- layouts/_default/_markup/render-image.html | 4 +++- layouts/partials/scripts-end.html | 1 - layouts/shortcodes/img-lazy.html | 32 ++++++++++++++++++++---------- layouts/shortcodes/img-nz-lazy.html | 25 ----------------------- layouts/shortcodes/img-nz.html | 7 ------- static/assets/js/fuji.min.js | 2 +- 7 files changed, 26 insertions(+), 76 deletions(-) delete mode 100644 layouts/shortcodes/img-nz-lazy.html delete mode 100644 layouts/shortcodes/img-nz.html diff --git a/assets/js/fuji.js b/assets/js/fuji.js index 4bc9d56..b72c30e 100644 --- a/assets/js/fuji.js +++ b/assets/js/fuji.js @@ -10,23 +10,6 @@ function getNowTheme() { } } -// update medium-zoom theme -function updateMeidumTheme(mediumInst) { - let targetTheme = getNowTheme(); - if (mediumInst) { - mediumInst.detach(); - if (targetTheme === 'dark') { - mediumInst = mediumZoom('.img-zoomable', { - background: '#2f3136', - }); - } else { - mediumInst = mediumZoom('.img-zoomable', { - background: '#fffffd', - }); - } - } -} - // update utterances theme function updateUtterancesTheme(utterancesFrame) { let targetTheme = getNowTheme(); @@ -61,18 +44,6 @@ document.querySelector('.btn .btn-scroll-top').addEventListener('click', () => { document.documentElement.scrollTop = 0; }); -// init medium-zoom -var mediumInst; // medium-zoom instance -if (getNowTheme() === 'dark') { - mediumInst = mediumZoom('.img-zoomable', { - background: '#2f3136', - }); -} else { - mediumInst = mediumZoom('.img-zoomable', { - background: '#fffffd', - }); -} - // theme switch button document.querySelector('.btn .btn-toggle-mode').addEventListener('click', () => { let nowTheme = getNowTheme(); @@ -95,8 +66,6 @@ document.querySelector('.btn .btn-toggle-mode').addEventListener('click', () => localStorage.setItem('fuji_data-theme', systemTheme === 'light' ? 'auto' : 'light'); } - // update medium background - updateMeidumTheme(mediumInst); // switch comment area theme // if this page has comment area let commentArea = document.querySelector('.post-comment'); diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html index b9020c7..1b20943 100644 --- a/layouts/_default/_markup/render-image.html +++ b/layouts/_default/_markup/render-image.html @@ -1 +1,3 @@ -{{ .Text }} \ No newline at end of file + + {{ .Text }} + \ No newline at end of file diff --git a/layouts/partials/scripts-end.html b/layouts/partials/scripts-end.html index 024ee6f..e5426ad 100644 --- a/layouts/partials/scripts-end.html +++ b/layouts/partials/scripts-end.html @@ -4,7 +4,6 @@ - {{ with .Params.player }} diff --git a/layouts/shortcodes/img-lazy.html b/layouts/shortcodes/img-lazy.html index fef9bd3..e57b8fb 100644 --- a/layouts/shortcodes/img-lazy.html +++ b/layouts/shortcodes/img-lazy.html @@ -1,10 +1,22 @@ -{{ if len .Params | eq 2 }} -{{ index .Params 0 }} -{{ else if len .Params | eq 3 }}{{ if eq (index .Params 0) "row" }} -{{ index .Params 1 }} -{{ else if eq (index .Params 0) "col" }} -{{ index .Params 1 }} -{{ else }}{{ end }}{{ else }}{{ end }} \ No newline at end of file +{{- if len .Params | eq 2 -}} +

+ + {{ index .Params 0 }} + +

+{{- else if len .Params | eq 3 }}{{ if eq (index .Params 0) "row" -}} +

+ + {{ index .Params 1 }} + +

+{{- else if eq (index .Params 0) "col" -}} +

+ + {{ index .Params 1 }} + +

+{{- else -}}{{- end -}}{{- else -}}{{ end -}} \ No newline at end of file diff --git a/layouts/shortcodes/img-nz-lazy.html b/layouts/shortcodes/img-nz-lazy.html deleted file mode 100644 index bfdb26a..0000000 --- a/layouts/shortcodes/img-nz-lazy.html +++ /dev/null @@ -1,25 +0,0 @@ -{{ if len .Params | eq 2 }} -{{ index .Params 0 }} -{{ else if len .Params | eq 3 }}{{ if eq (index .Params 0) "row" }} -{{ index .Params 1 }} -{{ else if eq (index .Params 0) "col" }} -{{ index .Params 1 }} -{{ else }} - - {{ index .Params 0 }} - -{{ end }}{{ else if len .Params | eq 4 }}{{ if eq (index .Params 0) "row" }} - - {{ index .Params 1 }} - -{{ else if eq (index .Params 0) "col" }} - - {{ index .Params 1 }} - -{{ else }}{{ end }}{{ else }}{{ end }} \ No newline at end of file diff --git a/layouts/shortcodes/img-nz.html b/layouts/shortcodes/img-nz.html deleted file mode 100644 index 1b4f791..0000000 --- a/layouts/shortcodes/img-nz.html +++ /dev/null @@ -1,7 +0,0 @@ -{{ if (index .Params 2) }} - - {{ index .Params 0 }} - -{{ else }} -{{ index .Params 0 }} -{{ end }} \ No newline at end of file diff --git a/static/assets/js/fuji.min.js b/static/assets/js/fuji.min.js index 90c27a6..b3940da 100644 --- a/static/assets/js/fuji.min.js +++ b/static/assets/js/fuji.min.js @@ -1 +1 @@ -"use strict";function getNowTheme(){var e=document.body.getAttribute("data-theme");return"auto"===e?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":"dark"===e?"dark":"light"}function updateMeidumTheme(e){var t=getNowTheme();e&&(e.detach(),e="dark"===t?mediumZoom(".img-zoomable",{background:"#2f3136"}):mediumZoom(".img-zoomable",{background:"#fffffd"}))}function updateUtterancesTheme(e){var t=getNowTheme();e&&("dark"===t?e.contentWindow.postMessage({type:"set-theme",theme:"photon-dark"},"https://utteranc.es"):e.contentWindow.postMessage({type:"set-theme",theme:"github-light"},"https://utteranc.es"))}var mediumInst;document.querySelector("span.post-comment-notloaded")&&document.querySelector("span.post-comment-notloaded").addEventListener("click",loadComment),document.querySelector(".btn .btn-scroll-top").addEventListener("click",function(){document.documentElement.scrollTop=0}),mediumInst="dark"===getNowTheme()?mediumZoom(".img-zoomable",{background:"#2f3136"}):mediumZoom(".img-zoomable",{background:"#fffffd"}),document.querySelector(".btn .btn-toggle-mode").addEventListener("click",function(){var e=getNowTheme(),t=document.body.getAttribute("data-theme"),o=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";"auto"===t?(document.body.setAttribute("data-theme","light"===e?"dark":"light"),localStorage.setItem("fuji_data-theme","light"===e?"dark":"light")):"light"===t?(document.body.setAttribute("data-theme","dark"),localStorage.setItem("fuji_data-theme","dark"==o?"auto":"dark")):(document.body.setAttribute("data-theme","light"),localStorage.setItem("fuji_data-theme","light"==o?"auto":"light")),updateMeidumTheme(mediumInst);var m=document.querySelector(".post-comment");m&&document.querySelector("span.post-comment-notloaded").getAttribute("style")&&("utterances"===m.getAttribute("data-comment")&&updateUtterancesTheme(document.querySelector(".post-comment iframe")),"disqus"===m.getAttribute("data-comment")&&DISQUS.reset({reload:!0}))}); \ No newline at end of file +"use strict";function getNowTheme(){var t=document.body.getAttribute("data-theme");return"auto"===t?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":"dark"===t?"dark":"light"}function updateUtterancesTheme(t){var e=getNowTheme();t&&("dark"===e?t.contentWindow.postMessage({type:"set-theme",theme:"photon-dark"},"https://utteranc.es"):t.contentWindow.postMessage({type:"set-theme",theme:"github-light"},"https://utteranc.es"))}document.querySelector("span.post-comment-notloaded")&&document.querySelector("span.post-comment-notloaded").addEventListener("click",loadComment),document.querySelector(".btn .btn-scroll-top").addEventListener("click",function(){document.documentElement.scrollTop=0}),document.querySelector(".btn .btn-toggle-mode").addEventListener("click",function(){var t=getNowTheme(),e=document.body.getAttribute("data-theme"),o=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";"auto"===e?(document.body.setAttribute("data-theme","light"===t?"dark":"light"),localStorage.setItem("fuji_data-theme","light"===t?"dark":"light")):"light"===e?(document.body.setAttribute("data-theme","dark"),localStorage.setItem("fuji_data-theme","dark"==o?"auto":"dark")):(document.body.setAttribute("data-theme","light"),localStorage.setItem("fuji_data-theme","light"==o?"auto":"light"));var a=document.querySelector(".post-comment");a&&document.querySelector("span.post-comment-notloaded").getAttribute("style")&&("utterances"===a.getAttribute("data-comment")&&updateUtterancesTheme(document.querySelector(".post-comment iframe")),"disqus"===a.getAttribute("data-comment")&&DISQUS.reset({reload:!0}))}); \ No newline at end of file -- cgit v1.2.3