-
-
Save seb-thomas/4978749 to your computer and use it in GitHub Desktop.
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
| var dateUpdated = ""; | |
| var reDate = /(\d+)\/(\d+)\/(\d+)/; | |
| var titleDate = jQuery('p.author a').last().attr('title'); | |
| var favi = jQuery('[rel="shortcut icon"]'); | |
| //Swap year and day, convert to Date obj | |
| titleDate = (titleDate).replace(reDate, "$3/$2/$1"); | |
| titleDate = new Date(titleDate); | |
| function changeTitle() { | |
| jQuery.get( | |
| location.pathname + '.json', | |
| function(data){ | |
| dateUpdated = data.issue.updated_on; | |
| dateUpdated = new Date(dateUpdated); | |
| dateUpdated.setSeconds(0); | |
| console.log(dateUpdated.getTime(), dateUpdated, ' Time stamp on server'); | |
| console.log(titleDate.getTime(), titleDate); | |
| console.log('------------------------------------------------'); | |
| if (dateUpdated.getTime() > titleDate.getTime()) { | |
| //If theres a time diff, change the favicon | |
| favi.attr('href', 'http://cdn.dustball.com/time_add.png'); | |
| }else{ | |
| //If not, keep checking, dammit! | |
| setTimeout(changeTitle, 30000); | |
| } | |
| } | |
| ); | |
| } | |
| changeTitle() |
Author
I cannot! Don't know why, syntax selector is disabled.
Made another one. Hopefully that fixes the name too
https://gist.github.com/sebastianthomas/4984941#file-gistfile1-js
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Set the syntax to javascript!