Ask HN: Browser scripts to keep yourself from getting distracted

1 points by 65 ↗ HN
What browser scripts do you use? E.g. GreaseMonkey or TamperMonkey scripts.

Some scripts I have:

1. Redirect NYTimes home page to Today's Paper

    if (window.location.href === "https://www.nytimes.com/") window.location.href = "https://www.nytimes.com/section/todayspaper"
I read the NY Times but find myself getting distracted by the constantly updating home page.

2. Block sites (e.g. Twitter)

    document.body.style.display = "none";
3. Turn off websites after 12am (to make me go to bed earlier)

    (function() {
        function turnOff() {
            // 12am - 5am
            const turnOn = 5;
            const now = new Date();
            const hours = now.getHours();
            if (hours < turnOn) document.body.style.display = "none";
        }
        window.addEventListener('click', turnOff)
        window.addEventListener('load', turnOff)
    })();

0 comments

[ 2.9 ms ] story [ 13.3 ms ] thread

No comments yet.