OGS Utilities

Small improvements of online-go.com

目前為 2015-02-14 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         OGS Utilities
// @description  Small improvements of online-go.com
// @author       TPReal
// @namespace    https://greasyfork.org/users/9113
// @version      0.2.1
// @match        *://online-go.com/*
// @grant        none
// ==/UserScript==

var TITLE_MATCHER=/^(?:\[\d+\] )?(.*)$/;

var updateTitle=function(){
  var value=$("#turn-notification-indicator").text();
  var prefix="";
  if(value&&value!="0")
    prefix="["+value+"] ";
  var baseTitle=TITLE_MATCHER.exec(document.title)[1];
  document.title=prefix+baseTitle;
};

var isFullscreen=function(){
  return screen.width==window.outerWidth&&screen.height==window.outerHeight;
};

var fullscreenStyle=$("<style> \
  #game-main-container > #game-controls { \
    display:none; \
  } \
  </style>").appendTo(document.head)[0];

var updateFullscreenStyle=function(){
  fullscreenStyle.sheet.disabled=!isFullscreen();
};

var tick=function(){
  updateTitle();
  updateFullscreenStyle();
  setTimeout(tick,1000);
};
tick();