mirror of
https://codeberg.org/Amm0ni4/bypass-all-shortlinks-debloated.git
synced 2025-01-31 15:07:28 +05:00
fix for link detection of bypass.city
This commit is contained in:
parent
6e87005046
commit
bc172776e5
3 changed files with 24 additions and 10 deletions
|
@ -4,7 +4,7 @@
|
||||||
// @run-at document-start
|
// @run-at document-start
|
||||||
// @author Amm0ni4
|
// @author Amm0ni4
|
||||||
// @noframes
|
// @noframes
|
||||||
// @version 92.3.23
|
// @version 92.3.25
|
||||||
// @grant GM_setValue
|
// @grant GM_setValue
|
||||||
// @grant GM_getValue
|
// @grant GM_getValue
|
||||||
// @grant GM_addStyle
|
// @grant GM_addStyle
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
// @run-at document-start
|
// @run-at document-start
|
||||||
// @author Amm0ni4
|
// @author Amm0ni4
|
||||||
// @noframes
|
// @noframes
|
||||||
// @version 92.3.23
|
// @version 92.3.25
|
||||||
// @grant GM_setValue
|
// @grant GM_setValue
|
||||||
// @grant GM_getValue
|
// @grant GM_getValue
|
||||||
// @grant GM_addStyle
|
// @grant GM_addStyle
|
||||||
|
@ -1808,10 +1808,15 @@
|
||||||
const isValidUrl = url => { try { new URL(url); return true; } catch (error) { return false; } };
|
const isValidUrl = url => { try { new URL(url); return true; } catch (error) { return false; } };
|
||||||
|
|
||||||
function makeUrlClickable(element) {
|
function makeUrlClickable(element) {
|
||||||
let url = element.textContent.match(/(https?:\/\/\S+)/)[0];
|
let initialUrl = element.textContent;
|
||||||
|
let url = element.textContent.replace('The resolved url is: ', '')
|
||||||
|
if (!url.startsWith('http')) {
|
||||||
|
url = 'https://' + url;
|
||||||
|
}
|
||||||
|
url = url.match(/(https?:\/\/\S+)/)[0];
|
||||||
if (url && isValidUrl(url) && !url.endsWith('...')) {
|
if (url && isValidUrl(url) && !url.endsWith('...')) {
|
||||||
let link = document.createElement('a'); link.href = url; link.textContent = url;
|
let link = document.createElement('a'); link.href = url; link.textContent = url;
|
||||||
element.innerHTML = element.innerHTML.replace(url, link.outerHTML);
|
element.innerHTML = 'The resolved url is: ' + element.innerHTML.replace(initialUrl, link.outerHTML);
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1820,10 +1825,12 @@
|
||||||
window.addEventListener('load', function() { //After window loaded
|
window.addEventListener('load', function() { //After window loaded
|
||||||
let checkInterval = setInterval(function() { //Check every 0.5s if the link is available
|
let checkInterval = setInterval(function() { //Check every 0.5s if the link is available
|
||||||
let linkContainerElement = document.querySelector('div.mantine-fn96xv:nth-child(3)');
|
let linkContainerElement = document.querySelector('div.mantine-fn96xv:nth-child(3)');
|
||||||
if (linkContainerElement && linkContainerElement.innerHTML.includes('http')) {
|
if (linkContainerElement) {
|
||||||
clearInterval(checkInterval);
|
clearInterval(checkInterval);
|
||||||
let targetUrl = makeUrlClickable(linkContainerElement);
|
let targetUrl = makeUrlClickable(linkContainerElement);
|
||||||
isValidUrl(targetUrl) && window.location.assign(targetUrl);
|
if (isValidUrl(targetUrl)) {
|
||||||
|
setTimeout(function() { window.location.assign(targetUrl); }, 4000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, 500);
|
}, 500);
|
||||||
});
|
});
|
||||||
|
|
|
@ -12,10 +12,15 @@
|
||||||
const isValidUrl = url => { try { new URL(url); return true; } catch (error) { return false; } };
|
const isValidUrl = url => { try { new URL(url); return true; } catch (error) { return false; } };
|
||||||
|
|
||||||
function makeUrlClickable(element) {
|
function makeUrlClickable(element) {
|
||||||
let url = element.textContent.match(/(https?:\/\/\S+)/)[0];
|
let initialUrl = element.textContent;
|
||||||
|
let url = element.textContent.replace('The resolved url is: ', '')
|
||||||
|
if (!url.startsWith('http')) {
|
||||||
|
url = 'https://' + url;
|
||||||
|
}
|
||||||
|
url = url.match(/(https?:\/\/\S+)/)[0];
|
||||||
if (url && isValidUrl(url) && !url.endsWith('...')) {
|
if (url && isValidUrl(url) && !url.endsWith('...')) {
|
||||||
let link = document.createElement('a'); link.href = url; link.textContent = url;
|
let link = document.createElement('a'); link.href = url; link.textContent = url;
|
||||||
element.innerHTML = element.innerHTML.replace(url, link.outerHTML);
|
element.innerHTML = 'The resolved url is: ' + element.innerHTML.replace(initialUrl, link.outerHTML);
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,10 +29,12 @@
|
||||||
window.addEventListener('load', function() { //After window loaded
|
window.addEventListener('load', function() { //After window loaded
|
||||||
let checkInterval = setInterval(function() { //Check every 0.5s if the link is available
|
let checkInterval = setInterval(function() { //Check every 0.5s if the link is available
|
||||||
let linkContainerElement = document.querySelector('div.mantine-fn96xv:nth-child(3)');
|
let linkContainerElement = document.querySelector('div.mantine-fn96xv:nth-child(3)');
|
||||||
if (linkContainerElement && linkContainerElement.innerHTML.includes('http')) {
|
if (linkContainerElement) {
|
||||||
clearInterval(checkInterval);
|
clearInterval(checkInterval);
|
||||||
let targetUrl = makeUrlClickable(linkContainerElement);
|
let targetUrl = makeUrlClickable(linkContainerElement);
|
||||||
isValidUrl(targetUrl) && window.location.assign(targetUrl);
|
if (isValidUrl(targetUrl)) {
|
||||||
|
setTimeout(function() { window.location.assign(targetUrl); }, 4000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, 500);
|
}, 500);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue