MozillaZine

[Ext] userChrome.js

Announce and Discuss the Latest Theme and Extension Releases.
aaron

User avatar
 
Posts: 3130
Joined: November 4th, 2002, 8:49 pm
Location: Texas

Post Posted July 25th, 2006, 10:47 am

I've tried these on 1.5 and the only one I can get to work is the auto context menu. All I need is searchbar auto clear (I currently use the "Search Button" extension to perform just this one task...).

SevenSeven wrote:Sharing some of my own 2.0a3-tested-only snippets:

- Auto clear searchbar after submit
- Auto show context menu upon selecting

<a href="data:application/x-javascript;charset=utf-8;base64,Lyo9PT09PT09IENsZWFyIHRoZSBzZWFyY2hiYXIgYWZ0ZXIgc3VibWl0ID09PT09PT0qLw0KDQp2YXIgc2VhcmNoYmFyQXV0b2NsZWFyID0gew0KCXNlYXJjaGJhclBvcHVwc2hvd2luZzogZmFsc2UsDQoJaW5pdDogZnVuY3Rpb24oKSB7ICANCgkJdGhpcy5zZWFyY2hiYXIgPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgic2VhcmNoYmFyIik7DQoJCXZhciBzZWFyY2hiYXJUZXh0Ym94ID0gZG9jdW1lbnQuZ2V0QW5vbnltb3VzRWxlbWVudEJ5QXR0cmlidXRlKHRoaXMuc2VhcmNoYmFyLCAiYW5vbmlkIiwgInNlYXJjaGJhci10ZXh0Ym94Iik7DQoJCXNlYXJjaGJhclRleHRib3guYWRkRXZlbnRMaXN0ZW5lcigia2V5cHJlc3MiLCBmdW5jdGlvbihldmVudCkgeyBzZWFyY2hiYXJBdXRvY2xlYXIuY2xlYXIoZXZlbnQpOyB9LCBmYWxzZSk7DQoJCXZhciBnb0J1dHRvbiA9IGRvY3VtZW50LmdldEFub255bW91c0VsZW1lbnRCeUF0dHJpYnV0ZSh0aGlzLnNlYXJjaGJhciwgImFub25pZCIsICJzZWFyY2gtZ28tYnV0dG9uIik7DQoJCWdvQnV0dG9uLmFkZEV2ZW50TGlzdGVuZXIoImNsaWNrIiwgZnVuY3Rpb24oZXZlbnQpIHsgc2VhcmNoYmFyQXV0b2NsZWFyL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DQoJCWlmICgoZXZlbnQua2V5Q29kZSA9PSAxMykgfHwgKGV2ZW50LmJ1dHRvbiA9PSAwKSkgew0KCQkJc2V0VGltZW91dCgic2VhcmNoYmFyQXV0b2NsZWFyLnNlYXJjaGJhci52YWx1ZT0nJzsiLCAwKTsNCgkJCXNldFRpbWVvdXQoInNlYXJjaGJhckF1dG9jbGVhci5zZWFyY2hiYXIuX3RleHRib3guX2Rpc3BsYXlDdXJyZW50RW5naW5lKCk7IiwgMCk7DQoJCQlldmVudC5zdG9wUHJvcGFnYXRpb24oKTsNCgkJfQ0KCX0NCn07DQpzZWFyY2hiYXJBdXRvY2xlYXIuaW5pdCgpOw%3D%3D">even better auto clear searchbar code - display current engine after submit</a>

<a href="data:application/x-javascript;charset=utf-8;base64,Lyo9PT09PT09IEF1dG8gY29udGV4dCBtZW51IG9uIHNlbGVjdGlvbiA9PT09PT09Ki8NCg0KdmFyIGF1dG9Db250ZXh0bWVudSA9IHsNCglleGVjOiBmdW5jdGlvbihldmVudCkgew0KCQlpZiAoZXZlbnQuYnV0dG9uICE9IDApIHJldHVybjsNCgkJdmFyIHNlbGVjdGlvbiA9IGRvY3VtZW50LmNvbW1hbmREaXNwYXRjaGVyLmZvY3VzZWRXaW5kb3cuZ2V0U2VsZWN0aW9uKCk7DQoJCWlmIChzZWxlY3Rpb24udG9TdHJpbmcoKSA9PSAiIikgcmV0dXJuOw0KCQlpZiAoZXZlbnQudHlwZSA9PSAibW91c2Vkb3duIikNCgkJCWlmICgoc2VsZWN0aW9uLnJhbmdlQ291bnQgPiAwKSAmJiAhc2VsZWN0aW9uLmdldFJhbmdlQXQoMCkuY29sbGFwc2VkKQ0KCQkJCWlmIChldmVudC50YXJnZXQudGFnTmFtZSAhPSAibWVudWl0ZW0iKQ0KCQkJCQlzZWxlY3Rpb24ucmVtb3ZlQWxsUmFuZ2VzKCk7DQoJCWlmICghc2VsZWN0aW9uLmlzQ29sbGFwc2VkKSB7DQoJCQl2YXIgbW91c2VFdmVudCA9IGRvY3VtZW50LmNyZWF0ZUV2ZW50KCJNb3VzZUV2ZW50cyIpOw0KCQkJbW91c2VFdmVudC5pbml0TW91c2VFdmVudCgiY29udGV4dG1lbnUiLCB0cnVlLCB0cnVlLCB3aW5kb3csIDEsIGV2ZW50LnNjcmVlblgsIGV2ZW50LnNjcmVlblksIGV2ZW50LmNsaWVudFgsIGV2ZW50LmNsaWVudFksIGZhbHNlLCBmYWxzZSwgZmFsc2UsIGZhbHNlLCAyLCBudWxsKTsNCgkJCWV2ZW50LnRhcmdldC5kaXNwYXRjaEV2ZW50KG1vdXNlRXZlbnQpOw0KCQl9DQoJfQ0KfTsNCmRvY3VtZW50LmFkZEV2ZW50TGlzdGVuZXIoIm1vdXNlZG93biIsIGZ1bmN0aW9uKGV2ZW50KSB7IGF1dG9Db250ZXh0bWVudS5leGVjKGV2ZW50KTsgfSwgZmFsc2UpOw0KZG9jdW1lbnQuYWRkRXZlbnRMaXN0ZW5lcigibW91c2V1cCIsIGZ1bmN0aW9uKGV2ZW50KSB7IGF1dG9Db250ZXh0bWVudS5leGVjKGV2ZW50KTsgfSwgZmFsc2UpOw0K">better auto context menu - now works for repeated selection of the same objects</a>

