Skip to content

Instantly share code, notes, and snippets.

@mgerdts
Created February 13, 2023 05:05
Show Gist options
  • Save mgerdts/f508ae81795097397106156fa291bafa to your computer and use it in GitHub Desktop.
Save mgerdts/f508ae81795097397106156fa291bafa to your computer and use it in GitHub Desktop.
Workaround for Gerrit bug 16113
// ==UserScript==
// @name Gerrit margin fix
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Workaround https://bugs.chromium.org/p/gerrit/issues/detail?id=16113
// @author Mike Gerdts <[email protected]>
// @match https://*/gerrit/q/*
// @match https://*/gerrit/dashboard/self
// @icon https://www.google.com/s2/favicons?sz=64&domain=tampermonkey.net
// @grant none
// ==/UserScript==
(function () {
// This works when loading page initially or reloading. It needs to be triggered
// when using links
setTimeout(function () {
var $app_elem = document.querySelector("#pg-app").
shadowRoot.querySelector("#app-element");
// Look for the right element in the dashboard page.
var $e = $app_elem.shadowRoot.querySelector("gr-dashboard-view");
if ($e === null) {
// Look for the right element in the query results page.
$e = $app_elem.shadowRoot.querySelector("gr-change-list-view");
}
if ($e === null) {
console.log('Could not find element');
return;
}
var $style = $e.shadowRoot.querySelector("gr-change-list").
shadowRoot.querySelector("gr-change-list-section").
shadowRoot.querySelector(".groupContent").querySelector("gr-change-list-item").
shadowRoot.querySelector(".selectionLabel").style;
console.log('Working around https://bugs.chromium.org/p/gerrit/issues/detail?id=16113', $style);
$style.margin = '0px';
}, 1000);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment