Missing required fields
Posted by Windcape Thu 1st Mar 2007 01:38 - Syntax is JavaScript - 27 views
Download | New Post | Modify | Hide line numbers
  1. function displayToolbarButton(myButtonID, afterItemID) {
  2.     var navToolbar = document.getElementById("nav-bar");
  3.     var afterItem = document.getElementById(afterItemID);
  4.     if(navToolbar.currentSet.indexOf(myButtonID) == -1) {
  5.         navToolbar.insertItem(myButtonID, afterItem, null, false);
  6.     }
  7.     document.persist("nav-bar", "currentset");
  8. }
  9.  
  10.  
  11. /*
  12. function displayToolbarButton(myButtonID,insertAfterID) {
  13.    // http://forums.mozillazine.org/viewtopic.php?t=189667
  14.    var navToolbar = document.getElementById("nav-bar");
  15.    if (navToolbar.currentSet.indexOf(myButtonID) == -1) {
  16.       var set = navToolbar.currentSet
  17.       var i = set.indexOf(insertAfterID);
  18.       if (i == -1) {
  19.          // can't find insertAfterID, so just insert at end of toolbar
  20.          navToolbar.insertItem(myButtonID , null, null, false);
  21.       } else {
  22.          i += insertAfterID.length; // add _after_ given id
  23.          set = set.slice(0,i) + "," + myButtonID + set.slice(i);
  24.          navToolbar.currentSet = set;
  25.       }
  26.    }
  27. }
  28. */
  29.  
  30. function pastebin_open(event) {
  31.     if(event.button == 2) { // right-click: do nothing
  32.         return;
  33.     }
  34.     openUILink('chrome://pastebin/content/pastebin.xul',event);
  35. }
  36.  
  37. window.addEventListener("load",function() {
  38.    displayToolbarButton('pastebin-button','home-button');
  39. }, false);

PermaLink to this entry https://pastebin.co.uk/11188
Posted by Windcape Thu 1st Mar 2007 01:38 - Syntax is JavaScript - 27 views
Download | New Post | Modify | Hide line numbers

 

Comments: 0