Delete dead button - Need to bring up Options Edit /Delete context menu and need id

6 replies [Last post]
Joined: 01/26/2009
Posts: 18
User offline. Last seen 3 weeks 2 days ago.

I'm a Custombutton beginner in kindergarden. I'm trying to modify a button. I keep messing up and it goes dead.
So I get the id number from clicking Edit Button, it opens up the button,
but then I can't pull up the usual Shift+RightClick Dropdown Edit/Delete menu (Options context dropdown menu), so that I can Delete the button.
There are too many steps to take to remove a dead button. When working on a button, I make continuous mistakes and am doing a lot of trial by Error which means I'm creating dead buttons continuously. It slows me down so much with having to remove the dead button. When I press Apply to test then I lose the UNDO ctrl+Z.

#1 COuld I have a quick simple few lines to put into the Initialization code to pull up the Options dropdown Edit/delete menu. (Shift+RightClick)

#2 REQUEST Please:
Even better, is there any way that every button can have a Delete Button next to the Apply and OK button in the editor, that when you click it there will be a confirmation prompt. (the way that Stylish Editor has a cancel button that when clicked a confirmation prompt appears).

#3
Every button should have the Options dropdown menu automatically built into it with choices of which click, so that it does not have to be written into it.
A special unique click sequence only for pulling up Options dropdown menu that is never used for anything else... like Ctrl+Shift+Rightclick

#4
The particular button I'm modifying does not show the ID # in the tooltip when "Include Button id Number" is enabled in the Options > Editor dialog.
Is there a quick easy one/two line code that I can add to make it show the id # so that I don't have to rummage through Domi or the "Button Names List"?
Better yet...can every Editor automatically show the id number (in tooltip) when Enabled in OPtions Editor Dialog without the author having to write it up into the Initialization code ?

Maybe ALL HELP Tab could have these codes automatically written into them so that you can copy paste it into "Initialization code" or some other section of the button.

Thanks for any response !

Custom Buttons² v.3.1.0

Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8 (.NET CLR 3.5.30729)

Posted with the theme Pluralism

Top
jw25's picture
Joined: 08/17/2008
Posts: 90
User offline. Last seen 4 hours 16 min ago.

To remove a dead button: If you can get the editor to open select all and delete everything in the Init code tab and close the editor. That usually works.
If you can't get the button editor to open the "Edit Button" can be helpful.
To display the button ID in the tooltip: change the tooltip code to
"this.tooltipText += 'whatever';" (the "+" adds the ID to the tooltip)
The command to open the CustomButtons² context menu is "custombuttons.gQuot.gShowPopup(this);" and can be assigned to any mouseclick. It is assigned by default to shift-right-click.
Due to some changes in firefox a browser restart is often necessary to active a button after the editor has been opened.
Hope this has answered some of your questions.

Custom Buttons² v.3.1.0

Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.8) Gecko/20100722 Ant.com Toolbar 2.0.1 Firefox/3.0.3, ( .NET CLR 3.5.30729; .NET4.0C)

Posted with the theme Pluralism

Top
Joined: 01/26/2009
Posts: 18
User offline. Last seen 3 weeks 2 days ago.

OMG !!! A firefox restart after each slight change of testing, each trial and error step... OMG !
This is a nightmare ! This addon is NOT for beginners. No one can learn with all those restarts.
My computer would start smokin, hissing and screaming, and bleeding out. I'll get electrocuted from all the flying sparks ! And I'll be screaming back at it until I bleed out! The stress !
sigh....

So far I've tried this:

TOOLTIP ID
I CHANGED THIS:
this.setAttribute("tooltiptext","Quote Selected Text: L:\"\" M:- R:+\nShift+R: Options");

TO THIS:
this.setAttribute("this.tooltipText +="Quote Selected Text: L:\"\" M:- R:+\nShift+R: Options");

RESULT:
#1
I got the tooltIp id with the text that was in the Name box which is different text.
#2
It completely faded out and KILLED the button... before and after the firefox restart.

Also: I had already tried select all and removed everything in the Initialization code, and the name box and the image, clicked OK, or tried clicking APPLY and then OK, or tried clicking APPLY and then cancel, or tried clicking APPLY and then X out... and it DID NOT Delete the button,it's still there on my toolbar. (it did change the faded out color back to full opacity though)I didn't try ff restart though...will try firefox restart.

Still would really like a DELETE Button next to the APPLY and OK button, with the confirmation prompt... to whoever designed the Custombuttons Editor !

Thanks for assistance jw25 ! (I have to go offline for several hours now)

Custom Buttons² v.3.1.0

Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8 (.NET CLR 3.5.30729)

Posted with the theme Pluralism

Top
morat's picture
Joined: 01/31/2009
Posts: 198
User offline. Last seen 3 hours 30 min ago.

Here is an alternative to the Edit Button.

* left click opens dialog (button list with id and label)
* middle click restarts browser

javascript: Copy To Clipboard
/*Initialization Code*/
var data = <window
  title={this.label}
  onload={"opener.document.getElementById(\"" + this.id + "\").load()"}
  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
    <keyset>
      <key keycode="VK_ESCAPE" oncommand="close()"/>
    </keyset>
    <vbox flex="1">
      <listbox id="listbox" flex="1">
        <listhead>
          <listheader label="Id" width="200"/>
          <listheader label="Label"/>
        </listhead>
        <listcols>
          <listcol/>
          <listcol flex="1"/>
        </listcols>
      </listbox>
      <hbox>
        <button label="Edit" oncommand={"opener.document.getElementById(\"" + this.id + "\").edit()"}/>
      </hbox>
    </vbox>
</window>;
var bool = XML.prettyPrinting;
XML.prettyPrinting = false;
data = '<?xml version="1.0"?><?xml-stylesheet href="chrome://global/skin/" type="text/css"?>' + data.toXMLString();
XML.prettyPrinting = bool;
var dialog;
this.leftclick = function(event) {
  var url = "data:application/vnd.mozilla.xul+xml;text/plain," + data;
  var feature = "chrome,centerscreen,width=500,height=200,dialog=no";
  dialog = window.openDialog(url, "", feature);
}
this.midclick = function(event) {
  var os = Components.classes["@mozilla.org/observer-service;1"].
    getService(Components.interfaces.nsIObserverService);
  var cancelQuit = Components.classes["@mozilla.org/supports-PRBool;1"].
    createInstance(Components.interfaces.nsISupportsPRBool);
  os.notifyObservers(cancelQuit, "quit-application-requested", "restart");
  if (cancelQuit.data) {
    alert("Abort Restart Process");
  } else {
    var appStartup = Components.classes["@mozilla.org/toolkit/app-startup;1"].
      getService(Components.interfaces.nsIAppStartup);
    appStartup.quit(appStartup.eAttemptQuit | appStartup.eRestart);
  }
}
this.load = function() {
  var nodeList = document.getElementsByTagName("toolbarbutton");
  for (var i = 0; i < nodeList.length; i++) {
    if (nodeList[i].id.search("custombuttons-button") == 0) {
      var item = document.createElement("listitem");
      var cell = document.createElement("listcell");
      cell.setAttribute("label", nodeList[i].id);
      item.appendChild(cell);
      var cell = document.createElement("listcell");
      cell.setAttribute("label", nodeList[i].label);
      item.appendChild(cell);
      dialog.document.getElementById("listbox").appendChild(item);
    }
  }
  dialog.document.getElementById("listbox").focus();
  dialog.document.getElementById("listbox").selectAll();
}
this.edit = function() {
  var label = dialog.document.getElementById("listbox").selectedItem.firstChild.getAttribute("label");
  dialog.close();
  custombuttons.editButton(document.getElementById(label));
}
this.setAttribute("onclick", "custombuttons.gQuot.mHandler(event, this)");

