Adds a script to the dom for use. This allows applications to arbilitary include custom JS and data files AdmoApp.addJavaScript('apps/$appname/data/menu4.js');
770447
function(path){
    var script = document.createElement( 'script' );
    script.type = 'text/javascript';
    script.src = path;
    $("head").append( script );
  }
348874
function setupAddBox() {
  var addBox = document.querySelector('.addRow input');
  addBox.oninput = function() {
    if (addBox.value == '') {
      clearError();
      return;
    }
    fetchAddonManifest(addBox.value);
  };
  function fetchAddonManifest(url) {
    var xhr = new XMLHttpRequest();
    xhr.open('GET', url, true);
    xhr.onerror = function() {
      setError();
    };
    xhr.onload = function() {
      var contentType = xhr.getResponseHeader('content-type') || '';
      if (xhr.status != 200 ||
          contentType.indexOf('/json') == -1) {
        setError();
        return;
      }

      var manifest;
      try {
        manifest = JSON.parse(xhr.responseText);
      } catch (e) {
      }
      if (!manifest) {
        setError();
        return;
      }

      clearError();
      addAddon(url, manifest);
    };
    try {
      xhr.send(null);
    } catch (e) {
      setError();
    }
  };
  function setError() {
    addBox.classList.add('kTextFieldError');
  };
  function clearError() {
    addBox.classList.remove('kTextFieldError');
  };

  function addAddon(url, manifest) {
    _gaq.push(['_trackEvent', 'popup', 'addon_added']);

    addBox.value = '';
    port.postMessage({
      command: 'add_addon',
      url: url,
      manifest: manifest
    });
    port.postMessage({
      command: 'toggle_addon',
      enabled: true,
      url: url
    });
  };
}
518356
@Override
    public JsPage addJs(String jsAsset) {
        return addAssetInternal(jsAsset, "JS", true, JsPage::new, this::addJs);
    }
138658
function MODULENAME_DivHTML( divId, resourceURL, paramObj ) {
	log( "MODULENAME",  "divId="+divId+" resourceURL="+resourceURL );
	if ( moduleConfig[ divId ] != null ) {
		MODULENAME_RenderHTML( divId, resourceURL, paramObj, moduleConfig[ divId ]  );
	} else {

		//TODO: move that to portal-ng.js
		var metaURL =  resourceURL+"/MODULENAME";
    if ( paramObj != null ) {
      if ( paramObj.def != null ) {
        metaURL = resourceURL+"/"+paramObj.def;
      }
		}
		// pass get params of page to module config loader call, to enable dynamic table columns
		if ( paramObj.get != null ) {
			var first = true;
			for (var key in paramObj.get) {
				metaURL += (first ? "?" :"&");
				metaURL += key + "=" + paramObj.get[ key ];
				first = false;
			}
		}

		$.getJSON( 
			resourceURL+"/MODULENAME", 
			function( pmd ) {
				MODULENAME_RenderHTML( divId, resourceURL, paramObj, pmd );
			}
		);					
	}	
}
1292923
def include_javascripts(*packages)
      options = packages.extract_options!
      options.merge!(:extname=>false)
      html_safe packages.map {|pack|
        should_package? ? Jammit.asset_url(pack, :js) : Jammit.packager.individual_urls(pack.to_sym, :js)
      }.flatten.map {|pack|
        "<script src=\"#{pack}\"></script>"
      }.join("\n")
    end
958466
public void addScriptFunction(ScriptPlacement placement, String script)
    {
        assert (script != null) : "The paramter 'script' must not be null";
        IScriptReporter sr = getParentScriptReporter();
        if (sr != null) {
            sr.addScriptFunction(placement, script);
            return;
        }

        // get the list of function blocks and add this script to it.
        if (placement == null || placement == ScriptPlacement.PLACE_INFRAMEWORK) {
            if (_funcBlocks == null) {
                _funcBlocks = new ArrayList/*<String>*/();
            }
            assert (_funcBlocks != null) : "_funcBlocks should not be null";
            _funcBlocks.add(script);
        }
        else if (placement == ScriptPlacement.PLACE_BEFORE) {
            if (_codeBefore == null)
                _codeBefore = new ArrayList/*<String>*/();
            _codeBefore.add(script);
        }
        else if (placement == ScriptPlacement.PLACE_AFTER) {
            if (_codeAfter == null)
                _codeAfter = new ArrayList/*<String>*/();
            _codeAfter.add(script);
        }
        else {
            assert(false) : "unsupported placement:" + placement;
        }
    }
1334793
@CallMethod(pattern = "install/version/script")
    public void addScript(@CallParam(pattern = "install/version/script") final String _code,
                          @CallParam(pattern = "install/version/script", attributeName = "type") final String _type,
                          @CallParam(pattern = "install/version/script", attributeName = "name") final String _name,
                          @CallParam(pattern = "install/version/script", attributeName = "function")
                            final String _function)
    {
        AbstractScript script = null;
        if ("rhino".equalsIgnoreCase(_type)) {
            script = new RhinoScript(_code, _name, _function);
        } else if ("groovy".equalsIgnoreCase(_type)) {
            script = new GroovyScript(_code, _name, _function);
        }
        if (script != null) {
            this.scripts.add(script);
        }
    }
1358240
public void addNewScript(JsAst ast) {
    if (!addNewSourceAst(ast)) {
      return;
    }
    Node emptyScript = new Node(Token.SCRIPT);
    InputId inputId = ast.getInputId();
    emptyScript.setInputId(inputId);
    emptyScript.setStaticSourceFile(
        SourceFile.fromCode(inputId.getIdName(), ""));

    processNewScript(ast, emptyScript);
  }
706507
function(moduleId) {
		var scriptEl = document.createElement('script');
		scriptEl.type = 'text/javascript';
		scriptEl.src = resolveModuleUri(moduleId);

		var useStandard = !!scriptEl.addEventListener,
			timeoutHandle;

		var errorFunc = function() {
			postLoadFunc(false);
		};

		var loadFunc = function() {
			if (useStandard || (scriptEl.readyState == 'complete' || scriptEl.readyState == 'loaded')) {
				postLoadFunc(getModule(moduleId).defined);
			}
		};

		var postLoadFunc = function(loaded) {
			clearTimeout(timeoutHandle);

			if (useStandard) {
				scriptEl.removeEventListener('load', loadFunc, false);
				scriptEl.removeEventListener('error', errorFunc, false);
			}
			else {
				scriptEl.detachEvent('onreadystatechange', loadFunc);
			}

			if (!loaded) {
				var module = getModule(moduleId);
				if (!module.defined) {
					module.defined = module.error = true;
					fireCallbacks();
				}
			}
		};

		if (useStandard) {
			scriptEl.addEventListener('load', loadFunc, false);
			scriptEl.addEventListener('error', errorFunc, false);
		}
		else {
			scriptEl.attachEvent('onreadystatechange', loadFunc);
		}

		timeoutHandle = setTimeout(errorFunc, _timeoutLength);

		head.appendChild(scriptEl);
	}
518251
protected function attachScripts()
    {
        $scripts   = $this->container->make('config')->get('antares/html::form.scripts.client-side');
        $container = $this->container->make('antares.asset')->container($scripts['position']);
        foreach ($scripts['resources'] as $name => $path) {
            $container->add($name, $path);
        }
        return;
    }
364662
function insertScript (url) {
  const script = document.createElement('script')

  script.async = true
  script.src = url

  document.head.appendChild(script)

  return script
}
1020203
def add_jsfile(self, src: str) -> None:
        """"""
        self.body.appendChild(Script(src=src))
731874
public void addJavaScriptValues(Map<String, String> parameterMap) {
        for (Map.Entry<String, String> entry : parameterMap.entrySet()) {
            String parameterName = entry.getKey();
            String parameterValue = entry.getValue();
            this.javascriptExpressions.put(parameterName, parameterValue);
        }
    }
1081434
function injectScriptFile(url, rawText) {
  var filename = url;
  var lastSlash = url.lastIndexOf('/');
  if (lastSlash != -1) {
    filename = url.substr(lastSlash + 1);
  }

  var source = [
    '(function() {' + rawText + '})();',
    '// Web Tracing Framework injected file: ' + url,
    '//# sourceURL=x://wtf-injector/' + filename
  ].join('\n');

  // Setup script tag with the raw source.
  var script = document.createElement('script');
  script.type = 'text/javascript';
  script.text = source;

  // Add to page.
  injectScriptTag(script);
}
804837
function createScript(src, callback) {
  if (!src) return;
  var _callback = callback || function () { }
  var script = document.createElement('script');
  script.setAttribute('src', src);
  // script.setAttribute('charset', sBianMa);
  // script.setAttribute('type', 'text/javascript');
  document.getElementsByTagName('head')[0].appendChild(script);
  // ie browser
  if (/msie/.test(window.navigator.userAgent.toLowerCase())) {
    script.onreadystatechange = function () {
      if (this.readyState == 'loaded' || this.readyState == 'complete') {
        script.parentNode.removeChild(script);
        // if (callback) callback();
        console.log('ie')
        _callback();
      }
    }
  } else if (/gecko/.test(window.navigator.userAgent.toLowerCase()) ||
    /opera/.test(window.navigator.userAgent.toLowerCase())) {
    script.onload = function () {
      script.parentNode.removeChild(script);
      console.log('firefox')
      _callback();
    }
  } else {
    script.parentNode.removeChild(script);
    console.log('other')
    _callback();
  }
}
603776
static void addFeatureToScript(Node scriptNode, Feature feature) {
    checkState(scriptNode.isScript(), scriptNode);
    FeatureSet currentFeatures = getFeatureSetOfScript(scriptNode);
    FeatureSet newFeatures =
        currentFeatures != null
            ? currentFeatures.with(feature)
            : FeatureSet.BARE_MINIMUM.with(feature);
    scriptNode.putProp(Node.FEATURE_SET, newFeatures);
  }
858952
public JavaScriptActionBuilder javascript(String script) {
        JavaScriptAction action = new JavaScriptAction();
        action.setScript(script);
        action(action);
        return new JavaScriptActionBuilder(action);
    }