Classic Online-Stopwatch

Return to classic Online-Stopwatch

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        Classic Online-Stopwatch
// @namespace   feifeihang.info
// @description Return to classic Online-Stopwatch
// @include     http://www.online-stopwatch.com*
// @include     https://www.online-stopwatch.com*
// @version     1
// @grant       unsafeWindow
// ==/UserScript==
(function (window, document, undefined) {
  var FULLSCREEN = 'http://www.online-stopwatch.com/full-screen-stopwatch/';
  var pathname = window.location.pathname;
  // if it's homepage, go to fullscreen mode.
  if (pathname === '' || pathname === '/') {
    window.location.href = FULLSCREEN;
    return;
  }
  //  if it's fullscreen mode page, remove the top and bottom back links.

  if (pathname === '/full-screen-stopwatch/' || pathname === '/full-screen-stopwatch') {
    var divs = document.querySelectorAll('div.coad, div.bback');
    console.log(divs);
    divs = Array.prototype.slice.apply(divs);
    divs.map(function (div) {
      div.remove();
      return null;
    });
    // now, make the stopwatch really fullscreen.
    unsafeWindow.adSize = 0;
    unsafeWindow.fully();
  }
}) (this, this.document);