The Internet gets better: No Cookies 🍪

First version: gets rid of cookies 🍪🍪🍪 Let me know wich website it doesn't work on

  1. // ==UserScript==
  2. // @name The Internet gets better: No Cookies 🍪
  3. // @name:fr L'internet devient mieux
  4. // @description First version: gets rid of cookies 🍪🍪🍪 Let me know wich website it doesn't work on
  5. // @description:fr Première version: Ca efface les cookies 🍪🍪🍪
  6. // @author iloverats1234
  7. // @match https://consent.google.*/*
  8. // @match https://www.google.tld/*
  9. // @match https://starve.io/
  10. // @match https://www.google.com
  11. // @match https://www.youtube.com/
  12. // @match https://www.facebook.com/
  13. // @match https://twitter.com/
  14. // @match https://www.instagram.com/
  15. // @match http://www.baidu.com/
  16. // @match https://www.wikipedia.org/
  17. // @match https://www.reddit.com/
  18. // @match https://consent.yahoo.com/v2/collectConsent?sessionId=3_cc-session_83f05cbb-450a-4c64-a23a-bc67eb43a71f
  19. // @match https://yahoo.com/
  20. // @match https://www.amazon.com/
  21. // @match https://www.netflix.com/fr/
  22. // @match https://www.netflix.com/fr-en/
  23. // @match https://www.twitch.tv/
  24. // @match https://www.ebay.com/
  25. // @match https://moomoo.io/
  26. // @match https://diep.io
  27. // @match https://devast.io/
  28. // @match https://slither.io
  29. // @match https://krunker.io/
  30. // @match https://odysee.com/
  31. // @match https://www.amazon.de/
  32. // @match https://www.amazon.fr/
  33. // @match https://www.amazon.nl/
  34. // @match https://www.amazon.it/
  35. // @match https://www.amazon.es/
  36. // @match https://www.amazon.co.uk/
  37. // @match https://www.adobe.com/
  38. // @match https://www.friv.com/
  39. // @match https://shellshock.io/
  40. // @license MIT
  41. // @version 0.0.1.20221215235744
  42. // @namespace https://gf.qytechs.cn/users/998067
  43. // ==/UserScript==
  44. (function(){
  45. "use strict";
  46. alert('cookie deleter : actived - agrees (or refuse if you are going to YouTube) to the cookies dialog to make it disappear forever')
  47. if (document.readyState != 'loading') consent();
  48. else document.addEventListener('DOMContentLoaded', consent);
  49. function consent() {
  50. var e=document.querySelector('#introAgreeButton');
  51. if (!e) e=document.querySelector('div.jw8mI button#zV9nZe.tHlp8d, div.VDity button#L2AGLb.tHlp8d, form[action="https://consent.google.com/s"] button');('div.jw8mI button#zV9nZe.tHlp8d, div.VDity button#L2AGLb.tHlp8d, form[action="https://twitter.com/"] button');('div.jw8mI button#zV9nZe.tHlp8d, div.VDity button#L2AGLb.tHlp8d, form[action="https://starve.io/"] button');('div.jw8mI button#zV9nZe.tHlp8d, div.VDity button#L2AGLb.tHlp8d, form[action="https://consent.google.*/*"] button');('div.jw8mI button#zV9nZe.tHlp8d, div.VDity button#L2AGLb.tHlp8d, form[action="https://www.google.tld/*"] button');('div.jw8mI button#zV9nZe.tHlp8d, div.VDity button#L2AGLb.tHlp8d, form[action="https://starve.io/"] button');('div.jw8mI button#zV9nZe.tHlp8d, div.VDity button#L2AGLb.tHlp8d, form[action="https://www.google.com"] button');('div.jw8mI button#zV9nZe.tHlp8d, div.VDity button#L2AGLb.tHlp8d, form[action="https://www.youtube.com/"] button');('div.jw8mI button#zV9nZe.tHlp8d, div.VDity button#L2AGLb.tHlp8d, form[action="https://www.facebook.com/"] button');('div.jw8mI button#zV9nZe.tHlp8d, div.VDity button#L2AGLb.tHlp8d, form[action="https://twitter.com/"] button');('div.jw8mI button#zV9nZe.tHlp8d, div.VDity button#L2AGLb.tHlp8d, form[action="https://www.instagram.com/"] button');('div.jw8mI button#zV9nZe.tHlp8d, div.VDity button#L2AGLb.tHlp8d, form[action="http://www.baidu.com/"] button');('div.jw8mI button#zV9nZe.tHlp8d, div.VDity button#L2AGLb.tHlp8d, form[action="https://www.wikipedia.org/"] button');('div.jw8mI button#zV9nZe.tHlp8d, div.VDity button#L2AGLb.tHlp8d, form[action="https://www.reddit.com/"] button');('div.jw8mI button#zV9nZe.tHlp8d, div.VDity button#L2AGLb.tHlp8d, form[action="https://consent.yahoo.com/v2/collectConsent?sessionId=3_cc-session_83f05cbb-450a-4c64-a23a-bc67eb43a71f"] button');('div.jw8mI button#zV9nZe.tHlp8d, div.VDity button#L2AGLb.tHlp8d, form[action="https://yahoo.com/"] button');('div.jw8mI button#zV9nZe.tHlp8d, div.VDity button#L2AGLb.tHlp8d, form[action="https://www.amazon.com/"] button');('div.jw8mI button#zV9nZe.tHlp8d, div.VDity button#L2AGLb.tHlp8d, form[action="https://www.netflix.com/fr/"] button');('div.jw8mI button#zV9nZe.tHlp8d, div.VDity button#L2AGLb.tHlp8d, form[action="https://www.netflix.com/fr-en/"] button');('div.jw8mI button#zV9nZe.tHlp8d, div.VDity button#L2AGLb.tHlp8d, form[action="https://www.twitch.tv/"] button');('div.jw8mI button#zV9nZe.tHlp8d, div.VDity button#L2AGLb.tHlp8d, form[action="https://www.ebay.com/"] button');('div.jw8mI button#zV9nZe.tHlp8d, div.VDity button#L2AGLb.tHlp8d, form[action="https://diep.io"] button');('div.jw8mI button#zV9nZe.tHlp8d, div.VDity button#L2AGLb.tHlp8d, form[action="https://moomoo.io/"] button');('div.jw8mI button#zV9nZe.tHlp8d, div.VDity button#L2AGLb.tHlp8d, form[action="https://devast.io/"] button');('div.jw8mI button#zV9nZe.tHlp8d, div.VDity button#L2AGLb.tHlp8d, form[action="https://slither.io"] button');('div.jw8mI button#zV9nZe.tHlp8d, div.VDity button#L2AGLb.tHlp8d, form[action="https://krunker.io/"] button');('div.jw8mI button#zV9nZe.tHlp8d, div.VDity button#L2AGLb.tHlp8d, form[action="https://odysee.com/"] button');('div.jw8mI button#zV9nZe.tHlp8d, div.VDity button#L2AGLb.tHlp8d, form[action="https://truthsocial.com/"] button');('div.jw8mI button#zV9nZe.tHlp8d, div.VDity button#L2AGLb.tHlp8d, form[action="https://www.amazon.de/"] button');('div.jw8mI button#zV9nZe.tHlp8d, div.VDity button#L2AGLb.tHlp8d, form[action="https://www.amazon.fr/"] button');('div.jw8mI button#zV9nZe.tHlp8d, div.VDity button#L2AGLb.tHlp8d, form[action="https://www.amazon.nl/"] button');('div.jw8mI button#zV9nZe.tHlp8d, div.VDity button#L2AGLb.tHlp8d, form[action="https://www.amazon.it/"] button');('div.jw8mI button#zV9nZe.tHlp8d, div.VDity button#L2AGLb.tHlp8d, form[action="https://www.amazon.es/"] button');('div.jw8mI button#zV9nZe.tHlp8d, div.VDity button#L2AGLb.tHlp8d, form[action="https://www.amazon.co.uk/"] button');
  52. e && e.click();
  53. }
  54. var t, e=r.querySelector('#introAgreeButton')
  55. || ( (t=r.querySelectorAll('#lightbox[class*="ytd-consent-bump"] a.ytd-button-renderer:not([href])')) && (t.length==1) && (e=t[0]) )
  56. || ( (t=r.querySelectorAll('form button')) && (t.length == 1) && (e=t[0]) )
  57. || ( (t=r.querySelectorAll(':scope form button')) && (t.length == 4) && (e=t[1]) ) /*20220524*/
  58. || ( (t=r.querySelectorAll('ytd-button-renderer > a:not([href]) tp-yt-paper-button[class*="primary"]')) && (t.length == 1) && (e=t[0]) )
  59. || ( (t=r.querySelectorAll('ytd-button-renderer > a:not([href]) tp-yt-paper-button[class*="primary"]')) && (t.length == 2) && (e=t[0]) );
  60. e && e.click();
  61. if (location.href.startsWith('https://consent.youtube.com/')) {
  62. if (document.readyState != 'loading') consent();
  63. else document.addEventListener('DOMContentLoaded', consent);
  64. return;
  65. }
  66. if (window !== window.top) return;
  67. function cookies() {
  68. var r={}, a=document.cookie;
  69. a.split(';').forEach(function(e){
  70. var p=e.split('=');
  71. if (p[0]) r[p.shift().trim()]=p.join('=');
  72. });
  73. return r;
  74. }
  75. var ck=cookies();
  76. if (ck['APISID']) return;
  77. function hasDismiss(e, l=1) {
  78. var p=e;
  79. while (p && l-- && (p=p.parentNode)) {
  80. if (p.id=='dismiss-button') return p;
  81. }
  82. }
  83. function SImutF(mutL){
  84. for (let mut of mutL) {
  85. let t=mut.target, db=t;
  86. if ( (t.id=='dismiss-button') || (db=hasDismiss(t,2)) ) {
  87. if (db.__c__) continue;
  88. if (t.classList.contains('yt-upsell-dialog-renderer') || t.classList.contains('ytd-mealbar-promo-renderer')) ;
  89. else if (t.classList.contains('yt-tooltip-renderer')) {
  90. t=t.querySelector('yt-button-renderer');
  91. if (!t) continue;
  92. }
  93. else continue;
  94. db.__c__=true;
  95. setTimeout(function(){
  96. t.click();
  97. delete db.__c__;
  98. }, 300);
  99. subObs.observe(t,{attributes: true, subtree: true});
  100. }
  101. }
  102. }
  103. var obs=new MutationObserver(SImutF);
  104. var subObs=new MutationObserver(SImutF);
  105. var obs_w4PU=new MutationObserver(function(mutL){
  106. for (let mut of mutL) {
  107. for (let n of mut.addedNodes) {
  108. if (n.nodeName == 'YTD-POPUP-CONTAINER') {
  109. this.disconnect();
  110. setObs();
  111. return;
  112. }
  113. }
  114. }
  115. });
  116. var obs_w4ErRd=new MutationObserver(function(mutL){
  117. for (let mut of mutL) {
  118. for (let n of mut.addedNodes) {
  119. if (n.id == 'columns') {
  120. let r=n.querySelector('yt-playability-error-supported-renderers');
  121. if (r) {
  122. this.disconnect();
  123. setErRdObs();
  124. return;
  125. }
  126. }
  127. }
  128. }
  129. });
  130. var obsCk=new MutationObserver(function(mutL){
  131. var cb;
  132. for (let mut of mutL) {
  133. for (let n of mut.addedNodes) {
  134. if (n.nodeName == 'TP-YT-IRON-OVERLAY-BACKDROP') {
  135. cb=document.querySelector('#lightbox');
  136. consent();
  137. }
  138. if ( (n.nodeName == 'YTD-CONSENT-BUMP-LIGHTBOX') || (n=cb) ) {
  139. this.disconnect();
  140. setTimeout(function(){
  141. let ck=cookies();
  142. if (ck['CONSENT'] && !ck['CONSENT'].startsWith('YES')) document.cookie='CONSENT=YES+;path=/;secure;domain=youtube.com;expires='+(new Date(Date.now()+567648000000)).toUTCString()+';';
  143. }, 5000);
  144. // not an iframe anymore
  145. consent(null,n);
  146. return;
  147. }
  148. }
  149. }
  150. });
  151. var ErRd, ErRdIT,
  152. obsErRd=new MutationObserver(function(mutL){
  153. var t, ITc=30;
  154. for (let mut of mutL) {
  155. t=mut.target;
  156. if (t.id=='dismiss-button') {
  157. if (t.classList.contains('yt-player-error-message-renderer')) t=t.querySelector(':scope yt-button-renderer paper-button#button');
  158. else continue;
  159. if (ErRdIT) clearInterval(ErRdIT);
  160. ErRdIT=setInterval(function(){
  161. if (!ITc-- || ErRd.hidden || !t) {
  162. clearInterval(ErRdIT);
  163. ErRdIT=0;
  164. }
  165. else t.click();
  166. }, 300);
  167. return;
  168. }
  169. }
  170. });
  171. function init() {
  172. var t;
  173. if (document.querySelector('ytm-app')) {
  174. new MutationObserver(function(mutL){
  175. for (let mut of mutL) {
  176. for (let n of mut.addedNodes) {
  177. if (n.classList.contains('upsell-dialog-lightbox') || n.classList.contains('consent-bump-lightbox') ) {
  178. if (t=document.querySelector('.upsell-dialog-dismiss-button button, .consent-bump-button-wrapper button')) {
  179. t.click();
  180. }
  181. }
  182. }
  183. }
  184. }).observe(document.body, {childList: true, subtree: false});
  185. }
  186. setObs();
  187. setErRdObs();
  188. if (ck['CONSENT'] && !ck['CONSENT'].startsWith('YES')) {
  189. obsCk.observe(document.body, {childList:true});
  190. setTimeout(function(){obsCk.disconnect();},30000);
  191. }
  192. }
  193. var c=1;
  194. function setObs(){
  195. var r=document.querySelector('ytd-app ytd-popup-container');
  196. if (!r) {
  197. if (c--) obs_w4PU.observe(document.querySelector('ytd-app'), {childList:true});
  198. return;
  199. }
  200. obs.observe(r, {childList: true, subtree: true});
  201. }
  202. function setErRdObs() {
  203. ErRd=document.querySelector('ytd-app yt-playability-error-supported-renderers');
  204. if (!ErRd) {
  205. obs_w4ErRd.observe(document.querySelector('ytd-app'), {childList: true, subtree: true});
  206. setTimeout(function(){obs_w4ErRd.disconnect();}, 20000);
  207. }
  208. else obsErRd.observe(ErRd ,{childList: true, subtree: true, attributes: true});
  209. }
  210. if (document.readyState != 'loading') init();
  211. else document.addEventListener('DOMContentLoaded', init);
  212. function inject() {
  213. var r=document.head || document.documentElement;
  214. if (!r) {
  215. setTimeout(inject,0);
  216. return;
  217. }
  218. var s=document.createElement('style');
  219. r.appendChild(s);
  220. s.textContent="#consent-bump,iron-overlay-backdrop,yt-upsell-dialog-renderer{opacity:0;}yt-upsell-dialog-renderer *,yt-bubble-hint-renderer,.upsell-dialog-lightbox,.consent-bump-lightbox{display:none !important;}ytd-app > ytd-consent-bump-lightbox,ytd-app > ytd-consent-bump-v2-lightbox,ytd-app ~ iron-overlay-backdrop,ytd-app ~ tp-yt-iron-overlay-backdrop{display:none;}";
  221. s=document.createElement('script');
  222. s.textContent= `(function(){var c=160, pl, plR, prom, oldp={}, t, done, hasPaused;
  223. const obs=new MutationObserver(function(mutL){
  224. if (!prom) {
  225. if (prom=document.querySelector('ytd-player#ytd-player') ) {
  226. if (prom.getPlayerPromise) {
  227. prom.getPlayerPromise().then(function(a){
  228. pl=a;
  229. patch();
  230. });
  231. }
  232. else prom=null;
  233. }
  234. }
  235. for (let mut of mutL) {
  236. for (let n of mut.addedNodes) {
  237. if (n.id == 'movie_player') {
  238. plR=n.closest('ytd-player#ytd-player');
  239. if (!plR) continue;
  240. this.disconnect();
  241. setTimeout(function(){
  242. pl=plR.getPlayer();
  243. patch();
  244. }, 0);
  245. return;
  246. }
  247. }
  248. }
  249. });
  250. function init(){
  251. obs.observe(document.querySelector('ytd-app') || document.body, {childList: true, subtree: true});
  252. setTimeout(function(){obs.disconnect();},10000);
  253. f();
  254. }
  255. function f(){
  256. plR=document.querySelector('ytd-player#ytd-player');
  257. if (plR) pl=plR.getPlayer();
  258. if (!pl) {
  259. if (--c) setTimeout(f,100);
  260. return;
  261. }
  262. else patch();
  263. }
  264. if (document.readyState != 'loading') init();
  265. else document.addEventListener('DOMContentLoaded', init);
  266. function patch() {
  267. if (done) return;
  268. if (pl) done=1;
  269. obs.disconnect();
  270. for (let i in pl) if (typeof pl[i] == 'function') {
  271. if ( !['cancelPlayback', 'pauseVideo', 'stopVideo', 'playVideo'].includes(i) ) continue;
  272. oldp[i]=pl[i];
  273. pl[i]=function() {
  274. let pass= (!hasPaused && i=='playVideo') ? true:false;
  275. let st=(new Error()).stack;
  276. if ( !pass && (st.search(/(\\.onFulfilled|_onFulfilled|scheduler\\.js:|handlePopupClose_)/)>0) && (st.search(/onYtStopOldPlayer/) ==-1) ) {
  277. if (i=='pauseVideo') hasPaused=1;
  278. return;
  279. }
  280. oldp[i].apply(this,arguments);
  281. }
  282. }
  283. }
  284. })();`;
  285. r.appendChild(s);
  286. if (s.parentNode) s.parentNode.removeChild(s);
  287. } // inject()
  288. inject();
  289. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址