I'm trying to write my first extension with Firefox Addon SDK - current code is just testing what is possible (just to clarify).
Problematic part seems to be extension not working after first load of the page and moving beetween subpages. Page loads fully, extension "kicks in" and modifies page as supposed to (on site.com/directory for example), but after moving to subpage (site.com/directory/all) extension no longer works. If I do CTRL + R and refresh page, site loads again and extension works even on that subpage.
main.js
// Import the page-mod API
var pageMod = require("sdk/page-mod");
// Import the self API
var self = require("sdk/self");
// Create a page mod
pageMod.PageMod({
include: "*",
contentScriptFile: [self.data.url("jquery-2.1.1.min.js"), self.data.url("script.js")]
});
script.js
$(".directory_header").css('border', '#500 solid 10px');
Include is set like this just for testing purposes. Site script is supossed to work on twitch.tv and their /directory subpage. Currently looking for directory_header class and setting border around it, however after moving to directory/all border will not load again until the page is reloaded fully. Is there a reason for this behaviour?
What Ive tried
I tried to use
attachTo: ["top", "frame", "existing"]
which from first look seemed like it could help, but it did not. Similar with
contentScriptWhen: 'start'
again, with no result.