Set the catalog thumbnail via background image, save one element.
Also tiny fixes here and there.
This commit is contained in:
parent
ad5f787c71
commit
d6030f7df0
@ -415,26 +415,28 @@ a[href="javascript:;"] {
|
|||||||
max-height: 320px;
|
max-height: 320px;
|
||||||
word-break: break-word;
|
word-break: break-word;
|
||||||
}
|
}
|
||||||
.catalog-thread > a {
|
.thumb {
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
background-size: 100% 100%;
|
||||||
.thumb {
|
background-repeat: no-repeat;
|
||||||
max-width: 150px;
|
background-position: center;
|
||||||
max-height: 150px;
|
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
box-shadow: 0 0 5px rgba(0, 0, 0, .25);
|
box-shadow: 0 0 5px rgba(0, 0, 0, .25);
|
||||||
}
|
}
|
||||||
.thunb.spoiler-file {
|
.thumb.spoiler-file {
|
||||||
|
background-size: 100px;
|
||||||
width: 100px;
|
width: 100px;
|
||||||
height: 100px;
|
height: 100px;
|
||||||
}
|
}
|
||||||
.thumb.deleted-file {
|
.thumb.deleted-file {
|
||||||
|
background-size: 127px 13px;
|
||||||
width: 127px;
|
width: 127px;
|
||||||
height: 13px;
|
height: 13px;
|
||||||
padding: 20px 11px;
|
padding: 20px 11px;
|
||||||
}
|
}
|
||||||
.thumb.no-file {
|
.thumb.no-file {
|
||||||
|
background-size: 77px 13px;
|
||||||
width: 77px;
|
width: 77px;
|
||||||
height: 13px;
|
height: 13px;
|
||||||
padding: 20px 36px;
|
padding: 20px 36px;
|
||||||
@ -444,7 +446,7 @@ a[href="javascript:;"] {
|
|||||||
top: 1px;
|
top: 1px;
|
||||||
right: 1px;
|
right: 1px;
|
||||||
}
|
}
|
||||||
.catalog-thread > a:not(:hover) .menu-button {
|
.thumb:not(:hover) .menu-button > i {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
.thread-icons > .menu-button > i {
|
.thread-icons > .menu-button > i {
|
||||||
@ -455,10 +457,9 @@ a[href="javascript:;"] {
|
|||||||
cursor: help;
|
cursor: help;
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
line-height: .8;
|
margin-top: 2px;
|
||||||
margin-top: 1px;
|
|
||||||
}
|
}
|
||||||
.catalog-thread .subject {
|
.catalog-thread > .subject {
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
@ -466,7 +467,7 @@ a[href="javascript:;"] {
|
|||||||
}
|
}
|
||||||
.catalog-thread > .comment {
|
.catalog-thread > .comment {
|
||||||
flex-shrink: 1;
|
flex-shrink: 1;
|
||||||
max-width: 100%;
|
align-self: stretch;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
<a href="/#{thread.board}/res/#{thread.ID}" target="_blank">
|
<a href="/#{thread.board}/res/#{thread.ID}" target="_blank" class="thumb">
|
||||||
<img src="#{src}" class="thumb #{imgClass or ''}" #{if imgWidth then "width='#{imgWidth}'"} #{if imgHeight then "height='#{imgHeight}'"}>
|
|
||||||
<div class="thread-icons"></div>
|
<div class="thread-icons"></div>
|
||||||
</a>
|
</a>
|
||||||
<div class="thread-stats" title="Post count / File count / Page count">
|
<div class="thread-stats" title="Post count / File count / Page count">
|
||||||
|
|||||||
@ -263,25 +263,6 @@ Build =
|
|||||||
{staticPath, gifIcon} = Build
|
{staticPath, gifIcon} = Build
|
||||||
data = Index.liveThreadData[Index.liveThreadIDs.indexOf thread.ID]
|
data = Index.liveThreadData[Index.liveThreadIDs.indexOf thread.ID]
|
||||||
|
|
||||||
if data.spoiler and !Conf['Reveal Spoilers']
|
|
||||||
src = "#{staticPath}spoiler"
|
|
||||||
if spoilerRange = Build.spoilerRange[thread.board]
|
|
||||||
# Randomize the spoiler image.
|
|
||||||
src += "-#{thread.board}" + Math.floor 1 + spoilerRange * Math.random()
|
|
||||||
src += '.png'
|
|
||||||
imgClass = 'spoiler-file'
|
|
||||||
else if data.filedeleted
|
|
||||||
src = "#{staticPath}filedeleted-res#{gifIcon}"
|
|
||||||
imgClass = 'deleted-file'
|
|
||||||
else if thread.OP.file
|
|
||||||
src = thread.OP.file.thumbURL
|
|
||||||
max = Math.max data.tn_w, data.tn_h
|
|
||||||
imgWidth = data.tn_w * 150 / max
|
|
||||||
imgHeight = data.tn_h * 150 / max
|
|
||||||
else
|
|
||||||
src = "#{staticPath}nofile.png"
|
|
||||||
imgClass = 'no-file'
|
|
||||||
|
|
||||||
postCount = data.replies + 1
|
postCount = data.replies + 1
|
||||||
fileCount = data.images + !!data.ext
|
fileCount = data.images + !!data.ext
|
||||||
pageCount = Index.liveThreadIDs.indexOf(thread.ID) // Index.threadsNumPerPage
|
pageCount = Index.liveThreadIDs.indexOf(thread.ID) // Index.threadsNumPerPage
|
||||||
@ -300,6 +281,27 @@ Build =
|
|||||||
$.addClass root, 'pinned' if thread.isPinned
|
$.addClass root, 'pinned' if thread.isPinned
|
||||||
$.addClass root, thread.OP.highlights... if thread.OP.highlights
|
$.addClass root, thread.OP.highlights... if thread.OP.highlights
|
||||||
|
|
||||||
|
thumb = root.firstElementChild
|
||||||
|
if data.spoiler and !Conf['Reveal Spoilers']
|
||||||
|
src = "#{staticPath}spoiler"
|
||||||
|
if spoilerRange = Build.spoilerRange[thread.board]
|
||||||
|
# Randomize the spoiler image.
|
||||||
|
src += "-#{thread.board}" + Math.floor 1 + spoilerRange * Math.random()
|
||||||
|
src += '.png'
|
||||||
|
$.addClass thumb, 'spoiler-file'
|
||||||
|
else if data.filedeleted
|
||||||
|
src = "#{staticPath}filedeleted-res#{gifIcon}"
|
||||||
|
$.addClass thumb, 'deleted-file'
|
||||||
|
else if thread.OP.file
|
||||||
|
src = thread.OP.file.thumbURL
|
||||||
|
max = Math.max data.tn_w, data.tn_h
|
||||||
|
thumb.style.width = data.tn_w * 150 / max + 'px'
|
||||||
|
thumb.style.height = data.tn_h * 150 / max + 'px'
|
||||||
|
else
|
||||||
|
src = "#{staticPath}nofile.png"
|
||||||
|
$.addClass thumb, 'no-file'
|
||||||
|
thumb.style.backgroundImage = "url(#{src})"
|
||||||
|
|
||||||
for quotelink in $$ '.quotelink', root.lastElementChild
|
for quotelink in $$ '.quotelink', root.lastElementChild
|
||||||
$.replace quotelink, [quotelink.childNodes...]
|
$.replace quotelink, [quotelink.childNodes...]
|
||||||
|
|
||||||
|
|||||||
@ -22,11 +22,14 @@ AutoGIF =
|
|||||||
return unless OP.file?.isImage
|
return unless OP.file?.isImage
|
||||||
{URL} = OP.file
|
{URL} = OP.file
|
||||||
return unless /gif$/.test URL
|
return unless /gif$/.test URL
|
||||||
AutoGIF.replaceThumbnail @nodes.thumb, URL
|
AutoGIF.replaceThumbnail @nodes.thumb, URL, true
|
||||||
replaceThumbnail: (thumb, URL) ->
|
replaceThumbnail: (thumb, URL, isCatalog) ->
|
||||||
gif = $.el 'img'
|
gif = $.el 'img'
|
||||||
$.on gif, 'load', ->
|
$.on gif, 'load', ->
|
||||||
# Replace the thumbnail once the GIF has finished loading.
|
# Replace the thumbnail once the GIF has finished loading.
|
||||||
thumb.src = URL
|
if isCatalog
|
||||||
|
thumb.style.backgroundImage = "url(#{URL})"
|
||||||
|
else
|
||||||
|
thumb.src = URL
|
||||||
gif.src = URL
|
gif.src = URL
|
||||||
|
|
||||||
|
|||||||
@ -16,7 +16,7 @@ ImageHover =
|
|||||||
$.on @nodes.thumb, 'mouseover', ImageHover.mouseover
|
$.on @nodes.thumb, 'mouseover', ImageHover.mouseover
|
||||||
mouseover: (e) ->
|
mouseover: (e) ->
|
||||||
post = if $.hasClass @, 'thumb'
|
post = if $.hasClass @, 'thumb'
|
||||||
g.posts[@parentNode.parentNode.dataset.fullID]
|
g.posts[@parentNode.dataset.fullID]
|
||||||
else
|
else
|
||||||
Get.postFromNode @
|
Get.postFromNode @
|
||||||
el = $.el 'img',
|
el = $.el 'img',
|
||||||
|
|||||||
@ -13,7 +13,7 @@ Menu =
|
|||||||
name: 'Menu'
|
name: 'Menu'
|
||||||
cb: @node
|
cb: @node
|
||||||
CatalogThread.callbacks.push
|
CatalogThread.callbacks.push
|
||||||
name: 'Image Hover'
|
name: 'Menu'
|
||||||
cb: @catalogNode
|
cb: @catalogNode
|
||||||
|
|
||||||
node: ->
|
node: ->
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user