Advertisement
Guest User

Untitled

a guest
Feb 6th, 2022
8,068
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name Symbolab Pro [Fixed]
  3. // @namespace http://tampermonkey.net/
  4. // @version 2.1
  5. // @description A script to allow students to learn mathematics without being restricted by a paywall
  6. // @author ShortHax,Azrak
  7. // @match https://www.symbolab.com/
  8. // @include *://*symbolab.com/*
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function () {
  14. "use strict";
  15.  
  16. var code = `window.onload = function(){
  17. const signedIn = !!document.getElementById("userName").title.trim();
  18. if (signedIn) {
  19. // initialize constants
  20. const url = location.href;
  21. const langMatch = url.match('//([a-z]{2})\.symbolab');
  22. const lang = langMatch ? langMatch[1] : 'en';
  23.  
  24. // reinitialize SymbolabSteps with subscribed set to true
  25. SYSTEPS = new SymbolabSteps('en', 'true', null, url);
  26.  
  27. // reinitialize Solutions with subscribed set to true
  28. SOLUTIONS = new Solutions("", "step-by-step", htmlDecode(SYMBOLAB.params.query),htmlDecode(''), '0', '', lang, 'true');
  29. SOLUTIONS.init();
  30. // prevent paywall from appearing when verify solution is clicked
  31. $("#click-capture").addClass("click-capture-subscribed");
  32. }
  33. // warn user if not logged in
  34. else {
  35. // create a tooltip popup next to the sign in link to tell the user they must log in
  36. const joinEl = document.getElementById("join");
  37. const warning = document.createElement("div");
  38. const styles = {
  39. position: "absolute",
  40. top: "49px",
  41. right: "0px",
  42. width: "260px",
  43. height: "185px",
  44. backgroundColor: "rgb(255 255 255)",
  45. zIndex: "9999",
  46. padding: "1em",
  47. fontSize: "150%",
  48. lineHeight: "1.5em",
  49. border: "2px solid red",
  50. };
  51. Object.assign(warning.style, styles);
  52. warning.innerHTML =
  53. "<h4>Viewing step-by-step solutions is only possible when logged in.</h4>" +
  54. "</h4><p>Sign in or create a free account to continue.</p>";
  55. // close button
  56. const closeButton = document.createElement("button");
  57. closeButton.innerHTML = "&times;";
  58. const closeStyles = {
  59. position: "absolute",
  60. top: "0px",
  61. right: "0px",
  62. fontSize: "150%",
  63. fontWeight: "bold",
  64. cursor: "pointer",
  65. background: "none",
  66. border: "none",
  67. };
  68. Object.assign(closeButton.style, closeStyles);
  69. closeButton.addEventListener("click", () => {
  70. warning.style.display = "none";
  71. });
  72. warning.appendChild(closeButton);
  73. joinEl.appendChild(warning);
  74. }
  75. }`;
  76.  
  77. // make sure the code runs before the subscription status is checked
  78. document.documentElement.setAttribute("onreset", code);
  79. document.documentElement.dispatchEvent(new CustomEvent("reset"));
  80. document.documentElement.removeAttribute("onreset");
  81. })();
Advertisement
RAW Paste Data Copied
Advertisement