Plint change header between testing and production

Plint header color based on development

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey, Greasemonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

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

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

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         Plint change header between testing and production
// @description  Plint header color based on development
// @namespace    http://tampermonkey.net/
// @license      MIT
// @version      0.1
// @author       Paul Egell-Johnsen
// @match        https://*.plint.dev/*
// @match        https://*.plint.app/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=plint.dev
// @grant        GM_addStyle
// ==/UserScript==

(function() {
    'use strict';
    const mainNavbar = document.getElementById('main-navbar');
    const div = document.createElement('div');
    div.style.setProperty('font-size','2em');

    if (location.href.match(/nrk-1-core.test.plint.dev/gi)) {
        div.innerText = 'Testing';

        GM_addStyle ( `
      #main-navbar {
          background-color: #66ff66;
      }
    ` );

    }

    if (location.href.match(/nrk.plint.app/gi)) {
        div.innerText = 'Production';
        GM_addStyle ( `
      #main-navbar {
          background-color: #ff6666;
      }
    ` );
    }
    mainNavbar.appendChild( div );

})();