1.8 - fingers crossed, media fixed

This commit is contained in:
Sebastian Cabrera 2024-07-09 06:34:56 -04:00
parent c265da35f6
commit 5ad23deee2
No known key found for this signature in database
GPG key ID: 9C70960A46161D08

View file

@ -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');