@xiee/utils 1.1.13 → 1.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/js/center-img.js +5 -0
- package/js/custom-disqus.js +16 -0
- package/package.json +1 -1
package/js/center-img.js
CHANGED
|
@@ -27,4 +27,9 @@
|
|
|
27
27
|
for (var i = 0; i < tagNames.length; i++) {
|
|
28
28
|
center_el(tagNames[i]);
|
|
29
29
|
}
|
|
30
|
+
// also center paragraphs that contain `* * *`
|
|
31
|
+
var ps = document.getElementsByTagName('p');
|
|
32
|
+
for (var i = 0; i < ps.length; i++) {
|
|
33
|
+
if (ps[i].innerText === '* * *') ps[i].style.textAlign = 'center';
|
|
34
|
+
};
|
|
30
35
|
})();
|
package/js/custom-disqus.js
CHANGED
|
@@ -77,6 +77,22 @@
|
|
|
77
77
|
selectTab2();
|
|
78
78
|
};
|
|
79
79
|
};
|
|
80
|
+
s.onload = function(e) {
|
|
81
|
+
// if Disqus comment count is zero, just get rid of the Disqus tab
|
|
82
|
+
var dc = d.getElementById('disqus_count');
|
|
83
|
+
if (!dc) return;
|
|
84
|
+
var s3 = d.createElement('script');
|
|
85
|
+
s3.src = '//yihui.disqus.com/count.js';
|
|
86
|
+
s3.id = 'dsq-count-scr';
|
|
87
|
+
t.appendChild(s3);
|
|
88
|
+
new MutationObserver(() => {
|
|
89
|
+
if (dc.innerText == '' || dc.innerText > 0) return;
|
|
90
|
+
selectTab2(); loadScript();
|
|
91
|
+
a.append(a.querySelector('#tab-2 ~ .panel'));
|
|
92
|
+
a.querySelector('.tabs').remove();
|
|
93
|
+
a.querySelector('.panel').style.display = 'block';
|
|
94
|
+
}).observe(dc, {characterData: true, childList: true});
|
|
95
|
+
};
|
|
80
96
|
// show comments when the hash means to jump to a comment
|
|
81
97
|
if (location.hash.match(/^#comment-[0-9]+$/)) return l(true);
|
|
82
98
|
var c = function() {
|