diff --git a/assets/css/_common/components/third-party/disqusjs.scss b/assets/css/_common/components/3rd/disqusjs.scss similarity index 100% rename from assets/css/_common/components/third-party/disqusjs.scss rename to assets/css/_common/components/3rd/disqusjs.scss diff --git a/assets/css/_common/components/third-party/gitalk.scss b/assets/css/_common/components/3rd/gitalk.scss similarity index 100% rename from assets/css/_common/components/third-party/gitalk.scss rename to assets/css/_common/components/3rd/gitalk.scss diff --git a/assets/css/_common/components/third-party/gitter.scss b/assets/css/_common/components/3rd/gitter.scss similarity index 100% rename from assets/css/_common/components/third-party/gitter.scss rename to assets/css/_common/components/3rd/gitter.scss diff --git a/assets/css/_common/components/third-party/index.scss b/assets/css/_common/components/3rd/index.scss similarity index 100% rename from assets/css/_common/components/third-party/index.scss rename to assets/css/_common/components/3rd/index.scss diff --git a/assets/css/_common/components/third-party/livere.scss b/assets/css/_common/components/3rd/livere.scss similarity index 100% rename from assets/css/_common/components/third-party/livere.scss rename to assets/css/_common/components/3rd/livere.scss diff --git a/assets/css/_common/components/third-party/mermaid.scss b/assets/css/_common/components/3rd/mermaid.scss similarity index 100% rename from assets/css/_common/components/third-party/mermaid.scss rename to assets/css/_common/components/3rd/mermaid.scss diff --git a/assets/css/_common/components/third-party/related-posts.scss b/assets/css/_common/components/3rd/related-posts.scss similarity index 100% rename from assets/css/_common/components/third-party/related-posts.scss rename to assets/css/_common/components/3rd/related-posts.scss diff --git a/assets/css/_common/components/third-party/search.scss b/assets/css/_common/components/3rd/search.scss similarity index 100% rename from assets/css/_common/components/third-party/search.scss rename to assets/css/_common/components/3rd/search.scss diff --git a/assets/css/_common/components/third-party/utterances.scss b/assets/css/_common/components/3rd/utterances.scss similarity index 100% rename from assets/css/_common/components/third-party/utterances.scss rename to assets/css/_common/components/3rd/utterances.scss diff --git a/assets/css/_common/components/third-party/waline.scss b/assets/css/_common/components/3rd/waline.scss similarity index 100% rename from assets/css/_common/components/third-party/waline.scss rename to assets/css/_common/components/3rd/waline.scss diff --git a/assets/css/_common/components/index.scss b/assets/css/_common/components/index.scss index 191a6cb..15bb2f2 100644 --- a/assets/css/_common/components/index.scss +++ b/assets/css/_common/components/index.scss @@ -25,4 +25,4 @@ @import 'post'; @import 'pages'; -@import 'third-party'; +@import '3rd'; diff --git a/assets/js/third-party/comments/artalk.js b/assets/js/3rd/comments/artalk.js similarity index 100% rename from assets/js/third-party/comments/artalk.js rename to assets/js/3rd/comments/artalk.js diff --git a/assets/js/third-party/comments/giscus.js b/assets/js/3rd/comments/giscus.js similarity index 100% rename from assets/js/third-party/comments/giscus.js rename to assets/js/3rd/comments/giscus.js diff --git a/assets/js/third-party/comments/livere.js b/assets/js/3rd/comments/livere.js similarity index 100% rename from assets/js/third-party/comments/livere.js rename to assets/js/3rd/comments/livere.js diff --git a/assets/js/third-party/comments/utterances.js b/assets/js/3rd/comments/utterances.js similarity index 100% rename from assets/js/third-party/comments/utterances.js rename to assets/js/3rd/comments/utterances.js diff --git a/assets/js/third-party/comments/waline.js b/assets/js/3rd/comments/waline.js similarity index 100% rename from assets/js/third-party/comments/waline.js rename to assets/js/3rd/comments/waline.js diff --git a/assets/js/third-party/comments/waline3.js b/assets/js/3rd/comments/waline3.js similarity index 100% rename from assets/js/third-party/comments/waline3.js rename to assets/js/3rd/comments/waline3.js diff --git a/assets/js/third-party/others/counter.js b/assets/js/3rd/others/counter.js similarity index 100% rename from assets/js/third-party/others/counter.js rename to assets/js/3rd/others/counter.js diff --git a/assets/js/third-party/others/lawidget.js b/assets/js/3rd/others/lawidget.js similarity index 100% rename from assets/js/third-party/others/lawidget.js rename to assets/js/3rd/others/lawidget.js diff --git a/assets/js/third-party/others/math.js b/assets/js/3rd/others/math.js similarity index 100% rename from assets/js/third-party/others/math.js rename to assets/js/3rd/others/math.js diff --git a/assets/js/third-party/others/mermaid.js b/assets/js/3rd/others/mermaid.js similarity index 100% rename from assets/js/third-party/others/mermaid.js rename to assets/js/3rd/others/mermaid.js diff --git a/assets/js/third-party/others/translate.js b/assets/js/3rd/others/translate.js similarity index 80% rename from assets/js/third-party/others/translate.js rename to assets/js/3rd/others/translate.js index 6dee18e..c386ede 100644 --- a/assets/js/third-party/others/translate.js +++ b/assets/js/3rd/others/translate.js @@ -4,6 +4,6 @@ NexT.plugins.others.translate = function() { if (!NexT.utils.checkDOMExist(element)) return; NexT.utils.lazyLoadComponent(element, function() { window.translateelement_styles='/css/google-translate.min.css'; - NexT.utils.getScript('/js/third-party/google-translate.min.js'); + NexT.utils.getScript('/js/3rd/google-translate.min.js'); }); } \ No newline at end of file diff --git a/assets/js/third-party/search/algolia.js b/assets/js/3rd/search/algolia.js similarity index 100% rename from assets/js/third-party/search/algolia.js rename to assets/js/3rd/search/algolia.js diff --git a/assets/js/third-party/search/local.js b/assets/js/3rd/search/local.js similarity index 100% rename from assets/js/third-party/search/local.js rename to assets/js/3rd/search/local.js diff --git a/assets/js/third-party/share/addtoany.js b/assets/js/3rd/share/addtoany.js similarity index 100% rename from assets/js/third-party/share/addtoany.js rename to assets/js/3rd/share/addtoany.js diff --git a/assets/js/third-party/share/sharethis.js b/assets/js/3rd/share/sharethis.js similarity index 100% rename from assets/js/third-party/share/sharethis.js rename to assets/js/3rd/share/sharethis.js diff --git a/exampleSite/content/post/image-viewer.md b/exampleSite/content/post/image-viewer.md index 7cb64be..f40a0f5 100644 --- a/exampleSite/content/post/image-viewer.md +++ b/exampleSite/content/post/image-viewer.md @@ -27,15 +27,15 @@ expired: true ## 动物 - - - - + + + + ## 风景 - - - - + + + + diff --git a/layouts/partials/_funs/get_res.html b/layouts/partials/_funs/get_cdn_res.html similarity index 100% rename from layouts/partials/_funs/get_res.html rename to layouts/partials/_funs/get_cdn_res.html diff --git a/layouts/partials/_funs/get_plugin.html b/layouts/partials/_funs/get_plugin.html index 4b50486..70d6a00 100644 --- a/layouts/partials/_funs/get_plugin.html +++ b/layouts/partials/_funs/get_plugin.html @@ -1,6 +1,6 @@ {{/* Get third party js plugins resource */}} -{{ $pluginPath := printf "%s/%s/%s" "js/third-party" .class .plugin }} +{{ $pluginPath := printf "%s/%s/%s" "js/3rd" .class .plugin }} {{ $targetPath := printf "js/%s" .plugin }} {{ $plugin := resources.Get $pluginPath | resources.ExecuteAsTemplate $targetPath .ctx }} diff --git a/layouts/partials/head/style.html b/layouts/partials/head/style.html index 0a34bfe..cb96efc 100644 --- a/layouts/partials/head/style.html +++ b/layouts/partials/head/style.html @@ -4,7 +4,7 @@ {{ $router := .Scratch.Get "router" }} {{ range $css := $cssRes }} - {{ $pluginCss := partial "_funs/get_res.html" (dict "res" . "vendor" $vendor "router" $router) }} + {{ $pluginCss := partial "_funs/get_cdn_res.html" (dict "res" . "vendor" $vendor "router" $router) }} {{ end }} diff --git a/layouts/partials/scripts/global.html b/layouts/partials/scripts/global.html index 085c253..419a625 100644 --- a/layouts/partials/scripts/global.html +++ b/layouts/partials/scripts/global.html @@ -3,7 +3,7 @@ {{ $vendor := .Site.Params.vendors.plugins }} {{ $router := .Scratch.Get "router" }} {{ range $jsRes }} - {{ $pluginJS := partial "_funs/get_res.html" (dict "res" . "vendor" $vendor "router" $router) }} + {{ $pluginJS := partial "_funs/get_cdn_res.html" (dict "res" . "vendor" $vendor "router" $router) }} {{ end }} @@ -41,18 +41,18 @@ {{/* Share scripts */}} {{/** if and .Site.Params.share.enable (isset .Site.Params "sharethisid") }} -{{ $sharethisjs := resources.Get "js/third-party/share/sharethis.js" }} +{{ $sharethisjs := resources.Get "js/3rd/share/sharethis.js" }} {{ $nextjs = $nextjs | append $sharethisjs }} {{ end **/}} {{ with .Site.Params.share }} {{ if or .enable .Params.share }} {{ if isset . "sharethis" }} - {{ $sharethisjs := resources.Get "js/third-party/share/sharethis.js" }} + {{ $sharethisjs := resources.Get "js/3rd/share/sharethis.js" }} {{ $nextjs = $nextjs | append $sharethisjs }} {{ end }} {{ if isset . "addtoany" }} - {{ $addtoanyjs := resources.Get "js/third-party/share/addtoany.js" }} + {{ $addtoanyjs := resources.Get "js/3rd/share/addtoany.js" }} {{ $nextjs = $nextjs | append $addtoanyjs }} {{ end }} {{ end }} @@ -60,53 +60,53 @@ {{/* Comments scripts */}} {{ if isset .Site.Params "waline" }} - {{ $walinejs := resources.Get "js/third-party/comments/waline.js" }} + {{ $walinejs := resources.Get "js/3rd/comments/waline.js" }} {{ $nextjs = $nextjs | append $walinejs }} {{ end }} {{ if isset .Site.Params "waline3" }} - {{ $walinejs3 := resources.Get "js/third-party/comments/waline3.js" }} + {{ $walinejs3 := resources.Get "js/3rd/comments/waline3.js" }} {{ $nextjs = $nextjs | append $walinejs3 }} {{ end }} {{ if or .Site.Params.postMeta.views.enable .Site.Params.postMeta.comments.enable }} - {{ $counterjs := resources.Get "js/third-party/others/counter.js" }} + {{ $counterjs := resources.Get "js/3rd/others/counter.js" }} {{ $nextjs = $nextjs | append $counterjs }} {{ end }} {{ if isset .Site.Params "giscus" }} -{{ $giscusjs := resources.Get "js/third-party/comments/giscus.js" }} +{{ $giscusjs := resources.Get "js/3rd/comments/giscus.js" }} {{ $nextjs = $nextjs | append $giscusjs }} {{ end}} {{ if isset .Site.Params "livere" }} -{{ $liverejs := resources.Get "js/third-party/comments/livere.js" }} +{{ $liverejs := resources.Get "js/3rd/comments/livere.js" }} {{ $nextjs = $nextjs | append $liverejs }} {{ end }} {{ if isset .Site.Params "artalk" }} -{{ $artalkjs := resources.Get "js/third-party/comments/artalk.js" }} +{{ $artalkjs := resources.Get "js/3rd/comments/artalk.js" }} {{ $nextjs = $nextjs | append $artalkjs }} {{ end }} {{ if isset .Site.Params "utterances" }} -{{ $utterancesjs := resources.Get "js/third-party/comments/utterances.js" }} +{{ $utterancesjs := resources.Get "js/3rd/comments/utterances.js" }} {{ $nextjs = $nextjs | append $utterancesjs }} {{ end }} {{/* Search engin scripts */}} {{ if .Site.Params.localSearch.enable }} -{{ $search := resources.Get "js/third-party/search/local.js" }} +{{ $search := resources.Get "js/3rd/search/local.js" }} {{ $nextjs = $nextjs | append $search }} {{ end }} {{ if .Site.Params.algoliaSearch.enable }} -{{ $search := resources.Get "js/third-party/search/algolia.js" }} +{{ $search := resources.Get "js/3rd/search/algolia.js" }} {{ $nextjs = $nextjs | append $search }} {{ end }} {{/* Other not useful scripts, eg: 51la widget, translate */}} {{ with .Site.Params.siteState.views }} {{ if and .enable (eq .plugin "51la") }} - {{ $lawt := resources.Get "js/third-party/others/lawidget.js" }} + {{ $lawt := resources.Get "js/3rd/others/lawidget.js" }} {{ $nextjs = $nextjs | append $lawt }} {{ end }} {{ end }} {{ if .Site.Params.footer.translate }} -{{ $translate := resources.Get "js/third-party/others/translate.js" }} +{{ $translate := resources.Get "js/3rd/others/translate.js" }} {{ $nextjs = $nextjs | append $translate }} {{ end }} diff --git a/static/js/third-party/analytics/baidu-analytics.js b/static/js/third-party/analytics/baidu-analytics.js deleted file mode 100644 index c10e7d0..0000000 --- a/static/js/third-party/analytics/baidu-analytics.js +++ /dev/null @@ -1,7 +0,0 @@ -/* global _hmt */ - -if (!window._hmt) window._hmt = []; - -document.addEventListener('pjax:success', () => { - _hmt.push(['_trackPageview', location.pathname]); -}); diff --git a/static/js/third-party/analytics/google-analytics.js b/static/js/third-party/analytics/google-analytics.js deleted file mode 100644 index 2cd128f..0000000 --- a/static/js/third-party/analytics/google-analytics.js +++ /dev/null @@ -1,35 +0,0 @@ -/* global CONFIG, dataLayer, gtag */ - -if (!CONFIG.google_analytics.only_pageview) { - if (CONFIG.hostname === location.hostname) { - window.dataLayer = window.dataLayer || []; - window.gtag = function() { - dataLayer.push(arguments); - }; - gtag('js', new Date()); - gtag('config', CONFIG.google_analytics.tracking_id); - - document.addEventListener('pjax:success', () => { - gtag('event', 'page_view', { - page_location: location.href, - page_path : location.pathname, - page_title : document.title - }); - }); - } -} else { - const sendPageView = () => { - if (CONFIG.hostname !== location.hostname) return; - const uid = localStorage.getItem('uid') || (Math.random() + '.' + Math.random()); - localStorage.setItem('uid', uid); - navigator.sendBeacon('https://www.google-analytics.com/collect', new URLSearchParams({ - v : 1, - tid: CONFIG.google_analytics.tracking_id, - cid: uid, - t : 'pageview', - dp : encodeURIComponent(location.pathname) - })); - }; - document.addEventListener('pjax:complete', sendPageView); - sendPageView(); -} diff --git a/static/js/third-party/analytics/growingio.js b/static/js/third-party/analytics/growingio.js deleted file mode 100644 index 0460833..0000000 --- a/static/js/third-party/analytics/growingio.js +++ /dev/null @@ -1,10 +0,0 @@ -/* global CONFIG, gio */ - -if (!window.gio) { - window.gio = function() { - (window.gio.q = window.gio.q || []).push(arguments); - }; -} - -gio('init', `${CONFIG.growingio_analytics}`, {}); -gio('send'); diff --git a/static/js/third-party/chat/chatra.js b/static/js/third-party/chat/chatra.js deleted file mode 100644 index e495b8e..0000000 --- a/static/js/third-party/chat/chatra.js +++ /dev/null @@ -1,19 +0,0 @@ -/* global CONFIG, Chatra */ - -(function() { - if (CONFIG.chatra.embed) { - window.ChatraSetup = { - mode : 'frame', - injectTo: CONFIG.chatra.embed - }; - } - - window.ChatraID = CONFIG.chatra.id; - - const chatButton = document.querySelector('.sidebar-button button'); - if (chatButton) { - chatButton.addEventListener('click', () => { - Chatra('openChat', true); - }); - } -})(); diff --git a/static/js/third-party/chat/gitter.js b/static/js/third-party/chat/gitter.js deleted file mode 100644 index 2b26d05..0000000 --- a/static/js/third-party/chat/gitter.js +++ /dev/null @@ -1,5 +0,0 @@ -/* global CONFIG */ - -((window.gitter = {}).chat = {}).options = { - room: CONFIG.gitter.room -}; diff --git a/static/js/third-party/chat/tidio.js b/static/js/third-party/chat/tidio.js deleted file mode 100644 index bffb918..0000000 --- a/static/js/third-party/chat/tidio.js +++ /dev/null @@ -1,10 +0,0 @@ -/* global tidioChatApi */ - -(function() { - const chatButton = document.querySelector('.sidebar-button button'); - if (chatButton) { - chatButton.addEventListener('click', () => { - tidioChatApi.open(); - }); - } -})(); diff --git a/static/js/third-party/fancybox.js b/static/js/third-party/fancybox.js deleted file mode 100644 index bb436ab..0000000 --- a/static/js/third-party/fancybox.js +++ /dev/null @@ -1,38 +0,0 @@ -document.addEventListener('page:loaded', () => { - - /** - * Wrap images with fancybox. - */ - document.querySelectorAll('.post-body :not(a) > img, .post-body > img').forEach(element => { - const $image = $(element); - const imageLink = $image.attr('data-src') || $image.attr('src'); - const $imageWrapLink = $image.wrap(``).parent('a'); - if ($image.is('.post-gallery img')) { - $imageWrapLink.attr('data-fancybox', 'gallery').attr('rel', 'gallery'); - } else if ($image.is('.group-picture img')) { - $imageWrapLink.attr('data-fancybox', 'group').attr('rel', 'group'); - } else { - $imageWrapLink.attr('data-fancybox', 'default').attr('rel', 'default'); - } - - const imageTitle = $image.attr('title') || $image.attr('alt'); - if (imageTitle) { - // Do not append image-caption if pandoc has already created a figcaption - if (!$imageWrapLink.next('figcaption').length) { - $imageWrapLink.append(`
${imageTitle}
`); - } - // Make sure img title tag will show correctly in fancybox - $imageWrapLink.attr('title', imageTitle).attr('data-caption', imageTitle); - } - }); - - $.fancybox.defaults.hash = false; - $('.fancybox').fancybox({ - loop : true, - helpers: { - overlay: { - locked: false - } - } - }); -}); diff --git a/static/js/third-party/google-translate.min.js b/static/js/third-party/google-translate.min.js deleted file mode 100644 index fd80e1b..0000000 --- a/static/js/third-party/google-translate.min.js +++ /dev/null @@ -1 +0,0 @@ -(function(){var gtConstEvalStartTime=new Date();var h=this||self,l=/^[\w+/_-]+[=]{0,2}$/,m=null;function n(a){return(a=a.querySelector&&a.querySelector("script[nonce]"))&&(a=a.nonce||a.getAttribute("nonce"))&&l.test(a)?a:""}function p(a,b){function c(){}c.prototype=b.prototype;a.i=b.prototype;a.prototype=new c;a.prototype.constructor=a;a.h=function(g,f,k){for(var e=Array(arguments.length-2),d=2;d