748 ], |
748 ], |
749 url: 'includes/db_profile_mash.php' |
749 url: 'includes/db_profile_mash.php' |
750 }, |
750 }, |
751 mashlist = new $.jqx.dataAdapter(mashProfileSource); |
751 mashlist = new $.jqx.dataAdapter(mashProfileSource); |
752 |
752 |
|
753 /* Websocket interface. Place "websocket.onmessage = function(evt) {}" in the user script. */ |
|
754 var websocket = new WebSocket('ws://'+location.hostname+'/ws'); |
|
755 |
|
756 websocket.onopen = function(evt) { |
|
757 console.log('WebSocket connection opened'); |
|
758 $('#wsstatus').html('WebSocket open'); |
|
759 } |
|
760 |
|
761 websocket.onclose = function(evt) { |
|
762 console.log('Websocket connection closed'); |
|
763 $('#wsstatus').html('WebSocket closed'); |
|
764 } |
|
765 |
|
766 websocket.onerror = function(event) { |
|
767 console.log('Websocket error: ' + event.data); |
|
768 $('#wsstatus').html('WebSocket error: ' + event.data); |
|
769 } |
|
770 |
|
771 /* Handle global menu manipulation called by the user script. */ |
|
772 function ws_global(msg) { |
|
773 |
|
774 } |
753 |
775 |
754 |
776 |
755 $(document).ready(function() { |
777 $(document).ready(function() { |
756 |
778 |
757 $('#jqxMenu').jqxMenu({ |
779 $('#jqxMenu').jqxMenu({ |
760 autoOpen: false, |
782 autoOpen: false, |
761 clickToOpen: true, |
783 clickToOpen: true, |
762 theme: theme |
784 theme: theme |
763 }); |
785 }); |
764 $('#jqxWidget').css('visibility', 'visible'); |
786 $('#jqxWidget').css('visibility', 'visible'); |
765 |
|
766 var websocket = new WebSocket('ws://'+location.hostname+'/ws'); |
|
767 |
|
768 websocket.onopen = function(evt) { |
|
769 console.log('WebSocket connection opened'); |
|
770 document.getElementById("wsstatus").innerHTML = ""; |
|
771 } |
|
772 |
|
773 websocket.onmessage = function(evt) { |
|
774 var msg = evt.data; |
|
775 var value; |
|
776 |
|
777 console.log('ws got: ' + msg); |
|
778 // switch (msg.charAt(0)) { |
|
779 // case '{': |
|
780 // BrewBoard.p_msg(evt.data); |
|
781 // break; |
|
782 // default: |
|
783 // document.getElementById("output").innerHTML = evt.data; |
|
784 // break; |
|
785 // } |
|
786 } |
|
787 |
|
788 websocket.onclose = function(evt) { |
|
789 console.log('Websocket connection closed'); |
|
790 // $('#wsstatus').html('WebSocket closed'); |
|
791 } |
|
792 |
|
793 websocket.onerror = function(event) { |
|
794 console.log('Websocket error: ' + event.data); |
|
795 $('#wsstatus').html('WebSocket error: ' + event.data); |
|
796 } |
|
797 }); |
787 }); |
798 |
788 |
799 |
789 |
800 |
790 |
801 function Round(n, d) { |
791 function Round(n, d) { |