Browse Source

Allow catalog search by a URL fragment (#s=...)

pull/40/head
Matěj Grabovský 9 years ago
parent
commit
6b37abab85
  1. 7
      js/catalog-search.js

7
js/catalog-search.js

@ -26,9 +26,14 @@ var catalogSearch = function() {
$threads.hide(); $threads.hide();
$found.show(); $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 // remotely and filter by multiple fields
var searchThreads = function($threads, query) { var searchThreads = function($threads, query) {
var re = new RegExp(query, 'mi'); var re = new RegExp(query, 'mi');

Loading…
Cancel
Save