GoBili

Keep trying go Live on live.bilibili.com

目前为 2015-06-08 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name GoBili
  3. // @namespace https://github.com/5long/gobili
  4. // @version 0.1.0
  5. // @description Keep trying go Live on live.bilibili.com
  6. // @author Whyme Lyu
  7. // @supportURL callme5long@gmail.com
  8. // @license https://github.com/5long/gobili/blob/master/UNLICENSE
  9. // @match http://live.bilibili.com/*
  10. // @grant none
  11. // @run-at document-idle
  12. // ==/UserScript==
  13.  
  14. ;(function() {
  15. var btn = $("#live_status_control")
  16. , intvl
  17.  
  18. if ((!btn.size())
  19. || btn.hasClass('guest')
  20. || btn.hasClass('on')) return
  21.  
  22. function click() {
  23. if (btn.hasClass("off")) {
  24. btn.trigger("click")
  25. }
  26.  
  27. if (btn.hasClass("on")) {
  28. clearInterval(intvl)
  29. alert("抢到了, 赶紧开播")
  30. }
  31. }
  32.  
  33. function setup() {
  34. intvl = setInterval(click, 2000)
  35. }
  36.  
  37. btn.one("click", setup)
  38. }());