Ask HN: Browser scripts to keep yourself from getting distracted

https://news.ycombinator.com/item?id=42987738
by 65 • 1 year ago
1 0 1 year ago

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)
    })();

Related Stories

Loading related stories...

Source preview

news.ycombinator.com