Greasy Fork is available in English.

appledaily-zero

蘋果新聞 零會員 | 免登記成為(壹)會員都可安心睇蘋果日報 | ported from https://github.com/QuentinFung/appledaily-unblock

  1. // ==UserScript==
  2. // @name appledaily-zero
  3. // @namespace https://www.xmader.com/
  4. // @version 1.19.0
  5. // @description 蘋果新聞 零會員 | 免登記成為(壹)會員都可安心睇蘋果日報 | ported from https://github.com/QuentinFung/appledaily-unblock
  6. // @author QuentinFung, Xmader
  7. // @match *://*.appledaily.com/*
  8. // @match *://*.appledaily.com.hk/*
  9. // @match *://*.appledaily.com.tw/*
  10. // @match *://*.nextmedia.com/*
  11. // @match *://*.nextmag.com.tw/*
  12. // @match *://*.nextmgz.com/*
  13. // @match *://*.nextdigital.com.hk/*
  14. // @match *://*.applehealth.com.hk/*
  15. // @match *://*.applefruity.com/*
  16. // @match *://*.nextfilm.com.hk/*
  17. // @license MIT
  18. // @copyright Copyright (c) 2019-2020 QuentinFung, Xmader
  19. // @run-at document-start
  20. // @noframes
  21. // @grant none
  22. // ==/UserScript==
  23.  
  24. (function overwrite(link) {
  25. //if (link.href.indexOf('.js') < 0) {
  26. var xhr = new XMLHttpRequest();
  27. xhr.open('GET', link.href, false); // sync request
  28. xhr.onload = () => {
  29. var html = xhr.responseText;
  30. // HK, US
  31. html = html.replace('function uReadDisplayMsgBox(showdef){', 'function uReadDisplayMsgBox(showdef){}\nfunction xxx(showdef){');
  32. html = html.replace('function uReadDisplayMsgBox(showdef, atype){', 'function uReadDisplayMsgBox(showdef, atype){}\nfunction xxx(showdef, atype){');
  33. // HK mobile
  34. html = html.replace('function uReadPrompt(content,msgtype,vdoimg){', 'function uReadPrompt(content,msgtype,vdoimg){}\nfunction xxx(content,msgtype,vdoimg){');
  35. // TW
  36. html = html.replace('var effects = function(e,val){', 'var effects = function(e,val){$(".ndAritcle_headPic,.ndArticle_margin,.mediabox,#playerVideo,.articulum").show();};\nvar effectsx = function(e,val){');
  37. html = html.replace('.parent().remove();', '.parent();');
  38. html = html.replace('class="ndArticle_margin" style="display: none;"', 'class="ndArticle_margin"');
  39. // 04JUL2019
  40. html = html.replace(/visibility: hidden;/g, '');
  41. // nextmag
  42. html = html.replace('<div class="article-content">', '<div class="article-content" style="display:block!important">');
  43. // 果燃台
  44. if (link.href.substr(0, 49) == 'https://hk.feature.appledaily.com/goodestchannel/' || link.href.substr(0, 42) == 'https://hk.applefruity.com/goodestchannel/')
  45. html += "<script>function setBanPaidFalse(){if(document.querySelector('.videoPlayer')!=null && document.querySelector('.videoPlayer').__vue__.banPaid){document.querySelector('.videoPlayer').__vue__.banPaid = false;}} var r = setInterval(setBanPaidFalse, 1000);</script>";
  46. // 蘋果台
  47. if (link.href.substr(0, 43) == 'https://tw.feature.appledaily.com/applepie/')
  48. html += "<script>function setBanPaidFalse(){if(document.querySelector('.videoPlayer')!=null && document.querySelector('.videoPlayer').__vue__.banPaid){document.querySelector('.videoPlayer').__vue__.banPaid = false;}} var r = setInterval(setBanPaidFalse, 1000);</script>";
  49. // 飲食男女
  50. html = html.replace('function blockContent() {', 'function blockContent() {}\nfunction xxx() {');
  51. // 台灣會員專區
  52. html = html.replace(/hideContent:'nm-main-articles',/g, "hideContent:'nm-main-articlesxxx',");
  53. html = html.replace(".nm-main-articles {display:none;}", '');
  54. html = html.replace('id="video_player"', 'id="video_playerx"');
  55. html = html.replace('anvatoPlayerID = "video_player"', 'anvatoPlayerID = "video_playerx"');
  56. // 22JUL2019
  57. html = html.replace("anvpInstance.createInstance('video_player')", "anvpInstance.createInstance('video_playerx')");
  58. // 01SEP2019 蘋果馬網
  59. if (link.href.substr(0, 33) == 'https://racing.appledaily.com.hk/')
  60. html += "<style>html {overflow:initial!important;} .omo-blocking {display:none!important;}</style>";
  61. // 19SEP2019 nextplus
  62. html = html.replace("if(confirmSubscriptionOn() && (!anvp_omo_currentuser.isLoggedIn || !anvp_omo_userentitled)){", "if (false){");
  63. // 01OCT2019 TW, HK
  64. if (link.href.substr(0, 11) == 'https://tw.' || link.href.substr(0, 11) == 'https://hk.')
  65. html += "<style>#articleBody, .scroller-truncate {overflow-y:initial!important;max-height:initial!important;height: initial!important;} #articleOmo {display:none!important;}</style>";
  66. // 01OCT2019 Applehealth HK
  67. if (link.href.substr(0, 31) == 'https://www.applehealth.com.hk/')
  68. html += "<style>.article-container-block [id^=article] .col-lg-8 {overflow:initial!important;height:initial!important;} #contentblock-block {display:none!important;} .article-container-block [id^=article] .col-lg-8:before{background:none!important;}</style>";
  69. // 20DEC2019
  70. html += "<style>.paywall_fade {display: none;}</style>";
  71. // 17FEB2020 三餸一湯
  72. if (link.href.substr(0, 41) == 'https://hk.feature.appledaily.com/recipe/' || link.href.substr(0, 34) == 'https://hk.applefruity.com/recipe/')
  73. html = html.replace("var siteMode = 2;", "var siteMode = 0;");
  74. // 28MAR2020 果盤
  75. html = html.replace(/blockable blockable-meter/g, "");
  76. // 28MAR2020 果GYM
  77. html += "<style>div.flex.fixed.top-0.left-0.justify-center.items-center.w-screen.h-full.bg-translucent-black.z-10 {display: none!important;}</style>";
  78. // 28MAR2020 讀果, 動物蘋台, 蘋果寶庫
  79. if (link.href.indexOf('goodestzine') >= 0 || link.href.indexOf('petform') >= 0 || link.href.indexOf('archive') >= 0 || link.href.indexOf('us.appledaily.com/ebook') >= 0 || link.href.indexOf('tw.feature.appledaily.com/ebook') >= 0) {
  80. html = html.replace(/wasLoggedIn = false/g, 'wasLoggedIn = true');
  81. html = html.replace(/omoUserType = OMO_USER_TYPE.FREE/g, 'omoUserType = OMO_USER_TYPE.SUBSCRIBER');
  82. html = html.replace(/const/g, '//const');
  83. html = html.replace('<script type="text/javascript" src="https://static.omoplanet.com/WebSDK/v3.3.1/omo-sdk-3.3.1.min.js"></script>', '');
  84. }
  85. if (link.href.indexOf('tw.feature.appledaily.com/ebook') >= 0) {
  86. html = html.replace(/"acl":1/g, '"acl":-9');
  87. html = html.replace(/oldOmoUserType/g, 'oldOmoUserType1');
  88. html += '<script>document.cookie = "oldOmoUserType=2; path=/";setTimeout(function(){document.cookie = "oldOmoUserType=2; path=/";},1000);</script>';
  89. }
  90. // 28MAR2020 懶專家
  91. html = html.replace(/omoUserType:a/g, 'omoUserType:2');
  92. // 28MAR2020 囚牢之疆
  93. html = html.replace(/as-member-login/g, 'as-member-login1');
  94. // 28MAR2020 US
  95. if (link.href.substr(0, 11) == 'https://us.') {
  96. html += "<style>omo-paywall {display: none!important;} div.guest-user-hide {overflow: inherit!important;height: auto!important;}</style>";
  97. html = html.replace(/retrieveOMO/g, 'cracked');
  98. }
  99. // 28MAR2020 武漢肺炎
  100. if (link.href.indexOf('wars') >= 0) {
  101. html += "<style>.contentblock-block{display:none!important;}</style>";
  102. html += "<script>var override = setInterval(function(){$('#main_view').attr('id','main_view2');$('.content_block').removeClass('content_block').addClass('content_block2');},500); setTimeout(function(){clearInterval(override);$('.content_block2').removeClass('content_block2').addClass('content_block');},2000);</script>";
  103. }
  104. // 28MAR2020 蘋果地產
  105. if (link.href.indexOf('tw.feature.appledaily.com/house') >= 0) {
  106. html = html.replace(/MEMBERCONTENT/g, 'FREE');
  107. html = html.replace('class="paywallfix" style="display:none;"', '');
  108. }
  109. // 28MAR2020 只想旅行
  110. if (link.href.indexOf('tw.feature.appledaily.com/travelseed') >= 0) {
  111. html = html.replace('class="paywallfix"', '');
  112. html += "<style>#video-player-wrap{overflow: inherit!important;height: auto!important;}</style>";
  113. }
  114.  
  115. document.open();
  116. document.write(html);
  117. document.close();
  118. };
  119. xhr.send();
  120. //}
  121. })(location);