/*
(non-Javadoc)

@see
net.jawr.web.resource.bundle.locale.message.MessageBundleScriptCreator
#createScript(java.nio.charset.Charset)
762922
public Reader createScript(Charset charset) {

		// Determine wether this is run-app or run-war style of runtime.
		boolean warDeployed = ((Boolean) this.servletContext
				.getAttribute(JawrGrailsConstant.GRAILS_WAR_DEPLOYED))
				.booleanValue();

		// Spring message bundle object, the same used by grails.
		GrailsBundleMessageSource messageSource = new GrailsBundleMessageSource(
				warDeployed);
		
		messageSource.setFallbackToSystemLocale(control.isFallbackToSystemLocale());
		messageSource.setFilters(filterList);

		if (warDeployed) {
			messageSource.setResourceLoader(new ServletContextResourceLoader(
					this.servletContext));

		}
		messageSource.setBasenames(getBaseNames(warDeployed));

		Properties props = messageSource.getAllMessages(locale);
		return doCreateScript(props);
	}
333548
private TagScript createTagScript(QName n, Map<?, ?> attributes) throws JellyException {
        TagLibrary lib = context.getTagLibrary(n.getNamespaceURI());
        if(lib!=null) {
            String localName = n.getLocalPart();

            TagScript tagScript = lib.createTagScript(localName, null/*this parameter appears to be unused.*/);
            if (tagScript==null)    tagScript = lib.createTagScript(localName.replace('_','-'), null);

            if (tagScript!=null) {
                if (attributes != null) {
                    for (Entry e : attributes.entrySet()) {
                        Object v = e.getValue();
                        if (v!=null)
                            tagScript.addAttribute(e.getKey().toString(), new ConstantExpression(v));
                    }
                }

                return tagScript;
            }
        }

        // otherwise treat it as a literal.
        return null;
    }
501948
public Script build(File f) throws ScriptBuilderException {
        int k = f.getAbsolutePath().hashCode();
        if (dates.containsKey(k) && dates.get(k) == f.lastModified() && cache.containsKey(f.getPath())) {
            LOGGER.debug("get '" + f.getName() + "' from the cache");
            return cache.get(f.getPath());
        }

        LOGGER.debug(f.getName() + " is built from the file");
        dates.put(k, f.lastModified());
        String name = f.getName();
        try {
            Script v = build(new ANTLRFileStream(f.getAbsolutePath()));
            if (!name.equals(v.getlocalName() + Script.EXTENSION)) {
                throw new ScriptBuilderException("Script '" + v.getlocalName()
                        + "' must be declared in a file named '" + v.getlocalName() + Script.EXTENSION);
            }
            cache.put(f.getPath(), v);
            return v;
        } catch (IOException e) {
            throw new ScriptBuilderException(e.getMessage(), e);
        }

    }
70838
function createJSScript(id, src, cb) {
  var headElement = document.getElementsByTagName("head")[0];

  var scripter = document.createElement('script');
  scripter.setAttribute("type", 'text/javascript');
  scripter.setAttribute("id", id);
  if (src.indexOf('http') === 0 || src.indexOf('/') === 0) {
    scripter.onload = scripter.onreadystatechange = function () {
      if (!this.readyState || this.readyState == 'loaded' || this.readyState == 'complete') {
        ImmitSax.data[id] = 'finish'
        setTimeout(function(){
          ImmitSax.roll(id)
          ImmitSax.off(id)
        }, 200);
      }
    }
    // if (src.lastIndexOf('.js')==-1) src += '.js'
    scripter.setAttribute("src", src);
    headElement.appendChild(scripter);
  }
  else {
    scripter.appendChild(document.createTextNode(src))
    headElement.appendChild(scripter);
    ImmitSax.data[id] = 'finish'
    ImmitSax.roll(id)
    ImmitSax.off(id)
  }
}
192784
protected MessageFormat createMessageFormat(String msg, Locale locale) {
        return new MessageFormat((msg != null ? msg : ""), locale);
    }
