30 lines
No EOL
1.1 KiB
JavaScript
30 lines
No EOL
1.1 KiB
JavaScript
// ==UserScript==
|
|
// @name Use old new Reddit
|
|
// @namespace https://codeberg.org/okseby/newnewredditsucks
|
|
// @version 1.8
|
|
// @description forward the ugly new reddit to the older new reddit
|
|
// @author okseby
|
|
// @match https://www.reddit.com/*
|
|
// @icon https://www.google.com/s2/favicons?sz=64&domain=reddit.com
|
|
// @grant none
|
|
// @run-at document-start
|
|
// @updateURL https://codeberg.org/okseby/newnewredditsucks/raw/branch/main/newnewredditsucks.user.js
|
|
// @downloadURL https://codeberg.org/okseby/newnewredditsucks/raw/branch/main/newnewredditsucks.user.js
|
|
// ==/UserScript==
|
|
|
|
(function () {
|
|
'use strict';
|
|
|
|
// 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');
|
|
|
|
// Redirect to the new URL
|
|
window.location.replace(newUrl);
|
|
})(); |