Inject one line of JavaScript from firefox addon -
i new ff extension creation, , rather specific.
when run js command in, example, firefox's built-in sandbox, works fine, make ff addon on click same js command execute. command works in web page:
javascript:$('.plus').click();
i suppose doesn't have work this:
var widget = require("widget").widget; var tabs = require('tabs'); exports.main = function() { new widget({ id: "user-widget-1", label: "my mozilla widget", contenturl: "http://www.mozilla.org/favicon.ico", onclick: function(event) { javascript:$('.plus').click(); } });
};
thanks.
$(.plus)
jquery syntax want load jquery content script widget. , want run code content script well, e.g.:
var data = require("sdk/self").data; new widget({ id: "user-widget-1", label: "my mozilla widget", contenturl: "http://example.com/foo.html", contentscriptfile: [data.url("jquery.js"), data.url("myscript.js")] });
and data/myscript.js
like:
$(document).ready(function() { $('.plus').click() });
if don't want click happen when document loads rather on specific event happening in extension, might want communicating content scripts. recommend reading general overview of content scripts.
Comments
Post a Comment