burlesco/src/content-start.js

146 lines
4.2 KiB
JavaScript
Raw Normal View History

2017-11-07 05:45:39 -08:00
// run_at: document_start
const INJECTION = {
2019-10-20 09:59:10 -07:00
crusoe: {
url : /crusoe.com.br/,
code: `
document.cookie = 'crs_subscriber=1';
`
},
2019-06-27 10:10:57 -07:00
diariograndeabc: {
url : /dgabc.com.br/,
code: `
var email = "colaborador@dgabc.com.br";
var senha = "";
localStorage.emailNoticiaExclusiva = email;
$('.NoticiaExclusivaNaoLogado').hide();
$('.NoticiaExclusivaLogadoSemPermissao').hide();
$('.linhaSuperBanner').show();
$(".footer").show();
$('.NoticiaExclusivaLogado').show();
`
},
2019-10-20 13:32:46 -07:00
em: {
url: /em\.com\.br/,
code: `
2020-01-24 08:06:19 -08:00
window.id_acesso_noticia=0
style = document.createElement('style')
style.type = 'text/css'
2019-10-20 13:32:46 -07:00
css=\`
2020-01-24 08:06:19 -08:00
.news-blocked {
display: none !important
}
2019-10-20 13:32:46 -07:00
.news-blocked-no-scroll {
overflow: auto !important;
width: auto !important;
position: unset !important;
}
2020-01-24 08:06:19 -08:00
div[itemprop="articleBody"] {
height: auto !important;
}
2019-10-20 13:32:46 -07:00
\`;
2020-01-24 08:06:19 -08:00
style.appendChild(document.createTextNode(css))
document.head.appendChild(style)
2019-10-20 13:32:46 -07:00
`
},
gauchazh: {
url : /gauchazh.clicrbs.com.br/,
code: `
2022-06-25 16:58:01 -07:00
document.addEventListener('DOMContentLoaded', function() {
function patchJs(jsurl) {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
var injectme = this.responseText;
injectme = injectme.replace(
/![a-z].showLoginPaywall&&![a-z].showPaywall\\|\\|!1/g, 'true');
injectme = injectme.replace('throw new Error("only one instance of babel-polyfill is allowed");', '');
var script = document.createElement("script");
script.type = "text/javascript";
var textNode = document.createTextNode(injectme);
script.appendChild(textNode);
document.head.appendChild(script);
}
};
xhttp.open("GET", jsurl.replace('.com.br', '.com.br.'), true);
xhttp.send();
}
2017-11-07 05:45:39 -08:00
2022-06-25 16:58:01 -07:00
const scripts = Array.from(document.getElementsByTagName('script'));
const script = scripts.find((el) => { return el.src.includes('static/main'); });
if (script) {
patchJs(script.src);
2022-06-25 16:58:01 -07:00
}
});
2022-06-25 16:58:01 -07:00
window.onload = function() {
function check(){
if(document.getElementsByClassName('wrapper-paid-content')[0]){
document.getElementsByClassName('wrapper-paid-content')[0].innerHTML = '<p>Por favor aperte Ctrl-F5 para carregar o restante da notícia!</p>';
}
setTimeout(function(){ check(); }, 5000);
}
check();
};
const cleanPaywallTracking = () => {
document.cookie = 'pwsi__zh=;domain=.clicrbs.com.br;path=/;expires=Thu, 01 Jan 1970 00:00:01 GMT';
localStorage.removeItem('pwsi__zh');
sessionStorage.removeItem('pwsi__zh');
};
cleanPaywallTracking();
setTimeout(cleanPaywallTracking, 5000);
document.body.addEventListener('click', cleanPaywallTracking, true);
`
2018-11-23 20:26:59 -08:00
},
oglobo: {
2019-08-05 13:14:50 -07:00
url: /globo\.com/,
2018-11-23 20:26:59 -08:00
code: `
window.hasPaywall = false
2018-11-23 20:26:59 -08:00
`
},
2020-07-24 23:21:31 -07:00
nexo: {
url: /nexojornal\.com\.br/,
code: `
style = document.createElement('style')
style.type = 'text/css'
const css = \`
body {
overflow: auto !important;
}
div[class*='PaywallBumper__wrap-container'],
div[class*='Datawall__wrap-container'] {
display: none !important;
}
\`;
style.appendChild(document.createTextNode(css))
document.head.appendChild(style)
2020-07-24 23:21:31 -07:00
`
},
};
2018-06-19 19:39:59 -07:00
chrome.storage.local.get('sites', function(result) {
for (let site in INJECTION) {
let enabledSites = result.sites;
if (enabledSites && enabledSites[site] == false)
continue;
if (INJECTION[site] == undefined)
continue;
if (INJECTION[site].url.test(document.location.host)) {
var script = document.createElement('script');
script.textContent = INJECTION[site].code;
(document.head||document.documentElement).appendChild(script);
script.parentNode.removeChild(script);
break;
}
}
});