MozillaZine

[Ext] userChrome.js

Announce and Discuss the Latest Theme and Extension Releases.
Zoolcar9

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

Post Posted June 7th, 2006, 7:20 am

giuliastro wrote:Could you explain a little better how this works? I installed your extension in Firefox and tried to create a userChrome.js file in my profile directory (I'm using Linux). Tried to paste some code there taken from the first page of this thread. Nothing happens. What am I doing wrong? Where should I create the file userChrome.js? Where can I find some documentation to write js to work with userChrome? Thanks a lot.

It should be in the <code>chrome</code> directory in your profile directory.

My Firefox information | Add-ons | GitHub

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

giuliastro
 
Posts: 8
Joined: April 18th, 2006, 6:58 am

Post Posted June 7th, 2006, 8:38 am

Zoolcar9 wrote:It should be in the <code>chrome</code> directory in your profile directory.


Ok, then there is some sort of bug with 0.7 and Firefox 1.5.0.3 on Linux. The extension got installed fine, and the chrome directory gets created. But no userChrome.js file there. Manually creating it (and pasting some code in it) doesn't seem to make it work. Am I doing something wrong?

giuliastro
 
Posts: 8
Joined: April 18th, 2006, 6:58 am

Post Posted June 7th, 2006, 8:46 am

Works perfectly on Thunderbird though.

giuliastro
 
Posts: 8
Joined: April 18th, 2006, 6:58 am

Post Posted June 7th, 2006, 8:51 am

zeniko wrote:
giuliastro wrote:Did anybody try this with Thunderbird?

Me myself, of course. See this post for some very basic examples.


Nice job! Do you think there is some way to use userChrome to filter/parse mail text? I mean, I would like to parse strings and modify email text when I reply to emails, such as automatically edit subjects and replace words. Do you think it could be possible?

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

Post Posted June 8th, 2006, 1:14 am

Diorser wrote:I would not like to abuse... but it seems so easy to you.......

Then don't. ;) And while in some cases the solution is indeed quite simple, similar solutions can be more difficult than imagined.
Diorser wrote:How to make download open in a tab by default (when open by the system).

I'm afraid, that's one of the more difficult issues and not solvable with userChrome.js except with major hackery (which I'm not willing to even try).

dougeeebear wrote:to open in a new tab instead of a window, and I'm not having any luck with it.

AFAICT, you'll have to overwrite <code>BookmarkCommand.manageFolder</code> (original code) to open a new tab instead - and then make sure that you somehow pass the argument to the tab (the argument is used here). Good luck.

XerBlade wrote:Anyone know a way I can add a toolbar buttons to the ends of the tab bar (without using one of the extensions that adds small actual toolbars to the ends of it)?

Code: Select all
document.getAnonymousNodes(getBrowser().tabContainer)[0]
        .appendChild(toolbarButton);

XerBlade wrote:And, while I'm at it, move already existing buttons there?

Just have <code>toolbarButton</code> in the snippet above point to an actual button (e.g. <code>var toolbarButton = document.getElementById("back-button");</code>). Further tweaking/styling will probably be necessary, though.

Diorser wrote:Only thing to improve for history manager: the Tab is not labelled "History Manager", but chrome://browser/content/history/history-panel.xul ...

Try the following instead of the original snippet:
Code: Select all
document.getElementById("viewHistorySidebar").setAttribute("oncommand", 'var tab = getBrowser().selectedTab = getBrowser().addTab("chrome://browser/content/history/history-panel.xul"); setTimeout(function() { tab.label = "History Manager"; }, 0);');


giuliastro wrote:Ok, then there is some sort of bug with 0.7 and Firefox 1.5.0.3 on Linux.

Do you get any errors in the JS console (having the hidden pref javascript.options.showInConsole set to true)? Make sure Firefox does have write access to the chrome directory. The userChrome.js code should actually be so simple as to not being able to contain bugs...
giuliastro wrote:Do you think there is some way to use userChrome to filter/parse mail text?

It should be possible to intercept the message before it is sent by getting into the compose window through the WindowHook snippet (see this thread's first post) and there intercepting/modifying the <code>GenericSendMessage</code> method (see MsgComposeCommands.js). Currently, writing a proper extension will require slightly less hackery, though.

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

Post Posted June 9th, 2006, 7:39 pm

Is this one possible for FF's menuitems? Go to this link, if no script is installed then temporarily allow. Now mouse over the menuitems in the box where the first item says "System overviews".

JNewbry

User avatar
 
Posts: 321
Joined: April 9th, 2005, 3:56 am
Location: Dallas,TX

Post Posted June 9th, 2006, 8:02 pm

Howdy Greg!
You do know those are all images?
Three per block with loaded/mouseover/mouseout javascript.
<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 Greg S
 
Posts: 0
Joined: December 31st, 1969, 5:00 pm

Post Posted June 9th, 2006, 8:17 pm

JNewbry wrote:Howdy Greg!
You do know those are all images?
Three per block with loaded/mouseover/mouseout javascript.

Yes, but wasn't for sure if it would work with FF's browser menupopup menuitems and didn't want to waste time trying to code it if there were some limitation to FF that wouldn't allow it even though it works with content

JNewbry

User avatar
 
Posts: 321
Joined: April 9th, 2005, 3:56 am
Location: Dallas,TX

Post Posted June 9th, 2006, 9:14 pm

I "think" it would be a job for just good old css... It is a cool effect. Mind boggling to me at the moment how to though.
Two different images for hover? Hmmmm.....
<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 Greg S
 
Posts: 0
Joined: December 31st, 1969, 5:00 pm

Post Posted June 9th, 2006, 9:40 pm

JNewbry wrote:I "think" it would be a job for just good old css... It is a cool effect.

But one would still need the onmouseover, onmouseout function with js so's you could code each with [nodeName="nodeValue"], correct? I'm unlearned as how to go about it since I really haven't read that chapter yet,lol. The site was pointed out to me by user "zoriv" who would like to have his menuitems do this if possible and I also think it's pretty neat.

Zoolcar9

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

Post Posted June 9th, 2006, 9:56 pm


Assuming the menuitem is on context menu: <a href="view-source:data:application/vnd.mozilla.xul+xml;base64,CjxvdmVybGF5IGlkPSJwbWFpbENvbnRleHRPdmVybGF5IiB4bWxucz0iaHR0cDovL3d3dy5tb3ppbGxhLm9yZy9rZXltYXN0ZXIvZ2F0ZWtlZXBlci90aGVyZS5pcy5vbmx5Lnh1bCI%2BCgogIDxzY3JpcHQgdHlwZT0iYXBwbGljYXRpb24veC1qYXZhc2NyaXB0Ij4KICA8IVtDREFUQVsKICAgIGZ1bmN0aW9uIHBNYWlsKGFFdmVudCkgewogICAgICBpZih0eXBlb2Ygbm9zY3JpcHRPdmVybGF5ID09ICJvYmplY3QiKSB7CiAgICAgICAgdHJ5IHsKICAgICAgICAgIHZhciBuc3QgPSBnUHJlZlNlcnZpY2UuZ2V0Q2hhclByZWYoIm5vc2NyaXB0LnRlbXAiKTsKICAgICAgICAgIGlmKCFuc3QubWF0Y2goL3BtYWlsXC5jb20vKSkgbm9zY3JpcHRPdmVybGF5LnNhZmVBbGxvdygicG1haWwuY29tIiwgdHJ1ZSwgdHJ1ZSk7CiAgICAgICAgfSBjYXRjaChleCkgewogICAgICAgICAgbm9zY3JpcHRPdmVybGF5LnNhZmVBbGxvdygicG1haWwuY29tIiwgdHJ1ZSwgdHJ1ZSk7CiAgICAgICAgfQogICAgICB9CiAgICAgIG9wZW5VSUxpbmsoImh0dHA6Ly93d3cucG1haWwuY29tIiwgYUV2ZW50LCBmYWxzZSwgdHJ1ZSk7CiAgICB9CiAgXV0%2BCiAgPC9zY3JpcHQ%2BCgogIDxwb3B1cCBpZD0iY29udGVudEFyZWFDb250ZXh0TWVudSI%2BCiAgICA8bWVudWl0ZW0KICAgICAgaWQ9ImNvbnRleHQtcG1haWwiCiAgICAgIGxhYmVsPSJHb3RvIFBhZ2FzdXMgTWFpbCIKICAgICAgb25jb21tYW5kPSJwTWFpbChldmVudCkiCiAgICAgIG9uY2xpY2s9ImNoZWNrRm9yTWlkZGxlQ2xpY2sodGhpcywgZXZlbnQpOyIKICAgICAgaW5zZXJ0YmVmb3JlPSJjb250ZXh0LW9wZW5saW5rIiAvPgogIDwvcG9wdXA%2BCgo8L292ZXJsYXk%2BCgo%3D">pmail.xul</a>

My Firefox information | Add-ons | GitHub

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

zoriv

User avatar
 
Posts: 1249
Joined: May 6th, 2005, 2:01 pm

Post Posted June 10th, 2006, 1:25 am

Greg S wrote:

...The site was pointed out to me by user "zoriv" who would like to have his menuitems do this if possible and I also think it's pretty neat...


Maybe I'm a little bit familiar with css recoding in the FF and TB user.Chrome.css files, but this idea is too complicated for me. That's why I won't to involve in some expert discussion.
May the below code will be a basis and help our FF's TB's experts to find the right solution. May the code is nothing to do with this hover effect. I'm just pointing out. I'm fencing of this code. I've just founded it surfing the other css forums and pasted here.

Code: Select all
#nav li a:link,
#nav li a:visited,
#nav li:hover li a,
#nav li.sfhover li a,
#nav li:hover li:hover li a,
#nav li.sfhover li.sfhover li a {
 display: block;
 text-decoration: none;
 text-align:center;
 color: #00314C;
 width: 112px;
 border: 1px solid #000;
 padding: 3px 0 3px 0;
 background-color: #FFFFFF;
 }

#nav li a:hover,
#nav li:hover a,
#nav li.sfhover a,
#nav li:hover li:hover a,
#nav li.sfhover li.sfhover,
#nav li:hover li:hover li:hover a,
#nav li.sfhover li.sfhover li.sfhover a {
 background-color: #34339B;
 color:#E5EEF4;
 }

KidReefer

User avatar
 
Posts: 141
Joined: May 7th, 2006, 6:10 am
Location: Earth...mainly

Post Posted June 10th, 2006, 3:50 am

JNewbry wrote:I "think" it would be a job for just good old css... It is a cool effect. Mind boggling to me at the moment how to though.
Two different images for hover? Hmmmm.....


Its one image (Its an animated gif) when saved it just blinks once quickly when viewed, can css even distinguish between hover "on", hover"off"? The blue is all css, maybe if the image "blinked" when hovered, then was covered with css while hovered. I dont think it would effect look when moving to next link though.Maybe the last blink would be seen when moving off the link? Crazy thought...but any way to a give a css command a sort of time delay?

XerBlade

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

Post Posted June 10th, 2006, 2:41 pm

zeniko wrote:
XerBlade wrote:Anyone know a way I can add a toolbar buttons to the ends of the tab bar (without using one of the extensions that adds small actual toolbars to the ends of it)?

Code: Select all
document.getAnonymousNodes(getBrowser().tabContainer)[0]
        .appendChild(toolbarButton);

XerBlade wrote:And, while I'm at it, move already existing buttons there?

Just have <code>toolbarButton</code> in the snippet above point to an actual button (e.g. <code>var toolbarButton = document.getElementById("back-button");</code>). Further tweaking/styling will probably be necessary, though.


Thanks. Took me a bit of time to get it working at all, but then I realized that the incoherent error (might've been easier to figure out had I separated your operation into multiple steps, so I'd get a line number actually pointing to the problem...) I was getting in the console was actually coming from typing my variable name wrong that I sent to the appendChild function.
User Agent
Extensions
AMD64/2.41GHz RAM/1.0GB ATI/256MB-GDDR3/128-bit/8xAGP Cable6.0M/384kbps

Zoolcar9

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

Post Posted June 11th, 2006, 8:52 am

JNewbry wrote:I "think" it would be a job for just good old css...

OK, you're right. Better use CSS (Stylish) than JS (userChromeJS) in this case.

Code: Select all
@namespace url(http://www.w3.org/1999/xhtml);

@-moz-document domain(pmail.com) {
  img[name] {
    width: 0 !important;
    padding-left: 300px;
  }

  img[name="so"] {
    background-image: url(http://www.pmail.com/images/nav_so_of.gif);
  }

  img[name="so"]:hover {
    background-image: url(http://www.pmail.com/images/nav_so_on.gif);
  }

  img[name="vi"] {
    background-image: url(http://www.pmail.com/images/nav_vi_of.gif);
  }

  img[name="vi"]:hover {
    background-image: url(http://www.pmail.com/images/nav_vi_on.gif);
  }

  img[name="ts"] {
    background-image: url(http://www.pmail.com/images/nav_ts_of.gif);
  }

  img[name="ts"]:hover {
    background-image: url(http://www.pmail.com/images/nav_ts_on.gif);
  }

  img[name="om"] {
    background-image: url(http://www.pmail.com/images/nav_om_of.gif);
  }

  img[name="om"]:hover {
    background-image: url(http://www.pmail.com/images/nav_om_on.gif);
  }

  img[name="eo"] {
    background-image: url(http://www.pmail.com/images/nav_eo_of.gif);
  }

  img[name="eo"]:hover {
    background-image: url(http://www.pmail.com/images/nav_eo_on.gif);
  }

  img[name="fa"] {
    background-image: url(http://www.pmail.com/images/nav_fa_of.gif);
  }

  img[name="fa"]:hover {
    background-image: url(http://www.pmail.com/images/nav_fa_on.gif);
  }

  img[name="cu"] {
    background-image: url(http://www.pmail.com/images/nav_cu_of.gif);
  }

  img[name="cu"]:hover {
    background-image: url(http://www.pmail.com/images/nav_cu_on.gif);
  }

}


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 4 guests