Skip to content

Instantly share code, notes, and snippets.

@k1sul1
Last active March 8, 2016 10:01
Show Gist options
  • Save k1sul1/9fa949e1dcf5bd01ac89 to your computer and use it in GitHub Desktop.
Save k1sul1/9fa949e1dcf5bd01ac89 to your computer and use it in GitHub Desktop.
bbPress Votes hide post if score is below threshold
(function () {
"use strict";
// ES6 Magic, powered by Babel.
if (document.body.classList.contains("bbpress")) {
var replies = document.querySelectorAll(".reply");
for (var i = 0; i < replies.length; i++) {
var reply = replies[i];
if (parseInt(reply.querySelector(".bbpvotes-score").textContent, 10) <= -5) {
(function () {
var replyContent = reply.querySelector(".bbp-reply-content");
replyContent.style.display = "none";
var showReply = document.createElement("div");
showReply.innerHTML = "<p class='bbpress-spamreply'>Tämä vastaus on piilotettu sen alhaisen pistemäärän vuoksi. Klikkaa tästä näyttääksesi vastauksen.</p>";
showReply.addEventListener("click", function (e) {
e.target.remove();
replyContent.style.display = "block";
});
reply.appendChild(showReply);
})();
}
}
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment