Posted by Windcape Thu 1st Mar 2007 01:38 - Syntax is JavaScript - 23 views
Download | New Post | Modify | Show line numbers
function displayToolbarButton(myButtonID, afterItemID) {
    var navToolbar = document.getElementById("nav-bar");
    var afterItem = document.getElementById(afterItemID);
    if(navToolbar.currentSet.indexOf(myButtonID) == -1) {
        navToolbar.insertItem(myButtonID, afterItem, null, false);
    }
    document.persist("nav-bar", "currentset");
}


/*
function displayToolbarButton(myButtonID,insertAfterID) {
   // http://forums.mozillazine.org/viewtopic.php?t=189667
   var navToolbar = document.getElementById("nav-bar");
   if (navToolbar.currentSet.indexOf(myButtonID) == -1) {
      var set = navToolbar.currentSet
      var i = set.indexOf(insertAfterID);
      if (i == -1) {
         // can't find insertAfterID, so just insert at end of toolbar
         navToolbar.insertItem(myButtonID , null, null, false);
      } else {
         i += insertAfterID.length; // add _after_ given id
         set = set.slice(0,i) + "," + myButtonID + set.slice(i);
         navToolbar.currentSet = set;
      }
   }
}
*/


function pastebin_open(event) {
    if(event.button == 2) { // right-click: do nothing
        return;
    }
    openUILink('chrome://pastebin/content/pastebin.xul',event);
}

window.addEventListener("load",function() {
   displayToolbarButton('pastebin-button','home-button');
}, false);

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

 

Comments: 0