From 57eaea0d72eb925c97930de97780502a37248d7d Mon Sep 17 00:00:00 2001 From: Rodrigo Orem Date: Tue, 14 Jun 2022 18:42:01 -0300 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20Ga=C3=BAchaZH?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/burlesco.user.js | 45 +++++++++++++------------------------------- 1 file changed, 13 insertions(+), 32 deletions(-) diff --git a/src/burlesco.user.js b/src/burlesco.user.js index 3563821..8099e40 100644 --- a/src/burlesco.user.js +++ b/src/burlesco.user.js @@ -9,7 +9,6 @@ // Atenção: Caso algum site não funcione logo após a instalação, limpe o cache do navegador. // @grant GM_webRequest // @grant GM_xmlhttpRequest -// @connect gauchazh.clicrbs.com.br // @connect static.infoglobo.com.br // @connect cdn.tinypass.com // @connect observador.pt @@ -34,7 +33,6 @@ // @match *://*.nytimes.com/* // @match *://*.nyt.com/* // @match *://*.oglobo.globo.com/* -// @match *://www.rbsonline.com.br/* // @match *://api.tinypass.com/* // @match *://cdn.tinypass.com/* // @match *://dashboard.tinypass.com/* @@ -77,14 +75,11 @@ // @webRequestItem {"selector":"*://correio.rac.com.br/includes/js/novo_cp/fivewall.js*","action":"cancel"} // @webRequestItem {"selector":"*://dashboard.tinypass.com/xbuilder/experience/load*","action":"cancel"} // @webRequestItem {"selector":"*://*.fivewall.com.br/*","action":"cancel"} -// @webRequestItem {"selector":"*://www.rbsonline.com.br/cdn/scripts/SLoader.js","action":"cancel"} // @webRequestItem {"selector":"*://*.nytimes.com/js/mtr.js","action":"cancel"} // @webRequestItem {"selector":"*://*.washingtonpost.com/wp-stat/pwapi/*","action":"cancel"} // @webRequestItem {"selector":"*://cdn.tinypass.com/api/tinypass.min.js","action":"cancel"} // @webRequestItem {"selector":"*://api.tinypass.com/*","action":"cancel"} // @webRequestItem {"selector":"*://tm.jsuol.com.br/modules/content-gate.js","action":"cancel"} -// @webRequestItem {"selector":"*://gauchazh.clicrbs.com.br/static/main*","action":"cancel"} -// @webRequestItem {"selector":"*://www.rbsonline.com.br/cdn/scripts/special-paywall.min.js*","action":"cancel"} // @webRequestItem {"selector":"https://paywall.nsctotal.com.br/behaviors","action":"cancel"} // @webRequestItem {"selector":"*://*.estadao.com.br/paywall/*","action":"cancel"} // @webRequestItem {"selector":"*://www.folhadelondrina.com.br/login.php*","action":"cancel"} @@ -105,38 +100,24 @@ // run_at: document_start if (/gauchazh\.clicrbs\.com\.br/.test(document.location.host)) { - document.addEventListener('DOMContentLoaded', function() { - function patchJs(jsurl) { - GM_xmlhttpRequest({ - method: 'GET', - url: jsurl, - onload: function(response) { - var injectme = response.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'); - 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); - } - }); - } + 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'); + } - var scripts = Array.from(document.getElementsByTagName('script')); - var script = scripts.find((el) => { return el.src.includes('static/main'); }); - if (script) - patchJs(script.src); + document.addEventListener('DOMContentLoaded', function() { + cleanPaywallTracking(); + document.body.addEventListener('click', cleanPaywallTracking, true); }); window.onload = function() { function check(){ - if(document.getElementsByClassName('wrapper-paid-content')[0]){ - document.getElementsByClassName('wrapper-paid-content')[0].innerHTML = '

Por favor aperte Ctrl-F5 para carregar o restante da notícia!

'; + if( + document.getElementsByClassName('wrapper-paid-content')[0] && + !document.getElementsByClassName('wrapper-paid-content')[0].innerHTML.includes('Burlesco') + ) { + document.getElementsByClassName('wrapper-paid-content')[0].innerHTML = '

Burlesco: Por favor aperte Ctrl-F5 para carregar o restante da notícia!

