You currently have Javascript disabled, to use some of the features (such as the login) you must enable it for this site
Thunderbird userChrome.js for CopyBBCodeLink | Custom Buttons²

Thunderbird userChrome.js for CopyBBCodeLink

Post & Get codes templates and info here

Postby nicholas on Thu Aug 30, 2007 6:09 pm

Here is a little userChrome.js hack for those of you using Thunderbird. This will add the option "CopyBBCodeLink" to the Custom Buttons 0.1.3 Context Menu. Now posting Thunderbird buttons on the forum will be much easier. This should be a nice band aid until George gets around to finishing up making the extension work with TB.

Show CopyBBCodeLink
Code: Select all
(function() {
  if(typeof custombuttons != "object") return;

  var mItem = document.createElement("menuitem");
  mItem.id = "custombuttons-contextpopup-copy";
  mItem.setAttribute("label", "CopyBBCodeLink");
  mItem.setAttribute("oncommand", "custombuttons.copyHyper();");
  mItem.style.listStyleImage = "url('data:image/png;base64,\
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAB3R\
JTUUH1wYPERkqSZPKSAAAAAlwSFlzAAALEgAACxIB0t1+/AAAAA\
xQTFRFAAAAwsV3o7K/S2iDrZWMQgAAAAF0Uk5TAEDm2GYAAAAuS\
URBVHjaY2DAAIwggMRgZAIBkACYwQgUYGZmhqgFMiACCO2DTADd\
pWh+QfctAG6iAN320GrNAAAAAElFTkSuQmCC')";

  var separator2 = document.getElementById("custombuttons-contextpopup-separator2");
  separator2.parentNode.insertBefore(mItem, separator2);
})();

window.setTimeout(function() {
  if(typeof custombuttons != "object") return;
  custombuttons.copyHyper = function () {
    var Button = document.popupNode;
    var num = this.getNumber(Button.id);
    var values = this.getButtonParameters(num);
    var uri = "[cb=custombutton://" + escape(values.name +
              "][" + values.image +
              "][" + values.code +
              "][" + values.initCode) +
              "," + unescape(values.image) +
              "]" + unescape(values.name) + "[/cb]";
      const gClipboardHelper = Components.classes["@mozilla.org/widget/clipboardhelper;1"]
         .getService(Components.interfaces.nsIClipboardHelper);
      gClipboardHelper.copyString(uri);

  }
});
User avatar
nicholas
Admin
Admin
 
Posts: 1315
Joined: Thu Jun 14, 2007 6:30 pm
Location: Los Angeles, CA

Return to Templates Codes & Tutorials

Who is online

Users browsing this forum: • Registered: 0 and 0 guests