Skip to content

Commit 89076b0

Browse files
committed
update copyright & rm disqus ads
1 parent 798c65a commit 89076b0

File tree

4 files changed

+46
-17
lines changed

4 files changed

+46
-17
lines changed

material/assets/javascripts/jquery-latest.min.js

+4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

material/base.html

+18
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,24 @@
6969
{% endblock %}
7070
{% block disqus_js %}
7171
{% if config.extra.disqus and not page.is_homepage %}
72+
<!--rm disqus ad refer to https://www.javaer101.com/article/25891160.html-->
73+
<script src="{{ base_url }}/assets/javascripts/jquery-latest.min.js"></script>
74+
<script>
75+
(function($){
76+
setInterval(() => {
77+
$.each($('iframe'), (arr,x) => {
78+
let src = $(x).attr('src');
79+
if (src && src.match(/(ads-iframe)|(disqusads)/gi)) {
80+
$(x).remove();
81+
}
82+
let title = $(x).attr('title');
83+
if (!src && title == "Disqus") {
84+
$(x).remove();
85+
}
86+
});
87+
}, 300);
88+
})(jQuery);
89+
</script>
7290
{% endif %}
7391
{% endblock %}
7492
{% block fonts %}
+23-16
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,10 @@
1-
<div id="disqus_thread"></div>
2-
<script>
3-
var disqus_config = function () {
4-
this.page.url = "{{ page.canonical_url }}";
5-
this.page.identifier =
6-
"{{ page.canonical_url | replace(config.site_url, "") }}";
7-
};
8-
(function() {
9-
var d = document, s = d.createElement("script");
10-
s.src = "//{{ config.extra.disqus }}.disqus.com/embed.js";
11-
s.setAttribute("data-timestamp", +new Date());
12-
(d.head || d.body).appendChild(s);
13-
})();
14-
</script>
15-
161
<script src="https://giscus.app/client.js"
172
data-repo="szcf-weiya/ESL-CN"
183
data-repo-id="MDEwOlJlcG9zaXRvcnk2OTYyNTgzOA=="
194
data-category="评论区"
205
data-category-id="DIC_kwDOBCZn7s4ChHU6"
216
data-mapping="pathname"
22-
data-strict="0"
7+
data-strict="1"
238
data-reactions-enabled="1"
249
data-emit-metadata="0"
2510
data-input-position="bottom"
@@ -28,3 +13,25 @@
2813
crossorigin="anonymous"
2914
async>
3015
</script>
16+
17+
18+
<div id="disqus_thread"></div>
19+
<script>
20+
if (window.location.hostname !== "localhost" && window.location.hostname !== "127.0.0.1") {
21+
var disqus_config = function () {
22+
this.page.url = "{{ page.canonical_url }}";
23+
this.page.identifier =
24+
"{{ page.canonical_url | replace(config.site_url, "") }}";
25+
};
26+
(function() {
27+
var d = document, s = d.createElement("script");
28+
s.src = "//{{ config.extra.disqus }}.disqus.com/embed.js";
29+
s.setAttribute("data-timestamp", +new Date());
30+
(d.head || d.body).appendChild(s);
31+
})();
32+
} else {
33+
console.log("Disqus is disabled on localhost.");
34+
}
35+
</script>
36+
37+

mkdocs.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ edit_uri: edit/master/docs/
241241

242242
#website_cn: 随笔
243243

244-
copyright: 'Copyright &copy; 2016-2024 weiya'
244+
copyright: 'Copyright &copy; 2016-2025 weiya'
245245

246246
markdown_extensions:
247247
- admonition

0 commit comments

Comments
 (0)