Warning: fopen(/www/sites/greasyfork.cloud/index/store/forever/d374b474e7675d044e6adc7c6c5a40bd.html): failed to open stream: No space left on device in /www/sites/greasyfork.cloud/index/scriptsControl.php on line 127
Mediablock - 源代码

Greasy Fork

Mediablock

Redirects people back to what they were doing before they decided to browse social media from 7 AM to 5 PM inclusive on weekdays, 6 AM to 10 AM Saturdays, and completely free on Sundays!

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

// ==UserScript==
// @name Mediablock
// @description Redirects people back to what they were doing before they decided to browse social media from 7 AM to 5 PM inclusive on weekdays, 6 AM to 10 AM Saturdays, and completely free on Sundays!
// @include https://*.reddit.com
// @include https://*.reddit.com/*
// @include https://*.facebook.com
// @include https://*.facebook.com/*
// @include https://*.twitter.com
// @include https://*.twitter.com/*
// @include https://scratch.mit.edu
// @include https://scratch.mit.edu/*
// @include https://*.newgrounds.com
// @include https://*.newgrounds.com/*
// @include https://*.myspace.com
// @include https://*.myspace.com/*
// @run-at document-start
// @version 0.0.1.20151123001655
// @namespace https://greasyfork.org/users/12417
// ==/UserScript==

// For any further inquiries, please contact me at scratch.mit.edu/users/iamunknown2 or reddit/u/iamunknowntwo
var date1 = new Date();
var hours = date1.getHours(); // Hours
var day = date1.getDay(); // Day of the week

if (day === 6) // If it's a Saturday
{
    if (hours >= 5 && hours <= 9) //  Doesn't hurt to add a few more hours of work.
    {
        window.history.back();
    }
}
else if (hours >= 6 && hours <= 16 && day !== 0) // If hours are 7 AM to 5 PM (inclusive) and not a Sunday
{
    {
        window.history.back(); // Get back to your work.
    }
}