MozillaZine

[Ext] userChrome.js

Announce and Discuss the Latest Theme and Extension Releases.
dougeeebear

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

Post Posted March 26th, 2006, 12:26 pm

Thanks, Zoolcar9, I didn't even see that... duhhh :)

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

Post Posted March 26th, 2006, 6:14 pm

userScript.js 0.7 adds no code changes - but it will install in about every Gecko product that I managed to get hold of a GUID of...

dougeeebear wrote:userChrome.css allows you to call other .css files using @import url.
Will userChrome.js allow calling other .js files in some manner?

As already pointed out, the first code sample demonstrates how to do this. Furthermore I intend to add no syntactic sugar or other special methods to be used inside userChrome.js - it will be as plain JS as userChrome.css is plain CSS.

dougeeebear wrote:Also I'm thinking I might be able to make use of some of the scripts at http://userscripts.org/

I doubt it, since these scripts are targeted at website content (i.e. for use with GreaseMonkey), while userChrome.js is targeted at the UI around the websites (and mails - although as long as GreaseMonkey doesn't work for Thunderbird, you might get somewhere by using userChrome.js there instead).

Zoolcar9

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

Post Posted March 27th, 2006, 5:37 am


Sample scripts:
  • <a href="data:application/x-javascript;base64,Ly8gIFRoaXMgc2NyaXB0IHdpbGwgYWRkICJIZWxsbywgV29ybGQhIiBtZW51aXRlbSBvbiBUb29scyBtZW51CgooZnVuY3Rpb24oKSB7CiAgdmFyIG5ld0l0ZW0gPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KCJtZW51aXRlbSIpOwogIG5ld0l0ZW0uc2V0QXR0cmlidXRlKCJsYWJlbCIsICJIZWxsbywgV29ybGQhIik7CiAgbmV3SXRlbS5zZXRBdHRyaWJ1dGUoIm9uY29tbWFuZCIsICJhbGVydCgnSGVsbG8sIFdvcmxkIScpOyIpOwoKICB2YXIgcHJlZlNlcCA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCJwcmVmU2VwIik7IC8vbWVudXNlcGFyYX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gaG9tZUJ1dHRvbi5wYXJlbnROb2RlLmluc2VydEJlZm9yZShuZXdCdXR0b24sIGhvbWVCdXR0b24ubmV4dFNpYmxpbmcpOyAvL2FkZHMgdGhlIG5ldyBidXR0b24gb24gdGhlIHJpZ2h0IG9mIEhvbWUgYnV0dG9uDQoNCn0pKCk7DQoNCg%3D%3D">Adds a toolbarbutton</a>
  • <a href="data:application/x-javascript;base64,LyogIFRoaXMgc2NyaXB0IHdpbGwgYWRkICJFZGl0IHVzZXJDaHJvbWUuanMiIG1lbnVpdGVtIGluDQogICAgTVIgVGVjaCBMb2NhbCBJbnN0YWxsJ3MgRWRpdCBDb25maWcgQnV0dG9uIE1lbnUgdmVyc2lvbiAxLjQgICAgKi8NCg0KKGZ1bmN0aW9uKCkgew0KDQogIGZ1bmN0aW9uIGluc2VydE1lbnVJdGVtKHRoaXNNZW51SXRlbUlELCB0aGlzRmlsZUV4dCwgdGhpc0tleSkNCiAgew0KICAgIHZhciBlZGl0Q29uZmlnTWVudSA9IGRvY3VtZW50DQogICAgICAgIC5nZXRFbGVtZW50QnlJZCh0aGlzTWVudUl0ZW1JRCkuZmlyc3RDaGlsZDsNCiAgICBpZighZWRpdENvbmZpZ01lbnUpIHJldHVybjsNCg0KICAgIHZhciBjbWQ7DQogICAgaWYodHlwZW9mIG9wZW5fcHJvZmlsZS5nZXRTcGVjaWFsRm9sZGVyID09ICJmdW5jdGlvbiIpDQogICAgICBjbWQgPSAib3Blbl9wcm9maWxlLmZpbGVSdW5Pck9wZW4ob3Blbl9wcm9maWxlLmdldFNwZWNpYWxGb2xkZXIoJ1VDaHJtJyksICd1c2VyQ2hyb21lLiIgKyB0aGlzRmlsZUV4dCArICInLCAnbG9jYWxfaW5zdGFsbC5kZWZhdWx0X0pTX2VkaXRvcicsIHRydWUpOyIgIC8vIHVzZXMgZGVmYXVsdCBKUyBlZGl0b3IgdG8gZWRpdCBYVUwNCiAgICBlbHNlDQogICAgICAvL01MVEkgNC41LjEgYW5kIGFib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0KICBpbnNlcnRNZW51SXRlbSgiZWRpdGNvbmZpZ2ZpbGVzLXRvb2xiYXItYnV0dG9uIiwgInh1bCIsICJ4Iik7IC8vcmVtb3ZlIHRoZXNlIDIgbGluZXMgDQogIGluc2VydE1lbnVJdGVtKCJ0b29sc19lZGl0X215X2NvbmZpZyIsICJ4dWwiLCAieCIpOyAgICAgICAgICAvL2lmIHlvdSBkb24ndCBoYXZlIHVzZXJDaHJvbWUueHVsDQoNCiAgaW5zZXJ0TWVudUl0ZW0oImVkaXRjb25maWdmaWxlcy10b29sYmFyLWJ1dHRvbiIsICJqcyIsICJqIik7DQogIGluc2VydE1lbnVJdGVtKCJ0b29sc19lZGl0X215X2NvbmZpZyIsICJqcyIsICJqIik7DQoNCn0pKCk7DQoNCg0K">Adds "Edit userChrome.js" and "Edit userChrome.xul" on MR Tech Local Install's Edit Config button menu</a> (last updated: 2006-05-24)
  • <a href="data:application/x-javascript;charset=utf-8;base64,Ly8gU2hvd3MgdGhlIEJvb2ttYXJrcyB0b29sdGlwcyAoYnVnIDI1MzkxMikgYW5kIFNpZGViYXIgdG9vbHRpcHMgKGJ1ZyAyNTkxOTkpDQoNCihmdW5jdGlvbigpIHsNCiAgdmFyIGlkID0gWyJib29rbWFya3MtbWVudSIsICJib29rbWFya3MtcHRmIl07DQogIGZvcih2YXIgaSA9IDA7IGkgPCBpZC5sZW5ndGg7IGkrKykgew0KICAgIHZhciBibSA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKGlkW2ldKTsNCiAgICBibS50b29sdGlwID0gImJ0VG9vbHRpcCI7DQogIH0NCg0KICBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgic2lkZWJhciIpLnRvb2x0aXAgPSAiYUhUTUxUb29sdGlwIjsNCg0KfSkoKTsNCg0K">Shows the Bookmarks tooltips and Sidebar tooltips</a>
Last edited by Zoolcar9 on June 4th, 2006, 7:52 am, edited 4 times in total.
My Firefox information | Add-ons | GitHub

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

asqueella
 
Posts: 4019
Joined: November 16th, 2003, 3:05 am
Location: Russia, Moscow

Post Posted March 27th, 2006, 7:36 am

zeniko, you should be awarded a medal for the extensions you wrote.

alta88
 
Posts: 981
Joined: January 28th, 2006, 3:08 pm

Post Posted March 27th, 2006, 10:02 am

nice, already solved a tweak with keys.

how could i change the external file search code to look in \chrome\ScriptDir\script.us.js eg. ?

without some kind of file include 'sugar' to allow commenting out (made easy with zoolcar9's Edit menu script), the only way to turn off script files is to rename them..

would a greasemonkey type management dialog be out of the question? :D

XerBlade

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

Post Posted March 27th, 2006, 2:19 pm

Zoolcar9 wrote:
Sample scripts:
  • <a href="data:application/x-javascript;charset=utf-8;base64,Ly8gIFRoaXMgc2NyaXB0IHdpbGwgYWRkICJIZWxsbywgV29ybGQhIiBtZW51aXRlbSBvbiBUb29scyBtZW51DQoNCihmdW5jdGlvbigpIHsNCiAgdmFyIG5ld0l0ZW0gPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KCJtZW51aXRlbSIpOw0KICBuZXdJdGVtLnNldEF0dHJpYnV0ZSgibGFiZWwiLCAiSGVsbG8sIFdvcmxkISIpOw0KICBuZXdJdGVtLnNldEF0dHJpYnV0ZSgib25jb21tYW5kIiwgImFsZXJ0KCdIZWxsbywgV29ybGQhJyk7Iik7DQoNCiAgdmFyIHByZWZTZXAgPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgicHJlZlNlcCIpOyAvL21lbnVzZXBhcmF0b3IgYWJvdmUgdGhlIE9wdGlvbnMgbWVudWl0ZW0NCg0KICAvL3RoaXMgd2lsbCBhZGQgdGhlIG1lbnVpdGVtIGFib3ZlIHRoZSBzZXBlcmF0b3IgbWVudSBiZWZvcmUgdGhlIE9wdGlvbnMgbWVudWl0ZW06DQogIHByZWZTZXAucGFyZW50Tm9kZS5pbnNlcnRCZWZvcmUobmV3SXRlbSwgcHJlZlNlcCk7DQoNCiAgLy90byBhZGQgdGhlIG1lbnVpdGVtIGF0IHRoZSBib3R0b20gb2YgdGhlIFRvb2xzIG1lbnUsIHVzZToNCiAgLy9wcmVmU2VwLnBhcmVudE5vZGUuYXBwZW5kQ2hpbGQobmV3SXRlbSkNCg0KfSgpOw0KDQo%3D">Adds a menuitem on Tools menu</a>
  • <a href="data:application/x-javascript;charset=utf-8;base64,LyogIFRoaXMgc2NyaXB0IHdpbGwgYWRkICJIZWxsbywgV29ybGQhIiBtZW51aXRlbSBiZWZvcmUNCiAgICB0aGUgIk9wZW4gTGluayBpbiBOZXcgV2luZG93IiBtZW51aXRlbSBvbiBDb250ZXh0IE1lbnUgICAgKi8NCg0KKGZ1bmN0aW9uKCkgew0KICB2YXIgbmV3SXRlbSA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoIm1lbnVpdGVtIik7DQogIG5ld0l0ZW0uc2V0QXR0cmlidXRlKCJsYWJlbCIsICJIZWxsbywgV29ybGQhIik7DQogIG5ld0l0ZW0uc2V0QXR0cmlidXRlKCJvbmNvbW1hbmQiLCAiYWxlcnQoJ0hlbGxvLCBXb3JsZCEnKTsiKTsNCg0KICB2YXIgb3BlbkxpbmsgPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgiY29udGV4dC1vcGVubGluayIpOyAvL09wZW4gTGluayBpbiBOZXcgV2luZG93IG1lbnVpdGVtDQogIG9wZW5MaW5rLnBhcmVudE5vZGUuaW5zZXJ0QmVmb3JlKG5ld0l0ZW0sIG9wZW5MaW5rKTsgIC8vYWRkcyB0aGUgbmV3IG1lbnVpdGVtIGFmdGVyIHRoZSBPcGVuIExpbmsgaW4gTmV3IFdpbmRvdyBtZW51aXRlbQ0KDQp9KCk7DQoNCg%3D%3D">Adds a menuitem on context menu</a>
  • <a href="data:application/x-javascript;charset=utf-8;base64,Ly9UaGlzIHNjcmlwdCB3aWxsIGFkZCAiSGVsbG8sIFdvcmxkISIgYnV0dG9uIG9uIHRoZSB0b29sYmFyDQo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data:application/x-javascript;charset=utf-8;base64,LyogIFRoaXMgc2NyaXB0IHdpbGwgYWRkICJFZGl0IHVzZXJDaHJvbWUuanMiIG1lbnVpdGVtIGluDQogICAgTVIgVGVjaCBMb2NhbCBJbnN0YWxsJ3MgRWRpdCBDb25maWcgQnV0dG9uIE1lbnUgICAgICAgICAqLw0KDQooZnVuY3Rpb24oKSB7DQogIHZhciBlZGl0Q29uZmlnVG9vbGJhck1lbnVwb3B1cCA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCJlZGl0Y29uZmlnZmlsZXMtdG9vbGJhci1idXR0b24iKS5maXJzdENoaWxkOw0KICBpZighZWRpdENvbmZpZ1Rvb2xiYXJNZW51cG9wdXApIHJldHVybjsNCg0KICB2YXIgdXNlckNocm9tZUpTID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgibWVudWl0ZW0iKTsNCiAgdXNlckNocm9tZUpTLnNldEF0dHJpYnV0ZSgibGFiZWwiLCAiRWRpdCB1c2VyQ2hyb21lLmpzIik7DQogIHVzZXJDaHJvbWVKUy5zZXRBdHRyaWJ1dGUoIm9uY29tbWFuZCIsICJvcGVuX3Byb2ZpbGUuZmlsZVJ1bk9yT3BlbihvcGVuX3Byb2ZpbGUuZ2V0U3BlY2lhbEZvbGRlcignVUNocm0nKSwgJ3VzZXJDaHJvbWUuanMnLCAnbG9jYWxfaW5zdGFsbC5kZWZhdWx0X0pTX2VkaXRvcicsIHRydWUpOyIpOw0KICB1c2VyQ2hyb21lSlMuc2V0QXR0cmlidXRlKCJsb2NhbF9pbnN0YWxsIiwgdHJ1ZSk7DQoNCiAgZWRpdENvbmZpZ1Rvb2xiYXJNZW51cG9wdXAuaW5zZXJ0QmVmb3JlKHVzZXJDaHJvbWVKUywgZWRpdENvbmZpZ1Rvb2xiYXJNZW51cG9wdXAuZmlyc3RDaGlsZCk7DQoNCn0pKCk7DQoNCg%3D%3D">Adds "Edit userChrome.js" on MR Tech Local Install's Edit Config button menu</a>
  • <a href="data:application/x-javascript;charset=utf-8;base64,Ly8gU2hvd3MgdGhlIEJvb2ttYXJrcyB0b29sdGlwcyAoYnVnIDI1MzkxMikgYW5kIFNpZGViYXIgdG9vbHRpcHMgKGJ1ZyAyNTkxOTkpDQoNCihmdW5jdGlvbigpIHsNCiAgdmFyIGlkID0gWyJib29rbWFya3MtbWVudSIsICJib29rbWFya3MtcHRmIl07DQogIGZvcih2YXIgaSA9IDA7IGkgPCBpZC5sZW5ndGg7IGkrKykgew0KICAgIHZhciBibSA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKGlkW2ldKTsNCiAgICBibS50b29sdGlwID0gImJ0VG9vbHRpcCI7DQogIH0NCg0KICBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgic2lkZWJhciIpLnRvb2x0aXAgPSAiYUhUTUxUb29sdGlwIjsNCg0KfSkoKTsNCg0K">Shows the Bookmarks tooltips and Sidebar tooltips</a>

With this extension, MTLI, and CuteMenus -Crystal SVG installed, plus with this slightly modified version of the script from that post (I didn't feel like using a complicated onCommand like that in my CSS [and don't like styling by labels]):
Code: Select all
/*  This script will add "Edit userChrome.js" menuitem in
    MR Tech Local Install's Edit Config Button Menu         */

(function() {
  var editConfigToolbarMenupopup = document.getElementById("editconfigfiles-toolbar-button").firstChild;
  if(!editConfigToolbarMenupopup) return;

  var userChromeJS = document.createElement("menuitem");
  userChromeJS.setAttribute("id", "edit_userChrome.js");
  userChromeJS.setAttribute("label", "Edit userChrome.js");
  userChromeJS.setAttribute("oncommand", "open_profile.fileRunOrOpen(open_profile.getSpecialFolder('UChrm'), 'userChrome.js', 'local_install.default_JS_editor', true);");
  userChromeJS.setAttribute("local_install", true);

  editConfigToolbarMenupopup.insertBefore(userChromeJS, editConfigToolbarMenupopup.firstChild);

})();

plus this in Stylish:
Code: Select all
@namespace url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);

menuitem[id="edit_userChrome.js"] {
    list-style-image: url("chrome://cutemenus/content/res/customize.png") !important;
}

it's all so incredibly nifty. :D
User Agent
Extensions
AMD64/2.41GHz RAM/1.0GB ATI/256MB-GDDR3/128-bit/8xAGP Cable6.0M/384kbps

Cato62

User avatar
 
Posts: 684
Joined: March 7th, 2005, 10:06 am
Location: Eugene, OR

Post Posted March 27th, 2006, 8:58 pm

I ran into a problem. I installed this and it worked great with my text editor of choice. After updating MTLI it will no longer open the text editor. Any ideas?

TIA
"It is difficult to fight against anger, for a man will buy revenge with his soul." ~ Heraclites, 500 B.C.

The Blood Series: BloodFire, BloodFire 3, BloodThunder, BloodSun, & BloodSong

dougeeebear

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

Post Posted March 28th, 2006, 1:11 pm

I found out if there is a coding mistake anywhere within userChrome.js, none of the scripts work (meaning the script with the mistake plus all other scripts).
You have to physically go and find the file and edit it and correct your mistake before anything will work again.
I guess that means don't make any mistakes.

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

Post Posted March 28th, 2006, 1:48 pm

asqueella wrote:zeniko, you should be awarded a medal for the extensions you wrote.

Thanks.

alta88 wrote:how could i change the external file search code to look in \chrome\ScriptDir\script.us.js eg.?

Insert the following line between var chromeDir and var files:
Code: Select all
chromeDir.append("ScriptDir");

alta88 wrote:without some kind of file include 'sugar' to allow commenting out (made easy with zoolcar9's Edit menu script), the only way to turn off script files is to rename them..

I've added an importScript snippet which takes an absolute path as an argument and imports just that one script.

alta88 wrote:would a greasemonkey type management dialog be out of the question? :D

That's not within the reach of this extension. All I'm doing here is mirror userChrome.css for JavaScript. That's by far enough for me.

dougeeebear wrote:I found out if there is a coding mistake anywhere within userChrome.js, none of the scripts work

I've updated the Sub-Script Loader snippet to catch exceptions in subscripts and post them as messages to the JavaScript console (which should point you right to the error).

Of course, not making errors also helps... ;)

dougeeebear

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

Post Posted March 28th, 2006, 2:49 pm

zeniko wrote:
dougeeebear wrote:I found out if there is a coding mistake anywhere within userChrome.js, none of the scripts work

I've updated the Sub-Script Loader snippet to catch exceptions in subscripts and post them as messages to the JavaScript console (which should point you right to the error).

Of course, not making errors also helps... ;)

This is good, but the scripts I was referring to are the multiple scripts within userChrome.js itself, not uc.js scripts.

If there is a coding error anywhere within userChrome.js, nothing in the userChrome.js file is used.

So if userChrome.js containes five different scripts, all five are disabled.

EDIT.. problem solved
Using the script for the edit menu entry as a template, I created another menu entry to edit another file userChrome.jss (I am using .jss instead of .uc.js).
This file is for testing scripts, and if they contain errors, it does not affect userChrome.js.
Once I see that a script works ok, I can transfer it over to userChrome.js.
Last edited by dougeeebear on March 28th, 2006, 6:04 pm, edited 1 time in total.

pirlouy

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

Post Posted March 28th, 2006, 3:14 pm

2 requests:
- one simple script to open tabs, just at right of the current (instead of far right), like does this extension.

- there's a version of superDrag&Go where you can adjust 4 search engines (thanks to mouse gestion).
It could be very useful to change the search engine with this userchome.js (link to that SD&G version)

If someone is interested...

alta88
 
Posts: 981
Joined: January 28th, 2006, 3:08 pm

Post Posted March 28th, 2006, 5:21 pm

zeniko wrote:I've added an importScript snippet which takes an absolute path as an argument and imports just that one script.


thanks. does this mean full "C:\blah blah\..\ScriptDir\script1.uc.js" is correct syntax for arg aFile? didn't work this way for me, no console errors (other than attempt to try it without quotes), perhaps an example. ideally one would do

function importScript(rFile){..
};

importScript("ScriptDir\script1.uc.js");
// importScript("ScriptDir\script2.uc.js");
importScript("ScriptDir\script3.uc.js");

relative to chrome might be best, for those who'd like to make Fx work on usbs etc.

Zoolcar9

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

Post Posted March 28th, 2006, 6:03 pm

dougeeebear wrote:This is good, but the scripts I was referring to are the multiple scripts within userChrome.js itself, not uc.js scripts.

If there is a coding error anywhere within userChrome.js, nothing in the userChrome.js file is used.

So if userChrome.js containes five different scripts, all five are disabled.

Do you find any errors on JS Console?

pirlouy wrote:- one simple script to open tabs, just at right of the current (instead of far right), like does this extension.

The answer is in the extension itself :)
Code: Select all
eval("gBrowser.addTab = " + gBrowser.addTab.toString()
  .replace('if (!blank)', 'this.moveTabTo(t,this.mCurrentTab._tPos+1);' +
  'if (!blank)'));


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 March 28th, 2006, 6:09 pm

Zoolcar9 wrote:Do you find any errors on JS Console?

I think I was posting the same time you were.
I just get generic syntax error messages in the console, nothing specific.
I've edited my previous post with updated info.

Diorser

User avatar
 
Posts: 934
Joined: June 22nd, 2005, 6:57 am

Post Posted March 29th, 2006, 6:48 am

Looking for a simple JS to hide titlebar;
Different trials, but no success. :(
Any idea ?

If a solution is known with userchrome.css to hide titlebar, it is even better.
I am very open. (the goal is to avoid heavy extension for so small request).

Return to Extension/Theme Releases


Who is online

Users browsing this forum: No registered users and 2 guests