ECOD-Demo-Warnings

Warn Users for DEMO envs

Verze ze dne 17. 04. 2024. Zobrazit nejnovější verzi.

// ==UserScript==
// @name         ECOD-Demo-Warnings
// @namespace    ecod.demo.warnings
// @version      1.0.1
// @description  Warn Users for DEMO envs
// @author       CRK

// @match        https://aws-summit-demo.ecodesigncloud.com/*
// @match        https://cluster-dashboard.aws-summit-demo.ecodesigncloud.com/*
// @match        https://deployment.aws-summit-demo.ecodesigncloud.com/*
// @match        https://workflows.aws-summit-demo.ecodesigncloud.com/*
// @match        https://rollouts-dashboard.aws-summit-demo.ecodesigncloud.com/*
// @match        https://apim.aws-summit-demo.ecodesigncloud.com/*
// @match        https://pgadmin.aws-summit-demo.ecodesigncloud.com/*

// @match        https://puig-demo.ecodesigncloud.com/*
// @match        https://deployment.puig-demo.ecodesigncloud.com/*
// @match        https://rollouts-dashboard.puig-demo.ecodesigncloud.com/*
// @match        https://pgadmin.puig-demo.ecodesigncloud.com/*
// @match        https://cluster-dashboard.puig-demo.ecodesigncloud.com/*
// @match        https://workflows.puig-demo.ecodesigncloud.com/*
// @match        https://apim.puig-demo.ecodesigncloud.com/console/*

// @match        https://apim.loreal-demo.ecodesigncloud.com/console/*
// @match        https://workflows.loreal-demo.ecodesigncloud.com/*
// @match        https://cluster-dashboard.loreal-demo.ecodesigncloud.com/*
// @match        https://loreal-demo.ecodesigncloud.com/*
// @match        https://pgadmin.loreal-demo.ecodesigncloud.com/*
// @match        https://rollouts-dashboard.loreal-demo.ecodesigncloud.com/*
// @match        https://deployment.loreal-demo.ecodesigncloud.com/*
// @match        https://demo.retailecoscore.net/*

// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';
    // Function to create and append the live text
    function createLiveText() {
        var liveText = document.createElement('div');
        liveText.innerHTML = 'DEMO';
        liveText.style.position = 'fixed';
        liveText.style.padding = '3px';
        liveText.style.top = '0';
        liveText.style.left = '0';
        liveText.style.color = 'white';
        liveText.style.backgroundColor = 'magenta';
        liveText.style.fontSize = '40px';
        liveText.style.fontFamily = 'Arial';
        liveText.style.fontWeight = 'bold';
        liveText.style.zIndex = '9999'; // Make sure it's always on top
        document.documentElement.appendChild(liveText);
    }

    // Initial creation of the live text
    createLiveText();

    // Function to reapply live text after AJAX updates
    function reapplyLiveText() {
        var liveText = document.querySelector('#liveText');
        if (!liveText) {
            createLiveText();
        }
    }

    // Create a MutationObserver to detect changes in the DOM
    var observer = new MutationObserver(function(mutations) {
        mutations.forEach(function(mutation) {
            reapplyLiveText();
        });
    });

    // Configuration of the MutationObserver
    var config = { attributes: true, childList: true, subtree: true };

    // Start observing the document
    observer.observe(document.body, config);
})();