mirror of
https://git.sr.ht/~cadence/cloudtube
synced 2024-11-14 04:17:29 +00:00
Autofocus search if user-agent not a mobile device
This commit is contained in:
parent
54ae21685f
commit
848651757a
11
api/pages.js
Normal file
11
api/pages.js
Normal file
@ -0,0 +1,11 @@
|
||||
const {render} = require("pinski/plugins")
|
||||
|
||||
module.exports = [
|
||||
{
|
||||
route: "/", methods: ["GET"], code: async ({req}) => {
|
||||
const userAgent = req.headers["user-agent"] || ""
|
||||
const mobile = userAgent.toLowerCase().includes("mobile")
|
||||
return render(200, "pug/home.pug", {mobile})
|
||||
}
|
||||
}
|
||||
]
|
@ -11,7 +11,7 @@ block content
|
||||
p You're in control. Watch things your way.
|
||||
p Go on. What do you want to watch?
|
||||
form(method="get" action="/search").encouraging-search-form
|
||||
input(type="text" name="q" placeholder="I'd like to watch..." autocomplete="off").search.base-border-look
|
||||
input(type="text" name="q" placeholder="I'd like to watch..." autocomplete="off" autofocus=!mobile).search.base-border-look
|
||||
p: a(href="/cant-think") ...can't think of anything?
|
||||
|
||||
.encouraging-message
|
||||
|
@ -16,7 +16,6 @@ const {setInstance} = require("pinski/plugins")
|
||||
server.addRoute("/static/css/main.css", "sass/main.sass", "sass")
|
||||
|
||||
server.addPugDir("pug", ["pug/includes"])
|
||||
server.addRoute("/", "pug/home.pug", "pug")
|
||||
server.addRoute("/cant-think", "pug/cant-think.pug", "pug")
|
||||
|
||||
server.addStaticHashTableDir("html/static/js")
|
||||
|
Loading…
Reference in New Issue
Block a user