mirror of
https://gitlab.com/magnolia1234/bypass-paywalls-firefox-clean.git
synced 2024-11-10 08:17:49 +01:00
57 lines
1.8 KiB
JavaScript
57 lines
1.8 KiB
JavaScript
//"use strict";
|
|
|
|
if (matchDomain('gitlab.com')) {
|
|
window.setTimeout(function () {
|
|
let bio = document.querySelector('div.profile-user-bio');
|
|
if (bio) {
|
|
let split = bio.innerText.split(/(https:[\w\-/.]+)|\|/g).filter(x => x && x.trim());
|
|
bio.innerText = '';
|
|
for (let part of split) {
|
|
let elem;
|
|
if (part.startsWith('https')) {
|
|
elem = document.createElement('a');
|
|
elem.innerText = part;
|
|
elem.href = part;
|
|
elem.appendChild(document.createElement('br'));
|
|
} else {
|
|
elem = document.createElement('b');
|
|
elem.appendChild(document.createTextNode(part));
|
|
if (!part.includes(':'))
|
|
elem.appendChild(document.createElement('br'));
|
|
}
|
|
bio.appendChild(elem);
|
|
}
|
|
}
|
|
}, 1000);
|
|
}
|
|
|
|
else if (matchDomain('nzherald.co.nz')) {
|
|
function nzherald_main() {
|
|
if (window.Fusion)
|
|
window.Fusion.globalContent.isPremium = false;
|
|
}
|
|
window.setTimeout(function () {
|
|
insert_script(nzherald_main);
|
|
}, 100);
|
|
}
|
|
|
|
function matchDomain(domains, hostname) {
|
|
var matched_domain = false;
|
|
if (!hostname)
|
|
hostname = window.location.hostname;
|
|
if (typeof domains === 'string')
|
|
domains = [domains];
|
|
domains.some(domain => (hostname === domain || hostname.endsWith('.' + domain)) && (matched_domain = domain));
|
|
return matched_domain;
|
|
}
|
|
|
|
function insert_script(func, insertAfterDom) {
|
|
let bpc_script = document.querySelector('script#bpc_script');
|
|
if (!bpc_script) {
|
|
let script = document.createElement('script');
|
|
script.setAttribute('id', 'bpc_script');
|
|
script.appendChild(document.createTextNode('(' + func + ')();'));
|
|
let insertAfter = insertAfterDom ? insertAfterDom : (document.body || document.head || document.documentElement);
|
|
insertAfter.appendChild(script);
|
|
}
|
|
}
|