Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hexo-theme-shokax

Package Overview
Dependencies
Maintainers
0
Versions
101
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.5.0-dev-815e373 to 0.5.0-dev-e34ffd2

26

package.json
{
"name": "hexo-theme-shokax",
"version": "0.5.0-dev-815e373",
"version": "0.5.0-dev-e34ffd2",
"description": "a hexo theme based on shoka",

@@ -16,19 +16,19 @@ "main": "index.js",

"@types/fancybox": "^3.5.7",
"@types/jquery": "^3.5.30",
"@types/jquery": "^3.5.32",
"@types/js-yaml": "^4.0.9",
"@types/katex": "^0.16.7",
"@types/node": "^22.5.5",
"@types/node": "^22.8.6",
"@types/quicklink": "^2.3.4",
"@typescript-eslint/eslint-plugin": "^8.6.0",
"@typescript-eslint/parser": "^8.6.0",
"eslint": "^9.11.0",
"@typescript-eslint/eslint-plugin": "^8.12.2",
"@typescript-eslint/parser": "^8.12.2",
"eslint": "^9.13.0",
"eslint-config-standard": "~17",
"eslint-plugin-vue": "^9.28.0",
"eslint-plugin-vue": "^9.30.0",
"glob": "^11.0.0",
"typescript": "^5.6.2"
"typescript": "^5.6.3"
},
"dependencies": {
"@algolia/client-search": "^5.5.3",
"@algolia/client-search": "^5.12.0",
"@waline/client": "^3.3.2",
"algoliasearch": "5.10.2",
"algoliasearch": "5.12.0",
"esbuild": "^0.24.0",

@@ -42,9 +42,7 @@ "hexo": "^7.3.0",

"hexo-util": "^3.3.0",
"instantsearch.js": "^4.74.1",
"instantsearch.js": "^4.75.3",
"js-yaml": "^4.1.0",
"katex": "^0.16.11",
"mouse-firework": "^0.0.6",
"quicklink": "^2.3.0",
"theme-shokax-anime": "^0.0.7",
"theme-shokax-pjax": "^0.0.3",
"twikoo": "^1.6.39",

@@ -54,3 +52,3 @@ "unlazy": "^0.11.3"

"engines": {
"node": ">=18.0.0"
"node": ">=20.0.0"
},

@@ -57,0 +55,0 @@ "engineStrict": true,

@@ -12,2 +12,3 @@ **🏗️ 当前分支为 ShokaX 0.5 Dev分支,不建议普通用户使用** \

- 引入 CI 自动测试
- 重构 player (暂时移除)
- 优化 menu 配置格式

@@ -14,0 +15,0 @@ - 优化和异步化 Smart Bundle 技术

@@ -62,6 +62,2 @@ var __create = Object.create;

},
quicklink: {
timeout: theme.quicklink.timeout,
priority: theme.quicklink.priority
},
playerAPI: theme.playerAPI,

@@ -68,0 +64,0 @@ experiments: {

import { CONFIG } from '../globals/globalVars'
import { init, RecentComments } from '@waline/client'
// @ts-ignore
import { pageviewCount } from '@waline/client/pageview'
// @ts-ignore
await import('@waline/client/style')

@@ -77,3 +79,2 @@

commentLink.href = root + item.href
commentLink['data-pjax-state'] = 'data-pjax-state'
commentEl.className = 'item'

@@ -80,0 +81,0 @@

@@ -43,3 +43,2 @@ import * as twikoo from 'twikoo'

commentLink.href = root + item.href
commentLink['data-pjax-state'] = 'data-pjax-state'
commentEl.className = 'item'

@@ -46,0 +45,0 @@

@@ -1,3 +0,1 @@

import { $dom } from '../library/dom'
import Pjax from 'theme-shokax-pjax'
import initProto from '../library/proto'

@@ -32,3 +30,2 @@

export let LOCAL_URL = window.location.href
export let pjax:Pjax

@@ -70,6 +67,2 @@ export function setSiteNavHeight (value:number):void {

export function setPjax (value:Pjax):void {
pjax = value
}
export function setOriginTitle (value:string):void {

@@ -76,0 +69,0 @@ originTitle = value

@@ -112,7 +112,2 @@ type vendorUrl = {

walinePageView: boolean
quicklink: {
ignores: any
timeout: number
priority: boolean
}
playerAPI: string

@@ -119,0 +114,0 @@ experiments: {

import { $dom } from '../library/dom'
import { vendorCss, vendorJs } from '../library/loadFile'
import { insertAfter } from '../library/proto'

@@ -8,70 +7,61 @@

if (document.querySelector(p + ' .md img')) {
vendorCss('fancybox')
vendorCss('justifiedGallery')
vendorJs('jquery', ()=>{
vendorJs('justifiedGallery',()=>{
vendorJs('fancybox', () => {
const q = jQuery.noConflict()
const q = jQuery.noConflict()
$dom.each(p + ' p.gallery', (element) => {
const box = document.createElement('div')
box.className = 'gallery'
box.setAttribute('data-height', String(element.getAttribute('data-height') || 220))
$dom.each(p + ' p.gallery', (element) => {
const box = document.createElement('div')
box.className = 'gallery'
box.setAttribute('data-height', String(element.getAttribute('data-height') || 220))
box.innerHTML = element.innerHTML.replace(/<br>/g, '')
box.innerHTML = element.innerHTML.replace(/<br>/g, '')
element.parentNode.insertBefore(box, element)
element.remove()
})
element.parentNode.insertBefore(box, element)
element.remove()
})
$dom.each(p + ' .md img:not(.emoji):not(.vemoji)', (element) => {
const $image = q(element)
const imageLink = $image.attr('data-src') || $image.attr('src') // 替换
const $imageWrapLink = $image.wrap('<a class="fancybox" href="' + imageLink + '" itemscope itemtype="https://schema.org/ImageObject" itemprop="url"></a>').parent('a')
let info; let captionClass = 'image-info'
if (!$image.is('a img')) {
$image.data('safe-src', imageLink)
if (!$image.is('.gallery img')) {
$imageWrapLink.attr('data-fancybox', 'default').attr('rel', 'default')
} else {
captionClass = 'jg-caption'
}
}
if ((info = element.getAttribute('title'))) {
$imageWrapLink.attr('data-caption', info)
const para = document.createElement('span')
const txt = document.createTextNode(info)
para.appendChild(txt)
para.addClass(captionClass)
insertAfter(element, para)
}
})
$dom.each(p + ' .md img:not(.emoji):not(.vemoji)', (element) => {
const $image = q(element)
const imageLink = $image.attr('data-src') || $image.attr('src') // 替换
const $imageWrapLink = $image.wrap('<a class="fancybox" href="' + imageLink + '" itemscope itemtype="https://schema.org/ImageObject" itemprop="url"></a>').parent('a')
let info; let captionClass = 'image-info'
if (!$image.is('a img')) {
$image.data('safe-src', imageLink)
if (!$image.is('.gallery img')) {
$imageWrapLink.attr('data-fancybox', 'default').attr('rel', 'default')
} else {
captionClass = 'jg-caption'
}
}
if ((info = element.getAttribute('title'))) {
$imageWrapLink.attr('data-caption', info)
const para = document.createElement('span')
const txt = document.createTextNode(info)
para.appendChild(txt)
para.addClass(captionClass)
insertAfter(element, para)
}
})
$dom.each(p + ' div.gallery', (el, i) => {
// @ts-ignore
q(el).justifiedGallery({
rowHeight: q(el).data('height') || 120,
rel: 'gallery-' + i
}).on('jg.complete', function () {
q(this).find('a').each((k, ele) => {
ele.setAttribute('data-fancybox', 'gallery-' + i)
})
})
})
q.fancybox.defaults.hash = false
q(p + ' .fancybox').fancybox({
loop: true,
// @ts-ignore
helpers: {
overlay: {
locked: false
}
}
})
// @ts-ignore
}, window.jQuery)
$dom.each(p + ' div.gallery', (el, i) => {
// @ts-ignore
q(el).justifiedGallery({
rowHeight: q(el).data('height') || 120,
rel: 'gallery-' + i
}).on('jg.complete', function () {
q(this).find('a').each((k, ele) => {
ele.setAttribute('data-fancybox', 'gallery-' + i)
})
})
})
q.fancybox.defaults.hash = false
q(p + ' .fancybox').fancybox({
loop: true,
// @ts-ignore
helpers: {
overlay: {
locked: false
}
}
})
}
}

@@ -234,11 +234,11 @@ import { $dom } from '../library/dom'

if (__shokax_player__) {
$dom.each('.md div.player', (element) => {
mediaPlayer(element, {
type: element.getAttribute('data-type'),
mode: 'order',
btns: []
}).player.load(JSON.parse(element.getAttribute('data-src'))).fetch()
})
}
// if (__shokax_player__) {
// $dom.each('.md div.player', (element) => {
// mediaPlayer(element, {
// type: element.getAttribute('data-type'),
// mode: 'order',
// btns: []
// }).player.load(JSON.parse(element.getAttribute('data-src'))).fetch()
// })
// }

@@ -245,0 +245,0 @@ const angleDown = document.querySelectorAll('.show-btn .i-angle-down')

@@ -8,3 +8,3 @@ import { CONFIG, siteSearch } from '../globals/globalVars'

export function algoliaSearch (pjax) {
export function algoliaSearch () {
const search = instantsearch({

@@ -22,6 +22,2 @@ indexName: CONFIG.search.indexName,

search.on('render', () => {
pjax.refresh(document.getElementById("search-hits"))
})
// Registering Widgets

@@ -110,3 +106,3 @@ search.addWidgets([

document.querySelector('.close-btn').addEventListener('click', onPopupClose)
window.addEventListener('pjax:success', onPopupClose)
// window.addEventListener('pjax:success', onPopupClose)
window.addEventListener('keyup', (event) => {

@@ -113,0 +109,0 @@ if (event.key === 'Escape') {

@@ -48,10 +48,10 @@ import { backToTopHandle, goToBottomHandle, goToCommentHandle, sideBarToggleHandle } from '../components/sidebar'

if (__shokax_player__) {
mediaPlayer(toolPlayer)
// if (__shokax_player__) {
// mediaPlayer(toolPlayer)
//
// document.querySelector('main').addEventListener('click', () => {
// toolPlayer.player.mini()
// })
// }
document.querySelector('main').addEventListener('click', () => {
toolPlayer.player.mini()
})
}
const createIntersectionObserver = () => {

@@ -58,0 +58,0 @@ // waves在视口外时停止动画

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

import { $dom } from '../library/dom'
import { cardActive } from '../page/common'
import { pageScroll, transition } from '../library/anime'
import { vendorCss, vendorJs } from '../library/loadFile'
import { pjaxScript } from '../library/scriptPjax'
import { resizeHandle } from '../globals/handles'
import {
CONFIG,
loadCat,
menuToggle,
setLocalHash, setLocalUrl, setOriginTitle,
sideBar,
toolPlayer
} from '../globals/globalVars'
import { pagePosition, positionInit } from '../globals/tools'
import { positionInit } from '../globals/tools'
import { menuActive, sideBarTab, sidebarTOC } from '../components/sidebar'

@@ -21,17 +12,2 @@ import { Loader, isOutime } from '../globals/thirdparty'

export const pjaxReload = () => {
pagePosition()
if (sideBar.hasClass('on')) {
transition(sideBar, 0, () => {
sideBar.removeClass('on')
menuToggle.removeClass('close')
}) // 'transition.slideRightOut'
}
const mainNode = document.getElementById('main')
mainNode.innerHTML = ''
mainNode.appendChild(loadCat.lastChild.cloneNode(true))
pageScroll(0)
}
export const siteRefresh = async (reload) => {

@@ -41,7 +17,5 @@ setLocalHash(0)

vendorCss('katex');
// @ts-ignore
// await import('katex/dist/katex.min.css')
// vendorJs('copy_tex')
await import('katex/dist/contrib/copy-tex.mjs')
vendorCss('mermaid')

@@ -66,6 +40,2 @@ // 懒加载背景图

if (reload !== 1) {
$dom.each('script[data-pjax]', pjaxScript)
}
setOriginTitle(document.title)

@@ -129,6 +99,11 @@

if (__shokax_player__) {
toolPlayer.player.load(LOCAL.audio || CONFIG.audio || {})
// if (__shokax_player__) {
// toolPlayer.player.load(LOCAL.audio || CONFIG.audio || {})
// }
if (sessionStorage.getItem('loaded') === 'true') {
Loader.hide(30)
} else {
sessionStorage.setItem('loaded', 'true')
Loader.hide(500)
}
Loader.hide(100)

@@ -135,0 +110,0 @@ setTimeout(() => {

import domInit from './domInit'
import { pjaxReload, siteRefresh } from './refresh'
import { siteRefresh } from './refresh'
import { cloudflareInit } from '../components/cloudflare'
import { BODY, CONFIG, pjax, setPjax, setSiteSearch, siteSearch } from '../globals/globalVars'
import { BODY, CONFIG, setSiteSearch, siteSearch } from '../globals/globalVars'
import { autoDarkmode, themeColorListener } from '../globals/themeColor'
import { resizeHandle, scrollHandle, visibilityListener } from '../globals/handles'
import { pagePosition } from '../globals/tools'
import Pjax from 'theme-shokax-pjax'
import { initVue } from '../library/vue'

@@ -18,19 +17,2 @@ import { $dom } from '../library/dom'

setPjax(new Pjax({
selectors: [
'head title',
'.languages',
'.twikoo',
'.pjax',
'.leancloud-recent-comment',
'script[data-config]'
],
cacheBust: false
}))
CONFIG.quicklink.ignores = LOCAL.ignores
import('quicklink').then(({listen}) => {
listen(CONFIG.quicklink)
})
autoDarkmode()

@@ -57,3 +39,3 @@

import('../page/search').then(({algoliaSearch}) => {
algoliaSearch(pjax)
algoliaSearch()
})

@@ -88,14 +70,7 @@

window.addEventListener('pjax:send', pjaxReload, {
passive: true
})
window.addEventListener('pjax:success', siteRefresh, {
passive: true
}) // 默认会传入一个event参数
window.addEventListener('beforeunload', () => {
window.addEventListener('visibilitychange', () => {
pagePosition()
})
await siteRefresh(1)
// TODO 修复内页跳转后重复出现加载动画的问题
}

@@ -102,0 +77,0 @@

@@ -0,1 +1,3 @@

// 临时性弃用,等待重构
import { CONFIG, originTitle } from './globals/globalVars'

@@ -2,0 +4,0 @@ import { showtip } from './globals/tools'

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

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