-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfix_gcp_css.js
More file actions
49 lines (42 loc) · 1.41 KB
/
Copy pathfix_gcp_css.js
File metadata and controls
49 lines (42 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// ==UserScript==
// @name Fix GCP CSS
// @namespace http://tampermonkey.net/
// @version 2025-05-07
// @description try to take over the world!
// @author You
// @match https://console.cloud.google.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=google.com
// @grant none
// ==/UserScript==
(function() {
'use strict';
// Inject a global CSS override
// fix for trigger forms to be too small
const css = `
.cfc-max-width-base, .cm-gm2 form, .cm-gm2 form[sandboxuid="0"], .cfc-ng2-region .cfc-max-width-base[sandboxuid="0"] {
max-width: 1024px;
}
`;
const style = document.createElement('style');
style.textContent = css;
document.head.appendChild(style);
// fix for a double scroll bar (only on firefox)
document.body.style.overflowY = 'hidden';
function applyMaxWidth() {
// fix for revision env var in cloud run to be too small
const revisionEnvVarDiv = document.querySelectorAll('cfc-table.cfc-max-width-base.ng-star-inserted');
revisionEnvVarDiv.forEach((table) => {
table.style.maxWidth = '100%';
});
}
// Execute on ready
applyMaxWidth();
// Execute on DOM change
const observer = new MutationObserver(() => {
applyMaxWidth();
});
observer.observe(document.body, {
childList: true,
subtree: true,
});
})();