Last active
July 10, 2023 22:21
-
-
Save LeafarDev/3424a24f0c5010c13acfdd87192d6619 to your computer and use it in GitHub Desktop.
portal obmep, parar de scrollar
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
| // ==UserScript== | |
| // @name New Userscript | |
| // @namespace http://tampermonkey.net/ | |
| // @version 0.1 | |
| // @description try to take over the world! | |
| // @author You | |
| // @match https://portaldaobmep.impa.br/ | |
| // @icon https://www.google.com/s2/favicons?sz=64&domain=impa.br | |
| // @grant none | |
| // ==/UserScript== | |
| (function () { | |
| 'use strict'; | |
| const buttons = document.querySelectorAll('a'); | |
| const closeButtons = document.getElementsByClassName('close'); | |
| const disableScrolling = () => { | |
| const x = window.scrollX; | |
| const y = window.scrollY; | |
| window.onscroll = function () { | |
| window.scrollTo(x, y); | |
| }; | |
| } | |
| const enableScrolling = () => { | |
| window.onscroll = function () { | |
| }; | |
| } | |
| Array.from(closeButtons).forEach(function (button) { | |
| button.onclick = enableScrolling | |
| }); | |
| Array.from(buttons).forEach(function (button) { | |
| if (button.innerText === 'Assistir Vídeo') { | |
| const existingOnClick = button.getAttribute('onclick'); | |
| button.onclick = () => { | |
| disableScrolling(); | |
| eval(existingOnClick); | |
| } | |
| } | |
| }); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment