Created
February 9, 2012 10:22
-
-
Save deanhume/1779089 to your computer and use it in GitHub Desktop.
Blog TinyCon
This file contains hidden or 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
<input type="hidden" id="blogCount" name="blogCount" value="<%= TempData["TotalPageCount"] %>" /> | |
<script type="text/javascript"> | |
// Check if user can handle localStorage first. | |
if (typeof (localStorage) != 'undefined') { | |
GetCount(); | |
} | |
function GetCount() { | |
// Get the last value | |
var blogCount = localStorage.getItem('blogCount'); | |
// If null, then set it | |
if (blogCount == null) { | |
localStorage.setItem("blogCount", document.getElementById('blogCount').value); //saves to the database, "key", "value" | |
} else { | |
// If not null then check the last count and compare | |
var result = document.getElementById('blogCount').value - blogCount; | |
// If different, then show the favicon bubble | |
if (result > 0) { | |
if (result != document.getElementById('blogCount').value) { | |
window.Tinycon.setBubble(result); | |
// Re-add to localStorage | |
localStorage.setItem("blogCount", document.getElementById('blogCount').value); //saves to the database, "key", "value" | |
} | |
} | |
} | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment