Overview Redirect

Change all username urls to point to overviews instead of profiles

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

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.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==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();});