Base for Drive in sandboxed iframe

This commit is contained in:
yflory
2017-09-21 17:56:24 +02:00
parent a1c124f1be
commit 456370b1aa
22 changed files with 5060 additions and 19 deletions

View File

@@ -77,6 +77,7 @@ define([
funcs.openTemplatePicker = callWithCommon(UI.openTemplatePicker);
funcs.displayAvatar = callWithCommon(UI.displayAvatar);
funcs.createButton = callWithCommon(UI.createButton);
funcs.createUsageBar = callWithCommon(UI.createUsageBar);
// History
funcs.getHistory = callWithCommon(History.create);
@@ -156,6 +157,12 @@ define([
if (cb) { cb(data); }
});
};
funcs.getPinUsage = function (cb) {
cb = cb || $.noop;
ctx.sframeChan.query('Q_PIN_GET_USAGE', null, function (err, data) {
cb(err || data.error, data.data);
});
};
funcs.isOverPinLimit = function (cb) {
ctx.sframeChan.query('Q_GET_PIN_LIMIT_STATUS', null, function (err, data) {
@@ -283,6 +290,18 @@ define([
ctx.sframeChan.event('EV_CACHE_PUT', x);
};
});
ctx.sframeChan.whenReg('EV_LOCALSTORE_PUT', function () {
if (Object.keys(window.cryptpadStore.updated).length) {
ctx.sframeChan.event('EV_LOCALSTORE_PUT', window.cryptpadStore.updated);
}
window.cryptpadStore._put = window.cryptpadStore.put;
window.cryptpadStore.put = function (k, v, cb) {
window.cryptpadStore._put(k, v, cb);
var x = {};
x[k] = v;
ctx.sframeChan.event('EV_LOCALSTORE_PUT', x);
};
});
UI.addTooltips();