Author |
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: January 20 2008 at 12:55 | IP Logged
|
|
|
I finally got around to getting some of my PSP pages to not refresh when actions are initiated.
The standard, multi-file frames-page setup is not necessary. You can just drop an iframe into a page and target that.
Code:
<iframe name="mt" src="/ph-cgi/blank" FRAMEBORDER=0 width="1" height="1"></iframe>
<form method="post" name="evalformula" action="/ph-cgi/evalformula" target="mt">
<input type="hidden" name="formula" value="">
<input type="hidden" name="nexturl" value="/ph-cgi/blank">
</form> |
|
|
Not a huge revelation, but it helps!
|
Back to Top |
|
|
raven77 Groupie
Joined: January 02 2007 Location: United States
Online Status: Offline Posts: 44
|
Posted: January 20 2008 at 14:08 | IP Logged
|
|
|
Why would you not want them to refresh?
|
Back to Top |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: January 20 2008 at 16:20 | IP Logged
|
|
|
This is just to keep the screen from flashing (redrawing) when not necessary. It's too distracting to me. The plan is to use JavaScript to only update what needs to be updated.
My next step is to pull data from PH into the iframe (which is not visible) and update the visible portion of the page.
The master plan is to move away from a web-based front end for easier screen creation and maintenance.
|
Back to Top |
|
|
onhiatus Senior Member
Joined: May 12 2004 Location: United States
Online Status: Offline Posts: 279
|
Posted: January 21 2008 at 12:32 | IP Logged
|
|
|
All my pages work this way. I have a hidden data frame that I use to refresh elements on my display page.
One big hint to avoid syncing issues: Have the data page itself trigger the refresh. So the data page (being loaded into my hidden data frame) uses the "onload" method in the body tag: <BODY onload="parent.doUpdate();">
I use span elements in the data page and in the display page and use matching ids - so my data page looks something like (file is called '770data.psp'):
<HTML>
<BODY onload="parent.doUpdate();">
<span id="data_timeStamp"><%ph_getglobal_s("G_DATA_VER") %></span>
<span id="data_X10State"><%ph_macroparmret("GET X10 STATE",0,0,0,0,0) %></span>
<span id="data_title"><%ph_getglobal_s("G_NP_TITLE") %></span>
<span id="data_artist"><%ph_getglobal_s("G_NP_ARTIST") %></span>
<span id="data_album"><%ph_getglobal_s("G_NP_ALBUM") %></span>
<span id="EndMarker">The End</span>
</BODY></HTML>
The striped down updater code (in the display page) looks something like:
function doUpdate ()
{
var sd = window.frames["dataFrame">;
// Make sure document is loaded:
if (sd==null) return;
// Check to see if data has changed:
if(sd.document.body.all[ "data_timeStamp">.innerHTML == dataLast) {
return;
}
for (var i = 0; i < sd.document.all.length-3; i++) {
var dataSrc = sd.document.body.all[ i >;
var dataId = dataSrc.id;
if (dataId != "") {
var dataDest = document.body.all[ dataId >;
var data = dataSrc.innerText;
data = data.replace(/</gi, "<");
data = data.replace(/>/gi, ">");
data = data.replace(/&/gi, "&");
if (dataSrc != null && dataDest != null) dataDest.innerHTML = data;
}
}
setTimeout("resetDataFra me('770data.psp')", 5000);
return;
}
NOTE: In the above code the square close brackets have been coverted to greater thans by the forum software!
The above code may not work as is - I've stripped it down a lot to make it easier to read. There are a lot of special things you have to do to update images, parse data, etc. But the above should work for updating text without flickering. I've tested the above code in IE, and Opera (what I use for my displays). The html entity resubstitution (e.g data.replace(/</gi, "<")) is not needed for ie, but Opera does not really use the "text" for innerText.
Another suggestion - my datapage got very large very quickly, and most data does not change that often so I put the time sensitive stuff on every data page (now playing and x10 switch status) and have a main page which included "versions" (time / date) stamps for each data page - when the version for a specific data page changes I load it into the data frame. I currently have 9 different data files (almanac, calendar, weather, bus arrivals, schedules, temperatures, etc.)
Hope this is useful for someone! Let me know if you have questions.
-Tony (OnHiatus)
|
Back to Top |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: January 21 2008 at 12:42 | IP Logged
|
|
|
I saw one of your old posts on this and read that I never got it to work in Firefox. Thanks for posting it again. I'll hit it once more.
|
Back to Top |
|
|
onhiatus Senior Member
Joined: May 12 2004 Location: United States
Online Status: Offline Posts: 279
|
Posted: January 22 2008 at 21:10 | IP Logged
|
|
|
So here is a "port" of my home control - a mock up that I've copied to the web as a demonstration.
Everything mostly works, except the data has been scrubed (so you can't read about my secret work meetings), and some data is static (the calendar, temperature, and weather station - though I'll try to echo those from the house in the near future).
Big caveat - this is written for Opera browsers only (the Nokia 770's browser will handle it though it's sluggish - works best on Desktop Opera). IE sort of works though the formatting is bad, Firefox does not really work at all, as if now I am not sure why
Anyway here it is: http://www.onhiatus.com/house/770home.htm
Usage Notes: You switch between screens by clicking on the box marked "home" in the upper left corner. Almost any area on any of the screens will bring up a menu, or more information. On the perpetual calendar page only Dec / Jan / Feb / Mar have any data - if you scroll through the months it takes many seconds to load the icons so be patient. Almost everything times out eventually, but can be "pinned" if you want it to stay - you pin/unpin a screen by selecting it again from the top popup menu.
If you delve into the code realize that it is extremely unorganized, un-optimized, etc - think spaghetti. If you have any questions / comments let me know!
-Tony
PS - All the data pages have been switched to html files because my server did not like the psp files. So in my home system the data files are served via powerhome to get the lastest stati.
|
Back to Top |
|
|
onhiatus Senior Member
Joined: May 12 2004 Location: United States
Online Status: Offline Posts: 279
|
Posted: August 19 2008 at 16:47 | IP Logged
|
|
|
In case anyone still cares - I've updated my demo port on the web - same caveats discussed above, but some new functionality
I'm going to start a new "brag" thread to talk about what does what where (slow time at work right now).
I use this with my Nokia 770 as a wall display (so 480x800 pixels). The 770 just rdps to my server where this runs in a fullscreen Opera instance
This now displays great in Opera 8 or above, Poorly but working in IE6, even poorer but still working in IE7, and does not work in Firefox
http://www.onhiatus.com/house/770home2.htm
|
Back to Top |
|
|
raven77 Groupie
Joined: January 02 2007 Location: United States
Online Status: Offline Posts: 44
|
Posted: October 04 2008 at 19:29 | IP Logged
|
|
|
TonyNo wrote:
This is just to keep the screen from flashing (redrawing) when not necessary. It's too distracting to me. The plan is to use JavaScript to only update what needs to be updated.
My next step is to pull data from PH into the iframe (which is not visible) and update the visible portion of the page.
The master plan is to move away from a web-based front end for easier screen creation and maintenance. |
|
|
I am using your code so my Iphone HTML page doesn't refresh after clicking a button. Did you ever come up with a way so ONLY the status updates on the page?
Here is a small part of my code...any ideas on how I can just update the status?
Thanks!
<form method="post" name="execsendkeys" action="/ph-cgi/execsendkeys" target="mt">
<input type="hidden" name="sendkeys" value="">
<input type="hidden" name="nexturl" value="/ph-cgi/blank">
</form>
<iframe name="mt" src="/ph-cgi/blank" FRAMEBORDER=0 width="0" height="0"></iframe>
<table border="0" cellpadding="1" cellspacing="0">
<tr>
<td valign=middle height="1" nowrap><font face="Verdana" size="4" color="#3399FF">
<b>Walkway Lights:</b>
<% case(ph_getinsteonstat("WALKLIGHTS") when 2 then '<font color="#00ff00">ON' else '<font color="#ff0000">OFF')
%>
</tr>
<tr>
<td align="left" valign=middle height="1">
<a onclick="sk('ph_rtne( ph_insteon( \'<%"WALKLIGHTS"%>\', ion, int(255)) )')"<img src="/touch/ON.gif" border=0 hspace=3 vspace=0></a>
<a onclick="sk('ph_rtne( ph_insteon( \'<%"WALKLIGHTS"%>\', ioff, 0))')"<img src="/touch/OFF.gif" border=0 hspace=3 vspace=0></a>
</td>
</tr>
|
Back to Top |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: October 04 2008 at 20:40 | IP Logged
|
|
|
I never took the time to figure it out after finding Tony's code didn't work in Firefox.
|
Back to Top |
|
|
raven77 Groupie
Joined: January 02 2007 Location: United States
Online Status: Offline Posts: 44
|
Posted: October 04 2008 at 20:50 | IP Logged
|
|
|
TonyNo wrote:
I never took the time to figure it out after finding Tony's code didn't work in Firefox.
|
|
|
that sucks! I have been doing some research on it, but I cant find a good way to do it!
|
Back to Top |
|
|
onhiatus Senior Member
Joined: May 12 2004 Location: United States
Online Status: Offline Posts: 279
|
Posted: October 06 2008 at 13:51 | IP Logged
|
|
|
I'll add that my page also does not work well with Chrome - which uses WebKit to render - same as Safari and the iPhone - so it's not so suuprising that it doesn't work well for the iPhone.
Having said that, the navigation does work, and the time does get updated - it's just the status parsing that has a problem. My guess is that should be easy to fix.
Try loading my demo page: http://www.onhiatus.com/house/770home.htm whith your iPhone. See if the clock (lower right corner) is updating - if it is, then you can do somehting like that to update without reloading.
Good luck, the other Tony
|
Back to Top |
|
|