[Ext] userChrome.js

Announce and Discuss the Latest Theme and Extension Releases.
Locked
Muescha
Posts: 53
Joined: February 17th, 2005, 9:18 am
Location: Germany

Post by Muescha »

i would like to have a GUI like greasemonkey ...
********
Posts: 947
Joined: August 24th, 2005, 12:23 pm

Post by ******** »

@Muescha:
not going to happen.
DMCrimson
Posts: 1025
Joined: February 13th, 2004, 6:11 am

Post by DMCrimson »

mrtech wrote:<li> Updated <a href="data:application/x-javascript;charset=utf-8;base64,LyogIFRoaXMgc2NyaXB0IHdpbGwgYWRkICJFZGl0IHVzZXJDaHJvbWUuanMiIG1lbnVpdGVtIGluDQogICAgTVIgVGVjaCBMb2NhbCBJbnN0YWxsJ3MgRWRpdCBDb25maWcgQnV0dG9uIE1lbnUgdmVyc2lvbiAxLjMgICAgKi8NCg0KKGZ1bmN0aW9uKCkgew0KDQogIGZ1bmN0aW9uIGluc2VydE1lbnVJdGVtKHRoaXNNZW51SXRlbUlELCB0aGlzQ21kKQ0KICB7DQogICAgdmFyIGVkaXRDb25maWdNZW51ID0gZG9jdW1lbnQNCiAgICAgICAgLmdldEVsZW1lbnRCeUlkKHRoaXNNZW51SXRlbUlEKS5maXJzdENoaWxkOw0KICANCiAgICBpZighZWRpdENvbmZpZ01lbnUpIHJldHVybjsNCg0KICAgIHZhciB1c2VyQ2hyb21lSlMgPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KCJtZW51aXRlbSIpOw0KICAgIHVzZXJDaHJvbWVKUy5zZXRBdHRyaWJ1dGUoImlkIiwgInVzZXJDaHJvbWVfanMiKTsNCiAgICB1c2VyQ2hyb21lSlMuc2V0QXR0cmlidXRlKCJsYWJlbCIsICJFZGl0IHVzZXJDaHJvbWUuanMiKTsNCiAgICB1c2VyQ2hyb21lSlMuc2V0QXR0cmlidXRlKCJvbmNvbW1hbmQiLCB0aGlzQ21kKTsNCiAgICB1c2VyQ2hyb21lSlMuc2V0QXR0cmlidXRlKCJjbGFzcyIsICJtZW51aXRlbS1pY29uaWMiKTsNCiAgICB1c2VyQ2hyb21lSlMuc2V0QXR0cmlidXRlKCJsb2NhbF9pbnN0YWxsIiwgdHJ1ZSk7DQogIA0KICAgIGVkaXRDb25maWdNZW51Lmluc2VydEJlZm9yZSh1c2VyQ2hyb21lSlMsDQogICAgICBlZGl0Q29uZmlnTWVudS5maXJzdENoaWxkKTsNCiAgfQ0KDQogIHZhciBjbWQ7DQoNCiAgaWYodHlwZW9mIG9wZW5fcHJvZmlsZS5nZXRTcGVjaWFsRm9sZGVyID09ICJmdW5jdGlvbiIpDQogICAgY21kID0gIm9wZW5fcHJvZmlsZS5maWxlUnVuT3JPcGVuKG9wZW5fcHJvZmlsZS5nZXRTcGVjaWFsRm9sZGVyKCdVQ2hybScpLCAndXNlckNocm9tZS5qcycsICdsb2NhbF9pbnN0YWxsLmRlZmF1bHRfSlNfZWRpdG9yJywgdHJ1ZSk7Ig0KICBlbHNlDQogICAgLy9NTFRJIDQuNS4xIGFuZCBhYm92ZQ0KICAgIGNtZCA9ICJldmVudC5zdG9wUHJvcGFnYXRpb24oKTsgb3Blbl9wcm9maWxlLmZpbGVSdW5Pck9wZW4obG9jYWxfY29tbW9uLmdldFNwZWNpYWxGb2xkZXJQYXRoKCdVQ2hybScpLCAndXNlckNocm9tZS5qcycsICdsb2NhbF9pbnN0YWxsLmRlZmF1bHRfSlNfZWRpdG9yJywgdHJ1ZSk7IjsNCg0KICBpbnNlcnRNZW51SXRlbSgiZWRpdGNvbmZpZ2ZpbGVzLXRvb2xiYXItYnV0dG9uIiwgY21kKTsNCiAgaW5zZXJ0TWVudUl0ZW0oInRvb2xzX2VkaXRfbXlfY29uZmlnIiwgY21kKTsNCg0KfSkoKTsNCg0KDQo%3D">Add 'Edit userChrome.js' on MR Tech Local Install's Edit Config button menu</a> this works with 4.6.4


