fixing ESPNConversations (add pause button)

旧时模样 提交于 2019-12-12 16:31:50

问题


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 are 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.)


回答1:


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.



来源:https://stackoverflow.com/questions/6237066/fixing-espnconversations-add-pause-button

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!