From 6b37abab85ad342fd18e5c09c65248634e7dd194 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Grabovsk=C3=BD?= Date: Fri, 27 Mar 2015 13:55:01 +0100 Subject: [PATCH] Allow catalog search by a URL fragment (#s=...) --- js/catalog-search.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/js/catalog-search.js b/js/catalog-search.js index b91fc1ea..3235d1dc 100644 --- a/js/catalog-search.js +++ b/js/catalog-search.js @@ -26,9 +26,14 @@ var catalogSearch = function() { $threads.hide(); $found.show(); }); + + var m = location.hash.match(/[#&]s=([^&]+)/); + if(m) { + $searchBox.val(decodeURIComponent(m[1])).keyup(); + } }; -// Filter threads by their content, given a regex. Can be extended later to load data +// Filter threads by their content, given a regex. Can be extended to load data // remotely and filter by multiple fields var searchThreads = function($threads, query) { var re = new RegExp(query, 'mi');