开发者

fixing ESPNConversations (add pause button)

Its their new discussion board. (http://espn.go.com/nba/conversation?id=310605006) The problem is, the real time updates keep adding new comments so it keeps scrolling away from whatever you're reading, for example right after a game when thousands of people ar开发者_开发百科e adding comments. Its really ridiculous. So just trying to write a greasemonkey script where you can hit a button and it will pause the board updates.

The pause function is what I don't know - what is the most basic straightforward way to do that - something that temporarily disables ajax or the like I'm thinking, but anything that works. (Don't know for sure its ajax they're using.)


There is no set way to pause AJAX. It all depends on the page details.

In this case, that page pauses updates when you mouse over the conversation area. And that page uses jQuery and the Echo Stream library.

So you could have your script create a button that sends mouseover 1 events (toggling to send mouseout to clear).

To pause the comments from the Firebug console:

jQuery ('div.echo-stream-body').mouseover ();



To pause the comments from a Greasemonkey script:

unsafeWindow.jQuery ('div.echo-stream-body').mouseover ();



Hopefully that's enough to get you started.

For help writing a script from scratch for that page, try the userscripts.org forum.

For specific code problems, we can help here (in another question).



1 Or you could probably find the function that echo stream fires on hover events and hook in directly.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