220975
function (msg) {
            if (this.utilsType.isObject(msg)) {
                this.message = msg;
                this.localized_message = msg.localizedMessage;
            } else if (this.utilsType.isString(msg)) {
                this.localized_message = msg;
                this.message = ariaUtilsData.createMessage(msg);
            }
        }
1135739
public FilePath createScriptFile(@Nonnull FilePath dir) throws IOException, InterruptedException {
        return dir.createTextTempFile("jenkins", getFileExtension(), getContents(), false);
    }
1052338
function createScript(url,cb)
    {
      var sc = document.createElement('script');
      sc.src = url;
      sc.onerror = function()
      {
        cb(null,true);
      }
      sc.onload = function()
      {
        cb(_config);
      }
      document.head.stopChange().appendChild(sc);
    }
1108119
public static Script createInputScript(@Nullable TransactionSignature signature, ECKey pubKey) {
        byte[] pubkeyBytes = pubKey.getPubKey();
        byte[] sigBytes = signature != null ? signature.encodeToBitcoin() : new byte[]{};
        return new ScriptBuilder().data(sigBytes).data(pubkeyBytes).build();
    }
44023
public void eInit(SarlScript script, String name, IJvmTypeProvider context) {
		setTypeResolutionContext(context);
		if (this.sarlInterface == null) {
			this.container = script;
			this.sarlInterface = SarlFactory.eINSTANCE.createSarlInterface();
			script.getXtendTypes().add(this.sarlInterface);
			this.sarlInterface.setAnnotationInfo(XtendFactory.eINSTANCE.createXtendTypeDeclaration());
			if (!Strings.isEmpty(name)) {
				this.sarlInterface.setName(name);
			}
		}
	}
93124
@Override
    public void setMessage(HttpMessage msg) {
	try {
            if (script != null) {
                script.parseParameters(this, msg);
            }
            
        } catch (Exception e) {
            // Catch Exception instead of ScriptException because script engine implementations might
            // throw other exceptions on script errors (e.g. jdk.nashorn.internal.runtime.ECMAException)
            extension.handleScriptException(wrapper, e);
        }
    }
1070287
protected void _generate(SarlScript script, IExtraLanguageGeneratorContext context) {
		if (script != null) {
			for (final XtendTypeDeclaration content : script.getXtendTypes()) {
				if (context.getCancelIndicator().isCanceled()) {
					return;
				}
				try {
					generate(content, context);
				} finally {
					context.clearData();
				}
			}
		}
	}
1248137
public void eInit(SarlScript script, String name, IJvmTypeProvider context) {
		setTypeResolutionContext(context);
		if (this.sarlEvent == null) {
			this.sarlEvent = SarlFactory.eINSTANCE.createSarlEvent();
			script.getXtendTypes().add(this.sarlEvent);
			this.sarlEvent.setAnnotationInfo(XtendFactory.eINSTANCE.createXtendTypeDeclaration());
			if (!Strings.isEmpty(name)) {
				this.sarlEvent.setName(name);
			}
		}
	}
714301
static InterpretedFunction createScript(InterpreterData idata,
                                            Object staticSecurityDomain)
    {
        InterpretedFunction f;
        f = new InterpretedFunction(idata, staticSecurityDomain);
        return f;
    }
1152584
@Override
  public ScriptElement createScriptElement(Document doc, String source) {
    ScriptElement elem = (ScriptElement) createElement(doc, "script");
    elem.setInnerText(source);
    return elem;
  }
116531
public static void writeScriptBlock(ServletRequest req, AbstractRenderAppender results, String script)
    {
        assert(results != null);
        ScriptTag.State state = new ScriptTag.State();
        state.suppressComments = false;
        ScriptTag br = (ScriptTag) TagRenderingBase.Factory.getRendering(TagRenderingBase.SCRIPT_TAG, req);

        results.append("\n");
        br.doStartTag(results, state);
        results.append(script);
        br.doEndTag(results, false);
        results.append("\n");
    }
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();
  }
}