MediaWiki:Gadget-search-fix.js:修订间差异
跳到导航
跳到搜索
imported>=海豚= (创建页面,内容为“(function($, mw) { // don't be too aggresive. just fix some obvious typos var searchTerm = mw.util.getParamValue('search'); if (searchTerm !== null && mw…”) |
imported>=海豚= 无编辑摘要 |
||
第11行: | 第11行: | ||
// valid namespace | // valid namespace | ||
var url = mw.config.get('wgScript') + '?search=' + encodeURIComponent(ns + ':' + page); | var url = mw.config.get('wgScript') + '?search=' + encodeURIComponent(ns + ':' + page); | ||
mw.notify('全角冒号转换完成'); | |||
window.location.href = url; | window.location.href = url; | ||
} | } |
2021年5月25日 (二) 13:02的版本
(function($, mw) {
// don't be too aggresive. just fix some obvious typos
var searchTerm = mw.util.getParamValue('search');
if (searchTerm !== null && mw.util.getParamValue('fulltext') === null) {
// namespace names
var colonIdx = searchTerm.indexOf(':');
if (colonIdx != -1) {
var ns = searchTerm.substring(0, colonIdx);
var page = searchTerm.substring(colonIdx + 1);
if (mw.config.get('wgNamespaceIds')[ns.toLowerCase()]) {
// valid namespace
var url = mw.config.get('wgScript') + '?search=' + encodeURIComponent(ns + ':' + page);
mw.notify('全角冒号转换完成');
window.location.href = url;
}
}
}
})(jQuery, mediaWiki);