Skip to content

Instantly share code, notes, and snippets.

@skalee
Last active July 30, 2018 01:54
Show Gist options
  • Save skalee/3008eea77ba5d77ac53649092e575c4e to your computer and use it in GitHub Desktop.
Save skalee/3008eea77ba5d77ac53649092e575c4e to your computer and use it in GitHub Desktop.
SSC likes counter (GreaseMonkey)

Public Domain.

Preview:

Preview

// ==UserScript==
// @name Likes counter for SkyScraperCity
// @description Initially developed by me. Public domain.
// @version 1
// @grant none
// @include https://www.skyscrapercity.com/showthread.php?*
// @include https://www.skyscrapercity.com/showpost.php?*
// ==/UserScript==
(function() {
let ready = async function() {
let like_lists = document.querySelectorAll("div[id^='dbtech_thanks_block_'] .smallfont")
for (list of like_lists) {
let like_entries = list.querySelectorAll("a[href^='member.php']")
let likes_count = like_entries.length
let last_like = like_entries[likes_count - 1]
if (likes_count > 0) {
last_like.insertAdjacentHTML("afterend", ` (${likes_count} total)`)
}
}
}
if (document.readyState === "loading") {
document.addEventListener("DOMContentLoaded", ready);
} else {
ready();
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment