mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-11 09:31:01 +01:00
Add new advanced setting: uiStyles
Default to `unset`. To allow users to bypass uBO's default CSS styles in case they are causing issues to specific users. It is the responsibility of the user to ensure the value of `uiStyles` contains valid CSS property declarations. uBO will assign the value to `document.body.style.cssText`. Related issue: - https://github.com/uBlockOrigin/uBlock-issues/issues/1044 For example, in the case of the issue above, one could set `uiStyles` to `font-family: sans-serif` to force uBO to the system font for its user interface.
This commit is contained in:
parent
5229e0c810
commit
9f7e5b621d
4 changed files with 12 additions and 1 deletions
|
@ -8,7 +8,6 @@ body > div.body {
|
|||
}
|
||||
h2, h3 {
|
||||
margin: 1em 0;
|
||||
font-family: sans-serif;
|
||||
}
|
||||
h2 {
|
||||
font-size: 18px;
|
||||
|
|
|
@ -74,6 +74,7 @@ const µBlock = (( ) => { // jshint ignore:line
|
|||
suspendTabsUntilReady: 'unset',
|
||||
uiPopupConfig: 'undocumented',
|
||||
uiFlavor: 'unset',
|
||||
uiStyles: 'unset',
|
||||
updateAssetBypassBrowserCache: false,
|
||||
userResourcesLocation: 'unset',
|
||||
};
|
||||
|
|
|
@ -159,6 +159,10 @@ const onMessage = function(request, sender, callback) {
|
|||
µb.toggleHostnameSwitch(request);
|
||||
break;
|
||||
|
||||
case 'uiStyles':
|
||||
response = µb.hiddenSettings.uiStyles;
|
||||
break;
|
||||
|
||||
case 'userSettings':
|
||||
response = µb.changeUserSettings(request.name, request.value);
|
||||
break;
|
||||
|
|
|
@ -105,6 +105,13 @@ DOMListFactory.nodeFromSelector = function(selector) {
|
|||
if ( window.matchMedia('(prefers-color-scheme: dark)').matches ) {
|
||||
root.classList.add('dark');
|
||||
}
|
||||
|
||||
// https://github.com/uBlockOrigin/uBlock-issues/issues/1044
|
||||
// Offer the possibility to bypass uBO's default styling
|
||||
vAPI.messaging.send('uDom', { what: 'uiStyles' }).then(response => {
|
||||
if ( typeof response !== 'string' || response === 'unset' ) { return; }
|
||||
document.body.style.cssText = response;
|
||||
});
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
|
Loading…
Reference in a new issue