PR Anti-Edit

Untick checkbox allowing edits from maintainers for new pull and merge requests on GitHub and GitLab. Effectively, it prevents extraneous adding and modifying commits within your fork's branch acting as a source in PR/MR you create. May be useful to those of you who don't appreciate upstream maintainer tampering with your allegedly perfect work.

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        PR Anti-Edit
// @namespace   https://github.com/vintprox
// @description Untick checkbox allowing edits from maintainers for new pull and merge requests on GitHub and GitLab. Effectively, it prevents extraneous adding and modifying commits within your fork's branch acting as a source in PR/MR you create. May be useful to those of you who don't appreciate upstream maintainer tampering with your allegedly perfect work.
// @version     0.1
// @icon        https://github.com/vintprox/pr-anti-edit/raw/main/icon.png
// @license     GPL-3.0
// @author      vintprox
// @match       https://github.com/*/*/compare*
// @match       https://gitlab.com/*/merge_requests/new*
// @grant       none
// ==/UserScript==

(function () {
  let checkbox;

  switch (location.host) {
    case "github.com":
      checkbox = document.querySelector("input[name=collab_privs]");
      break;
    case "gitlab.com":
      checkbox = document.getElementById("merge_request_allow_collaboration");
      break;
  }

  if (!checkbox) throw new Error("[PR Anti-Edit] Cannot find checkbox to untick");

  checkbox.checked = false;
})();