@@ -113,4 +113,68 @@ module.exports = [
113113 document.write("<s"+"cript defer='defer' type='text/javascript' src='https://analytics.numpy.org.cn/public/ad.js?"+Math.random()+"'></scr"+"ipt>");
114114 })();
115115` ] ,
116+ // 屏蔽评论
117+ [ 'script' , { } , `
118+ (function () {
119+ let styleContent = \`
120+ .forum-tips {
121+ position: absolute;
122+ left: 0px;
123+ top: 0px;
124+ width: 100%;
125+ height: 100%;
126+ background-color: rgba(255, 255, 255, 0.92);
127+ display: flex;
128+ justify-content: center;
129+ align-items: center;
130+ z-index: 100;
131+ }
132+ \`
133+ let divContent = \`
134+ <a href="https://www.kuxai.com/f/numpy" target="_blank">
135+ 评论系统已退役,点击进入<b>Numpy中文社区</b>,体验功能更强大的交流社区。
136+ </a>
137+ \`
138+ function asyncQuerySelector(selector, callback) {
139+ let el = '';
140+ let timer = window.setInterval(function() {
141+ el = document.querySelector(selector);
142+ if (el) {
143+ window.clearInterval(timer);
144+ callback(el);
145+ }
146+ });
147+ }
148+ function init() {
149+ asyncQuerySelector('#valine-vuepress-comment > .vwrap', function (parentNode) {
150+ if (!document.querySelector('.forum-tips')) {
151+ let newStyle = document.createElement('style');
152+ newStyle.innerHTML = styleContent;
153+ parentNode.appendChild(newStyle);
154+ let newDiv = document.createElement('div');
155+ newDiv.className = 'forum-tips';
156+ newDiv.innerHTML = divContent;
157+ parentNode.appendChild(newDiv);
158+ }
159+ });
160+ }
161+ document.addEventListener('readystatechange', function (e) {
162+ if (document.readyState == 'complete') {
163+ init();
164+ }
165+ });
166+ (function() {
167+ var url1 = window.location.href;
168+ var url2 = window.location.href;
169+ setInterval(function() {
170+ if (url1 === url2) {
171+ url2 = window.location.href;
172+ } else {
173+ url1 = url2;
174+ init();
175+ }
176+ }, 200);
177+ })();
178+ })();
179+ ` ]
116180]
0 commit comments