raw/angular-dynamic-locale/tmhDynamicLocale.js
function loadScript(url, callback, errorCallback, $timeout) {
    var script = document.createElement('script'),
      body = document.getElementsByTagName('body')[0],
      removed = false;

    script.type = 'text/javascript';
    if (script.readyState) { // IE
      script.onreadystatechange = function () {
        if (script.readyState === 'complete' ||
            script.readyState === 'loaded') {
          script.onreadystatechange = null;
          $timeout(
            function () {
              if (removed) return;
              removed = true;
              body.removeChild(script);
              callback();
            }, 30, false);
        }
      };
    } else { // Others
      script.onload = function () {
        if (removed) return;
        removed = true;
        body.removeChild(script);
        callback();
      };
      script.onerror = function () {
        if (removed) return;
        removed = true;
        body.removeChild(script);
        errorCallback();
      };
    }
    script.src = url;
    script.async = false;
    body.appendChild(script);
  }
function loadScript(url, callback, errorCallback, $timeout) {
    var script = document.createElement('script'),
      body = document.getElementsByTagName('body')[0],
      removed = false;

    script.type = 'text/javascript';
    if (script.readyState) { // IE
      script.onreadystatechange = function () {
        if (script.readyState === 'complete' ||
            script.readyState === 'loaded') {
          script.onreadystatechange = null;
          $timeout(
            function () {
              if (removed) return;
              removed = true;
              body.removeChild(script);
              callback();
            }, 30, false);
        }
      };
    } else { // Others
      script.onload = function () {
        if (removed) return;
        removed = true;
        body.removeChild(script);
        callback();
      };
      script.onerror = function () {
        if (removed) return;
        removed = true;
        body.removeChild(script);
        errorCallback();
      };
    }
    script.src = url;
    script.async = false;
    body.appendChild(script);
  }
function loadScript ( url , callback , errorCallback , $timeout ) { var script = document . createElement ( 'script' ) , body = document . getElementsByTagName ( 'body' ) [ 0 ] , removed = false ; script . type = 'text/javascript' ; if ( script . readyState ) { // IE script . onreadystatechange = function ( ) { if ( script . readyState === 'complete' || script . readyState === 'loaded' ) { script . onreadystatechange = null ; $timeout ( function ( ) { if ( removed ) return ; removed = true ; body . removeChild ( script ) ; callback ( ) ; } , 30 , false ) ; } } ; } else { // Others script . onload = function ( ) { if ( removed ) return ; removed = true ; body . removeChild ( script ) ; callback ( ) ; } ; script . onerror = function ( ) { if ( removed ) return ; removed = true ; body . removeChild ( script ) ; errorCallback ( ) ; } ; } script . src = url ; script . async = false ; body . appendChild ( script ) ; }
Loads a script asynchronously

@param {string} url The url for the script
@ @param {function) callback A function to be called once the script is loaded
Loads a script asynchronously