I am developing a Firefox addon using the Addon Builder. I use JQuery UI in my addon panel, and also would like to use it from the content script tied to the panel. In the panel page everything works fine. In the content script, JQuery seems to work, but I see no effect of JQuery UI calls, such as the slider case below.
Here is part of my main.js that defines the panel:
var panel = require("panel").Panel({
width: 350,
height: 400,
contentURL: require("self").data.url("panel.html"),
contentStyleFile: data.url("css/jquery-ui-1.8.22.custom.css"),
contentScriptFile: [
data.url("js/jquery-1.8.0.js"),
data.url("js/jquery-ui-1.8.22.custom.min.js"),
data.url("panel.js")
]
});
and here's the call that triggers the custom event:
panel.port.emit("loadingDataEvent", t );
In panel.js, the following part tries to use JQuery and JQuery UI. The JQuery call is completed sucessfully, however the JQuery UI call that tries to update the slider object does not have any effect on anything:
self.port.on("loadingDataEvent", function (t) {
$("#load-counter").html("<br />Not enough data yet. Approx. " + t + " secs. to go...");
$( "#progressbar" ).progressbar( "option", "value", (60-t)/60*100 );
document.defaultView.postMessage('{}', '*');
});
In my panel.html I can use both JQuery and JQueryUI without any problems by including them the conventional way:
<link type="text/css" href="css/jquery-ui-1.8.22.custom.css" rel="Stylesheet" />
<script type="text/javascript" src="js/jquery-1.8.0.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.22.custom.min.js"></script>
...
<script>
$(function() {
$( "#tabs" ).tabs();
....
});
</script>
Any ideas on where I could be doing a mistake?