Last active
May 22, 2018 00:54
-
-
Save zettca/04329f907d12b730c79a to your computer and use it in GitHub Desktop.
Instagram auto-liker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function (delay, type) { | |
const g = (c) => document.getElementsByClassName(c); | |
const pics = g('_si7dy'); | |
function iteration() { | |
const heart = g((type === 'like') ? 'coreSpriteHeartOpen' : 'coreSpriteHeartFull')[0]; | |
heart && heart.click(); | |
g('coreSpriteRightPaginationArrow')[0].click(); | |
} | |
new MutationObserver((muts) => { | |
muts.forEach((mut) => { | |
if (mut.addedNodes.length) { | |
setTimeout(iteration, delay); | |
new MutationObserver((muts) => { | |
muts.forEach((mut) => { | |
if (mut.addedNodes.length) setTimeout(iteration, delay); | |
}); | |
}).observe(mut.addedNodes[0].firstChild.children[1].firstChild.firstChild, { attributes: true, childList: true, characterData: true }); | |
} | |
}); | |
}).observe(document.body, { childList: true }); | |
})(100, 'like'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment