Skip to content

Instantly share code, notes, and snippets.

@LeafarDev
Last active July 10, 2023 22:21
Show Gist options
  • Select an option

  • Save LeafarDev/3424a24f0c5010c13acfdd87192d6619 to your computer and use it in GitHub Desktop.

Select an option

Save LeafarDev/3424a24f0c5010c13acfdd87192d6619 to your computer and use it in GitHub Desktop.
portal obmep, parar de scrollar
// ==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