firefox-addon

.setAttribute(“disabled”, false); changes editable attribute to false

戏子无情 提交于 2020-01-18 16:01:24
问题 I want to have textboxes related to radiobuttons. Therefore each radio button should enable it's textbox and disable the others. However when I set the disabled attribute of textbox to true, it changes the editable attribute too. I tried setting editable attribute true again but it did not work. This was what I tried: JS function: function enable(id) { var eleman = document.getElementById(id); eleman.setAttribute("disabled", false); eleman.setAttribute("editable", true); } XUL elements:

Interacting with firefox addons by javascript

孤街醉人 提交于 2020-01-17 08:38:07
问题 My case is when the user press f10 i want to run the copy paste addons in Firefox. in the case i want to implement a listener for this key and when this key pressed run the addons and copy text to the clipboard. How i can use the Firefox addons to copy the text by javascript? 回答1: This copies text to the native clipboard. Not logical clipboard. Apparently those are different things. var gClipboardHelper = Components.classes["@mozilla.org/widget/clipboardhelper;1"].getService(Components

firefox addon sdk page-worker blocks main thread

末鹿安然 提交于 2020-01-17 03:59:16
问题 I'm crawling about 20 Web sites in the background, when a page loads, within the addon script, with the page-worker. Unfortunately the browser freezes, unpredictable during that time. I tried to use timers.setTimeout(..., 0-400ms) and also tried the example from the wiki function executeSoon(aFunc) { var tm = Cc["@mozilla.org/thread-manager;1"] .getService(Ci.nsIThreadManager); tm.mainThread.dispatch({ run: function () { aFunc(); } }, Ci.nsIThread.DISPATCH_NORMAL); } but this also freezes the

X11 - XChangeProperty _NET_WM_ICON

我的梦境 提交于 2020-01-17 02:30:08
问题 I load an image, and then turn it to ARGB data. I use XChangeProperty , instead of making data be unsigned_char i made it long , when i copy paste and run this code from firefox scratchpad, environment > browser, i get a value of 1 for XChangeProperty meaning success, but the icon didn't change. I tested it on Mint 17.1 Cinnamon, and Ubuntu 14.04 with default window manager and also icewm. Is there anything wrong with this code? Does XChangeProperty not work on cinammon and ubuntu? Thanks

Get value of an input element on a firefox addon

泪湿孤枕 提交于 2020-01-16 17:26:50
问题 How i can fetch the value of this input element in my main.js: <input type="hidden" value="12124054" id="ctl00_cphContent_hdnID" name="ctl00$cphContent$hdnID"> I tried var id = document.getElementById("ctl00_cphContent_hdnPlayerID").value; and contentWindow.document.getElementById("ctl00_cphContent_hdnPlayerID").focus(); but i am getting errors that document and contentWindows are unidentified :( 回答1: You need to get the value from the page using a content script and then send the value to

Firefox addon using AngularJS - “ng-src” not working

岁酱吖の 提交于 2020-01-16 04:02:28
问题 I am working on a Firefox add-on that uses AngularJS. The issue is with 'ng-src'. It does not load the referenced image. When I switch to 'src' the image loads fine. Example.html and 'icon-32.png' are within same folder. Appreciate your help in making sense of this issue. Below are the code snippets. Example.html <html ng-app="MyAddon" ng-csp> <head> </head> <body ng-controller="MainCtrl" dir="{{dirr}}"> <div border="0"> <img ng-src="{{logo}}" width="32" align="center"> <input id="textbox"

Initiate TCP connection from a browser (extension)?

谁说我不能喝 提交于 2020-01-16 02:05:31
问题 Is it possible to initiate a TCP connection from a browser? If so, does there already exist browser (esp. Firefox and Chrome) extensions that do this? If no extensions exist yet, do you know the core elements/functions to create a Firefox/Chrome browser-initiated TCP connection? 回答1: The Chrome Browser (I think since v24 in the stable channel) lets you host a TCP server, and the samples indicate that it can connect to a telnet server, which means that it is also capable of being a TCP client.

How to control opening of next link

断了今生、忘了曾经 提交于 2020-01-16 00:40:32
问题 I was wondering how to control the next link the opens. Like I want to capture it and then redirect it to like open in new tab, or new background tab, or new window, or new pop behind window. This is to help this guys question that was unnecesarily duplicated: Can the new tab be opened in the background in HTML Form target="_blank"? It also helps me with my own stuff please. Thanks @errosman if you put javascript then those javascript guys invade and do lots of topic closing etc. when it

Using Mozilla firefox parser (Rendering Engine) in an extension

妖精的绣舞 提交于 2020-01-15 20:14:46
问题 I want to build a Firefox extension which will use Firefox parser(Rendering Engine). I want to feed some HTML data to parser and in return, it will give me HTML and java-script content separately. Then I will do some processing on it. Is there any API or another way to do it? 回答1: you mean something like this... let s = "<i>cool</i><script>alert('cool!')</script>"; var parser = new DOMParser(); let doc = parser.parseFromString(s, "text/html"); //do whatever you want.... doc.body.appendChild

document.caretPositionFromPoint grabbing too high

你。 提交于 2020-01-15 12:26:14
问题 I'm working on an update to my "jump-to-anchor" add-on which is a Firefox add-on to let you right-click somewhere in a doc to (hopefully) get the closest anchor above the click point. After submitting the add-on, I realized I could improve the algorithm by finding the actual text node where clicked, and look up from there (instead of the first children of the current clicked element). However, in my tests (against a page I happened to be reading, http://tools.ietf.org/html/rfc5323#section-2.3