Alexander_O / Fasolit widget ( Stock Quantity )

// ==UserScript==
// @name         Fasolit widget ( Stock Quantity )
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Fasolit widget for Stock management!
// @copyright    2021, Alexander_O (https://openuserjs.org/users/Alexander_O)
// @license      MIT
// @match        https://office.bexio.com/*
// @match        https://fasolit.dev.optimalsolutionshub.net/*
// @grant        none
// ==/UserScript==

//  ==OpenUserJs==
// @author Alexander Osinskii ( https://github.com/Ozea )
//  ==/OpenUserJs==

(function () {
  'use strict';

  function init() {
    var preactWrapper = document.createElement('div');
    var styleLink = document.createElement('link');
    var scriptElement = document.createElement("script");
    var bodyElement = document.querySelector('html.js.flexbox.flexboxlegacy > body');

    scriptElement.src = "https://optimal-solutions-hub.github.io/fasolit-widget-build/build/index.js";
    preactWrapper.id = "f-root";

    styleLink.rel = "stylesheet";
    styleLink.type = "text/css";
    styleLink.href = "https://optimal-solutions-hub.github.io/fasolit-widget-build/build/index.css";

    if (bodyElement) {
        document.head.appendChild(styleLink);
        bodyElement.appendChild(scriptElement);
        bodyElement.appendChild(preactWrapper);
    }
  }

  init();
})();