Last active
August 29, 2015 14:18
-
-
Save gtarsia/f139cb4e452d9d12b8f5 to your computer and use it in GitHub Desktop.
Hide reddit comments by click the side of the comment
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
function hide(obj) { | |
$(obj) | |
.children('.entry').first() | |
.children('.tagline').first() | |
.children('.expand').first() | |
.click(); | |
} | |
var shouldClick = true; | |
var preventClickEvent = false; | |
$(document).ready(function() { | |
$(".comment").click(function(e) { | |
try { | |
if (!shouldClick) return; | |
if (e.currentTarget != e.target) return; | |
hide(this); | |
e.preventDefault(); | |
shouldClick = false; | |
setTimeout(function() { shouldClick = true; }, 200); | |
} catch(err) {} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It would be nice to have color on hover only for the side of the comment and nothing else, but I really have no idea how to do that, because there is no element to color there.