firefox-addon

Why the addone button is lost when I enable panel code?

亡梦爱人 提交于 2020-02-06 11:22:13
问题 Once the require("sdk/panel").Panel code is enabled, I cannot find the addone button, even cannot find it in customize page, what's wrong? var buttons = require('sdk/ui/button/action'); var tabs = require("sdk/tabs"); var data = require("sdk/panel").data; // var okentry=require("sdk/panel").Panel({ // contentURL: data.url("okentry.html"), // contentScriptFile: data.url("okentry.js") // }); var button = buttons.ActionButton({ id: "test-panel", label: "ok", icon: { "16": "./icon-16.png", "32":

Why the addone button is lost when I enable panel code?

爷,独闯天下 提交于 2020-02-06 11:22:09
问题 Once the require("sdk/panel").Panel code is enabled, I cannot find the addone button, even cannot find it in customize page, what's wrong? var buttons = require('sdk/ui/button/action'); var tabs = require("sdk/tabs"); var data = require("sdk/panel").data; // var okentry=require("sdk/panel").Panel({ // contentURL: data.url("okentry.html"), // contentScriptFile: data.url("okentry.js") // }); var button = buttons.ActionButton({ id: "test-panel", label: "ok", icon: { "16": "./icon-16.png", "32":

Firefox port.emit and port.on not working in extension

ぐ巨炮叔叔 提交于 2020-02-04 04:09:24
问题 I am trying to make a firefox extension. I need to exchange data with the background script(main.js) so I am trying to use port but it doesn't work. //Content.js self.port.on("alert",function(){alert()});//Listen to message self.port.emit("message",{message:"Hello"}); And in the main.js this is how I add the worker. So bascically, when the content script sends "message", the background script sends "alert" and the content script alerts. That doesn't happen //main.js pageMod.PageMod({ include:

Firefox port.emit and port.on not working in extension

青春壹個敷衍的年華 提交于 2020-02-04 04:07:49
问题 I am trying to make a firefox extension. I need to exchange data with the background script(main.js) so I am trying to use port but it doesn't work. //Content.js self.port.on("alert",function(){alert()});//Listen to message self.port.emit("message",{message:"Hello"}); And in the main.js this is how I add the worker. So bascically, when the content script sends "message", the background script sends "alert" and the content script alerts. That doesn't happen //main.js pageMod.PageMod({ include:

Firefox extension observing response

一笑奈何 提交于 2020-02-02 15:03:09
问题 I am trying using code // This is an active module of the goelvivek (8) Add-on exports.main = function() { var httpRequestObserver = { observe: function(subject, topic, data) { if (topic == "http-on-examine-response") { if(console) console.log(data); } } }; var {Cc, Ci, Cr} = require("chrome"); var observer = require("observer-service"); observerService = Components.classes["@mozilla.org/observer-service;1"]. getService(Components.interfaces.nsIObserverService); observerService.addObserver

FireFox SDK keydown / keyup events

隐身守侯 提交于 2020-01-30 07:54:05
问题 Is it possible to track keydown/keyup events in FireFox addons? I would like to implement something similar as following scenario: After pressing and holding the modifier key panel appears While holding these modifier keys, pressing the other keys will cause some actions with the panel When modifier key released, the panel disappears 回答1: You would need to register your event listener in each browser window for that. The high-level SDK API don't give you direct access to the browser window

How to flush a socket in my code

孤者浪人 提交于 2020-01-26 02:30:20
问题 I'm writing through a socket from a FF add-on to a java server. I write several requests and the server seems to process them one-by-one. In contrast, the responses from the server are processed all at the same time. I've tried flushing the out stream in the server but it does nothing. I don't understand what's going on. I appreciate any help, thank you. EDIT1: May be the add-on (client) is not flushing the input stream, is that possible? I'm using in the java server the out.println so the '

jQuery in firefox extension

谁都会走 提交于 2020-01-24 19:09:08
问题 I was creating a firefox extension. and I am including the jquery in the xul file as <script type="application/x-javascript" src="libs/project/libs/jquery.js" /> followed by some other files which uses jquery <script type="application/x-javascript" src="sample.js" /> <script type="application/x-javascript" src="sample2.js" /> . . . but here I am getting some errors like ReferenceError: jQuery is not defined TypeError: a is undefined ReferenceError: $ is not defined what should I do ? 回答1:

Link onclick - do something before following href

折月煮酒 提交于 2020-01-24 16:41:37
问题 How do I tell firefox browser to do something with a link(etc string trim) that i have just clicked then go to the modified link? Is is possible ? or is there an addon for this? 回答1: You don't need to create a plugin for that. This can be done with a simple script and Greasemonkey. It is also not necessary to add a click handler to every link. It is better to use event delegation : document.addEventListener('click', function(event) { if(event.target.nodeName === 'A') { var href = event.target

Link onclick - do something before following href

▼魔方 西西 提交于 2020-01-24 16:41:17
问题 How do I tell firefox browser to do something with a link(etc string trim) that i have just clicked then go to the modified link? Is is possible ? or is there an addon for this? 回答1: You don't need to create a plugin for that. This can be done with a simple script and Greasemonkey. It is also not necessary to add a click handler to every link. It is better to use event delegation : document.addEventListener('click', function(event) { if(event.target.nodeName === 'A') { var href = event.target