MediaWiki:Gadget-checkRestricted.js: Difference between revisions

Waki285 (talk | contribs)
ページの作成:「* * CheckRestricted - 2024 Waki285 * Confirms when an attempt is made to grant the specified authority to another person. * @license MIT or Apache-2.0: (function () { var spName = mw.config.get("wgCanonicalSpecialPageName"); if (spName !== "Userrights") { return; } if (typeof restrictedGroups === "undefined") { var restrictedGroups = ["checkuser", "suppress"]; } var $form = $("#mw-content-text form"); if ($form.length === 0) { r…」
 
Waki285 (talk | contribs)
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
/**
/**
  * CheckRestricted - 2024 Waki285
  * CheckRestricted - 2024 Waki285
  * Confirms when an attempt is made to grant the specified authority to another person.
  * 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
  */
  */
Line 11: Line 11:
   }
   }


   if (typeof restrictedGroups === "undefined") {
   if (typeof window.restrictedGroups === "undefined") {
     var restrictedGroups = ["checkuser", "suppress"];
     window.restrictedGroups = ["checkuser", "suppress"];
   }
   }


Line 32: Line 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;
   }
   }
Line 44: Line 51:


     var $group = $form2.find("input[name^='wpGroup-']:checked");
     var $group = $form2.find("input[name^='wpGroup-']:checked");
    var $user = $form2.find("input[type=hidden][name=user]");
    var user = $user.val();
    var executor = mw.config.get("wgUserName");
    if (executor === user) {
      $form2.off("submit");
      $form2.submit();
      return;
    }


     var danger = false;
     var danger = false;