diff --git a/www/common/onlyoffice/history.js b/www/common/onlyoffice/history.js index e9cec385b..5f144aa8b 100644 --- a/www/common/onlyoffice/history.js +++ b/www/common/onlyoffice/history.js @@ -1,9 +1,10 @@ define([ 'jquery', '/common/common-interface.js', + '/common/hyperscript.js', '/bower_components/nthen/index.js', //'/bower_components/chainpad-json-validator/json-ot.js', -], function ($, UI, nThen, /* JsonOT */) { +], function ($, UI, h, nThen, /* JsonOT */) { //var ChainPad = window.ChainPad; var History = {}; @@ -42,6 +43,29 @@ define([ if (endWithCp) { cpIndex = 0; } + var $loadMore, $version, $time; + + var showVersion = function (initial) { + var major = sortedCp.length - cpIndex; + var v = major + '.' + msgIndex; + if (initial) { + v = "Latest"; // XXX + } + $version.text("Version: " + v); // XXX + + var $pos = $hist.find('.cp-toolbar-history-pos'); + var cps = sortedCp.length; + var id = sortedCp[cps - cpIndex -1] || -1; + if (!ooMessages[id]) { return; } + var msgs = ooMessages[id]; + var p = 100*(msgIndex / (msgs.length)); + $pos.css('margin-left', p+'%'); + + var time = msgs[msgIndex].time; + if (time) { $time.text(new Date(time).toLocaleString()); } + else { $time.text(''); } + }; + // We want to load a checkpoint (or initial state) var loadMoreOOHistory = function () { if (!Array.isArray(sortedCp)) { return void console.error("Wrong type"); } @@ -127,33 +151,10 @@ define([ UI.spinner($hist).get().show(); - var $loadMore, $version, get; - - var showVersion = function (initial) { - var major = sortedCp.length - cpIndex; - var v = major + '.' + msgIndex; - if (initial) { - v = "Latest"; // XXX - } - $version.text("Version: " + v); // XXX - - var $pos = $hist.find('.cp-toolbar-history-pos'); - var cps = sortedCp.length; - var id = sortedCp[cps - cpIndex -1] || -1; - if (!ooMessages[id]) { return; } - var msgs = ooMessages[id]; - var p = 100*(msgIndex / (msgs.length)); - $pos.css('margin-left', p+'%'); - }; - var $fastPrev = $('