Created
August 22, 2010 08:36
-
-
Save rtanglao/543534 to your computer and use it in GitHub Desktop.
last 5 topics updated in place
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
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <body> | |
| <ol> | |
| <div class="d1"></div> | |
| <div class="d2"></div> | |
| <div class="d3"></div> | |
| <div class="d4"></div> | |
| <div class="d5"></div> | |
| </ol> | |
| <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" ></script> | |
| <script> | |
| (function($){ | |
| $.ajaxSetup({ | |
| cache: false // turn off AJAX caching so you actually get the top 5! | |
| }); | |
| function doIt(){ | |
| $.getJSON("http://api.getsatisfaction.com/products/mozilla_thunderbird/topics.json?sort=recently_active&limit=5&callback=?", | |
| function(gsjs){ //gsjs is the JSON object from getsatisfaction | |
| localDate = new Date(); | |
| $('.d1').replaceWith("<div class=\"d1\"><p>Last Updated:<b>"+ localDate.toLocaleString() + | |
| "</b></p><li><a href=\""+gsjs.data[0].at_sfn + "\">"+ gsjs.data[0].subject + "</a></li></div>"); | |
| $('.d2').replaceWith("<div class=\"d2\"><li><a href=\""+gsjs.data[1].at_sfn + "\">"+ gsjs.data[1].subject + "</a></li></div>"); | |
| $('.d3').replaceWith("<div class=\"d3\"><li><a href=\""+gsjs.data[2].at_sfn + "\">"+ gsjs.data[2].subject + "</a></li></div>"); | |
| $('.d4').replaceWith("<div class=\"d4\"><li><a href=\""+gsjs.data[3].at_sfn + "\">"+ gsjs.data[3].subject + "</a></li></div>"); | |
| $('.d5').replaceWith("<div class=\"d5\"><li><a href=\""+gsjs.data[4].at_sfn + "\">"+ gsjs.data[4].subject + "</a></li></div>"); | |
| }); | |
| setTimeout(doIt, 32000); | |
| }; | |
| setTimeout(doIt, 1000); | |
| })(jQuery); | |
| </script> | |
| </body> | |
| </html> |
Author
Author
Oops forgot to mention step 0:
Change mozilla_thunderbird in the file to the Get Satisfaction name of your product e.g. songbird or whatever!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To use this gist:
last5gs.updateinplace.html
There is no step 3 :-)