Gerrit checkbox resolved is always unchecked

Never automatically check "resolved", even on Done or Ack.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name            Gerrit checkbox resolved is always unchecked
// @description     Never automatically check "resolved", even on Done or Ack.
// @include         https://gerrit.example.com/c/*
// @version         1
// @run-at          document-start
// @namespace https://greasyfork.org/users/767392
// ==/UserScript==


function patchScript() {
    text = this.responseText
    text = text.replace(/n.unresolved=i/g, "n.unresolved=true");
  
    var newScript = document.createElement('script');
    newScript.type = "text/javascript";
    newScript.textContent = text;
    var body = document.getElementsByTagName('body')[0];
    body.appendChild(newScript);
}

window.addEventListener('beforescriptexecute',
  function(event)
  {
    var originalScript = event.target;

    if(/\/gr-app\.js$/.test(originalScript.src)) 
    { 
      var replacementScript = document.createElement('script');
      console.log('Greasemonkey is patching:', originalScript.src);

      originalScript.parentNode.replaceChild(replacementScript, originalScript);

      // prevent execution of the original script
      event.preventDefault();
      
      // load script and patch
      var oReq = new XMLHttpRequest();
      oReq.addEventListener("load", patchScript);
      oReq.open("GET", originalScript.src);
      oReq.send();
    }
  }
);