-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
28 lines (22 loc) · 855 Bytes
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
jQuery(function () {
jQuery('.datasearchform__qsearch_in')
.each(function (i, input) {
var $input = jQuery(input);
var $form = $input.parent().parent();
var $output = $form.find('.datasearchform__qsearch_out');
var $ns = $form.find('.datasearchform__ns');
$input.dw_qsearch({
output: $output,
getSearchterm: function () {
var query = $input.val(),
reg = new RegExp("(?:^| )(?:@|ns:)[\\w:]+");
if (reg.test(query)) {
return query;
} else {
var namespace = $ns.val();
return query + (namespace ? ' @' + namespace : '');
}
}
});
});
});