Skip to content

Instantly share code, notes, and snippets.

@hellresistor
Last active July 6, 2025 11:00
Show Gist options
  • Save hellresistor/064e247688ff7b63289143b08ee7bbcb to your computer and use it in GitHub Desktop.
Save hellresistor/064e247688ff7b63289143b08ee7bbcb to your computer and use it in GitHub Desktop.
A script to insert on Tampermonkey extension. Enabling the copy/paste function if website blocked that
// ==UserScript==
// @name Desbloqueio click e copypaste com links - Hidromarinha.pt
// @namespace https://linktr.ee/hellresistor_cathedral
// @version 1.1
// @description Adiciona "🔓 Desbloquear" ao rodapé e ao menu principal para activar cópia e clique direito na página Hidromarinha.pt
// @match https://www.hidromarinha.pt/*
// @grant none
// @run-at document-idle
// ==/UserScript==
(function () {
'use strict';
function aplicarDesbloqueio() {
['oncontextmenu', 'oncopy', 'oncut', 'onpaste', 'onkeydown', 'onkeypress', 'onkeyup', 'onmousedown', 'onmouseup'].forEach(eventName => {
try {
Object.defineProperty(document, eventName, { get: () => null, set: () => {}, configurable: true });
Object.defineProperty(window, eventName, { get: () => null, set: () => {}, configurable: true });
} catch (e) {}
});
const eventos = ['copy', 'cut', 'paste', 'contextmenu', 'keydown', 'keypress', 'keyup', 'mousedown', 'mouseup'];
eventos.forEach(ev => {
window.addEventListener(ev, e => e.stopImmediatePropagation(), true);
document.addEventListener(ev, e => e.stopImmediatePropagation(), true);
});
const style = document.createElement('style');
style.innerHTML = `
* {
user-select: text !important;
-webkit-user-select: text !important;
-moz-user-select: text !important;
-ms-user-select: text !important;
}
`;
document.head.appendChild(style);
console.log('[TM] Desbloqueio aplicado com sucesso!');
}
function criarLink(texto = '🔓 Desbloquear', onClick) {
const a = document.createElement('a');
a.href = '#';
a.textContent = texto;
a.style.color = 'red';
a.style.fontWeight = 'bold';
a.style.cursor = 'pointer';
a.onclick = function (e) {
e.preventDefault();
onClick();
a.textContent = 'âś… Desbloqueado';
a.style.color = 'green';
};
return a;
}
function adicionarAoRodape() {
const txtRodape = document.querySelector('.txt_rodape');
if (!txtRodape) return;
const linkRodape = criarLink(' 🔓 Desbloquear', aplicarDesbloqueio);
txtRodape.appendChild(linkRodape);
console.log('[TM] Link adicionado ao rodapé');
}
function adicionarAoMenu() {
const menuItems = [...document.querySelectorAll('li.noselected a')];
const utilitarios = menuItems.find(a => a.href.includes('/utilitarios'));
const contactos = menuItems.find(a => a.href.includes('/contactos'));
if (utilitarios && contactos) {
const li = document.createElement('li');
li.className = 'noselected';
const linkMenu = criarLink('🔓 Desbloquear', aplicarDesbloqueio);
li.appendChild(linkMenu);
// Inserir depois de "Utilitários"
const parentUl = utilitarios.closest('ul');
const refLi = contactos.closest('li');
parentUl.insertBefore(li, refLi);
console.log('[TM] Link adicionado ao menu entre Utilitários e Contactos');
}
}
window.addEventListener('load', () => {
adicionarAoRodape();
adicionarAoMenu();
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment