From 39ae05549159e6d56459c9e7dfa4ea4573eb8ab1 Mon Sep 17 00:00:00 2001 From: Meekdai Date: Fri, 19 Jul 2024 14:29:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=B8=8D=E8=92=9C=E5=AD=90?= =?UTF-8?q?=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/GmeekBSZ.js | 32 ++++++++++++++++++++++++++++++++ plugins/GmeekTOC.js | 1 + templates/base.html | 2 +- 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 plugins/GmeekBSZ.js diff --git a/plugins/GmeekBSZ.js b/plugins/GmeekBSZ.js new file mode 100644 index 0000000..0a33ec1 --- /dev/null +++ b/plugins/GmeekBSZ.js @@ -0,0 +1,32 @@ +function loadResource(type, attributes, callback) { + var element; + if (type === 'script') { + element = document.createElement('script'); + element.src = attributes.src; + element.onload = callback; + } else if (type === 'link') { + element = document.createElement('link'); + element.rel = attributes.rel; + element.href = attributes.href; + } else if (type === 'style') { + element = document.createElement('style'); + element.rel = 'stylesheet'; + element.appendChild(document.createTextNode(attributes.css)); + } + document.head.appendChild(element); +} + +function createBSZ() { + var postBody = document.getElementById('postBody'); + if (postBody){ + postBody.insertAdjacentHTML('afterend',''); + } + var runday = document.getElementById('runday'); + runday.insertAdjacentHTML('afterend', ''); +} + +document.addEventListener("DOMContentLoaded", function() { + createBSZ(); + loadResource('script', { src: '//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js' }); + console.log("\n %c GmeekBSZ Plugins https://github.com/Meekdai/Gmeek \n","padding:5px 0;background:#bc4c00;color:#fff"); +}); diff --git a/plugins/GmeekTOC.js b/plugins/GmeekTOC.js index d076779..4ba9551 100644 --- a/plugins/GmeekTOC.js +++ b/plugins/GmeekTOC.js @@ -55,4 +55,5 @@ document.addEventListener("DOMContentLoaded", function() { var footerPlaceholder = document.createElement('div'); footerPlaceholder.style.height = window.innerHeight + 'px'; document.body.appendChild(footerPlaceholder); + console.log("\n %c GmeekTOC Plugins https://github.com/Meekdai/Gmeek \n","padding:5px 0;background:#C333D0;color:#fff"); }); diff --git a/templates/base.html b/templates/base.html index 5066103..7d8fabe 100644 --- a/templates/base.html +++ b/templates/base.html @@ -57,7 +57,7 @@ function utterancesTheme(theme){ } if(themeSettings[theme]){changeTheme(...themeSettings[theme]);} {%- endif %} -console.log("\n %c Gmeek {{ blogBase['GMEEK_VERSION'] }} https://github.com/Meekdai/Gmeek \n\n","padding:5px 0;background:#02d81d;color:#fff"); +console.log("\n %c Gmeek {{ blogBase['GMEEK_VERSION'] }} https://github.com/Meekdai/Gmeek \n","padding:5px 0;background:#02d81d;color:#fff"); {% block script %}{% endblock %}