You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cryptpad/www/common/sframe-boot.js

19 lines
814 B
JavaScript

7 years ago
// 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.
7 years ago
;(function () {
var req = JSON.parse(decodeURIComponent(window.location.hash.substring(1)));
req.cfg = req.cfg || {};
if (req.pfx) {
req.cfg.onNodeCreated = function (node /*, config, module, path*/) {
node.setAttribute('src', req.pfx + node.getAttribute('src'));
};
}
require.config(req.cfg);
if (req.req) { require(req.req, function () { }); }
7 years ago
window.addEventListener('message', function (msg) {
7 years ago
var data = JSON.parse(msg.data);
7 years ago
if (data.q !== 'INIT') { return; }
7 years ago
msg.source.postMessage(JSON.stringify({ txid: data.txid, content: 'OK' }), '*');
7 years ago
require(['/common/sframe-boot2.js'], function () { });
7 years ago
});
}());