I recently created a userscript that allows the use of twitch.tv emotes on hitbox.tv. The userscript works completely fine in Tampermonkey for Chrome, however, when I try to load the unpackaged script and manifest files to create a chrome extension, it doesn't work. I don't know what might be causing the problem so if any of you guys could give me some support, it would be greatly appreciated.

Thanks in advanced! If you need any more information, please just ask and I will try and provide some more.

-Tom.

有帮助吗?

解决方案

Your manifest:

{
    "manifest_version": 2,
    "content_scripts": [ {
        "exclude_globs":    [  ],
        "include_globs":    [ "*" ],
        "js":               [ "465792.user.js" ],
        "matches":          [   "http://hitbox.tv/*",
                                "https://hitbox.tv/*"
                            ]
    } ],
    "description":  "Allows the use of Twitch emotes on Hitbox.",
        "icons": { "128": "icon128.png" },
    "name":         "Hitbox Emotes",
    "version":      "1.1.4"
}

Your content script:

emotify.emoticons("",yourHundredLineObject);

I see two things that could be causing problems:

  1. The websitee hitbox.tv prepended a www. to the url, which doesn't match what you listed. I think you want matches: ["*://*.hitbox.tv/"] (reference). Your globs also don't appear to be doing anything, and can be removed.

  2. Your content script is trying to use the hitbox defined function emotify.emoticons. Isolated worlds will prevent this. In order to call the function, you'll need to have a different content script write <script src="465792.user.js"></script> into the webpage (example).

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top