@Override public ScriptBuilder type(String type) { assertCanAddAttribute().setType(type); return this; } }
script.setType("text/javascript"); script.setId(callbackId); script.setSrc(uri.toString());
@Override public ScriptBuilder type(String type) { assertCanAddAttribute().setType(type); return this; } }
@Override public ScriptBuilder type(String type) { assertCanAddAttribute().setType(type); return this; } }
script.setType("text/javascript"); script.setId(callbackId); script.setSrc(uri.toString());
script.setType("text/javascript"); script.setId(callbackId); script.setSrc(uri.toString());
/** * Ensure respond js script element. */ private void ensureRespondJsScriptElement() { if (this.respondJsScript == null) { this.respondJsScript = Document.get().createScriptElement(); this.respondJsScript.setSrc(GWT.getModuleBaseForStaticFiles() + DefaultIE8ThemeController.RESPOND_JS_LOCATION); this.respondJsScript.setType("text/javascript"); } }
/** * Ensure respond js script element. */ private void ensureRespondJsScriptElement() { if (this.respondJsScript == null) { this.respondJsScript = Document.get().createScriptElement(); this.respondJsScript.setSrc(GWT.getModuleBaseForStaticFiles() + DefaultIE8ThemeController.RESPOND_JS_LOCATION); this.respondJsScript.setType("text/javascript"); } }
public void load(DataReader<D> reader, Object loadConfig, AsyncCallback<D> callback) { this.callback = callback; this.reader = reader; this.config = loadConfig; String transId = "transId" + ID++; String prepend = url.indexOf("?") != -1 ? "&" : "?"; String u = url + prepend + "callback=" + CALLBACK_CONTAINER + "." + transId + generateUrl(loadConfig); createCallback(this, CALLBACK_CONTAINER, transId); ScriptElement script = Document.get().createScriptElement(); script.setId(transId); script.setType("text/javascript"); head.appendChild(script); script.setSrc(u); }
/** * Adds a script element to the DOM that loads the API Loader main script "jsapi". * * @param apiKey * Optional API key value (pass null to omit the key). See * http://code.google.com/apis/ajaxsearch/signup.html * @returns <code>true</code> if the API has already been loaded. Otherwise, * returns <code>false</code>, meaning that the application should * wait for a callback. */ private boolean injectJsApi(String apiKey) { if (alreadyInjected) { return true; } boolean alreadyLoaded = createCallback(this); alreadyInjected = true; if (alreadyLoaded) { return true; } Document doc = Document.get(); String key = (apiKey == null) ? "" : ("key=" + apiKey + "&"); String protocol = (Window.Location.getProtocol().equals("https:")) ? "https:" : "http:"; String src = protocol + "//" + HOSTNAME + "/jsapi?" + key + "callback=__gwt_charts_AjaxLoader_onLoad"; ScriptElement script = doc.createScriptElement(); script.setSrc(src); script.setType("text/javascript"); doc.getBody().appendChild(script); return false; }
private void loadAnalyticsScript() { ScriptElement script = Document.get().createScriptElement(); script.setSrc(GoogleAnalyticsImpl.SCRIPT_URL); script.setType("text/javascript"); script.setAttribute("async", "true"); Element firstScript = Document.get().getElementsByTagName("script").getItem(0); firstScript.getParentNode().insertBefore(script, firstScript); }
/** * Adds a script element to the DOM that loads the Ajax API Loader main script * "jsapi". * * @param apiKey Optional API key value (pass null to omit the key). See * http://code.google.com/apis/ajaxsearch/signup.html * @returns <code>true</code> if the API has already been loaded. Otherwise, * returns <code>false</code>, meaning that the application should * wait for a callback. */ private static boolean injectJsapi(String apiKey, String hostname) { if (alreadyInjected) { return true; } boolean alreadyLoaded = nativeCreateCallback(); alreadyInjected = true; if (alreadyLoaded) { return true; } Document doc = Document.get(); String key = (apiKey == null) ? "" : ("key=" + apiKey + "&"); hostname = (hostname == null) ? "www.google.com" : hostname; String src = getProtocol() + "//" + hostname + "/jsapi?" + key + "callback=__gwt_AjaxLoader_onLoad"; ScriptElement script = doc.createScriptElement(); script.setSrc(src); script.setType("text/javascript"); doc.getBody().appendChild(script); return false; }