1 function getClipboardText() {
2 var clip = Components.classes['@mozilla.org/widget/clipboard;1']
3 .getService(Components.interfaces.nsIClipboard);
4 if (!clip) return null;
6 var trans = Components.classes['@mozilla.org/widget/transferable;1']
7 .createInstance(Components.interfaces.nsITransferable);
8 if (!trans) return null;
10 trans.addDataFlavor("text/unicode");
12 clip.supportsSelectionClipboard()
13 ? clip.kSelectionClipboard
14 : clip.kGlobalClipboard
18 var strLength = new Object;
19 trans.getTransferData("text/unicode", str, strLength);
23 if (str) str = str.value.QueryInterface(Components.interfaces.nsISupportsString);
24 if (str) text = str.data.substring(0, strLength.value / 2);
29 function lookup_bts() {
30 var bug = getClipboardText();
31 loadURI("http://bugs.debian.org/" + bug);
35 btsButton: function (e) {