Skip to content

Instantly share code, notes, and snippets.

@darkfeline
Created November 17, 2016 02:55
Show Gist options
  • Save darkfeline/8810ff63b9a1d4b16cfa42c33ab897b0 to your computer and use it in GitHub Desktop.
Save darkfeline/8810ff63b9a1d4b16cfa42c33ab897b0 to your computer and use it in GitHub Desktop.
Userscript for fixing Arik on SoylentNews
// ==UserScript==
// @name Arik Fixer
// @namespace https://www.felesatra.moe/
// @version 0.1
// @description Fix Arik
// @author darkfeline <darkfeline@felesatra.moe>
// @match https://soylentnews.org/comments.pl*
// @match https://soylentnews.org/article.pl*
// @grant none
// @require https://code.jquery.com/jquery-latest.js
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// ==/UserScript==
(function() {
'use strict';
function fixArik(node) {
$("div.sict_open").each(function(){
var details = $(this).find("div.details");
console.dir(details.find("a").first().text());
// If author is Arik
if (details.find("a").first().text() === "Arik (4543)") {
var post = $(this).parent().parent();
// Get post body.
var body = post.find("div.commentBody");
// Replace <tt> with <p>
body = body.find("tt").first();
var newBody = $('<p>' + body.html() + '</p>');
body.replaceWith(newBody);
}
});
}
waitForKeyElements("div.sict_open", fixArik);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment