你不能返回,除非你在一个函数中
您可以将所有代码包装在IIFE中
(function() { // your pre here}())或者
if (window.top == window.self) { if (document.readyState !== 'loading') return console.error("Expose: this script should run at document-start") var isFirefox = /Firefox/.test(navigator.userAgent) // Stage 1: Find corresponding rule var rules for (var i = 0; i < allRules.length; i++) if (allRules[i].hostname.indexOf(window.location.hostname) !== -1) { rules = allRules[i] break } if (!rules) return console.error("Expose: cant find corresponding rule") // Stage 2: Search for `main_out.js` if (isFirefox) { function bse_listener(e) { tryReplace(e.target, e) } window.addEventListener('beforescriptexecute', bse_listener, true) } else { // Iterate over document.head child elements and look for `main_out.js` for (var i = 0; i < document.head.childNodes.length; i++) if (tryReplace(document.head.childNodes[i])) return // If there are no desired element in document.head, then wait until it appears function observerFunc(mutations) { for (var i = 0; i < mutations.length; i++) { var addedNodes = mutations[i].addedNodes for (var j = 0; j < addedNodes.length; j++) if (tryReplace(addedNodes[j])) return observer.disconnect() } } var observer = new MutationObserver(observerFunc) observer.observe(document.head, {childList: true}) }}


