Skip to content

Commit a23cfe2

Browse files
committed
添加allHead配置,用于自定义所有页面的head标签
1 parent 1bb985b commit a23cfe2

File tree

4 files changed

+8
-23
lines changed

4 files changed

+8
-23
lines changed

Gmeek.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def cleanFile(self):
8888

8989

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

plugins/GmeekBSZ.js

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,16 @@
1-
function loadResource(type, attributes, callback) {
2-
var element;
3-
if (type === 'script') {
4-
element = document.createElement('script');
5-
element.src = attributes.src;
6-
element.onload = callback;
7-
} else if (type === 'link') {
8-
element = document.createElement('link');
9-
element.rel = attributes.rel;
10-
element.href = attributes.href;
11-
} else if (type === 'style') {
12-
element = document.createElement('style');
13-
element.rel = 'stylesheet';
14-
element.appendChild(document.createTextNode(attributes.css));
15-
}
16-
document.head.appendChild(element);
17-
}
18-
191
function createBSZ() {
202
var postBody = document.getElementById('postBody');
213
if (postBody){
22-
postBody.insertAdjacentHTML('afterend','<div id="busuanzi_container_page_pv" style="display:none;float:left;margin-top:8px;font-size:small;">本文浏览量 <span id="busuanzi_value_page_pv"></span>次</div>');
4+
postBody.insertAdjacentHTML('afterend','<div id="busuanzi_container_page_pv" style="display:none;float:left;margin-top:8px;font-size:small;">本文浏览量<span id="busuanzi_value_page_pv"></span>次</div>');
235
}
246
var runday = document.getElementById('runday');
257
runday.insertAdjacentHTML('afterend', '<div id="busuanzi_container_site_pv" style="display:none;">总浏览量<span id="busuanzi_value_site_pv"></span>次 • </div>');
268
}
279

2810
document.addEventListener("DOMContentLoaded", function() {
2911
createBSZ();
30-
loadResource('script', { src: '//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js' });
12+
var element = document.createElement('script');
13+
element.src = '//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js';
14+
document.head.appendChild(element);
3115
console.log("\n %c GmeekBSZ Plugins https://github.com/Meekdai/Gmeek \n","padding:5px 0;background:#bc4c00;color:#fff");
3216
});

templates/base.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<meta name="viewport" content="width=device-width,initial-scale=1.0">
66
<meta http-equiv="X-UA-Compatible" content="IE=edge">
77
{{ blogBase['primerCSS'] }}
8+
{{ blogBase['allHead'] }}
89
<link rel="icon" href="{{ blogBase['faviconUrl'] }}">
910
{%- if blogBase['themeMode']=='manual' -%}
1011
<script>

templates/footer.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<div id="footer1">Copyright © <span id="copyrightYear"></span> <a href="{{ blogBase['homeUrl'] }}">{{ blogBase['title'] }}</a></div>
22
<div id="footer2">
33
{%- if blogBase['filingNum']!='' -%}
4-
<span id="filingNum"><a href="https://beian.miit.gov.cn/" target="_blank">{{ blogBase['filingNum'] }}</a></span>
4+
<span id="filingNum"><a href="https://beian.miit.gov.cn/" target="_blank">{{ blogBase['filingNum'] }}</a></span>
55
{%- endif %}
6-
<span id="runday"></span>Powered by <a href="https://meekdai.com/Gmeek.html" target="_blank">Gmeek</a>
6+
<span id="runday"></span><span>Powered by <a href="https://meekdai.com/Gmeek.html" target="_blank">Gmeek</a></span>
77
</div>
88

99
<script>

0 commit comments

Comments
 (0)