Add Background to Body

Adds a white background to the page if it doesn't have one specified. This can help if you have a transparency in your browser (e.g. Zen Browser)

Ekde 2025/02/03. Vidu La ĝisdata versio.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

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.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Add Background to Body
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Adds a white background to the page if it doesn't have one specified. This can help if you have a transparency in your browser (e.g. Zen Browser)
// @author       Maniac
// @match        *://*/*
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    window.addEventListener('load', function() {
        const bodyStyle = window.getComputedStyle(document.body);

        if (!bodyStyle.backgroundImage && !bodyStyle.background && bodyStyle.backgroundImage === 'none' || bodyStyle.backgroundColor === 'rgba(0, 0, 0, 0)') {
            document.body.style.backgroundColor = "#ffffff"; // Set background to white
        }
    });
})();