It works, but i don┬┤t know how. http://www.eventghost.org/downloads/Webserver_Demo.zip
Do i need all the cryptic functions ?
What is "case" in the KeyDownHandler function ?
I like to build a webpage with a few nice buttons (png).
Like Play, Stop, Rewind and Forward.
How do i manage the detection of the clicked button ?
Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details
If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.
If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.
could anyone explain the Webserver demo file
Re: could anyone explain the Webserver demo file
You can trigger events using the webserver by sending the event name and payload as parameters of the http request. so the url will be something like http://localhost/?foo=bar&something=else.
In the example's html:
TriggerEvent is an utility function that constructs an appropriate URL and then sends an http request to it using an ajax(in the background).
For example, if you want to create an image that will trigger an event when clicked all you should need to do is run the TriggerEvent function, something like
The rest is related to handling keyboard input. Here a quick summary how that works in the example.
-jinxdone
In the example's html:
TriggerEvent is an utility function that constructs an appropriate URL and then sends an http request to it using an ajax(in the background).
For example, if you want to create an image that will trigger an event when clicked all you should need to do is run the TriggerEvent function, something like
Code: Select all
<img src="myimage.png" onClick="TriggerEvent('myevent');">- Pressing a key on your keyboard raises a javascript onkeydown event when the document is in focus
- The onkeydown event is bound to run the function KeyDownHandler()
- The 'event' parameter for KeyDownHandler contains information including a keycode of the key that was pressed (this is the event.which variable)
- In KeyDownHandler the switch...case statement runs a piece of code when event.which matches a certain value. The switch...case is basically a more convenient way of writing a long list of if..then..elseif statements.
- When you release a key on the keyboard it will send a "ButtonReleased" event.
-jinxdone
Re: could anyone explain the Webserver demo file
I have not looked into it but is there a function that will query EG for all the Macros and any Comment objects (or something similar) inside it?
It would be cool to have a web page that would auto generate a list of Macros and create buttons for them. The reason for the association is so that users could add a Comment to the Macro to exclude it from the list. I could do this by Macro name, but that is not very clean.
I have a similar page I made for my Homeseer app that I may be able to port over if this is possible. I was hoping that the Android app would do this but I'm not sure how much more development will be done on it.
It would be cool to have a web page that would auto generate a list of Macros and create buttons for them. The reason for the association is so that users could add a Comment to the Macro to exclude it from the list. I could do this by Macro name, but that is not very clean.
I have a similar page I made for my Homeseer app that I may be able to port over if this is possible. I was hoping that the Android app would do this but I'm not sure how much more development will be done on it.
setup... XBMC, W7MC for DVR & Live OTA TV, JRMC for multi-zone audio, EG, MiCasaVerde Vera3, USB-UIRT IR receiver, Harmony remote, 5.2 home theater system
Re: could anyone explain the Webserver demo file
This Triggerevent looks interesting.
I have testet this :
<a href="?music"><img src="music.jpg"></a>
This send "html.music" to EG. So it works, but the Navibar in Firefox show the output too.
I have testet this :
<a href="?music"><img src="music.jpg"></a>
This send "html.music" to EG. So it works, but the Navibar in Firefox show the output too.