pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/templates templates: add DuckDuckGo search box



details:   https://anonhg.NetBSD.org/pkgsrc/rev/277cc3ea4027
branches:  trunk
changeset: 450764:277cc3ea4027
user:      nia <nia%pkgsrc.org@localhost>
date:      Wed Apr 21 10:17:16 2021 +0000

description:
templates: add DuckDuckGo search box

diffstat:

 templates/README.top |  30 +++++++++++++++++++++++++++++-
 templates/main.css   |  19 ++++++++++++++++++-
 2 files changed, 47 insertions(+), 2 deletions(-)

diffs (83 lines):

diff -r bad1ffff0889 -r 277cc3ea4027 templates/README.top
--- a/templates/README.top      Wed Apr 21 09:35:33 2021 +0000
+++ b/templates/README.top      Wed Apr 21 10:17:16 2021 +0000
@@ -1,4 +1,4 @@
-<!-- $NetBSD: README.top,v 1.29 2021/04/12 14:02:43 nia Exp $ -->
+<!-- $NetBSD: README.top,v 1.30 2021/04/21 10:17:16 nia Exp $ -->
 <!-- generated by pkgsrc/mk/scripts/mkreadme -->
 <!doctype html>
 <html lang="en">
@@ -7,12 +7,40 @@
 <meta name="viewport" content="width=device-width, initial-scale=1">
 <link href="templates/main.css" rel="stylesheet">
 <title>The NetBSD Packages Collection</title>
+<script type="text/javascript">
+function appendSearch() {
+       document.x.q.value += ' site:cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc +"NetBSD Packages Collection"'
+       return true;
+}
+
+window.onload = function() {
+       var e = document.getElementById('search-box');
+       e.style.display = "block";
+};
+</script>
 </head>
 <body>
 
 <a href="https://pkgsrc.org/";><img src="templates/pkgsrc.png" alt="pkgsrc" id="logo"></a>
 <h1>The NetBSD Packages Collection</h1>
 
+<!-- based on https://duckduckgo.com/search_box with customizations
+to make it more useful for searching pkgsrc -->
+<form class="search-box" id="search-box" name="x" style="display: none;"
+       action="https://duckduckgo.com/"; target="_top" onSubmit="return appendSearch()">
+       <label for="q">Search:</label>
+       <input type="text" autocomplete="off" name="q"
+               placeholder="Search DuckDuckGo"
+               value="">
+       <input id="search_button_homepage" type="submit" value="Go"/>
+       <!-- don't autoload images -->
+       <input type="hidden" name="kc" value="-1"/>
+       <!-- don't show favicons -->
+       <input type="hidden" name="kf" value="-1"/>
+       <!-- don't open instant answers -->
+       <input type="hidden" name="kz" value="-1"/>
+</form>
+
 <p>
 The packages collection is divided into categories of packages.
 A <a href="index-all.html">complete list of all packages</a>
diff -r bad1ffff0889 -r 277cc3ea4027 templates/main.css
--- a/templates/main.css        Wed Apr 21 09:35:33 2021 +0000
+++ b/templates/main.css        Wed Apr 21 10:17:16 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: main.css,v 1.12 2021/04/13 15:04:03 nia Exp $ */
+/* $NetBSD: main.css,v 1.13 2021/04/21 10:17:16 nia Exp $ */
 
 body {
        font-family: sans-serif;
@@ -76,6 +76,23 @@
        border-bottom: 1px solid #aaa;
 }
 
+.search-box label {
+       display: none;
+}
+
+.search-box input {
+       color: #000;
+       background-color: #fff;
+       border: 1px solid #ccc;
+       border-radius: 2px;
+       padding: 3px;
+}
+
+.search-box input[type="Submit"] {
+       padding-left: 1em;
+       padding-right: 1em;
+}
+
 nav {
        margin-bottom: 1em;
 }



Home | Main Index | Thread Index | Old Index