その他の操作
細 Waki285 がページ「MediaWiki:Gadgets-checkRestricted.js」を「MediaWiki:Gadget-checkRestricted.js」に、リダイレクトを残さずに移動しました: ページ名の誤字・脱字 |
編集の要約なし |
||
(同じ利用者による、間の2版が非表示) | |||
1行目: | 1行目: | ||
/** | /** | ||
* CheckRestricted - 2024 Waki285 | * CheckRestricted - 2024 Waki285 | ||
* Confirms when an attempt is made to grant the specified | * Confirms when an attempt is made to grant the specified permission to another person. | ||
* @license MIT or Apache-2.0 | * @license MIT or Apache-2.0 | ||
*/ | */ | ||
11行目: | 11行目: | ||
} | } | ||
if (typeof restrictedGroups === "undefined") { | if (typeof window.restrictedGroups === "undefined") { | ||
window.restrictedGroups = ["checkuser", "suppress"]; | |||
} | } | ||
32行目: | 32行目: | ||
if ($form2.length === 0) { | if ($form2.length === 0) { | ||
return; | |||
} | |||
var $user = $form2.find("input[type=hidden][name=user]"); | |||
var user = $user.val(); | |||
var executor = mw.config.get("wgUserName"); | |||
if (executor === user) { | |||
return; | return; | ||
} | } | ||
44行目: | 51行目: | ||
var $group = $form2.find("input[name^='wpGroup-']:checked"); | var $group = $form2.find("input[name^='wpGroup-']:checked"); | ||
var danger = false; | var danger = false; |
2024年7月13日 (土) 21:46時点における最新版
/**
* CheckRestricted - 2024 Waki285
* Confirms when an attempt is made to grant the specified permission to another person.
* @license MIT or Apache-2.0
*/
(function () {
var spName = mw.config.get("wgCanonicalSpecialPageName");
if (spName !== "Userrights") {
return;
}
if (typeof window.restrictedGroups === "undefined") {
window.restrictedGroups = ["checkuser", "suppress"];
}
var $form = $("#mw-content-text form");
if ($form.length === 0) {
return;
}
for (var i = 0; i < restrictedGroups.length; i++) {
var $group = $form.find("label[for='wpGroup-" + restrictedGroups[i] + "']");
if ($group.length > 0) {
$group.css("color", "red");
$group.append(" (restricted)");
}
}
var $form2 = $("form[name=editGroup]");
if ($form2.length === 0) {
return;
}
var $user = $form2.find("input[type=hidden][name=user]");
var user = $user.val();
var executor = mw.config.get("wgUserName");
if (executor === user) {
return;
}
var $initInput = $("input[name='conflictcheck-originalgroups']");
var initGroups = $initInput.val().split(",");
$form2.on("submit", function (e) {
e.preventDefault();
$form2.append($("input[name=saveusergroups").clone().prop("type", "hidden"));
var $group = $form2.find("input[name^='wpGroup-']:checked");
var danger = false;
for (var i = 0; i < $group.length; i++) {
var group = $group.eq(i).prop("name").replace("wpGroup-", "");
if (restrictedGroups.indexOf(group) === -1) {
continue;
}
if (initGroups.indexOf(group) !== -1) {
continue;
}
danger = true;
}
if (danger) {
if (confirm("You are about to add a restricted group to this user. Are you sure you want to continue?")) {
if (confirm("Are you really sure?")) {
if (confirm("Are you REALLY REALLY sure?")) {
alert("Okay, you asked for it...");
$form2.off("submit");
// wait 1sec
setTimeout(function () {
$form2.submit();
}, 1000);
} else {
return;
}
} else {
return;
}
} else {
return;
}
}
$form2.off("submit");
$form2.submit();
});
})();