cryptpad/www/common/sframe-app-outer.js

42 lines
1.4 KiB
JavaScript
Raw Normal View History

2023-10-20 14:35:26 +00:00
// SPDX-FileCopyrightText: 2023 XWiki CryptPad Team <contact@cryptpad.org> and contributors
//
// SPDX-License-Identifier: AGPL-3.0-or-later
2017-08-28 10:25:05 +00:00
// Load #1, load as little as possible because we are in a race to get the loading screen up.
2014-10-31 15:42:58 +00:00
define([
'/components/nthen/index.js',
2017-08-28 10:25:05 +00:00
'/api/config',
2017-12-01 15:05:20 +00:00
'/common/dom-ready.js',
2017-08-30 09:10:57 +00:00
'/common/sframe-common-outer.js'
2020-11-04 10:22:31 +00:00
], function (nThen, ApiConfig, DomReady, SFCommonO) {
2017-08-28 10:25:05 +00:00
2023-01-16 20:22:57 +00:00
var isIntegration = Boolean(window.CP_integration_outer);
var integration = window.CP_integration_outer || {};
2020-01-27 11:18:25 +00:00
var hash, href;
2017-08-28 10:25:05 +00:00
nThen(function (waitFor) {
2017-12-01 15:05:20 +00:00
DomReady.onReady(waitFor());
2017-08-28 10:25:05 +00:00
}).nThen(function (waitFor) {
2023-01-16 20:22:57 +00:00
var obj = SFCommonO.initIframe(waitFor, true, integration.pathname);
2020-11-04 10:22:31 +00:00
href = obj.href;
hash = obj.hash;
2023-01-16 20:22:57 +00:00
if (isIntegration) {
href = integration.href;
hash = integration.hash;
}
2017-08-28 10:25:05 +00:00
}).nThen(function (/*waitFor*/) {
SFCommonO.start({
2023-01-16 20:22:57 +00:00
cache: !isIntegration,
2021-03-08 09:59:54 +00:00
noDrive: true,
2020-01-27 11:18:25 +00:00
hash: hash,
href: href,
2023-01-16 20:22:57 +00:00
useCreationScreen: !isIntegration,
messaging: true,
integration: isIntegration,
2023-01-24 15:58:23 +00:00
integrationUtils: integration.utils,
2023-01-26 17:40:31 +00:00
integrationConfig: integration.config || {},
initialState: integration.initialState || undefined
});
2017-02-17 14:39:34 +00:00
});
2017-12-01 15:05:20 +00:00
});