MediaWiki:Gadget-search-fix.js:修订间差异
跳到导航
跳到搜索
imported>=海豚= 无编辑摘要 |
imported>=海豚= 小 (=海豚=移动页面MediaWiki:Gadget-fullwidth-search-fix.js至MediaWiki:Gadget-search-fix.js,不留重定向:文本替换 - 替换“fullwidth-search-fix”为“search-fix”) |
(没有差异)
|
2021年6月15日 (二) 13:29的版本
(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);
window.location.href = url;
}
}
}
})(jQuery, mediaWiki);