2022-12-07 13:14:32 +01:00
|
|
|
//'use strict';
|
|
|
|
var ext_api = (typeof browser === 'object') ? browser : chrome;
|
2021-06-30 18:20:20 +02:00
|
|
|
|
2022-11-05 15:09:46 +01:00
|
|
|
if (matchDomain('gitlab.com')) {
|
2022-03-17 19:39:21 +01:00
|
|
|
window.setTimeout(function () {
|
2023-03-14 17:00:17 +01:00
|
|
|
let bio = document.querySelector('p.profile-user-bio');
|
2022-03-17 19:39:21 +01:00
|
|
|
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);
|
2021-09-05 18:47:28 +02:00
|
|
|
}
|
|
|
|
|
2022-12-07 13:14:32 +01:00
|
|
|
else {
|
|
|
|
window.setTimeout(function () {
|
|
|
|
|
|
|
|
let hostname = window.location.hostname;
|
2022-12-14 08:30:03 +01:00
|
|
|
let custom_domain = getCookieDomain(hostname);
|
2022-12-07 13:14:32 +01:00
|
|
|
let group;
|
|
|
|
if (hostname) {
|
2022-12-14 08:30:03 +01:00
|
|
|
if (document.querySelector('script[src*=".medium.com/"]') || matchDomain(['plainenglish.io']))
|
2022-12-07 13:14:32 +01:00
|
|
|
group = '###_medium_custom';
|
2023-02-08 21:58:02 +01:00
|
|
|
else if (document.querySelector('script[src*="/leaky-paywall"], link[href*="/leaky-paywall"]'))
|
2022-12-07 13:14:32 +01:00
|
|
|
group = '###_wp_leaky_paywall';
|
|
|
|
else if (document.querySelector('script[src*="/substackcdn.com/"], link[rel="stylesheet"][href*="/substackcdn.com/"]'))
|
2023-01-17 12:16:38 +01:00
|
|
|
group = '###_substack_custom';// no fix
|
2022-12-07 13:14:32 +01:00
|
|
|
else if (hostname.match(/\.(com|net)\.au$/)) {
|
|
|
|
if (document.querySelector('a[href*="/australiancommunitymedia.zendesk.com/"]'))
|
|
|
|
group = '###_au_comm_media';
|
|
|
|
else if (hostname.endsWith('.com.au')) {
|
2023-02-08 16:58:13 +01:00
|
|
|
if (document.querySelector('li > a[href*=".sevenwestmedia.com.au"]'))
|
2022-12-07 13:14:32 +01:00
|
|
|
group = 'thewest.com.au';
|
|
|
|
}
|
|
|
|
} else if (hostname.endsWith('.cl')) {
|
|
|
|
if (document.querySelector('meta[content*="/impresa.soy-chile.cl/"]'))
|
|
|
|
group = 'elmercurio.com';
|
2023-01-08 09:35:56 +01:00
|
|
|
} else if (hostname.match(/\.(de|at|ch)$/) || matchDomain(['horizont.net', 'lebensmittelzeitung.net'])) {
|
2022-12-07 13:14:32 +01:00
|
|
|
if (document.querySelector('script[data-cmp-src*=".funkedigital.de/"], div#fmg-markenanker > a[href="https://www.funkemedien.de/"]'))
|
|
|
|
group = '###_de_funke_medien';
|
|
|
|
else if (document.querySelector('link[href*=".rndtech.de/"]'))
|
|
|
|
group = '###_de_madsack';
|
2023-01-08 09:35:56 +01:00
|
|
|
else if (document.querySelector('script[src*="/dfv.containers.piwik.pro/"]'))
|
|
|
|
group = '###_de_dfv_medien';
|
2023-02-05 14:25:33 +01:00
|
|
|
else if (document.querySelector('meta[name^="cXenseParse:vrm-"]'))
|
|
|
|
group = '###_de_vrm';
|
2023-01-08 09:35:56 +01:00
|
|
|
else if (document.querySelector('link[href*="/assets.static-chmedia.ch/"]'))
|
|
|
|
group = 'nzz.ch';
|
2023-01-09 17:00:43 +01:00
|
|
|
else if (document.querySelector('link[href*=".tamedia.ch/"]'))
|
2023-01-17 12:16:38 +01:00
|
|
|
group = '###_ch_tamedia';// no fix
|
2022-12-07 13:14:32 +01:00
|
|
|
} else if (hostname.match(/\.(es|cat)$/) || matchDomain(['diariocordoba.com', 'elperiodicodearagon.com', 'elperiodicoextremadura.com', 'elperiodicomediterraneo.com', 'emporda.info'])) {
|
|
|
|
if (document.querySelector('link[href*="/estaticos-cdn."]'))
|
|
|
|
group = '###_es_epiberica';
|
2023-02-03 13:29:41 +01:00
|
|
|
} else if (hostname.endsWith('.fi')) {
|
|
|
|
if (document.querySelector('link[href^="https://assets.almatalent.fi"]'))
|
|
|
|
group = '###_fi_alma_talent';// no fix
|
2022-12-07 13:14:32 +01:00
|
|
|
} else if (hostname.endsWith('.fr')) {
|
|
|
|
if (document.querySelector('link[href*=".fr/static/bloc/ripolinage/header/cf-header/"]'))
|
|
|
|
group = '###_fr_gcf';
|
2023-01-17 12:16:38 +01:00
|
|
|
} else if (hostname.endsWith('.it')) {
|
|
|
|
if (document.querySelector('link[href^="//citynews.stgy.ovh/"]'))
|
|
|
|
group = '###_it_citynews';// no fix
|
2022-12-07 13:14:32 +01:00
|
|
|
} else if (hostname.endsWith('.nl')) {
|
|
|
|
if (document.querySelector('script[src*=".ndcmediagroep.nl/"]'))
|
|
|
|
group = '###_nl_mediahuis_noord';
|
2023-02-17 18:19:29 +01:00
|
|
|
} else if (hostname.endsWith('.co.uk')) {
|
|
|
|
if (document.querySelector('footer > div a[href^="https://www.nationalworldplc.com"]'))
|
|
|
|
group = '###_uk_nat_world';
|
2022-12-07 13:14:32 +01:00
|
|
|
} else if (hostname.match(/\.(ca|com|net|org)$/)) {
|
|
|
|
if (document.querySelector('picture > source[srcset*="%2Fgcm.omerlocdn.com%2F"]'))
|
|
|
|
group = '###_ca_gcm';
|
|
|
|
else if (document.querySelector('script[src*=".postmedia.digital/"], meta[content*=".postmedia.digital/"]'))
|
|
|
|
group = '###_ca_postmedia';
|
2022-12-23 15:48:26 +01:00
|
|
|
else if (document.querySelector('script[src*=".axate.io/"], script[src*=".agate.io/"]'))
|
|
|
|
group = '###_uk_axate.io';
|
2023-01-04 11:37:34 +01:00
|
|
|
else if (document.querySelector('link[href*=".gannett-cdn.com/"]'))
|
2022-12-07 13:14:32 +01:00
|
|
|
group = '###_usa_gannett';
|
|
|
|
else if (document.querySelector('script[src*="/treg.hearstnp.com/"]'))
|
|
|
|
group = '###_usa_hearst_comm';
|
|
|
|
else if (document.querySelector('script[src*=".townnews.com/"][src*="leetemplates.com/'))
|
|
|
|
group = '###_usa_lee_ent';
|
|
|
|
else if (document.querySelector('script[src*=".townnews.com/"][src*="/tncms/"]'))
|
|
|
|
group = '###_usa_townnews';
|
2022-12-30 12:35:13 +01:00
|
|
|
else if (document.querySelector('meta[content^="https://www.mcclatchy-wires.com/"], a[href^="https://classifieds.mcclatchy.com/"], script[src*=".mcclatchyinteractive.com/"]'))
|
2022-12-07 13:14:32 +01:00
|
|
|
group = '###_usa_mcc';
|
2022-12-28 12:21:06 +01:00
|
|
|
else if (document.querySelector('script[src*=".com/wp-content/plugins/dfm"], amp-img#paywall[src*=".com/wp-content/plugins/dfm-amp-mods/"]'))
|
2022-12-07 13:14:32 +01:00
|
|
|
group = '###_usa_mng';
|
|
|
|
else if (hostname.match(/\.com$/)) {
|
|
|
|
if (document.querySelector('link[href*=".com/wp-content/themes/madavor/"]'))
|
|
|
|
group = '###_usa_madavor';
|
2023-03-24 16:06:51 +01:00
|
|
|
else if (document.querySelector('img[data-src*="/wp-content/plugins/pragmatic-pei-rebranding/"]'))
|
2022-12-07 13:14:32 +01:00
|
|
|
group = '###_usa_pei';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ext_api.runtime.sendMessage({
|
|
|
|
request: 'custom_domain',
|
|
|
|
data: {
|
|
|
|
domain: custom_domain,
|
|
|
|
group: group
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
}, 1000);
|
|
|
|
}
|
|
|
|
|
2021-06-30 18:20:20 +02:00
|
|
|
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;
|
|
|
|
}
|
2022-11-24 17:30:56 +01:00
|
|
|
|
2022-12-14 08:30:03 +01:00
|
|
|
function getCookieDomain(hostname) {
|
|
|
|
let domain = hostname;
|
|
|
|
let n = 0;
|
|
|
|
let parts = hostname.split('.');
|
|
|
|
let str = '_gd' + (new Date()).getTime();
|
2023-01-12 19:18:09 +01:00
|
|
|
try {
|
2022-12-14 08:30:03 +01:00
|
|
|
while (n < (parts.length - 1) && document.cookie.indexOf(str + '=' + str) == -1) {
|
|
|
|
domain = parts.slice(-1 - (++n)).join('.');
|
|
|
|
document.cookie = str + "=" + str + ";domain=" + domain + ";";
|
|
|
|
}
|
|
|
|
document.cookie = str + "=;expires=Thu, 01 Jan 1970 00:00:01 GMT;domain=" + domain + ";";
|
2023-01-12 19:18:09 +01:00
|
|
|
} catch (e) {
|
|
|
|
console.log(e);
|
|
|
|
}
|
2022-12-14 08:30:03 +01:00
|
|
|
return domain;
|
2022-12-07 13:14:32 +01:00
|
|
|
}
|