Skip to content

Commit

Permalink
moved web search to a user preference
Browse files Browse the repository at this point in the history
  • Loading branch information
kennethrapp committed Apr 29, 2021
1 parent 3689e25 commit da1d940
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions apps/news/news.arc
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,6 @@

)

; Look up title on Searx, a free metasearch engine

(def weblink (q)
(pr bar*)
(link "web" (+ "https://searx.me/?q=" (urlencode q))))


(def vote-url (user i dir whence)
(+ "vote?for=" i!id
Expand Down Expand Up @@ -94,6 +88,7 @@
theme 0
topcolor nil
keys nil
search-pref "https://searx.neocities.org?q=" ; search prefix
delay 0)

(deftem item
Expand Down Expand Up @@ -291,6 +286,12 @@

(mac uvar (u k) `((profile ,u) ',k))


; enable a user-defined prefix for title search and urls

(def search-link (u q)
(aif (and u (uvar u search-pref)) (+ it (urlencode q)) it))

(mac karma (u) `(uvar ,u karma))
(mac ignored (u) `(uvar ,u ignore))

Expand Down Expand Up @@ -887,6 +888,7 @@
(hexcol topcolor ,(or (p 'topcolor) (hexrep site-color*)) ,k ,k)
(choice theme ,themes* ,u ,u)
(int font-size ,(p 'font-size) ,u ,u)
(string search-pref,(p 'search-pref) ,u ,u)
(int delay ,(p 'delay) ,u ,u))))

(def saved-link (user subject)
Expand Down Expand Up @@ -1032,7 +1034,7 @@
(tag (div "class" "subtext")
(hook 'itemline s user)
(itemline s user)
(when (isnt whence "news") (weblink s!title))
(when (isnt whence "news") (search-link user s!title))
(when (in s!type 'story 'poll) (commentlink s user))
(editlink s user)
(when (apoll s) (addoptlink s user))
Expand Down

0 comments on commit da1d940

Please sign in to comment.