reddit commentroversy

By frantk Last update Mar 5, 2009 — Installed 8,200 times. Daily Installs: 27, 16, 19, 20, 7, 4, 11, 13, 12, 8, 5, 8, 8, 20, 34, 13, 11, 10, 10, 5, 13, 14, 10, 14, 8, 24, 18, 8, 36, 11, 13

Stopped working

Subscribe to Stopped working 4 posts, 3 voices

Nicola Archi... Scriptwright

Looks like reddit has renamed the score text fields ID's from score_<name> to just 'score likes' with no specific identifier as to the comment in question. Thus commentroversy no longer works.

They've also killed off the undeletion ability, so it's looking like they're making a concerted effort to kill off the 'useful' userscripts.</name>

 
hobophobe Scriptwright

Not sure it's a concerted effort. I'm wait and see on that one, could be they just made some changes without fully understanding the repercussions.

Nonetheless, it's a pain to update the scripts. Especially when you can only get at the id by class now. Sigh.

 
hobophobe Scriptwright

Edit: D'oh. Because of the javascript namespace and the fact that Reddit already is using jQuery, don't load it as part of the script. Live and learn.

Edit: Small change so if you @include http://www.reddit.com/* it will display on story scores as well.
Edit: Added a proper header for the script per Stretch's comment

-- if you use this, it should load before the Commentroversy script (put it higher in the Greasemonkey list) --

Using jQuery (imported/downloaded when this script loads) I wrote this to manually add the ids for all of the comments.

Could probably use some cleaning up. Still, one hopes that the current state of Reddit will be amended to once again include ids in their markup and restore sanity to the (known) universe and premature code cleanup is for suckers.

If you're bored feel free to improve on this.

// ==UserScript==
// @name           Reddit Add ids
// @description    Adds ids to comment scores
// @include        http://www.reddit.com/comments/*
// @include        http://reddit.com/comments/*
// @include        http://www.reddit.com/user/*
// @include        http://reddit.com/user/*
// ==/UserScript==

// Add jQuery
//var GM_JQ = document.createElement('script');
//GM_JQ.src = 'http://jquery.com/src/jquery-latest.js';
//GM_JQ.type = 'text/javascript';
//document.getElementsByTagName('head')[0].appendChild(GM_JQ);

// Check if jQuery's loaded
function GM_wait() {
    if(typeof unsafeWindow.jQuery == 'undefined') { window.setTimeout(GM_wait,100); }
else { $ = unsafeWindow.jQuery; letsJQuery(); }
}
GM_wait();

// All your GM code must be inside this function
function letsJQuery() {
  var IDed = $('.thing');
  for (var i = 0; i < IDed.length; i++)
  {
    if (IDed[i].className.indexOf('id-') == -1)
      continue;
    var classes = IDed[i].className.split(' ');
    var j = 0;
    for (; classes[j].indexOf('id-') == -1 && j < classes.length;j++);
    var score = $(".tagline .score", IDed[i])[0];
    if (score != null)
      score.id = 'score_' + classes[j].substring(3);
  }
}

 
Stretch User

hobo,

Just tried this and works like a dandy. Don't forget to copy the included pages over or you will have this script running on more than just the proper reddit pages.

Cross
Presentational HTML allowed.
Use <code> for inline code and <pre> for code blocks. Use &lt; and &gt; for literal < and >.
We help break paragraphs and link your links.
or cancel