Remove rounding

Removes rounding of all elements on all sites. | Прибирає срані заокруглення усіх елементів на всіх сайтах

  1. // ==UserScript==
  2. // @name Remove rounding
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.4
  5. // @description Removes rounding of all elements on all sites. | Прибирає срані заокруглення усіх елементів на всіх сайтах
  6. // @author SergoZar
  7. // @match *://*/*
  8. // @license GPL v2.0
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13.  
  14. function add_style(e, shadow=false){
  15. var style = document.createElement("style");
  16. style.setAttribute("unround", '1');
  17. style.textContent = ` *{
  18. border-radius: 0 !important;
  19. }`;
  20.  
  21. if (e.shadowRoot){
  22. //document.querySelectorAll("style[unround='1']")
  23. e.shadowRoot.append(style);
  24. console.log(e.shadowRoot.querySelectorAll("style[unround='1']"));
  25. }
  26. else
  27. e.append(style);
  28. }
  29. add_style(document.head);
  30.  
  31. // https://gist.github.com/Spencer-Doak/9954daae8a859337a08f0022293313a6
  32. function findRoots(ele) {
  33. return [ ele, ...ele.querySelectorAll('*') ]
  34. .filter(e => !!e.shadowRoot)
  35. .flatMap(e => [e.shadowRoot, ...findRoots(e.shadowRoot)])
  36. }
  37.  
  38. function equal(ar1, ar2){
  39. if (ar1.length !== ar2.length)
  40. return false;
  41. for (var i = 0; i < ar1.length; i++)
  42. if (ar1[i] !== ar2[i])
  43. return false;
  44. return true;
  45. }
  46.  
  47. var shadows_old = findRoots(document.body);
  48. shadows_old.forEach( i => add_style(i, true) );
  49.  
  50. setInterval(function () {
  51. var shadows_new = findRoots(document.body);
  52. if(equal(shadows_new, shadows_old)){
  53.  
  54. }
  55. else{
  56. console.log("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA")
  57. shadows_old = shadows_new;
  58. shadows_new.forEach( i => add_style(i, true));
  59. }
  60. }, 3000);
  61. })();
  62.