FEATURE: Allow selection of highlight js languages

PERF: stop loading highlight js on load

To get latest highlight js run bin/rake highlightjs:update
This commit is contained in:
Sam
2015-03-13 16:15:13 +11:00
parent 1e339ad527
commit a82530012a
137 changed files with 277 additions and 26 deletions

View File

@ -31,13 +31,19 @@ export default function loadScript(url, opts) {
resolve();
};
var cdnUrl = url;
if (Discourse.CDN && url[0] === "/") {
cdnUrl = Discourse.CDN + url;
}
// Some javascript depends on the path of where it is loaded (ace editor)
// to dynamically load more JS. In that case, add the `scriptTag: true`
// option.
if (opts.scriptTag) {
loadWithTag(url, cb);
loadWithTag(cdnUrl, cb);
} else {
$.getScript(url).then(cb);
$.getScript(cdnUrl).then(cb);
}
});
}