MozillaZine

[Ext] userChrome.js

Announce and Discuss the Latest Theme and Extension Releases.
XerBlade

User avatar
 
Posts: 865
Joined: October 4th, 2005, 10:45 pm
Location: Nashville, TN, US

Post Posted May 22nd, 2006, 9:17 am

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.

<a href="data:application/x-javascript;charset=utf-8;base64,ZnVuY3Rpb24gRGlzYWJsZUJhY2tzcGFjZU5hdmlnYXRpb24gKCkKewoJdGhpcy5yZW1vdmVLZXkgPSBmdW5jdGlvbiAoa2V5c2V0KQoJewoJCXZhciBrZXlzID0ga2V5c2V0LmdldEVsZW1lbnRzQnlUYWdOYW1lICgia2V5Iik7CgkJZm9yICh2YXIgbiA9IDA7IG4gPCBrZXlzLmxlbmd0aDsgbisrKQoJCXsKCQkJdmFyIGtleSA9IGtleXNbbl07CgkJCWlmIChrZXkudGFnTmFtZSAhPSAia2V5IikKCQkJewoJCQkJY29udGludWU7CgkJCX0KCgkJCWlmIChrZXkuZ2V0QXR0cmlidXRlICgia2V5Y29kZSIpICE9ICJWS19CQUNLIikKCQkJewoJCQkJY29udGludWU7CgkJCX0KCgkJCWlmIChrZXkuZ2V0QXR0cmlidXRlICgiY29tbWFuZCIpICE9ICJjbWRfaGFuZGxlQmFja3NwYWNlIikKCQkJewoJCQkJY29udGludWU7CgkJCX0KCgkJCWtleS5yZW1vdmVBdHRyaWJ1dGUgKCJjb21tYW5kIik7CgkJCWtleS5yZW1vdmVBdHRyaWJ1dGUgKCJrZXljb2RlIik7CgkJfQoJfQoKCgl0aGlzLnRyYXZlcnNlS2V5c2V0cyA9IGZ1bmN0aW9uICgpCgl7CgkJdmFyIGtleXNldHMgPSBkb2N1bWVudC5nZXRFbGVtZW50c0J5VGFnTmFtZSAoImtleXNldCIpOwoJCWZvciAodmFyIG4gPSAwOyBuIDwga2V5c2V0cy5sZW5ndGg7IG4rKykKCQl7CgkJCXZhciBrZXlzZXQgPSBrZXlzZXRzW25dOwoJCQlpZiAoa2V5c2V0LnRhZ05hbWUgIT0gImtleXNldCIpCgkJCXsKCQkJCWNvbnRpbnVlOwoJCQl9CgoJCQlpZiAoa2V5c2V0LmdldEF0dHJpYnV0ZSAoImlkIikgIT0gIm1haW5LZXlzZXQiKQoJCQl7CgkJCQljb250aW51ZTsKCQkJfQoKCQkJdGhpcy5yZW1vdmVLZXkgKGtleXNldCk7CgkJfQoJfQoKCXRoaXMudHJhdmVyc2VLZXlzZXRzICgpOwp9Cgp2YXIgZGlzYWJsZUJhY2tzcGFjZU5hdmlnYXRpb24gPSBuZXcgRGlzYWJsZUJhY2tzcGFjZU5hdmlnYXRpb24gKCk7Cgo%3D">DisableBackspaceNavigation</a>

For Firefox 1.0.7 and 1.5.0.*

This one shall be eternally grateful.
I hate that function, and it shouldn't take a whole extension for something like that.
User Agent
Extensions
AMD64/2.41GHz RAM/1.0GB ATI/256MB-GDDR3/128-bit/8xAGP Cable6.0M/384kbps

dougeeebear

User avatar
 
Posts: 548
Joined: September 15th, 2005, 4:17 pm

Post Posted May 22nd, 2006, 10:08 am

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?

old zeniko
 
Posts: 0
Joined: December 31st, 1969, 5:00 pm

Post Posted May 22nd, 2006, 10:24 am

Philip Chee wrote:window._content is depreciated. Please use window.content instead.

depreciated is deprecated as well... ;) And please use <code>content</code> instead of <code>window.content</code>.

XerBlade wrote:I hate that function, and it shouldn't take a whole extension for something like that.

This will be fixed for Firefox 2.0 (through the pref browser.backspace_action).

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...

dougeeebear

User avatar
 
Posts: 548
Joined: September 15th, 2005, 4:17 pm

Post Posted May 22nd, 2006, 11:31 am

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.

old zeniko
 
Posts: 0
Joined: December 31st, 1969, 5:00 pm

Post Posted May 22nd, 2006, 11:37 am

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>...

dougeeebear

User avatar
 
Posts: 548
Joined: September 15th, 2005, 4:17 pm

Post Posted May 22nd, 2006, 1:09 pm

Thanks zeniko, I wasn't sure about it (and now I don't have to post it) :)

XerBlade

User avatar
 
Posts: 865
Joined: October 4th, 2005, 10:45 pm
Location: Nashville, TN, US

Post Posted May 22nd, 2006, 1:18 pm

zeniko wrote:
XerBlade wrote:I hate that function, and it shouldn't take a whole extension for something like that.

This will be fixed for Firefox 2.0 (through the pref browser.backspace_action).
\

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

Old Greg S
 
Posts: 0
Joined: December 31st, 1969, 5:00 pm

Post Posted May 22nd, 2006, 9:14 pm

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
Code: Select all
<?xml version="1.0"?>

<!DOCTYPE overlay SYSTEM "chrome://global/locale/tabbrowser.dtd">

<overlay id="ctc" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

<script type="application/x-javascript"><![CDATA[

window.addEventListener("load",ctc_init,false);

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 );
}

]]></script>

<popup id="contentAreaContextMenu">
  <menuitem id="context-closetab" label="&closeTab.label;" oncommand="gBrowser.removeCurrentTab()" insertafter="context-stop"/>
</popup>

</overlay>

Zoolcar9

User avatar
 
Posts: 2225
Joined: November 9th, 2004, 6:45 pm
Location: Jakarta, Indonesia (UTC+7)

Post Posted May 23rd, 2006, 9:37 am


//whoops sorry didn't read you carefully

Last edited by Zoolcar9 on May 23rd, 2006, 1:33 pm, edited 2 times in total.
My Firefox information | Add-ons | GitHub

"With great power, comes great desire to show it off."

old zeniko
 
Posts: 0
Joined: December 31st, 1969, 5:00 pm

Post Posted May 23rd, 2006, 11:13 am

Another snippet for fiddling around with: throbber as progress meter (a preview of what might come for Firefox 2 - see bug 334697).

@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.

Zoolcar9

User avatar
 
Posts: 2225
Joined: November 9th, 2004, 6:45 pm
Location: Jakarta, Indonesia (UTC+7)

Post Posted May 23rd, 2006, 12:01 pm

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%2BCiAgPCFbQ0RBVEFbCiAgICBmdW5jdGlvbiB2aWV3TGlua1NvdXJjZShhRXZlbnQpIHsKICAgICAgdHJ5IHsKICAgICAgICBnQnJvd3Nlci5tUHJlZnMuZ2V0Qm9vbFByZWYoInZpZXdTb3VyY2VJblRhYi5sb2FkSW5OZXdUYWIiKTsKICAgICAgfSBjYXRjaChleCkgewogICAgICAgIGdCcm93c2VyLm1QcmVmcy5zZXRCb29sUHJlZigidmlld1NvdXJjZUluVGFiLmxvYWRJbk5ld1RhYiIsIHRydWUpOwogICAgICB9CgogICAgICB0cnkgewogICAgICAgIGdCcm93c2VyLm1QcmVmcy5nZXRCb29sUHJlZigidmlld1NvdXJjZUluVGFiLmxvYWRJbkJhY2tncm91bmQiKTsKICAgICAgfSBjYXRjaChleCkgewogICAgICAgIGdCcm93c2VyLm1QcmVmcy5zZXRCb29sUHJlZigidmlld1NvdXJjZUluVGFiLmxvYWRJbkJhY2tncm91bmQiLCBmYWxzZSk7CiAgICAgIH0KCiAgICAgIHZhciB1cmwgPSBnQ29udGV4dE1lbnUubGlua1VSTDsKCiAgICAgIGlmKGFFdmVudCkgewogICAgICAgIGFFdmVudC5zdG9wUHJvcGFnYXRpb24oKTsKICAgICAgICBzd2l0Y2goYUV2ZW50LmJ1dHRvbikgewogICAgICAgICAgY2FzZSAxOgogICAgICAgICAgICBpZihnQnJvd3Nlci5tUHJlZnMuZ2V0Qm9vbFByZWYoInZpZXdTb3VyY2VJblRhYi5sb2FkSW5OZXdUYWIiKSkgewogICAgICAgICAgICAgIHZhciBuZXdUYWIgPSBnQnJvd3Nlci5hZGRUYWIoInZpZXctc291cmNlOiIgKyB1cmwpOyAvL3ZpZXcgc291cmNlIGluIG5ldyB0YWIKICAgICAgICAgICAgICBpZighZ0Jyb3dzZXIubVByZWZzLmdldEJvb2xQcmVmKCJ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KTsKICAgIH0KCiAgICB3aW5kb3cuc2V0VGltZW91dChmdW5jdGlvbigpIHsKICAgICAgdmFyIGNtID0gd2luZG93LmRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCJjb250ZW50QXJlYUNvbnRleHRNZW51Iik7CiAgICAgIGNtLmFkZEV2ZW50TGlzdGVuZXIoInBvcHVwc2hvd2luZyIsIHZpZXdMaW5rU291cmNlUG9wdXAsIGZhbHNlKTsKICAgIH0pOwogIF1dPgogIDwvc2NyaXB0PgoKICA8cG9wdXAgaWQ9ImNvbnRlbnRBcmVhQ29udGV4dE1lbnUiPgogICAgPG1lbnVpdGVtCiAgICAgIGlkPSJjb250ZXh0LXZpZXdsaW5rc291cmNlIgogICAgICBsYWJlbD0iVmlldyBMaW5rIFNvdXJjZSIKICAgICAgYWNjZXNza2V5PSJWIgogICAgICBvbmNvbW1hbmQ9InZpZXdMaW5rU291cmNlKCk7IgogICAgICBvbmNsaWNrPSJ2aWV3TGlua1NvdXJjZShldmVudCk7IgogICAgICBpbnNlcnRhZnRlcj0iY29udGV4dC12aWV3c291cmNlIiAvPgogIDwvcG9wdXA%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,LyogIFRoaXMgc2NyaXB0IHdpbGwgYWRkICJFZGl0IHVzZXJDaHJvbWUuanMiCiAgICBhbmQgIkVkaXQgdXNlckNocm9tZS54dWwiIG1lbnVpdGVtcyBpbgogICAgTVIgVGVjaCBMb2NhbCBJbnN0YWxsJ3MgRWRpdCBDb25maWcgQnV0dG9uIE1lbnUKICAgIFZlcnNpb24gZGF0ZTogMjAwNjA1MjggICovCgooZnVuY3Rpb24oKSB7CiAgZnVuY3Rpb24gaW5zZXJ0TWVudUl0ZW0odGhpc01lbnVJdGVtSUQsIHRoaXNGaWxlRXh0LCB0aGlzS2V5KSB7CiAgICB2YXIgZWRp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RoaXNGaWxlRXh0KTsKICAgIG1lbnVpdGVtLnNldEF0dHJpYnV0ZSgib25jb21tYW5kIiwgY21kKTsKICAgIG1lbnVpdGVtLnNldEF0dHJpYnV0ZSgiY2xhc3MiLCAibWVudWl0ZW0taWNvbmljIik7CiAgICBtZW51aXRlbS5zZXRBdHRyaWJ1dGUoImxvY2FsX2luc3RhbGwiLCB0cnVlKTsKICAgIGlmKHRoaXNLZXkpIG1lbnVpdGVtLnNldEF0dHJpYnV0ZSgiYWNjZXNza2V5IiwgdGhpc0tleSk7CgogICAgZWRpdENvbmZpZ01lbnVQb3B1cC5pbnNlcnRCZWZvcmUobWVudWl0ZW0sCiAgICAgIHR5cGVvZiBMb2NhbF9JbnN0YWxsLm9wZW5DaHJvbWVFZGl0b3IgPT0gImZ1bmN0aW9uIiAvL01MVEkgNC42IGFuZCBhYm92ZQogICAgICA%2FIGVkaXRDb25maWdNZW51UG9wdXAuZmlyc3RDaGlsZC5uZXh0U2libGluZwogICAgICA6IGVkaXRDb25maWdNZW51UG9wdXAuZmlyc3RDaGlsZCk7CiAgfQoKICBpbnNlcnRNZW51SXRlbSgiZWRpdGNvbmZpZ2ZpbGVzLXRvb2xiYXItYnV0dG9uIiwgInh1bCIsICJ4Iik7CiAgaW5zZXJ0TWVudUl0ZW0oInRvb2xzX2VkaXRfbXlfY29uZmlnIiwgInh1bCIsICJ4Iik7CgogIGluc2VydE1lbnVJdGVtKCJlZGl0Y29uZmlnZmlsZXMtdG9vbGJhci1idXR0b24iLCAianMiLCAiaiIpOwogIGluc2VydE1lbnVJdGVtKCJ0b29sc19lZGl0X215X2NvbmZpZyIsICJqcyIsICJqIik7Cgp9KSgpOwoKCg%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.
My Firefox information | Add-ons | GitHub

"With great power, comes great desire to show it off."

pile0nades
 
Posts: 756
Joined: May 15th, 2005, 2:31 am

Post Posted May 25th, 2006, 3:09 am

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:
Code: Select all
(function () {
  var get = function(query) {
    return document.evaluate(
      query,
      document,
      null,
      XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,
      null
    );
  }

  var findbar = document.getElementById("FindToolbar");
  var tabpanels = get("//tabbrowser[@id='content']//tabpanels");
  alert(tabpanels.snapshotLength);
 
  //document.getAnonymousNodes(tabpanels)[0].appendChild(findbar);
 
})();


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?
Linkify bug numbers - test: bug 258287

Zoolcar9

User avatar
 
Posts: 2225
Joined: November 9th, 2004, 6:45 pm
Location: Jakarta, Indonesia (UTC+7)

Post Posted May 25th, 2006, 4:34 am

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.

Maybe because tabpanels is anonymous element?

Anyway, try this instead

Code: Select all
var findbar = document.getElementById('FindToolbar');
var tabbrowser = document.getElementById('content');
var tabpanels = tabbrowser.mPanelContainer;

tabpanels.parentNode.insertBefore(findbar, tabpanels)


My Firefox information | Add-ons | GitHub

"With great power, comes great desire to show it off."

dougeeebear

User avatar
 
Posts: 548
Joined: September 15th, 2005, 4:17 pm

Post Posted May 25th, 2006, 6:15 am

This is for userChrome.XUL.

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.

<a href="data:application/x-javascript;charset=utf-8;base64,PG92ZXJsYXkgaWQ9InJlc3RhcnRmaXJlZm94Ig0KICAgICAgICAgeG1sbnM9Imh0dHA6Ly93d3cubW96aWxsYS5vcmcva2V5bWFzdGVyL2dhdGVrZWV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leT0iUiIgLz4NCiAgPC9tZW51cG9wdXA%2BDQoNCjwvb3ZlcmxheT4NCg0K">Restart Firefox</a>

Zoolcar9

User avatar
 
Posts: 2225
Joined: November 9th, 2004, 6:45 pm
Location: Jakarta, Indonesia (UTC+7)

Post Posted May 25th, 2006, 7:36 am


To add a toolbarbutton, add this code to the overlay:

Code: Select all
<toolbar id="toolbar-menubar">
  <toolbarbutton
    id="restart-firefox-butt"
    label="Restart Firefox"
    tooltiptext="Restart Firefox"
    oncommand="restartfirefoxObject.restartFX();"
    insertbefore="menubar-items" />
</toolbar>

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.

Code: Select all
#restart-firefox-butt {
  list-style-image: url("image_url");
}


My Firefox information | Add-ons | GitHub

"With great power, comes great desire to show it off."

Return to Extension/Theme Releases


Who is online

Users browsing this forum: No registered users and 2 guests