Turbo Duck

DuckDuckGo interface improvements

  1. // ==UserScript==
  2. // @name Turbo Duck
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.92
  5. // @description DuckDuckGo interface improvements
  6. // @author aseg
  7. // @match https://duckduckgo.com/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=duckduckgo.com
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function()
  14. {
  15. 'use strict';
  16.  
  17. document.body.onload = function()
  18. {
  19. if(document.getElementsByTagName('div').length > 0)
  20. {
  21. let weHrFlag = 0, imHrFlag = 0, viHrFlag = 0, neHrFlag = 0;
  22. const styleTag = document.createElement("style");
  23. styleTag.innerText = "::-webkit-scrollbar, ::-webkit-scrollbar-corner {background-color: #383a3b;width: 15px;height: 15px}"
  24. + "::-webkit-scrollbar-thumb {background-color: #54575a;}"
  25. + ".zci__main.zci__main--tiles.js-tiles.has-nav.tileview__images.has-tiles--grid {background-color: #2e3030;padding-top: 45px;}"
  26. + ".tile--img__media {border-radius: 5px;}"
  27. + ".cw {z-index: 99;background-color: #242528;width: 100%;}"
  28. + ".metabar__dropdowns, .metabar.metabar--fixed.js-zcm-sticky.has-dropdowns {background-color: #242528 !important;}"
  29. + ".tile-wrap {background-color: #2e3030;}"
  30. + ".metabar.metabar--fixed.js-zcm-sticky.has-dropdowns, .metabar.metabar--fixed.js-zcm-sticky.has-dropdowns.is-stuck {border-top: 5px solid #242528;}"
  31. + ".metabar__dropdowns-wrap {height : 42px}"
  32. + ".search-filters-wrap:before, .search-filters-wrap:after, .metabar__dropdowns-wrap:before, RHsWhMlxc4ETEMDS9ltw::before, .metabar__dropdowns-wrap:after {background-image: none !important;}"
  33. + "hr {border: none;border-bottom: 1px solid #606060;margin: 0px -7px 0px -7px;}"
  34. + ".nYs5EPJFwdhisN0E7MCB .wAo0g6uUc98EWmmASZLv:after {visibility: hidden;}"
  35. + "#react-layout {padding-top: 70px;}"
  36. + ".site-wrapper {background-color: #2e3030 !important;}"
  37. + "#header_wrapper {background-color: #242528;}"
  38. + ".DrcPyihFGyKMlg6lpwsa::before, .XvPRmQVeIoCP5lQhICTv.ofDl_1VxUG_EKc3b9E3x::before {background-image: none;}"
  39. + ".W4_K5H4AqLL1ngRJt_pk {position: fixed; top: 90px; z-index: 99; background-color: #242528; width: 100%; left: 0px; padding: 10px 0px 10px 10%;}";
  40.  
  41. document.head.insertAdjacentElement('beforeend', styleTag);
  42.  
  43. new MutationObserver(() =>
  44. {
  45. setTimeout(function()
  46. {
  47. if (weHrFlag == 0 && location.href.match("web"))
  48. {
  49. weHrFlag = 1;
  50. document.getElementsByClassName("cw")[1].style.position = "fixed";
  51. }
  52. else if (imHrFlag == 0 && location.href.match("images"))
  53. {
  54. imHrFlag = 1;
  55. let imHr = document.createElement("hr");
  56. if(document.getElementsByClassName("metabar__dropdowns-wrap")[1]) document.getElementsByClassName("metabar__dropdowns-wrap")[1].insertAdjacentElement("afterend", imHr);
  57. else document.getElementsByClassName("metabar__dropdowns-wrap")[0].insertAdjacentElement("afterend", imHr);
  58. }
  59. else if (viHrFlag == 0 && location.href.match("videos")) // Voir HR qui ne s'affiche pas sous "metabar__dropdowns-wrap"
  60. {
  61. viHrFlag = 1;
  62. let viHr = document.createElement("hr");
  63. if(document.getElementsByClassName("metabar__dropdowns-wrap")[1]) document.getElementsByClassName("metabar__dropdowns-wrap")[1].insertAdjacentElement("afterend", viHr);
  64. else document.getElementsByClassName("metabar__dropdowns-wrap")[0].insertAdjacentElement("afterend", viHr);
  65.  
  66. document.getElementsByClassName("zci__main zci__main--tiles js-tiles has-nav tileview__videos has-tiles--grid")[0].style.paddingTop = "40px";
  67. }
  68. else if (neHrFlag == 0 && location.href.match("news"))
  69. {
  70. neHrFlag = 1;
  71. let sBar = document.getElementsByClassName("search-filters-wrap")[0].style
  72. sBar.position = "fixed";
  73. sBar.zIndex = "100";
  74. sBar.backgroundColor = "#242528";
  75. sBar.width = "100%";
  76. sBar.marginLeft = "-300px";
  77. sBar.paddingLeft = "300px";
  78. sBar.overflowY = "visible";
  79.  
  80. let neHr = document.createElement("hr");
  81. document.getElementsByClassName("search-filters js-vertical-filters")[0].insertAdjacentElement("afterend", neHr);
  82. neHr.style.marginTop = "-18px";
  83. neHr.style.marginLeft = "-300px";
  84.  
  85. document.getElementsByClassName("results--sidebar js-vertical-sidebar")[0].style.marginTop = "30px";
  86. document.getElementsByClassName("header cw")[0].style.paddingBottom ="9px";
  87. document.getElementsByClassName("results js-vertical-results")[0].style.top = "60px";
  88. document.getElementsByClassName("cw")[1].style.backgroundColor = "#2e3030";
  89. }
  90. if (document.getElementsByClassName("At_VJ9MlrHsSjbfCtz2_ aDtqDaYogch0DyrGTrX6"))
  91. {
  92. document.getElementsByClassName("At_VJ9MlrHsSjbfCtz2_ aDtqDaYogch0DyrGTrX6")[0].style.minWidth = "860px"
  93. }
  94. },100);
  95. }).observe(document, {subtree: true, childList: true});
  96.  
  97.  
  98. let greyHr = document.createElement("hr");
  99. greyHr.style = "border-bottom: 1px solid #606060;margin: 0px 0px 0px -7px;";
  100. document.getElementById("links_wrapper").insertAdjacentElement("afterend", greyHr);
  101. }
  102. }
  103. })();