Skip to content

Instantly share code, notes, and snippets.

@corylulu
Last active May 19, 2017 00:07
Show Gist options
  • Save corylulu/c46138bda08f2dc0b3edd2d94d3127b2 to your computer and use it in GitHub Desktop.
Save corylulu/c46138bda08f2dc0b3edd2d94d3127b2 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Disable New Profiles
// @namespace http://tampermonkey.net/
// @version 0.7.5
// @description Modifies all profile links to bring you to the overview page. Also fixes overflow issue on new profile page.
// @author /u/corylulu
// @match https://www.reddit.com/*
// @grant none
// @require https://code.jquery.com/jquery.min.js
// @require https://raw.githubusercontent.com/uzairfarooq/arrive/master/minified/arrive.min.js
// @run-at document-start
// ==/UserScript==
(function() {
'use strict';
function modifyLink(a){
var href = a.attr('href');
if(href) {
if(href.match(/\/u\/[^\/?]+$/) || href.match(/\/user\/[^\/?]+$/))
a.attr('href', href + "/overview");
else if (href.match(/\/u\/[^\/?]+\/$/) || href.match(/\/user\/[^\/?]+\/$/))
a.attr('href', href + "overview");
}
}
$(function() {
// Modifies all existing links
$('a').each(function(){ modifyLink($(this)); });
// Modifies links dynamically added to page
$(document).arrive('a', function() { modifyLink($(this)); });
// Fixes overflow issue on new profile page.
var p = $('.ProfileTemplate__content');
if(p)
p.css("overflow", "auto");
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment