Greasy Fork is available in English.

La Repubblica "Rep" Paywall Bypass

Unhides the "paywalled" articles on Rep.

  1. // ==UserScript==
  2. // @name La Repubblica "Rep" Paywall Bypass
  3. // @name:it La Repubblica "Rep" Paywall Bypass
  4. // @namespace LucciUserJS
  5. // @version 2.1.1
  6. // @description Unhides the "paywalled" articles on Rep.
  7. // @description:it Rimuove il paywall su Rep, gli articoli premium di la Repubblica.it.
  8. // @author Lucci <gabriele@lucci.xyz>, Andrea Lazzarotto
  9. // @match https://rep.repubblica.it/*
  10. // @license GPL version 3 or any later version http://www.gnu.org/copyleft/gpl.html
  11. // ==/UserScript==
  12.  
  13. const addStyle = function(css) {
  14. /**
  15. * Inject CSS into the document.
  16. *
  17. * This is a standalone implementation of GM_addStyle, which is
  18. * deprecated by Greasemonkey but still supported by other extensions.
  19. *
  20. * Inspired by Tampermonkey's TM_addStyle function, which is
  21. * Tampermonkey's own implementation of GM_addStyle.
  22. **/
  23. try {
  24. let style = document.createElement('style');
  25. style.textContent = css;
  26. parent = (document.head || document.body || document.documentElement || document);
  27. parent.appendChild(style);
  28. } catch (e) {
  29. console.log("Error: " + e);
  30. }
  31. };
  32.  
  33. const redirect = function() {
  34. var pwa = location.href.indexOf("/pwa/") > 0;
  35. var comments = location.pathname.endsWith("/commenti");
  36. if (pwa && !comments) {
  37. location.href = location.href.replace("/pwa/", "/ws/detail/");
  38. }
  39. };
  40.  
  41. (function () {
  42. 'use strict';
  43. redirect()
  44. addStyle(
  45. `
  46. div.detail-article_body > div:not(.paywall) {
  47. display: none !important;
  48. }
  49. div.detail-article_body > div.paywall,
  50. body:not(.i-amphtml-subs-grant-yes) [subscriptions-section='content'] {
  51. display: block !important;
  52. }
  53. `
  54. );
  55. window.dispatchEvent(new Event('resize'));
  56. })()