[Ext] userChrome.js

Announce and Discuss the Latest Theme and Extension Releases.
Locked
old zeniko
Posts: 0
Joined: December 31st, 1969, 5:00 pm

Post by old zeniko »

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

JavaScript is way stricter than CSS. An error in userChrome.css probably affects only a few rules, whereas one in JavaScript quite easily affects the whole file (especially if it's a syntax error). The point is that JavaScript doesn't know about your different snippets as long as you don't use the updated Sub-Script Loader (which catches the errors in the individual files). In the end, you really have to avoid errors...

alta88 wrote:does this mean full "C:\blah blah\..\ScriptDir\script1.uc.js" is correct syntax for arg aFile?

Yes and no. Yes, the full path is the correct syntax. And no, in JavaScript you have to write the backslashs twice: "C:\\Documents and Settings\\...\\chrome\\ScriptDir\\script1.js".

alta88 wrote:importScript("ScriptDir\script1.uc.js");

I've updated the importScript snippet to also accept paths relative to the chrome folder (i.e. "ScriptDir/script1.uc.js" equals "C:\\...\\chrome\\ScriptDir\\script1.uc.js").

Diorser wrote:Looking for a simple JS to hide titlebar

Hiding the titlebar of existing windows is impossible. All you could do would be to switch the window into full-screen mode (which effectively hides the titlebar):

Code: Select all

window.fullScreen = true;

In case you want to achieve a different effect, please describe more precisely what you're after...
User avatar
Diorser
Posts: 1009
Joined: June 22nd, 2005, 6:57 am

Post by Diorser »

zeniko wrote:Hiding the titlebar of existing windows is impossible.
Impossible is probably not true because you can do it at least with two different extensions: 'Menux' and 'Autohide'.

zeniko wrote:In case you want to achieve a different effect, please describe more precisely what you're after...
No I don't want a different effect: "hiding the titlebar" and nothing else should be clear enough.
old zeniko
Posts: 0
Joined: December 31st, 1969, 5:00 pm

Post by old zeniko »

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.
User avatar
Diorser
Posts: 1009
Joined: June 22nd, 2005, 6:57 am

Post by Diorser »

Code: Select all

document.getElementById("main-window").setAttribute("hidechrome", "true");
has no effect in userchrome.css

"Autohide" has following options, and do what I am looking for => "hiding the titlebar":

Image

reminder: my goal is/was to avoid extra extensions for simple operation.
I don't really understand why an extension is necessary for this, and why a simple Jscript or css cannot do it, but I will live with it !
User avatar
cyberrus
Posts: 144
Joined: October 15th, 2004, 5:42 pm
Location: Wroclaw, Poland

Post by cyberrus »

Diorser wrote:...I don't really understand why an extension is necessary for this, and why a simple Jscript or css cannot do it, but I will live with it !


because title bar is part of operating system chrome not browser itself
old zeniko
Posts: 0
Joined: December 31st, 1969, 5:00 pm

Post by old zeniko »

Please read this carefully:

Diorser wrote:

Code: Select all

document.getElementById("main-window").setAttribute("hidechrome", "true");
has no effect in userchrome.css

The code I gave you was for userChrome.js and not userChrome.css (as even the title of this thread states).

Diorser wrote:"Autohide" has following options, and do what I am looking for => "hiding the titlebar":

Autohide just sets the window into full-screen mode (i.e. the window is maximized and the titlebar is hidden). This can be achieved with the code I offered you first: window.fullScreen = true; (again to be put into userChrome.js, although I somewhat doubt that you want to have every window full-screened per default). Please press your [F11] key once before posting again...
Zoolcar9
Posts: 2225
Joined: November 9th, 2004, 6:45 pm
Location: Jakarta, Indonesia (UTC+7)
Contact:

Post by Zoolcar9 »


You can try this

Code: Select all

window.fullScreen = true;
window.FullScreen.showXULChrome("toolbar", true);
window.FullScreen.showXULChrome("statusbar", true);
window.setTimeout(function() {
  window.resizeTo(800, 600);
  window.moveTo(112, 84);
})();

It looked ugly though :er:

//edit: it's for userChrome.js

My Firefox information | Add-ons | GitHub

"With great power, comes great desire to show it off."
User avatar
Diorser
Posts: 1009
Joined: June 22nd, 2005, 6:57 am

Post by Diorser »

zeniko wrote:The code I gave you was for userChrome.js and not userChrome.css
Sorry, I was not familiar with userchrome.js, which is considered as an extension if I understand well, with userchrome.js file placed in chrome dir.

Tried both of your solutions above, but don't see any difference with a normal full-screen operation.

Well, finally, I think "Autohide" will do it !
Thanks to all.
User avatar
pirlouy
Posts: 232
Joined: February 11th, 2005, 6:29 am
Location: France

Post by pirlouy »

Thanks Zoolcar9 for the solution (tab just at right). ;)

@zeniko: you could add it in the first post...but little by little, you will have to create a special page with all scripts.
Once again, thanks for your active development.
User avatar
mrtech
Posts: 2007
Joined: May 15th, 2003, 7:46 am
Location: New York
Contact:

Post by mrtech »

Cato62 wrote: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


Cato62: with v4.5.1 I had to make some changes to try to support Linux and rewrote some of the calls.

just change this:
userChromeJS.setAttribute("oncommand", "open_profile.fileRunOrOpen(open_profile.getSpecialFolder('UChrm'), 'userChrome.js', 'local_install.default_JS_editor', true);");

to this:
userChromeJS.setAttribute("oncommand", "open_profile.fileRunOrOpen(local_common.getSpecialFolderPath('UChrm'), 'userChrome.js', 'local_install.default_JS_editor', true);");
mel reyes • mrtech.com • BlogPlaxoLinkedInTwitter
Support mrtech.com get our toolbar
User avatar
Cato62
Posts: 684
Joined: March 7th, 2005, 10:06 am
Location: Eugene, OR

Post by Cato62 »

mrtech wrote:
Cato62 wrote: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


Cato62: with v4.5.1 I had to make some changes to try to support Linux and rewrote some of the calls.

just change this:
userChromeJS.setAttribute("oncommand", "open_profile.fileRunOrOpen(open_profile.getSpecialFolder('UChrm'), 'userChrome.js', 'local_install.default_JS_editor', true);");

to this:
userChromeJS.setAttribute("oncommand", "open_profile.fileRunOrOpen(local_common.getSpecialFolderPath('UChrm'), 'userChrome.js', 'local_install.default_JS_editor', true);");


Thanks for the fix, Mel! Worked like a charm. Great job! =D> \:D/ :turn-l:
"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
Zoolcar9
Posts: 2225
Joined: November 9th, 2004, 6:45 pm
Location: Jakarta, Indonesia (UTC+7)
Contact:

Post by Zoolcar9 »


