[Ext] userChromeJS 2.0 [2015-08-02]

Announce and Discuss the Latest Theme and Extension Releases.
Locked
makondo
Posts: 1961
Joined: October 18th, 2007, 5:26 pm
Location: Rocky Mountains

Re: [Ext] userChromeJS 1.0 [2008-12-22]

Post by makondo »

pirlouy,
there's yet another way to do this - Custom Buttons² ext. + see my post in TMP forum:
makondo wrote:There's a custom button available now - it will toggle TMP' focus option left/right after closing a tab. Thanks rawny!
Of course, you need the Custom Buttons² ext., but with hundreds and hundreds of buttons available already (some of which are made specifically to work with TMP and some can replace other extensions) and a very helpful forum (with wiki and video tutorials), i don't think you'll regret.
Good Luck!
User avatar
pirlouy
Posts: 232
Joined: February 11th, 2005, 6:29 am
Location: France

Re: [Ext] userChromeJS 1.0 [2008-12-22]

Post by pirlouy »

I don't use TabMix Plus; and I try not to have lots of buttons so I don't use CustomButtons² either;
But thanks for your solution.
User avatar
the-edmeister
Posts: 32249
Joined: February 25th, 2003, 12:51 am
Location: Chicago, IL, USA

Re: [Ext] userChromeJS 1.0 [2008-12-22]

Post by the-edmeister »

alta 88,

Thank you for keeping this project alive!

http://userchromejs.mozdev.org/faq.html
Any plans for including the V 3.0 Sub -Script loader?
IMO, it makes it a lot easier to handle many separate mods, in separate .uc.js files.

Plus including the Snippet Collection links from here in the FAQ, might be a good idea:
http://mozilla.zeniko.ch/userchrome.js.html


Ed
A mind is a terrible thing to waste. Mine has wandered off and I'm out looking for it.
alta88
Posts: 1029
Joined: January 28th, 2006, 3:08 pm

Re: [Ext] userChromeJS 1.0 [2008-12-22]

Post by alta88 »

the-edmeister wrote:alta 88,

Thank you for keeping this project alive!

http://userchromejs.mozdev.org/faq.html
Any plans for including the V 3.0 Sub -Script loader?
IMO, it makes it a lot easier to handle many separate mods, in separate .uc.js files.

can you explain this more? the main enhancement here is file management, so is there something you can't do via the current new import methods?
Plus including the Snippet Collection links from here in the FAQ, might be a good idea:
http://mozilla.zeniko.ch/userchrome.js.html


Ed

that link is in the README.TXT file link in the FAQ, item #1 is to start there as otherwise the new utilities won't be known..
User avatar
pirlouy
Posts: 232
Joined: February 11th, 2005, 6:29 am
Location: France

Re: [Ext] userChromeJS 1.0 [2008-12-22]

Post by pirlouy »

The sub-script loader is even better with this version. Just use

Code: Select all

userChrome.import("*", "UChrm");
in userchrome.js
and all files ending by .js in your chrome directory will be read !
alta88
Posts: 1029
Joined: January 28th, 2006, 3:08 pm

Re: [Ext] userChromeJS 1.0 [2008-12-22]

Post by alta88 »

pirlouy wrote:The sub-script loader is even better with this version. Just use

Code: Select all

userChrome.import("*", "UChrm");
in userchrome.js
and all files ending by .js in your chrome directory will be read !


except userChrome.js ;D
DavidRegev
Posts: 25
Joined: October 23rd, 2007, 2:14 am
Contact:

Status Bar In Menu Bar

Post by DavidRegev »

pirlouy wrote:I just want to share this so useful script (by pile0nades) which allows to put statusbar in toolbar (or menubar)

Code: Select all

var statusbar = document.getElementById("status-bar");
var menubar = document.getElementById("nav-bar");
menubar.appendChild(statusbar);

/* statusbar.setAttribute("style", "-moz-appearance: none;");*/

statusbar.setAttribute("flex", "1");

Yeah, that’s an awesome script. However, as I pointed out in that old thread, it has a few glitches. First, the navigation toolbar’s context menu interferes with that of items in the status bar. To fix that, add this line to the script:

Code: Select all

statusbar.contextMenu = null;
Second, the window resizer is now in the wrong place. Ideally, it would always be displayed in the corner. Since I don’t know how to do that, here’s a style to hide it:

Code: Select all

#status-bar .statusbar-resizerpanel { display: none; }

Now it’s perfect. :)
User avatar
pirlouy
Posts: 232
Joined: February 11th, 2005, 6:29 am
Location: France

Re: [Ext] userChromeJS 1.0 [2008-12-22]

Post by pirlouy »

