Add more preferences

This commit is contained in:
Zed 2019-08-13 21:25:29 +02:00
parent 7eb66d65aa
commit 45d88da3d9
5 changed files with 29 additions and 18 deletions

View File

@ -386,6 +386,7 @@ video, .video-container img {
padding: 0 2em; padding: 0 2em;
line-height: 2em; line-height: 2em;
} }
.show-more a:hover { .show-more a:hover {
background-color: #282828; background-color: #282828;
} }
@ -441,7 +442,6 @@ video, .video-container img {
text-align: left; text-align: left;
vertical-align: top; vertical-align: top;
max-width: 32%; max-width: 32%;
position: sticky;
top: 50px; top: 50px;
} }

View File

@ -32,6 +32,19 @@ const prefList*: Table[string, seq[Pref]] = {
Pref(kind: checkbox, name: "autoplayGifs", label: "Autoplay gifs", Pref(kind: checkbox, name: "autoplayGifs", label: "Autoplay gifs",
defaultState: true), defaultState: true),
],
"Display": @[
Pref(kind: checkbox, name: "hideTweetStats",
label: "Hide tweet stats (replies, retweets, likes",
defaultState: false),
Pref(kind: checkbox, name: "hideBanner", label: "Hide profile banner",
defaultState: false),
Pref(kind: checkbox, name: "stickyProfile",
label: "Make profile sidebar stick to top",
defaultState: true)
] ]
}.toTable }.toTable

View File

@ -22,10 +22,8 @@ db("cache.db", "", "", ""):
tweets*: string tweets*: string
likes*: string likes*: string
media*: string media*: string
verified* {. verified* {.dbType: "STRING", parseIt: parseBool(it.s), formatIt: $it.}: bool
dbType: "STRING", parseIt: parseBool(it.s), formatIt: $it.}: bool protected* {.dbType: "STRING", parseIt: parseBool(it.s), formatIt: $it.}: bool
protected* {.
dbType: "STRING", parseIt: parseBool(it.s), formatIt: $it.}: bool
joinDate* {. joinDate* {.
dbType: "INTEGER" dbType: "INTEGER"
parseIt: it.i.fromUnix() parseIt: it.i.fromUnix()
@ -49,17 +47,14 @@ db("cache.db", "", "", ""):
parseIt: parseEnum[VideoType](it.s), parseIt: parseEnum[VideoType](it.s),
formatIt: $it, formatIt: $it,
.}: VideoType .}: VideoType
available* {. available* {.dbType: "STRING", parseIt: parseBool(it.s) formatIt: $it.}: bool
dbType: "STRING",
parseIt: parseBool(it.s)
formatIt: $it
.}: bool
Prefs* = object Prefs* = object
videoPlayback* {. videoPlayback* {.dbType: "STRING", parseIt: parseBool(it.s), formatIt: $it.}: bool
dbType: "STRING", parseIt: parseBool(it.s), formatIt: $it.}: bool autoplayGifs* {.dbType: "STRING", parseIt: parseBool(it.s), formatIt: $it.}: bool
autoplayGifs* {. hideTweetStats* {.dbType: "STRING", parseIt: parseBool(it.s), formatIt: $it.}: bool
dbType: "STRING", parseIt: parseBool(it.s), formatIt: $it.}: bool hideBanner* {.dbType: "STRING", parseIt: parseBool(it.s), formatIt: $it.}: bool
stickyProfile* {.dbType: "STRING", parseIt: parseBool(it.s), formatIt: $it.}: bool
type type
QueryKind* = enum QueryKind* = enum

View File

@ -70,10 +70,12 @@ proc renderBanner(profile: Profile): VNode =
proc renderProfile*(profile: Profile; timeline: Timeline; proc renderProfile*(profile: Profile; timeline: Timeline;
photoRail: seq[GalleryPhoto]; prefs: Prefs): VNode = photoRail: seq[GalleryPhoto]; prefs: Prefs): VNode =
buildHtml(tdiv(class="profile-tabs")): buildHtml(tdiv(class="profile-tabs")):
if not prefs.hideBanner:
tdiv(class="profile-banner"): tdiv(class="profile-banner"):
renderBanner(profile) renderBanner(profile)
tdiv(class="profile-tab"): let sticky = if prefs.stickyProfile: "sticky" else: "unset"
tdiv(class="profile-tab", style={position: sticky}):
renderProfileCard(profile) renderProfileCard(profile)
if photoRail.len > 0: if photoRail.len > 0:
renderPhotoRail(profile, photoRail) renderPhotoRail(profile, photoRail)

View File

@ -210,6 +210,7 @@ proc renderTweet*(tweet: Tweet; prefs: Prefs; class="";
elif tweet.poll.isSome: elif tweet.poll.isSome:
renderPoll(tweet.poll.get()) renderPoll(tweet.poll.get())
if not prefs.hideTweetStats:
renderStats(tweet.stats) renderStats(tweet.stats)
if tweet.hasThread and "timeline" in class: if tweet.hasThread and "timeline" in class: