Skip to content

Commit

Permalink
chore: 变量调整、显示预加载工具移动至edit.js
Browse files Browse the repository at this point in the history
  • Loading branch information
fallenice2022 committed Oct 31, 2023
1 parent a043b9c commit 85d9cc8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
19 changes: 12 additions & 7 deletions src/gadgets/edit/MediaWiki:Gadget-edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,18 @@ $(() => {
if (!["edit", "submit"].includes(mw.config.get("wgAction"))) {
return;
}
if (mw.config.get("wgPageName").startsWith("萌娘百科_talk:讨论版/")) {
const wgPageName = mw.config.get("wgPageName");
const wgNamespaceNumber = mw.config.get("wgNamespaceNumber");

if (wgPageName.startsWith("萌娘百科_talk:讨论版/")) {
$(".mw-editnotice + .mw-warning-with-logexcerpt").hide();
}
const sanity = $(document.createElement("span"));
const sanity = $("<span>");
const sanityClean = (h) => {
sanity.text(h);
return sanity.html();
};
// 快速填写编辑摘要
const wpSummary = $('[name="wpSummary"]');
// $(".mw-summary-preset-item a").closest('.oo-ui-fieldLayout-header').width($('#wpSummary').width());
$(".mw-summary-preset-item a").on("click", ({ target }) => {
Expand Down Expand Up @@ -51,8 +55,7 @@ $(() => {
return result;
};
if (!$("ul.permissions-errors").find('a[href*="MoeAuth"]').length && !!$(".permissions-errors, #wpTextbox1[readonly]")[1] && mw.config.get("wgUserName") && !$(".newComment")[0]) {
const wgNamespaceNumber = mw.config.get("wgNamespaceNumber"),
ns = [];
const ns = [];
if (wgNamespaceNumber < 0 || wgNamespaceNumber % 2 === 1) {
return;
}
Expand All @@ -69,7 +72,6 @@ $(() => {
if (!ns[0]) {
return;
}
const wgPageName = mw.config.get("wgPageName");
let page = mw.config.get("wgPageName");
const pageToLowerCase = page.toLowerCase();
for (const n of ns) {
Expand All @@ -96,11 +98,14 @@ $(() => {
scrollTop: explainconflict.closest(".infoBox").offset().top - 2,
}, 137);
}

//只在ns0和ns2的子页面加载预加载工具
if (![0, 2].includes(wgNamespaceNumber) || wgNamespaceNumber === 2 && !wgPageName.includes("/")) {
$("#multiboilerplateform").remove();
}
// 非维护组、技术组成员提出方针编辑请求时提醒需要走提案
if (
new URLSearchParams(location.search).get("preloadtitle").startsWith("编辑请求") &&
mw.config.get("wgNamespaceNumber") === 5 &&
wgNamespaceNumber === 5 &&
mw.config.get("wgAction") === "edit" &&
!mw.config.get("wgUserGroups").some((value) => ["patroller", "sysop", "techeditor", "interface-admin", "staff"].includes(value))
) {
Expand Down
4 changes: 0 additions & 4 deletions src/gadgets/site-js/MediaWiki:Gadget-site-js.js
Original file line number Diff line number Diff line change
Expand Up @@ -571,10 +571,6 @@
passive: true,
});
});
//只在ns0和ns2的子页面加载预加载工具
if (![0, 2].includes(mw.config.get("wgNamespaceNumber")) || mw.config.get("wgNamespaceNumber") === 2 && !mw.config.get("wgPageName").includes("/")) {
$("#multiboilerplateform").remove();
}
// 小工具使用统计移除默认启用的小工具
if (mw.config.get("wgCanonicalSpecialPageName") === "GadgetUsage") {
gadgetUsageRemoveDefaultGadgets();
Expand Down

0 comments on commit 85d9cc8

Please sign in to comment.