Ok. Thanks for the info, I did not notice.
And for resizerpanel, I have forgotten I have it hidden.

alta88 wrote:except userChrome.js ;D

That could have been problematic. :mrgreen:
Miccovin
Posts: 51
Joined: February 9th, 2007, 12:44 am

Re: [Ext] userChromeJS 1.0 [2008-12-22]

Post by Miccovin »

Hi,

thanks for your new work at this awesome extension. I love it. My userchrome.js is really huge. :)

If you have any new scripts - please let us know :)

And what do you think: Is it possible to organize a website for the scripts like userscripts.org/userstyles.org for Greasemonkey/Stylish?

Thanks for your great work,
Mic
Last edited by Miccovin on April 12th, 2009, 1:55 am, edited 1 time in total.
Miccovin
Posts: 51
Joined: February 9th, 2007, 12:44 am

Re: [Ext] userChromeJS 1.0 [2008-12-22]

Post by Miccovin »

Hi,

do you have an idea for a script to create a simple contextmenu-menu with my often used words so that i can insert them from there in a textarea? Like the extensions Clippings or MyWords.

Greets,
Mic
DavidRegev
Posts: 25
Joined: October 23rd, 2007, 2:14 am
Contact:

Updating the Stop-Reload-Go Button script

Post by DavidRegev »

I’m trying to update my Stop-Reload-Go Button script (which combines Stop, Reload, and Go into one dynamic button) for Firefox 3. My idea is to build upon the Smart Stop/Reload extension, and place that smart button inside the location bar, where Firefox will automatically hide it when displaying the Go button. There is one annoying problem, however, that I have been unable to solve.

So, I have this userChrome.js script:

Code: Select all

// Move Smart Stop/Reload button into the location bar right before the Go button
document.getElementById("urlbar-icons").insertBefore(
    document.getElementById("stop-reload-container"),
    document.getElementById("go-button")
);
  
with this style for Windows:

Code: Select all

@namespace url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);

/* Ensure small versions of Stop and Reload buttons are used, for consistency with other “lucky charms” */
#urlbar-icons #stop-button,
#urlbar-icons #reload-button {
   list-style-image: url(chrome://browser/skin/Toolbar-small.png) !important;
}
#urlbar-icons #reload-button {                                   -moz-image-region: rect( 0px 64px 16px 48px) !important; }
#urlbar-icons #reload-button:hover {                             -moz-image-region: rect(16px 64px 32px 48px) !important; }
#urlbar-icons #reload-button:hover:active {                      -moz-image-region: rect(64px 64px 80px 48px) !important; }
#urlbar-icons #stop-button[disabled="true"] {                    -moz-image-region: rect(32px 48px 48px 32px) !important; }
#urlbar-icons #stop-button:not([disabled="true"]) {              -moz-image-region: rect( 0px 48px 16px 32px) !important; }
#urlbar-icons #stop-button:not([disabled="true"]):hover {        -moz-image-region: rect(16px 48px 32px 32px) !important; }
#urlbar-icons #stop-button:not([disabled="true"]):hover:active { -moz-image-region: rect(64px 48px 80px 32px) !important; }

/* Consistent appearance for smart button */
#urlbar-icons {
   padding-right: 0px !important;
}
#urlbar-icons #stop-button,
#urlbar-icons #reload-button,
#urlbar-icons > #go-button {
   -moz-binding: url(chrome://global/content/bindings/toolbarbutton.xml#toolbarbutton);
   -moz-appearance: toolbarbutton;
   margin: -1.01667px 0px !important;
   padding: 3.5px 6px !important;
}
#urlbar-icons > #go-button > image {
   margin-right: 0px !important;
}
and this style for GTK+:

Code: Select all

@namespace url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);

/* Ensure small versions of Stop and Reload buttons are used, for consistency with other “lucky charms” */
#urlbar-icons #stop-button:not([disabled="true"]) { list-style-image: url(moz-icon://stock/gtk-stop?size=menu) !important; }
#urlbar-icons #stop-button[disabled="true"] {       list-style-image: url(moz-icon://stock/gtk-stop?size=menu&state=disabled) !important; }
#urlbar-icons #reload-button {                      list-style-image: url(moz-icon://stock/gtk-refresh?size=menu) !important; }

/* Consistent appearance for smart button */
#autocomplete-security-wrapper {
   margin-right: -4px !important;
}
#urlbar-icons {
   padding-right: 0px !important;
}
#urlbar-icons #stop-button,
#urlbar-icons #reload-button,
#urlbar-icons > #go-button {
   -moz-binding: url(chrome://global/content/bindings/toolbarbutton.xml#toolbarbutton);
   -moz-appearance: toolbarbutton;
   margin: -4px 0px !important;
   cursor: pointer;
}
#urlbar-icons > #go-button > image {
   margin: 0.5px 1.5px !important;
}

Now, here is my problem: since Stop and Reload are now children of the location bar, clicking on either focuses it. This is especially annoying if one uses either Fission or Locationbar², since their functionality is hidden when the location bar is focused. So…
How do I prevent the Stop and Reload buttons from giving focus to the location bar?
Any help would be greatly appreciated.
User avatar
Alice0775
Posts: 2817
Joined: October 26th, 2007, 11:25 pm
Location: OSAKA

Re: Updating the Stop-Reload-Go Button script

Post by Alice0775 »

Dawudd wrote:How do I prevent the Stop and Reload buttons from giving focus to the location bar?
Any help would be greatly appreciated.

Hook click event for these buttons.
And event.stopPropagation();
nettrotter
Posts: 87
Joined: June 26th, 2007, 6:17 pm

Re: [Ext] userChromeJS 1.0 [2008-12-22]

Post by nettrotter »

[-o< :mrgreen:
Last edited by nettrotter on April 18th, 2009, 5:04 am, edited 2 times in total.
aronin
Posts: 243
Joined: November 9th, 2005, 7:31 pm

Re: [Ext] userChromeJS 1.0 [2008-12-22]

Post by aronin »

Hi Need some help...

In order to automatically open a URL from Locationbar in New Tab, we have the following code:

Code: Select all

eval("gURLBar.handleCommand = " + gURLBar.handleCommand.toString().replace("if (aTriggeringEvent instanceof MouseEvent)", "if ((gBrowser.currentURI.spec != 'about:blank' || gBrowser.webProgress.isLoadingDocument) && (!aTriggeringEvent || !aTriggeringEvent.ctrlKey && !aTriggeringEvent.shiftKey && !aTriggeringEvent.altKey)) gBrowser.selectedTab = gBrowser.addTab(); $&"));


Now, in Fx3.1/3.5, besides wanting to overwrite an 'about:blank' tab (which is taken care of in this code), there are a couple of other scenarios where one would want to overwrite an existing tab instead of opening a new one:
- When you switch to Private Browsing mode, Fx displayed the about:privatebrowsing page. When a new URL is entered, it reads this as a loaded page and opens the URL in a new tab. Ideally this page should be overwritten.
- If you have installed this extension http://labs.mozilla.com/2009/03/firefox-new-tab-next-iteration/ , and open a new tab (Ctrl+T), it displays the new 'New Tab' page. Now again, when I input a URL and click enter, it opens in a new tab, though I would ideally want to overwrite this tab.

In order to implement these changes, I modified the code a bit. Now, I don't really know Javascript, and I get a feeling that the following script is not optimal - it works though. Was looking to see if someone can help in optimising this a bit, if possible at all.

Code: Select all

eval("gURLBar.handleCommand = " + gURLBar.handleCommand.toString().replace("if (aTriggeringEvent instanceof MouseEvent)", "if ((gBrowser.currentURI.spec != 'about:blank' || gBrowser.webProgress.isLoadingDocument) && (gBrowser.currentURI.spec != 'about:privatebrowsing') && (gBrowser.currentURI.spec != 'chrome://abouttab/content/text.html') && (!aTriggeringEvent || !aTriggeringEvent.ctrlKey && !aTriggeringEvent.shiftKey && !aTriggeringEvent.altKey)) gBrowser.selectedTab = gBrowser.addTab(); $&"));


Another note:
The default page that shows up with the 'New Tab' extension is chrome://abouttab/content/text.html, but it also has a sibling chrome://abouttab/content/tab.html. Instead of mentioning them separately, can't I just say chrome://abouttab/* and get the same behavior?

Any help is appreciated. Thanks.
DavidRegev
Posts: 25
Joined: October 23rd, 2007, 2:14 am
Contact:

Re: Updating the Stop-Reload-Go Button script

Post by DavidRegev »

Alice0775 wrote:Hook click event for these buttons.
And event.stopPropagation();

Thank you, and sorry for the long delay in responding. I was not able to get that to work at first. I tried adding

Code: Select all

document.getElementById("stop-reload-container").onclick="event.stopPropagation()";
but that would just not work. Eventually, I tried

Code: Select all

document.getElementById("stop-reload-container").setAttribute("onclick", "event.stopPropagation()");
and that worked.

If I don’t find any problems with adding that line, I will soon post the final script. In the meantime, if anyone has any idea of how to combine the Windows and GTK+ styles into one, perhaps somehow by using a selector to select for one of those platforms, I’d love to hear it. Thank you.
Last edited by DavidRegev on April 23rd, 2009, 2:07 pm, edited 1 time in total.
Locked