Skip to content

Add unified Auto-Aceite LGPD e SIGMINE UserScript#1

Merged
nelisjunior merged 1 commit intomainfrom
copilot/fix-e48acf0c-ac91-4cd3-abce-7a26314d7a79
Jul 1, 2025
Merged

Add unified Auto-Aceite LGPD e SIGMINE UserScript#1
nelisjunior merged 1 commit intomainfrom
copilot/fix-e48acf0c-ac91-4cd3-abce-7a26314d7a79

Conversation

Copy link
Contributor

Copilot AI commented Jul 1, 2025

Summary

This PR adds a unified UserScript that automatically handles LGPD consent for both GEOANP and SIGMINE websites, as requested in the issue. The script detects which site it's running on and executes the appropriate automation.

Features

🔍 Automatic Site Detection

  • Detects GEOANP sites (containing "geoanp" in hostname)
  • Detects SIGMINE sites (geo.anm.gov.br)
  • Gracefully handles unknown sites

🤖 GEOANP (LGPD) Automation

  • Automatically clicks "Prosseguir" button in LGPD notices
  • Uses multiple selector strategies for robustness
  • Handles dynamic content loading

🤖 SIGMINE Automation

  • Automatically checks "Eu concordo" checkbox
  • Automatically clicks "OK" button
  • Supports various HTML structures (labels, standalone checkboxes)

🛡️ Robust Implementation

  • Multiple selector strategies with intelligent fallbacks
  • Execution state management prevents unnecessary re-runs using sessionStorage
  • Dynamic timing with multiple execution attempts (1s, 3s, 5s intervals)
  • Comprehensive error handling with detailed logging
  • Text-based element detection as fallback when selectors fail

Files Added

/userscripts/
├── Auto-Aceite LGPD e SIGMINE.user.js  # Main UserScript (340 lines)
├── README.md                           # Comprehensive documentation
└── test.html                          # Development/testing page

Technical Details

UserScript Metadata

  • Name: Auto-Aceite LGPD e SIGMINE
  • Version: 1.0.0
  • Matches: *://geoanp*/* and *://geo.anm.gov.br/*
  • Runtime: document-start for early execution

Installation

  1. Install a UserScript manager (Tampermonkey, Greasemonkey, Violentmonkey)
  2. Copy the script content from /userscripts/Auto-Aceite LGPD e SIGMINE.user.js
  3. Create new UserScript and paste the code
  4. Save and activate

Debug Support

  • Detailed console logging with [Auto-Aceite LGPD e SIGMINE] prefix
  • Toggle debug mode with DEBUG constant
  • Step-by-step execution tracking

Example Usage

The script automatically activates when visiting supported sites:

GEOANP sites:

[Auto-Aceite LGPD e SIGMINE] Site detectado: geoanp
[Auto-Aceite LGPD e SIGMINE] Executando automação...
[Auto-Aceite LGPD e SIGMINE] Iniciando automação para GEOANP (LGPD)
[Auto-Aceite LGPD e SIGMINE] Clicando no botão "Prosseguir" do LGPD
[Auto-Aceite LGPD e SIGMINE] Automação GEOANP concluída com sucesso

SIGMINE sites:

[Auto-Aceite LGPD e SIGMINE] Site detectado: sigmine
[Auto-Aceite LGPD e SIGMINE] Executando automação...
[Auto-Aceite LGPD e SIGMINE] Iniciando automação para SIGMINE
[Auto-Aceite LGPD e SIGMINE] Marcando checkbox "Eu concordo"
[Auto-Aceite LGPD e SIGMINE] Clicando no botão "OK"
[Auto-Aceite LGPD e SIGMINE] Automação SIGMINE concluída com sucesso

Testing

A test HTML file is included (/userscripts/test.html) that simulates both site scenarios for development and validation purposes.

Repository Organization

  • Added /userscripts/ directory for better organization
  • Updated main README.md with project information
  • Added .gitignore for repository cleanliness
  • All JavaScript syntax validated with Node.js

This implementation provides a reliable, maintainable solution that can adapt to minor changes in the target websites while providing comprehensive debugging capabilities.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

@nelisjunior nelisjunior marked this pull request as ready for review July 1, 2025 13:37
@nelisjunior nelisjunior merged commit f18a976 into main Jul 1, 2025
1 check passed
Copilot AI changed the title [WIP] Unir scripts de automação LGPD e SIGMINE em um único arquivo Add unified Auto-Aceite LGPD e SIGMINE UserScript Jul 1, 2025
Copilot AI requested a review from nelisjunior July 1, 2025 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants