mirror of https://gitlab.com/curben/blog
refactor: use 'sites' search parameter
https://stackoverflow.com/a/7305734
This commit is contained in:
parent
ab3a7c1af1
commit
bd7342314d
|
@ -8,6 +8,7 @@
|
|||
<div class="searchContainer">
|
||||
<form id="searchForm" method="post" action="https://duckduckgo.com/" target="_blank">
|
||||
<input type="text" name="q" class="searchBox" id="searchTxt" placeholder="Search..." title="Powered by DuckDuckGo">
|
||||
<input type="hidden" name="sites" value="curben.netlify.com">
|
||||
<input type="hidden" name="kd" value="-1">
|
||||
<input type="hidden" name="kg" value="p">
|
||||
<input type="hidden" name="kae" value="#000">
|
||||
|
@ -31,6 +32,7 @@
|
|||
<div class="searchContainer">
|
||||
<form id="searchFormMob" method="post" action="https://duckduckgo.com/" target="_blank">
|
||||
<input type="text" name="q" class="searchBox" id="searchTxtMob" placeholder="Search..." title="Powered by DuckDuckGo">
|
||||
<input type="hidden" name="sites" value="curben.netlify.com">
|
||||
<input type="hidden" name="kd" value="-1">
|
||||
<input type="hidden" name="kg" value="p">
|
||||
<input type="hidden" name="kae" value="#000">
|
||||
|
|
|
@ -1,24 +1,10 @@
|
|||
// Search button function
|
||||
const searchClick = document.getElementById('searchClick')
|
||||
searchClick.addEventListener('click', () => {
|
||||
const searchTxt = document.getElementById('searchTxt')
|
||||
const searchForm = document.getElementById('searchForm')
|
||||
|
||||
searchTxt.value = searchTxt.value + ' site:curben.netlify.com'
|
||||
document.getElementById('searchClick').addEventListener('click', () => {
|
||||
searchForm.submit()
|
||||
|
||||
searchTxt.value = searchTxt.value.replace(' site:curben.netlify.com', '')
|
||||
}, false)
|
||||
|
||||
const searchClickMob = document.getElementById('searchClickMob')
|
||||
searchClickMob.addEventListener('click', () => {
|
||||
const searchTxt = document.getElementById('searchTxtMob')
|
||||
const searchForm = document.getElementById('searchFormMob')
|
||||
|
||||
searchTxt.value = searchTxt.value + ' site:curben.netlify.com'
|
||||
searchForm.submit()
|
||||
|
||||
searchTxt.value = searchTxt.value.replace(' site:curben.netlify.com', '')
|
||||
document.getElementById('searchClickMob').addEventListener('click', () => {
|
||||
searchFormMob.submit()
|
||||
}, false)
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue