// Load #1, load as little as possible because we are in a race to get the loading screen up. define([ '/bower_components/nthen/index.js', '/api/config', '/common/requireconfig.js', '/customize/messages.js', 'jquery', ], function (nThen, ApiConfig, RequireConfig, Messages, $) { var common = {}; var embeddableApps = [ //'calendar', 'code', //'doc', // XXX // 'drive', // XXX //'file', // doesn't suggest iframes 'form', 'kanban', 'pad', // 'poll', // XXX //'presentation', // XXX // 'sheet', // XXX 'slide', //'teams', // XXX 'whiteboard', ].map(function (x) { return `/${x}/`; // XXX intentionally break IE or anything that doesn't support template literals }); common.initIframe = function (waitFor, isRt, pathname) { if (window.top !== window) { if (ApiConfig.disableEmbedding) { return void window.alert(`This CryptPad instance's administrators have disabled remote embedding of its editors.`); } // even where embedding is not forbidden it should still be limited // to apps that are explicitly permitted if (!embeddableApps.includes(window.location.pathname)) { return void window.alert(`Embedding this CryptPad editor in remote pages is not supported.`); } } if (window.location.origin !== ApiConfig.httpUnsafeOrigin) { return void window.alert(`This page is configured to only be accessed via ${ApiConfig.httpUnsafeOrigin}.`); } var requireConfig = RequireConfig(); var lang = Messages._languageUsed; var themeKey = 'CRYPTPAD_STORE|colortheme'; var req = { cfg: requireConfig, req: [ '/common/loading.js' ], pfx: window.location.origin, theme: localStorage[themeKey], themeOS: localStorage[themeKey+'_default'], lang: lang }; window.rc = requireConfig; window.apiconf = ApiConfig; var hash, href; if (isRt) { // Hidden hash hash = window.location.hash; href = window.location.href; if (window.history && window.history.replaceState && hash) { window.history.replaceState({}, window.document.title, '#'); } } var $i = $('