[Ext] userChrome.js

Announce and Discuss the Latest Theme and Extension Releases.
Locked
User avatar
dougeeebear
Posts: 548
Joined: September 15th, 2005, 4:17 pm

Post by dougeeebear »

Thanks zeniko, it works fine now.
********
Posts: 947
Joined: August 24th, 2005, 12:23 pm

Post by ******** »

zeniko, here's the code to show "View Background Image" in the context menu even when you're right-clicking on an image and it also adds a "Save Background Image As..." to the context menu when applicable. It's pretty much the BackgroundImage Saver extension code with some modifications. If you consider it noteworthy, you can post a link on the first post of this thread.

btw, anyone know how to make a "LaunchOpera" (LaunchIE except with Opera)?
old zeniko
Posts: 0
Joined: December 31st, 1969, 5:00 pm

Post by old zeniko »

desertfox wrote:btw, anyone know how to make a "LaunchOpera" (LaunchIE except with Opera)?

Google ;) (and I'm pretty sure you could easily do so as well, if you just looked at the code)
Peng
Posts: 778
Joined: November 9th, 2004, 2:31 pm
Location: Central Florida
Contact:

Post by Peng »

desertfox: Got that without the Internal Server Error? :P I think that might get me to finally install userChrome.js. :)
Hug Peng
(aka Matt Nordhoff)
Check out: Adblock Plus | FoxClocks | OpenBook
********
Posts: 947
Joined: August 24th, 2005, 12:23 pm

Post by ******** »

Peng wrote:desertfox: Got that without the Internal Server Error? :P I think that might get me to finally install userChrome.js. :)


yeah, i do. i'll try re-uploading it when i get home.
the server was being weird yesterday.
i have several userChrome.js scripts to upload, actually. ;)
Peng
Posts: 778
Joined: November 9th, 2004, 2:31 pm
Location: Central Florida
Contact:

Post by Peng »

desertfox wrote:yeah, i do. i'll try re-uploading it when i get home.
the server was being weird yesterday.
i have several userChrome.js scripts to upload, actually. ;)


Okay. :)
Hug Peng
(aka Matt Nordhoff)
Check out: Adblock Plus | FoxClocks | OpenBook
User avatar
dougeeebear
Posts: 548
Joined: September 15th, 2005, 4:17 pm

Post by dougeeebear »

desertfox wrote:i have several userChrome.js scripts to upload, actually. ;)

Cool... I can't wait to see what they are.

I've been playing around with another one for Stylish, but I'm not having any luck with it so far.

When you install a style on userstyles.org using the "Install" button, a link appears in the editor window "Visit this style's website".
This link opens the site in a new window.
What I'm trying to do is have it open in a new tab instead (like you did for the userstyles.org link in the Manage Styles window).
********
Posts: 947
Joined: August 24th, 2005, 12:23 pm

Post by ******** »

well, just bookmark the site where i upload all the scripts and styles and extensions that i have written. :D

i have 4 up so far:
bgimage.uc.js - the background image menu items thing
launcher.uc.js - Launcher = LaunchIE + LaunchOpera in a submenu in the context menu
sm.uc.js - Session Clicking Shortcuts for Session Manager
stylish.uc.js - for the Stylish extension, read the comments in the code
Zoolcar9
Posts: 2225
Joined: November 9th, 2004, 6:45 pm
Location: Jakarta, Indonesia (UTC+7)
Contact:

Post by Zoolcar9 »


For Launch Oprah

Code: Select all

...
try
{
  var regkey = Components.classes["@mozilla.org/windows-registry-key;1"]
                .createInstance(Components.interfaces.nsIWindowsRegKey);
  regkey.open(Components.interfaces.nsIWindowsRegKey.ROOT_KEY_CURRENT_USER,
    "Software\\Opera Software\\", Components.interfaces.nsIWindowsRegKey.ACCESS_READ);
  iexplore.initWithPath(regkey.readStringValue("Last Directory3") +  "\\opera.exe");
  regkey.close();
}
catch (ex)
{
  iexplore.initWithPath((Components.classes["@mozilla.org/process/environment;1"]
      .getService(Components.interfaces.nsIEnvironment)
      .get("PROGRAMFILES") || "C:\\Program Files") + "\\Opera\\opera.exe");
}
...

My Firefox information | Add-ons | GitHub

"With great power, comes great desire to show it off."
AnonEmoose
Posts: 2031
Joined: February 6th, 2004, 11:59 am

Post by AnonEmoose »

Zoolcar9 wrote:
For Launch Oprah
........


you'd need a little more power than some js code to "launch" Oprah hehehe
********
Posts: 947
Joined: August 24th, 2005, 12:23 pm

Post by ******** »

Presenting...
Mouse Gestures with userChrome.js

i just wrote a userChrome.js spinnet for mouse rocker gestures!

features:
1. hold right mouse button and click left mouse button to go back
2. hold left mouse button and click right mouse button to go forward
3. hold right mouse button and scroll mouse wheel to switch tabs

this is really awesome for me, because i've always wanted basic mouse gesture functionality without having to use the huge all-in-one gestures extension.

now i have it with only 40 lines of code.
any suggestions for more gestures?
Zoolcar9
Posts: 2225
Joined: November 9th, 2004, 6:45 pm
Location: Jakarta, Indonesia (UTC+7)
Contact:

Post by Zoolcar9 »

  • <a href="data:application/x-javascript,%2F%2F%20View%20Source%20in%20Tab%20on%20middle%20click%0D%0A%2F%2F%20Original%20code%20is%20View%20Source%20in%20Tab%20extension%20by%20LouCypher%20(aka%20Zoolcar9)%0D%0A%2F%2F%20http%3A%2F%2Floucypher.wordpress.com%2Fprojects%2Fextensions%2Fview-source-in-tab%2F%0D%0A%0D%0A(function()%20%7B%0D%0A%20%20var%20menuID%20%3D%20%5B%22view-menu%22%2C%20%22frame%22%5D%3B%0D%0A%20%20var%20menuCmd%20%3D%20%5B%22View%3APageSource%22%2C%20%22gContextMenu.viewFrameSource()%3B%22%5D%3B%0D%0A%20%20var%20itemAttr%20%3D%20%5B%22command%22%2C%20%22oncommand%22%5D%3B%0D%0A%20%20var%20doc%20%3D%20%5B%22content.document%22%2C%20%22gContextMenu.target.ownerDocument%22%5D%3B%0D%0A%0D%0A%20%20for(var%20i%20%3D%200%3B%20i%20%3C%20doc.length%3B%20i%2B%2B)%20%7B%0D%0A%20%20%20%20var%20menuPopup%20%3D%20document.getElementById(menuID%5Bi%5D).getElementsByTagName('menupopup')%5B0%5D%3B%0D%0A%20%20%20%20var%20menuItems%20%3D%20menuPopup.getElementsByTagName(%22menuitem%22)%3B%0D%0A%20%20%20%20for(var%20j%20%3D%200%3B%20j%20%3C%20menuItems.length%3B%20j%2B%2B)%20%7B%0D%0A%20%20%20%20%20%20var%20menuItem%20%3D%20menuItems%5Bj%5D%3B%0D%0A%20%20%20%20%20%20if(menuItem.hasAttribute(itemAttr%5Bi%5D)%20%26%26%20menuItem.getAttribute(itemAttr%5Bi%5D)%20%3D%3D%20menuCmd%5Bi%5D)%0D%0A%20%20%20%20%20%20%20%20menuItem.setAttribute(%22onclick%22%2C%20%22viewSourceInTab(%22%20%2B%20doc%5Bi%5D%20%2B%20%22%2C%20event)%3B%22)%3B%0D%0A%20%20%20%20%7D%0D%0A%20%20%7D%0D%0A%0D%0A%20%20var%20contextViewSource%20%3D%20document.getElementById(%22context-viewsource%22)%3B%0D%0A%20%20contextViewSource.setAttribute(%22onclick%22%2C%20%22viewSourceInTab(content.document%2C%20event)%22)%3B%0D%0A%0D%0A%7D)()%3B%0D%0A%0D%0Afunction%20viewSourceInTab(aDocument%2C%20aEvent)%20%7B%0D%0A%20%20try%20%7B%0D%0A%20%20%20%20gBrowser.mPrefs.getBoolPref(%22viewSourceInTab.loadInNewTab%22)%3B%0D%0A%20%20%7D%20catch(ex)%20%7B%0D%0A%20%20%20%20gBrowser.mPrefs.setBoolPref(%22viewSourceInTab.loadInNewTab%22%2C%20true)%3B%0D%0A%20%20%7D%0D%0A%0D%0A%20%20try%20%7B%0D%0A%20%20%20%20gBrowser.mPrefs.getBoolPref(%22viewSourceInTab.loadInBackground%22)%3B%0D%0A%20%20%7D%20catch(ex)%20%7B%0D%0A%20%20%20%20gBrowser.mPrefs.setBoolPref(%22viewSourceInTab.loadInBackground%22%2C%20false)%3B%0D%0A%20%20%7D%0D%0A%0D%0A%20%20var%20sourceURL%20%3D%20%22view-source%3A%22%20%2B%20aDocument.location.href%3B%0D%0A%20%20if(aEvent.button%20%3D%3D%201)%20%7B%20%20%2F%2Fmiddle%20click%0D%0A%20%20%20%20if(gBrowser.mPrefs.getBoolPref(%22viewSourceInTab.loadInNewTab%22))%20%7B%0D%0A%20%20%20%20%20%20var%20newTab%20%3D%20gBrowser.addTab(sourceURL)%3B%0D%0A%20%20%20%20%20%20if(!gBrowser.mPrefs.getBoolPref(%22viewSourceInTab.loadInBackground%22))%0D%0A%20%20%20%20%20%20%20%20gBrowser.selectedTab%20%3D%20newTab%3B%20%20%20%20%2F%2Fview%20source%20in%20new%20tab%0D%0A%20%20%20%20%7D%20else%0D%0A%20%20%20%20%20%20loadURI(sourceURL)%3B%20%20%20%2F%2Fview%20source%20in%20current%20tab%0D%0A%20%20%7D%20else%20if(aEvent.button%20%3D%3D%202)%20%7B%20%2F%2Fright%20click%0D%0A%20%20%20%20%20%20aEvent.stopPropagation()%3B%0D%0A%20%20%20%20%20%20openWebPanel(aDocument.title%2C%20sourceURL)%3B%20%2F%2Fview%20source%20in%20sidebar%0D%0A%20%20%7D%0D%0A%20%20closeMenus(aEvent.target)%3B%0D%0A%7D%0D%0A%0D%0A">View Source in Tab</a> (extension)
  • <a href="data:application/x-javascript,(function()%20%7B%0D%0A%20%20%2F*%20%3A%3A%3A%3A%3A%3A%3A%3A%20WindowHook%20%3A%3A%3A%3A%3A%3A%3A%3A%20*%2F%0D%0A%20%20%2F%2Fby%20Zeniko%20http%3A%2F%2Fforums.mozillazine.org%2Fviewtopic.php%3Fp%3D2169699%232169699%0D%0A%20%20%2F%2Fallows%20userChrome.js%20to%20target%20all%20windows%20%2F%20not%20only%20the%20main%20window%0D%0A%20%20var%20WindowHook%20%3D%20%7B%0D%0A%20%20%20%20observe%3A%20function(aSubject%2C%20aTopic%2C%20aData)%20%7B%0D%0A%20%20%20%20%20%20if(!aSubject._WindowHook)%20%7B%0D%0A%20%20%20%20%20%20%20%20aSubject._WindowHook%20%3D%20this%3B%0D%0A%20%20%20%20%20%20%20%20aSubject.addEventListener(%22load%22%2C%20this.onLoad_window%2C%20false)%3B%0D%0A%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%7D%2C%0D%0A%0D%0A%20%20%20%20onLoad_window%3A%20function()%20%7B%0D%0A%20%20%20%20%20%20this.removeEventListener(%22load%22%2C%20this._WindowHook.onLoad_window%2C%20false)%3B%0D%0A%20%20%20%20%20%20var%20funcs%20%3D%20this._WindowHook.mFuncs%5Bthis.document.location.href%5D%20%7C%7C%20null%3B%0D%0A%20%20%20%20%20%20if(funcs)%20%7B%0D%0A%20%20%20%20%20%20%20%20funcs.forEach(function(aFunc)%20%7B%20aFunc(this)%3B%20%7D%2C%20this)%3B%0D%0A%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%20%20delete%20this._WindowHook%3B%0D%0A%20%20%20%20%7D%2C%0D%0A%0D%0A%20%20%20%20register%3A%20function(aURL%2C%20aFunc)%20%7B%0D%0A%20%20%20%20%20%20if(!this.mFuncs)%20%7B%0D%0A%20%20%20%20%20%20%20%20this.mFuncs%20%3D%20%7B%7D%3B%0D%0A%20%20%20%20%20%20%20%20Components.classes%5B%22%40mozilla.org%2Fobserver-service%3B1%22%5D%0D%0A%20%20%20%20%20%20%20%20%20%20.getService(Components.interfaces.nsIObserverService)%0D%0A%20%20%20%20%20%20%20%20%20%20.addObserver(this%2C%20%22domwindowopened%22%2C%20false)%3B%0D%0A%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%20%20if(!this.mFuncs%5BaURL%5D)%20%7B%0D%0A%20%20%20%20%20%20%20%20this.mFuncs%5BaURL%5D%20%3D%20%5B%5D%3B%0D%0A%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%20%20this.mFuncs%5BaURL%5D.push(aFunc)%3B%0D%0A%20%20%20%20%7D%0D%0A%20%20%7D%3B%0D%0A%0D%0A%0D%0A%20%20WindowHook.register(%22chrome%3A%2F%2Fbrowser%2Fcontent%2Fpreferences%2Fpreferences.xul%22%2C%0D%0A%20%20%20%20function(aWindow)%20%7B%0D%0A%20%20%20%20%2F%2FDelicious%20Delicacies%0D%0A%20%20%20%20%2F%2FThe%20Original%20Code%20is%20Delicious%20Delicacies%20for%20Firefox%20by%20Jesse%20Ruderman.%0D%0A%20%20%20%20%2F%2Fhttp%3A%2F%2Fwww.squarefree.com%2Fextensions%2Fdelicious-delicacies%2F%0D%0A%20%20%20%20%20%20var%20deliciousDelicacies%20%3D%20%7B%0D%0A%20%20%20%20%20%20%20%20init%3A%20function%20()%20%7B%0D%0A%20%20%20%20%20%20%20%20%20%20var%20tabbox%20%3D%20aWindow.document.getElementById(%22privacyPrefs%22)%3B%0D%0A%20%20%20%20%20%20%20%20%20%20if%20(!tabbox)%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20return%3B%0D%0A%20%20%20%20%20%20%20%20%20%20var%20descriptions%20%3D%20tabbox.getElementsByTagName(%22description%22)%3B%0D%0A%20%20%20%20%20%20%20%20%20%20var%20idx%3B%0D%0A%20%20%20%20%20%20%20%20%20%20for%20(idx%20%3D%200%3B%20idx%20%3C%20descriptions.length%3B%20%2B%2Bidx)%20%7B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20var%20elem%20%3D%20descriptions%5Bidx%5D%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20if(elem.hasAttribute(%22control%22)%20%26%26%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20(%22enableCookies%22%20%3D%3D%20elem.getAttribute(%22control%22)))%20%7B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20var%20text%20%3D%20aWindow.document.createTextNode(%22Cookies%20are%20delicious%20delicacies.%22)%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20elem.replaceChild(text%2C%20elem.firstChild)%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20return%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%20%20deliciousDelicacies.init()%3B%0D%0A%20%20%20%20%20%20aWindow.document.getElementById(%22panePrivacy%22)%0D%0A%20%20%20%20%20%20%20%20.addEventListener(%22paneload%22%2C%20deliciousDelicacies.init%2C%20false)%3B%0D%0A%20%20%20%20%7D%0D%0A%20%20)%3B%0D%0A%0D%0A%7D)()%3B%0D%0A%0D%0A">Delicious Delicacies</a> (extension)
    requires WindowHook script
My Firefox information | Add-ons | GitHub

"With great power, comes great desire to show it off."
********
Posts: 947
Joined: August 24th, 2005, 12:23 pm

Post by ******** »

is it possible to "view selection source" in a tab or sidebar?
Zoolcar9
Posts: 2225
Joined: November 9th, 2004, 6:45 pm
Location: Jakarta, Indonesia (UTC+7)
Contact:

Post by Zoolcar9 »

Last edited by Zoolcar9 on December 3rd, 2006, 11:25 am, edited 1 time in total.
My Firefox information | Add-ons | GitHub

"With great power, comes great desire to show it off."
User avatar
pirlouy
Posts: 232
Joined: February 11th, 2005, 6:29 am
Location: France

Post by pirlouy »

@desertfox: waouh, great, the mouse gestures possibility... :-)
Suggestions ? support for basics gestures for right click (i.e. left, right, up, down) ?
Locked