X-Git-Url: https://git.ktnx.net/?p=icedeb.git;a=blobdiff_plain;f=icedeb.js;h=81e5f0afa758280f1b1258b1bfbf75733a7d56dd;hp=26ea6cf11146fa9eb9adab0d52512e73a7f22a68;hb=bd5f16a1bf76b13ed551a492ee398a8442181811;hpb=29ce28d505875ae05212766dc12a55a78a5478b7 diff --git a/icedeb.js b/icedeb.js index 26ea6cf..81e5f0a 100644 --- a/icedeb.js +++ b/icedeb.js @@ -30,6 +30,7 @@ function trim(word) { word = word.replace(/^[^a-zA-Z0-9]+/, ''); word = word.replace(/[^a-zA-Z0-9]+$/, ''); word = word.replace(/^Bug#/i, ''); + word = word.replace(/^#/, ''); } while ( oldword != word ); return word; @@ -173,13 +174,16 @@ function link_clicked(e) { function check_likely_inputs(q) { let cnt = document.getElementById('button-list-container').classList; - cnt.remove('like-b', 'like-p', 'like-m', 'like-i'); + cnt.remove('like-b', 'like-p', 'like-m', 'like-i', 'like-s'); document.querySelectorAll('.likely') .forEach((el) => { el.classList.remove('likely'); }); - if ( /^\d+$/.test(q) || /^CVE-/.test(q) ) + q = q.replace(/^\s+/, ''); + q = q.replace(/\s+$/, ''); + + if ( /^#?\d+$/.test(q) || /^CVE-/.test(q) ) cnt.add('like-b'); if ( /^[a-z0-9][a-z0-9\-+.]+$/.test(q) ) @@ -191,7 +195,10 @@ function check_likely_inputs(q) { if ( /^<.+@.+>$/.test(q) ) cnt.add('like-i'); - document.querySelectorAll('.like-b .hint.b, .like-p .hint.p, .like-m .hint.m, .like-i .hint.i') + if ( /^d[sl]a[- ]\d+(-\d+)?$/i.test(q) ) + cnt.add('like-s'); + + document.querySelectorAll('.like-b .hint.b, .like-p .hint.p, .like-m .hint.m, .like-i .hint.i, .like-s .hint.s') .forEach((el) => { el.parentElement.parentElement.classList.add('likely'); } ); @@ -233,3 +240,5 @@ window.addEventListener('DOMContentLoaded', (e) => { window.requestAnimationFrame(get_clipboard_contents); }); }); + +// vim: sw=2