Thanks :) I updated the <a href="data:application/x-javascript;charset=utf-8;base64,LyogIFRoaXMgc2NyaXB0IHdpbGwgYWRkICJFZGl0IHVzZXJDaHJvbWUuanMiIG1lbnVpdGVtIGluDQogICAgTVIgVGVjaCBMb2NhbCBJbnN0YWxsJ3MgRWRpdCBDb25maWcgQnV0dG9uIE1lbnUgdmVyc2lvbiAxLjQgICAgKi8NCg0KKGZ1bmN0aW9uKCkgew0KDQogIGZ1bmN0aW9uIGluc2VydE1lbnVJdGVtKHRoaXNNZW51SXRlbUlELCB0aGlzRmlsZUV4dCwgdGhpc0tleSkNCiAgew0KICAgIHZhciBlZGl0Q29uZmlnTWVudSA9IGRvY3VtZW50DQogICAgICAgIC5nZXRFbGVtZW50QnlJZCh0aGlzTWVudUl0ZW1JRCkuZmlyc3RDaGlsZDsNCiAgICBpZighZWRpdENvbmZpZ01lbnUpIHJldHVybjsNCg0KICAgIHZhciBjbWQ7DQogICAgaWYodHlwZW9mIG9wZW5fcHJvZmlsZS5nZXRTcGVjaWFsRm9sZGVyID09ICJmdW5jdGlvbiIpDQogICAgICBjbWQgPSAib3Blbl9wcm9maWxlLmZpbGVSdW5Pck9wZW4ob3Blbl9wcm9maWxlLmdldFNwZWNpYWxGb2xkZXIoJ1VDaHJtJyksICd1c2VyQ2hyb21lLiIgKyB0aGlzRmlsZUV4dCArICInLCAnbG9jYWxfaW5zdGFsbC5kZWZhdWx0X0pTX2VkaXRvcicsIHRydWUpOyIgIC8vIHVzZXMgZGVmYXVsdCBKUyBlZGl0b3IgdG8gZWRpdCBYVUwNCiAgICBlbHNlDQogICAgICAvL01MVEkgNC41LjEgYW5kIGFib3ZlDQogICAgICBjbWQgPSAiZXZlbnQuc3RvcFByb3BhZ2F0aW9uKCk7IG9wZW5fcHJvZmlsZS5maWxlUnVuT3JPcGVuKGxvY2FsX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bnVJdGVtKCJlZGl0Y29uZmlnZmlsZXMtdG9vbGJhci1idXR0b24iLCAianMiLCAiaiIpOw0KICBpbnNlcnRNZW51SXRlbSgidG9vbHNfZWRpdF9teV9jb25maWciLCAieHVsIiwgIngiKTsNCiAgaW5zZXJ0TWVudUl0ZW0oInRvb2xzX2VkaXRfbXlfY29uZmlnIiwgImpzIiwgImoiKTsNCg0KfSkoKTsNCg0KDQo%3D" title="Last updated: 2006-05-24">code</a>.

//re-updated. Thanks again.
Last edited by Zoolcar9 on May 23rd, 2006, 10:39 pm, edited 2 times in total.
My Firefox information | Add-ons | GitHub

"With great power, comes great desire to show it off."
User avatar
mrtech
Posts: 2007
Joined: May 15th, 2003, 7:46 am
Location: New York
Contact:

Post by mrtech »

you might want to change the example to:

if (typeof open_profile.getSpecialFolder == "function")

not sure if the original version gives an error in js console and this is a litte safer.
mel reyes • mrtech.com • BlogPlaxoLinkedInTwitter
Support mrtech.com get our toolbar
alta88
Posts: 1029
Joined: January 28th, 2006, 3:08 pm

Post by alta88 »

thank you zeniko.

it's odd the malformed file name didn't catch and there was no 'file not found' console log message..

how could i get a message to print in the console, for debugging etc. i tried the method in the example but nothing shows. (both javascript options set to true.)
old zeniko
Posts: 0
Joined: December 31st, 1969, 5:00 pm

Post by old zeniko »

pirlouy wrote:@zeniko: you could add it in the first post...

I've added a "Tabs to the Right" snippet which is a little bit more sophisticated (if you open two tabs in a row, the second tab will be to the right of the first one).

alta88 wrote:it's odd the malformed file name didn't catch and there was no 'file not found' console log message..

I get the following message in the console (not that precise, but an error after all):
Error Console wrote:Error: 'Error opening input stream (invalid filename?)' when calling method: [nsIDOMEventListener::handleEvent] = NS_ERROR_XPC_JS_THREW_STRING

alta88 wrote:how could i get a message to print in the console, for debugging etc. i tried the method in the example but nothing shows. (both javascript options set to true.)

JavaScript errors should be displayed automatically. To log messages yourself, use something like the following function:

Code: Select all

function debug(aMsg) {
  Components.classes["@mozilla.org/consoleservice;1"]
    .getService(Components.interfaces.nsIConsoleService)
    .logStringMessage("userChrome.js: " + aMsg);
}
Locked