2020-05-09 15:20:13 +00:00
|
|
|
//- Needs constants, settings, csrf, status, message
|
2020-05-04 14:02:35 +00:00
|
|
|
|
|
|
|
mixin fieldset(name)
|
|
|
|
fieldset
|
|
|
|
legend= name
|
|
|
|
.fieldset-contents
|
|
|
|
block
|
|
|
|
|
2020-06-21 14:04:15 +00:00
|
|
|
mixin input(id, description, placeholder, disabled, list)
|
2020-05-04 14:02:35 +00:00
|
|
|
.field-row
|
|
|
|
label.description(for=id)= description
|
2020-06-21 14:04:15 +00:00
|
|
|
input(type="text" id=id name=id value=settings[id] placeholder=placeholder disabled=disabled list=`${id}-list`)
|
|
|
|
if list
|
|
|
|
datalist(id=`${id}-list`)
|
|
|
|
each item in list
|
|
|
|
option(value=item)
|
2020-05-04 14:02:35 +00:00
|
|
|
|
2020-05-05 13:45:56 +00:00
|
|
|
mixin checkbox(id, description, label, disabled)
|
2020-05-04 14:02:35 +00:00
|
|
|
.field-row.checkbox-row
|
|
|
|
label.description(for=id)= description
|
2020-05-05 13:45:56 +00:00
|
|
|
input.checkbox(type="checkbox" id=id name=id checked=(settings[id] !== 0) disabled=disabled autocomplete="off")
|
2020-05-04 14:02:35 +00:00
|
|
|
label.pill(for=id tabindex=(disabled ? null : 0) onkeypress=`[" ", "Enter"].includes(event.key) && this.click()`)= label
|
|
|
|
span.fake-checkbox
|
|
|
|
|
|
|
|
mixin select(id, description, disabled, options)
|
|
|
|
.field-row
|
|
|
|
label.description(for=id)= description
|
|
|
|
select(id=id name=id disabled=disabled)
|
2020-05-05 13:45:56 +00:00
|
|
|
each option in options
|
|
|
|
option(value=option.value selected=(option.value === settings[id]))= option.text
|
2020-05-04 14:02:35 +00:00
|
|
|
|
|
|
|
doctype html
|
|
|
|
html
|
|
|
|
head
|
|
|
|
title Settings | Bibliogram
|
|
|
|
include includes/head
|
2020-06-19 07:12:43 +00:00
|
|
|
script(src=getStaticURL("html", "/static/js/settings_message.js") type="module")
|
2020-05-04 14:02:35 +00:00
|
|
|
body.settings-page
|
2020-05-09 15:20:13 +00:00
|
|
|
if status && message
|
|
|
|
.status-notice(class=status)= message
|
2020-05-04 14:02:35 +00:00
|
|
|
main.settings
|
2020-05-29 08:46:45 +00:00
|
|
|
form(action=returnAction method="post" enctype="application/x-www-form-urlencoded")
|
2020-05-09 15:20:13 +00:00
|
|
|
input(type="hidden" name="csrf" value=csrf)
|
|
|
|
|
2020-05-04 14:02:35 +00:00
|
|
|
h1 Settings
|
|
|
|
|
|
|
|
+fieldset("Features")
|
2020-07-19 13:40:27 +00:00
|
|
|
+select("language", "Language", false, [
|
2020-05-05 13:45:56 +00:00
|
|
|
{value: "en", text: "English (International)"},
|
2020-07-22 11:45:15 +00:00
|
|
|
{value: "en-us", text: "English (US)"},
|
2020-07-27 19:41:49 +00:00
|
|
|
{value: "fa", text: "فارسي"},
|
2020-07-27 14:48:36 +00:00
|
|
|
{value: "it", text: "Italiano"},
|
2020-07-27 19:41:49 +00:00
|
|
|
{value: "ru", text: "Русский"}
|
2020-05-05 13:45:56 +00:00
|
|
|
])
|
2020-05-04 14:02:35 +00:00
|
|
|
|
2020-05-09 09:34:00 +00:00
|
|
|
+select("save_data", "Save data", true, [
|
|
|
|
{value: "automatic", text: "Automatic"},
|
|
|
|
{value: "off", text: "Off"},
|
|
|
|
{value: "lazy_load", text: "Lazy load"},
|
|
|
|
{value: "full", text: "Full"}
|
|
|
|
])
|
|
|
|
|
2020-06-21 14:04:15 +00:00
|
|
|
+input("rewrite_youtube", "Rewrite YouTube domain", constants.default_user_settings.rewrite_youtube, false, [
|
|
|
|
"invidio.us",
|
|
|
|
"invidious.snopyta.org",
|
|
|
|
"invidious.13ad.de",
|
|
|
|
"watch.nettohikari.com",
|
|
|
|
"invidious.fdn.fr",
|
|
|
|
"yewtu.be"
|
|
|
|
])
|
2020-05-09 09:34:00 +00:00
|
|
|
|
2020-06-21 14:04:15 +00:00
|
|
|
+input("rewrite_twitter", "Rewrite Twitter domain", constants.default_user_settings.rewrite_twitter, false, [
|
|
|
|
"nitter.net",
|
|
|
|
"nitter.snopyta.org",
|
|
|
|
"nitter.pussthecat.org",
|
|
|
|
"nitter.42l.fr",
|
|
|
|
"nitter.mastodont.cat",
|
|
|
|
"nitter.tedomum.net",
|
|
|
|
"nitter.cattube.org",
|
|
|
|
"nitter.fdn.fr",
|
|
|
|
"nitter.1d4.us"
|
|
|
|
])
|
2020-05-09 09:34:00 +00:00
|
|
|
|
2020-05-30 11:14:36 +00:00
|
|
|
+checkbox("remove_trailing_hashtags", "Hide trailing hashtags", "Hide", false)
|
2020-05-04 14:02:35 +00:00
|
|
|
|
2020-05-05 13:45:56 +00:00
|
|
|
+checkbox("link_hashtags", "Clickable hashtags", "Clickable", true)
|
2020-05-04 14:02:35 +00:00
|
|
|
|
2020-05-30 11:04:06 +00:00
|
|
|
+checkbox("show_comments", "Display comments", "Display", true)
|
|
|
|
|
2020-05-05 14:14:11 +00:00
|
|
|
+checkbox("spa", "Fast navigation", "Enabled", false)
|
2020-05-04 14:02:35 +00:00
|
|
|
|
2020-05-30 11:04:06 +00:00
|
|
|
+select("infinite_scroll", "Infinite scroll", true, [
|
|
|
|
{value: "normal", text: "Normal"},
|
|
|
|
{value: "eager", text: "Eager"},
|
|
|
|
{value: "off", text: "Manual"}
|
|
|
|
])
|
|
|
|
|
2020-05-04 14:02:35 +00:00
|
|
|
+fieldset("Appearance")
|
2020-05-10 11:58:05 +00:00
|
|
|
+select("theme", "Theme", false, constants.themes.collated.map(entry => ({value: entry.file, text: entry.name})))
|
2020-05-04 14:02:35 +00:00
|
|
|
|
2020-05-05 15:35:18 +00:00
|
|
|
+checkbox("display_top_nav", "Display top bar", "Always", false)
|
|
|
|
|
2020-06-21 13:03:41 +00:00
|
|
|
+select("timeline_columns", "Timeline columns", false, [
|
2020-05-05 15:35:18 +00:00
|
|
|
{value: "dynamic", text: "Dynamic"},
|
2020-06-21 13:03:41 +00:00
|
|
|
{value: "three", text: "3 columns"},
|
|
|
|
{value: "four", text: "4 columns"},
|
|
|
|
{value: "six", text: "6 columns"}
|
2020-05-05 15:35:18 +00:00
|
|
|
])
|
|
|
|
|
2020-05-19 15:03:21 +00:00
|
|
|
+select("caption_side", "Caption side", false, [
|
2020-05-05 13:45:56 +00:00
|
|
|
{value: "left", text: "Left (Bibliogram)"},
|
|
|
|
{value: "right", text: "Right (Instagram)"}
|
|
|
|
])
|
2020-05-04 14:02:35 +00:00
|
|
|
|
2020-05-19 15:38:32 +00:00
|
|
|
+checkbox("display_alt", "Display alt text inline", "Display", false)
|
2020-05-04 14:02:35 +00:00
|
|
|
|
|
|
|
//- div
|
|
|
|
//- Here are all the possible input styles. Uncomment to test styling.
|
|
|
|
- let i = 2
|
|
|
|
- let id = 0
|
|
|
|
- let thisID
|
|
|
|
while --i >= 0
|
|
|
|
fieldset
|
|
|
|
legend Style demo
|
|
|
|
.field-row
|
|
|
|
- thisID = "in"+(id++)
|
|
|
|
label.description(for=thisID) Placeholder
|
|
|
|
input(type="text" placeholder="Placeholder" id=thisID)
|
|
|
|
|
|
|
|
.field-row
|
|
|
|
- thisID = "in"+(id++)
|
|
|
|
label.description(for=thisID) Disabled
|
|
|
|
input(type="text" disabled placeholder="Disabled" value="Value" id=thisID)
|
|
|
|
|
|
|
|
.field-row
|
|
|
|
label.description Button
|
|
|
|
button(type="button") Button
|
|
|
|
|
|
|
|
.field-row
|
|
|
|
- thisID = "in"+(id++)
|
|
|
|
label.description(for=thisID) Select
|
|
|
|
select(id=thisID)
|
|
|
|
option Select
|
|
|
|
option Yes
|
|
|
|
option No
|
|
|
|
option Always
|
|
|
|
option Never
|
|
|
|
|
|
|
|
.field-row.checkbox-row
|
|
|
|
- thisID = "in"+(id++)
|
|
|
|
label.description(for=thisID) Checkbox
|
|
|
|
input.checkbox(type="checkbox" id=thisID)
|
|
|
|
label.pill(for=thisID tabindex=0 onkeypress=`[" ", "Enter"].includes(event.key) && this.click()`) Label
|
|
|
|
span.fake-checkbox
|
|
|
|
|
2020-06-19 07:12:43 +00:00
|
|
|
if token
|
|
|
|
p You can restore and sync saved settings by #[a(href=`/applysettings/${token}`)#restore-link bookmarking this link.]
|
|
|
|
|
2020-05-04 14:02:35 +00:00
|
|
|
.action-container
|
2020-05-29 08:46:45 +00:00
|
|
|
span.home-link-container: a(href=returnURL).home-link ← Return
|
|
|
|
button(type="submit" formaction=stayAction).save-button Save
|
|
|
|
button(type="submit").save-button Save & return
|