added jquery to live-coder iframes

This commit is contained in:
Mark Moser 2016-08-03 15:22:54 -05:00
parent 330126d672
commit 7e13ed59a8

View File

@ -14,19 +14,24 @@ function updateResults(elem) {
codeFrame.setAttribute("height", "100%");
resultsContainer.appendChild(codeFrame);
var jqueryNode = document.createElement("script");
jqueryNode.setAttribute("type", "text/javascript");
jqueryNode.setAttribute("src", "<%= "//#{ENV['full_app_url']}#{javascript_path "jquery"}" %>");
iHead.appendChild(jqueryNode);
var codeStyle = document.createElement("style");
codeStyle.setAttribute("type", "text/css");
var rulesNode = document.createTextNode(codeCss);
codeStyle.appendChild(rulesNode);
iHead.appendChild(codeStyle);
iDoc.appendChild(iHead);
iDoc.appendChild(iHead);
iBody.innerHTML = codeHtml;
iDoc.appendChild(iBody);
var codeScript = document.createElement("script");
codeScript.setAttribute("type", "text/javascript");
var scriptNode = document.createTextNode(codeJs);
var scriptNode = document.createTextNode("setTimeout(function(){ " + codeJs + "}, 800);");
codeScript.appendChild(scriptNode);
iDoc.appendChild(codeScript);