JSFiddle - React, Tailwind, and code Playground

by shamaleyte

HTML

<pre id="output"></pre>

JavaScript

(function(){

  var AWS_URL = "https://j3v6q1h131.execute-api.us-east-1.amazonaws.com/default/0/g2";
  var encrypted_token = "";
  var vid = ""; // to be used for option B
  var dfd_b = "";

  var loadJSLibs = function(libs, onComplete){
    var self = this;

    function loadJavaScript(src, onLoaded){
      var fastMode = !!window._hsumFastLoadingMode;
      var element = document.createElement( 'script' );
      element.type = 'text/javascript';
      if (fastMode || !document.body) {
        var x = document.getElementsByTagName('script')[0];
        x.parentNode.insertBefore(element, x);
      } else {
        document.body.appendChild(element);
      }
      if (fastMode) {
        element.async = true;
      }

      var scriptLoaded = false;
      element.onreadystatechange = function () {
        if (this.readyState == 'loaded' || this.readyState == 'complete') {
          if(!scriptLoaded){
            scriptLoaded = true;
            setTimeout(onLoaded, 0);
          }
        }
      };
      element.onload = function () {
        if(!scriptLoaded){
          scriptLoaded = true;
          setTimeout(onLoaded, 0);

        }
      };
      element.src = src;
    }

    var loadedCounter = 0;
    for(var i = 0; i < libs.length; i++){
      var scriptUrl = libs[i].indexOf('/') === 0 ? self.assetsUrl + libs[i] : libs[i];
      loadJavaScript(scriptUrl, function(){
        loadedCounter++;
        if(loadedCounter == libs.length){
          onComplete();
        }
      });
    }
  };

 if(typeof jQuery=='undefined' && typeof Cookies == 'undefined'){
 console.log("none of the libs are available - load both");
 	loadJSLibs(["https://code.jquery.com/jquery-3.3.1.min.js", "https://cdn.jsdelivr.net/npm/js-cookie@2/src/js.cookie.min.js"], onJqueryLoader);
  
  }
  else if(typeof jQuery=='undefined') {
  console.log("jQuery lib. is missing. Load it");
    loadJSLibs(["https://code.jquery.com/jquery-3.3.1.min.js"], onJqueryLoader);
  }
  else if(typeof Cookies...