X-Git-Url: https://git.ktnx.net/?p=icedeb.git;a=blobdiff_plain;f=chrome%2Ficedeb.js;fp=chrome%2Ficedeb.js;h=0000000000000000000000000000000000000000;hp=3a08f11cae017ac4b40613b72080645b761df79b;hb=b3a0ffe87f19260ceaa14c539659af12569bd5f3;hpb=ff5223ec5c065c013dddb8593a9160c08ae6d91b diff --git a/chrome/icedeb.js b/chrome/icedeb.js deleted file mode 100644 index 3a08f11..0000000 --- a/chrome/icedeb.js +++ /dev/null @@ -1,110 +0,0 @@ -function getClipboardText() { - var clip = Components.classes['@mozilla.org/widget/clipboard;1'] - .getService(Components.interfaces.nsIClipboard); - if (!clip) return null; - - var trans = Components.classes['@mozilla.org/widget/transferable;1'] - .createInstance(Components.interfaces.nsITransferable); - if (!trans) return null; - - trans.addDataFlavor("text/unicode"); - clip.getData(trans, - clip.supportsSelectionClipboard() - ? clip.kSelectionClipboard - : clip.kGlobalClipboard - ); - - var str = new Object; - var strLength = new Object; - trans.getTransferData("text/unicode", str, strLength); - - var text = null; - - if (str) str = str.value.QueryInterface(Components.interfaces.nsISupportsString); - if (str) text = str.data.substring(0, strLength.value / 2); - - return text; -} - -function trim_keyword(word) { - if (!word) return word; - - var oldword; - do { - oldword = word; - - word = word.replace(/^\s+/, ''); - word = word.replace(/\s+$/, ''); - word = word.replace(/^#/, ''); - word = word.replace(/[-:\/,.]$/, ''); - } while ( oldword != word ); - - return word; -} - -function lookup_bts(in_new) { - var bug = trim_keyword(getClipboardText()); - if (!bug) return null; - var uri="http://bugs.debian.org/" + bug; - - if (in_new) { - var b = getBrowser(); - var new_tab = b.addTab(uri); - b.selectedTab = new_tab; - } - else { - loadURI(uri); - } -} - -function lookup_pts(in_new) { - var pkg = trim_keyword(getClipboardText()); - if (!pkg) return null; - var uri="http://packages.qa.debian.org/" + pkg; - - if (in_new) { - var b = getBrowser(); - var new_tab = b.addTab(uri); - b.selectedTab = new_tab; - } - else { - loadURI(uri); - } -} - -function lookup_deb(in_new) { - var pkg = trim_keyword(getClipboardText()); - if (!pkg) return null; - var uri="http://packages.debian.org/" + pkg; - - if (in_new) { - var b = getBrowser(); - var new_tab = b.addTab(uri); - b.selectedTab = new_tab; - } - else { - loadURI(uri); - } -} - -Debian = { - btsButton: function (e) { - if ( e.button == 0 ) - lookup_bts(false) - else if ( e.button == 1 ) - lookup_bts(true); - }, - ptsButton: function (e) { - if ( e.button == 0 ) - lookup_pts(false) - else if ( e.button == 1 ) - lookup_pts(true); - }, - debButton: function (e) { - if ( e.button == 0 ) - lookup_deb(false) - else if ( e.button == 1 ) - lookup_deb(true); - } -} -