mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 13:18:33 +08:00
8b2a379e4e
`.js.no-module.es6` files will be transpiled without producing a module. import/export statements are deliberately not supported, so one would still need to use `const module = require('moduleName').default.`
43 lines
1.4 KiB
JavaScript
43 lines
1.4 KiB
JavaScript
(function() {
|
|
var ps = require("preload-store").default;
|
|
var preloadedDataElement = document.getElementById("data-preloaded");
|
|
|
|
if (preloadedDataElement) {
|
|
var preloaded = JSON.parse(preloadedDataElement.dataset.preloaded);
|
|
|
|
Object.keys(preloaded).forEach(function(key) {
|
|
ps.store(key, JSON.parse(preloaded[key]));
|
|
});
|
|
}
|
|
|
|
var setupData = document.getElementById("data-discourse-setup").dataset;
|
|
|
|
Discourse.CDN = setupData.cdn;
|
|
Discourse.BaseUrl = setupData.baseUrl;
|
|
Discourse.BaseUri = setupData.baseUri;
|
|
Discourse.Environment = setupData.environment;
|
|
Discourse.SiteSettings = ps.get("siteSettings");
|
|
Discourse.ThemeSettings = ps.get("themeSettings");
|
|
Discourse.LetterAvatarVersion = setupData.letterAvatarVersion;
|
|
Discourse.MarkdownItURL = setupData.markdownItUrl;
|
|
Discourse.ServiceWorkerURL = setupData.serviceWorkerUrl;
|
|
I18n.defaultLocale = setupData.defaultLocale;
|
|
Discourse.start();
|
|
Discourse.set("assetVersion", setupData.assetVersion);
|
|
Discourse.Session.currentProp(
|
|
"disableCustomCSS",
|
|
setupData.disableCustomCss === "true"
|
|
);
|
|
|
|
if (setupData.safeMode) {
|
|
Discourse.Session.currentProp("safe_mode", setupData.safeMode);
|
|
}
|
|
|
|
Discourse.HighlightJSPath = setupData.highlightJsPath;
|
|
|
|
if (setupData.s3BaseUrl) {
|
|
Discourse.S3CDN = setupData.s3Cdn;
|
|
Discourse.S3BaseUrl = setupData.s3BaseUrl;
|
|
}
|
|
})();
|