From 25606b92bf49933ace93a58265459573e71b7df2 Mon Sep 17 00:00:00 2001 From: yflory Date: Tue, 22 Sep 2020 15:27:16 +0200 Subject: [PATCH] lint compliance --- lib/workers/db-worker.js | 6 ++--- www/common/onlyoffice/history.js | 39 ++++++++------------------------ 2 files changed, 12 insertions(+), 33 deletions(-) diff --git a/lib/workers/db-worker.js b/lib/workers/db-worker.js index 681988ad0..584b9af01 100644 --- a/lib/workers/db-worker.js +++ b/lib/workers/db-worker.js @@ -253,9 +253,9 @@ const getOlderHistory = function (data, cb) { if (typeof (desiredMessages) === "number") { toSend = messages.slice(-desiredMessages); } else if (untilHash) { - for (var i = messages.length - 1; i >= 0; i--) { - toSend.unshift(messages[i]); - if (Array.isArray(messages[i]) && HK.getHash(messages[i][4]) === untilHash) { + for (var j = messages.length - 1; j >= 0; j--) { + toSend.unshift(messages[j]); + if (Array.isArray(messages[j]) && HK.getHash(messages[j][4]) === untilHash) { break; } } diff --git a/www/common/onlyoffice/history.js b/www/common/onlyoffice/history.js index 5f144aa8b..9907d9320 100644 --- a/www/common/onlyoffice/history.js +++ b/www/common/onlyoffice/history.js @@ -2,9 +2,7 @@ define([ 'jquery', '/common/common-interface.js', '/common/hyperscript.js', - '/bower_components/nthen/index.js', - //'/bower_components/chainpad-json-validator/json-ot.js', -], function ($, UI, h, nThen, /* JsonOT */) { +], function ($, UI, h) { //var ChainPad = window.ChainPad; var History = {}; @@ -21,7 +19,6 @@ define([ var cpIndex = -1; var msgIndex = 0; - var sortedCp; var ooMessages = {}; var loading = false; var update = function () {}; @@ -43,7 +40,9 @@ define([ if (endWithCp) { cpIndex = 0; } - var $loadMore, $version, $time; + var $version, $time; + var $hist = $toolbar.find('.cp-toolbar-history'); + var $bottom = $toolbar.find('.cp-toolbar-bottom'); var showVersion = function (initial) { var major = sortedCp.length - cpIndex; @@ -117,18 +116,6 @@ define([ }); }; - // config.setHistory(bool, bool) - // - bool1: history value - // - bool2: reset old content? - var render = function (val) { - if (typeof val === "undefined") { return; } - try { - config.applyVal(val); - } catch (e) { - // Probably a parse error - console.error(e); - } - }; var onClose = function () { config.setHistory(false); }; var onRevert = function () { config.onRevert(); @@ -138,13 +125,7 @@ define([ var Messages = common.Messages; - var realtime; - var states = []; - var c = 0;//states.length - 1; - - var $hist = $toolbar.find('.cp-toolbar-history'); - var $bottom = $toolbar.find('.cp-toolbar-bottom'); $hist.html('').css('display', 'flex'); $bottom.hide(); @@ -263,6 +244,11 @@ define([ }); }); + // Versioned link + $share.click(function () { + // XXX + }); + // Push one patch $next.click(function () { if (loading) { return; } @@ -270,13 +256,6 @@ define([ next(); update(); }); - // Reset current checkpoint - /*$prev.click(function () { - if (loading) { return; } - loading = true; - loadMoreOOHistory(); - update(); - });*/ // Go to previous checkpoint $fastNext.click(function () { if (loading) { return; }