New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

hexo-theme-shokax

Package Overview
Dependencies
Maintainers
1
Versions
105
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hexo-theme-shokax - npm Package Compare versions

Comparing version 0.2.9 to 0.2.10

2

package.json
{
"name": "hexo-theme-shokax",
"version": "0.2.9",
"version": "0.2.10",
"description": "a hexo theme based on shoka",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -1,2 +0,2 @@

const sideBarToggleHandle = function (event, force) {
const sideBarToggleHandle = (event, force) => {
if (sideBar.hasClass('on')) {

@@ -17,3 +17,3 @@ sideBar.removeClass('on');

else {
transition(sideBar, 'slideRightIn', function () {
transition(sideBar, 'slideRightIn', () => {
sideBar.addClass('on');

@@ -25,5 +25,4 @@ menuToggle.addClass('close');

};
const sideBarTab = function () {
const sideBarTab = () => {
const sideBarInner = sideBar.child('.inner');
const panels = sideBar.find('.panel');
if (sideBar.child('.tab')) {

@@ -35,5 +34,5 @@ sideBarInner.removeChild(sideBar.child('.tab'));

list.className = 'tab';
['contents', 'related', 'overview'].forEach(function (item) {
['contents', 'related', 'overview'].forEach((item) => {
const element = sideBar.child('.panel.' + item);
if (element.innerHTML.replace(/(^\s*)|(\s*$)/g, '').length < 1) {
if (element.innerHTML.trim().length < 1) {
if (item === 'contents') {

@@ -60,10 +59,10 @@ showContents.display('none');

}
tab.addEventListener('click', function (event) {
tab.addEventListener('click', (event) => {
const target = event.currentTarget;
if (target.hasClass('active'))
return;
sideBar.find('.tab .item').forEach(function (element) {
sideBar.find('.tab .item').forEach((element) => {
element.removeClass('active');
});
sideBar.find('.panel').forEach(function (element) {
sideBar.find('.panel').forEach((element) => {
element.removeClass('active');

@@ -85,4 +84,4 @@ });

};
const sidebarTOC = function () {
const activateNavByIndex = function (index, lock) {
const sidebarTOC = () => {
const activateNavByIndex = (index) => {
const target = navItems[index];

@@ -94,6 +93,6 @@ if (!target)

}
$dom.each('.toc .active', function (element) {
$dom.each('.toc .active', (element) => {
element && element.removeClass('active current');
});
sections.forEach(function (element) {
sections.forEach((element) => {
element && element.removeClass('active');

@@ -122,5 +121,5 @@ });

}
let sections = Array.prototype.slice.call(navItems) || [];
let sections = [...navItems];
let activeLock = null;
sections = sections.map(function (element, index) {
sections = sections.map((element, index) => {
const link = element.child('a.toc-link');

@@ -131,7 +130,7 @@ const anchor = $dom(decodeURI(link.attr('href')));

const alink = anchor.child('a.anchor');
const anchorScroll = function (event) {
const anchorScroll = (event) => {
event.preventDefault();
const target = $dom(decodeURI(event.currentTarget.attr('href')));
activeLock = index;
pageScroll(target, null, function () {
pageScroll(target, null, () => {
activateNavByIndex(index);

@@ -142,3 +141,3 @@ activeLock = null;

link.addEventListener('click', anchorScroll);
alink && alink.addEventListener('click', function (event) {
alink && alink.addEventListener('click', (event) => {
anchorScroll(event);

@@ -150,3 +149,3 @@ clipBoard(CONFIG.hostname + '/' + LOCAL.path + event.currentTarget.attr('href'));

const tocElement = sideBar.child('.contents.panel');
const findIndex = function (entries) {
const findIndex = (entries) => {
let index = 0;

@@ -168,4 +167,4 @@ let entry = entries[index];

};
const createIntersectionObserver = function () {
const observer = new IntersectionObserver(function (entries, observe) {
const createIntersectionObserver = () => {
const observer = new IntersectionObserver((entries) => {
const index = findIndex(entries) + (diffY < 0 ? 1 : 0);

@@ -178,3 +177,3 @@ if (activeLock === null) {

});
sections.forEach(function (element) {
sections.forEach((element) => {
element && observer.observe(element);

@@ -185,13 +184,13 @@ });

};
const backToTopHandle = function () {
const backToTopHandle = () => {
pageScroll(0);
};
const goToBottomHandle = function () {
const goToBottomHandle = () => {
pageScroll(parseInt(String(Container.changeOrGetHeight())));
};
const goToCommentHandle = function () {
const goToCommentHandle = () => {
pageScroll($dom('#comments'));
};
const menuActive = function () {
$dom.each('.menu .item:not(.title)', function (element) {
const menuActive = () => {
$dom.each('.menu .item:not(.title)', (element) => {
const target = element.child('a[href]');

@@ -198,0 +197,0 @@ const parentItem = element.parentNode.parentNode;

@@ -32,20 +32,17 @@ const canvasEl = document.createElement('canvas');

const p = {
x: undefined,
y: undefined,
x,
y,
color: undefined,
radius: undefined,
endPos: undefined,
draw: undefined
draw() {
ctx.beginPath();
ctx.arc(p.x, p.y, p.radius, 0, 2 * Math.PI, true);
ctx.fillStyle = p.color;
ctx.fill();
}
};
p.x = x;
p.y = y;
p.color = colors[anime.random(0, colors.length - 1)];
p.radius = anime.random(16, 32);
p.endPos = setParticuleDirection(p);
p.draw = function () {
ctx.beginPath();
ctx.arc(p.x, p.y, p.radius, 0, 2 * Math.PI, true);
ctx.fillStyle = p.color;
ctx.fill();
};
return p;

@@ -55,26 +52,19 @@ }

const p = {
x: undefined,
y: undefined,
color: undefined,
radius: undefined,
x,
y,
color: '#FFF',
radius: 0.1,
endPos: undefined,
alpha: undefined,
lineWidth: undefined,
draw: undefined
alpha: 0.5,
lineWidth: 6,
draw() {
ctx.globalAlpha = p.alpha;
ctx.beginPath();
ctx.arc(p.x, p.y, p.radius, 0, 2 * Math.PI, true);
ctx.lineWidth = p.lineWidth;
ctx.strokeStyle = p.color;
ctx.stroke();
ctx.globalAlpha = 1;
}
};
p.x = x;
p.y = y;
p.color = '#FFF';
p.radius = 0.1;
p.alpha = 0.5;
p.lineWidth = 6;
p.draw = function () {
ctx.globalAlpha = p.alpha;
ctx.beginPath();
ctx.arc(p.x, p.y, p.radius, 0, 2 * Math.PI, true);
ctx.lineWidth = p.lineWidth;
ctx.strokeStyle = p.color;
ctx.stroke();
ctx.globalAlpha = 1;
};
return p;

@@ -98,8 +88,4 @@ }

update: renderParticule,
x: function (p) {
return p.endPos.x;
},
y: function (p) {
return p.endPos.y;
},
x: p => p.endPos.x,
y: p => p.endPos.y,
radius: 0.1

@@ -122,7 +108,7 @@ }).add({

duration: Infinity,
update: function () {
update() {
ctx.clearRect(0, 0, canvasEl.width, canvasEl.height);
}
});
const hasAncestor = function (node, name) {
const hasAncestor = (node, name) => {
name = name.toUpperCase();

@@ -137,3 +123,3 @@ do {

};
document.addEventListener(tap, function (e) {
document.addEventListener(tap, (e) => {
if (hasAncestor(e.target, 'a')) {

@@ -140,0 +126,0 @@ return;

@@ -27,3 +27,3 @@ const statics = CONFIG.statics.indexOf('//') > 0 ? CONFIG.statics : CONFIG.root;

let pjax;
const changeTheme = function (type) {
const changeTheme = (type) => {
const btn = $dom('.theme .ic');

@@ -41,3 +41,3 @@ if (type === 'dark') {

};
const autoDarkmode = function () {
const autoDarkmode = () => {
if (CONFIG.auto_dark.enable) {

@@ -53,3 +53,3 @@ if (new Date().getHours() >= CONFIG.auto_dark.start || new Date().getHours() <= CONFIG.auto_dark.end) {

const lazyload = lozad('img, [data-background-image]', {
loaded: function (el) {
loaded(el) {
el.addClass('lozaded');

@@ -61,3 +61,3 @@ }

lock: false,
show: function () {
show() {
clearTimeout(this.timer);

@@ -68,3 +68,3 @@ document.body.removeClass('loaded');

},
hide: function (sec) {
hide(sec) {
if (!CONFIG.loader.start) {

@@ -75,3 +75,3 @@ sec = -1;

},
vanish: function () {
vanish() {
if (Loader.lock) {

@@ -87,3 +87,3 @@ return;

};
const changeMetaTheme = function (color) {
const changeMetaTheme = (color) => {
if (HTML.attr('data-theme') === 'dark') {

@@ -94,4 +94,4 @@ color = '#222';

};
const themeColorListener = function () {
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', function (mediaQueryList) {
const themeColorListener = () => {
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', (mediaQueryList) => {
if (mediaQueryList.matches) {

@@ -114,5 +114,5 @@ changeTheme('dark');

};
const visibilityListener = function () {
const visibilityListener = () => {
const iconNode = $dom('[rel="icon"]');
document.addEventListener('visibilitychange', function () {
document.addEventListener('visibilitychange', () => {
switch (document.visibilityState) {

@@ -133,3 +133,3 @@ case 'hidden':

}
titleTime = setTimeout(function () {
titleTime = setTimeout(() => {
document.title = originTitle;

@@ -141,3 +141,3 @@ }, 2000);

};
const showtip = function (msg) {
const showtip = (msg) => {
if (!msg) {

@@ -150,5 +150,5 @@ return;

});
setTimeout(function () {
setTimeout(() => {
tipbox.addClass('hide');
setTimeout(function () {
setTimeout(() => {
BODY.removeChild(tipbox);

@@ -158,3 +158,3 @@ }, 300);

};
const resizeHandle = function (event) {
const resizeHandle = (event) => {
siteNavHeight = siteNav.changeOrGetHeight();

@@ -169,3 +169,3 @@ headerHightInner = siteHeader.changeOrGetHeight();

};
const scrollHandle = function (event) {
const scrollHandle = (event) => {
const winHeight = window.innerHeight;

@@ -208,3 +208,3 @@ const docHeight = getDocHeight();

};
const pagePosition = function () {
const pagePosition = () => {
if (CONFIG.auto_scroll) {

@@ -214,3 +214,3 @@ $storage.set(LOCAL_URL, String(scrollAction.y));

};
const positionInit = function (comment) {
const positionInit = (comment) => {
const anchor = window.location.hash;

@@ -237,3 +237,3 @@ let target = null;

};
const clipBoard = function (str, callback) {
const clipBoard = (str, callback) => {
if (navigator.clipboard && window.isSecureContext) {

@@ -271,3 +271,3 @@ navigator.clipboard.writeText(str).then(() => {

};
const isOutime = function () {
const isOutime = () => {
let updateTime;

@@ -301,3 +301,3 @@ if (CONFIG.outime.enable && LOCAL.outime) {

};
const clickMenu = function () {
const clickMenu = () => {
const menuElement = $dom('#clickMenu');

@@ -330,5 +330,5 @@ window.oncontextmenu = function (event) {

};
window.addEventListener('click', function () {
window.addEventListener('click', () => {
menuElement.classList.remove('active');
});
};

@@ -12,7 +12,7 @@ const getDocHeight = () => $dom('main > .inner').offsetHeight;

$dom.each = (selector, callback, element) => {
return $dom.all(selector, element).forEach(callback);
$dom.all(selector, element).forEach(callback);
};
$dom.asyncify = async (selector, element = document) => {
if (selector.indexOf('#') === 0) {
return element.getElementById(selector.replace('#', ''));
if (selector[0] === '#') {
return element.getElementById(selector.substring(1));
}

@@ -25,3 +25,3 @@ return element.querySelector(selector);

Object.assign(HTMLElement.prototype, {
createChild: function (tag, obj, positon) {
createChild(tag, obj, positon) {
const child = document.createElement(tag);

@@ -42,3 +42,3 @@ Object.assign(child, obj);

},
wrapObject: function (obj) {
wrapObject(obj) {
const box = document.createElement('div');

@@ -50,3 +50,3 @@ Object.assign(box, obj);

},
changeOrGetHeight: function (h) {
changeOrGetHeight(h) {
if (h) {

@@ -57,3 +57,3 @@ this.style.height = typeof h === 'number' ? h + 'rem' : h;

},
changeOrGetWidth: function (w) {
changeOrGetWidth(w) {
if (w) {

@@ -64,9 +64,9 @@ this.style.width = typeof w === 'number' ? w + 'rem' : w;

},
getTop: function () {
getTop() {
return this.getBoundingClientRect().top;
},
left: function () {
left() {
return this.getBoundingClientRect().left;
},
attr: function (type, value) {
attr(type, value) {
if (value === null) {

@@ -83,3 +83,3 @@ return this.removeAttribute(type);

},
insertAfter: function (element) {
insertAfter(element) {
const parent = this.parentNode;

@@ -93,3 +93,3 @@ if (parent.lastChild === this) {

},
display: function (d) {
display(d) {
if (d == null) {

@@ -103,9 +103,9 @@ return this.style.display;

},
child: function (selector) {
child(selector) {
return $dom(selector, this);
},
find: function (selector) {
find(selector) {
return $dom.all(selector, this);
},
_class: function (type, className, display) {
_class(type, className, display) {
const classNames = className.indexOf(' ') ? className.split(' ') : [className];

@@ -121,15 +121,15 @@ classNames.forEach((name) => {

},
addClass: function (className) {
addClass(className) {
this._class('add', className);
return this;
},
removeClass: function (className) {
removeClass(className) {
this._class('remove', className);
return this;
},
toggleClass: function (className, display) {
toggleClass(className, display) {
this._class('toggle', className, display);
return this;
},
hasClass: function (className) {
hasClass(className) {
return this.classList.contains(className);

@@ -139,13 +139,13 @@ }

const $storage = {
set: (key, value) => {
set(key, value) {
localStorage.setItem(key, value);
},
get: (key) => {
get(key) {
return localStorage.getItem(key);
},
del: (key) => {
del(key) {
localStorage.removeItem(key);
}
};
const getScript = function (url, callback, condition) {
const getScript = (url, callback, condition) => {
if (condition) {

@@ -169,11 +169,11 @@ callback();

};
const assetUrl = function (asset, type) {
const assetUrl = (asset, type) => {
const str = CONFIG[asset][type];
if (str.indexOf('gh') > -1 || str.indexOf('combine') > -1) {
if (str.includes('gh') || str.includes('combine')) {
return `https://cdn.jsdelivr.net/${str}`;
}
if (str.indexOf('npm') > -1) {
if (str.includes('npm')) {
return `https://cdn.jsdelivr.net/${str}`;
}
if (str.indexOf('http') > -1) {
if (str.includes('http')) {
return str;

@@ -183,3 +183,3 @@ }

};
const vendorJs = function (type, callback, condition) {
const vendorJs = (type, callback, condition) => {
if (LOCAL[type]) {

@@ -191,3 +191,3 @@ getScript(assetUrl('js', type), callback || function () {

};
const vendorCss = function (type, condition) {
const vendorCss = (type, condition) => {
if (window['css' + type]) {

@@ -217,3 +217,3 @@ return;

animation = {
begin: function (anim) {
begin(anim) {
target.display('block');

@@ -233,3 +233,3 @@ },

animation = {
begin: function (anim) {
begin(anim) {
target.display('block');

@@ -247,3 +247,3 @@ },

animation = {
begin: function (anim) {
begin(anim) {
target.display('block');

@@ -271,6 +271,6 @@ },

easing: 'linear',
begin: function () {
begin() {
begin && begin();
},
complete: function () {
complete() {
target.display(display);

@@ -281,3 +281,3 @@ complete && complete();

};
const pjaxScript = function (element) {
const pjaxScript = (element) => {
const { text, parentNode, id, className, type, src, dataset } = element;

@@ -308,3 +308,3 @@ const code = text || element.textContent || element.innerHTML || '';

};
const pageScroll = function (target, offset, complete) {
const pageScroll = (target, offset, complete) => {
const opt = {

@@ -315,3 +315,3 @@ targets: typeof offset === 'number' ? target.parentNode : document.scrollingElement,

scrollTop: offset || (typeof target === 'number' ? target : (target ? target.getTop() + document.documentElement.scrollTop - siteNavHeight : 0)),
complete: function () {
complete() {
complete && complete();

@@ -318,0 +318,0 @@ }

@@ -1,7 +0,7 @@

const cardActive = function () {
const cardActive = () => {
if (!$dom('.index.wrap')) {
return;
}
const io = new IntersectionObserver(function (entries) {
entries.forEach(function (article) {
const io = new IntersectionObserver((entries) => {
entries.forEach((article) => {
if (article.target.hasClass('show')) {

@@ -21,9 +21,9 @@ io.unobserve(article.target);

});
$dom.each('.index.wrap article.item, .index.wrap section.item', function (article) {
$dom.each('.index.wrap article.item, .index.wrap section.item', (article) => {
io.observe(article);
});
$dom('.index.wrap .item:first-child').addClass('show');
$dom.each('.cards .item', function (element, index) {
['mouseenter', 'touchstart'].forEach(function (item) {
element.addEventListener(item, function (event) {
$dom.each('.cards .item', (element) => {
['mouseenter', 'touchstart'].forEach((item) => {
element.addEventListener(item, () => {
if ($dom('.cards .item.active')) {

@@ -35,4 +35,4 @@ $dom('.cards .item.active').removeClass('active');

});
['mouseleave'].forEach(function (item) {
element.addEventListener(item, function (event) {
['mouseleave'].forEach((item) => {
element.addEventListener(item, () => {
element.removeClass('active');

@@ -43,6 +43,6 @@ }, { passive: true });

};
const registerExtURL = function () {
$dom.each('span.exturl', function (element) {
const registerExtURL = () => {
$dom.each('span.exturl', (element) => {
const link = document.createElement('a');
link.href = decodeURIComponent(window.atob(element.dataset.url).split('').map(function (c) {
link.href = decodeURIComponent(window.atob(element.dataset.url).split('').map((c) => {
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);

@@ -61,8 +61,8 @@ }).join(''));

};
const postFancybox = function (p) {
const postFancybox = (p) => {
if ($dom(p + ' .md img')) {
vendorCss('fancybox');
vendorJs('fancybox', function () {
vendorJs('fancybox', () => {
const q = jQuery.noConflict();
$dom.each(p + ' p.gallery', function (element) {
$dom.each(p + ' p.gallery', (element) => {
const box = document.createElement('div');

@@ -75,3 +75,3 @@ box.className = 'gallery';

});
$dom.each(p + ' .md img:not(.emoji):not(.vemoji)', function (element) {
$dom.each(p + ' .md img:not(.emoji):not(.vemoji)', (element) => {
const $image = q(element);

@@ -100,3 +100,3 @@ const imageLink = $image.attr('data-src') || $image.attr('src');

});
$dom.each(p + ' div.gallery', function (el, i) {
$dom.each(p + ' div.gallery', (el, i) => {
q(el).justifiedGallery({

@@ -123,3 +123,3 @@ rowHeight: q(el).data('height') || 120,

};
const postBeauty = function () {
const postBeauty = () => {
loadComments();

@@ -130,3 +130,3 @@ if (!$dom('.md')) {

postFancybox('.post.block');
$dom('.post.block').oncopy = async function (event) {
$dom('.post.block').oncopy = async (event) => {
showtip(LOCAL.copyright);

@@ -156,3 +156,3 @@ if (LOCAL.nocopy) {

};
$dom.each('li ruby', function (element) {
$dom.each('li ruby', (element) => {
let parent = element.parentNode;

@@ -164,6 +164,6 @@ if (element.parentNode.tagName !== 'LI') {

});
$dom.each('ol[start]', function (element) {
$dom.each('ol[start]', (element) => {
element.style.counterReset = 'counter ' + parseInt(element.attr('start') - 1);
});
$dom.each('.md table', function (element) {
$dom.each('.md table', (element) => {
element.wrapObject({

@@ -173,6 +173,6 @@ className: 'table-container'

});
$dom.each('.highlight > .table-container', function (element) {
$dom.each('.highlight > .table-container', (element) => {
element.className = 'code-container';
});
$dom.each('figure.highlight', function (element) {
$dom.each('figure.highlight', (element) => {
const code_container = element.child('.code-container');

@@ -186,11 +186,11 @@ const caption = element.child('figcaption');

else {
copyBtn.addEventListener('click', function (event) {
copyBtn.addEventListener('click', (event) => {
const target = event.currentTarget;
let comma = '';
let code = '';
code_container.find('pre').forEach(function (line) {
code_container.find('pre').forEach((line) => {
code += comma + line.innerText;
comma = '\n';
});
clipBoard(code, function (result) {
clipBoard(code, (result) => {
target.child('.ic').className = result ? 'ic i-check' : 'ic i-times';

@@ -201,4 +201,4 @@ target.blur();

}, { passive: true });
copyBtn.addEventListener('mouseleave', function (event) {
setTimeout(function () {
copyBtn.addEventListener('mouseleave', (event) => {
setTimeout(() => {
event.target.child('.ic').className = 'ic i-clipboard';

@@ -209,3 +209,3 @@ }, 1000);

const breakBtn = element.child('.breakline-btn');
breakBtn.addEventListener('click', function (event) {
breakBtn.addEventListener('click', (event) => {
const target = event.currentTarget;

@@ -222,3 +222,3 @@ if (element.hasClass('breakline')) {

const fullscreenBtn = element.child('.fullscreen-btn');
const removeFullscreen = function () {
const removeFullscreen = () => {
element.removeClass('fullscreen');

@@ -229,4 +229,3 @@ element.scrollTop = 0;

};
const fullscreenHandle = function (event) {
const target = event.currentTarget;
const fullscreenHandle = () => {
if (element.hasClass('fullscreen')) {

@@ -258,11 +257,11 @@ removeFullscreen();

const showBtn = code_container.child('.show-btn');
const hideCode = function () {
const hideCode = () => {
code_container.style.maxHeight = '300px';
showBtn.removeClass('open');
};
const showCode = function () {
const showCode = () => {
code_container.style.maxHeight = '';
showBtn.addClass('open');
};
showBtn.addEventListener('click', function (event) {
showBtn.addEventListener('click', () => {
if (showBtn.hasClass('open')) {

@@ -279,8 +278,8 @@ removeFullscreen();

});
$dom.asyncifyEach('pre.mermaid > svg', function (element) {
$dom.asyncifyEach('pre.mermaid > svg', (element) => {
const temp = element;
temp.style.maxWidth = '';
});
$dom.each('.reward button', function (element) {
element.addEventListener('click', function (event) {
$dom.each('.reward button', (element) => {
element.addEventListener('click', (event) => {
event.preventDefault();

@@ -292,3 +291,3 @@ const qr = $dom('#qr');

else {
transition(qr, 1, function () {
transition(qr, 1, () => {
qr.display('inline-flex');

@@ -299,4 +298,4 @@ });

});
$dom.asyncifyEach('.quiz > ul.options li', function (element) {
element.addEventListener('click', function (event) {
$dom.asyncifyEach('.quiz > ul.options li', (element) => {
element.addEventListener('click', () => {
if (element.hasClass('correct')) {

@@ -311,8 +310,8 @@ element.toggleClass('right');

});
$dom.asyncifyEach('.quiz > p', function (element) {
element.addEventListener('click', function (event) {
$dom.asyncifyEach('.quiz > p', (element) => {
element.addEventListener('click', () => {
element.parentNode.toggleClass('show');
});
});
$dom.asyncifyEach('.quiz > p:first-child', function (element) {
$dom.asyncifyEach('.quiz > p:first-child', (element) => {
const quiz = element.parentNode;

@@ -334,9 +333,9 @@ let type = 'choice';

});
$dom.asyncifyEach('.quiz .mistake', function (element) {
$dom.asyncifyEach('.quiz .mistake', (element) => {
element.attr('data-type', LOCAL.quiz.mistake);
});
$dom.each('div.tags a', function (element) {
$dom.each('div.tags a', (element) => {
element.className = ['primary', 'success', 'info', 'warning', 'danger'][Math.floor(Math.random() * 5)];
});
$dom.asyncifyEach('.md div.player', function (element) {
$dom.asyncifyEach('.md div.player', (element) => {
mediaPlayer(element, {

@@ -372,5 +371,5 @@ type: element.attr('data-type'),

};
const tabFormat = function () {
const tabFormat = () => {
let first_tab;
$dom.each('div.tab', function (element, index) {
$dom.each('div.tab', (element) => {
if (element.attr('data-ready')) {

@@ -388,3 +387,3 @@ return;

const showBtn = box.child('.show-btn');
showBtn.addEventListener('click', function (event) {
showBtn.addEventListener('click', () => {
pageScroll(box);

@@ -412,5 +411,5 @@ });

}
li.addEventListener('click', function (event) {
li.addEventListener('click', (event) => {
const target = event.currentTarget;
box.find('.active').forEach(function (el) {
box.find('.active').forEach((el) => {
el.removeClass('active');

@@ -425,3 +424,3 @@ });

};
const loadComments = function () {
const loadComments = () => {
const element = $dom('#comments');

@@ -435,3 +434,3 @@ if (!element) {

}
const io = new IntersectionObserver(function (entries, observer) {
const io = new IntersectionObserver((entries, observer) => {
const entry = entries[0];

@@ -446,3 +445,3 @@ vendorCss('valine');

};
const algoliaSearch = function (pjax) {
const algoliaSearch = (pjax) => {
if (CONFIG.search === null) {

@@ -460,3 +459,3 @@ return;

searchClient: algoliasearch(CONFIG.search.appID, CONFIG.search.apiKey),
searchFunction: function (helper) {
searchFunction(helper) {
const searchInput = $dom('.search-input');

@@ -468,3 +467,3 @@ if (searchInput.value) {

});
search.on('render', function () {
search.on('render', () => {
pjax.refresh($dom('#search-hits'));

@@ -489,3 +488,3 @@ });

templates: {
text: function (data) {
text(data) {
const stats = LOCAL.search.stats

@@ -501,7 +500,7 @@ .replace(/\$\{hits}/, data.nbHits)

templates: {
item: function (data) {
item(data) {
const cats = data.categories ? '<span>' + data.categories.join('<i class="ic i-angle-right"></i>') + '</span>' : '';
return '<a href="' + CONFIG.root + data.path + '">' + cats + data._highlightResult.title.value + '</a>';
},
empty: function (data) {
empty(data) {
return '<div id="hits-empty">' +

@@ -537,6 +536,6 @@ LOCAL.search.empty.replace(/\$\{query}/, data.query) +

search.start();
$dom.each('.search', function (element) {
element.addEventListener('click', function () {
$dom.each('.search', (element) => {
element.addEventListener('click', () => {
document.body.style.overflow = 'hidden';
transition(siteSearch, 'shrinkIn', function () {
transition(siteSearch, 'shrinkIn', () => {
$dom('.search-input').focus();

@@ -546,7 +545,7 @@ });

});
const onPopupClose = function () {
const onPopupClose = () => {
document.body.style.overflow = '';
transition(siteSearch, 0);
};
siteSearch.addEventListener('click', function (event) {
siteSearch.addEventListener('click', (event) => {
if (event.target === siteSearch) {

@@ -558,3 +557,3 @@ onPopupClose();

window.addEventListener('pjax:success', onPopupClose);
window.addEventListener('keyup', function (event) {
window.addEventListener('keyup', (event) => {
if (event.key === 'Escape') {

@@ -565,4 +564,4 @@ onPopupClose();

};
const domInit = function () {
$dom.each('.overview .menu > .item', function (el) {
const domInit = () => {
$dom.each('.overview .menu > .item', (el) => {
siteNav.child('.menu').appendChild(el.cloneNode(true));

@@ -590,7 +589,7 @@ });

mediaPlayer(toolPlayer);
$dom('main').addEventListener('click', function () {
$dom('main').addEventListener('click', () => {
toolPlayer.player.mini();
});
}
const createIntersectionObserver = function () {
const createIntersectionObserver = () => {
new IntersectionObserver(([entry]) => {

@@ -635,6 +634,6 @@ if (entry.isIntersecting) {

};
const pjaxReload = function () {
const pjaxReload = () => {
pagePosition();
if (sideBar.hasClass('on')) {
transition(sideBar, 0, function () {
transition(sideBar, 0, () => {
sideBar.removeClass('on');

@@ -649,3 +648,3 @@ menuToggle.removeClass('close');

};
const siteRefresh = function (reload) {
const siteRefresh = (reload) => {
LOCAL_HASH = 0;

@@ -672,3 +671,3 @@ LOCAL_URL = window.location.href;

Loader.hide();
setTimeout(function () {
setTimeout(() => {
positionInit();

@@ -680,3 +679,3 @@ }, 500);

};
const siteInit = function () {
const siteInit = () => {
domInit();

@@ -706,3 +705,3 @@ pjax = new Pjax({

window.addEventListener('pjax:success', siteRefresh);
window.addEventListener('beforeunload', function () {
window.addEventListener('beforeunload', () => {
pagePosition();

@@ -709,0 +708,0 @@ });

let NOWPLAYING = null;
const isMobile = /mobile/i.test(window.navigator.userAgent);
const mediaPlayer = function (t, config) {
const mediaPlayer = (t, config) => {
const buttons = {
el: {},
create: function () {
create() {
if (!t.player.options.btns) {
return;
}
t.player.options.btns.forEach(function (item) {
t.player.options.btns.forEach((item) => {
if (buttons.el[item]) {

@@ -16,4 +16,4 @@ return;

className: item + ' btn',
onclick: function (event) {
t.player.fetch().then(function () {
onclick(event) {
t.player.fetch().then(() => {
t.player.options.events[item](event);

@@ -38,3 +38,3 @@ });

const that = controller;
t.player.options.controls.forEach(function (item) {
t.player.options.controls.forEach((item) => {
if (that.btns[item]) {

@@ -44,3 +44,3 @@ return;

const opt = {
onclick: function (event) {
onclick(event) {
that.events[item] ? that.events[item](event) : t.player.options.events[item](event);

@@ -69,3 +69,3 @@ }

events: {
mode: function (e) {
mode(e) {
switch (t.player.options.mode) {

@@ -84,7 +84,7 @@ case 'loop':

},
volume: function (e) {
volume(e) {
e.preventDefault();
const current = e.currentTarget;
let drag = false;
const thumbMove = function (e) {
const thumbMove = (e) => {
e.preventDefault();

@@ -94,3 +94,3 @@ t.player.volume(controller.percent(e, current));

};
const thumbUp = function (e) {
const thumbUp = (e) => {
e.preventDefault();

@@ -117,7 +117,7 @@ current.removeEventListener(utils.nameMap.dragEnd, thumbUp);

},
backward: function (e) {
backward(e) {
controller.step = 'prev';
t.player.mode();
},
forward: function (e) {
forward(e) {
controller.step = 'next';

@@ -127,7 +127,7 @@ t.player.mode();

},
update: function (percent) {
update(percent) {
controller.btns.volume.className = 'volume ' + (!source.muted && percent > 0 ? 'on' : 'off') + ' btn';
controller.btns.volume.bar.changeOrGetWidth(Math.floor(percent * 100) + '%');
},
percent: function (e, el) {
percent(e, el) {
let percentage = ((e.clientX || e.changedTouches[0].clientX) - el.left()) / el.changeOrGetWidth();

@@ -141,3 +141,3 @@ percentage = Math.max(percentage, 0);

bar: null,
create: function () {
create() {
const current = playlist.current().el;

@@ -162,7 +162,7 @@ if (current) {

},
update: function (percent) {
update(percent) {
progress.bar.changeOrGetWidth(Math.floor(percent * 100) + '%');
progress.el.attr('data-ptime', utils.secondToTime(percent * source.duration));
},
seeking: function (type) {
seeking(type) {
if (type) {

@@ -175,3 +175,3 @@ progress.el.addClass('seeking');

},
percent: function (e, el) {
percent(e, el) {
let percentage = ((e.clientX || e.changedTouches[0].clientX) - el.left()) / el.changeOrGetWidth();

@@ -181,6 +181,6 @@ percentage = Math.max(percentage, 0);

},
drag: function (e) {
drag(e) {
e.preventDefault();
const current = playlist.current().el;
const thumbMove = function (e) {
const thumbMove = (e) => {
e.preventDefault();

@@ -191,3 +191,3 @@ const percentage = progress.percent(e, current);

};
const thumbUp = function (e) {
const thumbUp = (e) => {
e.preventDefault();

@@ -210,3 +210,3 @@ current.removeEventListener(utils.nameMap.dragEnd, thumbUp);

el: null,
create: function () {
create() {
const current = playlist.current();

@@ -227,3 +227,3 @@ preview.el.innerHTML = '<div class="cover"><div class="disc"><img src="' + (current.cover) + '" class="blur" alt="music cover"/></div></div>' +

add: (group, list) => {
list.forEach(function (item, i) {
list.forEach((item) => {
item.group = group;

@@ -237,3 +237,3 @@ item.name = item.name || item.title || 'Meida name';

},
clear: function () {
clear() {
playlist.data = [];

@@ -246,5 +246,5 @@ playlist.el.innerHTML = '';

},
create: function () {
create() {
const el = playlist.el;
playlist.data.map(function (item, index) {
playlist.data.map((item, index) => {
if (item.el) {

@@ -269,3 +269,3 @@ return null;

innerHTML: '<span class="info"><span>' + item.name + '</span><span>' + item.artist + '</span></span>',
onclick: function (event) {
onclick(event) {
const current = event.currentTarget;

@@ -289,6 +289,6 @@ if (playlist.index === index && progress.el) {

},
current: function () {
current() {
return this.data[this.index];
},
scroll: function () {
scroll() {
const item = this.current();

@@ -306,3 +306,3 @@ let li = this.el.child('li.active');

},
title: function () {
title() {
if (source.paused) {

@@ -314,3 +314,3 @@ return;

},
error: function () {
error() {
const current = this.current();

@@ -324,3 +324,3 @@ current.el.removeClass('current').addClass('error');

el: null,
create: function () {
create() {
if (this.el) {

@@ -337,6 +337,6 @@ return;

},
hide: function () {
hide() {
const el = this.el;
el.addClass('hide');
window.setTimeout(function () {
window.setTimeout(() => {
el.removeClass('show hide');

@@ -352,3 +352,3 @@ }, 300);

events: {
'play-pause': function (event) {
'play-pause'(event) {
if (source.paused) {

@@ -361,3 +361,3 @@ t.player.play();

},
music: function (event) {
music(event) {
if (info.el.hasClass('show')) {

@@ -374,6 +374,6 @@ info.hide();

const utils = {
random: function (len) {
random(len) {
return Math.floor((Math.random() * len));
},
parse: function (link) {
parse(link) {
let result = [];

@@ -395,3 +395,3 @@ [

['xiami.com.*collect/(\\w+)', 'xiami', 'playlist']
].forEach(function (rule) {
].forEach((rule) => {
const patt = new RegExp(rule[0]);

@@ -405,6 +405,6 @@ const res = patt.exec(link);

},
fetch: function (source) {
fetch(source) {
const list = [];
return new Promise(function (resolve, reject) {
source.forEach(function (raw) {
return new Promise((resolve, reject) => {
source.forEach((raw) => {
const meta = utils.parse(raw);

@@ -420,5 +420,5 @@ if (meta[0]) {

fetch(`${CONFIG.playerAPI}/meting/?server=` + meta[0] + '&type=' + meta[1] + '&id=' + meta[2] + '&r=' + Math.random())
.then(function (response) {
.then((response) => {
return response.json();
}).then(function (json) {
}).then((json) => {
$storage.set(skey, JSON.stringify(json));

@@ -438,4 +438,4 @@ list.push(...json);

},
secondToTime: function (second) {
const add0 = function (num) {
secondToTime(second) {
const add0 = (num) => {
return isNaN(num) ? '00' : (num < 10 ? '0' + num : '' + num);

@@ -458,3 +458,3 @@ };

group: true,
load: function (newList) {
load(newList) {
let d = '';

@@ -477,3 +477,3 @@ if (newList && newList.length > 0) {

},
fetch: function () {
fetch() {
return new Promise((resolve, reject) => {

@@ -486,4 +486,4 @@ if (playlist.data.length > 0) {

const promises = [];
this.options.rawList.forEach(function (raw, index) {
promises.push(new Promise(function (resolve, reject) {
this.options.rawList.forEach((raw, index) => {
promises.push(new Promise((resolve, reject) => {
let group = index;

@@ -500,3 +500,3 @@ let source;

}
utils.fetch(source).then(function (list) {
utils.fetch(source).then((list) => {
playlist.add(group, list);

@@ -507,3 +507,3 @@ resolve(0);

});
Promise.all(promises).then(function () {
Promise.all(promises).then(() => {
resolve(true);

@@ -521,3 +521,3 @@ });

},
mode: function () {
mode() {
const total = playlist.data.length;

@@ -528,3 +528,3 @@ if (!total || playlist.errnum === total) {

const step = controller.step === 'next' ? 1 : -1;
const next = function () {
const next = () => {
let index = playlist.index + step;

@@ -563,3 +563,3 @@ if (index > total || index < 0) {

},
switch: function (index) {
switch(index) {
if (typeof index === 'number' &&

@@ -573,3 +573,3 @@ index !== playlist.index &&

},
init: function () {
init() {
const item = playlist.current();

@@ -597,3 +597,3 @@ if (!item || item.error) {

},
play: function () {
play() {
NOWPLAYING && NOWPLAYING.player.pause();

@@ -604,12 +604,12 @@ if (playlist.current().error) {

}
source.play().then(function () {
source.play().then(() => {
playlist.scroll();
}).catch(function (e) {
}).catch((e) => {
});
},
pause: function () {
pause() {
source.pause();
document.title = originTitle;
},
stop: function () {
stop() {
source.pause();

@@ -619,3 +619,3 @@ source.currentTime = 0;

},
seek: function (time) {
seek(time) {
time = Math.max(time, 0);

@@ -626,3 +626,3 @@ time = Math.min(time, source.duration);

},
muted: function (status) {
muted(status) {
if (status === 'muted') {

@@ -639,3 +639,3 @@ source.muted = status;

},
volume: function (percentage) {
volume(percentage) {
if (!isNaN(percentage)) {

@@ -647,3 +647,3 @@ controller.update(percentage);

},
mini: function () {
mini() {
info.hide();

@@ -656,6 +656,6 @@ }

index: 0,
create: function (box) {
create(box) {
const current = playlist.index;
const raw = playlist.current().lrc;
const callback = function (body) {
const callback = (body) => {
if (current !== playlist.index) {

@@ -666,3 +666,3 @@ return;

let lrc = '';
this.data.forEach(function (line, index) {
this.data.forEach((line, index) => {
lrc += '<p' + (index === 0 ? ' class="current"' : '') + '>' + line[1] + '</p>';

@@ -683,3 +683,3 @@ });

},
update: function (currentTime) {
update(currentTime) {
if (!this.data) {

@@ -700,5 +700,5 @@ return;

},
parse: function (lrc_s) {
parse(lrc_s) {
if (lrc_s) {
lrc_s = lrc_s.replace(/([^\]^\n])\[/g, function (match, p1) {
lrc_s = lrc_s.replace(/([^\]^\n])\[/g, (match, p1) => {
return p1 + '\n[';

@@ -714,3 +714,3 @@ });

.replace(/<(\d{2}):(\d{2})(\.(\d{2,3}))?>/g, '')
.replace(/^\s+|\s+$/g, '');
.trim;
if (lrcTimes) {

@@ -728,8 +728,4 @@ const timeLen = lrcTimes.length;

}
lrc = lrc.filter(function (item) {
return item[1];
});
lrc.sort(function (a, b) {
return a[0] - b[0];
});
lrc = lrc.filter((item) => item[1]);
lrc.sort((a, b) => a[0] - b[0]);
return lrc;

@@ -741,9 +737,9 @@ }

},
fetch: function (url, callback) {
fetch(url, callback) {
fetch(url)
.then(function (response) {
.then((response) => {
return response.text();
}).then(function (body) {
}).then((body) => {
callback(body);
}).catch(function (ex) {
}).catch((ex) => {
});

@@ -753,7 +749,7 @@ }

const events = {
onerror: function () {
onerror() {
playlist.error();
t.player.mode();
},
ondurationchange: function () {
ondurationchange() {
if (source.duration !== 1) {

@@ -763,7 +759,7 @@ progress.el.attr('data-dtime', utils.secondToTime(source.duration));

},
onloadedmetadata: function () {
onloadedmetadata() {
t.player.seek(0);
progress.el.attr('data-dtime', utils.secondToTime(source.duration));
},
onplay: function () {
onplay() {
t.parentNode.addClass('playing');

@@ -773,7 +769,7 @@ showtip(this.attr('title'));

},
onpause: function () {
onpause() {
t.parentNode.removeClass('playing');
NOWPLAYING = null;
},
ontimeupdate: function () {
ontimeupdate() {
if (!this.disableTimeupdate) {

@@ -784,3 +780,3 @@ progress.update(this.currentTime / this.duration);

},
onended: function (argument) {
onended(argument) {
t.player.mode();

@@ -790,3 +786,3 @@ t.player.play();

};
const init = function (config) {
const init = (config) => {
if (t.player.created) {

@@ -793,0 +789,0 @@ return;

@@ -13,7 +13,7 @@ Vue.createApp({

});
const hideNeko = function () {
const hideNeko = () => {
transition(neko, {
delay: 2500,
opacity: 0
}, function () {
}, () => {
BODY.removeChild(neko);

@@ -23,3 +23,3 @@ });

if (btn.hasClass('i-sun')) {
c = function () {
c = () => {
neko.addClass('dark');

@@ -33,3 +33,3 @@ changeTheme('dark');

neko.addClass('dark');
c = function () {
c = () => {
neko.removeClass('dark');

@@ -41,5 +41,5 @@ changeTheme();

}
transition(neko, 1, function () {
transition(neko, 1, () => {
setTimeout(c, 210);
}, function () {
}, () => {
neko.display('block');

@@ -46,0 +46,0 @@ });

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc