widget.js
/** Helper function to load external scripts */
Helper function to load external scripts
Helper function to load external scripts
function loadScript(src, onLoad, onError) {
    var script_tag = document.createElement('script');
        script_tag.setAttribute('type', 'text/javascript');
        script_tag.setAttribute('src', src);
    if (script_tag.readyState) {
      script_tag.onreadystatechange = function () {
        if (this.readyState == 'complete' || this.readyState == 'loaded') {
          onLoad();
        }
      };
    } else {
      script_tag.onload = onLoad;
    }
    if (typeof onError === 'function') {
      script_tag.onerror = onError;
    }
    (document.getElementsByTagName('head')[0] || document.documentElement).appendChild(script_tag);
  }
function loadScript ( src , onLoad , onError ) { var script_tag = document . createElement ( 'script' ) ; script_tag . setAttribute ( 'type' , 'text/javascript' ) ; script_tag . setAttribute ( 'src' , src ) ; if ( script_tag . readyState ) { script_tag . onreadystatechange = function ( ) { if ( this . readyState == 'complete' || this . readyState == 'loaded' ) { onLoad ( ) ; } } ; } else { script_tag . onload = onLoad ; } if ( typeof onError === 'function' ) { script_tag . onerror = onError ; } ( document . getElementsByTagName ( 'head' ) [ 0 ] || document . documentElement ) . appendChild ( script_tag ) ; }
Helper function to load external scripts
Helper function to load external scripts
// append loaded script to head