MozillaZine

[Ext] userChrome.js [support discontinued]

Announce and Discuss the Latest Theme and Extension Releases.
zeniko
 
Posts: 201
Joined: October 19th, 2007, 4:50 am
Location: Swiss Confederation

Post Posted October 19th, 2007, 8:25 am

userChrome.js allows to easily customize Firefox through JavaScript code snippets (see e.g. these code snippet collections as a starting point).

Download/install userChrome.js 0.8
This release works for Firefox and Thunderbird 2 and 3 and all Gecko 1.9 applications.

Support: For code related questions, please use the Extension Development forum.
Last edited by zeniko on April 19th, 2008, 12:21 am, edited 2 times in total.

deathburger
 
Posts: 20
Joined: April 28th, 2006, 9:58 pm

Post Posted October 19th, 2007, 11:37 am

Just want to bring this over to the new thread. It's been quite useful to me so hopefully others will think so as well.

<a href="http://deathburger.jottit.com/ucjs">http://deathburger.jottit.com/ucjs</a>

Eygte450

User avatar
 
Posts: 179
Joined: July 20th, 2006, 12:52 pm

Post Posted October 20th, 2007, 12:44 am

i remember that there is a bug that if corrected, this extension would be useless... anyone know the #?

pirlouy

User avatar
 
Posts: 232
Joined: February 11th, 2005, 6:29 am
Location: France

Post Posted November 7th, 2007, 1:01 pm

I've found other sites with userChrome.js scripts, and I don't use this page anymore.
http://extensions.geckozone.org/userChrome_js_scripts

Zoolcar9

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

Post Posted November 10th, 2007, 2:32 am


alice0775 has many useful userChrome.js scripts in her blog
http://space.geocities.yahoo.co.jp/gl/alice0775 (JA)
(<a href="http://honyaku.yahoofs.jp/url_result?ctw_=sT,eCR-JE,bF,hT,uaHR0cDovL3NwYWNlLmdlb2NpdGllcy55YWhvby5jby5qcC9nbC9hbGljZTA3NzU=,qlang=ja|for=0|sp=-5|fs=100%|fb=0|fi=0|fc=FF0000|db=T|eid=CR-EJ,">Translate to EN</a>)

My Firefox information | Add-ons | GitHub

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

pirlouy

User avatar
 
Posts: 232
Joined: February 11th, 2005, 6:29 am
Location: France

Post Posted November 20th, 2007, 3:43 pm

Several scripts don't work anymore with version 3.0 beta 1. This one for example:
Code: Select all
var statusbar = document.getElementById("status-bar");
var menubar = document.getElementById("nav-bar");
menubar.appendChild(statusbar);


Is there a simple solution to have all these scripts compatible.

deathburger
 
Posts: 20
Joined: April 28th, 2006, 9:58 pm

Post Posted November 20th, 2007, 6:53 pm

pirlouy wrote:Is there a simple solution to have all these scripts compatible.


Not if they're changing IDs at random which is what that looks like. If they are doing that it would be incredibly stupid by the way, it would break many many things that work fine now. I'm not keen on what they've been doing with Firefox by a long shot but I find it hard to believe they could do something that dumb on purpose.

pirlouy

User avatar
 
Posts: 232
Joined: February 11th, 2005, 6:29 am
Location: France

Post Posted November 21st, 2007, 2:44 am

Statusbar and menubar IDs have not changed. So the problem is with this kind of scripts.

aronin
 
Posts: 243
Joined: November 9th, 2005, 7:31 pm

Post Posted November 23rd, 2007, 10:46 am

Can someone advise me on whats wrong with this code? This is on Fx3preB2 nightly builds.

/* ::::::::::::::::::::::::: Places Organizer - Open in Tab ::::::::::::::::::::::::: */
document.getElementsByAttribute("key", "manBookmarkKb")[0].setAttribute("oncommand", '(getBrowser().selectedTab = getBrowser().addTab("chrome://browser/content/places/places.xul")).label = "Places Organizer";');

deathburger
 
Posts: 20
Joined: April 28th, 2006, 9:58 pm

Post Posted November 23rd, 2007, 11:40 am

pirlouy wrote:Statusbar and menubar IDs have not changed. So the problem is with this kind of scripts.


Someone had once mentioned that there was a bug that, if fixed, would render this extension useless. Maybe they finally got around to fixing it?

pirlouy

User avatar
 
Posts: 232
Joined: February 11th, 2005, 6:29 am
Location: France

Post Posted November 23rd, 2007, 2:47 pm

Some scripts work, so I think the extension works well. It's just the script initialization which should be bad. :/

deathburger
 
Posts: 20
Joined: April 28th, 2006, 9:58 pm

Post Posted November 23rd, 2007, 3:08 pm

try something like this to see where it's dying:

var statusbar = document.getElementById("status-bar");
if(!statusbar){alert("Unable to grab statusbar")}
var menubar = document.getElementById("nav-bar");
if(!menubar){alert("Unable to grab menubar")}
menubar.appendChild(statusbar);

There are better ways to debug but that one is quickest for small temporary checks IMO.

zeniko
 
Posts: 201
Joined: October 19th, 2007, 4:50 am
Location: Swiss Confederation

Post Posted November 23rd, 2007, 3:52 pm

pirlouy wrote:
Code: Select all
var statusbar = document.getElementById("status-bar");
var menubar = document.getElementById("nav-bar");
menubar.appendChild(statusbar);

WFM with the latest nightly (Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9b2pre) Gecko/2007112305 Minefield/3.0b2pre) on a clean profile. So either the Beta is borked - or your profile resp. an incompatible extension therein.

Besides: Does not working anymore have any other symptoms such as related errors in the Error Console or snippets following that one not working?

aronin wrote:Can someone advise me on whats wrong with this code?

It sets an <code>oncommand</code> handler on an element which already sports a <code>command</code> attribute (which AFAICT takes precedence). So you'll either have to modify the <code>Browser:ShowBookmarks</code> command element or remove the <code>command</code> attribute from the menuitem you're working on...

aronin
 
Posts: 243
Joined: November 9th, 2005, 7:31 pm

Post Posted November 23rd, 2007, 4:33 pm

zeniko wrote:
aronin wrote:Can someone advise me on whats wrong with this code?

It sets an <code>oncommand</code> handler on an element which already sports a <code>command</code> attribute (which AFAICT takes precedence). So you'll either have to modify the <code>Browser:ShowBookmarks</code> command element or remove the <code>command</code> attribute from the menuitem you're working on...


Ok, I tried it a different way and it worked:

/* ::::::::::::::::::::::::: Places Library - Open in Tab ::::::::::::::::::::::::: */
document.getElementById("Browser:ShowBookmarks").setAttribute("oncommand", '(getBrowser().selectedTab = getBrowser().addTab("chrome://browser/content/places/places.xul")).label = "Places Organizer";');

But ofcourse, couldn't be without problems:
Once I open Places Organizer in Tab ... New Folder command doesn't work anymore (within the organizer). Any ideas?

pirlouy

User avatar
 
Posts: 232
Joined: February 11th, 2005, 6:29 am
Location: France

Post Posted November 23rd, 2007, 4:48 pm

You were both right, deathburger & zeniko.
Some IDs have changed (notably bookmarks) and some scripts were blocking the following ones (console shows me errors).

Thanks.

Return to Extension/Theme Releases


Who is online

Users browsing this forum: No registered users and 5 guests