wip
This commit is contained in:
parent
498c8229e9
commit
8b702e0150
31
www/common/loading.js
Normal file
31
www/common/loading.js
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
define([
|
||||||
|
'less!/customize/src/less/cryptpad.less'
|
||||||
|
], function () {
|
||||||
|
var urlArgs = window.location.href.replace(/^.*\?([^\?]*)$/, function (all, x) { return x; });
|
||||||
|
var elem = document.createElement('div');
|
||||||
|
elem.setAttribute('id', 'loading');
|
||||||
|
elem.innerHTML = [
|
||||||
|
'<div class="loadingContainer">',
|
||||||
|
'<img class="cryptofist" src="/customize/cryptpad-new-logo-colors-logoonly.png?' + urlArgs + '">',
|
||||||
|
'<div class="spinnerContainer">',
|
||||||
|
'<span class="fa fa-circle-o-notch fa-spin fa-4x fa-fw"></span>',
|
||||||
|
'</div>',
|
||||||
|
'<p id="cp-loading-message"></p>',
|
||||||
|
'</div>'
|
||||||
|
].join('');
|
||||||
|
var intr;
|
||||||
|
var append = function () {
|
||||||
|
if (!document.body) { return; }
|
||||||
|
clearInterval(intr);
|
||||||
|
document.body.appendChild(elem);
|
||||||
|
require([
|
||||||
|
'/customize/messages.js',
|
||||||
|
|
||||||
|
'css!/bower_components/components-font-awesome/css/font-awesome.min.css',
|
||||||
|
], function (Messages) {
|
||||||
|
document.getElementById('cp-loading-message').innerText = Messages.loading;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
intr = setInterval(append, 100);
|
||||||
|
append();
|
||||||
|
});
|
||||||
@ -1,5 +1,6 @@
|
|||||||
// Stage 0, this gets cached which means we can't change it. boot2-sframe.js is changable.
|
// Stage 0, this gets cached which means we can't change it. boot2-sframe.js is changable.
|
||||||
// Note that this file is meant to be executed only inside of a sandbox iframe.
|
// Note that this file is meant to be executed only inside of a sandbox iframe.
|
||||||
|
;(function () {
|
||||||
window.addEventListener('message', function (msg) {
|
window.addEventListener('message', function (msg) {
|
||||||
var data = JSON.parse(msg.data);
|
var data = JSON.parse(msg.data);
|
||||||
if (data.q !== 'INIT') { return; }
|
if (data.q !== 'INIT') { return; }
|
||||||
@ -7,3 +8,7 @@ window.addEventListener('message', function (msg) {
|
|||||||
if (data.content && data.content.requireConf) { require.config(data.content.requireConf); }
|
if (data.content && data.content.requireConf) { require.config(data.content.requireConf); }
|
||||||
require(['/common/sframe-boot2.js'], function () { });
|
require(['/common/sframe-boot2.js'], function () { });
|
||||||
});
|
});
|
||||||
|
var req = JSON.parse(decodeURIComponent(window.location.hash.substring(1)));
|
||||||
|
if (req.cfg) { require.config(req.cfg); }
|
||||||
|
if (req.req) { require(req.req, function () { }); }
|
||||||
|
}());
|
||||||
@ -49,10 +49,7 @@ define(['jquery'], function ($) {
|
|||||||
exp.updateTitle = function (newTitle, cb) {
|
exp.updateTitle = function (newTitle, cb) {
|
||||||
cb = cb || $.noop;
|
cb = cb || $.noop;
|
||||||
if (newTitle === exp.title) { return; }
|
if (newTitle === exp.title) { return; }
|
||||||
// Change the title now, and set it back to the old value if there is an error
|
Common.updateTitle(newTitle, cb);
|
||||||
//var oldTitle = exp.title;
|
|
||||||
Common.updateTitle(newTitle, cb)
|
|
||||||
//cb(null, newTitle);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO not needed?
|
// TODO not needed?
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html class="cp pad">
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>CryptPad</title>
|
<title>CryptPad</title>
|
||||||
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
|
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
|
||||||
@ -27,4 +27,4 @@
|
|||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<iframe id="sbox-iframe"></iframe>
|
<iframe id="sbox-iframe">
|
||||||
@ -1,5 +1,5 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html class="cp pad">
|
||||||
<head>
|
<head>
|
||||||
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
|
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
|
||||||
<link rel="stylesheet" href="/bower_components/components-font-awesome/css/font-awesome.min.css">
|
<link rel="stylesheet" href="/bower_components/components-font-awesome/css/font-awesome.min.css">
|
||||||
|
|||||||
@ -1,20 +1,29 @@
|
|||||||
|
|
||||||
define([
|
define([
|
||||||
'/api/config',
|
'/api/config',
|
||||||
'/common/sframe-channel.js',
|
|
||||||
'jquery',
|
'jquery',
|
||||||
|
'/common/requireconfig.js'
|
||||||
|
], function (ApiConfig, $, RequireConfig) {
|
||||||
|
$(function () {
|
||||||
|
var req = {
|
||||||
|
cfg: RequireConfig,
|
||||||
|
req: [ '/common/loading.js' ],
|
||||||
|
};
|
||||||
|
$('#sbox-iframe').attr('src',
|
||||||
|
ApiConfig.httpSafeOrigin + '/pad2/inner.html?' + ApiConfig.requireConf.urlArgs +
|
||||||
|
'#' + encodeURIComponent(JSON.stringify(req)));
|
||||||
|
});
|
||||||
|
require([
|
||||||
|
'/common/sframe-channel.js',
|
||||||
'/common/sframe-chainpad-netflux-outer.js',
|
'/common/sframe-chainpad-netflux-outer.js',
|
||||||
'/bower_components/nthen/index.js',
|
'/bower_components/nthen/index.js',
|
||||||
'/common/cryptpad-common.js',
|
'/common/cryptpad-common.js',
|
||||||
'/bower_components/chainpad-crypto/crypto.js'
|
'/bower_components/chainpad-crypto/crypto.js'
|
||||||
], function (ApiConfig, SFrameChannel, $, CpNfOuter, nThen, Cryptpad, Crypto) {
|
], function (SFrameChannel, CpNfOuter, nThen, Cryptpad, Crypto) {
|
||||||
console.log('xxx');
|
console.log('xxx');
|
||||||
var sframeChan;
|
var sframeChan;
|
||||||
nThen(function (waitFor) {
|
nThen(function (waitFor) {
|
||||||
$(waitFor());
|
$(waitFor());
|
||||||
}).nThen(function (waitFor) {
|
}).nThen(function (waitFor) {
|
||||||
$('#sbox-iframe').attr('src',
|
|
||||||
ApiConfig.httpSafeOrigin + '/pad2/inner.html?' + ApiConfig.requireConf.urlArgs);
|
|
||||||
SFrameChannel.create($('#sbox-iframe')[0].contentWindow, waitFor(function (sfc) {
|
SFrameChannel.create($('#sbox-iframe')[0].contentWindow, waitFor(function (sfc) {
|
||||||
sframeChan = sfc;
|
sframeChan = sfc;
|
||||||
console.log('sframe initialized');
|
console.log('sframe initialized');
|
||||||
@ -101,3 +110,4 @@ define([
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
});
|
||||||
Loading…
x
Reference in New Issue
Block a user