aaron

User avatar
 
Posts: 3130
Joined: November 4th, 2002, 8:49 pm
Location: Texas

Post Posted July 25th, 2006, 12:29 pm

Anyone have any code code to spawn the context menu for items in the bookmark toolbar (for SeaMonkey)?

aranittara

User avatar
 
Posts: 32
Joined: July 31st, 2006, 6:25 am

Post Posted August 1st, 2006, 4:47 pm

http://webdesigns.ms11.net/chromeditpSE.html


you all should check this out
-Aranittara

deskareas
 
Posts: 85
Joined: June 1st, 2003, 4:45 pm

Post Posted August 4th, 2006, 9:28 am

how do i add the IE icon in LaunchIE (LaunchIE.uc.js) for the context menu ?
i finally found out how to launch my external application with arguments,
but would like to have the program icon there too.

i tried without result:
Code: Select all
this.mItem.setAttribute("image","c:\\test.ico" );


thanks

XerBlade

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

Post Posted August 4th, 2006, 11:05 am

Try doing it in CSS rather than JS, just targeting the item created in that JS.

Code: Select all
menuitem[label="LaunchIE"]  {
   list-style-image: url("file:///c:/image/ie.png");
}


Also, make sure you use the "file:///" protocol, and try not to use a .ico file but rather an image file.
User Agent
Extensions
AMD64/2.41GHz RAM/1.0GB ATI/256MB-GDDR3/128-bit/8xAGP Cable6.0M/384kbps

deskareas
 
Posts: 85
Joined: June 1st, 2003, 4:45 pm

Post Posted August 4th, 2006, 11:30 am

uhm ... where to put that ?

thanks

XerBlade

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

Post Posted August 4th, 2006, 11:36 am

xpi wrote:uhm ... where to put that ?

thanks

userChrome.css, somewhere below the @namespace line.
If you don't have a userChrome.css, rename the userChrome-example.css file in your Chrome folder to it.
User Agent
Extensions
AMD64/2.41GHz RAM/1.0GB ATI/256MB-GDDR3/128-bit/8xAGP Cable6.0M/384kbps

deskareas
 
Posts: 85
Joined: June 1st, 2003, 4:45 pm

Post Posted August 4th, 2006, 12:00 pm

that doesn't work for me :(

my userChrome.css (everything is in the right place (the css and png exist) - chromeditor shows the code)

Code: Select all
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* set default namespace to XUL */

menuitem[label="LaunchIE"]  {
   list-style-image: url("file:///c:/ie.png");
}

lyn2005
 
Posts: 22
Joined: September 30th, 2005, 10:56 am

Post Posted August 4th, 2006, 12:08 pm

Would userChrome.js allow me to add tooltips text to Bookmarks Toolbar folders?

(or if someone here knows another way to do that, I'd appreciate their advice)

Thanks,

Lyn

Zoolcar9

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

Post Posted August 4th, 2006, 12:29 pm


@<a href="#2411631">Lyn</a>:
See Shows the Bookmarks tooltips and Sidebar tooltips script at http://forums.mozillazine.org/viewtopic ... 24#2171524

@<a href="#2411607">xpi</a>:
This old trick works:
Code: Select all
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");

menuitem[label="LaunchIE"]  {
   background-image: url("file:///d:/image.png") !important;
   background-position: top left !important;
   background-repeat: no-repeat !important;
}

Last edited by Zoolcar9 on August 4th, 2006, 4:22 pm, edited 1 time in total.
My Firefox information | Add-ons | GitHub

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

deskareas
 
Posts: 85
Joined: June 1st, 2003, 4:45 pm

Post Posted August 4th, 2006, 1:44 pm

Zoolcar9, thanks for your help !

deskareas
 
Posts: 85
Joined: June 1st, 2003, 4:45 pm

Post Posted August 4th, 2006, 1:52 pm

do you have an idea why the icon disappears on mouse over ?

Zoolcar9

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

Post Posted August 4th, 2006, 4:24 pm


It works for me, but I fixed the code <a href="#2411689">above</a>. Please try it.

My Firefox information | Add-ons | GitHub

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

lyn2005
 
Posts: 22
Joined: September 30th, 2005, 10:56 am

Post Posted August 4th, 2006, 5:47 pm

I'm not exactly sure where to put that code. Can't seem to create a js.user file, either, nor does Chromedit say I even have one.

Can I put the code in Stylish? Sorry, I know I'm missing something very obvious but I'm confused.

Thanks again,

Lyn

Firefox 1.5.0.1

lyn2005
 
Posts: 22
Joined: September 30th, 2005, 10:56 am

Post Posted August 4th, 2006, 5:49 pm

I should have added, I tried both notepad and metapad to create js.user ... in my profile folder, of course. Seems like that's the first thing I better figure out..

Return to Extension/Theme Releases


Who is online

Users browsing this forum: No registered users and 3 guests