Productivity Saver

Redirects people to video if someone goes to reddit between 9 AM and 6 PM (inclusive).

当前为 2015-11-21 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name Productivity Saver
// @description Redirects people to video if someone goes to reddit between 9 AM and 6 PM (inclusive). 
// @include https://*.reddit.com
// @include https://*.reddit.com/*
// @include https://www.youtube.com/*
// @run-at document-end
// @version 0.0.1.20151121091716
// @namespace https://greasyfork.org/users/12417
// ==/UserScript==

// This whole code is meant to block websites you apply to this script to from 9 AM to 6 PM, with 1 check per minute.
// For any further inquiries, please tell me at scratch.mit.edu/users/iamunknown2 or reddit/u/iamunknowntwo

function check() // This function will set the hours variable (which will specify the hours in the day).
{
    var date1 = new Date();
    var hours = date1.getHours();
    
    if (hours >= 8 && hours <= 17) // If hours are 8 AM to 7 PM (inclusive)
    {
        if (window.location.href != "https://www.youtube.com/watch?v=ZXsQAXx_ao0")
        {
            window.location.href = "https://www.youtube.com/watch?v=ZXsQAXx_ao0"; // Will play "JUST DO IT" Shia LaBeouf speech
        }
    }
    document.getElementById("watch-discussion").innerHTML = ""; // YouTube comments are horrible.
}
check() // Will check first time run.
setTimeout(check(), 60000); // Checks above code per minute.