Skip to content

Instantly share code, notes, and snippets.

@DEADB33F
Created November 27, 2012 21:52
Show Gist options
  • Save DEADB33F/4157361 to your computer and use it in GitHub Desktop.
Save DEADB33F/4157361 to your computer and use it in GitHub Desktop.
Reddit parent comment
// ==UserScript==
// @name Reddit parent comment
// @namespace v1
// @description Mouse over "parent" link to show parent comment.
// @include http://www.reddit.com/r/*/comments/*
// ==/UserScript==
function parentcomment(){
var inlineComment = $('<div class="entry comment" style="position:absolute;display:none;padding: 10px 15px;margin:10px;background-color: #FAFAFA;border: 1px solid #369;border-radius: 7px;" />').appendTo('body');
$(document)
.on('mouseenter','.flat-list.buttons li:nth-of-type(3) a.bylink',function(){ inlineComment.delay(500).fadeIn(100).html( $(this).thing().parent().thing().find('.entry:eq(0)').html() ) })
.on('mouseleave','.flat-list.buttons li:nth-of-type(3) a.bylink',function(){ inlineComment.stop().hide() })
.on('mousemove','.flat-list.buttons li:nth-of-type(3) a.bylink',function(e){ inlineComment.css({top:e.pageY,left:e.pageX}) })
}
s=document.createElement('script');s.textContent='('+parentcomment.toString()+')();';document.head.appendChild(s);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment