添加allHead配置,用于自定义所有页面的head标签

This commit is contained in:
Meekdai 2024-07-19 15:06:27 +08:00
parent 1bb985b92e
commit a23cfe26be
4 changed files with 8 additions and 23 deletions

View File

@ -88,7 +88,7 @@ class GMEEK():
def defaultConfig(self): 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()) config=json.loads(open('config.json', 'r', encoding='utf-8').read())
self.blogBase={**dconfig,**config}.copy() self.blogBase={**dconfig,**config}.copy()
self.blogBase["postListJson"]=json.loads('{}') self.blogBase["postListJson"]=json.loads('{}')

View File

@ -1,21 +1,3 @@
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() { function createBSZ() {
var postBody = document.getElementById('postBody'); var postBody = document.getElementById('postBody');
if (postBody){ if (postBody){
@ -27,6 +9,8 @@ function createBSZ() {
document.addEventListener("DOMContentLoaded", function() { document.addEventListener("DOMContentLoaded", function() {
createBSZ(); 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"); console.log("\n %c GmeekBSZ Plugins https://github.com/Meekdai/Gmeek \n","padding:5px 0;background:#bc4c00;color:#fff");
}); });

View File

@ -5,6 +5,7 @@
<meta name="viewport" content="width=device-width,initial-scale=1.0"> <meta name="viewport" content="width=device-width,initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
{{ blogBase['primerCSS'] }} {{ blogBase['primerCSS'] }}
{{ blogBase['allHead'] }}
<link rel="icon" href="{{ blogBase['faviconUrl'] }}"> <link rel="icon" href="{{ blogBase['faviconUrl'] }}">
{%- if blogBase['themeMode']=='manual' -%} {%- if blogBase['themeMode']=='manual' -%}
<script> <script>

View File

@ -1,9 +1,9 @@
<div id="footer1">Copyright © <span id="copyrightYear"></span> <a href="{{ blogBase['homeUrl'] }}">{{ blogBase['title'] }}</a></div> <div id="footer1">Copyright © <span id="copyrightYear"></span> <a href="{{ blogBase['homeUrl'] }}">{{ blogBase['title'] }}</a></div>
<div id="footer2"> <div id="footer2">
{%- if blogBase['filingNum']!='' -%} {%- if blogBase['filingNum']!='' -%}
<span id="filingNum"><a href="https://beian.miit.gov.cn/" target="_blank">{{ blogBase['filingNum'] }}</a></span> <span id="filingNum"><a href="https://beian.miit.gov.cn/" target="_blank">{{ blogBase['filingNum'] }}</a></span>
{%- endif %} {%- endif %}
<span id="runday"></span>Powered by <a href="https://meekdai.com/Gmeek.html" target="_blank">Gmeek</a> <span id="runday"></span><span>Powered by <a href="https://meekdai.com/Gmeek.html" target="_blank">Gmeek</a></span>
</div> </div>
<script> <script>