Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save opastorello/cb5ef0946d6c42adc5b014dd6b17f159 to your computer and use it in GitHub Desktop.

Select an option

Save opastorello/cb5ef0946d6c42adc5b014dd6b17f159 to your computer and use it in GitHub Desktop.
GoofishLoginBypass.js
// ==UserScript==
// @name Goofish Login Bypass
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Remove login modals e mantém a página navegável no Goofish
// @author Nícolas Pastorello
// @match https://www.goofish.com/*
// @icon https://img.alicdn.com/tfs/TB19WObTNv1gK0jSZFFXXb0sXXa-144-144.png
// @grant none
// @run-at document-idle
// ==/UserScript==
(function() {
'use strict';
function debounce(fn, ms) {
var t;
return function() {
clearTimeout(t);
t = setTimeout(fn, ms);
};
}
function dismissLogin() {
// Remove ant-design modal (central login popup)
document.querySelectorAll('.ant-modal-mask, [class*="login-modal-wrap"], [class*="ant-modal-wrap"]').forEach(function(el) {
el.remove();
});
// Remove iframe-based login dialogs
document.querySelectorAll('[class*="dialog"],[class*="modal"]').forEach(function(d) {
if (d.querySelector('iframe[src*="login"],iframe[src*="passport"]')) d.remove();
});
// Remove fixed overlays/masks with high z-index
document.querySelectorAll('[class*="mask"],[class*="overlay"]').forEach(function(el) {
var s = window.getComputedStyle(el);
if (s.position === 'fixed' && parseFloat(s.zIndex) >= 1000) el.remove();
});
// Remove login-specific elements by class pattern
document.querySelectorAll('[class*="loginDialog"],[class*="login-dialog"],[class*="login-mask"],[class*="login-guide"],[class*="loginBar"],[class*="guide-login"],[class*="loginGuide"],[class*="bottomLead"]').forEach(function(el) { el.remove(); });
// Remove bottom login bar (position:fixed at bottom with login text)
var allDivs = document.querySelectorAll('div');
for (var i = 0; i < allDivs.length; i++) {
var el = allDivs[i];
var r = el.getBoundingClientRect();
var s = window.getComputedStyle(el);
if (r.bottom >= window.innerHeight - 5 && r.height < 80 && r.height > 20 && (s.position === 'fixed' || s.position === 'sticky') && el.textContent.indexOf('\u767B\u5F55') !== -1) {
el.remove();
}
}
document.body.style.setProperty('overflow-y', 'auto', 'important');
document.body.style.setProperty('overflow-x', 'auto', 'important');
}
// Inject persistent CSS override
var scrollFix = document.createElement('style');
scrollFix.textContent = 'body { overflow-y: auto !important; overflow-x: auto !important; }';
document.head.appendChild(scrollFix);
// Run immediately
dismissLogin();
// Watch for dynamically injected login modals
new MutationObserver(debounce(dismissLogin, 200)).observe(document.body, { childList: true, subtree: true });
// Watch for scroll lock on body
new MutationObserver(function() {
if (window.getComputedStyle(document.body).overflowY === 'hidden') {
document.body.style.setProperty('overflow-y', 'auto', 'important');
}
}).observe(document.body, { attributes: true, attributeFilter: ['style', 'class'] });
// Periodic cleanup for the first 10 seconds
var runs = 0;
var iv = setInterval(function() { dismissLogin(); if (++runs > 20) clearInterval(iv); }, 500);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment