Compare commits
2 commits
a9acfc34a2
...
711a8225fb
Author | SHA1 | Date | |
---|---|---|---|
711a8225fb | |||
82978e7c13 |
6 changed files with 54 additions and 17 deletions
|
@ -10,6 +10,7 @@
|
||||||
(make-reloadable-entry-point (quote varname) filename))))
|
(make-reloadable-entry-point (quote varname) filename))))
|
||||||
|
|
||||||
(require-reloadable "src/page-category.rkt" page-category)
|
(require-reloadable "src/page-category.rkt" page-category)
|
||||||
|
(require-reloadable "src/page-global-search.rkt" page-global-search)
|
||||||
(require-reloadable "src/page-home.rkt" page-home)
|
(require-reloadable "src/page-home.rkt" page-home)
|
||||||
(require-reloadable "src/page-not-found.rkt" page-not-found)
|
(require-reloadable "src/page-not-found.rkt" page-not-found)
|
||||||
(require-reloadable "src/page-proxy.rkt" page-proxy)
|
(require-reloadable "src/page-proxy.rkt" page-proxy)
|
||||||
|
@ -31,6 +32,7 @@
|
||||||
(dispatcher-tree
|
(dispatcher-tree
|
||||||
; order of these does not matter
|
; order of these does not matter
|
||||||
page-category
|
page-category
|
||||||
|
page-global-search
|
||||||
page-home
|
page-home
|
||||||
page-not-found
|
page-not-found
|
||||||
page-proxy
|
page-proxy
|
||||||
|
|
2
dist.rkt
2
dist.rkt
|
@ -4,6 +4,7 @@
|
||||||
"src/dispatcher-tree.rkt")
|
"src/dispatcher-tree.rkt")
|
||||||
|
|
||||||
(require (only-in "src/page-category.rkt" page-category))
|
(require (only-in "src/page-category.rkt" page-category))
|
||||||
|
(require (only-in "src/page-global-search.rkt" page-global-search))
|
||||||
(require (only-in "src/page-home.rkt" page-home))
|
(require (only-in "src/page-home.rkt" page-home))
|
||||||
(require (only-in "src/page-not-found.rkt" page-not-found))
|
(require (only-in "src/page-not-found.rkt" page-not-found))
|
||||||
(require (only-in "src/page-proxy.rkt" page-proxy))
|
(require (only-in "src/page-proxy.rkt" page-proxy))
|
||||||
|
@ -20,6 +21,7 @@
|
||||||
(dispatcher-tree
|
(dispatcher-tree
|
||||||
; order of these does not matter
|
; order of these does not matter
|
||||||
page-category
|
page-category
|
||||||
|
page-global-search
|
||||||
page-home
|
page-home
|
||||||
page-not-found
|
page-not-found
|
||||||
page-proxy
|
page-proxy
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
(sequencer:make
|
(sequencer:make
|
||||||
(pathprocedure:make "/" (hash-ref ds 'page-home))
|
(pathprocedure:make "/" (hash-ref ds 'page-home))
|
||||||
(pathprocedure:make "/proxy" (hash-ref ds 'page-proxy))
|
(pathprocedure:make "/proxy" (hash-ref ds 'page-proxy))
|
||||||
|
(pathprocedure:make "/search" (hash-ref ds 'page-global-search))
|
||||||
(filter:make #rx"^/[a-z-]+/wiki/Category:.+$" (lift:make (hash-ref ds 'page-category)))
|
(filter:make #rx"^/[a-z-]+/wiki/Category:.+$" (lift:make (hash-ref ds 'page-category)))
|
||||||
(filter:make #rx"^/[a-z-]+/wiki/.+$" (lift:make (hash-ref ds 'page-wiki)))
|
(filter:make #rx"^/[a-z-]+/wiki/.+$" (lift:make (hash-ref ds 'page-wiki)))
|
||||||
(filter:make #rx"^/[a-z-]+/search$" (lift:make (hash-ref ds 'page-search)))
|
(filter:make #rx"^/[a-z-]+/search$" (lift:make (hash-ref ds 'page-search)))
|
||||||
|
|
25
src/page-global-search.rkt
Normal file
25
src/page-global-search.rkt
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
#lang racket/base
|
||||||
|
(require racket/dict
|
||||||
|
; web server libs
|
||||||
|
net/url
|
||||||
|
web-server/http
|
||||||
|
"application-globals.rkt"
|
||||||
|
"url-utils.rkt"
|
||||||
|
"xexpr-utils.rkt")
|
||||||
|
|
||||||
|
(provide
|
||||||
|
page-global-search)
|
||||||
|
|
||||||
|
(define (page-global-search req)
|
||||||
|
(define wikiname (dict-ref (url-query (request-uri req)) 'wikiname #f))
|
||||||
|
(define q (dict-ref (url-query (request-uri req)) 'q #f))
|
||||||
|
(response-handler
|
||||||
|
(if (not (and wikiname q))
|
||||||
|
(response/output
|
||||||
|
#:code 400
|
||||||
|
#:mime-type "text/plain"
|
||||||
|
(λ (out)
|
||||||
|
(displayln "Requires wikiname and q parameters." out)))
|
||||||
|
(generate-redirect (format "/~a/search?~a"
|
||||||
|
wikiname
|
||||||
|
(params->query `(("q" . ,q))))))))
|
|
@ -27,11 +27,20 @@
|
||||||
(p "It removes ads, videos, and suggested content, leaving you with a clean page that doesn't slow down your device or use up your data.")
|
(p "It removes ads, videos, and suggested content, leaving you with a clean page that doesn't slow down your device or use up your data.")
|
||||||
(p "BreezeWiki can also be called an \"alternative frontend for Fandom\".")
|
(p "BreezeWiki can also be called an \"alternative frontend for Fandom\".")
|
||||||
(p ,(format "To use BreezeWiki, just replace \"fandom.com\" with \"~a\", and you'll instantly be teleported to a better world."
|
(p ,(format "To use BreezeWiki, just replace \"fandom.com\" with \"~a\", and you'll instantly be teleported to a better world."
|
||||||
(if (config-true? 'canonical_origin)
|
(if (config-true? 'canonical_origin)
|
||||||
(url-host (string->url (config-get 'canonical_origin)))
|
(url-host (string->url (config-get 'canonical_origin)))
|
||||||
"breezewiki.com")))
|
"breezewiki.com")))
|
||||||
(p "If you'd like to be automatically sent to BreezeWiki every time in the future, "
|
(p "If you'd like to be automatically sent to BreezeWiki every time in the future, "
|
||||||
(a (@ (href "https://docs.breezewiki.com/Automatic_Redirection.html")) "check out the tutorial in the manual."))
|
(a (@ (href "https://docs.breezewiki.com/Automatic_Redirection.html")) "check out the tutorial in the manual."))
|
||||||
|
(h2 "Find a page")
|
||||||
|
(form (@ (action "/search"))
|
||||||
|
(label (@ (class "paired__label"))
|
||||||
|
"Wiki name"
|
||||||
|
(input (@ (name "wikiname") (class "paired__input") (type "text") (placeholder "pokemon") (required))))
|
||||||
|
(label (@ (class "paired__label"))
|
||||||
|
"Search query"
|
||||||
|
(input (@ (name "q") (class "paired__input") (type "text") (placeholder "Eevee") (required))))
|
||||||
|
(button "Search"))
|
||||||
(h2 "Example pages")
|
(h2 "Example pages")
|
||||||
(ul
|
(ul
|
||||||
,@(map (λ (x)
|
,@(map (λ (x)
|
||||||
|
|
|
@ -26,6 +26,9 @@ sup {
|
||||||
sub {
|
sub {
|
||||||
vertical-align: sub;
|
vertical-align: sub;
|
||||||
}
|
}
|
||||||
|
.page table {
|
||||||
|
color: var(--theme-page-text-color); /* no idea why this needs to be specified, it should inherit from .page */
|
||||||
|
}
|
||||||
|
|
||||||
/* general page appearance */
|
/* general page appearance */
|
||||||
body.skin-fandomdesktop, button, input, textarea, .wikitable, .va-table {
|
body.skin-fandomdesktop, button, input, textarea, .wikitable, .va-table {
|
||||||
|
@ -58,6 +61,15 @@ p {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* home page search form */
|
||||||
|
.paired__label {
|
||||||
|
display: grid;
|
||||||
|
}
|
||||||
|
.paired__input {
|
||||||
|
width: auto;
|
||||||
|
max-width: 240px;
|
||||||
|
}
|
||||||
|
|
||||||
/* custom footer with source and license info */
|
/* custom footer with source and license info */
|
||||||
.custom-footer {
|
.custom-footer {
|
||||||
clear: both;
|
clear: both;
|
||||||
|
@ -132,20 +144,6 @@ img {
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* table overrides for dark theme pages */
|
|
||||||
/* these colours look good in all wikis I tried. colours that don't look good:
|
|
||||||
--theme-page-background-color--secondary is bad for fallout
|
|
||||||
--theme-page-accent-mix-color is bad for minecraft */
|
|
||||||
.wikitable > tr > th, .wikitable > * > tr > th, .va-table th {
|
|
||||||
background-color: var(--theme-page-dynamic-color-1--inverted);
|
|
||||||
}
|
|
||||||
.wikitable td, .va-table td {
|
|
||||||
background-color: var(--theme-page-text-mix-color-95);
|
|
||||||
}
|
|
||||||
.page table {
|
|
||||||
color: var(--theme-page-text-color); /* no idea why this needs to be specified, it should inherit from .page */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* float right. reorganised from their sheet */
|
/* float right. reorganised from their sheet */
|
||||||
.tright {
|
.tright {
|
||||||
clear: right;
|
clear: right;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue