MediaWiki:Gadget-ShortURL.js:修订间差异
删除的内容 添加的内容
修复 Vector 2022 匿名用户看不到工具的问题:优先使用 #p-tb 而非 #p-cactions 标签:已被回退 |
ShortURL: remove numbering from label |
||
| (未显示2个用户的10个中间版本) | |||
第6行:
* @author 安忆 <i@anyi.in>; WaitSpring <me@waitspring.com>
* @license GPL-3.0-or-later {@link https://www.qiuwenbaike.cn/wiki/H:GPL-3.0}
*/
第223行 ⟶ 第222行:
let portletLink = document.querySelector("#t-shortlink");
if (!portletLink) {
const portletId = document.querySelector("#p-
portletLink = mw.util.addPortletLink(portletId, "#", getMessage("Share URL for the page"), "t-shortlink", getMessage("Show URL"));
}
第249行 ⟶ 第248行:
}).$element
);
// 【原】if (wgUserName) { 以下内容 — 仅登录显示短链接 }
// 【新】匿名也可复制短链接
const [i,
$element.append(
label: "".concat(getMessage("Short URL")).concat(i + 1),▼
})
} catch (err) {▼
_iterator2.e(err);▼
} finally {▼
_iterator2.f();▼
}
}
void OO.ui.alert($element, {
第292行 ⟶ 第291行:
if (!headerLink) {
headerLink = /* @__PURE__ */ import_ext_gadget3.default.createElement("a", {
// 【原】"aria-label": wgUserName ? getMessage("Short URL") : getMessage("Share URL for the page"),
// 【新】匿名统一显示"短链接"
href: "#"
}, /* @__PURE__ */ import_ext_gadget3.default.createElement("span", {
className: "gadget-short-link__icon"
// 【新】匿名统一
}, getMessage("Short URL")));
(0, import_ext_gadget5.tippy)(headerLink, {
arrow: true,
// 【原】content: wgUserName ?
// 【新】匿名统一
content: getMessage("Short URL"),
placement: "bottom"
});
第308行 ⟶ 第313行:
$headerElement.prependTo(".mw-indicators");
}
// 【原】const fullLink = wgUserName ? "https://".concat(domains[0]).concat(link) : "https://".concat(location.host).concat(permaLink);
// 【新】匿名也可用短链接
const fullLink = domains.length ? "https://".concat(domains[0]).concat(link) : "https://".concat(location.host).concat(permaLink);
const $notifyElement = $(/* @__PURE__ */ import_ext_gadget3.default.createElement("span", null, getMessage("URL copied to clipboard"), /* @__PURE__ */ import_ext_gadget3.default.createElement("br", null), /* @__PURE__ */ import_ext_gadget3.default.createElement("a", {
href: "#",
第365行 ⟶ 第372行:
var _ref = _asyncToGenerator(function* (diffId) {
try {
return yield api.get(Object.assign({}, parameters, {
fromrev: diffId
}));
} catch (error) {
console.error("[ShortURL] Ajax error:", error);
第426行 ⟶ 第432行:
}
if (wgAction === "view" && wgArticleId) {
if ($content.attr("id") !== "mw-content-text") {
return;
第437行 ⟶ 第443行:
revisionId: mw.config.get("wgRevisionId")
});
}
const $content = $("#mw-content-text");
if ($content.length) {
runProcess($content);
}
mw.hook("wikipage.content").add(runProcess);
}
})();
| |||