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

pull/1/head
yflory 4 years ago
parent 79dff87377
commit c9b581b974

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

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

Loading…
Cancel
Save