RE: Update Bot auto curation

You are viewing a single comment's thread:

part 5

...
========== AUTO-VOTE TOGGLE FUNCTION ==========
let autoVotePaused = false;
let autoVoteInterval = null;

function toggleAutoVote() {
autoVotePaused = !autoVotePaused;
const toggleBtn = document.getElementById('autoVoteToggle');
const statusText = document.getElementById('autoVoteStatus');

if (autoVotePaused) {
    toggleBtn.textContent = "▶";
    statusText.textContent = "PAUSED";
    statusText.style.color = "var(--neon-red)";
    clearAutoRefresh();
    clearInterval(autoVoteInterval);

    // Arrêter le processus auto-vote en cours
    if (window.voteNextTimeout) {
        clearTimeout(window.voteNextTimeout);
    }
} else {
    toggleBtn.textContent = "⏸";
    statusText.textContent = "ACTIVE";
    statusText.style.color = "var(--neon-green)";

    // Relancer l'auto-vote si des posts sont éligibles
    const eligibleCount = <?php echo count($eligible_posts); ?>;
    if (eligibleCount > 0) {
        setTimeout(() => {
            startAutoVote();
        }, 1000);
    }
}

}

// Modification de startAutoVote pour gérer la pause
window.startAutoVoteOriginal = window.startAutoVote;
window.startAutoVote = async function() {
if (autoVotePaused) return;
await window.startAutoVoteOriginal();
}

// Initialisation
document.addEventListener('DOMContentLoaded', function() {
// Vérifier si l'auto-vote est activé dans la config
if (!) {
const toggleBtn = document.getElementById('autoVoteToggle');
const statusText = document.getElementById('autoVoteStatus');
toggleBtn.textContent = "▶";
statusText.textContent = "DISABLED";
statusText.style.color = "var(--text-secondary)";
toggleBtn.onclick = function() {
alert("Auto-vote is disabled in configuration. Set AUTO_VOTE_ENABLED to true in PHP config.");
};
}
});

(html comment removed: ========== PATCH: No Alert / Auto-Skip Errors ========== )

...


0
0
0.000
0 comments