Scrolller.com Redirector

Redirect Scrolller subreddit pages to sorted and filtered view

Verze ze dne 10. 07. 2024. Zobrazit nejnovější verzi.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name          Scrolller.com Redirector
// @namespace     http://tampermonkey.net/
// @license       MIT
// @version       0.1
// @description   Redirect Scrolller subreddit pages to sorted and filtered view
// @icon          https://scrolller.com/assets/favicon-16x16.png
// @author        nkatshiba
// @match         https://scrolller.com/r/*
// @grant         none
// @run-at        document-start
// ==/UserScript==

(function() {
    'use strict';

    // Get the current URL
    var currentUrl = new URL(window.location.href);

    // Check if the URL already contains the desired parameters
    var params = currentUrl.searchParams;

    // Only add the parameters if they are not already set correctly
    var needsRedirect = false;
    if (params.get('sort') !== 'rising') {
        params.set('sort', 'rising');
        needsRedirect = true;
    }
    if (params.get('filter') !== 'videos') {
        params.set('filter', 'videos');
        needsRedirect = true;
    }

    // Construct the new URL if needed
    if (needsRedirect) {
        var newUrl = currentUrl.origin + currentUrl.pathname + '?' + params.toString();
        window.location.replace(newUrl);
    }
})();