Skip to content

Instantly share code, notes, and snippets.

@Vusys
Created May 21, 2014 01:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Vusys/03fe51d58c8556e70bb4 to your computer and use it in GitHub Desktop.
Save Vusys/03fe51d58c8556e70bb4 to your computer and use it in GitHub Desktop.
RedditLog Linker
// ==UserScript==
// @name RedditLog Linker
// @namespace vusys
// @include http://redditlog.com/snapshot*
// @version 1
// @grant none
// @require http://codeorigin.jquery.com/jquery-2.0.3.min.js
// ==/UserScript==
$(function() {
$('.user, .author').each(function(){
var link = $('<a></a>');
link.text( $(this).text() );
link.attr('href', 'http://www.reddit.com/user/' + $(this).text() );
link.attr('target', '_blank');
$(this).replaceWith(link);
});
var domain = $('span.domain').text();
$('span.domain').remove();
var domain_replacement = $('<span class="domain"></span>').text(domain);
var link = $('<a class="title"></a>');
link.text( $('.title').text() );
link.attr('href', 'http://www.reddit.com/search?q='+$('.title').text() );
link.attr('target', '_blank');
$('.title').replaceWith(link);
$('.title').append(domain_replacement);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment