Skip to content

Commit 7a7bb5b

Browse files
authored
Update fast-search-card.js
1 parent d6a148d commit 7a7bb5b

File tree

1 file changed

+36
-12
lines changed

1 file changed

+36
-12
lines changed

dist/fast-search-card.js

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10043,18 +10043,42 @@ class FastSearchCard extends HTMLElement {
1004310043
}
1004410044

1004510045
getPresetIconForAction(action) {
10046-
// Icons die zu den Timer-Preset-Buttons passen
10047-
if (action.includes('Einschalten') || action.includes('💡')) {
10048-
return `<svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="M9 12l2 2 4-4"></path><circle cx="12" cy="12" r="9"></circle></svg>`;
10049-
} else if (action.includes('Ausschalten') || action.includes('🔴')) {
10050-
return `<svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>`;
10051-
} else if (action.includes('30%') || action.includes('🌙')) {
10052-
return `<svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><circle cx="12" cy="12" r="5"></circle></svg>`;
10053-
} else if (action.includes('50%') || action.includes('🌗')) {
10054-
return `<svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10z"></path></svg>`;
10055-
} else {
10056-
return `<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor"><circle cx="12" cy="12" r="10"></circle><polyline points="12,6 12,12 16,14"></polyline></svg>`;
10057-
}
10046+
// Bestimme welche Preset-Funktion und welche Action
10047+
let presetHTML = '';
10048+
10049+
if (action.includes('Einschalten') || action.includes('Ein')) {
10050+
presetHTML = this.getLightTimerPresets(); // Hole komplettes HTML
10051+
// Extrahiere SVG aus turn_on Button
10052+
const match = presetHTML.match(/data-action="turn_on"[^>]*>(.*?)<span class="timer-preset-label">/s);
10053+
if (match) {
10054+
const svgMatch = match[1].match(/<svg[^>]*>.*?<\/svg>/s);
10055+
return svgMatch ? svgMatch[0].replace('width="24"', 'width="16"').replace('height="24"', 'height="16"') : '';
10056+
}
10057+
} else if (action.includes('Ausschalten') || action.includes('Aus')) {
10058+
presetHTML = this.getLightTimerPresets();
10059+
const match = presetHTML.match(/data-action="turn_off"[^>]*>(.*?)<span class="timer-preset-label">/s);
10060+
if (match) {
10061+
const svgMatch = match[1].match(/<svg[^>]*>.*?<\/svg>/s);
10062+
return svgMatch ? svgMatch[0].replace('width="24"', 'width="16"').replace('height="24"', 'height="16"') : '';
10063+
}
10064+
} else if (action.includes('30%')) {
10065+
presetHTML = this.getLightTimerPresets();
10066+
const match = presetHTML.match(/data-action="dim_30"[^>]*>(.*?)<span class="timer-preset-label">/s);
10067+
if (match) {
10068+
const svgMatch = match[1].match(/<svg[^>]*>.*?<\/svg>/s);
10069+
return svgMatch ? svgMatch[0].replace('width="24"', 'width="16"').replace('height="24"', 'height="16"') : '';
10070+
}
10071+
} else if (action.includes('50%')) {
10072+
presetHTML = this.getLightTimerPresets();
10073+
const match = presetHTML.match(/data-action="dim_50"[^>]*>(.*?)<span class="timer-preset-label">/s);
10074+
if (match) {
10075+
const svgMatch = match[1].match(/<svg[^>]*>.*?<\/svg>/s);
10076+
return svgMatch ? svgMatch[0].replace('width="24"', 'width="16"').replace('height="24"', 'height="16"') : '';
10077+
}
10078+
}
10079+
10080+
// Fallback
10081+
return `<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor"><circle cx="12" cy="12" r="10"></circle><polyline points="12,6 12,12 16,14"></polyline></svg>`;
1005810082
}
1005910083

1006010084
getNextExecution(timer) {

0 commit comments

Comments
 (0)