Greasy Fork is available in English.

🌐 delete cookies 🍪

Page load and... what ? No cookie ? Net is now marvelous !

  1. // ==UserScript==
  2. // @name 🌐 delete cookies 🍪
  3. // @name:fr 🌐 suppression de l'avertissement des cookies 🍪
  4. // @namespace https://greasyfork.org/en/users/876222-zzz-the-hacker
  5. // @version 2.3
  6. // @description Page load and... what ? No cookie ? Net is now marvelous !
  7. // @description:fr Confirme l'acceptation des cookies pour le faire disparaître définitivement.
  8. // @author zzz le hacker
  9. // @match *://*/*
  10. // @grant none
  11. // @icon https://www.hebergeur-image.fr/uploads/20231210/7a28ab28a8e9a4bea32b6918aa65a39ef5dea1fb.png
  12. // ==/UserScript==
  13.  
  14. (function () {
  15. "use strict";
  16. let notif = (message, time, icon) => {
  17. let div = document.createElement("div");
  18. div.style = "background-color: white; color: black; font-family: monospace; display: flex; justify-content: center; align-items: center; position: absolute; max-width: 400px; left: -420px; top: 20px; border: 1px solid black; border-radius: 10px; z-index: 100000; transition: left 1s cubic-bezier(0.6, 0.59, 0, 0.99) 0s; padding: 20px;";
  19. div.innerHTML = message;
  20. document.body.appendChild(div);
  21. let img = document.createElement("img");
  22. img.src = icon;
  23. img.style = "width: 60px; margin-left: 10px; border: 1px black solid; border-radius: 10px;";
  24. div.appendChild(img);
  25. setTimeout(() => {
  26. div.style.left = "20px";
  27. setTimeout(() => {
  28. div.style.left = "-500px";
  29. setTimeout(() => {
  30. div.remove();
  31. }, 1500);
  32. }, time);
  33. }, 100);
  34. };
  35. let searchHTML = (element, callback) => {
  36. callback(element);
  37. [...element.childNodes].forEach(child => {
  38. if (child.innerHTML !== undefined && child.outerHTML !== undefined) searchHTML(child, callback);
  39. });
  40. };
  41. let onlyText = (element) => {
  42. var nodes = element.childNodes;
  43. for (var i = 0; i < nodes.length; i++) {
  44. if (nodes[i].nodeType !== 3) {
  45. return false;
  46. }
  47. }
  48. return true;
  49. }
  50. let refuse = () => {
  51. let h = [...document.getElementsByClassName("QS5gu sy4vM")];
  52. let condition = (h.length !== 0);
  53. if (condition) {
  54. h[0].click();
  55. notif("cookie refused !", 3000, "https://www.hebergeur-image.fr/uploads/20231210/7a28ab28a8e9a4bea32b6918aa65a39ef5dea1fb.png");
  56. } else {
  57. let rejectList = ["Refuser", "Refuser tous les cookies", "Refuser les cookies", "Rejeter", "Refuse", "Reject all cookies", "Reject cookies", "Decline", "Continuer sans accepter", "Continue without accepting", "Tout refuser", "Decline all"];
  58. let acceptList = ["Accepter", "Accepter tous les cookies", "Autoriser", "Valider", "Accept", "Accept all cookies", "Allow", "Confirm"];
  59. let RbuttonsList = [];
  60. let AbuttonsList = [];
  61. searchHTML(document.body, (child) => {
  62. rejectList.forEach(e => {
  63. if (child.innerHTML.includes(e)) if (onlyText(child)) if (!RbuttonsList.includes(child)) RbuttonsList.push(child);
  64. });
  65. acceptList.forEach(e => {
  66. if (child.innerHTML.includes(e)) if (onlyText(child)) if (!AbuttonsList.includes(child)) AbuttonsList.push(child);
  67. });
  68. });
  69. console.log([RbuttonsList, AbuttonsList]);
  70. if (RbuttonsList.length !== 0) {
  71. RbuttonsList.forEach(element => {
  72. element.click();
  73. notif("cookie refused !", 3000, "https://www.hebergeur-image.fr/uploads/20231210/7a28ab28a8e9a4bea32b6918aa65a39ef5dea1fb.png");
  74. });
  75. } else {
  76. if (AbuttonsList.length !== 0) notif("An error appeared when searching for the refuse cookies button: you can refer to the author of the script via greasyfork and tell him on which site you encountered this problem.", 8000, "https://www.hebergeur-image.fr/uploads/20231210/dab7ba5c2cb28fa94bf21c19b963050aff336b91.png");
  77. else notif("No cookies found on this page.", 3000, "https://www.hebergeur-image.fr/uploads/20231210/c4c756d82cb08cf29b91df0d4d863e51984bb925.png");
  78. };
  79. };
  80. };
  81. window.addEventListener('load', refuse, false);
  82. })();