()
| 107 | } |
| 108 | |
| 109 | var init = function () { |
| 110 | if (app) { return } |
| 111 | if (!(window.userObject != null ? window.userObject._id : undefined)) { |
| 112 | const options = { cache: false } |
| 113 | options.data = _.pick(utils.getQueryVariables(), 'preferredLanguage') |
| 114 | $.ajax('/auth/whoami', options).then(function (res) { |
| 115 | window.userObject = res |
| 116 | return init() |
| 117 | }) |
| 118 | return |
| 119 | } |
| 120 | |
| 121 | marked.setOptions({ gfm: true, sanitize: true, smartLists: true, breaks: false }) |
| 122 | app = require('core/application') |
| 123 | setupConsoleLogging() |
| 124 | watchForErrors() |
| 125 | setUpIOSLogging() |
| 126 | const path = document.location.pathname |
| 127 | app.testing = _.string.startsWith(path, '/test') |
| 128 | app.demoing = _.string.startsWith(path, '/demo') |
| 129 | setUpBackboneMediator(app) |
| 130 | app.initialize() |
| 131 | if (!app.isProduction()) { loadOfflineFonts() } |
| 132 | if (utils.isCodeCombat) { |
| 133 | // We always want to load this font. |
| 134 | $('head').prepend('<link rel="stylesheet" type="text/css" href="/fonts/vt323.css">') |
| 135 | } |
| 136 | Backbone.history.start({ pushState: true }) |
| 137 | handleNormalUrls() |
| 138 | setUpMoment() // Set up i18n for moment |
| 139 | setUpTv4() |
| 140 | installVueI18n() |
| 141 | if (utils.isOzaria) { |
| 142 | checkAndLogBrowserCrash() |
| 143 | checkAndRegisterHocModalInterval() |
| 144 | } |
| 145 | if (me.isAdmin() || !app.isProduction() || (typeof serverSession !== 'undefined' && serverSession !== null ? serverSession.amActually : undefined) || (typeof serverSession !== 'undefined' && serverSession !== null ? serverSession.switchingUserActualId : undefined)) { window.globalVar = globalVar } |
| 146 | if (self !== parent) { return parent.globalVar = globalVar } |
| 147 | } |
| 148 | |
| 149 | module.exports.init = init |
| 150 |
no test coverage detected