text: $(document).ready(function ()
  {      
      $("#toolbar-window .minimize").click(function()
      {
         window.minimize();   
      });
      
      $("#toolbar-window .maximize").click(function()
      {
         window.maximize();   
      });
      
      $("#toolbar-window .close").click(function()
      {
         window.close();   
      });
      
      $("#upgrade").click(function()
      {
          location.reload();
      });
      
      $(document).on("upgrade", function (evt, version)
      {
          $("#upgrade").show();
          $("#draggable-window").hide();
          $("#upgrade").find("span").html(version);
      });
  });  
    
  function round(value, numDec)
  {
      var dec = Math.pow(10, numDec);
      return Math.round(value * dec) / dec;
  }
  
  function setAppVersion(version)
  {
      var li = $("<li/>", {class: "mdl-menu__item", onclick: "window.open('https://github.com/lurume84/bling-desktop', '_blank')", html: "<i class=\"fas fa-desktop\"></i>&nbsp;Desktop " + version})
      li.appendTo($("#moremenu"));
  }
  
  function base64Encode(str)
  {
      var CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
      var out = "", i = 0, len = str.length, c1, c2, c3;
      while (i < len) {
          c1 = str.charCodeAt(i++) & 0xff;
          if (i == len) {
              out += CHARS.charAt(c1 >> 2);
              out += CHARS.charAt((c1 & 0x3) << 4);
              out += "==";
              break;
          }
          c2 = str.charCodeAt(i++);
          if (i == len) {
              out += CHARS.charAt(c1 >> 2);
              out += CHARS.charAt(((c1 & 0x3)<< 4) | ((c2 & 0xF0) >> 4));
              out += CHARS.charAt((c2 & 0xF) << 2);
              out += "=";
              break;
          }
          c3 = str.charCodeAt(i++);
          out += CHARS.charAt(c1 >> 2);
          out += CHARS.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4));
          out += CHARS.charAt(((c2 & 0xF) << 2) | ((c3 & 0xC0) >> 6));
          out += CHARS.charAt(c3 & 0x3F);
      }
      return out;
  }
  
  function generate_uid(length)
  {
      //edit the token allowed characters
      var a = "abcdef1234567890".split("");
      var b = [];  
      for (var i=0; i<length; i++) {
          var j = (Math.random() * (a.length-1)).toFixed(0);
          b[i] = a[j];
      }
      return b.join("");
  }