Skip to content

Instantly share code, notes, and snippets.

@abinashmeher999
Created October 30, 2017 20:26
Show Gist options
  • Save abinashmeher999/76d243e46488aa4abcb0e19aeef57a29 to your computer and use it in GitHub Desktop.
Save abinashmeher999/76d243e46488aa4abcb0e19aeef57a29 to your computer and use it in GitHub Desktop.
var cards_list = document.getElementsByClassName("memory-game-inner")[0];
ob = {};
delay = 0;
for (let item of cards_list.childNodes) {
if (item.tagName == 'DIV') {
console.log(item)
let id = item.firstChild.firstChild.firstChild.getAttribute('src').slice(34);
if (id in ob) {
(function (id, delay, item) {
setTimeout(function () { console.log(id); ob[id].firstChild.firstChild.click(); item.firstChild.firstChild.click(); }, delay);
})(id, delay += 400, item);
} else { ob[id] = item; }
}
}
(function (delay) {
setTimeout(function () { ob = {}; }, delay)
})(delay += 1000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment