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.

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 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;
})();