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

This commit is contained in:
Matěj Grabovský 2015-03-27 13:55:01 +01:00
parent 3d2ddb8c3b
commit 6b37abab85

View File

@ -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');