From 3c5d3ce43ec1d3c0cdc4517954134478df07d46b Mon Sep 17 00:00:00 2001 From: yflory Date: Mon, 21 Sep 2020 14:51:13 +0200 Subject: [PATCH] Add version number in oo history --- .../src/less2/include/toolbar-history.less | 1 + www/common/onlyoffice/history.js | 48 ++++++++++++++----- 2 files changed, 36 insertions(+), 13 deletions(-) diff --git a/customize.dist/src/less2/include/toolbar-history.less b/customize.dist/src/less2/include/toolbar-history.less index 7538fb2bc..119a82387 100644 --- a/customize.dist/src/less2/include/toolbar-history.less +++ b/customize.dist/src/less2/include/toolbar-history.less @@ -41,6 +41,7 @@ width: 100%; text-align: center; color: black; + left: 0; } .cp-toolbar-history-goto { display: inline-block; diff --git a/www/common/onlyoffice/history.js b/www/common/onlyoffice/history.js index e9f361f36..c8b485efe 100644 --- a/www/common/onlyoffice/history.js +++ b/www/common/onlyoffice/history.js @@ -64,6 +64,8 @@ define([ var fromHash = nextId ? hashes[nextId].hash : config.onlyoffice.lastHash; msgIndex = 0; + + showVersion(); if (ooMessages[id]) { // Cp already loaded: reload OO loading = false; @@ -123,14 +125,28 @@ define([ var $loadMore, $version, get; + var showVersion = function () { + var major = sortedCp.length - cpIndex; + var v = major + '.' + msgIndex; + $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-1)); + $pos.css('margin-left', p+'%'); + }; + var $fastPrev = $('