webxc 1.0.11 → 1.0.13

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.
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/css/mg.js ADDED
@@ -0,0 +1,75 @@
1
+ /** 复制提示 监听copy事件 */
2
+ document.addEventListener("copy", function(e) {
3
+ //复制的内容
4
+ btf.snackbarShow('复制成功,请遵循GPL协议', false, 3000)
5
+ })
6
+ // F12提示 检测按键
7
+ window.onkeydown = function(e) {
8
+ if (e.keyCode === 123) {
9
+ btf.snackbarShow('开发者模式已打开,请遵循GPL协议', false, 3000)
10
+ }
11
+ }
12
+ // 返回顶部 显示网页阅读进度
13
+ window.onscroll = percent; // 执行函数
14
+ // 页面百分比
15
+ function percent() {
16
+ let a = document.documentElement.scrollTop || window.pageYOffset, // 卷去高度
17
+ b =
18
+ Math.max(
19
+ document.body.scrollHeight,
20
+ document.documentElement.scrollHeight,
21
+ document.body.offsetHeight,
22
+ document.documentElement.offsetHeight,
23
+ document.body.clientHeight,
24
+ document.documentElement.clientHeight
25
+ ) - document.documentElement.clientHeight, // 整个网页高度 减去 可视高度
26
+ result = Math.round((a / b) * 100), // 计算百分比
27
+ btn = document.querySelector("#percent"); // 获取图标
28
+
29
+ result <= 99 || (result = 99), (btn.innerHTML = result);
30
+ }
31
+
32
+ document.getElementById("page-name").innerText = document.title.split(" | XC's Blog")[0];
33
+ window.onscroll = percent; // 执行函数
34
+ // 页面百分比
35
+ function percent() {
36
+ let a = document.documentElement.scrollTop || window.pageYOffset, // 卷去高度
37
+ b =
38
+ Math.max(
39
+ document.body.scrollHeight,
40
+ document.documentElement.scrollHeight,
41
+ document.body.offsetHeight,
42
+ document.documentElement.offsetHeight,
43
+ document.body.clientHeight,
44
+ document.documentElement.clientHeight
45
+ ) - document.documentElement.clientHeight, // 整个网页高度
46
+ result = Math.round((a / b) * 100), // 计算百分比
47
+ up = document.querySelector("#go-up"); // 获取按钮
48
+
49
+ if (result <= 95) {
50
+ up.childNodes[0].style.display = "none";
51
+ up.childNodes[1].style.display = "block";
52
+ up.childNodes[1].innerHTML = result;
53
+ } else {
54
+ up.childNodes[1].style.display = "none";
55
+ up.childNodes[0].style.display = "block";
56
+ }
57
+ }
58
+ //切换夜间
59
+ function switchDarkMode() {
60
+ const nowMode = document.documentElement.getAttribute('data-theme') === 'dark' ? 'dark' : 'light'
61
+ if (nowMode === 'light') {
62
+ activateDarkMode()
63
+ saveToLocal.set('theme', 'dark', 2)
64
+ GLOBAL_CONFIG.Snackbar !== undefined && btf.snackbarShow(GLOBAL_CONFIG.Snackbar.day_to_night)
65
+ } else {
66
+ activateLightMode()
67
+ saveToLocal.set('theme', 'light', 2)
68
+ GLOBAL_CONFIG.Snackbar !== undefined && btf.snackbarShow(GLOBAL_CONFIG.Snackbar.night_to_day)
69
+ }
70
+ // handle some cases
71
+ typeof utterancesTheme === 'function' && utterancesTheme()
72
+ typeof changeGiscusTheme === 'function' && changeGiscusTheme()
73
+ typeof FB === 'object' && window.loadFBComment()
74
+ typeof runMermaid === 'function' && window.runMermaid()
75
+ }