Productivity Saver

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

目前為 2015-11-21 提交的版本,檢視 最新版本

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

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

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

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

你需要先安裝一款使用者腳本管理器擴展,比如 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/watch?v=*
// @run-at document-start
// @version 0.0.1.20151121115859
// @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
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
    }
}

var comments = document.getElementById("watch-discussion");
comments.parentNode.removeChild(comments); // Bye bye YouTube comments!