Skip to content

Commit

Permalink
fix(script): 修复智慧树最新版脚本被检测的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
enncy committed Sep 15, 2023
1 parent b1eba8f commit adfe7a0
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions packages/scripts/src/projects/zhs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ async function watch(
function switchLine(definition: 'line1bq' | 'line1gq' = 'line1bq') {
const target = $el(`.definiLines .${definition}`);
if (target) {
stopPropagationClick(target);
jQueryClick(target);
}
}

Expand All @@ -653,17 +653,17 @@ function switchLine(definition: 'line1bq' | 'line1gq' = 'line1bq') {
function switchPlaybackRate(playbackRate: number) {
const target = $el(`.speedList [rate="${playbackRate === 1 ? '1.0' : playbackRate}"]`);
if (target) {
stopPropagationClick(target);
jQueryClick(target);
}
}

function stopPropagationClick(el: HTMLElement) {
const func = function (e: MouseEvent) {
e.stopPropagation();
el.removeEventListener('click', func);
};
el.addEventListener('click', func);
el.click();
function jQueryClick(target: HTMLElement): void {
for (const key in target) {
if (key.includes('jQuery')) {
// @ts-ignore
return target[key].events.click[0].handler();
}
}
}

/**
Expand Down

0 comments on commit adfe7a0

Please sign in to comment.