dougeeebear wrote:This is for userChrome.JS Taken from the Disable Backspace Navigation extension, this removes the back navigation function from the backspace key. Great for when forum posting and you hit the backspace key, only to be taken to the previous page.
I am also using Paste and Go in my userChrome.js, but it has the license block included.
So I'm not sure whether I should post it or not.
I'm thinking if I leave the license block with it, it should be ok.
Could someone please advise?
dougeeebear wrote:I'm thinking if I leave the license block with it, it should be ok. Could someone please advise?
This depends of course on what the license block says. If it's the usual Mozilla GPL/LGPL/MPL tri-license (or actually any sort of open source license), there shouldn't be any reason why you couldn't post the code here. As for having to include the license and as for what to do with non-open source licenses, you'll probably just have to read the license first...
I think I'll pass on posting the Paste and Go code.
If anyone wants to use it in your userChrome.js instead of as an extension, all you have to do is extract the contents of pasteandgo.js from the xpi and add it to your userChrome.js.
The license is indeed the usual tri-license. So you could at least have posted a direct link to <a href="jar:jar:http://tecwizards.de/mozilla/pasteandgo_0_4_3.xpi!/chrome/pasteandgo.jar!/content/pasteandgo/pasteandgo.js">pasteandgo.js</a>...
I know, there are just so many things about 2.0 that I love (I've been using it thus far for testing purposes only, not casual use). I can hardly wait for it to go at least beta, and especially final.
User Agent Extensions AMD64/2.41GHz RAM/1.0GB ATI/256MB-GDDR3/128-bit/8xAGP Cable6.0M/384kbps
Is there anything in this that would cause the close tab in context menu to always be visible even when a tab is not present. As an extension it works fine, but as userChrome.xul it doesn't
function ctc_init() { document.getElementById("contentAreaContextMenu").addEventListener("popupshowing",ctc_hide,false); }
// hide the Close Tab item when approproiate (use same logic as for Back, Stop etc, but also hide when not in tabs mode) function ctc_hide() { var cm = gContextMenu; var intabmode = (gBrowser.localName == 'tabbrowser' && gBrowser.mTabContainer.childNodes.length > 1); document.getElementById("context-closetab").hidden = ( !intabmode || cm.isTextSelected || cm.onLink || cm.onImage || cm.onTextInput ); }
@Greg S: This won't work because the "load" event is dispatched on the window before your overlay is loaded (to be precise: the content of the file userChrome.js - and thus also userChrome.xul - is loaded during the "load" event). Replacing the <code>window.addEventListener("load", ...)</code> part with just <code>ctc_init()</code> should do the trick.
zeniko wrote:This won't work because the "load" event is dispatched on the window before your overlay is loaded (to be precise: the content of the file userChrome.js - and thus also userChrome.xul - is loaded during the "load" event). Replacing the <code>window.addEventListener("load", ...)</code> part with just <code>ctc_init()</code> should do the trick.
Ah... thanks. My code is also working now
<a href="view-source:data:application/vnd.mozilla.xul+xml;base64,CjxvdmVybGF5IGlkPSJ2aWV3TGlua1NvdXJjZSIgeG1sbnM9Imh0dHA6Ly93d3cubW96aWxsYS5vcmcva2V5bWFzdGVyL2dhdGVrZWVwZXIvdGhlcmUuaXMub25seS54dWwiPgoKICA8c2NyaXB0IHR5cGU9ImFwcGxpY2F0aW9uL3gtamF2YXNjcmlwdCI%2BCiAgPCFbQ0RBVEFbCiAgICBmdW5jdGlvbiB2aWV3TGlua1NvdXJjZShhRXZlbnQpIHsKICAgICAgdHJ5IHsKICAgICAgICBnQnJvd3Nlci5tUHJlZnMuZ2V0Qm9vbFByZWYoInZpZXdTb3VyY2VJblRhYi5sb2FkSW5OZXdUYWIiKTsKICAgICAgfSBjYXRjaChleCkgewogICAgICAgIGdCcm93c2VyLm1QcmVmcy5zZXRCb29sUHJlZigidmlld1NvdXJjZUluVGFiLmxvYWRJbk5ld1RhYiIsIHRydWUpOwogICAgICB9CgogICAgICB0cnkgewogICAgICAgIGdCcm93c2VyLm1QcmVmcy5nZXRCb29sUHJlZigidmlld1NvdXJjZUluVGFiLmxvYWRJbkJhY2tncm91bmQiKTsKICAgICAgfSBjYXRjaChleCkgewogICAgICAgIGdCcm93c2VyLm1QcmVmcy5zZXRCb29sUHJlZigidmlld1NvdXJjZUluVGFiLmxvYWRJbkJhY2tncm91bmQiLCBmYWxzZSk7CiAgICAgIH0KCiAgICAgIHZhciB1cmwgPSBnQ29udGV4dE1lbnUubGlua1VSTDsKCiAgICAgIGlmKGFFdmVudCkgewogICAgICAgIGFFdmVudC5zdG9wUHJvcGFnYXRpb24oKTsKICAgICAgICBzd2l0Y2goYUV2ZW50LmJ1dHRvbikgewogICAgICAgICAgY2FzZSAxOgogICAgICAgICAgICBpZihnQnJvd3Nlci5tUHJlZnMuZ2V0Qm9vbFByZWYoInZpZXdTb3VyY2VJblRhYi5sb2FkSW5OZXdUYWIiKSkgewogICAgICAgICAgICAgIHZhciBuZXdUYWIgPSBnQnJvd3Nlci5hZGRUYWIoInZpZXctc291cmNlOiIgKyB1cmwpOyAvL3ZpZXcgc291cmNlIGluIG5ldyB0YWIKICAgICAgICAgICAgICBpZighZ0Jyb3dzZXIubVByZWZzLmdldEJvb2xQcmVmKCJ2aWV3U291cmNlSW5UYWIubG9hZEluQmFja2dyb3VuZCIpKQogICAgICAgICAgICAgICAgZ0Jyb3dzZXIuc2VsZWN0ZWRUYWIgPSBuZXdUYWI7ICAvL2ZvY3VzIG5ldyB0YWIKICAgICAgICAgICAgfSBlbHNlIGxvYWRVUkkoInZpZXctc291cmNlOiIgKyB1cmwpOyAgIC8vdmlldyBzb3VyY2UgaW4gY3VycmVudCB0YWIKICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICBjYXNlIDI6CiAgICAgICAgICAgIG9wZW5XZWJQYW5lbCh1cmwsICJ2aWV3LXNvdXJjZToiICsgdXJsKTsgLy92aWV3IHNvdXJjZSBpbiBzaWRlYmFyCiAgICAgICAgICAgIGJyZWFrOwogICAgICAgIH0KICAgICAgICBjbG9zZU1lbnVzKGFFdmVudC50YXJnZXQpOwogICAgICB9IGVsc2UgewogICAgICAgIGlmKHR5cGVvZiBnVmlld1NvdXJjZVV0aWxzID09ICdvYmplY3QnKQogICAgICAgICAgVmlld1NvdXJjZU9mVVJMKHVybCk7CiAgICAgICAgZWxzZQogICAgICAgICAgQnJvd3NlclZpZXdTb3VyY2VPZlVSTCh1cmwpOwogICAgICB9CiAgICB9CgogICAgZnVuY3Rpb24gdmlld0xpbmtTb3VyY2VQb3B1cCgpIHsKICAgICAgdmFyIHNjaGVtZXMgPSAiaHR0cHM%2FfGZ0cHxmaWxlfGRhdGF8cmVzb3VyY2V8Y2hyb21lfGFib3V0fGphciI7CiAgICAgIHZhciByZWdTY2hlbWUgPSBuZXcgUmVnRXhwKHNjaGVtZXMsICJpIik7CiAgICAgIHZhciBpc0xpbmtWaWV3YWJsZSA9IHJlZ1NjaGVtZS50ZXN0KGdDb250ZXh0TWVudS5saW5rUHJvdG9jb2wpOwogICAgICBnQ29udGV4dE1lbnUuc2hvd0l0ZW0oImNvbnRleHQtdmlld2xpbmtzb3VyY2UiLCBnQ29udGV4dE1lbnUub25MaW5rICYmIGlzTGlua1ZpZXdhYmxlKTsKICAgIH0KCiAgICB3aW5kb3cuc2V0VGltZW91dChmdW5jdGlvbigpIHsKICAgICAgdmFyIGNtID0gd2luZG93LmRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCJjb250ZW50QXJlYUNvbnRleHRNZW51Iik7CiAgICAgIGNtLmFkZEV2ZW50TGlzdGVuZXIoInBvcHVwc2hvd2luZyIsIHZpZXdMaW5rU291cmNlUG9wdXAsIGZhbHNlKTsKICAgIH0pOwogIF1dPgogIDwvc2NyaXB0PgoKICA8cG9wdXAgaWQ9ImNvbnRlbnRBcmVhQ29udGV4dE1lbnUiPgogICAgPG1lbnVpdGVtCiAgICAgIGlkPSJjb250ZXh0LXZpZXdsaW5rc291cmNlIgogICAgICBsYWJlbD0iVmlldyBMaW5rIFNvdXJjZSIKICAgICAgYWNjZXNza2V5PSJWIgogICAgICBvbmNvbW1hbmQ9InZpZXdMaW5rU291cmNlKCk7IgogICAgICBvbmNsaWNrPSJ2aWV3TGlua1NvdXJjZShldmVudCk7IgogICAgICBpbnNlcnRhZnRlcj0iY29udGV4dC12aWV3c291cmNlIiAvPgogIDwvcG9wdXA%2BCgo8L292ZXJsYXk%2BCgo%3D">viewLinkSource.xul</a> Adds "View Link Source" on context menu when right click on a link. Last updated: 2006-05-28
Plus: Updated <a href="data:application/x-javascript;charset=utf-8;base64,LyogIFRoaXMgc2NyaXB0IHdpbGwgYWRkICJFZGl0IHVzZXJDaHJvbWU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Y29uZmlnZmlsZXMtdG9vbGJhci1idXR0b24iLCAianMiLCAiaiIpOwogIGluc2VydE1lbnVJdGVtKCJ0b29sc19lZGl0X215X2NvbmZpZyIsICJqcyIsICJqIik7Cgp9KSgpOwoKCg%3D%3D"> Add 'Edit userChrome.js' on MR Tech Local Install's Edit Config button menu</a>
Last updated: 2006-05-28
Changes:
- Added "Edit userChrome.xul"
- etc.
Last edited by Zoolcar9 on May 28th, 2006, 12:18 am, edited 7 times in total.
I am writing a script to move the find bar to the top of the page instead of the bottom. I am using an XPath query to find the tabpanels box, but when I check the snapshotLength it is always 0. This is my code:
I tried changing the query to "//*" and the length becomes 942, but when I change it to something like "//toolbar" it is 0 again. What's wrong with my code?
pile0nades wrote:am writing a script to move the find bar to the top of the page instead of the bottom. I am using an XPath query to find the tabpanels box, but when I check the snapshotLength it is always 0.
This is a quick and easy way to get the restart function.
This adds a "Restart Firefox" entry to the File menu.
And it seems to be compatible with zeniko's Session Manager.
I haven't figured out how to get a toolbar button in a single xul file, so if someone wants to play around with it, that would make it a whole lot better.
That will add a toolbarbutton on the left of menubar.
To add the toolbarbutton image, add <code><?xml-stylesheet href="restartFirefox.css" type="text/css"?></code> before the <code>overlay</code> tag, where restartFirefox.css is in the same folder with the overlay, or add the CSS code to userChrome.css or Stylish.
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.