Last active
February 1, 2024 22:19
-
-
Save xim/eacb9dcc4155783d5d6911c2282c0d9d to your computer and use it in GitHub Desktop.
Dinosaur comics rss title shower
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 Dinosaur comics rss title shower | |
// @namespace https://gist.github.com/xim | |
// @version 4 | |
// @description Show the RSS title inline on www.qwantz.com | |
// @author You | |
// @match *://qwantz.com/* | |
// @match *://www.qwantz.com/* | |
// @downloadURL https://gist.githubusercontent.com/xim/eacb9dcc4155783d5d6911c2282c0d9d/raw/qwantz-rss-title.user.js | |
// @updateURL https://gist.githubusercontent.com/xim/eacb9dcc4155783d5d6911c2282c0d9d/raw/qwantz-rss-title.user.js | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=qwantz.com | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
var i, el, new_el, elems; | |
elems = [document]; | |
while (elems.length > 0) { | |
el = elems.pop(); | |
for (i = 0; i < el.childNodes.length; i++) { | |
var node = el.childNodes[i]; | |
if (node.nodeType === Node.COMMENT_NODE) { | |
if (node.textContent.match(/rss-title/)) { | |
new_el = document.createElement('div'); | |
new_el.style = "text-align: center;font-weight: bold;color: white;font-size: larger;"; | |
new_el.innerHTML = node.textContent; | |
node.parentElement.insertBefore(new_el, node); | |
break; | |
} | |
} else { | |
elems.push(node); | |
} | |
} | |
} | |
elems = document.getElementsByClassName('comic'); | |
for (i = 0; i != elems.length; i++) { | |
el = elems[i]; | |
if (el.title.length) { | |
new_el = document.createElement('div'); | |
new_el.style = "text-align: center;font-weight: bold;font-size: larger;"; | |
new_el.innerHTML = "<span>" + el.title + "</span>"; | |
el.parentElement.appendChild(new_el); | |
} | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment