javascript - What does paragraph about figuring out XUL elements mean in MDN document: "How to convert an overlay extension to restartless" -
recently friend of mine , have been working on firefox extension. handed code me today, , i've been trying make restartless. used tutorial how convert overlay extension restartless (on mdn). since don't have experience working javascript , extensions in general, wondering if understand step number 6 means here in tutorial. saying can't use "no more xul overlays", , understand this. don't understand how part:
figure out xul elements need create add-on add interface, needs go xul window, , how it. docs: document.getelementbyid(), document.createelement(), element reference, node reference (dom elements nodes).
i decided against using document.loadoverlay, since it's buggy. i'm not sure if helps much, here code our overlay.xul. again, sorry if question basic, appreciated. if need provide more code please let me know. @ point thought code our overlay.xul file important.
<?xml version="1.0" encoding="utf-8"?> <overlay id="my-overlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script type="application/javascript;version=1.7" src="overlay.js"/> </overlay>
xul overlays can used wide variety of things in firefox. step 6: no more xul overlays focuses more on ui elements other possible uses of overlays (e.g. loading scripts, doing).
in xul overlay extension, ui elements added providing xul overlay file each portion of interface modified. xul overlay extension not need consider removal of interface elements, removed when extension removed or disabled.
in restartless extension, ui elements added programmatically each time extension started. ui elements added once; , must added both each open window , when each new window opened. when extension disabled, or removed, ui elements must programmatically removed firefox.
the portion quoted attempting describe process of converting actual xul overlay (used modify firefox ui) programmatically inserting (and removing) ui elements. common ui element toolbar button, anything. because anything, description relatively vague.
that entire section, step 6: no more xul overlays, use expansion. remember planning based on code used when converting extension xul overlay. had wanted clean code bit, , account more cases. however, having example in there helpful. i'll see if can update in next week or (if else not beat me it).
in case:
based on overlay code included in question, section not talking directly how using xul overlay might desired. part quoted:
figure out xul elements need create add-on add interface, needs go xul window, , how it. docs: [document.getelementbyid()][3], [document.createelement()][4], [element reference][5], [node reference][6] (dom elements nodes).
is talking adding ui elements firefox, not doing overlay.
what going need determine how going apply script, overlay.js
, whatever adding to. remember, need able remove when extension disabled/removed/updated.
in order provide more detailed information, going need know adding script to. this, need include copy of chrome.manifest
file. might helpful know script functionality may more appropriately handled without applying script in way implied overlay. however, should ask new, separate question, not modify question ask different.
Comments
Post a Comment