Skip to content

Commit

Permalink
fix: #43
Browse files Browse the repository at this point in the history
  • Loading branch information
zkz098 committed Feb 27, 2023
1 parent 76158da commit d2dc51c
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 24 deletions.
2 changes: 1 addition & 1 deletion layout/_partials/head/head.pug
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ else if gt
link(rel="stylesheet" href="https://unpkg.com/gitalk/dist/gitalk.css")
script(src="https://unpkg.com/gitalk/dist/gitalk.min.js")
- var qw = theme.qweather.enable
- var qw = theme?.qweather?.enable
if qw
style.
img[data-v-7d48daab] {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hexo-theme-shokax",
"version": "0.2.0-rc2",
"version": "0.2.0-rc3",
"description": "a hexo theme based on shoka",
"main": "index.js",
"repository": "https://github.com/zkz098/hexo-theme-shokaX",
Expand Down
2 changes: 1 addition & 1 deletion source/js/_app/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ const sidebarTOC = function () {
const link = element.child('a.toc-link');
const anchor = $dom(decodeURI(link.attr('href')));
if (!anchor)
return;
return null;
const alink = anchor.child('a.anchor');
const anchorScroll = function (event) {
event.preventDefault();
Expand Down
15 changes: 7 additions & 8 deletions source/js/_app/global.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ const themeColorListener = function () {
}
};
const visibilityListener = function () {
let iconNode = $dom('[rel="icon"]');
const iconNode = $dom('[rel="icon"]');
document.addEventListener('visibilitychange', function () {
switch (document.visibilityState) {
case 'hidden':
Expand Down Expand Up @@ -182,8 +182,7 @@ const scrollHandle = function (event) {
siteNav.removeClass('down');
siteNav.toggleClass('up', SHOW);
}
else {
}
else { }
scrollAction.y = window.scrollY;
const scrollPercent = Math.round(Math.min(100 * window.scrollY / contentVisibilityHeight, 100)) + '%';
backToTop.child('span').innerText = scrollPercent;
Expand Down Expand Up @@ -287,16 +286,16 @@ const clickMenu = function () {
event.preventDefault();
let x = event.offsetX;
let y = event.offsetY;
let winWidth = window.innerWidth;
let winHeight = window.innerHeight;
let menuWidth = menuElement.offsetWidth;
let menuHeight = menuElement.offsetHeight;
const winWidth = window.innerWidth;
const winHeight = window.innerHeight;
const menuWidth = menuElement.offsetWidth;
const menuHeight = menuElement.offsetHeight;
x = winWidth - menuWidth >= x ? x : winWidth - menuWidth;
y = winHeight - menuHeight >= y ? y : winHeight - menuHeight;
menuElement.style.top = y + 'px';
menuElement.style.left = x + 'px';
menuElement.classList.add('active');
$dom.each(".clickSubmenu", (submenu) => {
$dom.each('.clickSubmenu', (submenu) => {
if (x > (winWidth - menuWidth - submenu.offsetWidth)) {
submenu.style.left = '-200px';
}
Expand Down
9 changes: 4 additions & 5 deletions source/js/_app/library.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,12 @@ Object.assign(HTMLElement.prototype, {
},
_class: function (type, className, display) {
const classNames = className.indexOf(' ') ? className.split(' ') : [className];
const that = this;
classNames.forEach(function (name) {
classNames.forEach((name) => {
if (type === 'toggle') {
that.classList.toggle(name, display);
this.classList.toggle(name, display);
}
else {
that.classList[type](name);
this.classList[type](name);
}
});
},
Expand Down Expand Up @@ -150,7 +149,7 @@ const getScript = function (url, callback, condition) {
let script = document.createElement('script');
script.onload = function (_, isAbort) {
if (isAbort || !script.readyState) {
console.log("abort!");
console.log('abort!');
script.onload = null;
script = undefined;
if (!isAbort && callback)
Expand Down
2 changes: 1 addition & 1 deletion source/js/_app/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ const pjaxReload = function () {
menuToggle.removeClass('close');
});
}
let mainNode = $dom('#main');
const mainNode = $dom('#main');
mainNode.innerHTML = '';
mainNode.appendChild(loadCat.lastChild.cloneNode(true));
pageScroll(0);
Expand Down
13 changes: 6 additions & 7 deletions source/js/_app/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -444,25 +444,24 @@ const mediaPlayer = function (t, config) {
return this;
},
fetch: function () {
const that = this;
return new Promise(function (resolve, reject) {
return new Promise((resolve, reject) => {
if (playlist.data.length > 0) {
resolve(true);
}
else {
if (that.options.rawList) {
if (this.options.rawList) {
const promises = [];
that.options.rawList.forEach(function (raw, index) {
this.options.rawList.forEach(function (raw, index) {
promises.push(new Promise(function (resolve, reject) {
let group = index;
let source;
if (!raw.list) {
group = 0;
that.group = false;
this.group = false;
source = [raw];
}
else {
that.group = true;
this.group = true;
source = raw.list;
}
utils.fetch(source).then(function (list) {
Expand All @@ -480,7 +479,7 @@ const mediaPlayer = function (t, config) {
if (c) {
playlist.create();
controller.create();
that.mode();
this.mode();
}
});
},
Expand Down

1 comment on commit d2dc51c

@vercel
Copy link

@vercel vercel bot commented on d2dc51c Feb 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.