跳转到内容
主菜单
主菜单
移至侧栏
隐藏
导航
首页
最近更改
随机页面
MediaWiki帮助
中医百科
搜索
搜索
登录
个人工具
登录
深色模式
查看“MediaWiki:Gadget-FullwidthSearchFix.js”的源代码
系统消息
讨论
English
阅读
查看源代码
查看历史
工具
工具
移至侧栏
隐藏
操作
阅读
查看源代码
查看历史
清除缓存
常规
链入页面
相关更改
特殊页面
页面信息
页面值
←
MediaWiki:Gadget-FullwidthSearchFix.js
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
此页面为本wiki上的软件提供界面文本,并受到保护以防止滥用。 如欲修改所有wiki的翻译,请访问
translatewiki.net
上的MediaWiki本地化项目。
您无权编辑此JavaScript页面,因为编辑此页面可能会影响所有访问者。
您必须确认您的电子邮件地址才能编辑页面。请通过
参数设置
设置并确认您的电子邮件地址。
您可以查看和复制此页面的源代码。
/** * SPDX-License-Identifier: CC-BY-SA-4.0 * _addText: '{{Gadget Header|license=CC-BY-SA-4.0}}' * * @base {@link https://zh.wikipedia.org/wiki/MediaWiki:Gadget-fullwidth-search-fix.js} * @source {@link https://git.qiuwen.net.cn/InterfaceAdmin/QiuwenGadgets/src/branch/master/src/FullwidthSearchFix} * @license CC-BY-SA-4.0 {@link https://www.qiuwenbaike.cn/wiki/H:CC-BY-SA-4.0} */ /** * +------------------------------------------------------------+ * | === WARNING: GLOBAL GADGET FILE === | * +------------------------------------------------------------+ * | All changes should be made in the repository, | * | otherwise they will be lost. | * +------------------------------------------------------------+ * | Changes to this page may affect many users. | * | Please discuss changes by opening an issue before editing. | * +------------------------------------------------------------+ */ /* <nowiki> */ (() => { "use strict"; // dist/FullwidthSearchFix/FullwidthSearchFix.js //! src/FullwidthSearchFix/modules/i18n.ts var import_ext_gadget = require("ext.gadget.i18n"); var getI18nMessages = () => { return { "Redirecting to": (0, import_ext_gadget.localize)({ en: "Redirecting to $1", ja: "「$1」にリダイレクト中", "zh-hans": "正在重定向至“$1”", "zh-hant": "正在重新導向至“$1”" }) }; }; var i18nMessages = getI18nMessages(); var getMessage = (key) => { return i18nMessages[key] || key; }; //! src/FullwidthSearchFix/modules/redirect.ts var import_ext_gadget2 = require("ext.gadget.Toastify"); var redirect = (nameSpace, pageName) => { (0, import_ext_gadget2.toastify)({ text: getMessage("Redirecting to").replace("$1", "".concat(nameSpace, ":").concat(pageName)), duration: -1 }, "info"); const { wgScript } = mw.config.get(); const href = new mw.Uri(wgScript).extend({ search: "".concat(nameSpace, ":").concat(pageName) }).toString(); location.href = href; }; //! src/FullwidthSearchFix/FullwidthSearchFix.ts (function fullwidthSearchFix() { const URL_FULLTEXT = mw.util.getParamValue("fulltext"); const URL_SEARCH = mw.util.getParamValue("search"); if (URL_FULLTEXT || !URL_SEARCH) { return; } const colonIndex = URL_SEARCH.indexOf(":"); if (colonIndex === -1) { return; } const nameSpace = URL_SEARCH.slice(0, Math.max(0, colonIndex)); const { wgNamespaceIds } = mw.config.get(); if (!wgNamespaceIds[nameSpace.toLowerCase()]) { return; } const pageName = URL_SEARCH.slice(Math.max(0, colonIndex + 1)); redirect(nameSpace, pageName); })(); })();
该页面使用的模板:
Template:Gadget Header
(
查看源代码
)
返回
MediaWiki:Gadget-FullwidthSearchFix.js
。
开关有限宽度模式