burlesco/src/content-start.js

149 lines
4.9 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: `
style = document.createElement('style');
style.type = 'text/css';
css=\`
.news-blocked {display: none !important}
.news-blocked-no-scroll {
overflow: auto !important;
width: auto !important;
position: unset !important;
}
\`;
style.appendChild(document.createTextNode(css));
document.head.appendChild(style);
`
},
gauchazh: {
url : /gauchazh.clicrbs.com.br/,
code: `
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,/g, 'false,');
injectme = injectme.replace(/[a-z].showPaywall,/g, 'false,');
injectme = injectme.replace(/[a-z].requestCPF\\|\\|!1,/g, 'false,');
injectme = injectme.replace(
/![a-z].showLoginPaywall&&![a-z].showPaywall\\|\\|!1/g, 'true');
2018-06-19 19:44:48 -07:00
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, true);
xhttp.send();
}
2017-11-07 05:45:39 -08:00
document.addEventListener("DOMContentLoaded", function(event) {
var scripts = Array.from(document.getElementsByTagName('script'));
var script = scripts.find((el) => {
return el.src.includes('static/main')
});
if (script)
patchJs(script.src);
});
`
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: `
function patchJs(jsurl) {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
var injectme = this.responseText;
2019-06-21 11:37:04 -07:00
injectme = injectme.replace('window.hasPaywall||!1;window.dataLayer=window.dataLayer||[]', 'false');
2018-11-23 20:26:59 -08:00
injectme = injectme.replace('window.conteudoExclusivo?!0:!1', 'false');
2019-06-22 11:45:05 -07:00
injectme = injectme.replace('Piano.activePaywall=!0', 'Piano.activePaywall=false');
injectme = injectme.replace('Piano.checkPaywall()', '');
2018-11-23 20:26:59 -08:00
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, true);
xhttp.send();
}
document.addEventListener("DOMContentLoaded", function(event) {
var scripts = Array.from(document.getElementsByTagName('script'));
var script = scripts.find((el) => {
return el.src.includes('js/tiny.js')
});
if (script)
patchJs(script.src);
});
`
},
2019-08-06 21:31:31 -07:00
nexo: {
url: /nexojornal\.com\.br/,
code: `
(function () {
let oldXHROpen = window.XMLHttpRequest.prototype.open;
window.XMLHttpRequest.prototype.open = function(method, url, async, user, password) {
if (url.includes('/paywall/access/')) {
Object.defineProperty(this, 'status', { writable: true });
Object.defineProperty(this, 'statusText', { writable: true });
this.status = 200;
this.statusText = 'OK';
}
return oldXHROpen.apply(this, arguments);
}
})();
(function () {
style = document.createElement('style');
style.type = 'text/css';
css='#aviso-metered-access {display: none !important}';
style.appendChild(document.createTextNode(css));
document.head.appendChild(style);
})();
`
},
};
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;
}
}
});