' + document.getElementsByClassName('wrapper-paid-content')[0].innerHTML; } setTimeout(function(){ check(); }, 1000); } From f2837dba3d8e2ef9009a46362b715d214b29b3e5 Mon Sep 17 00:00:00 2001 From: Rodrigo Orem Date: Sat, 25 Jun 2022 19:06:27 -0300 Subject: [PATCH 2/2] =?UTF-8?q?feat:=20libera=20colunas=20de=20opini=C3=A3?= =?UTF-8?q?o=20do=20Ga=C3=BAchaZH?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Restaurado o método de injeção de script. Sem ele, as colunas de opinião não são liberadas. A diferença é o bloqueio do script signwall. --- src/burlesco.user.js | 43 +++++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/src/burlesco.user.js b/src/burlesco.user.js index 8099e40..1e5d35b 100644 --- a/src/burlesco.user.js +++ b/src/burlesco.user.js @@ -9,6 +9,7 @@ // Atenção: Caso algum site não funcione logo após a instalação, limpe o cache do navegador. // @grant GM_webRequest // @grant GM_xmlhttpRequest +// @connect gauchazh.clicrbs.com.br // @connect static.infoglobo.com.br // @connect cdn.tinypass.com // @connect observador.pt @@ -80,6 +81,7 @@ // @webRequestItem {"selector":"*://cdn.tinypass.com/api/tinypass.min.js","action":"cancel"} // @webRequestItem {"selector":"*://api.tinypass.com/*","action":"cancel"} // @webRequestItem {"selector":"*://tm.jsuol.com.br/modules/content-gate.js","action":"cancel"} +// @webRequestItem {"selector":"*://gauchazh.clicrbs.com.br/static/main*","action":"cancel"} // @webRequestItem {"selector":"https://paywall.nsctotal.com.br/behaviors","action":"cancel"} // @webRequestItem {"selector":"*://*.estadao.com.br/paywall/*","action":"cancel"} // @webRequestItem {"selector":"*://www.folhadelondrina.com.br/login.php*","action":"cancel"} @@ -94,32 +96,45 @@ // @webRequestItem {"selector":"*://prisa-el-pais-brasil-prod.cdn.arcpublishing.com/arc/subs/p.js","action":"cancel"} // @webRequestItem {"selector":"*://prisa-el-pais-prod.cdn.arcpublishing.com/arc/subs/p.js","action":"cancel"} // @webRequestItem {"selector":"*://brasil.elpais.com/pf/resources/dist/js/article.js*","action":"cancel"} +// @webRequestItem {"selector":"*://gauchazh.clicrbs.com.br/static/signwall.*.min.js","action":"cancel"} // @run-at document-start // @noframes // ==/UserScript== // run_at: document_start if (/gauchazh\.clicrbs\.com\.br/.test(document.location.host)) { - 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'); - } - document.addEventListener('DOMContentLoaded', function() { - cleanPaywallTracking(); - document.body.addEventListener('click', cleanPaywallTracking, true); + function patchJs(jsurl) { + GM_xmlhttpRequest({ + method: 'GET', + url: jsurl, + onload: function(response) { + var injectme = response.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); + } + }); + } + + const scripts = Array.from(document.getElementsByTagName('script')); + const script = scripts.find((el) => { return el.src.includes('static/main'); }); + if (script) { + patchJs(script.src); + } }); window.onload = function() { function check(){ - if( - document.getElementsByClassName('wrapper-paid-content')[0] && - !document.getElementsByClassName('wrapper-paid-content')[0].innerHTML.includes('Burlesco') - ) { - document.getElementsByClassName('wrapper-paid-content')[0].innerHTML = '

Burlesco: Por favor aperte Ctrl-F5 para carregar o restante da notícia!

' + document.getElementsByClassName('wrapper-paid-content')[0].innerHTML; + if(document.getElementsByClassName('wrapper-paid-content')[0]){ + document.getElementsByClassName('wrapper-paid-content')[0].innerHTML = '

Por favor aperte Ctrl-F5 para carregar o restante da notícia!

'; } - setTimeout(function(){ check(); }, 1000); + setTimeout(function(){ check(); }, 5000); } check(); };