Created
July 1, 2019 15:32
-
-
Save techsin/a19dd548f6d193129dac74c22972fc77 to your computer and use it in GitHub Desktop.
Reaction time sens clicker
This file contains hidden or 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
var ele = document.querySelector('.test-standard.reaction-time-test'); | |
var config = { attributes: true }; | |
var event = new MouseEvent('mousedown', { | |
bubbles: true, | |
cancelable: true | |
}); | |
var callback = function (mutationsList, observer) { | |
for (var mutation of mutationsList) { | |
if (mutation.type == 'attributes' && mutation.attributeName == 'class' && ele.classList.contains('view-go')) { | |
console.log('clicked') | |
ele.dispatchEvent(event); | |
} | |
} | |
}; | |
var observer = new MutationObserver(callback); | |
observer.observe(ele, config); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment