Styling, animation while generating description...
This commit is contained in:
parent
edcb6ca928
commit
efaa5c4306
3 changed files with 27 additions and 7 deletions
|
|
@ -22,6 +22,29 @@
|
|||
});
|
||||
}
|
||||
|
||||
function setDescribeButtonsDisabled(disabled){
|
||||
document.querySelectorAll('.describe-button').forEach(function(btn){
|
||||
if (!btn.dataset.originalText) btn.dataset.originalText = btn.textContent;
|
||||
btn.classList.toggle('disabled', disabled);
|
||||
btn.setAttribute('aria-disabled', disabled ? 'true' : 'false');
|
||||
btn.textContent = disabled ? 'Generating...' : (btn.dataset.originalText || 'Describe');
|
||||
});
|
||||
}
|
||||
|
||||
function showDescribeBusy(){
|
||||
setDescribeButtonsDisabled(true);
|
||||
if (typeof window.showThumbBusy === 'function') {
|
||||
window.showThumbBusy('Generating description…');
|
||||
}
|
||||
}
|
||||
|
||||
function hideDescribeBusy(){
|
||||
if (typeof window.hideThumbBusy === 'function') {
|
||||
window.hideThumbBusy();
|
||||
}
|
||||
setDescribeButtonsDisabled(false);
|
||||
}
|
||||
|
||||
function showModal(job, articleId, description, teaser, quoteDa, rawJson){
|
||||
var existing = document.getElementById('mvlog-gemini-modal');
|
||||
if (existing) existing.remove();
|
||||
|
|
@ -104,9 +127,7 @@
|
|||
var job = el.dataset.job || '';
|
||||
var articleId = el.dataset.id || '';
|
||||
if (!job && !articleId) return;
|
||||
el.classList.add('disabled');
|
||||
var oldText = el.textContent;
|
||||
el.textContent = 'Generating...';
|
||||
showDescribeBusy();
|
||||
fetch('lib/generate_data_sync.php', {
|
||||
method: 'POST',
|
||||
credentials: 'same-origin',
|
||||
|
|
@ -137,8 +158,7 @@
|
|||
}).catch(function(err){
|
||||
showToast('Request failed: ' + err, false);
|
||||
}).finally(function(){
|
||||
el.classList.remove('disabled');
|
||||
el.textContent = oldText;
|
||||
hideDescribeBusy();
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue