google fixer

fix google annoying problems. currently it removes consent stuff from google and youtube, and you go directly to the web page instead of google feedback in google search.

  1. // ==UserScript==
  2. // @name google fixer
  3. // @description fix google annoying problems. currently it removes consent stuff from google and youtube, and you go directly to the web page instead of google feedback in google search.
  4. // @namespace Violentmonkey Scripts
  5. // @match https://www.youtube.com/*
  6. // @match https://www.google.com/*
  7. // @grant none
  8. // @version 0.0.1.20190608185432
  9. // ==/UserScript==
  10. function delete_cookie(name, domain) {
  11. document.cookie = name + '=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT; Domain=' + domain + ';';
  12. }
  13. const waitForIds = (...ids) => new Promise(resolve => {
  14. const delay = 500
  15. const f = () => {
  16. const elements = ids.map(id => document.getElementById(id))
  17. if (elements.every(element => element != null)) {
  18. resolve(elements)
  19. } else {
  20. setTimeout(f, delay)
  21. }
  22. }
  23. f()
  24. })
  25. const waitForTags = (...tags) => new Promise(resolve => {
  26. const delay = 500
  27. const f = () => {
  28. const elements = tags.flatMap(tag => document.getElementsByTagName(tag))
  29. if (elements.every(element => element != null)) {
  30. resolve(elements)
  31. } else {
  32. setTimeout(f, delay)
  33. }
  34. }
  35. f()
  36. })
  37. waitForIds('ticker').then(([ticker])=>{
  38. ticker.parentNode.removeChild(ticker);
  39. })
  40. waitForIds('consent-bump').then(([consentBump])=>{
  41. consentBump.parentNode.removeChild(consentBump);
  42. })
  43. waitForIds('lb').then(([lb])=>{
  44. lb.parentNode.removeChild(lb);
  45. })
  46. waitForIds('taw').then(([taw])=>{
  47. taw.parentNode.removeChild(taw);
  48. })
  49. waitForTags('ytd-popup-container').then(([ytd])=>{
  50. ytd.parentNode.removeChild(ytd);
  51. })
  52. waitForTags('a').then(([a])=>{
  53. console.log(a.length);
  54. for (var i = 0; i < a.length; i++) {
  55. console.log(a[i]);
  56. a[i].removeAttribute('onmousedown');
  57. }
  58. })
  59. delete_cookie('CONSENT', '.youtube.com');
  60. delete_cookie('CONSENT', '.google.com');

QingJ © 2025

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