From a3739cf6de614fc255139ad40e389097872407eb Mon Sep 17 00:00:00 2001 From: MDLeom <2809763-curben@users.noreply.gitlab.com> Date: Fri, 6 Mar 2020 08:47:37 +0000 Subject: [PATCH] feat: use duckduckgo onion address if site is .onion --- themes/chameleon/source/js/chameleon.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/themes/chameleon/source/js/chameleon.js b/themes/chameleon/source/js/chameleon.js index f5be359..bbc8ed2 100644 --- a/themes/chameleon/source/js/chameleon.js +++ b/themes/chameleon/source/js/chameleon.js @@ -6,3 +6,12 @@ document.getElementById('searchClick').addEventListener('click', () => { document.getElementById('searchClickMob').addEventListener('click', () => { searchFormMob.submit() }, false) + +// Use duckduckgo's onion address when the site is accessed via .onion +if (document.location.hostname.endsWith('.onion')) { + const searchForms = document.querySelectorAll('form#searchForm, form#searchFormMob') + + searchForms.forEach((form) => { + form.setAttribute('action', 'https://3g2upl4pq6kufc4m.onion/') + }) +}