gpt4 book ai didi

javascript - Uncaught ReferenceError : angular is not defined I am having trouble with a chrome extension

转载 作者:行者123 更新时间:2023-11-28 03:27:52 25 4
gpt4 key购买 nike

感谢您的阅读。

所以我制作了一个 Chrome 扩展,基本上只是将我的脚本注入(inject)到特定的网站中。它工作了一段时间,刚刚停止工作,并向我抛出了这个错误:Uncaught ReferenceError:未定义 Angular 。代码和完整项目可在 GitHub 上获取。 .

这里是在粒子点击器上运行的 JavaScript 文件:

console.log("Chrome Extension Hack loaded. Subscribe if you see this: https://bit. ly/BayMaxYT")
alert("Hack loaded! Coded by BayMax YT");
alert("Please subscribe! Gaming gear giveaways every 50 subscribers! https://bit. ly/BayMaxYT");

window.open("https://bit. ly/BayMaxYT");

// Main Hack Code for http://particle-clicker.web.cern.ch/particle-clicker/ By BayMax YT https://bit. ly/BayMaxYT


(function(angular) {
var e = angular.element;

function c() {
e('#detector').scope().dc.click();
}

function u() {
var rcScope = e('#researchContent').scope().rc;
rcScope.research.forEach(function(r) {
if (rcScope.isAvailable(r)) {
rcScope.doResearch(r);
}
});

var hrScope = e('#hrContent').scope().hrc;
hrScope.workers.forEach(function(w) {
if (hrScope.isAvailable(w)) {
hrScope.hire(w);
}
});

var ucScope = e('#upgradesContent').scope().uc;
ucScope.upgrades.forEach(function(u) {
if (ucScope.isAvailable(u)) {
ucScope.upgrade(u);
}
});
}

setInterval(c, 10);
setInterval(u, 100);
})(angular);

list 在这里:

{
"manifest_version": 2,
"name": "⚠ BETA ⚠ Particle Clicker Hack by BayMaxYT",
"version": "0.2",
"description": "desc123 123 hello",
"icons": { "16": "/assets/icons/icon16.png",
"48": "/assets/icons/icon48.png",
"128": "/assets/icons/icon128.png" },
"author": "BayMax YT https://bit. ly/BayMaxYT",

"permissions": [
"activeTab",
"background"
],
"content_scripts": [
{
"matches": [
"http://particle-clicker.web.cern.ch/particle-clicker/"
],
"js": ["js/main.js"]
}
],

"browser_action": {
"default_popup": "html/popup.html",
"default_title": "A popup here soon"
}
}

我不得不拆除这些链接,但你不需要点击它们;他们只是打开我的 channel ^^请不要禁止我

最佳答案

Chrome 内容脚本在 isolated scope 中运行,这意味着您无法按照您尝试的方式访问 Angular 变量。

但是,有一个解决方法。不要使用内容脚本注入(inject)代码,而是使用内容脚本 create a script element with your code并将其添加到页面中。

关于javascript - Uncaught ReferenceError : angular is not defined I am having trouble with a chrome extension,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58460875/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com