From 2024e0c50d943f5ceb5771d4924910dd3731f85b Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sat, 25 Jan 2014 19:00:26 +0100 Subject: [PATCH] Add sticky/closed status icons in the catalog. --- css/style.css | 23 +++++++++++++++++++++++ html/General/Thread-catalog-view.html | 3 ++- src/General/Build.coffee | 26 ++++++++++++++++++++------ 3 files changed, 45 insertions(+), 7 deletions(-) diff --git a/css/style.css b/css/style.css index 8d23bde6c..18a7a1e32 100644 --- a/css/style.css +++ b/css/style.css @@ -413,11 +413,34 @@ a[href="javascript:;"] { overflow: hidden; word-break: break-word; } +.catalog-thread > a { + display: inline-block; + position: relative; +} .thumb { max-width: 150px; max-height: 150px; box-shadow: 0 0 5px rgba(0, 0, 0, .25); } +.thunb.spoiler-file { + width: 100px; + height: 100px; +} +.thumb.deleted-file { + width: 127px; + height: 13px; + padding: 20px 11px; +} +.thumb.no-file { + width: 77px; + height: 13px; + padding: 20px 36px; +} +.thread-icons { + position: absolute; + top: 1px; + right: 1px; +} .thread-stats { cursor: help; font-size: 10px; diff --git a/html/General/Thread-catalog-view.html b/html/General/Thread-catalog-view.html index 9592c56a0..cf87775c9 100644 --- a/html/General/Thread-catalog-view.html +++ b/html/General/Thread-catalog-view.html @@ -1,5 +1,6 @@ - + +
#{postCount} / #{fileCount} / #{pageCount} diff --git a/src/General/Build.coffee b/src/General/Build.coffee index ad1c14558..def630799 100644 --- a/src/General/Build.coffee +++ b/src/General/Build.coffee @@ -260,25 +260,28 @@ Build = $.add root, nodes root threadCatalog: (thread) -> + {staticPath, gifIcon} = Build for data in Index.liveThreadData break if data.no is thread.ID if data.spoiler and !Conf['Reveal Spoilers'] - src = "#{Build.staticPath}spoiler" + src = "#{staticPath}spoiler" if spoilerRange = Build.spoilerRange[thread.board] # Randomize the spoiler image. src += "-#{thread.board}" + Math.floor 1 + spoilerRange * Math.random() src += '.png' - imgWidth = imgHeight = 100 + imgClass = 'spoiler-file' else if data.filedeleted - src = "#{Build.staticPath}filedeleted-res#{Build.gifIcon}" - imgWidth = 127 - imgHeight = 13 - else + 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 fileCount = data.images + !!data.ext @@ -294,6 +297,17 @@ Build = className: 'catalog-thread' innerHTML: <%= importHTML('General/Thread-catalog-view') %> + if thread.isSticky + $.add $('.thread-icons', root), $.el 'img', + src: "#{staticPath}sticky#{gifIcon}" + className: 'stickyIcon' + title: 'Sticky' + if thread.isClosed + $.add $('.thread-icons', root), $.el 'img', + src: "#{staticPath}closed#{gifIcon}" + className: 'closedIcon' + title: 'Closed' + if data.bumplimit $.addClass $('.post-count', root), 'warning' if data.imagelimit