mirror of
https://git.sr.ht/~cadence/cloudtube
synced 2024-11-22 15:47:30 +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,9 +11,9 @@ 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
|
||||
p CloudTube gets better with your help. I can't deal with issues that I don't know about.
|
||||
p: a(href="https://todo.sr.ht/~cadence/tube") Report a problem or missing feature
|
||||
p: a(href="https://todo.sr.ht/~cadence/tube") Report a problem or missing feature
|
||||
|
@ -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