mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 14:12:10 +08:00
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:
@ -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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user