hexo-theme-particlex 2.4.11 → 2.5.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,71 +0,0 @@
1
- function sleep(ms) {
2
- return new Promise(resolve => setTimeout(resolve, ms));
3
- }
4
- let copying = false;
5
- function highlight() {
6
- hljs.configure({ ignoreUnescapedHTML: true });
7
- let codes = document.getElementsByTagName("pre");
8
- for (let i of codes) {
9
- let lang = [...i.classList, ...i.firstChild.classList][0] || "plaintext";
10
- i.innerHTML = `<div class="code-content">${i.innerHTML}</div><div class="language">${lang}</div><div class="copycode"><i class="fa-solid fa-copy fa-fw"></i><i class="fa-solid fa-clone fa-fw"></i></div>`;
11
- let copycode = i.getElementsByClassName("copycode")[0];
12
- copycode.addEventListener("click", async function () {
13
- if (copying) return;
14
- copying = true;
15
- this.classList.add("copied");
16
- await navigator.clipboard.writeText(this.parentElement.firstChild.innerText);
17
- await sleep(1000);
18
- this.classList.remove("copied");
19
- copying = false;
20
- });
21
- hljs.highlightElement(i.getElementsByClassName("code-content")[0]);
22
- }
23
- }
24
- function showimg() {
25
- let wrap = document.getElementById("showimg"),
26
- content = document.getElementById("showimg-content"),
27
- images = document.querySelectorAll(".article .content img");
28
- function show(image) {
29
- content.alt = image.alt;
30
- content.src = image.src;
31
- wrap.style.opacity = 1;
32
- wrap.style.visibility = "visible";
33
- }
34
- function hide() {
35
- wrap.style.opacity = 0;
36
- wrap.style.visibility = "hidden";
37
- }
38
- for (let i of images)
39
- i.addEventListener("click", function () {
40
- show(this);
41
- });
42
- wrap.addEventListener("click", hide);
43
- window.addEventListener("resize", hide);
44
- }
45
- function rendermath() {
46
- if (typeof renderMathInElement !== "undefined")
47
- renderMathInElement(document.body, {
48
- delimiters: [
49
- { left: "$$", right: "$$", display: true },
50
- { left: "$", right: "$", display: false },
51
- { left: "\\(", right: "\\)", display: false },
52
- { left: "\\[", right: "\\]", display: true },
53
- ],
54
- });
55
- }
56
- function renderall() {
57
- highlight();
58
- showimg();
59
- rendermath();
60
- }
61
- function sha(str) {
62
- return CryptoJS.SHA256(str).toString();
63
- }
64
- function decrypt(str, key, shasum) {
65
- try {
66
- let res = CryptoJS.AES.decrypt(str, key).toString(CryptoJS.enc.Utf8);
67
- return { decrypt: res, check: sha(res) === shasum };
68
- } catch {
69
- return { check: false };
70
- }
71
- }
@@ -1,98 +0,0 @@
1
- const app = Vue.createApp({
2
- data() {
3
- return {
4
- showpage: false,
5
- menushow: false,
6
- cardtop: 100,
7
- barlocal: 0,
8
- composition: false,
9
- };
10
- },
11
- created() {
12
- window.addEventListener("load", () => {
13
- this.showpage = true;
14
- document.getElementById("loading").style.opacity = 0;
15
- });
16
- },
17
- mounted() {
18
- if (document.getElementById("home-head"))
19
- document.getElementById("menu").className += " menu-color";
20
- if (document.getElementById("crypto")) {
21
- let input = document.getElementById("crypto");
22
- input.addEventListener("input", () => {
23
- if (!this.composition) this.handlecrypto();
24
- });
25
- input.addEventListener("compositionstart", () => {
26
- this.composition = true;
27
- });
28
- input.addEventListener("compositionend", () => {
29
- this.handlecrypto();
30
- this.composition = false;
31
- });
32
- }
33
- if (document.getElementById("search-bar")) {
34
- let input = document.getElementById("search-bar");
35
- input.addEventListener("input", () => {
36
- if (!this.composition) this.handlesearch();
37
- });
38
- input.addEventListener("compositionstart", () => {
39
- this.composition = true;
40
- });
41
- input.addEventListener("compositionend", () => {
42
- this.handlesearch();
43
- this.composition = false;
44
- });
45
- }
46
- window.addEventListener("scroll", this.handlescroll, true);
47
- renderall();
48
- },
49
- methods: {
50
- homeclick() {
51
- window.scrollTo({ top: window.innerHeight, behavior: "smooth" });
52
- },
53
- handlescroll() {
54
- let newlocal = document.documentElement.scrollTop;
55
- let menu = document.getElementById("menu");
56
- let wrap = document.getElementById("home-posts-wrap");
57
- if (this.barlocal < newlocal) {
58
- menu.className = "hidden-menu";
59
- this.menushow = false;
60
- } else menu.className = "show-menu";
61
- if (wrap) {
62
- if (newlocal <= window.innerHeight - 100) menu.className += " menu-color";
63
- if (newlocal <= 400) wrap.style.marginTop = newlocal / -5 + "px";
64
- else wrap.style.marginTop = "-80px";
65
- }
66
- this.barlocal = newlocal;
67
- },
68
- handlecrypto() {
69
- let input = document.getElementById("crypto"),
70
- content = document.getElementsByClassName("content")[0];
71
- let res = decrypt(input.dataset.encrypt, input.value, input.dataset.shasum);
72
- if (res.check) {
73
- input.disabled = true;
74
- input.classList.remove("fail");
75
- input.classList.add("success");
76
- content.innerHTML = res.decrypt;
77
- content.style.opacity = 1;
78
- renderall();
79
- } else input.classList.add("fail");
80
- },
81
- handlesearch() {
82
- let input = document.getElementById("search-bar"),
83
- timeline = document.getElementsByClassName("timeline"),
84
- key = input.value.toLowerCase().replace(/s+/gm, "");
85
- for (let i of timeline)
86
- if (!key || i.dataset.title.includes(key)) {
87
- i.style.opacity = 1;
88
- i.style.pointerEvents = "";
89
- i.style.marginTop = "";
90
- } else {
91
- i.style.opacity = 0;
92
- i.style.pointerEvents = "none";
93
- i.style.marginTop = -i.offsetHeight - 30 + "px";
94
- }
95
- },
96
- },
97
- });
98
- app.mount("#layout");