make a preference for image sizes in posts, fix #119

This commit is contained in:
teddit
2021-03-01 19:01:02 +01:00
parent 2c55561dbd
commit f40816d7fc
5 changed files with 54 additions and 1 deletions

View File

@@ -24,6 +24,19 @@ html
p subreddit:
a(href="/r/" + subreddit + "")
p /r/#{subreddit}
if user_preferences.post_media_max_height
if(post_media_max_heights.hasOwnProperty(user_preferences.post_media_max_height))
style.
#post .image img, #post .video video {
max-height: #{post_media_max_heights[user_preferences.post_media_max_height]}px;
max-width: 100%;
}
else if(!isNaN(user_preferences.post_media_max_height))
style.
#post .image img, #post .video video {
max-height: #{user_preferences.post_media_max_height}px;
max-width: 100%;
}
.info
.score
div.arrow

View File

@@ -51,6 +51,20 @@ html
input(type="checkbox", name="nsfw_enabled", id="nsfw_enabled")
else
input(type="checkbox", name="nsfw_enabled", id="nsfw_enabled", checked="checked")
.setting
label(for="post_media_max_height") Media size in posts:
select(id="post_media_max_height", name="post_media_max_height")
-
let max_heights_html = ''
let user_key = user_preferences.post_media_max_height
if(!user_key || user_key == '')
user_key = 'medium'
for(let key in instance_config.post_media_max_heights) {
if(instance_config.post_media_max_heights.hasOwnProperty(key))
max_heights_html += `<option value="${key}" ${(user_key == key ? "selected" : "")}>${key}</option>`
}
!= max_heights_html
legend Subscribed subreddits
.setting
details