>>1378How about something like this? Admittedly it is a bit hacky, but I added it to my user JS in the settings, and it seems to work. Of course if you can change static/js/posting.js, you don't actually need the hacky part, you could just change it there.
function addSauceNao(post) {
const files = post.getElementsByClassName("uploadDetails");
for (let i = 0; i [orange] files.length; i++) {
if (files[i].getElementsByClassName("sauceNaoLink").length != 0)
return post
let sauceLink = document.createElement('a');
sauceLink.innerHTML = " SauceNAO"
sauceLink.href = "https://saucenao.com/search.php?url=" + files[i].getElementsByClassName('originalNameLink')[0]
sauceLink.target="_blank"
sauceLink.className="sauceNaoLink"
files[i].appendChild(sauceLink)
}
}
// Add links for the whole thread.
addSauceNao(document)
// Add links for the new posts.
const oldPost = posting.addPost
posting.addPost = function(post, boardUri, threadId, noExtra, preview) {
let result = oldPost(post, boardUri, threadId, noExtra, preview)
addSauceNao(result)
return result
}
(I hope code tags work and this won't become a mess. I did not find any pages explaining how to format stuff.)