DuckDuckGo layout cleaner

Remove useless clutter from duckduckgo.com

  1. // ==UserScript==
  2. // @name DuckDuckGo layout cleaner
  3. // @namespace duckduckgo_layout_cleaner
  4. // @description Remove useless clutter from duckduckgo.com
  5. // @match *://duckduckgo.com/*
  6. // @match *://duckduckgo.com/*
  7. // @run-at document-end
  8. // @encoding utf-8
  9. // @license MIT
  10. // @version 2025.05.30
  11. // ==/UserScript==
  12.  
  13. function removeByClass(clsname) {
  14. var a1 = document.getElementsByClassName(clsname);
  15. for(var i=0;i<a1.length;i++) a1[i].parentNode.removeChild(a1[i]);
  16. }
  17.  
  18. (function() {
  19. setTimeout(function() {
  20. removeByClass('js-tagline');
  21. removeByClass("header--aside__item");
  22. removeByClass("header--aside__item social");
  23. removeByClass("feedback-prompt");
  24. removeByClass("js-feedback-btn-wrap");
  25. removeByClass("footer");
  26. removeByClass("badge-link");
  27. removeByClass("js-onboarding-ed");
  28. removeByClass("content-info__items");
  29. removeByClass("content-info__title");
  30. removeByClass("E4_TKgKL7YzziY_dW6E9"); // remove "Can’t find what you’re looking for?"
  31. removeByClass("text_promo--text");
  32. removeByClass("related-searches");
  33. }, 1000);
  34. })();
  35.  
  36. // aiChatPromptSuggestions: {"hideSuggestions":true}
  37. localStorage.setItem('aiChatPromptSuggestions', '{"hideSuggestions":true}')
  38.  
  39. // aichatPromoDismissal: {"promosDismissed":"2025-04-06"}
  40. var date = new Date()
  41. var dt = `${date.getYear()+1900}-${(date.getMonth()+1).toString().padStart(2,"0")}-${date.getDay().toString().padStart(2, "0")}`
  42. localStorage.setItem('aichatPromoDismissal', '{"promosDismissed":"'+dt+'"}')
  43.  
  44.  
  45. // localstorege duckduckgo_settings tests:
  46. // chat on: {}
  47. // chat off: {"kbg":"-1"}
  48. // ai assist often: {"kbe":"3"}
  49. // ai assist never: {"kbe":"0"}
  50.  
  51. var ddg_settings = JSON.parse(localStorage.getItem('duckduckgo_settings')) || {};
  52.  
  53. ddg_settings['kbg'] = '-1'; // ai chat off
  54. ddg_settings['kbe'] = '0'; // ai assist never
  55.  
  56. // turn off futher annoyances
  57. ddg_settings['kpsb'] = '-1'; // dismiss "always private" self advertising
  58. ddg_settings["kau"] = "-1"; // OFF: "It's okay to (very infrequently) ask me about my experience using DuckDuckGo"
  59. ddg_settings["kao"] = "-1"; // OFF: "Shows the privacy benefits of using DuckDuckGo on the homepage"
  60. ddg_settings["kap"] = "-1"; // OFF: "Shows occasional reminders to sign up for the DuckDuckGo privacy newsletters"
  61. ddg_settings["kaq"] = "-1"; // OFF: "Shows sign-up form for the DuckDuckGo privacy newsletters"
  62. ddg_settings["kax"] = "-1"; // OFF: "Shows occasional reminders to add DuckDuckGo to your browser"
  63. ddg_settings["kak"] = "-1"; // OFF: "Shows links to instructions for how to add DuckDuckGo to your browser"
  64.  
  65. localStorage.setItem('duckduckgo_settings', JSON.stringify(ddg_settings));
  66.