mirror of https://gitlab.com/curben/blog
feat(search): replace gitlab search with duckduckgo
todo: algolia
This commit is contained in:
parent
105de8515c
commit
a5d1791b14
|
@ -3,7 +3,7 @@
|
|||
X-XSS-Protection: 1; mode=block
|
||||
X-Content-Type-Options: nosniff
|
||||
Content-Language: en
|
||||
Content-Security-Policy: default-src 'self'; child-src 'none'; connect-src 'none'; font-src 'none'; frame-src 'none'; img-src https: 'self'; manifest-src 'none'; media-src 'none'; object-src 'none'; prefetch-src 'none'; script-src https://cdnjs.cloudflare.com 'self'; style-src https://cdnjs.cloudflare.com 'self'; worker-src 'none'; base-uri 'none'; form-action 'none'; block-all-mixed-content; frame-ancestors 'none'
|
||||
Content-Security-Policy: default-src 'self'; child-src 'none'; connect-src 'none'; font-src 'none'; frame-src 'none'; img-src https: 'self'; manifest-src 'none'; media-src 'none'; object-src 'none'; prefetch-src 'none'; script-src https://cdnjs.cloudflare.com 'self'; style-src https://cdnjs.cloudflare.com 'self'; worker-src 'none'; base-uri 'none'; form-action https://duckduckgo.com; frame-ancestors 'none'; block-all-mixed-content
|
||||
Referrer-Policy: no-referrer
|
||||
Strict-Transport-Security: max-age=31536000
|
||||
Feature-Policy: accelerometer 'none'; autoplay 'none'; camera 'none'; document.domain 'none'; display-capture 'none'; encrypted-media 'none'; geolocation 'none'; gyroscope 'none'; magnetometer 'none'; microphone 'none'; midi 'none'; payment 'none'; sync-xhr 'none'; usb 'none'
|
|
@ -6,14 +6,19 @@
|
|||
<% } %>
|
||||
|
||||
<div class="searchContainer">
|
||||
<input class="searchBox" type="text" id="searchTxt" placeholder="Search...">
|
||||
<a class="searchBtn no-underline" id="searchClick" href="#">
|
||||
<form id="searchForm" method="post" action="https://duckduckgo.com/" target="_blank">
|
||||
<input type="text" name="q" class="searchBox" id="searchTxt" placeholder="Search..." title="Search using DuckDuckGo">
|
||||
<input type="hidden" name="kd" value="-1">
|
||||
<input type="hidden" name="kg" value="p">
|
||||
<input type="hidden" name="kae" value="#000">
|
||||
<a class="searchBtn no-underline" id="searchClick">
|
||||
<svg viewBox="0 0 512 512">
|
||||
<title>Search</title>
|
||||
<title>Search using DuckDuckGo</title>
|
||||
<desc>Search icon</desc>
|
||||
<use href="/svg/search.svg#search"/>
|
||||
</svg>
|
||||
</a>
|
||||
</form>
|
||||
</div>
|
||||
</nav>
|
||||
<%/* Nav menu for mobile */%>
|
||||
|
@ -24,14 +29,19 @@
|
|||
<input id="mobile-menu-toggle" type="checkbox"/>
|
||||
<ul class="mobile-nav-link">
|
||||
<div class="searchContainer">
|
||||
<input class="searchBox" type="text" id="searchTxtMob" placeholder="Search...">
|
||||
<a class="searchBtn no-underline" id="searchClickMob" href="#">
|
||||
<form id="searchFormMob" method="post" action="https://duckduckgo.com/" target="_blank">
|
||||
<input type="text" name="q" class="searchBox" id="searchTxtMob" placeholder="Search..." title="Search using DuckDuckGo">
|
||||
<input type="hidden" name="kd" value="-1">
|
||||
<input type="hidden" name="kg" value="p">
|
||||
<input type="hidden" name="kae" value="#000">
|
||||
<a class="searchBtn no-underline" id="searchClickMob">
|
||||
<svg viewBox="0 0 512 512">
|
||||
<title>Search</title>
|
||||
<title>Search using DuckDuckGo</title>
|
||||
<desc>Search icon</desc>
|
||||
<use href="/svg/search.svg#search"/>
|
||||
</svg>
|
||||
</a>
|
||||
</form>
|
||||
</div>
|
||||
<p><br></p>
|
||||
<% for (let i in theme.menu) { %>
|
||||
|
|
|
@ -1,16 +1,24 @@
|
|||
// Search button function
|
||||
const searchClick = document.getElementById('searchClick')
|
||||
searchClick.addEventListener('click', () => {
|
||||
window.open('https://gitlab.com/search?utf8=%E2%9C%93&search=' +
|
||||
document.getElementById('searchTxt').value +
|
||||
'&group_id=&project_id=8306723&search_code=true&repository_ref=master')
|
||||
}, false);
|
||||
const searchTxt = document.getElementById('searchTxt')
|
||||
const searchForm = document.getElementById('searchForm')
|
||||
|
||||
searchTxt.value = searchTxt.value + ' site:curben.netlify.com'
|
||||
searchForm.submit()
|
||||
|
||||
searchTxt.value = searchTxt.value.replace(' site:curben.netlify.com', '')
|
||||
}, false)
|
||||
|
||||
const searchClickMob = document.getElementById('searchClickMob')
|
||||
searchClickMob.addEventListener('click', () => {
|
||||
window.open('https://gitlab.com/search?utf8=%E2%9C%93&search=' +
|
||||
document.getElementById('searchTxtMob').value +
|
||||
'&group_id=&project_id=8306723&search_code=true&repository_ref=master')
|
||||
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', '')
|
||||
}, false)
|
||||
|
||||
/*
|
||||
|
@ -20,6 +28,7 @@ searchClickMob.addEventListener('click', () => {
|
|||
* <script src> is executed.
|
||||
*/
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
|
||||
// Copy button
|
||||
const copyCode = new ClipboardJS('.copy-button', {
|
||||
target: (trigger) => {
|
||||
|
|
Loading…
Reference in New Issue