// ==UserScript==
// @name Bypass Modiji Team SPY (Chrome Version)
// @namespace CHROME Scripts
// @version 1.2.0
// @grant GM_setValue
// @grant GM_getValue
// @grant GM_addStyle
// @grant GM_xmlhttpRequest
// @grant window.onurlchange
// @grant GM_registerMenuCommand
// @icon https://lh3.googleusercontent.com/-HPcn7AqepNg/AAAAAAAAAAI/AAAAAAAAAAA/ALKGfknb1BkQiq-8_KUVOYcNAJ4swKivDQ/photo.jp
// @description Automatically bypass Modiji URL (Chrome Compatible)
// @homepageURL https://t.me/team_spy_pro
// @supportURL https://t.me/team_spy_pro
// @license MIT
// @include /^https:\/\/[^\/]+\/safe\.php\?link=https:\/\/modijiurl\.com\/[^\/]+\/\?mid=.*$/
// @include /^https:\/\/modijiurl\.com\/[^\/]+\/\?mid=.*$/
// @run-at document-start
// @noframes
// ==/UserScript==
/*
MIT License
Copyright (c) 2024 [Your Name or Organization]
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
(function() {
'use strict';
const url = window.location.href;
const redirect = (finalUrl) => window.location.assign(finalUrl);
const getParam = (url, param) => new URLSearchParams(url).get(param);
const rot13 = (str) => str.replace(/[A-Za-z]/g, char => String.fromCharCode((char.charCodeAt(0) % 32 + 13) % 26 + (char < 'a' ? 65 : 97)));
const popupsToRedirects = () => window.open = (url, target, features) => (window.location.href = url, window);
const afterDOMLoaded = (callback) => document.addEventListener('DOMContentLoaded', callback);
const afterWindowLoaded = (callback) => window.addEventListener('load', callback);
const isValidUrl = (url) => /^(?:https?|ftp):\/\/(?:\w+\.){1,3}\w+(?:\/\S*)?$/.test(url);
const clickIfExists = (selector) => {
let intervalId = setInterval(() => {
let button = document.querySelector(selector);
if (button) {
clearInterval(intervalId);
button.click();
}
}, 1000);
};
const redirectIfExists = (selector) => {
let intervalId = setInterval(() => {
let button = document.querySelector(selector);
if (button && button.href && isValidUrl(button.href)) {
clearInterval(intervalId);
redirect(button.href);
}
}, 500);
};
const clickIfExistsNonStop = (selector) => {
let intervalId = setInterval(() => {
let button = document.querySelector(selector + ':not(.disabled)');
if (button) {
button.click();
}
}, 500);
};
const redirectIfNotDisabled = (selector) => {
let intervalId = setInterval(() => {
let linkButton = document.querySelector(selector + ':not(.disabled)');
if (linkButton && !linkButton.href.includes('/undefined')) {
clearInterval(intervalId);
setTimeout(function() {
redirect(linkButton.href);
}, 500);
}
}, 500);
};
const clickIfNotDisabled = (buttonSelector) => {
let intervalId = setInterval(() => {
let button = document.querySelector(buttonSelector);
if (!button.hasAttribute('disabled') && !button.classList.contains('disabled')) {
clearInterval(intervalId);
setTimeout(function() {
button.click();
}, 500);
}
}, 500);
};
const checkElementVisible = (element) => element !== null && !!(element.offsetWidth || element.offsetHeight || element.getClientRects().length) && (!element.getAttribute('style') || !element.getAttribute('style').includes('display:none'));
const clickIfVisible = (selector) => {
afterDOMLoaded(function() {
let intervalId = setInterval(() => {
let element = document.querySelector(selector);
if (checkElementVisible(element)) {
clearInterval(intervalId);
element.click();
}
}, 1000);
});
};
const preventForcedFocusOnWindow = () => {
window.mouseleave = true;
window.onmouseover = true;
document.hasFocus = function() { return true; };
Object.defineProperty(document, 'webkitVisibilityState', { get() { return 'visible'; } });
Object.defineProperty(document, 'visibilityState', { get() { return 'visible'; } });
window.addEventListener('visibilitychange', function(e) { e.stopImmediatePropagation(); }, true);
window.addEventListener('focus', onfocus, true);
document.addEventListener('visibilitychange', function(e) { e.stopImmediatePropagation(); }, true);
Object.defineProperty(document, 'hidden', { get() { return false; } });
};
function browserIsChrome() {
return /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor);
}
// Check for compatibility and apply script
if (browserIsChrome()) {
/^https:\/\/[^\/]+\/safe\.php\?link=https:\/\/modijiurl\.com\/[^\/]+\/\?mid=.*$/.test(url) ? redirect(url.split('?link=')[1]) : null;
/^https:\/\/modijiurl\.com\/[^\/]+\/\?mid=.*$/.test(url) ? redirectIfNotDisabled('#getLinkButton') : null;
}
})();