Styling changes for the confirm dialog

This commit is contained in:
cmdr2 2022-12-01 13:54:49 +05:30
parent 4bc6e51862
commit 3b554d881a

View File

@ -153,9 +153,12 @@ function shiftOrConfirm(e, prompt, fn) {
if (e.shiftKey || !confirmDangerousActionsField.checked) { if (e.shiftKey || !confirmDangerousActionsField.checked) {
fn(e) fn(e)
} else { } else {
$.confirm({ theme: 'supervan', $.confirm({
theme: 'modern',
title: prompt, title: prompt,
content: 'Tip: To skip this dialog, use shift-click or disable the setting "Confirm dangerous actions" in the systems setting.', useBootstrap: false,
animateFromElement: false,
content: '<small>Tip: To skip this dialog, use shift-click or disable the "Confirm dangerous actions" setting in the Settings tab.</small>',
buttons: { buttons: {
yes: () => { fn(e) }, yes: () => { fn(e) },
cancel: () => {} cancel: () => {}
@ -164,7 +167,6 @@ function shiftOrConfirm(e, prompt, fn) {
} }
} }
function logMsg(msg, level, outputMsg) { function logMsg(msg, level, outputMsg) {
if (outputMsg.hasChildNodes()) { if (outputMsg.hasChildNodes()) {
outputMsg.appendChild(document.createElement('br')) outputMsg.appendChild(document.createElement('br'))
@ -886,7 +888,9 @@ function createTask(task) {
task['progressBar'] = taskEntry.querySelector('.progress-bar') task['progressBar'] = taskEntry.querySelector('.progress-bar')
task['stopTask'] = taskEntry.querySelector('.stopTask') task['stopTask'] = taskEntry.querySelector('.stopTask')
task['stopTask'].addEventListener('click', (e) => { shiftOrConfirm(e, "Are you sure? Should this task be stopped?", async function(e) { task['stopTask'].addEventListener('click', (e) => {
let question = (task['isProcessing'] ? "Stop this task?" : "Remove this task?")
shiftOrConfirm(e, question, async function(e) {
if (task['isProcessing']) { if (task['isProcessing']) {
task.isProcessing = false task.isProcessing = false
task.progressBar.classList.remove("active") task.progressBar.classList.remove("active")
@ -903,7 +907,8 @@ function createTask(task) {
removeTask(taskEntry) removeTask(taskEntry)
} }
})}) })
})
task['useSettings'] = taskEntry.querySelector('.useSettings') task['useSettings'] = taskEntry.querySelector('.useSettings')
task['useSettings'].addEventListener('click', function(e) { task['useSettings'].addEventListener('click', function(e) {
@ -1054,14 +1059,14 @@ function removeTask(taskToRemove) {
} }
} }
clearAllPreviewsBtn.addEventListener('click', (e) => { shiftOrConfirm(e, "Are you sure? Remove all results and tasks from the results pane?", async function() { clearAllPreviewsBtn.addEventListener('click', (e) => { shiftOrConfirm(e, "Clear all the results and tasks in this window?", async function() {
await stopAllTasks() await stopAllTasks()
let taskEntries = document.querySelectorAll('.imageTaskContainer') let taskEntries = document.querySelectorAll('.imageTaskContainer')
taskEntries.forEach(removeTask) taskEntries.forEach(removeTask)
})}) })})
stopImageBtn.addEventListener('click', (e) => { shiftOrConfirm(e, "Are you sure? Do you want to stop all the tasks?", async function(e) { stopImageBtn.addEventListener('click', (e) => { shiftOrConfirm(e, "Stop all the tasks?", async function(e) {
await stopAllTasks() await stopAllTasks()
})}) })})