Posts with thumbnails have full size previews
This commit is contained in:
parent
44fd039961
commit
e3c4ea0e3c
|
@ -27,7 +27,7 @@ module.exports = function() {
|
||||||
let images = null
|
let images = null
|
||||||
let is_self_link = false
|
let is_self_link = false
|
||||||
let valid_reddit_self_domains = ['reddit.com']
|
let valid_reddit_self_domains = ['reddit.com']
|
||||||
|
|
||||||
if(data.over_18)
|
if(data.over_18)
|
||||||
if((config.nsfw_enabled === false && user_preferences.nsfw_enabled != 'true') || user_preferences.nsfw_enabled === 'false')
|
if((config.nsfw_enabled === false && user_preferences.nsfw_enabled != 'true') || user_preferences.nsfw_enabled === 'false')
|
||||||
continue
|
continue
|
||||||
|
@ -52,7 +52,8 @@ module.exports = function() {
|
||||||
} else {
|
} else {
|
||||||
if(data.preview.images[0].resolutions[0]) {
|
if(data.preview.images[0].resolutions[0]) {
|
||||||
images = {
|
images = {
|
||||||
thumb: await downloadAndSave(data.preview.images[0].resolutions[0].url, 'thumb_')
|
thumb: await downloadAndSave(data.preview.images[0].resolutions[0].url, 'thumb_'),
|
||||||
|
preview: await downloadAndSave(data.preview.images[0].source.url, 'preview_')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1051,8 +1051,10 @@ footer a {
|
||||||
}
|
}
|
||||||
/* SIDEBAR */
|
/* SIDEBAR */
|
||||||
#sidebar {
|
#sidebar {
|
||||||
|
box-sizing: border-box;
|
||||||
float: left;
|
float: left;
|
||||||
width: 25%;
|
width: 25%;
|
||||||
|
padding-left: 20px;
|
||||||
}
|
}
|
||||||
#sidebar .content {
|
#sidebar .content {
|
||||||
float: left;
|
float: left;
|
||||||
|
|
|
@ -110,6 +110,27 @@ html
|
||||||
.line
|
.line
|
||||||
.selftext
|
.selftext
|
||||||
!= unescape(link.selftext_html)
|
!= unescape(link.selftext_html)
|
||||||
|
if (link.images && link.images.preview)
|
||||||
|
style.
|
||||||
|
details.preview-container img {
|
||||||
|
width: 100% !important;
|
||||||
|
height: auto !important;
|
||||||
|
max-width: none !important;
|
||||||
|
max-height: none !important;
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
details.preview-container[open][data-url="#{link.images.preview}"] .preview {
|
||||||
|
width: 100%;
|
||||||
|
height: auto;
|
||||||
|
background-image: url('#{link.images.preview}');
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-size: contain;
|
||||||
|
}
|
||||||
|
details.preview-container(data-url="" + link.images.preview + "")
|
||||||
|
summary
|
||||||
|
span ▶
|
||||||
|
.preview
|
||||||
|
img(src=""+ link.images.thumb +"", alt="")
|
||||||
a(href="" + link.permalink + "", class="comments")
|
a(href="" + link.permalink + "", class="comments")
|
||||||
| #{link.num_comments} comments
|
| #{link.num_comments} comments
|
||||||
if json.info.before || json.info.after
|
if json.info.before || json.info.after
|
||||||
|
@ -128,4 +149,4 @@ html
|
||||||
label(for="nsfw") include NSFW results
|
label(for="nsfw") include NSFW results
|
||||||
input(type="checkbox", name="nsfw", id="nsfw", checked="checked")
|
input(type="checkbox", name="nsfw", id="nsfw", checked="checked")
|
||||||
input(type="submit", value="search")
|
input(type="submit", value="search")
|
||||||
include includes/footer.pug
|
include includes/footer.pug
|
||||||
|
|
|
@ -136,6 +136,27 @@ html
|
||||||
.line
|
.line
|
||||||
.selftext
|
.selftext
|
||||||
!= unescape(link.selftext_html)
|
!= unescape(link.selftext_html)
|
||||||
|
if (link.images && link.images.preview)
|
||||||
|
style.
|
||||||
|
details.preview-container img {
|
||||||
|
width: 100% !important;
|
||||||
|
height: auto !important;
|
||||||
|
max-width: none !important;
|
||||||
|
max-height: none !important;
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
details.preview-container[open][data-url="#{link.images.preview}"] .preview {
|
||||||
|
width: 100%;
|
||||||
|
height: auto;
|
||||||
|
background-image: url('#{link.images.preview}');
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-size: contain;
|
||||||
|
}
|
||||||
|
details.preview-container(data-url="" + link.images.preview + "")
|
||||||
|
summary
|
||||||
|
span ▶
|
||||||
|
.preview
|
||||||
|
img(src=""+ link.images.thumb +"", alt="")
|
||||||
a(href="" + link.permalink + "", class="comments")
|
a(href="" + link.permalink + "", class="comments")
|
||||||
| #{link.num_comments} comments
|
| #{link.num_comments} comments
|
||||||
if json.info.before || json.info.after
|
if json.info.before || json.info.after
|
||||||
|
|
Loading…
Reference in New Issue