Skip to content

Instantly share code, notes, and snippets.

@elishaukpong
Created April 1, 2022 11:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elishaukpong/1217561b05b1666dacd3d21851be4371 to your computer and use it in GitHub Desktop.
Save elishaukpong/1217561b05b1666dacd3d21851be4371 to your computer and use it in GitHub Desktop.
const targetNode = document.querySelector('.cff-wrapper-ctn');
const config = { childList: true, subtree: true };
function addBorder(){
const posts = Array.from(document.getElementsByClassName('cff-item'));
posts.forEach(post =>{
let count = parseInt(post.getElementsByClassName('cff-count')[0].innerHTML);
if(count >= 3){
post.style.border = '1px solid black';
}
});
}
const observer = new MutationObserver(function(mutationList, observer){
addBorder();
});
observer.observe(targetNode, config);
addBorder();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment