main.js 777 B

1234567891011121314151617181920
  1. $(document).ready(function(){
  2. setActionTypeList($('select[name="eventType"]').attr('value'));
  3. });
  4. function setActionTypeList(type){
  5. if($('select[name="eventTarget"]').val()=='server'){
  6. $('select[name="eventType"]').html(
  7. '<option '+(type=='command'?'selected="selected"':'')+'value="command">Exécuter une commande</option>'+
  8. '<option '+(type=='gpio'?'selected="selected"':'')+'value="gpio">Changer un etat GPIO</option>'
  9. );
  10. }else{
  11. $('select[name="eventType"]').html(
  12. '<option '+(type=='talk'?'selected="selected"':'')+'value="talk">Parler</option>'+
  13. '<option '+(type=='command'?'selected="selected"':'')+'value="command">Executer une commande</option>'+
  14. '<option '+(type=='sound'?'selected="selected"':'')+'value="sound">Jouer un son</option>'
  15. );
  16. }
  17. }