Last active
May 19, 2017 00:07
-
-
Save corylulu/c46138bda08f2dc0b3edd2d94d3127b2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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