use of com.google.gwt.dom.client.HeadElement in project rstudio by rstudio.
the class MathJaxLoader method ensureMathJaxLoaded.
public static void ensureMathJaxLoaded() {
if (MATHJAX_LOADED)
return;
initializeMathJaxConfig();
ScriptElement mathJaxEl = createMathJaxScriptElement();
HeadElement headEl = Document.get().getHead();
headEl.appendChild(mathJaxEl);
Scheduler.get().scheduleFixedDelay(new RepeatingCommand() {
@Override
public boolean execute() {
if (isMathJaxReady()) {
MATHJAX_LOADED = true;
for (Callback callback : MATHJAX_CALLBACKS) callback.onLoaded(false);
onMathJaxLoaded();
return false;
}
RETRY_COUNT++;
return RETRY_COUNT < 50;
}
}, 500);
}
use of com.google.gwt.dom.client.HeadElement in project rstudio by rstudio.
the class DiffMatchPatch method injectJavascript.
private static void injectJavascript(String source) {
Document doc = Document.get();
HeadElement head = (HeadElement) doc.getElementsByTagName("head").getItem(0);
if (head == null) {
head = doc.createHeadElement();
doc.insertBefore(head, doc.getBody());
}
ScriptElement script = doc.createScriptElement(source);
script.setType("text/javascript");
head.appendChild(script);
}
Aggregations