v1.0.177: Готово НЕ сбрасывается при сравнении другой группы
This commit is contained in:
+9
-9
@@ -442,22 +442,22 @@ window.runCompareForGroup = async function(gi, btn) {
|
|||||||
if (_activeCompareES) { _activeCompareES.close(); _activeCompareES = null; }
|
if (_activeCompareES) { _activeCompareES.close(); _activeCompareES = null; }
|
||||||
if (_activeCompareTimer) { clearInterval(_activeCompareTimer); _activeCompareTimer = null; }
|
if (_activeCompareTimer) { clearInterval(_activeCompareTimer); _activeCompareTimer = null; }
|
||||||
|
|
||||||
// Свернуть все раскрытые сравнения
|
// Свернуть все раскрытые сравнения, кроме текущей группы
|
||||||
document.querySelectorAll('.cmp-body').forEach(function(el) { el.style.display = 'none'; });
|
document.querySelectorAll('.cmp-body').forEach(function(el) { el.style.display = 'none'; });
|
||||||
document.querySelectorAll('.cmp-done').forEach(function(span) {
|
// Заменить span «✓ Готово» обратно на кнопку ТОЛЬКО для текущей группы
|
||||||
// Заменить span обратно на кнопку
|
var doneSpan = document.querySelector('.cmp-done[data-gi="' + gi + '"]');
|
||||||
|
if (doneSpan) {
|
||||||
var newBtn = document.createElement('button');
|
var newBtn = document.createElement('button');
|
||||||
newBtn.className = 'btn btn-primary cmp-btn';
|
newBtn.className = 'btn btn-primary cmp-btn';
|
||||||
newBtn.setAttribute('data-gi', span.getAttribute('data-gi'));
|
newBtn.setAttribute('data-gi', gi);
|
||||||
newBtn.textContent = '▶ Сравнить эту группу';
|
newBtn.textContent = '▶ Сравнить эту группу';
|
||||||
newBtn.style.cssText = 'margin-top:6px;font-size:12px;height:28px;';
|
newBtn.style.cssText = 'margin-top:6px;font-size:12px;height:28px;';
|
||||||
newBtn.addEventListener('click', function() {
|
newBtn.addEventListener('click', function() {
|
||||||
if (this.getAttribute('data-done') === '1') return;
|
var g = parseInt(this.getAttribute('data-gi'));
|
||||||
var gi = parseInt(this.getAttribute('data-gi'));
|
runCompareForGroup(g, this);
|
||||||
runCompareForGroup(gi, this);
|
|
||||||
});
|
|
||||||
span.parentNode.replaceChild(newBtn, span);
|
|
||||||
});
|
});
|
||||||
|
doneSpan.parentNode.replaceChild(newBtn, doneSpan);
|
||||||
|
}
|
||||||
|
|
||||||
btn.disabled = true;
|
btn.disabled = true;
|
||||||
btn.innerHTML = '<span class="spinner"></span> Применяю...';
|
btn.innerHTML = '<span class="spinner"></span> Применяю...';
|
||||||
|
|||||||
Reference in New Issue
Block a user