From 2b0ce6d843fd1a426e58a2302d7bd9deba5b67f0 Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Mon, 23 Nov 2020 11:11:04 +0100 Subject: [PATCH] Add: search-bar that uses DuckDuckGo to search the wiki (#96) It requires the --frontend-url to be set, as otherwise we cannot scope the DuckDuckGo results. --- static/truewiki/truewiki.css | 45 ++++++++++++++++++++++- templates/Edit.mediawiki | 14 +++++++ templates/Error.mediawiki | 14 +++++++ templates/Login.mediawiki | 14 +++++++ templates/Page.mediawiki | 14 +++++++ templates/Source.mediawiki | 14 +++++++ truewiki/namespaces/base.py | 4 ++ truewiki/namespaces/category/namespace.py | 9 +++++ truewiki/namespaces/file/namespace.py | 9 +++++ truewiki/namespaces/folder/namespace.py | 11 ++++++ truewiki/namespaces/page/namespace.py | 6 +++ truewiki/namespaces/template/namespace.py | 9 +++++ truewiki/views/sitemap.py | 3 ++ truewiki/web_routes.py | 23 ++++++++++++ truewiki/wiki_page.py | 4 ++ truewiki/wrapper.py | 4 ++ 16 files changed, 196 insertions(+), 1 deletion(-) diff --git a/static/truewiki/truewiki.css b/static/truewiki/truewiki.css index 5db4d55..3a80f5b 100644 --- a/static/truewiki/truewiki.css +++ b/static/truewiki/truewiki.css @@ -490,7 +490,7 @@ header { #review-access { position: absolute; right: 30px; - top: 10px; + top: 70px; } #review-access a { color: #aaa; @@ -504,3 +504,46 @@ header { font-size: 70%; margin: -4px 0 4px 0; } + +#search { + position: absolute; + right: 30px; + top: 10px; +} +#search input[type=text] { + width: 150px; +} + +#search-submit { + display: inline-block; + position: absolute; + right: 0px; +} +#search-submit input { + background-color: white; + border: 0; + border-left: 1px solid #aaa; + height: 20px; + margin: 1px 1px 0 0; + width: 20px; +} +#search-submit:hover input { + background-color: #aaa; +} +#search-submit div { + display: inline-block; + pointer-events: none; + position: absolute; + right: 1px; + top: -1px; + transform: rotate(45deg); +} +#search-submit div::after { + color: #D52D2D; + content: "⚲"; + font-size: 18px; + font-weight: bold; + left: -4px; + position: relative; + top: 4px; +} diff --git a/templates/Edit.mediawiki b/templates/Edit.mediawiki index a5c8770..6e99d15 100644 --- a/templates/Edit.mediawiki +++ b/templates/Edit.mediawiki @@ -20,6 +20,20 @@ Review access }} + {{#if: {{{has_search|}}}| + + }}