From 9279d0396ffe48897874571a5331f26e1a7d1ee2 Mon Sep 17 00:00:00 2001 From: Yorhel Date: Fri, 23 Oct 2020 11:29:17 +0200 Subject: Fix searchtabs taking over the query when switching tabs Fixes https://vndb.org/t2520.505 --- elm/searchtabs.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 elm/searchtabs.js (limited to 'elm') diff --git a/elm/searchtabs.js b/elm/searchtabs.js new file mode 100644 index 00000000..eed07ffc --- /dev/null +++ b/elm/searchtabs.js @@ -0,0 +1,11 @@ +document.querySelectorAll('#searchtabs a').forEach(function(l) { + l.onclick = function() { + var str = document.getElementById('q').value; + if(str.length > 1) { + if(this.href.indexOf('/g') >= 0 || this.href.indexOf('/i') >= 0) + this.href += '/list'; + this.href += '?q=' + encodeURIComponent(str); + } + return true; + }; +}); -- cgit v1.2.3