问题
Greasemonkey plugin. (js/ajax, jquery optional).
- Want to autoupdate forum pages when they get changed (new posts, for instance). Ideally with no page refresh.
- Additionally, if I can make it load multi-page threads in one page (when applicable, perfect).
- Don't want to lose content in response boxes if there's any text in them.
- Site: Paizo.com.
How would you guys go about doing this?
回答1:
loop GM_xmlhttpRequest to get the forum page in a 15 minutes interval.
save the response, and compare with the last one.
keep only the content that was added, and display it any way you see fit (i would use a div).
in this example here you can see how to use GM_xmlhttpRequest, create a DIV on the fly, store the desired content into it, and use its data as a parameter to request another page with GM_xmlhttpRequest again, repeating the cycle.
if you want me to explain the script, let me know.
来源:https://stackoverflow.com/questions/7945746/how-to-autoupdate-a-forum-thread-when-new-posts