Skip to content

Commit

Permalink
Removed unneeded semicolons
Browse files Browse the repository at this point in the history
  • Loading branch information
adamlui committed Dec 15, 2024
1 parent 5cb4c79 commit 08c33d5
Show file tree
Hide file tree
Showing 4 changed files with 365 additions and 365 deletions.
68 changes: 34 additions & 34 deletions docs/assets/js/src/back-to-top-button.js
Original file line number Diff line number Diff line change
@@ -1,64 +1,64 @@
// Add back-to-top button

// Create/style button
const button = document.createElement('button');
button.classList.add('back-to-top');
const button = document.createElement('button')
button.classList.add('back-to-top')

// Create button SVG
const svgElement = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
svgElement.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
svgElement.setAttribute('height', '2em');
svgElement.setAttribute('viewBox', '0 0 448 512');
const svgElement = document.createElementNS('http://www.w3.org/2000/svg', 'svg')
svgElement.setAttribute('xmlns', 'http://www.w3.org/2000/svg')
svgElement.setAttribute('height', '2em')
svgElement.setAttribute('viewBox', '0 0 448 512')

// Create button SVG path
const pathElement = document.createElementNS('http://www.w3.org/2000/svg', 'path');
pathElement.setAttribute('d', 'M246.6 41.4c-12.5-12.5-32.8-12.5-45.3 0l-160 160c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L224 109.3 361.4 246.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3l-160-160zm160 352l-160-160c-12.5-12.5-32.8-12.5-45.3 0l-160 160c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L224 301.3 361.4 438.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3z');
const pathElement = document.createElementNS('http://www.w3.org/2000/svg', 'path')
pathElement.setAttribute('d', 'M246.6 41.4c-12.5-12.5-32.8-12.5-45.3 0l-160 160c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L224 109.3 361.4 246.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3l-160-160zm160 352l-160-160c-12.5-12.5-32.8-12.5-45.3 0l-160 160c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L224 301.3 361.4 438.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3z')

// Merge elements
svgElement.append(pathElement); button.append(svgElement);
document.body.append(button);
svgElement.append(pathElement) ; button.append(svgElement)
document.body.append(button)

function fadeIn(el, duration) {
if (el.classList.contains('done')) return;
el.classList.add('done'); el.style.opacity = 0;
let last = +new Date();
if (el.classList.contains('done')) return
el.classList.add('done') ; el.style.opacity = 0
let last = +new Date()
const tick = () => {
el.style.opacity = +el.style.opacity + (new Date() - last) / duration;
last = +new Date();
el.style.opacity = +el.style.opacity + (new Date() - last) / duration
last = +new Date()
if (+el.style.opacity < 1)
(window.requestAnimationFrame && requestAnimationFrame(tick)) ||
setTimeout(tick, 16);
else el.style.display = 'block';
};
tick();
setTimeout(tick, 16)
else el.style.display = 'block'
}
tick()
}

function fadeOut(el, duration) {
if (!el.classList.contains('done')) return;
el.classList.remove('done'); el.style.opacity = 1;
let last = +new Date();
if (!el.classList.contains('done')) return
el.classList.remove('done') ; el.style.opacity = 1
let last = +new Date()
const tick = () => {
el.style.opacity = +el.style.opacity - (new Date() - last) / duration;
last = +new Date();
el.style.opacity = +el.style.opacity - (new Date() - last) / duration
last = +new Date()
if (+el.style.opacity > 0)
(window.requestAnimationFrame && requestAnimationFrame(tick)) ||
setTimeout(tick, 16);
else el.style.display = 'none';
};
tick();
setTimeout(tick, 16)
else el.style.display = 'none'
}
tick()
}

function scrollToTop() {
const c = document.documentElement.scrollTop || document.body.scrollTop;
if (c > 0) {
window.requestAnimationFrame(scrollToTop);
window.scrollTo(0, c - c / 8);
window.requestAnimationFrame(scrollToTop)
window.scrollTo(0, c - c / 8)
}
}
button.addEventListener('click', scrollToTop);
button.addEventListener('click', scrollToTop)

window.addEventListener('scroll', () => {
const scrollTop = window.scrollY || document.documentElement.scrollTop;
if (scrollTop > 0) fadeIn(button, 500);
else fadeOut(button, 500);
});
if (scrollTop > 0) fadeIn(button, 500)
else fadeOut(button, 500)
});
56 changes: 28 additions & 28 deletions docs/assets/js/src/copy-code-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@
return (s =
"function" == typeof Symbol && "symbol" == typeof Symbol.iterator
? function (o) {
return typeof o;
return typeof o
}
: function (o) {
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
})(o);
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o
})(o)
}
!(function (o, e) {
void 0 === e && (e = {});
var t = e.insertAt;
void 0 === e && (e = {})
var t = e.insertAt
if (o && "undefined" != typeof document) {
var n = document.head || document.getElementsByTagName("head")[0],
c = document.createElement("style");
(c.type = "text/css"), "top" === t && n.firstChild ? n.insertBefore(c, n.firstChild) : n.append(c), c.styleSheet ? (c.styleSheet.cssText = o) : c.append(document.createTextNode(o));
(c.type = "text/css"), "top" === t && n.firstChild ? n.insertBefore(c, n.firstChild) : n.append(c), c.styleSheet ? (c.styleSheet.cssText = o) : c.append(document.createTextNode(o))
}
})(
".docsify-copy-code-button,.docsify-copy-code-button span{cursor:pointer}.docsify-copy-code-button{position:absolute;z-index:1;top:0;right:0;overflow:visible;padding:.65em .8em;border:0;border-radius:0;outline:0;font-size:1em;background:grey;background:var(--theme-color,grey);color:#fff;opacity:1}.docsify-copy-code-button span{border-radius:3px;background:inherit;pointer-events:none}.docsify-copy-code-button .error,.docsify-copy-code-button .success{position:absolute;z-index:1000;top:24px;left:12px;padding:.5em .65em;font-size:.825em;opacity:0;transform:translateX(-88%)translateY(-50%)}.docsify-copy-code-button.error .error,.docsify-copy-code-button.success .success{left:12px;top:24px;opacity:1;,pre:hover .docsify-copy-code-button{opacity:1}"
Expand All @@ -27,65 +27,65 @@
init: function () {
return function (o, e) {
o.ready(function () {
console.warn("[Deprecation] Manually initializing docsify-copy-code using window.DocsifyCopyCodePlugin.init() is no longer necessary.");
});
};
console.warn("[Deprecation] Manually initializing docsify-copy-code using window.DocsifyCopyCodePlugin.init() is no longer necessary.")
})
}
},
}),
(window.$docsify = window.$docsify || {}),
(window.$docsify.plugins = [
function (o, r) {
o.doneEach(function () {
var o = Array.apply(null, document.querySelectorAll("pre[data-lang]")),
c = { buttonText: "<> Copy code", errorText: "Error", successText: "Code copied!" };
c = { buttonText: "<> Copy code", errorText: "Error", successText: "Code copied!" }
r.config.copyCode &&
Object.keys(c).forEach(function (t) {
var n = r.config.copyCode[t];
var n = r.config.copyCode[t]
"string" == typeof n
? (c[t] = n)
: "object" === s(n) &&
Object.keys(n).some(function (o) {
var e = -1 < location.href.indexOf(o);
return (c[t] = e ? n[o] : c[t]), e;
});
});
var e = -1 < location.href.indexOf(o)
return (c[t] = e ? n[o] : c[t]), e
})
})
var e = [
'<button class="docsify-copy-code-button">',
'<span class="label">'.concat(c.buttonText, "</span>"),
'<span class="error">'.concat(c.errorText, "</span>"),
'<span class="success">'.concat(c.successText, "</span>"),
"</button>",
].join("");
].join("")
o.forEach(function (o) {
o.insertAdjacentHTML("beforeend", e);
});
})
}),
o.mounted(function () {
document.querySelector(".content").addEventListener("click", function (o) {
if (o.target.classList.contains("docsify-copy-code-button")) {
var e = "BUTTON" === o.target.tagName ? o.target : o.target.parentNode,
t = document.createRange(),
n = e.parentNode.querySelector("code"),
c = window.getSelection();
t.selectNode(n), c.removeAllRanges(), c.addRange(t);
c = window.getSelection()
t.selectNode(n), c.removeAllRanges(), c.addRange(t)
try {
document.execCommand("copy") &&
(e.classList.add("success"), e.querySelector('.label').style.display = 'none',
setTimeout(function () {
e.classList.remove("success");
e.querySelector('.label').style.display = 'inline';
}, 2000));
e.classList.remove("success")
e.querySelector('.label').style.display = 'inline';
}, 2000))
} catch (o) {
console.error("docsify-copy-code: ".concat(o)),
e.classList.add("error"),
setTimeout(function () {
e.classList.remove("error");
e.classList.remove("error")
}, 2000);
}
"function" == typeof (c = window.getSelection()).removeRange ? c.removeRange(t) : "function" == typeof c.removeAllRanges && c.removeAllRanges();
"function" == typeof (c = window.getSelection()).removeRange ? c.removeRange(t) : "function" == typeof c.removeAllRanges && c.removeAllRanges()
}
});
});
})
})
},
].concat(window.$docsify.plugins || []));
})();
].concat(window.$docsify.plugins || []))
})();
Loading

0 comments on commit 08c33d5

Please sign in to comment.