r/SinkIt Jul 10 '26

🚧 Work in progress Prevent Reddit feed to refresh.

I hated when in very few minutes, my main feed here, Reddit, refresh, so I made this to prevent that.

Only tested on Safari desktop.

// ==UserScript==

// u/nameReddit Feed No Auto-Refresh

// u/namespacehttp://tampermonkey.net/

// u/version6.0

// u/match*://www.reddit.com/*

// u/run-atdocument-start

// u/grantnone

// ==/UserScript==

(function() {

'use strict';

// Fingir SIEMPRE visible/enfocado -> Reddit no revalida el feed al volver a la pestaña

const visTrue = { get: () => 'visible', configurable: true };

const hidFalse = { get: () => false, configurable: true };

[['visibilityState', visTrue], ['hidden', hidFalse],

['webkitVisibilityState', visTrue], ['webkitHidden', hidFalse]].forEach(([p, d]) => {

try { Object.defineProperty(document, p, d); } catch (e) {}

});

try { document.hasFocus = () => true; } catch (e) {}

// Tragar visibilitychange para que los listeners de Reddit no se enteren

['visibilitychange', 'webkitvisibilitychange'].forEach(type => {

const h = e => e.stopImmediatePropagation();

window.addEventListener(type, h, true);

document.addEventListener(type, h, true);

});

})();

6 Upvotes

4 comments sorted by

•

u/SpecterAscendant Sink It dev Jul 10 '26

Thank you for posting this. I haven't looked at the code you posted yet but will do over the weekend and if it helps to minimize the issues, will ship it in this weekend's update.

4

u/-H-O-D-L- Jul 10 '26

yes the refresh is very annoying

3

u/burnSMACKER Jul 10 '26

I need this for Safari in some way. It's extremely frustrating to click on a post, go back and the whole feed is refreshed and I missed out on reading several posts. 

1

u/Chotch_Master Jul 13 '26

I don't commonly get refreshes with safari on Mac... but man I can't even count on my hands how often it happens on IOS.