From 8b702e0150a24f40cafb4f0ba2d8c9268cd88504 Mon Sep 17 00:00:00 2001 From: Caleb James DeLisle Date: Mon, 21 Aug 2017 10:34:49 +0200 Subject: [PATCH] wip --- www/common/loading.js | 31 +++++ www/common/requireconfig.js | 2 +- www/common/sframe-boot.js | 7 +- www/common/sframe-common-title.js | 5 +- www/pad2/index.html | 4 +- www/pad2/inner.html | 2 +- www/pad2/outer.js | 190 ++++++++++++++++-------------- 7 files changed, 142 insertions(+), 99 deletions(-) create mode 100644 www/common/loading.js diff --git a/www/common/loading.js b/www/common/loading.js new file mode 100644 index 000000000..a1693d2c1 --- /dev/null +++ b/www/common/loading.js @@ -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 = [ + '
', + '', + '
', + '', + '
', + '

', + '
' + ].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(); +}); \ No newline at end of file diff --git a/www/common/requireconfig.js b/www/common/requireconfig.js index 2571b24e5..caa0da868 100644 --- a/www/common/requireconfig.js +++ b/www/common/requireconfig.js @@ -4,7 +4,7 @@ define([ var out = { // fix up locations so that relative urls work. baseUrl: window.location.pathname, - paths: { + paths: { // jquery declares itself as literally "jquery" so it cannot be pulled by path :( "jquery": "/bower_components/jquery/dist/jquery.min", // json.sortify same diff --git a/www/common/sframe-boot.js b/www/common/sframe-boot.js index 190055682..e0182beaf 100644 --- a/www/common/sframe-boot.js +++ b/www/common/sframe-boot.js @@ -1,9 +1,14 @@ // 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. +;(function () { window.addEventListener('message', function (msg) { var data = JSON.parse(msg.data); if (data.q !== 'INIT') { return; } msg.source.postMessage(JSON.stringify({ txid: data.txid, content: 'OK' }), '*'); if (data.content && data.content.requireConf) { require.config(data.content.requireConf); } require(['/common/sframe-boot2.js'], function () { }); -}); \ No newline at end of file +}); +var req = JSON.parse(decodeURIComponent(window.location.hash.substring(1))); +if (req.cfg) { require.config(req.cfg); } +if (req.req) { require(req.req, function () { }); } +}()); \ No newline at end of file diff --git a/www/common/sframe-common-title.js b/www/common/sframe-common-title.js index 545e80d51..066f0328c 100644 --- a/www/common/sframe-common-title.js +++ b/www/common/sframe-common-title.js @@ -49,10 +49,7 @@ define(['jquery'], function ($) { exp.updateTitle = function (newTitle, cb) { cb = cb || $.noop; if (newTitle === exp.title) { return; } - // Change the title now, and set it back to the old value if there is an error - //var oldTitle = exp.title; - Common.updateTitle(newTitle, cb) - //cb(null, newTitle); + Common.updateTitle(newTitle, cb); }; // TODO not needed? diff --git a/www/pad2/index.html b/www/pad2/index.html index 4e21fbe18..7f6236a5f 100644 --- a/www/pad2/index.html +++ b/www/pad2/index.html @@ -1,5 +1,5 @@ - + CryptPad @@ -27,4 +27,4 @@ - +