Last active
July 3, 2024 20:59
-
-
Save JSH32/1e67ac40bd4d3c68102bbbd6f70b8c72 to your computer and use it in GitHub Desktop.
Remove Portainer BE branding, based on https://github.com/adripo/portainer-ce-clean-layout stylus script but compiled to actual CSS.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# To use you can put this in your location proxy block, will automatically intercept Portainer HTML requests and put the CSS file in there. | |
proxy_set_header Accept-Encoding ""; | |
proxy_buffering off; | |
gzip off; | |
sub_filter_once off; | |
sub_filter_types text/html; | |
sub_filter '<base id="base"/>' '<base id="base"/><script src="https://cdn.gisthostfor.me/JSH32-SkOcsSXKYq-remove_be.js"></script><link rel="stylesheet" href="https://cdn.gisthostfor.me/JSH32-T2cOu14Cab-remove_be.css">'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#sideview button:has(+ nav) { | |
display: none !important; | |
} | |
#sideview | |
nav[aria-label="Settings"] | |
li[aria-label="Users"] | |
li:has(a[href="#!/roles"]) { | |
display: none !important; | |
} | |
#sideview | |
nav[aria-label="Settings"] | |
li[aria-label="Authentication logs"]:has(a[href="#!/auth-logs"]) { | |
display: none !important; | |
} | |
#sideview li[aria-label="Cluster"] li[aria-label="Security constraints"] { | |
display: none !important; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
function applyStyles() { | |
const url = window.location.href; | |
// Utility function to apply styles | |
function hideElements(selectors) { | |
selectors.forEach(selector => { | |
const elements = document.querySelectorAll(selector); | |
elements.forEach(el => { | |
el.style.display = 'none'; | |
}); | |
}); | |
} | |
// Styles based on URL patterns | |
const styles = [ | |
{ | |
pattern: /.*\/#!\/wizard\/endpoints($|\/create\?.*$)/, | |
selectors: [ | |
'#content-wrapper div.app-react-components-BoxSelector-BoxSelectorItem-module__business' | |
] | |
}, | |
{ | |
pattern: /.*\/#!\/endpoints\/[0-9]+\/access($|\?.*$)/, | |
selectors: [ | |
'#content-wrapper div.form-group:has(be-feature-indicator)' | |
] | |
}, | |
{ | |
pattern: /.*\/#!\/registries.*/, | |
selectors: [ | |
'#content-wrapper a.be-indicator' | |
] | |
}, | |
{ | |
pattern: /.*\/#!\/settings.*/, | |
selectors: [ | |
'#content-wrapper div.form-group:has(a.be-indicator)', | |
'#content-wrapper div.be-indicator-container', | |
'#content-wrapper div.app-react-components-BoxSelector-BoxSelectorItem-module__business' | |
] | |
}, | |
{ | |
pattern: /.*\/#!\/settings\/auth.*/, | |
selectors: [ | |
'#content-wrapper div.app-react-components-BoxSelector-BoxSelectorItem-module__business', | |
'#content-wrapper ldap-settings label[for="ldap_url"] button.limited-be', | |
'#content-wrapper ldap-settings ldap-custom-user-search > div.form-group div.col-sm-12:has(be-feature-indicator)', | |
'#content-wrapper ldap-settings ldap-custom-group-search > rd-widget div.form-group:has(pr-icon[icon="\'briefcase\'"])', | |
'#content-wrapper ldap-settings ldap-custom-group-search > div.form-group div.col-sm-12:has(be-feature-indicator)', | |
'#content-wrapper ldap-settings ldap-custom-admin-group', | |
'#content-wrapper ldap-settings ldap-settings-test-login', | |
'#content-wrapper oauth-settings div.form-group:has(a.be-indicator)' | |
] | |
}, | |
{ | |
pattern: /.*\/#!\/[0-9]+\/docker\/stacks\/newstack($|.*$)/, | |
selectors: [ | |
'#content-wrapper div:has(> div.form-section-title a.be-indicator)', | |
'#content-wrapper div > div.form-section-title:has(a.be-indicator)', | |
'#content-wrapper tr:has(div.form-group a.be-indicator)' | |
] | |
}, | |
{ | |
pattern: /.*\/#!\/[0-9]+\/docker\/containers\/new($|.*$)/, | |
selectors: [ | |
'#content-wrapper div:has(> div.form-group a.be-indicator)' | |
] | |
}, | |
{ | |
pattern: /.*\/#!\/[0-9]+\/docker\/containers\/[0-9a-fA-F]{64}.*/, | |
selectors: [ | |
'#content-wrapper tr:has(div.form-group a.be-indicator)' | |
] | |
}, | |
{ | |
pattern: /.*\/#!\/[0-9]+\/docker\/host\/feat-config.*/, | |
selectors: [ | |
'#content-wrapper div.form-group div.col-sm-12:has(a.be-indicator)', | |
'#content-wrapper div.form-section-title:has(+ div.form-group div.col-sm-12:only-child a.be-indicator)' | |
] | |
}, | |
{ | |
pattern: /.*\/#!\/[0-9]+\/docker\/host\/registries.*/, | |
selectors: [ | |
'#content-wrapper be-feature-indicator' | |
] | |
}, | |
{ | |
pattern: /.*\/#!\/[0-9]+\/kubernetes\/pools\/new($|.*$)/, | |
selectors: [ | |
'#content-wrapper div.form-group:has(label a.be-indicator)', | |
'#content-wrapper div.form-section-title:has(+ div.form-group + div.form-section-title + storage-class-switch a.be-indicator)', | |
'#content-wrapper div.form-section-title + div.form-group:has(+ div.form-section-title + storage-class-switch a.be-indicator)', | |
'#content-wrapper div.form-section-title + div.form-group + div.form-section-title:has(+ storage-class-switch a.be-indicator)' | |
] | |
}, | |
{ | |
pattern: /.*\/#!\/[0-9]+\/kubernetes\/deploy($|\?.*$)/, | |
selectors: [ | |
'#content-wrapper div.form-group:has(label a.be-indicator)' | |
] | |
}, | |
{ | |
pattern: /.*\/#!\/[0-9]+\/kubernetes\/cluster\/configure.*/, | |
selectors: [ | |
'#content-wrapper div.form-section-title:has(+ div.form-group por-switch-field[name="\'disableSysctlSettingForRegularUsers\'"] a.be-indicator)', | |
'#content-wrapper div.form-section-title + div.form-group:has(por-switch-field[name="\'disableSysctlSettingForRegularUsers\'"] a.be-indicator)', | |
'#content-wrapper div:has(> por-switch-field[name="\'restrictStandardUserIngressW\'"] a.be-indicator)', | |
'#content-wrapper div:has(+ div > por-switch-field[name="\'resource-over-commit-switch\'"] a.be-indicator)', | |
'#content-wrapper div + div:has(> por-switch-field[name="\'resource-over-commit-switch\'"] a.be-indicator)' | |
] | |
} | |
]; | |
styles.forEach(style => { | |
if (style.pattern.test(url)) { | |
hideElements(style.selectors); | |
} | |
}); | |
} | |
// Apply styles when the document is ready | |
document.addEventListener('DOMContentLoaded', applyStyles); | |
// Apply styles on URL change (Single Page Applications) | |
window.addEventListener('popstate', applyStyles); | |
window.addEventListener('pushState', applyStyles); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment