Created
November 17, 2016 02:55
-
-
Save darkfeline/8810ff63b9a1d4b16cfa42c33ab897b0 to your computer and use it in GitHub Desktop.
Userscript for fixing Arik on SoylentNews
This file contains hidden or 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 Arik Fixer | |
// @namespace https://www.felesatra.moe/ | |
// @version 0.1 | |
// @description Fix Arik | |
// @author darkfeline <[email protected]> | |
// @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