@AnonEmoose: Nice one. Do you think such XUL overlays would be broadly used? Might get some more input for the discussion over at MozillaWiki.
alta88 wrote:if netscape (7.2) mail only is selected as default, the script will not run.
Interesting. This does work for SeaMonkey and should just as well work for good ol' Netscape. But since I've got no Netscape installation lying around and probably won't have any Netscape users anyway, I'll leave it at that. Should anybody want to further investigate, I'll accept patches...
zeniko wrote:@AnonEmoose: Nice one. Do you think such XUL overlays would be broadly used? Might get some more input for the discussion over at MozillaWiki.
Probably less now-a-days then before, since implementation of the install.rdf/chrome.manifest introduced in 1.5. However, it could be still be useful for extension development/testing (before rolling an xpi), or quick/dirty hacks you want to try out or keep seperate. Also with these overlays one could add dtd/properties/js/css files.
I generally use it to keep individual snippets seperated (and customize or add menu items instead of pure JS to create elements) and disabling a particular overlay is as easy as commenting out the line....
eg it can be used instead of or convert the menu entry on Tools folder from the js file to an xul file.
zeniko wrote: should just as well work for good ol' Netscape. But since I've got no Netscape installation lying around
well then how can you advertise it works for netscape? are you a tarot card reader or software developer?
perhaps a Known Issues or WONTFIX disclaimer would be appropriate.
i use NS7.2 mail exclusively for reading email and would gladly contribute a patch if i could..
alta88 wrote:well then how can you advertise it works for netscape? are you a tarot card reader or software developer?
zeniko wrote:This release should work for ...
To be honest, I've only tested it with Firefox and SeaMonkey. It should work just as well with all other applications mentioned (it's so simple I don't see why it shouldn't), but I don't care too much about actually verifying that. Consider your post a contribution to the "Known Issues" section (since I haven't verified your claim, I wouldn't be much better off than reading my cards if I officially saw this as an issue )...
<li> Updated <a href="data:application/x-javascript;charset=utf-8;base64,LyogIFRoaXMgc2NyaXB0IHdpbGwgYWRkICJFZGl0IHVzZXJDaHJvbWUuanMiIG1lbnVpdGVtIGluDQogICAgTVIgVGVjaCBMb2NhbCBJbnN0YWxsJ3MgRWRpdCBDb25maWcgQnV0dG9uIE1lbnUgdmVyc2lvbiAxLjMgICAgKi8NCg0KKGZ1bmN0aW9uKCkgew0KDQogIGZ1bmN0aW9uIGluc2VydE1lbnVJdGVtKHR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AgLy9NTFRJIDQuNS4xIGFuZCBhYm92ZQ0KICAgIGNtZCA9ICJldmVudC5zdG9wUHJvcGFnYXRpb24oKTsgb3Blbl9wcm9maWxlLmZpbGVSdW5Pck9wZW4obG9jYWxfY29tbW9uLmdldFNwZWNpYWxGb2xkZXJQYXRoKCdVQ2hybScpLCAndXNlckNocm9tZS5qcycsICdsb2NhbF9pbnN0YWxsLmRlZmF1bHRfSlNfZWRpdG9yJywgdHJ1ZSk7IjsNCg0KICBpbnNlcnRNZW51SXRlbSgiZWRpdGNvbmZpZ2ZpbGVzLXRvb2xiYXItYnV0dG9uIiwgY21kKTsNCiAgaW5zZXJ0TWVudUl0ZW0oInRvb2xzX2VkaXRfbXlfY29uZmlnIiwgY21kKTsNCg0KfSkoKTsNCg0KDQo%3D">Add 'Edit userChrome.js' on MR Tech Local Install's Edit Config button menu</a> this works with 4.6.4
desertfox wrote:is it possible to add an overlay or script for other windows or dialogs?
I was thinking about applying userChrome.js to all windows (as is done for userChrome.css), but then you'd have to add some boilerplate code around all your snippets to make sure you're in the right window (which practically prevents to have one-line solutions to common issues). For convenience, I've thus settled with the solution we're having right now.
What you can do however is use the newly added WindowHook snippet and then register a function to be called for the other window. For your case, this would look as follows :
WindowHook.register("chrome://stylish/content/stylish.xul", function(aWindow) { // use aWindow instead of window and aWindow.document instead of document });
desertfox wrote:is it possible to add an overlay or script for other windows or dialogs?
What you can do however is use the newly added WindowHook snippet and then register a function to be called for the other window. For your case, this would look as follows :
WindowHook.register("chrome://stylish/content/stylish.xul", function(aWindow) { // use aWindow instead of window and aWindow.document instead of document });
zeniko wrote:What you can do however is use the newly added WindowHook snippet and then register a function to be called for the other window. For your case, this would look as follows :
WindowHook.register("chrome://stylish/content/stylish.xul", function(aWindow) { // use aWindow instead of window and aWindow.document instead of document });
I was thinking that the WindowHook snippet could be installed in userChrome.js, and then all registered functions would work off of that separately in a uc.js file.
But it would appear that each registered function has to be attached to its own WindowHook snippet.
Is this correct?
You shouldn't have to include the WindowHook snippet more than once. Make sure that you're using the Sub-Script Loader based on setTimeout (available from the first post), otherwise the WindowHook object won't be available for the .uc.js files (unless you've inserted the WindowHook snippet above the Sub-Script Loader snippet).
mozillaZine is an independent Mozilla community and advocacy site. We're not affiliated or endorsed by the Mozilla Corporation but we love them just the same.