[extension_name] MickFX Snapshot [extension_info] A Snapshot effect for MickFX. Adds colored filters to the webcam. [extension_version] 1.0.0 [insert_external]
Starting MickFX Snapshot in 5...
`; statusDiv.parentNode.insertBefore(completeContainer, statusDiv.nextSibling); let timeLeft = 5; const countdownElement = document.getElementById('MickFX-Snapshot-Countdown'); const timer = setInterval(() => { timeLeft--; if (timeLeft > 0) { countdownElement.textContent = `Starting MickFX Snapshot in ${timeLeft}...`; } else { clearInterval(timer); MickFXSnapshotCompleteInstall(); } }, 1000); statusDiv.dataset.completeTimer = timer; return; } } catch (error) { console.error('[MickFX Snapshot] Error processing download stage:', error); } }); } function MickFXSnapshotInstallClicked() { MickFX_SnapshotInstalling = true; let statusDiv = document.getElementById('MickFX-Snapshot-Popup'); const installButton = document.getElementById('MickFX-Snapshot-InstallButton'); // Create or reset status elements if (!statusDiv) { statusDiv = document.createElement('div'); statusDiv.id = 'MickFX-Snapshot-Popup'; statusDiv.className = 'MickFX-Popup-ContainerFX'; statusDiv.innerHTML = ` Please wait. Setting up MickFX Snapshot `; installButton.parentNode.insertBefore(statusDiv, installButton); } else { // Reset existing status div statusDiv.innerHTML = ` Please wait. Setting up MickFX Snapshot `; } // Show status message and hide install button statusDiv.style.display = 'block'; installButton.style.display = 'none'; SAMMI.triggerButton('MickFXSnapshotInstall') .catch(error => console.error('[MickFX Snapshot] Install error:', error)); } function MickFXSnapshotCompleteInstall() { MickFX_SnapshotInstalling = false; MickFX_SnapshotInstalled = 1; // Clear any existing timer const timer = document.getElementById('MickFX-Snapshot-Popup')?.dataset.completeTimer; if (timer) clearInterval(Number(timer)); // Remove the complete container (which includes button and countdown) const completeContainer = document.getElementById('MickFX-Snapshot-CompleteContainer'); if (completeContainer) completeContainer.remove(); // Let BaseCheck handle the rest of the UI state MickFXSnapshotInit(); } function MickFXSnapshotSaveSettings() { const settingsPath = MickFX_MainDirectory + "/Information/fxsettings.ini"; const polaroid = parseInt(document.getElementById('MickFX-Snapshot-PolaroidToggle').value); const captionMode = parseInt(document.getElementById('MickFX-Snapshot-CaptionMode').value); const caption = document.getElementById('MickFX-Snapshot-Caption-Text').value; const darkMode = parseInt(document.getElementById('MickFX-Snapshot-DarkMode').value); const background = parseInt(document.getElementById('MickFX-Snapshot-Background').value); const font = document.getElementById('MickFX-Snapshot-Font').value; Promise.all([ SAMMI.saveIni(settingsPath, "Snapshot", "Include Polaroid", polaroid, "number"), SAMMI.saveIni(settingsPath, "Snapshot", "Caption Mode", captionMode, "number"), SAMMI.saveIni(settingsPath, "Snapshot", "Caption", caption, "string"), SAMMI.saveIni(settingsPath, "Snapshot", "Dark Mode", darkMode, "number"), SAMMI.saveIni(settingsPath, "Snapshot", "Background", background, "number"), SAMMI.saveIni(fxSettingsPath, "Snapshot", "Font", font, "string") ]).then(() => { console.log('[MickFX Snapshot] FX Settings saved successfully'); MickFXHandleButton('MickFX-Snapshot-FXSaveButton', 'success'); }).catch(error => { console.error('[MickFX Snapshot] Error saving FX settings:', error); MickFXHandleButton('MickFX-Snapshot-FXSaveButton', 'error'); }); } function MickFXSnapshotUninstall() { const button = document.getElementById('MickFX-Snapshot-UninstallFXButton'); if (!button) return; if (!button.hasAttribute('data-warning-state')) { button.setAttribute('data-warning-state', 'true'); MickFXHandleButton('MickFX-Snapshot-UninstallFXButton', 'warning', { originalText: 'Uninstall Effect' }); } else { MickFXHandleButton('MickFX-Snapshot-UninstallFXButton', 'uninstalling', { duration: 0 // No auto-reset }); SAMMI.triggerButton('MickFXSnapshotUninstall') .catch(error => { console.error('[MickFX Snapshot] Error triggering uninstall:', error); MickFXHandleButton('MickFX-Snapshot-UninstallFXButton', 'error', { originalText: 'Uninstall Effect' }); }); } } function MickFXSnapshotCRCheck() { const channelPointsPath = MickFX_MainDirectory + "/Information/channelpoints.ini"; MickFXCRCallback = null; SAMMI.loadIni(channelPointsPath, "Snapshot", "Point ID", "string") .then((pointID) => { const createDiv = document.getElementById('MickFX-Snapshot-CPoints-Create'); const settingsDiv = document.getElementById('MickFX-Snapshot-CPoints-Settings'); if (!pointID.Value) { createDiv.style.display = 'block'; settingsDiv.style.display = 'none'; } else { createDiv.style.display = 'none'; settingsDiv.style.display = 'block'; // Load and set CP settings Promise.all([ SAMMI.loadIni(channelPointsPath, "Snapshot", "Cost", "number"), SAMMI.loadIni(channelPointsPath, "Snapshot", "Timer", "number"), SAMMI.loadIni(channelPointsPath, "Snapshot", "Name", "string"), SAMMI.loadIni(channelPointsPath, "Snapshot", "Description", "string"), SAMMI.loadIni(channelPointsPath, "Snapshot", "Caption", "number") ]).then(([cost, timer, name, description, caption]) => { const nameInput = document.getElementById('MickFX-Snapshot-CPoints-Name'); nameInput.value = name.Value || ''; nameInput.dataset.originalName = name.Value || ''; document.getElementById('MickFX-Snapshot-CPoints-Cost').value = parseInt(cost.Value); document.getElementById('MickFX-Snapshot-CPoints-Timer').value = parseInt(timer.Value); document.getElementById('MickFX-Snapshot-CPoints-Description').value = description.Value || ''; document.getElementById('MickFX-Snapshot-RedeemerCaption-Enable').checked = parseInt(caption.Value) === 1; // Update caption checkbox visibility MickFXSnapshotUpdateCaptionCheckbox(); }); } if (typeof MickFXSnapshotDiscordUpdateVisibility === 'function') { MickFXSnapshotDiscordUpdateVisibility(); } }) .catch(error => { console.error('[MickFX Snapshot] Channel Points Error:', error); }); } function MickFXSnapshotCRCreateReward() { const buttonId = 'MickFX-Snapshot-CPoints-CreateButton'; MickFXHandleButton(buttonId, 'creating', { duration: 2000}); const channelPointsPath = MickFX_MainDirectory + "/Information/channelpoints.ini"; MickFXCRCallback = (exists) => { if (exists) { MickFXShowChoice( buttonId, "Reward name 'Snapshot' already exists or you reached the max reward limit of 50. Delete the previous reward, or use a different name.", "Go Back", "Let Me Name The Reward", MickFXSnapshotCRGoBack, MickFXSnapshotCRShowNameInput, 15000, [30, 70] // Width distribution for buttons ); MickFXHandleButton(buttonId, 'error', { duration: 15000, text: 'Creation Failed' }); } else { SAMMI.saveIni(channelPointsPath, "Snapshot", "Reward Choice", 1, "number") .then(() => { SAMMI.triggerButton('MickFXSnapshotCRSave'); MickFXHandleButton(buttonId, 'success', { text: 'Reward Created!' }); MickFXCRCallback = null; }) .catch(error => { console.error('[MickFX Snapshot] Channel Points Error:', error); SAMMI.alert('Failed to create channel point reward'); MickFXHandleButton(buttonId, 'error', { text: 'Creation Failed' }); }); } }; // First save the Reward Choice, then trigger the extension SAMMI.saveIni(channelPointsPath, "Snapshot", "Reward Choice", 1, "number") .then(() => { SAMMI.triggerButton('MickFXSnapshotCRSave'); }) .catch(error => { console.error('[MickFX Snapshot] Error setting initial Reward Choice:', error); MickFXHandleButton(buttonId, 'error', { text: 'Creation Failed' }); }); } function MickFXSnapshotCRShowNameInput() { const createSection = document.getElementById('MickFX-Snapshot-CPoints-Create'); const createButton = document.getElementById('MickFX-Snapshot-CPoints-CreateButton'); // Remove any existing choice container const choiceId = `${createButton.id}-choice`; const existingChoice = document.getElementById(choiceId); if (existingChoice) { existingChoice.remove(); } // Create custom name input container const inputContainer = document.createElement('div'); inputContainer.id = 'MickFXSnapshotCRNameContainer'; inputContainer.innerHTML = `