mirror of
https://github.com/vladmandic/automatic
synced 2026-09-05 04:20:44 +02:00
Changed modification indicator to button element
The setting value now resets to previous when clicking on the indicator. Furthermore, when hovering over the indicator it also shows what the last value was.
This commit is contained in:
+7
-3
@@ -258,11 +258,15 @@ onOptionsChanged(function(){
|
||||
})
|
||||
|
||||
function markIfModified(setting_name, value) {
|
||||
elem = gradioApp().getElementById("setting_"+setting_name)
|
||||
elem = gradioApp().getElementById("modification_indicator_"+setting_name)
|
||||
if(elem == null) return;
|
||||
// Use JSON.stringify to compare nested objects (e.g. arrays for checkbox-groups)
|
||||
let is_new_value = JSON.stringify(value) != JSON.stringify(opts[setting_name])
|
||||
elem.classList.toggle("modified", is_new_value)
|
||||
let previous_value_json = JSON.stringify(opts[setting_name])
|
||||
let is_new_value = JSON.stringify(value) != previous_value_json
|
||||
elem.disabled = !is_new_value
|
||||
if (is_new_value) {
|
||||
elem.title = `Changed from previous value: ${previous_value_json}`
|
||||
}
|
||||
}
|
||||
|
||||
let txt2img_textarea, img2img_textarea = undefined;
|
||||
|
||||
Reference in New Issue
Block a user