Subversion Repositories HomeAutomation

Rev

Blame | Last modification | View Log | SVN | RSS feed

  1.  
  2. pages.flipswitches = {
  3.   init: function(pageInstance)
  4.   {
  5.     pageInstance.pageFlipswitchElements = {};
  6.  
  7.     jQuery.each(pageInstance.flipswitches, function(n, arr)
  8.     {
  9.     pageInstance.pageFlipswitchElements["flipswitch" + n] = $("#page-flipswitches-flipswitch-template").tmpl({idx: n, lbl: arr[0]}).appendTo(pageInstance.pageContentElement).trigger("create");
  10.  
  11.         $('#flipswitch' + n).bind('change', function() {
  12.                 if (jQuery(this).val() == "on") {
  13.                         sendCommand("IROut_SendBurst('"+pageInstance.aliases[0]+"','"+arr[1]+"','"+arr[2]+"');");
  14.                 }
  15.                 else {
  16.             sendCommand("IROut_SendBurst('"+pageInstance.aliases[0]+"','"+arr[1]+"','"+arr[3]+"');");
  17.                         //sendCommand("IROut_SendBurst(pageInstance.aliases[0],arr[1],arr[3]);");
  18.                 }
  19.                 //alert("mu");
  20.                 //$("#notification" + n).append('change event detected with this value: ' + jQuery(this).val() + '<BR>');
  21.                 //event.preventDefault();
  22.           });
  23.     });
  24.   }
  25.  
  26. //    pageInstance.pageFlipswitchElements = $("#page-flipswitches-flipswitch-template").tmpl().appendTo(pageInstance.pageContentElement).trigger("create");
  27. /*
  28. .find("flipswitch").bind("change", function()
  29.     {
  30.         if (jQuery(this).val() == "on") {
  31.             sendCommand("IROut_SendBurst('RFLaundryAlias','FR002T','A_A_I_1_On');");
  32.         }
  33.         else {
  34.             sendCommand("IROut_SendBurst('RFLaundryAlias','FR002T','A_A_I_1_Off');");
  35.         }
  36.         //alert("mu");
  37.         $("#notification").append('change event detected with this value: ' + jQuery(this).val() + '<BR>');
  38.         event.preventDefault();
  39.         });
  40. */
  41. /*
  42.     $('#flipswitch').bind('change', function() {
  43.       if (jQuery(this).val() == "on") {
  44.                         sendCommand("IROut_SendBurst('RFLaundryAlias','FR002T','A_A_I_1_On');");
  45.                 }
  46.                 else {
  47.                         sendCommand("IROut_SendBurst('RFLaundryAlias','FR002T','A_A_I_1_Off');");
  48.                 }
  49.                 //alert("mu");
  50.                 $("#notification").append('change event detected with this value: ' + jQuery(this).val() + '<BR>');
  51.                 //event.preventDefault();
  52.           });
  53. */
  54.  
  55. /*
  56.     jQuery.each(pageInstance.buttons, function(button, command)
  57.     {
  58.       pageInstance.pageButtonElements[button] = $("#page-buttons-button-template").tmpl({ button: button }).appendTo(pageInstance.pageContentElement).trigger("create").find("button").on("click", function(event)
  59.       {
  60.         sendCommand(command);
  61.  
  62.         event.preventDefault();
  63.       });
  64.     });
  65. */
  66.   //}
  67. };
  68.