Last active
September 5, 2025 13:12
-
-
Save qgustavor/d0c04f3c49ce07764f71b15ec21c473a to your computer and use it in GitHub Desktop.
Um user-script para colar os números do DUAM diretamente sem dor de cabeça, porque o pessoal do TI da prefeitura de Goiânia só sabe mexer naquele sistema novo (fonte: eles próprios falaram em uma reunião que tive com eles).
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 Cola DUAM | |
// @namespace Violentmonkey Scripts | |
// @match https://www.goiania.go.gov.br/sistemas/samin/asp/samin00002f0.asp* | |
// @grant none | |
// @version 1.0 | |
// @author - | |
// @description 9/5/2025, 9:55:33 AM | |
// ==/UserScript== | |
const interval = setInterval(() => { | |
const inputs = [ | |
document.querySelector('input[name="txt_bloco_01"]'), | |
document.querySelector('input[name="txt_bloco_02"]'), | |
document.querySelector('input[name="txt_bloco_03"]'), | |
document.querySelector('input[name="txt_bloco_04"]'), | |
] | |
if (inputs.some(e => !e)) return | |
clearInterval(interval) | |
document.addEventListener('paste', e => { | |
let text = (e.clipboardData || window.clipboardData).getData('text') | |
if (!text) return | |
text = text.replace(/\D+/g, '') | |
if (text.length !== 48) return | |
e.preventDefault() | |
for (let i = 0; i < 4; i++) { | |
inputs[i].value = text.substr(i * 12, 12) | |
inputs[i].dispatchEvent(new Event('input', { bubbles: true })) | |
inputs[i].dispatchEvent(new Event('keyup', { bubbles: true })) | |
} | |
}, true) | |
}, 500) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment