MediaWiki:Gadget-search-fix.js:修订间差异

H萌娘,万物皆可H的百科全书!
跳到导航 跳到搜索
imported>=海豚=
无编辑摘要
imported>=海豚=
无编辑摘要
第8行: 第8行:
        var ns = searchTerm.substring(0, colonIdx);
        var ns = searchTerm.substring(0, colonIdx);
        var page = searchTerm.substring(colonIdx + 1);
        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);
})(jQuery, mediaWiki);

2021年6月15日 (二) 11:59的版本

(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);
        }
    }
})(jQuery, mediaWiki);