forked from yui/yui3-gallery
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gallery-2011.08.03-21-18 nzakas gallery-idletimer
- Loading branch information
YUI Builder
committed
Aug 3, 2011
1 parent
9fa7f95
commit c814478
Showing
2 changed files
with
75 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<html> | ||
<head> | ||
<title>Idle Timer Example</title> | ||
<script src="http://yui.yahooapis.com/combo?3.3.0/build/yui/yui-min.js"></script> | ||
<script src="../../../build/gallery-idletimer/gallery-idletimer.js"></script> | ||
<body> | ||
<h1>Idle Timer Example</h1> | ||
<p>The idle timer is built on <a href="http://developer.yahoo.com/yui/3/">YUI 3</a> and provides two events: <code>idle</code> and <code>active</code>, which fire when the user's idle state has changed.</p> | ||
<p>This example has an idle timeout of 10 seconds. When you move your mouse over the page or start typing, you're considered "active". The status at the top of the screen changes to indicate your current state.</p> | ||
<div id="status" style="padding: 5px;"> </div> | ||
<form> | ||
<label for="comment">Comment:</label><br /> | ||
<textarea rows="10" cols="30" id="comment" name="comment"></textarea><br /> | ||
<input type="submit" value="Submit" /> | ||
</form> | ||
|
||
|
||
<script type="text/javascript"> | ||
|
||
YUI().use("event", "gallery-idletimer", function(Y){ | ||
|
||
Y.IdleTimer.subscribe("idle", function(){ | ||
console.log("IDLE"); | ||
Y.one("#status").set("innerHTML", "User is idle :(").set("style.backgroundColor", "silver"); | ||
}); | ||
|
||
Y.IdleTimer.subscribe("active", function(){ | ||
console.log("ACTIVE"); | ||
Y.one("#status").set("innerHTML", "User is active :D").set("style.backgroundColor", "yellow"); | ||
}); | ||
|
||
Y.IdleTimer.start(10000); | ||
}); | ||
|
||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters