diff --git a/demos/code/code.js b/demos/code/code.js
index df3d640db..8ad4d1667 100644
--- a/demos/code/code.js
+++ b/demos/code/code.js
@@ -200,14 +200,8 @@ Code.bindClick = function(el, func) {
* Load the Prettify CSS and JavaScript.
*/
Code.importPrettify = function() {
- //
- //
- var link = document.createElement('link');
- link.setAttribute('rel', 'stylesheet');
- link.setAttribute('href', '../prettify.css');
- document.head.appendChild(link);
var script = document.createElement('script');
- script.setAttribute('src', '../prettify.js');
+ script.setAttribute('src', 'https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js');
document.head.appendChild(script);
};
@@ -313,41 +307,41 @@ Code.renderContent = function() {
} else if (content.id == 'content_javascript') {
var code = Blockly.JavaScript.workspaceToCode(Code.workspace);
content.textContent = code;
- if (typeof prettyPrintOne == 'function') {
+ if (typeof PR.prettyPrintOne == 'function') {
code = content.textContent;
- code = prettyPrintOne(code, 'js');
+ code = PR.prettyPrintOne(code, 'js');
content.innerHTML = code;
}
} else if (content.id == 'content_python') {
code = Blockly.Python.workspaceToCode(Code.workspace);
content.textContent = code;
- if (typeof prettyPrintOne == 'function') {
+ if (typeof PR.prettyPrintOne == 'function') {
code = content.textContent;
- code = prettyPrintOne(code, 'py');
+ code = PR.prettyPrintOne(code, 'py');
content.innerHTML = code;
}
} else if (content.id == 'content_php') {
code = Blockly.PHP.workspaceToCode(Code.workspace);
content.textContent = code;
- if (typeof prettyPrintOne == 'function') {
+ if (typeof PR.prettyPrintOne == 'function') {
code = content.textContent;
- code = prettyPrintOne(code, 'php');
+ code = PR.prettyPrintOne(code, 'php');
content.innerHTML = code;
}
} else if (content.id == 'content_dart') {
code = Blockly.Dart.workspaceToCode(Code.workspace);
content.textContent = code;
- if (typeof prettyPrintOne == 'function') {
+ if (typeof PR.prettyPrintOne == 'function') {
code = content.textContent;
- code = prettyPrintOne(code, 'dart');
+ code = PR.prettyPrintOne(code, 'dart');
content.innerHTML = code;
}
} else if (content.id == 'content_lua') {
code = Blockly.Lua.workspaceToCode(Code.workspace);
content.textContent = code;
- if (typeof prettyPrintOne == 'function') {
+ if (typeof PR.prettyPrintOne == 'function') {
code = content.textContent;
- code = prettyPrintOne(code, 'lua');
+ code = PR.prettyPrintOne(code, 'lua');
content.innerHTML = code;
}
}