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.

目前為 2021-02-10 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name auto-localstorage-clearer-and-step-parser
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  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 You
  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("fmath");
  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. if (document.getElementById("solstepshowlink") != undefined){
  29. document.getElementById("solstepshowlink").onclick = f;}
  30.  
  31. var buttonEl = document.createElement("a");
  32. buttonEl.href = "#";
  33. buttonEl.onclick = funcc;
  34. buttonEl.innerHTML = "REVEAL COPY PASTE";
  35.  
  36.  
  37. }
  38. if (document.getElementById("parse_btn") != undefined){
  39. document.getElementById("parse_btn").onclick = funcc;
  40. }
  41.  
  42.  
  43. })();