cryptpad/www/common/sframe-boot2.js
Caleb James DeLisle 8a32b72ffc 1. implement cryptpadCache which has put() and get() functions that can be used like a localStorage that auto-flushes when a new version is released
2. change loading.js to use packaged css in order to get the loading screen up as quick as possible.
3. change LessLoader to cache less in cryptpadCache
2017-09-14 10:23:05 +02:00

26 lines
1 KiB
JavaScript

// This is stage 1, it can be changed but you must bump the version of the project.
// Note: This must only be loaded from inside of a sandbox-iframe.
define(['/common/requireconfig.js'], function (RequireConfig) {
require.config(RequireConfig());
// most of CryptPad breaks if you don't support isArray
if (!Array.isArray) {
Array.isArray = function(arg) { // CRYPTPAD_SHIM
return Object.prototype.toString.call(arg) === '[object Array]';
};
}
var mkFakeStore = function () {
var fakeStorage = {
getItem: function (k) { return fakeStorage[k]; },
setItem: function (k, v) { fakeStorage[k] = v; return v; }
};
return fakeStorage;
};
window.__defineGetter__('localStorage', function () { return mkFakeStore(); });
window.__defineGetter__('sessionStorage', function () { return mkFakeStore(); });
window.CRYPTPAD_INSIDE = true;
require([document.querySelector('script[data-bootload]').getAttribute('data-bootload')]);
});