The extension CB2 3.1.0 is really buggy with Firefox 3.6.

There is an initialization bug that forces the user to restart the browser when testing buttons.

Example:

javascript: Copy To Clipboard
/*Initialization Code*/
this.type = "menu-button";
this.setAttribute("tooltiptext", "foobar");

It is also possible to create a broken button.

Example:

1. add new button with default code and init code
2. place button on toolbar
3. close firefox
4. view buttonsoverlay.xul in profile folder\custombuttons

<toolbarbutton class="toolbarbutton-1 chromeclass-toolbar-additional"
  id="custombuttons-button3" label="Test" image=""
  cb-oncommand="/*CODE*/" cb-init="/*Initialization Code*/" Help=""
  context="custombuttons-contextpopup" tooltiptext="Test " initialized="true"/>

5. open firefox
6. edit init code

javascript: Copy To Clipboard
/*Initialization Code*/
this.removeAttribute("context");

7. open editor using the custombuttons.editButton function
8. delete this.removeAttribute("context"); in the init code
9. close firefox
10. view buttonsoverlay.xul (notice the missing context attribute)

<toolbarbutton class="toolbarbutton-1 chromeclass-toolbar-additional"
  id="custombuttons-button3" label="Test" image=""
  cb-oncommand="/*CODE*/" cb-init="/*Initialization Code*/" Help=""
  tooltiptext="Test " initialized="true"/>

11. open firefox (notice the button is still broken)
12. open editor using the custombuttons.editButton function
13. edit init code

javascript: Copy To Clipboard
/*Initialization Code*/
this.setAttribute("context", "custombuttons-contextpopup");

14. open editor using the context menu
15. delete this.setAttribute("context", "custombuttons-contextpopup"); in the init code

The button is back to normal...

BTW,

The original custom buttons extension does not have these problems... and version 0.0.5.1 works with Firefox 4.0b3 and Thunderbird 3.1.

Custom Buttons² was not found: find out why...

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8

Posted with the theme Pluralism

Top
Joined: 01/26/2009
Posts: 18
User offline. Last seen 3 weeks 2 days ago.

morat !!
Thanks for all that above! Up

Too many steps and too complicated !
My head is spinning from just reading all that. Reading
It's a little over my head though... and I don't want to go messing into profile folder. I know CSS but not any of this.
You must have spent soooo much of your valuable time writing that up... thankyou so much for that.

I just tried that button you wrote up:
(There's no instructions in the attachments that explains how to get the image of this button in this place - instead of automatically showing at the bottom of the page.) It won't drag to this place.

But I have the "Button Names List" id button already,which shows the image of the button so it's easier to find the button. but it means rummaging through, and a lot of buttons I'm working on have same image (cloned).
I have RESTART Firefox button with the firefox addon "Toolbar Buttons".
My firefox restart takes more than 2 minutes and 15seconds because of session manager loading and stylish sidebar loading (which I can close but then have to keep re-opening). Too much time!

I might have to wait until the next firefox version comes out where there is no bug with needing for firefox restarts then. Or maybe I'll try going back to custombuttons1 for awhile.

Like I said, a DELETE BUTTTON (with a confirmation prompt) on the Editor next to the APPLY button and OK button is the best choice. And getting the id should somehow be automatically built in, and the Dropdown EDit menu should be automatically built in as an emergency backup (with ctrl+Shift+RightClick).

And also HUGE Thankyou for all the work you did with jw25 on the find button I requested ! I absolutely love that button and use it many times a day every day ! Such a big help for me. I was going to thank you when it got posted and give it a review. Thankyou thankyou thankyou morat !

Custom Buttons² v.3.1.0

Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8 (.NET CLR 3.5.30729)

Posted with the theme Pluralism

Top
morat's picture
Joined: 01/31/2009
Posts: 198
User offline. Last seen 3 hours 30 min ago.

You would need to hack the extension to change the button editor.

The original custom buttons extension has a nice feature to disable initialization in the add-on options.

Here is a better version of the above button.

* left click opens dialog (button list with id, image, name)
* click edit to open editor
* click delete to delete button

javascript: Copy To Clipboard
/*Initialization code*/
var data = <window
  title={this.label}
  onload={"opener.document.getElementById(\"" + this.id + "\").load()"}
  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
    <keyset>
      <key keycode="VK_ESCAPE" oncommand="close()"/>
    </keyset>
    <vbox flex="1">
      <listbox id="listbox" flex="1">
        <listhead>
          <listheader label="Id" width="200"/>
          <listheader label="Image &amp; Label"/>
        </listhead>
        <listcols>
          <listcol/>
          <listcol flex="1"/>
        </listcols>
      </listbox>
      <hbox>
        <button label="Edit" oncommand={"opener.document.getElementById(\"" + this.id + "\").edit()"}/>
        <button label="Delete" oncommand={"opener.document.getElementById(\"" + this.id + "\").remove()"}/>
      </hbox>
    </vbox>
</window>;
var bool = XML.prettyPrinting;
XML.prettyPrinting = false;
data = '<?xml version="1.0"?><?xml-stylesheet href="chrome://global/skin/" type="text/css"?>' + data.toXMLString();
XML.prettyPrinting = bool;
var dialog;
this.leftclick = function(event) {
  var url = "data:application/vnd.mozilla.xul+xml;text/plain," + data;
  var feature = "chrome,centerscreen,width=500,height=200,dialog=no";
  dialog = window.openDialog(url, "", feature);
}
this.load = function() {
  var nodeList = document.getElementsByTagName("toolbarbutton");
  for (var i = 0; i < nodeList.length; i++) {
    if (nodeList[i].id.search("custombuttons-button") == 0) {
      var item = document.createElement("listitem");
      var cell = document.createElement("listcell");
      cell.setAttribute("label", nodeList[i].id);
      item.appendChild(cell);
      var cell = document.createElement("listcell");
      cell.setAttribute("class", "listcell-iconic");
      cell.setAttribute("image", nodeList[i].image || "chrome://custombuttons/skin/cb2-16.ico");
      cell.setAttribute("label", nodeList[i].label);
      item.appendChild(cell);
      dialog.document.getElementById("listbox").appendChild(item);
    }
  }
  dialog.document.getElementById("listbox").focus();
  dialog.document.getElementById("listbox").selectAll();
}
this.edit = function() {
  var id = dialog.document.getElementById("listbox").selectedItem.firstChild.getAttribute("label");
  custombuttons.editButton(document.getElementById(id));
  dialog.close();
}
this.remove = function() {
  var id = dialog.document.getElementById("listbox").selectedItem.childNodes[0].getAttribute("label");
  var label = dialog.document.getElementById("listbox").selectedItem.childNodes[1].getAttribute("label");
  var box = custombuttons.confirmBox(this.label, 'Delete button "' + label + '"?', "OK", "Cancel");
  if (box) custombuttons.removeWmButton(document.getElementById(id));
  dialog.close();
}
this.setAttribute("onclick", "custombuttons.gQuot.mHandler(event, this)");

Custom Buttons² was not found: find out why...

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8

Posted with the theme Pluralism

Top
Joined: 01/26/2009
Posts: 18
User offline. Last seen 3 weeks 2 days ago.

OMG morat !!!!!
That button is UNBELIEVABLE !!!! It's So fabulous !!!!
So helpful and it saves me so many steps and wasted time...all in one button !
Thankyou so much !!!!
The image is there for easy find of button... and a quick click to Open EDIT or DELETE the Button !!!
And it all worked perfectly !!!
SO helpful for beginnners. You must post it for others on the button database!

Thankyou Thankyou Thankyou morat !!!!!

Custom Buttons² v.3.1.0

Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8 (.NET CLR 3.5.30729)

Posted with the theme Pluralism

Top