Created
November 26, 2021 03:26
-
-
Save sunrise2575/4195981ef068b2145b1647752ea406cf to your computer and use it in GitHub Desktop.
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
// paste into Google Chrome DevTools | |
function simulateMouseClick(targetNode) { | |
function triggerMouseEvent(targetNode, eventType) { | |
var clickEvent = document.createEvent('MouseEvents'); | |
clickEvent.initEvent(eventType, true, true); | |
targetNode.dispatchEvent(clickEvent); | |
} | |
["mouseover", "mousedown", "mouseup", "click"].forEach(function(eventType) { | |
triggerMouseEvent(targetNode, eventType); | |
}); | |
} | |
let target = document.querySelector("div.view-splash") | |
let observer = new MutationObserver(m=>{ | |
if (target.getAttribute("class").includes('view-go')) { | |
simulateMouseClick(target); | |
} | |
if (target.getAttribute("class").includes('view-result')) { | |
simulateMouseClick(target); | |
} | |
}) | |
let option = {attributes:true, childList: true, characterData: true} | |
observer.observe(target, option) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment