MCPcopy Index your code
hub / github.com/easydiffusion/easydiffusion / initSettings

Function initSettings

ui/media/js/auto-save.js:83–117  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

81]
82
83async function initSettings() {
84 SETTINGS_IDS_LIST.forEach((id) => {
85 var element = document.getElementById(id)
86 if (!element) {
87 console.error(`Missing settings element ${id}`)
88 }
89 if (id in SETTINGS) {
90 // don't create it again
91 return
92 }
93 SETTINGS[id] = {
94 key: id,
95 element: element,
96 label: getSettingLabel(element),
97 default: getSetting(element),
98 value: getSetting(element),
99 ignore: IGNORE_BY_DEFAULT.includes(id),
100 }
101 element.addEventListener("input", settingChangeHandler)
102 element.addEventListener("change", settingChangeHandler)
103 })
104 var unsorted_settings_ids = [...SETTINGS_IDS_LIST]
105 SETTINGS_SECTIONS.forEach((section) => {
106 var name = section.name
107 var element = document.getElementById(section.id)
108 var unsorted_ids = unsorted_settings_ids.map((id) => `#${id}`).join(",")
109 var children = unsorted_ids == "" ? [] : Array.from(element.querySelectorAll(unsorted_ids))
110 section.keys = []
111 children.forEach((e) => {
112 section.keys.push(e.id)
113 })
114 unsorted_settings_ids = unsorted_settings_ids.filter((id) => children.find((e) => e.id == id) == undefined)
115 })
116 loadSettings()
117}
118
119function getSetting(element) {
120 if (element.dataset && "path" in element.dataset) {

Callers

nothing calls this directly

Calls 5

getSettingLabelFunction · 0.85
getSettingFunction · 0.85
loadSettingsFunction · 0.85
pushMethod · 0.80
addEventListenerMethod · 0.45

Tested by

no test coverage detected