Fix an issue where the history could only be opened once in the drive

This commit is contained in:
yflory 2020-09-29 18:04:04 +02:00
parent 79dff87377
commit c9b581b974
2 changed files with 7 additions and 19 deletions

View file

@ -758,23 +758,16 @@ define([
button = $('<span>');
break;
}
var active = $(".cp-toolbar-history:visible").length !== 0;
button = $('<button>', {
title: active ? Messages.history_closeTitle : Messages.historyButton,
title: Messages.historyButton,
'class': "fa fa-history cp-toolbar-icon-history",
}).append($('<span>', {'class': 'cp-toolbar-drawer-element'}).text(Messages.historyText));
button.toggleClass("active", active);
if (data.histConfig) {
if (active) {
button.click(function () { $(".cp-toolbar-history-close").trigger("click"); });
}
else {
button
.click(common.prepareFeedback(type))
.on('click', function () {
common.getHistory(data.histConfig);
});
}
button
.click(common.prepareFeedback(type))
.on('click', function () {
common.getHistory(data.histConfig);
});
}
break;
case 'mediatag':

View file

@ -281,7 +281,7 @@ define([
return states;
};
var $loadMore, $version, $time, get;
var $loadMore, $time, get;
// Get the content of the selected version, and change the version number
var loading = false;
@ -295,7 +295,6 @@ define([
if (err === 'EFULL') {
$loadMore.off('click').hide();
get(c);
$version.show();
return;
}
loading = false;
@ -306,7 +305,6 @@ define([
get(c);
if (isFull) {
$loadMore.off('click').hide();
$version.show();
}
if (cb) { cb(); }
});
@ -357,7 +355,6 @@ define([
// Display the version when the full history is loaded
// Note: the first version is always empty and probably can't be displayed, so
// we can consider we have only states.length - 1 versions
$version.text(idx + ' / ' + (states.length-1));
var time = states[idx].time;
if (time) {
$time.text(new Date(time).toLocaleString());
@ -460,7 +457,6 @@ define([
var pos = h('span.cp-history-timeline-pos.fa.fa-caret-down');
var time = h('div.cp-history-timeline-time');
$time = $(time);
$version = $(); // XXX
var timeline = h('div.cp-toolbar-history-timeline', [
h('div.cp-history-timeline-line', [
h('span.cp-history-timeline-legend', [
@ -674,7 +670,6 @@ define([
display();
if (isFull) {
$loadMore.off('click').hide();
$version.show();
}
});
};