javascript - 加载我的脚本时出错(Google Chrome 扩展)

标签 javascript html google-chrome google-chrome-extension video-game-consoles

我制作了一个可以在 Google Chrome 扩展程序中运行的脚本。我赶紧解释道: 有一款网络游戏叫《龙之谷》。该脚本的作用是计算您必须向对手射击的力量。好吧,我试图将我的脚本容纳在外部服务器上,并且显然已加载但未执行(“加载”)。我认为错误可能出在代码中(我使用视频游戏的 javascript 来创建我的脚本)。代理原始代码、调用外部脚本的json和js:

Main Javascript in Codeviewer

Manifest.json

{
  "name": "DragonBound Aimbot 2.0",
  "version": "2.0.0",
  "manifest_version": 2,
  "description": "DragonBound Aimbot Hack - HTML5",
   "browser_action": {
    "default_popup": "popup.html",
    "default_icon": "icon.png"
  },
   "permissions": ["tabs", "notifications", "http://*.dropbox.com/u/91461506/*", "https://*.dropbox.com/u/91461506/*"],
   "background": { "page": "background.html", "persistent" : false },
"content_scripts": [
    {
      "matches": ["http://*.dragonbound.net/*","http://*.dropbox.com/u/91461506/*"],
      "js": ["jquery2.js","DragonBoundAimbot.js"],
      "run_at": "document_end"
    }
  ],
  "icons": {"16": "16.png", "48": "48.png", "128": "128.png"},
  "web_accessible_resources": [
    "ranks/*","48.png"
  ],
  "homepage_url" : "http://www.dropbox.com"
}

-代码调用外部脚本:

chrome.extension.sendRequest({type:"init"},function(response){

    if(response.ingame){
        chrome.extension.sendRequest({id:"loading",type:"notification2",text:["Loading","Loading scripts from dropbox.com..."]}, function(response) {});
        chrome.extension.sendRequest({type:"loadscript",url:'http://dl.dropbox.com/u/91461506/prueba2.js',cache:false}, function(response) {
            if(response.type == 1){
                eval(response.scriptcontent);

            }else if(response.type == 0){
                chrome.extension.sendRequest({id:"loading",type:"closenotification2"}, function(response) {})
                chrome.extension.sendRequest({id:"errorloading",time:0,type:"notification2",text:["Error","Failed to load the script, try again later"]}, function(response) {});
            }
        });
    }else{
        chrome.extension.sendRequest({type:"loadscript",url:'http://dl.dropbox.com/u/91461506/page.js',cache:false}, function(response) {
            if(response.type == 1){
                eval(response.scriptcontent);
                PAGEDBA.init();
            }else if(response.type == 0){

            }
        });
    }
});

我已经上传了 Google Chrome 的扩展程序以及未压缩的扩展程序:
Extension of Chrome .CRX

Estension uncompressed .ZIP

Preview Preview 2

游戏网页链接为DragonBound.net

最佳答案

您使用 eval(),但 eval() 在 chrome 扩展中被禁用。

http://developer.chrome.com/apps/sandboxingEval.html

关于javascript - 加载我的脚本时出错(Google Chrome 扩展),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13498879/

相关文章:

javascript - 在 for 循环中调用 Function.prototype.call.apply

javascript - 返回错误 : Unknown for all input 的 Word insertOoxml 方法

php - 将 POST 数据传递给两个 php 文件

javascript - 单击覆盖元素会触发单击底层元素

c# - 将页面重定向到不同的网络浏览器

google-chrome - 如何将 "allow-downloads"添加到沙箱属性列表中

javascript - Discord.js 计数器和存储

javascript - 如何在 jQuery 中使用行和列索引创建表?

javascript - 在 Chrome 的输入字段中双击文本选择

javascript - 如何使用 Javascript 在同一个 div 中显示表单数据?