Created
June 23, 2016 02:17
-
-
Save unt0uchable/599ca3bb4805d5cb11d0bd0f50b88d60 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 dev_reddit_userinfo | |
// @namespace2 unt0uchable | |
// @description Display userinfo inline next to usernames on subreddit posts | |
// @author unt0uchable | |
// @include *reddit.com/r/* | |
// @include *reddit.com/me/m/* | |
// @version 1 | |
// @grant GM_config | |
// @grant GM_xmlhttpRequest | |
// @grant GM_getResourceURL | |
// @grant GM_getValue | |
// @grant GM_setValue | |
// @grant GM_registerMenuCommand | |
// @require http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js | |
// @require https://greasyfork.org/libraries/GM_config/20131122/GM_config.js | |
// @require https://raw.githubusercontent.com/sahilm/reddit.js/master/reddit.min.js | |
// ==/UserScript== | |
// this.$ = this.jQuery = jQuery.noConflict(true); | |
try { | |
// var authorHTML = '<div class="authorLinkKarma">' + escapeHTML(jsonData.data.link_karma) + '</div>'; | |
// $(authorHTML).insertAfter('.tagline .author'); | |
$('.tagline .author').each(function () { | |
var user = $(this).text(); | |
if (user != '[deleted]') { | |
var about = 'http://www.reddit.com/user/' + user + '/about.json'; | |
var author = $(this); | |
$.getJSON(about, function(json) { | |
$(author).append("<span class='link-karma'> (" + json.data.link_karma + ") </span>"); | |
// $(author).append("<span class='comment-karma' style='font-weight:bold'> C:" + json.data.comment_karma + "</span>"); | |
// $(author).children('span').css({'font-weight':'bold'}); | |
$(author).not('.friend').children('span').css({'color':'#ff4500'}); | |
// $(author).children('span').css({'font-weight':'bold','color':'#ff4500','background-color':'white'}); | |
}); | |
// $('.link-karma.comment-karma').css({'font-weight':'bold','color':'#ff4500'}); | |
// var sub_count = 0; | |
// var after = null; | |
// var submissions = 'http://www.reddit.com/user/' + author + '/submitted.json'; | |
// $.getJSON(submissions, function(json) { | |
// sub_count += json.data.children.length; | |
// after = json.data.after; | |
// } | |
// // if (json.before == null) { break }; | |
// while (json.data.after != null) { | |
// submissions = 'http://www.reddit.com/user/' + author + '/submitted.json?after=' + after; | |
// $.getJSON(submissions, function(json) { | |
// sub_count += json.data.children.length; | |
// after = json.data.after; | |
// } | |
// }); | |
// $(this).append('<span class="submissions">S: ' + sub_count + '</span>'); | |
// $('.comment-karma').append('<span class="submissions">S: ' + sub_count + '</span>'); | |
// // reddit.aboutUser("chromakode").fetch(); | |
// reddit.aboutUser("chromakode").fetch(function(res) { | |
// // res contains JSON parsed response from Reddit | |
// console.log(res); | |
// }); | |
} | |
}); | |
} catch (err) { | |
alert(err.toString()); | |
} | |
// $.ajax({ | |
// dataType: "json", | |
// url: about, | |
// data: data, | |
// success: success, | |
// dataType: dataType | |
// }); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment