MozillaZine

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

Announce and Discuss the Latest Theme and Extension Releases.
Alice0775

User avatar
 
Posts: 2450
Joined: October 26th, 2007, 11:25 pm
Location: OSAKA JPN

Post Posted June 2nd, 2009, 11:36 am

Jean-Gildas wrote:Hey, I've just discovered this extension, and tested it by giving cookie description back to the firefox, after a lot of tests I've aimed at this :

Code: Select all
var intvCookies;

clearIntvCookies=function() {
 clearInterval(intvCookies)
}

intvCookies=setInterval(
 function() {
  if (document.getElementById("cookiesGroup")) {
   var description = document.createElement("description");
   description.appendChild(document.createTextNode("Cookies are delicious delicacies."));
   document.getElementById("cookiesGroup").insertBefore(description,document.getElementById("cookiesBox"));
   clearIntvCookies();
  }
 },
 0
);


But there's certainly a simplier way to do, and without setting an interval (here, using only the code in the function the interval calls makes the text disappear when you open Preferences windows on another tab than Privacy one), if anyone can give me a clue, I'll be grateful ^^

You can use paneload event.
Code: Select all
function Cookies_are_delicious_delicacies() {
  if (document.getElementById("cookiesGroup")) {
   var description = document.createElement("description");
   description.appendChild(document.createTextNode("Cookies are delicious delicacies."));
   document.getElementById("cookiesGroup").insertBefore(description,document.getElementById("cookiesBox"));
   clearIntvCookies();
  }
}
Cookies_are_delicious_delicacies();
document.getElementById("panePrivacy").addEventListener("paneload", Cookies_are_delicious_delicacies, false);
Mozilla products are unreliable!!!!

If it ain't broke, don't fix it. Stop rapid release without automated test!
Now, Firefox lacks reliability. Storm of regression bugs. Let's switch to Chrome.

Jean-Gildas
 
Posts: 2
Joined: June 2nd, 2009, 10:02 am

Post Posted June 3rd, 2009, 4:21 am

Thank you for your fast answer, I didn't know this event ^^
About that, is there any list of existing events on all the Firefox DOM objects ?

Concerning the code itself, the clear interval line is now useless ;) :
Code: Select all
function Cookies_are_delicious_delicacies() {
  if (document.getElementById("cookiesGroup")) {
   var description = document.createElement("description");
   description.appendChild(document.createTextNode("Cookies are delicious delicacies."));
   document.getElementById("cookiesGroup").insertBefore(description,document.getElementById("cookiesBox"));
  }
}
Cookies_are_delicious_delicacies();
document.getElementById("panePrivacy").addEventListener("paneload", Cookies_are_delicious_delicacies, false);

Alice0775

User avatar
 
Posts: 2450
Joined: October 26th, 2007, 11:25 pm
Location: OSAKA JPN

Post Posted June 3rd, 2009, 4:46 am

Jean-Gildas wrote:is there any list of existing events on all the Firefox DOM objects ?

I always refer to MDC site.
And how to use refers to the source code of the product.
Mozilla products are unreliable!!!!

If it ain't broke, don't fix it. Stop rapid release without automated test!
Now, Firefox lacks reliability. Storm of regression bugs. Let's switch to Chrome.

shakthi
 
Posts: 1
Joined: June 24th, 2009, 4:54 am

Post Posted June 24th, 2009, 5:08 am

Hello all, glad to see UserChromeJS is going on.

I've been using a script called "URLsufix.uc.js" (yes, one "f") to complete the URL with ".com" or ".net" using Shift or Ctrl keys (same thing as the "URL suffix" extension), it works fine with Firefox 3.0.10 but it doesn't seem to be working anymore with Firefox 3.5 RC2, and I couldn't find the website I downloaded it. So if anyone can tell me what is wrong, here it is:
Code: Select all
window.__preUC_handleURLBarCommand = window.handleURLBarCommand;
window.handleURLBarCommand = function(aTriggeringEvent)
{
   const SHIFT_ENTER_URL = "http://www.%s.fr/";
   const CTRL_SHIFT_ENTER_URL = "http://www.%s.net/";

   if (!gURLBar)
   {
      return;
   }

   if (aTriggeringEvent && aTriggeringEvent.shiftKey && !aTriggeringEvent.ctrlKey)
   {
      if (!/^(\w+:|www\.)|\/\s*$/i.test(gURLBar.value))
      {
         gURLBar.value = SHIFT_ENTER_URL.replace("%s", gURLBar.value.replace(/^\s+|\s+$/g, "").replace(/ /g, "%20"));
      }
   }

   if (aTriggeringEvent && aTriggeringEvent.shiftKey && aTriggeringEvent.ctrlKey)
   {
      if (!/^(\w+:|www\.)|\/\s*$/i.test(gURLBar.value))
      {
         gURLBar.value = CTRL_SHIFT_ENTER_URL.replace("%s", gURLBar.value.replace(/^\s+|\s+$/g, "").replace(/ /g, "%20"));
      }
   }

   window.__preUC_handleURLBarCommand(aTriggeringEvent);
};

Thanks in advance.

Quickie1001
 
Posts: 7
Joined: July 27th, 2009, 8:54 am

Post Posted July 27th, 2009, 9:00 am

While the UserChromeJS addon is enabled, my FF does not respond to clicks on my "Exit" Toolbar button, nor does it exit when I click on File/Exit in FF's menu. Disabling the UCJS extension fixes this problem.

Please help! Thanks.

pirlouy

User avatar
 
Posts: 232
Joined: February 11th, 2005, 6:29 am
Location: France

Post Posted July 27th, 2009, 9:43 am

WFM.
Maybe a bad script in Chrome directory.

Quickie1001
 
Posts: 7
Joined: July 27th, 2009, 8:54 am

Post Posted July 27th, 2009, 10:15 am

Well, StatusbarInMenubar is the only script I use. Removing it from the Chrome folder stops the misbehaviour, so it must be causing my FF shutdown problems. (They did not occur before updating to FF 3.5, though.) I'm posting the code here in the hope someone can help me figure out what's wrong:

Code: Select all
var statusbar = document.getElementById("status-bar");
var menubar = document.getElementById("toolbar-menubar");

menubar.appendChild(statusbar);
statusbar.setAttribute("style", "-moz-appearance: toolbar;");
statusbar.setAttribute("flex", "1");
statusbar.contextMenu = null;

document.getElementById("urlbar").addEventListener("mouseover",function(){XULBrowserWindow.setOverLink("",null)},false);


I've noticed that I have "toolbar-menubar" where someone here has posted a version with "navbar" but that doesn't seem to work for me. Also, I'm not sure what the "document..." line (last line) does...

Many thanks.

alta88
 
Posts: 973
Joined: January 28th, 2006, 3:08 pm

Post Posted July 27th, 2009, 9:49 pm

well, if you move statusbar like that after various statusbar items have been initialized (meaning DOM references to them are now invalid) who knows what mayhem may occur. depends on what extensions you have that use statusbar, etc etc. as to severity. extension (or Fx) code that gets a reference once and not subsequently (why should it, DOM moves aren't really the norm and aren't designed for) will be broken.

the other thing you should realize, is that userChromeJS (like any extension) gives 'all access'. the script above is harmless, but - how do you know?

pirlouy

User avatar
 
Posts: 232
Joined: February 11th, 2005, 6:29 am
Location: France

Post Posted July 28th, 2009, 10:36 am

@Alta88: do you have a better way to put statusbar above tabbar ?

@Quickie1001: I think you can remove
Code: Select all
document.getElementById("urlbar").addEventListener("mouseover",function(){XULBrowserWindow.setOverLink("",null)},false);
which was used with LocationBar² and if statusbar was near locationbar.

alta88
 
Posts: 973
Joined: January 28th, 2006, 3:08 pm

Post Posted July 28th, 2009, 11:32 pm

pirlouy wrote:@Alta88: do you have a better way to put statusbar above tabbar ?

the DOM must be built with statusbar in its new place before any extensions or code make reference to it, as far as flow on Fx startup. i haven't tried it or anything, but theoretically the better way would be via xul overlay.
@Quickie1001: I think you can remove
Code: Select all
document.getElementById("urlbar").addEventListener("mouseover",function(){XULBrowserWindow.setOverLink("",null)},false);
which was used with LocationBar² and if statusbar was near locationbar.

this sets the statusbar message, usually 'Done'.

Jarikk
 
Posts: 2
Joined: September 2nd, 2009, 5:35 am

Post Posted September 2nd, 2009, 6:08 am

Hello!
There is a script for greasemonkey - Image fix and linkify - is it possible to make such a script for userChromeJS, leaving it functional of the script and add to it to load individual images on page on a combination of CTRL+click the right mouse button on the image itself?

tobbelundberg
 
Posts: 3
Joined: September 17th, 2009, 1:28 pm

Post Posted September 17th, 2009, 1:49 pm

I've made a few additions to the "Move statusbar to menubar" script.

Code: Select all
/* Code has been updated, see next message*/
/* Statusbar in Menubar (or urlbar, choose element by ID) */
var statusbar = document.getElementById("status-bar");
var menubar = document.getElementById("toolbar-menubar");

menubar.appendChild(statusbar);
statusbar.setAttribute("style", "-moz-appearance: toolbar;");
statusbar.setAttribute("flex", "1");

document.getElementById("statusbar-display").setAttribute("style", "display: none;");
document.getElementById("statusbar-progresspanel").setAttribute("style", "display: none;");

document.getElementById("urlbar").addEventListener("mouseover",function(){XULBrowserWindow.setOverLink("",null)},false);

statusbar.contextMenu = null;

/* Greasemonkey specific */
document.getElementById("gm-status-image").setAttribute("style", "margin: 0;");



aeosynth wrote:The Greasemonkey icon has lots of padding on its left and right sides, is there any way to get rid of that?


Yes, just set the margins of gm-status-image to 0 as I have done above.

EDIT: See next message for updated code
Last edited by tobbelundberg on September 18th, 2009, 7:28 am, edited 1 time in total.

tobbelundberg
 
Posts: 3
Joined: September 17th, 2009, 1:28 pm

Post Posted September 18th, 2009, 7:26 am

I've made some further refinements.

Code: Select all
/* Statusbar in Menubar (or urlbar, choose element by ID) */
var statusbar = document.getElementById("status-bar");
var menubar = document.getElementById("toolbar-menubar");

menubar.appendChild(statusbar);
statusbar.setAttribute("style", "-moz-appearance: toolbar;");
statusbar.setAttribute("flex", "1");

document.getElementById("statusbar-display").setAttribute("style", "display: none;");
document.getElementById("statusbar-progresspanel").setAttribute("style", "display: none;");

statusbar.contextMenu = null;

/* GreaseMonkey specific */
document.getElementById("gm-status-image").setAttribute("style", "margin: 0;");


I have also added the following to my userChrome.css file:
Code: Select all
#status-bar .statusbar-resizerpanel { display: none; }

as per Dawudd's suggestion.
Does anyone know of a way to put that in userChrome.js as well for a more unified solution? (document.getElementsByClassname('statusbar-resizerpanel') is an empty array)

Alice0775

User avatar
 
Posts: 2450
Joined: October 26th, 2007, 11:25 pm
Location: OSAKA JPN

Post Posted September 18th, 2009, 8:12 am

tobbelundberg wrote:Does anyone know of a way to put that in userChrome.js as well for a more unified solution? (document.getElementsByClassname('statusbar-resizerpanel') is an empty array)

See https://developer.mozilla.org/en/XBL/XB ... Interfaces
Code: Select all
document.getAnonymousElementByAttribute(document.getElementById("status-bar"), "class",  "statusbar-resizerpanel")
Mozilla products are unreliable!!!!

If it ain't broke, don't fix it. Stop rapid release without automated test!
Now, Firefox lacks reliability. Storm of regression bugs. Let's switch to Chrome.

tobbelundberg
 
Posts: 3
Joined: September 17th, 2009, 1:28 pm

Post Posted September 18th, 2009, 9:43 am

Thank you

So the script is now
Code: Select all
/* Statusbar in Menubar (or urlbar, choose element by ID) */
var statusbar = document.getElementById("status-bar");
var menubar = document.getElementById("toolbar-menubar");

menubar.appendChild(statusbar);
statusbar.setAttribute("style", "-moz-appearance: toolbar;");
statusbar.setAttribute("flex", "1");

document.getElementById("statusbar-display").setAttribute("style", "display: none;");
document.getElementById("statusbar-progresspanel").setAttribute("style", "display: none;");
document.getAnonymousElementByAttribute(statusbar, 'class', 'statusbar-resizerpanel').setAttribute("style", "display: none;");

statusbar.contextMenu = null;

/* GreaseMonkey specific */
document.getElementById("gm-status-image").setAttribute("style", "margin: 0;");


And there's no need for any userChrome.css editing :)

Return to Extension/Theme Releases


Who is online

Users browsing this forum: No registered users and 2 guests