Greasy Fork is available in English.

Faviconize SearX

Add favicons to SearX/SearXNG

질문, 리뷰하거나, 이 스크립트를 신고하세요.
  1. // ==UserScript==
  2. // @name Faviconize SearX
  3. // @namespace -
  4. // @version 1.3.0
  5. // @description Add favicons to SearX/SearXNG
  6. // @author NotYou
  7. // @match *://searx.be/search*
  8. // @match *://search.rhscz.eu/search*
  9. // @match *://searxng.site/search*
  10. // @match *://search.bus-hit.me/search*
  11. // @match *://priv.au/search*
  12. // @match *://search.hbubli.cc/search*
  13. // @match *://search.inetol.net/search*
  14. // @match *://searxng.ca/search*
  15. // @match *://searx.rhscz.eu/search*
  16. // @match *://s.mble.dk/search*
  17. // @match *://search.im-in.space/search*
  18. // @match *://opnxng.com/search*
  19. // @match *://search.mdosch.de/search*
  20. // @match *://www.gruble.de/search*
  21. // @match *://search.sapti.me/search*
  22. // @match *://xo.wtf/search*
  23. // @match *://search.rowie.at/search*
  24. // @match *://searx.catfluori.de/search*
  25. // @match *://searx.dresden.network/search*
  26. // @match *://searx.techsaviours.org/search*
  27. // @match *://search.projectsegfau.lt/search*
  28. // @match *://searx.si/search*
  29. // @match *://twinkpad.pl/search*
  30. // @match *://vanderwilhelm.me/search*
  31. // @match *://searxng.online/search*
  32. // @match *://baresearch.org/search*
  33. // @match *://searx.foss.family/search*
  34. // @match *://searx.tuxcloud.net/search*
  35. // @match *://searx.daetalytica.io/search*
  36. // @match *://searx.ari.lt/search*
  37. // @match *://search.privacyredirect.com/search*
  38. // @match *://copp.gg/search*
  39. // @match *://searxng.ch/search*
  40. // @match *://searx.perennialte.ch/search*
  41. // @match *://search.leptons.xyz/search*
  42. // @match *://ooglester.com/search*
  43. // @match *://searx.aleteoryx.me/search*
  44. // @match *://sx.thatxtreme.dev/search*
  45. // @match *://searx.ee/search*
  46. // @match *://sxng.violets-purgatory.dev/search*
  47. // @match *://search.nadeko.net/search*
  48. // @match *://search.ngn.tf/search*
  49. // @match *://s.trung.fun/search*
  50. // @match *://search.in.projectsegfau.lt/search*
  51. // @match *://searx.sev.monster/search*
  52. // @match *://darmarit.org/searx/search*
  53. // @match *://searxng.brihx.fr/search*
  54. // @match *://www.jabber-germany.de/searx/search*
  55. // @match *://searx.namejeff.xyz/search*
  56. // @match *://searx.lunar.icu/search*
  57. // @match *://search.colbster937.dev/search*
  58. // @match *://searx.oakleycord.dev/search*
  59. // @match *://nyc1.sx.ggtyler.dev/search*
  60. // @match *://search.starless.one/search*
  61. // @match *://searx.juancord.xyz/search*
  62. // @match *://etsi.me/search*
  63. // @match *://freesearch.club/search*
  64. // @match *://searx.zhenyapav.com/search*
  65. // @match *://search.datura.network/search*
  66. // @match *://search.demoniak.ch/search*
  67. // @match *://search.ononoki.org/search*
  68. // @match *://search.einfachzocken.eu/search*
  69. // @match *://searx.work/search*
  70. // @match *://search.smnz.de/search*
  71. // @match *://sx.catgirl.cloud/search*
  72. // @match *://northboot.xyz/search*
  73. // @match *://paulgo.io/search*
  74. // @match *://search.gcomm.ch/search*
  75. // @match *://searx.ankha.ac/search*
  76. // @match *://searx.headpat.exchange/search*
  77. // @match *://searx.ox2.fr/search*
  78. // @match *://searx.nobulart.com/search*
  79. // @match *://sex.finaltek.net/search*
  80. // @match *://searx.baczek.me/search*
  81. // @run-at document-end
  82. // @license GPL-3.0-or-later
  83. // @grant none
  84. // ==/UserScript==
  85.  
  86. class Styles {
  87. static addStyle(css) {
  88. const styleNode = document.createElement('style')
  89.  
  90. document.head.appendChild((styleNode.textContent = css,styleNode))
  91. }
  92.  
  93. static init() {
  94. this.addStyle(`
  95. .js-favicon {
  96. padding: 0 3px 5px 2px !important;
  97. width: 20px !important;
  98. height: 20px !important;
  99. }`)
  100. }
  101. }
  102.  
  103. class DuckDuckGo {
  104. static getFavicon(host) {
  105. return `https://icons.duckduckgo.com/ip3/${host}.ico`
  106. }
  107. }
  108.  
  109. class Google {
  110. static getFavicon(host) {
  111. return 'https://www.google.com/s2/favicons?domain=' + host
  112. }
  113. }
  114.  
  115. class Statvoo {
  116. static getFavicon(host) {
  117. return 'https://api.statvoo.com/favicon/' + host
  118. }
  119. }
  120.  
  121. class Faviconize {
  122. static init() {
  123. document.querySelectorAll('.result > .url_wrapper, .result > .result_header').forEach(el => {
  124. if (el.querySelector('.js-favicon')) {
  125. return
  126. }
  127.  
  128. const link = el.href || el.querySelector('a').href
  129. const host = new URL(link).host
  130. const icon = document.createElement('img')
  131.  
  132. icon.className = 'js-favicon'
  133. icon.alt = host
  134. icon.src = DuckDuckGo.getFavicon(host)
  135. icon.setAttribute('onerror', `this.setAttribute('onerror', 'this.src = "${Statvoo.getFavicon(host)}"'); this.src = "${Google.getFavicon(host)}"`)
  136.  
  137. el.prepend(icon)
  138. })
  139. }
  140. }
  141.  
  142. class Main {
  143. static init() {
  144. Styles.init()
  145. Faviconize.init()
  146.  
  147. const obs = new MutationObserver(() => {
  148. Faviconize.init()
  149. })
  150.  
  151. obs.observe(document.body, {
  152. childList: true,
  153. subtree: true
  154. })
  155. }
  156. }
  157.  
  158. Main.init()