Needs yet another update:)
User avatar
XerBlade
Posts: 865
Joined: October 4th, 2005, 10:45 pm
Location: Nashville, TN, US

Post by XerBlade »

That version of that code still works fine for me with MTLI 5.0. Perhaps your problem is something unrelated, such as an error in JS in your file somewhere?
User Agent
Extensions
AMD64/2.41GHz RAM/1.0GB ATI/256MB-GDDR3/128-bit/8xAGP Cable6.0M/384kbps
DMCrimson
Posts: 1025
Joined: February 13th, 2004, 6:11 am

Post by DMCrimson »

Maybe, direct copy-paste from the message - I see the entry in menu with icon, but when selected, nothing happens...
User avatar
XerBlade
Posts: 865
Joined: October 4th, 2005, 10:45 pm
Location: Nashville, TN, US

Post by XerBlade »

Perhaps it could have something to do with what Custom Editor you have set in the MTLI options? I just have Notepad set... (I usually never actually use Notepad, I just keep forgetting to change this pref since I first tested it [maybe I'll do it now]). It's definitely opening with no problems when I select it, though. Or maybe something funky with your Firefox version? What version do you have?
User Agent
Extensions
AMD64/2.41GHz RAM/1.0GB ATI/256MB-GDDR3/128-bit/8xAGP Cable6.0M/384kbps
DMCrimson
Posts: 1025
Joined: February 13th, 2004, 6:11 am

Post by DMCrimson »

my version: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.0.3) Gecko/20060426 Firefox/1.5.0.3 Mnenhy/0.7.4.0 - Build ID: 2006042618 and custom editor is set to SubEthaEdit. I'd really much like to see the editor inside Local Install along userChrome.css etc :)
User avatar
KidReefer
Posts: 141
Joined: May 7th, 2006, 6:10 am
Location: Earth...mainly
Contact:

Post by KidReefer »

zeniko wrote:
Diorser wrote:Impossible is probably not true because you can do it at least with two different extensions: 'Menux' and 'Autohide'.

Autohide is for putting the window into full-screen mode (see the code above). MenuX hides the whole windowing chrome. Use the following code for that effect:

Code: Select all

document.getElementById("main-window").setAttribute("hidechrome", "true");

zeniko wrote:No I don't want a different effect: "hiding the titlebar" and nothing else should be clear enough.

In that case, if the above doesn't help, there's nothing I can do for you.
Any way to apply this to chatzilla? I'd like to hide the windowing chrome so as to futher match my browser(I use MenuX). Can above code achive same effect w/out MenuX. Couldnt understand, still kinda new at this. Do I use userchromejs?
User avatar
dougeeebear
Posts: 548
Joined: September 15th, 2005, 4:17 pm

Post by dougeeebear »

Since there has been some discussion (and a snippet) regarding userChrome.xul in this thread, I thought this might be an appropriate place to ask this question...

zeniko pointed me to information on changing confirmation dialog button names using confirmEx.
Now I am trying to change the OK and Cancel button names in a prompt dialog, but I can't seem to find a way to do it with just javascript.

I was thinking maybe I could do it with userChrome.xul (maybe in combination with userChrome.js).
I am still trying to figure out and understand the entries in userChrome.xul and an overlay.xul as shown by AnonEmoose.
I think if I was able to understand this a little more, that I could do it.
Any info/help on this would really be appreciated.
User avatar
Philip Chee
Posts: 6475
Joined: March 1st, 2005, 3:03 pm
Contact:

Post by Philip Chee »

How is this prompt dialog called?
http://developer.mozilla.org/en/docs/DOM:window.prompt
A prompt dialog contains a single-line textbox and an OK button, and returns the (possibly empty) text the user inputted into that textbox.

Dialog boxes are modal windows - they prevent the user from accessing the rest of the program's interface until the dialog box is closed. For this reason, you should not overuse any function that creates a dialog box (or modal window).

Chrome users (e.g. extensions) should use methods of nsIPromptService instead.

http://developer.mozilla.org/en/docs/nsIPromptService

Following the links eventually I get to nsPromptService.cpp
The prompt method eventually feeds into commonDialog.xul
From a extension point of view this is:

Code: Select all

chrome://global/content/commonDialog.xul

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

Post by dougeeebear »

...
Last edited by dougeeebear on May 16th, 2006, 9:40 am, edited 6 times in total.
Old Greg S
Posts: 0
Joined: December 31st, 1969, 5:00 pm

Post by Old Greg S »

Is it possible to re-size the Customize Toolbar Window initial height & width using this userChrome.js? In the past I've just edited customizeToolbar.js in the toolkit jar
These were the lines I edited

Code: Select all

const kWindowWidth = 635;
const kWindowHeight = 400;


Also, is there anywhere other than the few scripts listed in this thread that one could choose from? Other than the one for adding userChrome.js to the tools menu, nothing has struck me personally as use worthy.

Another also, and I'm assuming this can't be done since I haven't seen it mentioned in this thread or I didn't see it. Is there anyway to add this userChrome.js to the selectable tabs in the ChromEdit Plus extension?
old zeniko
Posts: 0
Joined: December 31st, 1969, 5:00 pm

Post by old zeniko »

Greg S wrote:Is it possible to re-size the Customize Toolbar Window initial height & width using this userChrome.js? In the past I've just edited customizeToolbar.js in the toolkit jar
These were the lines I edited

Code: Select all

const kWindowWidth = 635;
const kWindowHeight = 400;

This is indeed possible. Just add <a href="data:text/javascript,WindowHook.register(%22chrome%3A%2F%2Fglobal%2Fcontent%2FcustomizeToolbar.xul%22%2C%20function(aWindow)%20%7B%0A%09%2F%2F%20new%20dimensions%20for%20the%20Customize%20Toolbars%20window%0A%09const%20DIALOG_WIDTH%20%3D%201000%3B%0A%09const%20DIALOG_HEIGHT%20%3D%20800%3B%0A%09%0A%09var%20codeToInject%20%3D%20'eval(%22repositionDialog%20%3D%20%22%20%2B%20repositionDialog.toString().replace(%2FkWindowWidth%2Fg%2C%20'%20%2B%20DIALOG_WIDTH%20%2B%20').replace(%2FkWindowHeight%2Fg%2C%20'%20%2B%20DIALOG_HEIGHT%20%2B%20'))%3B'%0A%09%0A%09%2F%2F%20inject%20the%20code%20into%20the%20dialog's%20JS%20context%0A%09Components.classes%5B%22%40mozilla.org%2Fmoz%2Fjssubscript-loader%3B1%22%5D%0A%09%20%20%20%20%20%20%20%20%20%20.getService(Components.interfaces.mozIJSSubScriptLoader)%0A%09%20%20%20%20%20%20%20%20%20%20.loadSubScript(%22data%3Atext%2Fjavascript%2C%22%20%2B%20encodeURIComponent(codeToInject)%2C%20aWindow)%3B%0A%7D)%3B%0A">these (slightly hacky) lines</a> to your userChrome.js (you'll have to include the WindowHook snippet above for this to work).

Greg S wrote:Also, is there anywhere other than the few scripts listed in this thread that one could choose from? Other than the one for adding userChrome.js to the tools menu, nothing has struck me personally as use worthy.

AFAIK there are mostly the snippets posted in this thread. You probably won't need this extension unless you've either got an itch to scratch or got some code for runtime patching a part of Firefox or an extension (and don't want to edit the source directly).

Greg S wrote:Another also, and I'm assuming this can't be done since I haven't seen it mentioned in this thread or I didn't see it. Is there anyway to add this userChrome.js to the selectable tabs in the ChromEdit Plus extension?

I've contacted ChromEdit Plus' author about this, but have never heard from him.
User avatar
JNewbry
Posts: 321
Joined: April 9th, 2005, 3:56 am
Location: Dallas,TX
Contact:

Post by JNewbry »

zeniko, You emailed me? I never got that. For sure I would have responded.
Last edited by JNewbry on June 1st, 2006, 9:30 pm, edited 1 time in total.
<a href="http://webdesigns.ms11.net/chromeditp.html" target="_blank">ChromEdit Plus</a> | <a href="http://webdesigns.ms11.net/winstripethemes.html" target="_blank">Firefox Themes</a>
old zeniko
Posts: 0
Joined: December 31st, 1969, 5:00 pm

Post by old zeniko »

Jim, all you should have to do is to check for the existence of the file userChrome.js when ChromEdit's dialog is opened and then either display or not display the fourth tab:

Code: Select all

var uchrm = Components.classes["@mozilla.org/file/directory_service;1"]
                      .getService(Components.interfaces.nsIProperties)
                      .get("UChrm", Components.interfaces.nsILocalFile);
uchrm.append("userChrome.js");
if (uchrm.exists() && uchrm.isFile()) {
   // display the userChrome.js tab
}

This is sufficient because the extension itself ensures the existence of that file. And should you still have issues, I'll have a look at your version.

Oh, and I've PMed you the mail - just for reference (or in case you want to search your junk folder).
Locked