diff --git a/newnewredditsucks.user.js b/newnewredditsucks.user.js index 6eb147e..2619ed1 100644 --- a/newnewredditsucks.user.js +++ b/newnewredditsucks.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name Use old new Reddit // @namespace https://codeberg.org/okseby/newnewredditsucks -// @version 1.7 +// @version 1.8 // @description forward the ugly new reddit to the older new reddit // @author okseby // @match https://www.reddit.com/* @@ -15,13 +15,13 @@ (function () { 'use strict'; - // if (window.location.hostname == 'www.reddit.com' && !window.location.hostname.includes('/media')) { - // window.location.hostname = 'new.reddit.com'; - // } - // Get the current URL const currentUrl = window.location.href; + // Check if it's a media link + const mediaPattern = /\/media($|\?)/; + if (mediaPattern.test(currentUrl)) return; // Abort the redirect + // Replace www.reddit.com with new.reddit.com const newUrl = currentUrl.replace('www.reddit.com', 'new.reddit.com');