Content deleted Content added
includeonly→onlyinclude |
var SearchRegexes should add to, not replace, the default values. |
||
(7 intermediate revisions by the same user not shown) | |||
Line 14:
if (searchbox.classList.contains("cdx-text-input__input") || searchbox.classList.contains("search") || searchbox.id == "searchInput") {
searchbox.setAttribute("onkeyup","replaceBracesInSearch(this);");
searchbox.setAttribute("onpaste","replaceBracesInSearch(this);");
replaceBracesInSearch(searchbox);
}
Line 19 ⟶ 20:
}
var SearchRegexes =
"^(\\\{\\\{#invoke|[Mm][Dd]):":"Module:",
"^(\\\{\\\{|[Tt][Pp]:)":"Template:",
"\\\}\\\}$":"",
...SearchRegexes
};
function replaceBracesInSearch(box) {
for (var search in SearchRegexes) {
Line 25 ⟶ 31:
if(re.test(box.value)) {
box.value=box.value.replace(re,SearchRegexes[search]);
box.dispatchEvent(new Event('input'));
}
}
|