X-Git-Url: https://git.ktnx.net/?p=icedeb.git;a=blobdiff_plain;f=chrome%2Ficedeb.js;h=3b9eb7bcc1e8ee52f1f4374bc23b7938813fb6ba;hp=df6363f3cfab8cfa1124fd07411783f32eb2349e;hb=8f5e38a99516512c8cca0855b7b3f68fea0c1aba;hpb=c49d6260cf1d26f340192597003b4d328f10c1cc diff --git a/chrome/icedeb.js b/chrome/icedeb.js index df6363f..3b9eb7b 100644 --- a/chrome/icedeb.js +++ b/chrome/icedeb.js @@ -26,10 +26,25 @@ function getClipboardText() { 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 = getClipboardText(); + var bug = trim_keyword(getClipboardText()); if (!bug) return null; - bug = bug.replace(/^#/, ''); var uri="http://bugs.debian.org/" + bug; if (in_new) { @@ -43,7 +58,7 @@ function lookup_bts(in_new) { } function lookup_pts(in_new) { - var pkg = getClipboardText(); + var pkg = trim_keyword(getClipboardText()); if (!pkg) return null; var uri="http://packages.qa.debian.org/" + pkg; @@ -58,7 +73,7 @@ function lookup_pts(in_new) { } function lookup_deb(in_new) { - var pkg = getClipboardText(); + var pkg = trim_keyword(getClipboardText()); if (!pkg) return null; var uri="http://packages.debian.org/" + pkg;