String.prototype.substr() is deprecated so we replace it with String.prototype.slice() which works similarily but isn't deprecated. Signed-off-by: Tobias Speicher <rootcommander@gmail.com> Co-authored-by: Jarek Radosz <jradosz@gmail.com>
32 lines
990 B
JavaScript
32 lines
990 B
JavaScript
(function () {
|
|
if (window.unsupportedBrowser) {
|
|
throw "Unsupported browser detected";
|
|
}
|
|
|
|
// TODO: Remove this and have resolver find the templates
|
|
const prefix = "discourse/templates/";
|
|
const adminPrefix = "admin/templates/";
|
|
let len = prefix.length;
|
|
Object.keys(requirejs.entries).forEach(function (key) {
|
|
if (key.indexOf(prefix) === 0) {
|
|
Ember.TEMPLATES[key.slice(len)] = require(key).default;
|
|
} else if (key.indexOf(adminPrefix) === 0) {
|
|
Ember.TEMPLATES[key] = require(key).default;
|
|
}
|
|
});
|
|
|
|
window.__widget_helpers = require("discourse-widget-hbs/helpers").default;
|
|
|
|
// TODO: Eliminate this global
|
|
window.virtualDom = require("virtual-dom");
|
|
|
|
let element = document.querySelector(
|
|
`meta[name="discourse/config/environment"]`
|
|
);
|
|
const config = JSON.parse(
|
|
decodeURIComponent(element.getAttribute("content"))
|
|
);
|
|
const event = new CustomEvent("discourse-booted", { detail: config });
|
|
document.dispatchEvent(event);
|
|
})();
|