GauthMath Bypass Paywall newer version

Bypass the paywall and hopefully jailbreak the site

当前为 2024-02-22 提交的版本,查看 最新版本

此脚本不应直接安装,它是供其他脚本使用的外部库。如果您需要使用该库,请在脚本元属性加入:// @require https://update.cn-greasyfork.org/scripts/488027/1331884/GauthMath%20Bypass%20Paywall%20newer%20version.js

  1. // ==UserScript==
  2. // @name GauthMath Bypass Paywall newer version
  3. // @namespace http://tampermonkey.net/
  4. // @version 2.5
  5. // @license MIT
  6. // @description Bypass the paywall and hopefully jailbreak the site
  7. // @author Viruszy
  8. // @match https://www.gauthmath.com/
  9. // @match https://www.gauthmath.com/calculator
  10. // @match https://www.gauthmath.com/search-question?questionID=1791612050420741&action=image_search
  11. // @match https://www.gauthmath.com/solution/1782791331021829/
  12. // @match https://www.gauthmath.com/solution/1782791331021829/
  13. // @match https://www.gauthmath.com/solution/1782635516057605/
  14. // @icon a photo of gauthmath symbol
  15. // @grant none
  16. // ==/UserScript==
  17.  
  18. (function () {
  19. 'use strict';
  20. const elementsToRemove = [
  21. "[data-testid^='ad_below_']" //Annoying video ads
  22. ];
  23. //simulating button click to keep native Gauth Math functionality without needing additional code.
  24. const elementsToClick = [
  25. "[data-testid='registration_toplayer_close_button']", //Login popup/modal close button
  26. '[aria-label="Close this dialog window"]' //Promotion popup/modal close button
  27. ];
  28. const config = { attributes: true, childList: true, subtree: true };
  29. let timeoutID = 0;
  30. let mutationObserver;
  31. const mutationCallback = () => {
  32. mutationObserver.disconnect();
  33. for (let query of elementsToRemove) {
  34. let nodes = document.querySelectorAll(query);
  35. for (let node of nodes)
  36. node.remove();
  37. }
  38. for (let query of elementsToClick) {
  39. let nodes = document.querySelectorAll(query);
  40. for (let node of nodes)
  41. if (timeoutID === 0)
  42. timeoutID = setTimeout(() => { timeoutID = 0; node.click(); }, 500);
  43. }
  44. mutationObserver.observe(document.body, config);
  45. }
  46. try {
  47. localStorage.clear();
  48. } catch (err) {
  49. console.error("Couldn't clear local storage, the browser is most likely blocking access to it. (are all cookies being blocked?)");
  50. console.error(err);
  51. }
  52. document.addEventListener("DOMContentLoaded", () => {
  53. mutationObserver = new MutationObserver(mutationCallback);
  54. mutationCallback();
  55. // Remove paywall elements
  56. function bypassPaywall() {
  57. const paywallElement = document.getElementById('paywall'); // Adjust the ID based on the actual paywall element
  58. if (paywallElement) {
  59. paywallElement.remove();
  60. }
  61. }
  62. // Enable Gauthplus features
  63. function enableGauthplus() {
  64. // Simulate successful Gauthplus subscription
  65. localStorage.setItem('isGauthplus', 'true');
  66. }
  67.  
  68. // Check if user has Gauthplus subscription
  69. function hasGauthplus() {
  70. return localStorage.getItem('isGauthplus') === 'true';
  71. }
  72.  
  73. // Main function
  74. function main() {
  75. bypassPaywall();
  76. if (!hasGauthplus()) {
  77. enableGauthplus();
  78. }
  79. }
  80. });
  81. })();