Skip to content

Instantly share code, notes, and snippets.

@TypeA2
Last active July 4, 2025 07:46
Show Gist options
  • Select an option

  • Save TypeA2/f4f0683515db3bb497d1deb961a326f5 to your computer and use it in GitHub Desktop.

Select an option

Save TypeA2/f4f0683515db3bb497d1deb961a326f5 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Post score and fav
// @namespace Violentmonkey Scripts
// @match *://*.donmai.us/posts
// @match *://*.donmai.us/
// @grant none
// @version 1.0
// @author user #480070
// @description 7/4/2025, 1:14:55 PM
// ==/UserScript==
function make_info_str(post, favs = '0') {
return `★ ${post.dataset.score}   ♥ ${favs}   ${post.dataset.rating.toUpperCase()}`;
}
const posts = $("article.post-preview");
posts.each((i, e) => {
const info = $("<div>", {
"class": "very-special-post-data text-sm text-center mt-1",
style: "font-size: 14px;",
html: make_info_str(e)
});
e.appendChild(info[0]);
});
fetch("/posts.json?" + new URLSearchParams({ only: "id,fav_count", tags: "id:" + Array.from(posts.map((_, e) => e.dataset.id)).join(",") }))
.then(e => e.json())
.then(
data => {
for (const post of data) {
const el = $(`#post_${post.id}`);
el.find(".very-special-post-data").html(make_info_str(el[0], post.fav_count));
}
}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment