|
|
@ -438,6 +438,36 @@ define([
|
|
|
|
window.dispatchEvent(evt);
|
|
|
|
window.dispatchEvent(evt);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var versionHashEl;
|
|
|
|
|
|
|
|
var onInit = function () {
|
|
|
|
|
|
|
|
UI.updateLoadingProgress({
|
|
|
|
|
|
|
|
state: 2,
|
|
|
|
|
|
|
|
progress: 0.1
|
|
|
|
|
|
|
|
}, false);
|
|
|
|
|
|
|
|
stateChange(STATE.INITIALIZING);
|
|
|
|
|
|
|
|
if ($('.cp-help-container').length) {
|
|
|
|
|
|
|
|
var privateDat = cpNfInner.metadataMgr.getPrivateData();
|
|
|
|
|
|
|
|
// Burn after reading warning
|
|
|
|
|
|
|
|
$('.cp-help-container').before(common.getBurnAfterReadingWarning());
|
|
|
|
|
|
|
|
// Versioned link warning
|
|
|
|
|
|
|
|
if (privateDat.isHistoryVersion) {
|
|
|
|
|
|
|
|
versionHashEl = h('div.alert.alert-warning.cp-burn-after-reading');
|
|
|
|
|
|
|
|
$('.cp-help-container').before(versionHashEl);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
common.getSframeChannel().on('EV_VERSION_TIME', function (time) {
|
|
|
|
|
|
|
|
if (!versionHashEl) { return; }
|
|
|
|
|
|
|
|
Messages.infobar_versionHash = "You're currently viewing an old version of this document ({0})."; // XXX
|
|
|
|
|
|
|
|
var vTime = time;
|
|
|
|
|
|
|
|
var vTimeStr = vTime ? new Date(vTime).toLocaleString()
|
|
|
|
|
|
|
|
: 'v' + privateDat.isHistoryVersion;
|
|
|
|
|
|
|
|
var vTxt = Messages._getKey('infobar_versionHash', [vTimeStr]);
|
|
|
|
|
|
|
|
versionHashEl.innerText = vTxt;
|
|
|
|
|
|
|
|
versionHashEl = undefined;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var onReady = function () {
|
|
|
|
var onReady = function () {
|
|
|
|
var newContentStr = cpNfInner.chainpad.getUserDoc();
|
|
|
|
var newContentStr = cpNfInner.chainpad.getUserDoc();
|
|
|
|
if (state === STATE.DELETED) { return; }
|
|
|
|
if (state === STATE.DELETED) { return; }
|
|
|
@ -455,6 +485,7 @@ define([
|
|
|
|
var privateDat = cpNfInner.metadataMgr.getPrivateData();
|
|
|
|
var privateDat = cpNfInner.metadataMgr.getPrivateData();
|
|
|
|
var type = privateDat.app;
|
|
|
|
var type = privateDat.app;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// contentUpdate may be async so we need an nthen here
|
|
|
|
// contentUpdate may be async so we need an nthen here
|
|
|
|
nThen(function (waitFor) {
|
|
|
|
nThen(function (waitFor) {
|
|
|
|
if (!newPad) {
|
|
|
|
if (!newPad) {
|
|
|
@ -706,13 +737,7 @@ define([
|
|
|
|
},
|
|
|
|
},
|
|
|
|
onRemote: onRemote,
|
|
|
|
onRemote: onRemote,
|
|
|
|
onLocal: onLocal,
|
|
|
|
onLocal: onLocal,
|
|
|
|
onInit: function () {
|
|
|
|
onInit: onInit,
|
|
|
|
UI.updateLoadingProgress({
|
|
|
|
|
|
|
|
state: 2,
|
|
|
|
|
|
|
|
progress: 0.1
|
|
|
|
|
|
|
|
}, false);
|
|
|
|
|
|
|
|
stateChange(STATE.INITIALIZING);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
onReady: function () { evStart.reg(onReady); },
|
|
|
|
onReady: function () { evStart.reg(onReady); },
|
|
|
|
onConnectionChange: onConnectionChange,
|
|
|
|
onConnectionChange: onConnectionChange,
|
|
|
|
onError: onError,
|
|
|
|
onError: onError,
|
|
|
|