Hi Phil
I want to mention a fault I've found in the Javascript handling in GuideMe. I'm getting some odd results because GuideMe is remembering JS functions from previous pages.
Let me explain in more detail, with some simplified scripts of what I'm trying to do. First, say I have the following global Javascript:
Code: Select all
<GlobalJavascript> <![CDATA[ function commonPageLoad() { if (typeof PageExit === 'function') { PageExit(); } else { scriptVars.put("strText","Boring default text."); }; } ]]> </GlobalJavascript>
The idea is that I don't need to define the PageExit function on every page. But if it's there, it'll run it.
Now here are some sample pages:
Code: Select all
<Page id="6"> <Text> <p class="text">Page 6 Text! <span>strText</span></p> </Text> <Image id="host006.jpg"/> <javascript> <![CDATA[ function pageLoad() { commonPageLoad(); } ]]> </javascript> </Page> <Page id="7"> <Text> <p class="text">Page 7 Text! <span>strText</span></p> </Text> <Image id="host007.jpg"/> <javascript> <![CDATA[ function pageLoad() { commonPageLoad(); } function PageExit() { scriptVars.put("strText","Exciting different text."); } ]]> </javascript> </Page> <Page id="8"> <Text> <p class="text">Page 8 Text! <span>strText</span></p> </Text> <Image id="host008.jpg"/> <javascript> <![CDATA[ function pageLoad() { commonPageLoad(); } ]]> </javascript> </Page>
The results of the text on each page that I expect to see are:
Code: Select all
Page 6 Text! Boring default text.Page 7 Text! Exciting different text.Page 8 Text! Boring default text.
But what I get is this:
Code: Select all
Page 6 Text! Boring default text.Page 7 Text! Exciting different text.Page 8 Text! Exciting different text.
So on page 8 when the typeof PageExit is tested, it sees PageExit as a function, instead of it being undefined. Not only that, but it then goes on to run the PageExit function from page 7.
But that's not all. If I restart and/or reload the guide, GuideMe still remembers the PageExit function, so page 6 then goes and runs it too!! Like this:
Code: Select all
Page 6 Text! Exciting different text.Page 7 Text! Exciting different text.Page 8 Text! Exciting different text.
Only when I terminate GuideMe and relaunch it does it finally "forget" PageExit and the Guide treats it as not existing until it gets to page 7 again.
When I look in the JS log, it only lists the GlobalJavascript code and the code from the current page. So for pages 6 and 8, PageExit() is nowhere to be seen in the JS log. Yet they still manage to run it anyway.
So, can you have a little look and see if you can figure out what GuideMe is doing.
If I had to speculate it's like the Javascript is being cached somehow ... maybe. If so, that cache might need purging between pages and definitely on reloads and restarts.
Also, not wishing to detract from the issue above, but one more thing to aid testing would be to add a Reload option to the File menu to reload the current Guide. As it is now you have to click open, navigate to the right folder, scroll all the way down and find the xml file of the Guide you're working on, which is all slow and laborious. A simple shortcut in the menu to reload the current Guide would be so much better.
Anyway, thanks in advance.
P.S. I'm using GuideMe v0.1.1 64bit on Windows 7.