auto-localstorage-clearer-and-step-parser

Clear localstorage so you can use the show work button unlimited times. And lay out the shown work for easy copy paste. I wrote this for personal use so updates may be uncommon.

  1. // ==UserScript==
  2. // @name auto-localstorage-clearer-and-step-parser
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.2
  5. // @description Clear localstorage so you can use the show work button unlimited times. And lay out the shown work for easy copy paste. I wrote this for personal use so updates may be uncommon.
  6. // @author pigPen6969
  7. // @match https://www.mathpapa.com/algebra-calculator.html
  8. // @match http://www.mathpapa.com/algebra-calculator.html
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. var funcc = function(){
  16. localStorage.clear();
  17. var allCookies = document.cookie.split(';');
  18.  
  19. for (var i = 0; i < allCookies.length; i++) {
  20. document.cookie = allCookies[i] + "=;expires=" + new Date(0).toUTCString();
  21. }
  22. var f = function(){
  23. var fm = document.getElementsByTagName("math");
  24. for (var i in fm){
  25. if (fm[i].getAttribute != undefined){
  26. document.getElementById("solout3").innerHTML +=fm[i].getAttribute("alttext").replaceAll("\\cl", "").replaceAll("green", "").replaceAll("blue", "").replaceAll("{", "").replaceAll("}", "").replaceAll("\\", "").replaceAll(",", "").trim().replaceAll(" ", " ").replaceAll(" ", " ").replaceAll("text", "").replaceAll("'", "") + "<br>";
  27. }}
  28. }
  29. if (document.getElementById("solstepshowlink") != undefined){
  30. document.getElementById("solstepshowlink").onclick = f;
  31. }
  32.  
  33. var buttonEl = document.createElement("a");
  34. buttonEl.href = "#";
  35. buttonEl.onclick = funcc;
  36. buttonEl.innerHTML = "REVEAL COPY PASTE";
  37.  
  38.  
  39. }
  40. if (document.getElementById("parse_btn") != undefined){
  41. document.getElementById("parse_btn").onclick = funcc;
  42. }
  43.  
  44.  
  45. })();