webxc 1.0.12 → 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.
package/css/mg.js CHANGED
@@ -1,64 +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
+ }
1
12
  // 返回顶部 显示网页阅读进度
2
13
  window.onscroll = percent; // 执行函数
3
14
  // 页面百分比
4
15
  function percent() {
5
- let a = document.documentElement.scrollTop || window.pageYOffset, // 卷去高度
6
- b =
7
- Math.max(
8
- document.body.scrollHeight,
9
- document.documentElement.scrollHeight,
10
- document.body.offsetHeight,
11
- document.documentElement.offsetHeight,
12
- document.body.clientHeight,
13
- document.documentElement.clientHeight
14
- ) - document.documentElement.clientHeight, // 整个网页高度 减去 可视高度
15
- result = Math.round((a / b) * 100), // 计算百分比
16
- btn = document.querySelector("#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"); // 获取图标
17
28
 
18
- result <= 99 || (result = 99), (btn.innerHTML = result);
29
+ result <= 99 || (result = 99), (btn.innerHTML = result);
19
30
  }
20
31
 
21
32
  document.getElementById("page-name").innerText = document.title.split(" | XC's Blog")[0];
22
33
  window.onscroll = percent; // 执行函数
23
34
  // 页面百分比
24
35
  function percent() {
25
- let a = document.documentElement.scrollTop || window.pageYOffset, // 卷去高度
26
- b =
27
- Math.max(
28
- document.body.scrollHeight,
29
- document.documentElement.scrollHeight,
30
- document.body.offsetHeight,
31
- document.documentElement.offsetHeight,
32
- document.body.clientHeight,
33
- document.documentElement.clientHeight
34
- ) - document.documentElement.clientHeight, // 整个网页高度
35
- result = Math.round((a / b) * 100), // 计算百分比
36
- up = document.querySelector("#go-up"); // 获取按钮
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"); // 获取按钮
37
48
 
38
- if (result <= 95) {
39
- up.childNodes[0].style.display = "none";
40
- up.childNodes[1].style.display = "block";
41
- up.childNodes[1].innerHTML = result;
42
- } else {
43
- up.childNodes[1].style.display = "none";
44
- up.childNodes[0].style.display = "block";
45
- }
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
+ }
46
57
  }
47
58
  //切换夜间
48
- function switchDarkMode(){
49
- const nowMode = document.documentElement.getAttribute('data-theme') === 'dark' ? 'dark' : 'light'
50
- if (nowMode === 'light') {
51
- activateDarkMode()
52
- saveToLocal.set('theme', 'dark', 2)
53
- GLOBAL_CONFIG.Snackbar !== undefined && btf.snackbarShow(GLOBAL_CONFIG.Snackbar.day_to_night)
54
- } else {
55
- activateLightMode()
56
- saveToLocal.set('theme', 'light', 2)
57
- GLOBAL_CONFIG.Snackbar !== undefined && btf.snackbarShow(GLOBAL_CONFIG.Snackbar.night_to_day)
58
- }
59
- // handle some cases
60
- typeof utterancesTheme === 'function' && utterancesTheme()
61
- typeof changeGiscusTheme === 'function' && changeGiscusTheme()
62
- typeof FB === 'object' && window.loadFBComment()
63
- typeof runMermaid === 'function' && window.runMermaid()
64
- }
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
+ }
File without changes
package/css/mg2.css ADDED
@@ -0,0 +1 @@
1
+ .loading-img{background:url(https://npm.elemecdn.com/webxc@1.0.0/logo/logo.jpg) no-repeat center center;background-size:cover;}#content-inner .layout h1:hover,#content-inner.layout h2:hover,#content-inner.layout h3:hover,#content-inner.layout h4:hover,#content-inner.layout h5:hover,#content-inner.layout h6:hover{color:#21D4FD;background:linear-gradient(30deg,#21D4FD,#B721FF);-webkit-background-clip:text;-webkit-text-fill-color:transparent;}#article-container .flink .flink-list>.flink-list-item:hover{-webkit-transform:scale(0.95);transform:scale(0.95);}#article-container .flink .flink-list>.flink-list-item{transition:.5s;}#article-container .flink .flink-list>.flink-list-item:hover .flink-item-icon{-webkit-transform:rotate(360deg) !important;transform:rotate(360deg) !important;}#article-container .flink .flink-list>.flink-list-item a .flink-item-icon{box-shadow:0px 0px 0px #fff !important;}#nav #site-name,#nav .site-page{text-shadow:0px 0px 0px #fff;}[data-theme='dark'] #rightside > div > button,[data-theme='dark'] #rightside > div > a{background:#65626280;}.cardHover,.error404 #error-wrap .error-content,.layout > div:first-child:not(.recent-posts),#recent-posts > .recent-post-item,#aside-content .card-widget,.layout > .recent-posts .pagination > *:not(.space){transition:0s !important;}#nav{transition:0s !important;}[data-theme='dark'] #footer-wrap,[data-theme='dark'] #footer-wrap a{color:#ffffffb3;}@media screen and (max-width:768px){#nav div#toggle-menu{padding-right:10px!important;}.menus_item ul li{margin-left:-55px;padding:6px 0px 0px 15px !important;}.layout #recent-posts>.recent-post-item:not(:first-child){border-bottom:1px dashed #abadb44a !important;}#article-container ol li,#article-container ul li{margin-left:7px;}#sidebar #sidebar-menus .menus_items .site-page.group>i:last-child{top:1.35em !important;right:25px !important;}#sidebar-menus.open>:nth-child(4),#sidebar-menus.open>:nth-child(2),#sidebar-menus.open>:nth-child(3){-webkit-animation:sidebarItem 0.7s!important;}.site-data>a .headline{font-weight:700;}.menus_item_child .iconfont{font-size:16px;}.post-content img{border-radius:30px;border:7px solid #aeaeae59;}#sidebar #sidebar-menus>.avatar-img{box-shadow:0px 0px 10px 2px #a181c1;}#page-header.post-bg:before{backdrop-filter:saturate(100%) blur(4px);}[data-theme=dark] #sidebar #menu-mask{background:#00000024 !important;}}#pagination .page-number,#pagination .space{display:none;}.layout>.recent-posts .pagination>:not(.space){border-radius:8px !important;background:#ffffff99 !important;transition:all .3s !important;width:300px !important;color:#4c4948;margin-bottom:10px;}.layout>div .pagination>:not(.space){border:1px solid #e0e3ed;}.layout>.recent-posts .pagination>*:not(.space):hover{color:#fff;background:#4976f5 !important;}.layout>div .pagination .next::before,.layout>div .pagination .prev::before{content:'下一页';}.layout>div .pagination .prev::before{content:'上一页';}[data-theme=dark] .layout>.recent-posts .pagination>:not(.space){color:#ffffffbd;background:#413c5754 !important;}[data-theme=dark] .layout>div .pagination>:not(.space){border-color:#707070 !important;}[data-theme=dark] .layout>.recent-posts .pagination>*:not(.space):hover{background:#817aa254 !important;}#aside-content>.card-widget.card-info{background:linear-gradient(-45deg,#e8d8b9,#eccec5,#a3e9eb,#bdbdf0,#eec1ea);box-shadow:0 0 5px rgb(66,68,68);position:relative;background-size:400% 400%;-webkit-animation:Gradient 10s ease infinite;-moz-animation:Gradient 10s ease infinite;animation:Gradient 10s ease infinite !important;}@-webkit-keyframes Gradient{0%{background-position:0% 50%;}50%{background-position:100% 50%;}100%{background-position:0% 50%;}}@-moz-keyframes Gradient{0%{background-position:0% 50%;}50%{background-position:100% 50%;}100%{background-position:0% 50%;}}@keyframes Gradient{0%{background-position:0% 50%;}50%{background-position:100% 50%;}100%{background-position:0% 50%;}}[data-theme="dark"] #aside-content>.card-widget.card-info{background:#1d1b26;}#aside-content>.card-widget.card-info>#card-info-btn{background-color:#3eb8be;border-radius:8px;}.snackbar-container{background:var(--heo-main) !important;color:var(--heo-white) !important;border-radius:0 !important;display:flex;justify-content:center !important;max-width:none !important;min-width:100% !important;margin:0px !important;left:0px !important;height:40px !important;transform:none !important;}.snackbar-container p{font-weight:bold !important;text-align:center !important;font-size:0.8rem !important;display:flex !important;justify-content:center !important;}.snackbar-container .action{color:var(--heo-white) !important;padding:4px 6px !important;font-weight:bold;border-radius:8px !important;transition:0.3s;border:var(--style-border) !important;}.snackbar-container .action:hover{color:var(--heo-main) !important;background:var(--heo-white) !important;}.snackbar-container::after{position:absolute;width:0;height:100%;left:0;top:0;background:var(--heo-white);opacity:0.1;content:"";animation:snackbar-progress 2s linear forwards;pointer-events:none;}@keyframes snackbar-progress{from{width:0;}to{width:100%;}}.list-beauty li:before,.category-lists ul li:before{display:none;}#search-mask{backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);background:var(--heo-maskbg);}.tk-expand[data-v-d82ce9a0]{margin-bottom:10px;}#twikoo .tk-content{background:rgb(235 235 235 / 60%);box-shadow:inset 0px 0px 3px 1px #9f9f9f30;padding:10px 15px;border-radius:10px}#twikoo .tk-content:hover{background:rgb(235 235 235 / 60%);box-shadow:inset 0px 0px 3px 1px #3489ff87;padding:10px 15px;border-radius:10px}.tk-expand,.tk-comments-container>.tk-comment,.tk-submit:nth-child(1){background:var(--card-bg);border:1px solid #e0e3ed;box-shadow:0 5px 10px rgb(189 189 189 / 10%);transition:all .3s ease-in-out;border-radius:12px;}.tk-extras[data-v-d82ce9a0]{margin-top:10px;padding-bottom:15px;}.tk-expand,.tk-comments-container>.tk-comment,.tk-submit:nth-child(1){padding:10px 10px 0px 10px;}[data-theme='dark'] .tk-comments-container>.tk-comment,[data-theme='dark'] #twikoo .tk-content,[data-theme='dark'] .tk-expand,[data-theme='dark'] .tk-submit:nth-child(1){background:#1d1b26;}[data-theme='dark'] .tk-comments-container>.tk-comment,[data-theme='dark'] .tk-expand,[data-theme='dark'] .tk-submit:nth-child(1){border-color:#42444a;}[data-theme='dark'] .tk-comments-container>.tk-comment{box-shadow:0px 0px 0px #ffffff00;}[data-theme='dark'] #twikoo .tk-content,[data-theme='dark'] .tk-expand,[data-theme='dark'] .tk-submit:nth-child(1){box-shadow:inset 0px 0px 0px 1px #42444a;}[data-theme='dark'] #twikoo .tk-content:hover{box-shadow:inset 0px 0px 3px 1px #5f8ecf87;}@media screen and (min-width:980px){#aside-content #card-toc .toc-content .toc-link.active{line-height:1.2;border-radius:12px;border-left-color:var(--heo-hovertext);background-color:var(--heo-card-bg);color:var(--heo-lighttext);font-weight:bold;font-size:20px;}[data-theme=dark].toc .toc-item.active .toc-link .toc-text{color:var(--heo-white);}#aside-content #card-toc .toc-content .toc-item.active .toc-link{opacity:1;border-radius:8px;}#aside-content #card-toc .toc-content .toc-link{line-height:1.2;padding:8px;border-left:0px solid transparent;border-radius:12px;color:var(--heo-secondtext);cursor:default;}#aside-content #card-toc .toc-content .toc-link:not(.active) span{opacity:0.6;cursor:pointer;filter:blur(1px);transition:0.3s;}#aside-content #card-toc:hover .toc-content .toc-link:not(.active) span{filter:blur(0px);opacity:1;}#aside-content #card-toc .toc-content .toc-link:not(.active) span:hover{color:var(--heo-lighttext);}}.loading-img{background:url(https://npm.elemecdn.com/webxc@1.0.0/logo/logo.jpg) no-repeat center center;background-size:cover;}#content-inner .layout h1:hover,#content-inner.layout h2:hover,#content-inner.layout h3:hover,#content-inner.layout h4:hover,#content-inner.layout h5:hover,#content-inner.layout h6:hover{color:#21D4FD;background:linear-gradient(30deg,#21D4FD,#B721FF);-webkit-background-clip:text;-webkit-text-fill-color:transparent;}#article-container .flink .flink-list>.flink-list-item:hover{-webkit-transform:scale(0.95);transform:scale(0.95);}#article-container .flink .flink-list>.flink-list-item{transition:.5s;}#article-container .flink .flink-list>.flink-list-item:hover .flink-item-icon{-webkit-transform:rotate(360deg) !important;transform:rotate(360deg) !important;}#article-container .flink .flink-list>.flink-list-item a .flink-item-icon{box-shadow:0px 0px 0px #fff !important;}#nav #site-name,#nav .site-page{text-shadow:0px 0px 0px #fff;}[data-theme='dark'] #rightside > div > button,[data-theme='dark'] #rightside > div > a{background:#65626280;}.cardHover,.error404 #error-wrap .error-content,.layout > div:first-child:not(.recent-posts),#recent-posts > .recent-post-item,#aside-content .card-widget,.layout > .recent-posts .pagination > *:not(.space){transition:0s !important;}#nav{transition:0s !important;}[data-theme='dark'] #footer-wrap,[data-theme='dark'] #footer-wrap a{color:#ffffffb3;}@media screen and (max-width:768px){#nav div#toggle-menu{padding-right:10px;}.menus_item ul li{margin-left:-55px;padding:6px 0px 0px 15px !important;}.layout #recent-posts>.recent-post-item:not(:first-child){border-bottom:1px dashed #abadb44a !important;}#article-container ol li,#article-container ul li{margin-left:7px;}#sidebar #sidebar-menus .menus_items .site-page.group>i:last-child{top:1.35em !important;right:25px !important;}#sidebar-menus.open>:nth-child(4),#sidebar-menus.open>:nth-child(2),#sidebar-menus.open>:nth-child(3){-webkit-animation:sidebarItem 0.7s;}.site-data>a .headline{font-weight:700;}.menus_item_child .iconfont{font-size:16px;}.post-content img{border-radius:30px;border:7px solid #aeaeae59;}#sidebar #sidebar-menus>.avatar-img{box-shadow:0px 0px 10px 2px #a181c1;}#page-header.post-bg:before{backdrop-filter:saturate(100%) blur(4px);}[data-theme=dark] #sidebar #menu-mask{background:#00000024 !important;}}#pagination .page-number,#pagination .space{display:none;}.layout>.recent-posts .pagination>:not(.space){border-radius:8px !important;background:#ffffff99 !important;transition:all .3s !important;width:300px !important;color:#4c4948;margin-bottom:10px;}.layout>div .pagination>:not(.space){border:1px solid #e0e3ed;}.layout>.recent-posts .pagination>*:not(.space):hover{color:#fff;background:#4976f5 !important;}.layout>div .pagination .next::before,.layout>div .pagination .prev::before{content:'下一页';}.layout>div .pagination .prev::before{content:'上一页';}[data-theme=dark] .layout>.recent-posts .pagination>:not(.space){color:#ffffffbd;background:#413c5754 !important;}[data-theme=dark] .layout>div .pagination>:not(.space){border-color:#707070 !important;}[data-theme=dark] .layout>.recent-posts .pagination>*:not(.space):hover{background:#817aa254 !important;}#aside-content>.card-widget.card-info{background:linear-gradient(-45deg,#e8d8b9,#eccec5,#a3e9eb,#bdbdf0,#eec1ea);box-shadow:0 0 5px rgb(66,68,68);position:relative;background-size:400% 400%;-webkit-animation:Gradient 10s ease infinite;-moz-animation:Gradient 10s ease infinite;animation:Gradient 10s ease infinite !important;}@-webkit-keyframes Gradient{0%{background-position:0% 50%;}50%{background-position:100% 50%;}100%{background-position:0% 50%;}}@-moz-keyframes Gradient{0%{background-position:0% 50%;}50%{background-position:100% 50%;}100%{background-position:0% 50%;}}@keyframes Gradient{0%{background-position:0% 50%;}50%{background-position:100% 50%;}100%{background-position:0% 50%;}}[data-theme="dark"] #aside-content>.card-widget.card-info{background:#1d1b26;}#aside-content>.card-widget.card-info>#card-info-btn{background-color:#3eb8be;border-radius:8px;}.snackbar-container{background:var(--heo-main) !important;color:var(--heo-white) !important;border-radius:0 !important;display:flex;justify-content:center !important;max-width:none !important;min-width:100% !important;margin:0px !important;left:0px !important;height:40px !important;transform:none !important;}.snackbar-container p{font-weight:bold !important;text-align:center !important;font-size:0.8rem !important;display:flex !important;justify-content:center !important;}.snackbar-container .action{color:var(--heo-white) !important;padding:4px 6px !important;font-weight:bold;border-radius:8px !important;transition:0.3s;border:var(--style-border) !important;}.snackbar-container .action:hover{color:var(--heo-main) !important;background:var(--heo-white) !important;}.snackbar-container::after{position:absolute;width:0;height:100%;left:0;top:0;background:var(--heo-white);opacity:0.1;content:"";animation:snackbar-progress 2s linear forwards;pointer-events:none;}@keyframes snackbar-progress{from{width:0;}to{width:100%;}}.list-beauty li:before,.category-lists ul li:before{display:none;}#search-mask{backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);background:var(--heo-maskbg);}.tk-expand[data-v-d82ce9a0]{margin-bottom:10px;}#twikoo .tk-content{background:rgb(235 235 235 / 60%);box-shadow:inset 0px 0px 3px 1px #9f9f9f30;padding:10px 15px;border-radius:10px}#twikoo .tk-content:hover{background:rgb(235 235 235 / 60%);box-shadow:inset 0px 0px 3px 1px #3489ff87;padding:10px 15px;border-radius:10px}.tk-expand,.tk-comments-container>.tk-comment,.tk-submit:nth-child(1){background:var(--card-bg);border:1px solid #e0e3ed;box-shadow:0 5px 10px rgb(189 189 189 / 10%);transition:all .3s ease-in-out;border-radius:12px;}.tk-extras[data-v-d82ce9a0]{margin-top:10px;padding-bottom:15px;}.tk-expand,.tk-comments-container>.tk-comment,.tk-submit:nth-child(1){padding:10px 10px 0px 10px;}[data-theme='dark'] .tk-comments-container>.tk-comment,[data-theme='dark'] #twikoo .tk-content,[data-theme='dark'] .tk-expand,[data-theme='dark'] .tk-submit:nth-child(1){background:#1d1b26;}[data-theme='dark'] .tk-comments-container>.tk-comment,[data-theme='dark'] .tk-expand,[data-theme='dark'] .tk-submit:nth-child(1){border-color:#42444a;}[data-theme='dark'] .tk-comments-container>.tk-comment{box-shadow:0px 0px 0px #ffffff00;}[data-theme='dark'] #twikoo .tk-content,[data-theme='dark'] .tk-expand,[data-theme='dark'] .tk-submit:nth-child(1){box-shadow:inset 0px 0px 0px 1px #42444a;}[data-theme='dark'] #twikoo .tk-content:hover{box-shadow:inset 0px 0px 3px 1px #5f8ecf87;}@media screen and (min-width:980px){#aside-content #card-toc .toc-content .toc-link.active{line-height:1.2;border-radius:12px;border-left-color:var(--heo-hovertext);background-color:var(--heo-card-bg);color:var(--heo-lighttext);font-weight:bold;font-size:20px;}[data-theme=dark].toc .toc-item.active .toc-link .toc-text{color:var(--heo-white);}#aside-content #card-toc .toc-content .toc-item.active .toc-link{opacity:1;border-radius:8px;}#aside-content #card-toc .toc-content .toc-link{line-height:1.2;padding:8px;border-left:0px solid transparent;border-radius:12px;color:var(--heo-secondtext);cursor:default;}#aside-content #card-toc .toc-content .toc-link:not(.active) span{opacity:0.6;cursor:pointer;filter:blur(1px);transition:0.3s;}#aside-content #card-toc:hover .toc-content .toc-link:not(.active) span{filter:blur(0px);opacity:1;}#aside-content #card-toc .toc-content .toc-link:not(.active) span:hover{color:var(--heo-lighttext);}}
package/css/style.js CHANGED
@@ -1,45 +1,119 @@
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
+ }
1
76
  categoriesBarActive()
2
77
  topCategoriesBarScroll()
3
78
 
4
79
  //分类条
5
80
  function categoriesBarActive() {
6
- var urlinfo = window.location.pathname;
7
- urlinfo = decodeURIComponent(urlinfo)
8
- console.log(urlinfo);
9
- //判断是否是首页
10
- if (urlinfo == '/') {
11
- if (document.querySelector('#category-bar')) {
12
- document.getElementById('首页').classList.add("select")
13
- }
14
- } else {
15
- // 验证是否是分类链接
16
- var pattern = /\/categories\/.*?\//;
17
- var patbool = pattern.test(urlinfo);
18
- console.log(patbool);
19
- // 获取当前的分类
20
- if (patbool) {
21
- var valuegroup = urlinfo.split("/");
22
- console.log(valuegroup[2]);
23
- // 获取当前分类
24
- var nowCategorie = valuegroup[2];
25
- if (document.querySelector('#category-bar')) {
26
- document.getElementById(nowCategorie).classList.add("select");
27
- }
28
- }
29
- }
81
+ var urlinfo = window.location.pathname;
82
+ urlinfo = decodeURIComponent(urlinfo)
83
+ console.log(urlinfo);
84
+ //判断是否是首页
85
+ if (urlinfo == '/') {
86
+ if (document.querySelector('#category-bar')) {
87
+ document.getElementById('首页').classList.add("select")
88
+ }
89
+ } else {
90
+ // 验证是否是分类链接
91
+ var pattern = /\/categories\/.*?\//;
92
+ var patbool = pattern.test(urlinfo);
93
+ console.log(patbool);
94
+ // 获取当前的分类
95
+ if (patbool) {
96
+ var valuegroup = urlinfo.split("/");
97
+ console.log(valuegroup[2]);
98
+ // 获取当前分类
99
+ var nowCategorie = valuegroup[2];
100
+ if (document.querySelector('#category-bar')) {
101
+ document.getElementById(nowCategorie).classList.add("select");
102
+ }
103
+ }
104
+ }
30
105
 
31
106
  }
32
-
33
107
  //鼠标控制横向滚动
34
108
  function topCategoriesBarScroll() {
35
- if (document.getElementById("category-bar-items")) {
36
- let xscroll = document.getElementById("category-bar-items");
37
- xscroll.addEventListener("mousewheel", function(e) {
38
- //计算鼠标滚轮滚动的距离
39
- let v = -e.wheelDelta / 2;
40
- xscroll.scrollLeft += v;
41
- //阻止浏览器默认方法
42
- e.preventDefault();
43
- }, false);
44
- }
109
+ if (document.getElementById("category-bar-items")) {
110
+ let xscroll = document.getElementById("category-bar-items");
111
+ xscroll.addEventListener("mousewheel", function(e) {
112
+ //计算鼠标滚轮滚动的距离
113
+ let v = -e.wheelDelta / 2;
114
+ xscroll.scrollLeft += v;
115
+ //阻止浏览器默认方法
116
+ e.preventDefault();
117
+ }, false);
118
+ }
45
119
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webxc",
3
- "version": "1.0.12",
3
+ "version": "1.0.13",
4
4
  "description": "webxc\u001b[D\u001b[D\u001b[D\u001b[D\u001b[D\u001b[D\u001b[D\u001b[Dwebxc-\u001b[C\u001bwebxc",
5
5
  "main": "index.js",
6
6
  "scripts": {