OGS Title Count

Displays number of games waiting for your move in page title on online-go.com

当前为 2015-02-14 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name OGS Title Count
  3. // @description Displays number of games waiting for your move in page title on online-go.com
  4. // @author TPReal
  5. // @namespace https://greasyfork.org/users/9113
  6. // @version 0.2
  7. // @match *://online-go.com/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. var TITLE_MATCHER=/^(?:\[\d+\] )?(.*)$/;
  12.  
  13. var updateTitle=function(){
  14. var value=document.getElementById("turn-notification-indicator").innerText;
  15. var prefix="";
  16. if(value&&value!="0")
  17. prefix="["+value+"] ";
  18. var baseTitle=TITLE_MATCHER.exec(document.title)[1];
  19. document.title=prefix+baseTitle;
  20. };
  21.  
  22. var tick=function(){
  23. updateTitle();
  24. setTimeout(tick,1000);
  25. };
  26. tick();