-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
07f6fe4
commit eb0ad20
Showing
9 changed files
with
89 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { instance } from "../utils/instance"; | ||
import type { Website } from "../websites"; | ||
|
||
const website: Website = { | ||
regexp: /.*docs\.qq\.com\/slide\/.+/, | ||
config: { | ||
initCopyEvent: false, | ||
captureInstance: true, | ||
runAt: "document-end", | ||
}, | ||
init: function () { | ||
if ( | ||
unsafeWindow.__ARK_EXTENSION_SERVICE__ && | ||
!unsafeWindow.clientVars.privilegeAttribute.can_copy | ||
) { | ||
let webpackJsonp = unsafeWindow.webpackJsonp; | ||
Object.defineProperty(unsafeWindow, "webpackJsonp", { | ||
get() { | ||
return webpackJsonp; | ||
}, | ||
set(newValue) { | ||
if (newValue.push.__HOOKED__) { | ||
return; | ||
} | ||
webpackJsonp = newValue; | ||
const originPush = webpackJsonp.push; | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
function push(...args: any[]) { | ||
const [, mods] = args[0]; | ||
for (const [key, fn] of Object.entries(mods)) { | ||
const stringifyFn = String(fn); | ||
if (/this\.shouldResponseCopy/.test(stringifyFn)) { | ||
const next = stringifyFn.replace(/this\.shouldResponseCopy\(/g, "(() => true)("); | ||
// .replace(/this.storeManager=/g, "window.storeManager=this.storeManager=") | ||
mods[key] = new Function(`return (${next})`)(); | ||
} | ||
} | ||
// @ts-expect-error this | ||
return originPush.call(this, ...args); | ||
} | ||
push.__HOOKED__ = 1; | ||
webpackJsonp.push = push; | ||
}, | ||
}); | ||
} | ||
window.onload = () => { | ||
instance.disable(); | ||
}; | ||
}, | ||
}; | ||
|
||
export default website; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,4 +73,5 @@ class Instance { | |
} | ||
|
||
export const instance = new Instance(); | ||
|
||
export default instance; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters