Question

Hi everyone,

Is it possible to return to a certain state in the site after a certain time without mouse movement?

Thnx.
David


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Interesting question. Sounds a bit like a sort of “kiosk mode” but
without the browser support for that. To be fair, you’d have to test
for scroll, too, and maybe keydown or some other keystroke-related
event. The basic model for this is to set a timeout in JavaScript,
then save a handle to that timeout function. Then you listen for the
various events, and if you notice one, you call clearTimeout on the
timer (through the handle) and you start the timer again.

With Prototype in your page, you could do something like this:

var cleanup;
function runCleanup(){
	if(cleanup.clearTimeout) cleanup.clearTimeout();
	cleanup = window.setTimeout(''window.location.href="index.html"', 
10000);
};
runCleanup();
Event.Observe(window,keydown',runCleanup);
Event.Observe(window,'mousemove', runCleanup);
Event.Observe(window,'scroll',runCleanup);

You would either need to wrap that in an unobtrusive listener (which
you get automatically if you use Protaculous), or you would put it in
a script block near the bottom of the page, like right before /body.

I’m sure I’ve made some mistake in this somewhere, I usually do when
typing off the top of my head.

Walter

On Jun 12, 2011, at 3:34 PM, david Verbruggen wrote:

Hi everyone,

Is it possible to return to a certain state in the site after a
certain time without mouse movement?

Thnx.
David


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Yup, just looked over this, and noticed a missing single-quote in the
first listener. Change that to this:

Event.Observe(window,‘keydown’,runCleanup);

Walter

On Jun 12, 2011, at 4:02 PM, Walter Davis wrote:

Interesting question. Sounds a bit like a sort of “kiosk mode” but
without the browser support for that. To be fair, you’d have to test
for scroll, too, and maybe keydown or some other keystroke-related
event. The basic model for this is to set a timeout in JavaScript,
then save a handle to that timeout function. Then you listen for the
various events, and if you notice one, you call clearTimeout on the
timer (through the handle) and you start the timer again.

With Prototype in your page, you could do something like this:

var cleanup;
function runCleanup(){
	if(cleanup.clearTimeout) cleanup.clearTimeout();
	cleanup = window.setTimeout(''window.location.href="index.html"', 
10000);
};
runCleanup();
Event.Observe(window,keydown',runCleanup);
Event.Observe(window,'mousemove', runCleanup);
Event.Observe(window,'scroll',runCleanup);

You would either need to wrap that in an unobtrusive listener (which
you get automatically if you use Protaculous), or you would put it
in a script block near the bottom of the page, like right before /
body.

I’m sure I’ve made some mistake in this somewhere, I usually do when
typing off the top of my head.

Walter

On Jun 12, 2011, at 3:34 PM, david Verbruggen wrote:

Hi everyone,

Is it possible to return to a certain state in the site after a
certain time without mouse movement?

Thnx.
David


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options