Erledigt
Hallo,
meine Anfrage hat sich erledigt. Es geht doch!
Hallo,
meine Anfrage hat sich erledigt. Es geht doch!
/* =========== lighton ============== */ $(document).delegate('span[data-widget="lighton.test"]',{ update:function(d,a){ $("#"+this.id+" img").attr("src",a==$(this).attr("data-val-on")?$(this).attr("data-pic-on"):$(this).attr("data-pic-off")); if (a == $(this).attr('data-val-on')) { $('#' + this.id).show(); } else { $('#' + this.id).hide(); } }, click:function(d){ $("#"+this.id+" img").attr("src")==$(this).attr("data-pic-off")?io.write($(this).attr("data-item"),$(this).attr("data-val-on")):io.write($(this).attr("data-item"),$(this).attr("data-val-off")) } });
/** * A switch, build of two pics * * @param unique id for this widget * @param a item * @param the text, printed when gad has value val (optional) * @param the pic for the 'on' state (optional) * @param the pic for the 'off' state (optional) * @param value send for the 'on' state (optional, default 1) * @param value send for the 'off' state (optional, default 0) */ {% macro test(id, item, txt, pic_on, pic_off, val_on, val_off) %} {% set uid = uid(page, id) %} <span id="{{ uid }}" data-widget="lighton.test" data-item="{{ item }}" data-val-on="{{ val_on|default('1') }}" data-val-off="{{ val_off|default('0') }}" data-pic-on="{{ pic_on|deficon('control_on_off.svg') }}" data-pic-off="{{ pic_off|deficon('control_on_off.svg') }}" class="switch"> <a class="icon1"> <img class="icon icon1" src="{{ pic_on|deficon('control_on_off.svg') }}" /> </a> {{ txt}} <br> </span> <!-- <span id="{{ uid(page, id) }}" data-widget="lighton.test" data-item="{{ gad }}" data-val-on="{{ val_on|default('1') }}" data-val-off="{{ val_off|default('0') }}" data-pic-on="{{ pic_on|default('control_on_off.png') }}" data-pic-off="{{ pic_off|default('control_on_off.png') }}" class="switch"><a><img class="icon" src="{{ pic_off|default('control_on_off.png') }}" /></a>{{ txt}} <br> </span> --> {% endmacro %}
{% import "widget_lighton.html" as lighton %}
{{ lighton.test('checkEG.Eingang.Decke', 'EG.Eingang.Decke', 'Decke Eingang', 'light_corridor.svg', 'light_corridor.svg') }}
/** * A switch with some descriptive text behind * Only if the switch has a defined state the switch will be shown. * Otherwise it will be hidden. In addition the switch can get used to trigger an operation on the switch itself * * @param unique id for this widget * @param a gad/item * @param the text, printed when gad has value val (optional) * @param the pic to be shown when filter value is reached * @param the val_filter in case the item has this value the pic will be shown * @param value send for the 'on' state (optional, default 1) * @param value send for the 'off' state (optional, default 0) * @param the color 'icon1' or e. g. '#f00' for red (default 'icon0' of the design) */ {% macro hiddenswitch(id, item, txt, pic, val_filter, val_on, val_off, color) %} {% set uid = uid(page, id) %} {% import _self as basic %} <span id="{{ uid(page, id) }}" data-widget="basic.hiddenswitch" data-item="{{ item }}" data-val-filter="{{ val_filter|default('1') }}" data-val-on="{{ val_on|default('1') }}" data-val-off="{{ val_off|default('0') }}" data-pic="{{ pic|deficon('control_on_off.svg') }}" > <a> {{ basic._icon(pic|deficon('control_on_off.svg'), color, uid) }} </a> {{ txt}} <br> </span> {% endmacro %}
// ----- basic.hiddenswitch -------------------------------------------------------- $.mobile.activePage.find('span[data-widget="basic.hiddenswitch"]').on({ update:function(event,response){ event.stopPropagation(); $(this).val(response); $(this).trigger('draw'); }, 'draw': function(event) { event.stopPropagation(); if($(this).val() == $(this).attr('data-val-filter')) { $(this).show(); } else { $(this).hide(); } }, click:function(d){ io.write($(this).attr('data-item'), ($(this).val() == $(this).attr('data-val-off') ? $(this).attr('data-val-on') : $(this).attr('data-val-off')) ); } }); // ----- basic.hiddenswitch -------------------------------------------------------- $.mobile.activePage.find('span[data-widget="basic.hiddenswitch"] > a > img', 'hover').on(function (d, a) { if (event.type === 'mouseenter') { $(this).addClass("ui-focus"); } else { $(this).removeClass("ui-focus"); } });
$.mobile.activePage.find('span[data-widget="basic.hiddenswitch"]').on({update:function(event,response){event.stopPropagation();$(this).val(response);$(this).trigger('draw');},'draw':function(event){event.stopPropagation();if($(this).val() == $(this).attr('data-val-filter')){$(this).show();}else{$(this).hide();}},click:function(d){io.write($(this).attr('data-item'),($(this).val()==$(this).attr('data-val-off')?$(this).attr('data-val-on'):$(this).attr('data-val-off')));}}),$.mobile.activePage.find('span[data-widget="basic.hiddenswitch"]>a>img','hover').on(function(d,a){if(event.type==='mouseenter'){$(this).addClass("ui-focus");}else{$(this).removeClass("ui-focus");}}),
{{ basic.hiddenswitch('OG.Schlafzimmer.Licht.On', 'OG.Schlafzimmer.Licht', 'Schlafzimmer', 'light_light.svg', '1', '1', '0', 'icon1') }} {{ basic.hiddenswitch('OG.Diele.Licht.On', 'OG.Diele.Licht', 'Diele OG', 'light_light.svg', '1', '1', '0', 'icon1') }} {{ basic.hiddenswitch('OG.Diele.LichtWand.On', 'OG.Diele.LichtWand', 'Diele OG Wand', 'light_light.svg', '1', '1', '0', 'icon1') }} ...
{{ basic.hiddenswitch('OG.Schlafzimmer.Steckdose.Off', 'OG.Schlafzimmer.Steckdose', 'Schlafzimmer', 'message_socket.svg', '0', '1', '0', 'icon0') }} {{ basic.hiddenswitch('OG.Arbeitszimmer.Steckdose.Off', 'OG.Arbeitszimmer.Steckdose', 'Arbeitszimmer', 'message_socket.svg', '0', '1', '0', 'icon0') }} {{ basic.hiddenswitch('OG.Leo.Steckdose.Off', 'OG.Leo.Steckdose', 'Leo', 'message_socket.svg', '0', '1', '0', 'icon0') }} ...
Wir verarbeiten personenbezogene Daten über die Nutzer unserer Website mithilfe von Cookies und anderen Technologien, um unsere Dienste bereitzustellen. Weitere Informationen findest Du in unserer Datenschutzerklärung.
Indem Du unten auf "ICH stimme zu" klickst, stimmst Du unserer Datenschutzerklärung und unseren persönlichen Datenverarbeitungs- und Cookie-Praktiken zu, wie darin beschrieben. Du erkennst außerdem an, dass dieses Forum möglicherweise außerhalb Deines Landes gehostet wird und bist damit einverstanden, dass Deine Daten in dem Land, in dem dieses Forum gehostet wird, gesammelt, gespeichert und verarbeitet werden.
Kommentar