Overview Redirect

Change all username urls to point to overviews instead of profiles

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name         Overview Redirect
// @name:en      Overview Redirect
// @version      4.1
// @description  Change all username urls to point to overviews instead of profiles
// @namespace    Overview Redirect
// @author       https://github.com/kimpeek
// @include      https://www.reddit.com*
// ==/UserScript==

// Define the regex for a username link
var username_link = new RegExp("(\/u\/|\/user\/)[A-Za-z0-9_-]+\/?$");
// Choose the page to replace with
//   Must be valid www.reddit.com/user/<USER>/*
//   eg. 'overview' or 'submitted'
var page_to_link = "overview";

// Find all links that point to a username
// and add 'page_to_link' to the end
function find_username_links(item, index){
    if (item.href.match(username_link)){
        item.href = change_username_link(item.href);
    }
}

// Conditionally add 'page_to_link' to the link
function change_username_link(link){
    if (link.endsWith("/")){
        link = link + page_to_link;
    }
    else {
        link = link + "/" + page_to_link;
    }
    return link;
}

// Wrapper for main functionality
function take_action(msg){
    // Gather all the links on the page
    var anchors = document.getElementsByTagName("a");
    // Transform the HTML Collection to an array
    var list = Array.from(anchors);
    // Execute the primary functionality
    list.forEach(find_username_links);
}

// Normal reddit and RES first page
window.addEventListener ("load", take_action());
// Never Ending Reddit
window.addEventListener ("neverEndingLoad", function(){take_action();});