Firefox Showcase by: joseprio

4 replies [Last post]

Buttons

Description:
The function of this button is to group all the buttons of the Firefox Showcase extension in one. Includes a drop down with all the available options, and will remember the last one. Clicking on the button (instead of the drop down arrow) will open the last used mode.

_________________
My extension: Firefox Showcase

Firefox Showcase by: joseprio
Compatibility: 

Minefield Firefox 3.0.* Firefox 2.0.* Firefox 1.5.* Flock Thunderbird 3.* Thunderbird 2.*

Author(s): 
joseprio
Description & info:

Button(s):
Alternate Image(s):

Behavior

Action Behavior

Revisions

Revisione Operazioni
07/18/2009 - 02:33 da awedmortal

smaller image?

revisione attuale
03/02/2009 - 08:14 da admin

update compatibility field

02/27/2009 - 19:48 da SCAdmin
02/26/2009 - 05:38 da rawny
02/25/2009 - 17:11 da rawny
02/25/2009 - 02:02 da makondo

Moved Post

Code

javascript: Copy To Clipboard
if (event.target.localName == "toolbarbutton") {
try {
  var targetCommand = gPrefService.getCharPref("custombuttons.showcaseButton.showcaseCommand");
  eval(targetCommand);
} catch (e) {
  showShowcase(false, false);
}
}

Init

javascript: Copy To Clipboard
function showcaseButtonMenuClicked(event) {
  var targetCommand = document.getElementById(event.target.getAttribute("command"));
  gPrefService.setCharPref("custombuttons.showcaseButton.showcaseCommand", targetCommand.getAttribute("oncommand"));
  gPrefService.setCharPref("custombuttons.showcaseButton.showcaseType", event.target.getAttribute("showcaseType"));
  event.target.parentNode.parentNode.setAttribute("showcaseType", event.target.getAttribute("showcaseType"));
}
 
function showcaseButtonSidebarMenuClicked(event) {
  gPrefService.setCharPref("custombuttons.showcaseButton.showcaseCommand", "toggleSidebar(\"" + event.target.getAttribute("targetObserver") + "\");");
  gPrefService.setCharPref("custombuttons.showcaseButton.showcaseType", event.target.getAttribute("showcaseType"));
  event.target.parentNode.parentNode.setAttribute("showcaseType", event.target.getAttribute("showcaseType"));
  toggleSidebar(event.target.getAttribute("targetObserver"));
}
 
var mPopup = document.createElement("menupopup");
//mPopup.setAttribute("oncommand", "event.stopPropagation(); //this.parentNode.savePrefs(event)");
 
try {
this.setAttribute("showcaseType", gPrefService.getCharPref("custombuttons.showcaseButton.showcaseType"));
} catch (e) { }
 
var showcaseType = this.getAttribute("showcaseType");
var sm = document.getElementById("menu_showcase").firstChild;
var selectedMenuItem = null;
 
for(var i = 0; i < sm.childNodes.length; i++) {
  var cmi = sm.childNodes[i];
  if (cmi.localName == "menuseparator") {
    mPopup.appendChild(document.createElement("menuseparator"));
    var mi = mPopup.appendChild(document.createElement("menuitem"));
    mi.addEventListener("click", showcaseButtonSidebarMenuClicked, false);
    mi.setAttribute("label", document.getElementById("viewShowcaseThisWindowSidebar").getAttribute("label"));
    mi.setAttribute("targetObserver", "viewShowcaseThisWindowSidebar");
    mi.setAttribute("showcaseType", "CBshowcaseThisWindowSidebarMenuItem");
    mi.setAttribute("type", "radio");
    mi.setAttribute("name", "CBShowcaseButton");
    if (mi.getAttribute("showcaseType") == showcaseType) {
      selectedMenuItem = mi;
    }
    mi = mPopup.appendChild(document.createElement("menuitem"));
    mi.addEventListener("click", showcaseButtonSidebarMenuClicked, false);
    mi.setAttribute("label", document.getElementById("viewShowcaseSidebar").getAttribute("label"));
    mi.setAttribute("targetObserver", "viewShowcaseSidebar");
    mi.setAttribute("showcaseType", "CBshowcaseSidebarMenuItem");
    mi.setAttribute("type", "radio");
    mi.setAttribute("name", "CBShowcaseButton");
    if (mi.getAttribute("showcaseType") == showcaseType) {
      selectedMenuItem = mi;
    }
    mPopup.appendChild(document.createElement("menuseparator"));
  } else {
    var mi = mPopup.appendChild(document.createElement("menuitem"));
    mi.setAttribute("label", cmi.getAttribute("label"));
    mi.setAttribute("image", cmi.getAttribute("image"));
    mi.setAttribute("command", cmi.getAttribute("command"));
    mi.setAttribute("showcaseType", "CB" + cmi.getAttribute("id"));
    if (cmi.getAttribute("id") != "showcaseOptionsMenuItem") {
      mi.setAttribute("type", "radio");
      mi.setAttribute("name", "CBShowcaseButton");
      mi.addEventListener("click", showcaseButtonMenuClicked, false);
    }
    if (mi.getAttribute("showcaseType") == showcaseType) {
      selectedMenuItem = mi;
    }
  }
}
 
this.appendChild(mPopup);
this.type = "menu-button";
 
if (selectedMenuItem != null) {
  selectedMenuItem.setAttribute("checked", true);
}this.setAttribute('homepage', 'http://custombuttons2.com/forum/buttons/buttons-database/firefox-showcase-joseprio.html');

Help

Field Empty

Details

Button Categories: 
Top
Joined: 12/20/2008
Posts: 2
User offline. Last seen 45 weeks 6 days ago.

can you (or I - with a bit of help) make a version of this button with a smaller image? that would sure be good for me... thx, ken

i tried to set up an alternate (smaller) image, but failed. feel free to delete.

Custom Buttons² v.3.0.1

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.1) Gecko/20090715 Firefox/3.0.6, Ant.com Toolbar 1.3 (.NET CLR 3.5.30729)

Posted with the theme Pluralism

Top
squeaky's picture
Joined: 03/01/2008
Posts: 191
User offline. Last seen 1 year 5 weeks ago.

These do?

HTH Smile

Computers ONLY do what you TOLD them to do - which is NOT necessarily what you THINK you told them to do!

Custom Buttons² v.3.0.1

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.11) Gecko/2009060215 Firefox/3.0.11 (.NET CLR 3.5.30729)

Posted with the theme Pluralism

Top
Joined: 12/20/2008
Posts: 2
User offline. Last seen 45 weeks 6 days ago.

look just right. now, can yu tell me how to put them in your button to replace the BIG button image?

when i save the image to disk, then browse to it in "edit button - image" it disables the pull-down arrow. i'm not doing something right.

thanks.

Custom Buttons² v.3.0.1

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.1) Gecko/20090715 Firefox/3.0.6, Ant.com Toolbar 1.3 (.NET CLR 3.5.30729)

Posted with the theme Pluralism

Top
squeaky's picture
Joined: 03/01/2008
Posts: 191
User offline. Last seen 1 year 5 weeks ago.

Hiya,

This link should help:-

changing button images

If it still goes wrong after that, come back and we'll investigate Smile

Computers ONLY do what you TOLD them to do - which is NOT necessarily what you THINK you told them to do!

Custom Buttons² v.3.0.1

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.11) Gecko/2009060215 Firefox/3.0.11 (.NET CLR 3.5.30729)

Posted with the theme Pluralism

Top