Mediablock

Closes 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 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name Mediablock
  3. // @description Closes social media from 7 AM to 5 PM inclusive on weekdays, 6 AM to 10 AM Saturdays, and completely free on Sundays!
  4. // @include https://*.reddit.com
  5. // @include https://*.reddit.com/*
  6. // @include https://*.facebook.com
  7. // @include https://*.facebook.com/*
  8. // @include https://*.twitter.com
  9. // @include https://*.twitter.com/*
  10. // @include https://scratch.mit.edu
  11. // @include https://scratch.mit.edu/*
  12. // @include https://*.newgrounds.com
  13. // @include https://*.newgrounds.com/*
  14. // @include https://*.myspace.com
  15. // @include https://*.myspace.com/*
  16. // @run-at document-start
  17. // @version 0.0.1.20151123012205
  18. // @namespace https://greasyfork.org/users/12417
  19. // ==/UserScript==
  20.  
  21. // For any further inquiries, please contact me at scratch.mit.edu/users/iamunknown2 or reddit/u/iamunknowntwo
  22. var date1 = new Date();
  23. var hours = date1.getHours(); // Hours
  24. var day = date1.getDay(); // Day of the week
  25.  
  26. if (day === 6) // If it's a Saturday
  27. {
  28. if (hours >= 5 && hours <= 9) // Doesn't hurt to add a few more hours of work.
  29. {
  30. var current = window.location.href;
  31. window.history.back();
  32. if (window.location.href == current)
  33. {
  34. window.location.href = "about://newtab";
  35. }
  36. }
  37. }
  38. else if (hours >= 6 && hours <= 16 && day !== 0) // If hours are 7 AM to 5 PM (inclusive) and not a Sunday
  39. {
  40. var current = window.location.href;
  41. window.history.back();
  42. if (window.location.href == current)
  43. {
  44. window.location.href = "about://newtab";
  45. }
  46. }