From a23cfe26bee27ebbe442784125af349dac3d2974 Mon Sep 17 00:00:00 2001 From: Meekdai Date: Fri, 19 Jul 2024 15:06:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0allHead=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=EF=BC=8C=E7=94=A8=E4=BA=8E=E8=87=AA=E5=AE=9A=E4=B9=89=E6=89=80?= =?UTF-8?q?=E6=9C=89=E9=A1=B5=E9=9D=A2=E7=9A=84head=E6=A0=87=E7=AD=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gmeek.py | 2 +- plugins/GmeekBSZ.js | 24 ++++-------------------- templates/base.html | 1 + templates/footer.html | 4 ++-- 4 files changed, 8 insertions(+), 23 deletions(-) diff --git a/Gmeek.py b/Gmeek.py index f72f06a..27f4493 100644 --- a/Gmeek.py +++ b/Gmeek.py @@ -88,7 +88,7 @@ class GMEEK(): def defaultConfig(self): - dconfig={"singlePage":[],"startSite":"","filingNum":"","onePageListNum":15,"commentLabelColor":"#006b75","yearColorList":["#bc4c00", "#0969da", "#1f883d", "#A333D0"],"i18n":"CN","themeMode":"manual","dayTheme":"light","nightTheme":"dark","urlMode":"pinyin","script":"","style":"","indexScript":"","indexStyle":"","bottomText":"","showPostSource":1,"iconList":{},"UTC":+8,"rssSplit":"sentence","exlink":{},"needComment":1} + dconfig={"singlePage":[],"startSite":"","filingNum":"","onePageListNum":15,"commentLabelColor":"#006b75","yearColorList":["#bc4c00", "#0969da", "#1f883d", "#A333D0"],"i18n":"CN","themeMode":"manual","dayTheme":"light","nightTheme":"dark","urlMode":"pinyin","script":"","style":"","indexScript":"","indexStyle":"","bottomText":"","showPostSource":1,"iconList":{},"UTC":+8,"rssSplit":"sentence","exlink":{},"needComment":1,"allHead":""} config=json.loads(open('config.json', 'r', encoding='utf-8').read()) self.blogBase={**dconfig,**config}.copy() self.blogBase["postListJson"]=json.loads('{}') diff --git a/plugins/GmeekBSZ.js b/plugins/GmeekBSZ.js index 0a33ec1..0cebe23 100644 --- a/plugins/GmeekBSZ.js +++ b/plugins/GmeekBSZ.js @@ -1,25 +1,7 @@ -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',''); + postBody.insertAdjacentHTML('afterend',''); } var runday = document.getElementById('runday'); runday.insertAdjacentHTML('afterend', ''); @@ -27,6 +9,8 @@ function createBSZ() { document.addEventListener("DOMContentLoaded", function() { createBSZ(); - loadResource('script', { src: '//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js' }); + var element = document.createElement('script'); + element.src = '//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js'; + document.head.appendChild(element); console.log("\n %c GmeekBSZ Plugins https://github.com/Meekdai/Gmeek \n","padding:5px 0;background:#bc4c00;color:#fff"); }); diff --git a/templates/base.html b/templates/base.html index 7d8fabe..bbc01b1 100644 --- a/templates/base.html +++ b/templates/base.html @@ -5,6 +5,7 @@ {{ blogBase['primerCSS'] }} + {{ blogBase['allHead'] }} {%- if blogBase['themeMode']=='manual' -%}