Created
May 11, 2018 05:45
-
-
Save chnbohwr/0b7bdf6ec8a54734e541417e7630f02f to your computer and use it in GitHub Desktop.
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
| const ele = document.querySelector('body > div.hero > div > div.test-wrapper.ng-scope > div'); | |
| let flag = true; | |
| const mouseDownEvent = document.createEvent('MouseEvents'); | |
| mouseDownEvent.initEvent('mousedown', true, true); | |
| const observer = new MutationObserver((mutations) => { | |
| mutations.every((mutation) => { | |
| if(mutation.target.classList.contains('view-go') && flag){ | |
| ele.dispatchEvent(mouseDownEvent); | |
| flag = false; | |
| return false; | |
| } | |
| return true; | |
| }); | |
| }); | |
| const config = { attributes: true, attributeFilter: ['class'] }; | |
| observer.observe(ele, config); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment