// ==UserScript==
// @name 拦截脚本加载
// @namespace http://tampermonkey.net/
// @version 2024-09-01
// @description try to take over the world!
// @author You
// @match https://dailydictation.com/exercises/ielts-listening/cam19-test-3-part-2.1375/listen-and-type
// @icon https://www.google.com/s2/favicons?sz=64&domain=dailydictation.com
// @grant GM_xmlhttpRequest
// @grant unsafeWindow
// @run-at document-start
// @grant GM_addElement
// ==/UserScript==
const origiforEach=unsafeWindow.Array.prototype.forEach
function runScript(){
GM_xmlhttpRequest({
url:"https://dailydictation.com/assets/appDictation.3872752ea90dfe30bc7c.js",
method :"GET",
headers: {
"Content-type": "application/x-www-form-urlencoded"
},
onload:function(xhr){
console.log(xhr.responseText);
GM_addElement('script', {
textContent: xhr.responseText // .replace('An({', 'false && An({')
});
}
});
}
unsafeWindow.Array.prototype.forEach=function(...args){
let err= new Error('大赦天下');
// console.log('keys大赦天下',err)
if(err.stack.indexOf('appDictation.3872752ea90dfe30bc7c.js')!==-1){
console.log("拦截成功")
runScript()
throw err;
}
return origiforEach.call(this,...args)
}