Studocu_Remove_Blur

Remove blur in studocu.com and other annoying things.

当前为 2022-03-28 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Studocu_Remove_Blur
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.9
  5. // @description Remove blur in studocu.com and other annoying things.
  6. // @author You
  7. // @match https://www.studocu.com/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=studocu.com
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function () {
  14. 'use strict';
  15.  
  16. // alert("Trying lol");
  17. let waitTime = 3000; // 3000ms to start
  18. let intervalTime = 10000; // 3000ms once
  19.  
  20. const timeout = setTimeout(() => {
  21. main();
  22. }, waitTime);
  23.  
  24. function main(){
  25. let frontShit = document.querySelectorAll('#document-wrapper')[0].childNodes[0];
  26. frontShit.remove();
  27. let frontShit2 = document.querySelectorAll('h2');
  28. for (let i = 0; i < frontShit2.length; i++) {
  29. const shit = frontShit2[i];
  30. let shitWords = "Why is this page out of focus?";
  31. if (shit.innerHTML.indexOf(shitWords) != -1) { // shitWords in innerHTML
  32. console.log(shit);
  33. shit.parentElement.parentElement.remove();
  34. }
  35. }
  36.  
  37. let count = 0;
  38. const interval = setInterval(()=>{
  39. count++;
  40. alert("Count: " + count);
  41. clearBlur();
  42. }, intervalTime)
  43.  
  44. let clearBlur = ()=>{
  45. let blurDivs = document.querySelectorAll('.page-content');
  46. for (let i = 0; i < blurDivs.length; i++) {
  47. const blurDiv = blurDivs[i];
  48. let blurWords = "filter: blur(4px);";
  49. if (blurDiv.outerHTML.indexOf(blurWords) != -1) {
  50. console.log(blurDiv);
  51. while (blurDiv.hasChildNodes()){// lifting all the children
  52. blurDiv.parentNode.insertBefore(blurDiv.firstChild,blurDiv);
  53. }
  54. blurDiv.parentNode.removeChild(blurDiv);
  55. }
  56. }
  57. };
  58.  
  59. //Repeated execution will result in a blank page for unknown reasons.
  60. // 如果重复执行会导致页面空白,原因未知。
  61. }
  62.  
  63. })();