Fix issues with trim history button

pull/1/head
yflory 5 years ago
parent 6f742fc295
commit 59d23ef5ff

@ -68,6 +68,9 @@
} }
} }
} }
button.cp-button-confirm-placeholder {
margin-bottom: 3px !important;
}
button:not(.pure-button):not(.md-button):not(.mdl-button) { button:not(.pure-button):not(.md-button):not(.mdl-button) {

@ -623,9 +623,9 @@ define([
var to; var to;
var done = function (res) { var done = function (res) {
cb(res); if (res) { cb(res); }
clearTimeout(to); clearTimeout(to);
$(content).remove(); $(content).detach();
$(originalBtn).show(); $(originalBtn).show();
}; };
@ -646,9 +646,12 @@ define([
$(div).css('width', p+'%'); $(div).css('width', p+'%');
to = setTimeout(todo, INTERVAL); to = setTimeout(todo, INTERVAL);
}; };
to = setTimeout(todo, INTERVAL);
$(originalBtn).addClass('cp-button-confirm-placeholder').click(function () {
i = 1;
to = setTimeout(todo, INTERVAL);
$(originalBtn).hide().after(content); $(originalBtn).hide().after(content);
});
}; };

@ -825,12 +825,9 @@ define([
$d.append(size); $d.append(size);
var $button = $(button); var $button = $(button);
$button.click(function () {
UI.confirmButton(button, { UI.confirmButton(button, {
classes: 'btn-danger' classes: 'btn-danger'
}, function (yes) { }, function () {
if (!yes) { return; }
$button.remove(); $button.remove();
spinner.spin(); spinner.spin();
history.execCommand('TRIM_HISTORY', { history.execCommand('TRIM_HISTORY', {
@ -850,7 +847,7 @@ define([
h('br'), h('br'),
h('span.cp-app-prop-content', formatted) h('span.cp-app-prop-content', formatted)
])); ]));
}); $d.append(h('div.alert.alert-success', Messages.trimHistory_success));
}); });
}); });

@ -1258,12 +1258,10 @@ define([
return; return;
} }
$(currentSize).html(Messages._getKey('trimHistory_currentSize', [UIElements.prettySize(size)])); $(currentSize).html(Messages._getKey('trimHistory_currentSize', [UIElements.prettySize(size)]));
$button.click(function () { $button.prop('disabled', '');
UI.confirmButton(button, { UI.confirmButton(button, {
classes: 'btn-danger' classes: 'btn-danger'
}, function (yes) { }, function () {
if (!yes) { return; }
$button.remove(); $button.remove();
spinner.spin(); spinner.spin();
APP.history.execCommand('TRIM_HISTORY', { APP.history.execCommand('TRIM_HISTORY', {
@ -1278,7 +1276,6 @@ define([
redrawTrimHistory(cb, $div); redrawTrimHistory(cb, $div);
}); });
}); });
}).prop('disabled', '');
}); });
$div.find('#cp-settings-trim-container').remove(); $div.find('#cp-settings-trim-container').remove();

Loading…
Cancel
Save