diff --git a/src/General/Build.coffee b/src/General/Build.coffee index 1a1bd7a8e..2ebfb1224 100644 --- a/src/General/Build.coffee +++ b/src/General/Build.coffee @@ -165,6 +165,7 @@ Build = thread: (thread, data) -> if (root = thread.nodes.root) $.rmAll root + delete thread.nodes.placeholder else thread.nodes.root = root = $.el 'div', className: 'thread' @@ -203,12 +204,11 @@ Build = postCount = data.replies + 1 fileCount = data.images + !!data.ext + container = $.el 'div', <%= readHTML('CatalogThread.html') %> + $.before thread.OP.nodes.info, [container.childNodes...] + root = $.el 'div', - className: 'catalog-thread post' # post added to make 4chan postInfo CSS work - - $.extend root, <%= readHTML('CatalogThread.html') %> - - root.dataset.fullID = thread.fullID + className: 'thread catalog-thread' $.addClass root, thread.OP.highlights... if thread.OP.highlights $.addClass root, 'noFile' unless thread.OP.file diff --git a/src/General/Get.coffee b/src/General/Get.coffee index d28ec2cdf..dceb0b36a 100644 --- a/src/General/Get.coffee +++ b/src/General/Get.coffee @@ -18,7 +18,7 @@ Get = index = root.dataset.clone if index then post.clones[index] else post postFromNode: (root) -> - Get.postFromRoot $.x '(ancestor::div[contains(@class,"postContainer") or contains(@class,"catalog-thread")][1]|following::div[contains(@class,"postContainer")][1])', root + Get.postFromRoot $.x '(ancestor::div[contains(@class,"postContainer")][1]|following::div[contains(@class,"postContainer")][1])', root postDataFromLink: (link) -> if link.hostname is 'boards.4chan.org' path = link.pathname.split /\/+/ diff --git a/src/General/Index.coffee b/src/General/Index.coffee index e2813fa39..730ba4783 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -713,7 +713,9 @@ Index = Index.buildReplies threads if Conf['Show Replies'] nodes = [] for thread in threads - thread.OP.setCatalogOP false + if thread.nodes.placeholder + $.replace thread.nodes.placeholder, thread.OP.nodes.root + delete thread.nodes.placeholder if (file = thread.OP.file) and (thumb = thread.OP.file.thumb) and thumb.dataset.src thumb.src = thumb.dataset.src # XXX https://bugzilla.mozilla.org/show_bug.cgi?id=1021289 @@ -729,7 +731,10 @@ Index = Index.sizeCatalogViews threads nodes = [] for thread in threads - thread.OP.setCatalogOP true + unless thread.nodes.placeholder + thread.nodes.placeholder = $.el 'div' + $.replace thread.OP.nodes.root, thread.nodes.placeholder + $.add thread.catalogView.nodes.root, thread.OP.nodes.root nodes.push thread.catalogView.nodes.root $.add Index.root, nodes if doc.contains Index.root diff --git a/src/Miscellaneous/Nav.coffee b/src/Miscellaneous/Nav.coffee index d5a552940..6b9de63c5 100644 --- a/src/Miscellaneous/Nav.coffee +++ b/src/Miscellaneous/Nav.coffee @@ -39,6 +39,7 @@ Nav = Nav.scroll +1 getThread: -> + return $ '.board' if $.hasClass doc, 'catalog-mode' for threadRoot in $$ '.thread' thread = Get.threadFromRoot threadRoot continue if thread.isHidden and !thread.stub diff --git a/src/classes/CatalogThread.coffee b/src/classes/CatalogThread.coffee index cabe9e057..5cbe79ab6 100644 --- a/src/classes/CatalogThread.coffee +++ b/src/classes/CatalogThread.coffee @@ -4,11 +4,12 @@ class CatalogThread constructor: (root, @thread) -> @ID = @thread.ID @board = @thread.board + {post} = @thread.OP.nodes @nodes = root: root - thumb: $ '.catalog-thumb', root - icons: $ '.catalog-icons', root - postCount: $ '.post-count', root - fileCount: $ '.file-count', root - pageCount: $ '.page-count', root + thumb: $ '.catalog-thumb', post + icons: $ '.catalog-icons', post + postCount: $ '.post-count', post + fileCount: $ '.file-count', post + pageCount: $ '.page-count', post @thread.catalogView = @ diff --git a/src/classes/Post.Clone.coffee b/src/classes/Post.Clone.coffee index 7ba89f1c7..b031d103d 100644 --- a/src/classes/Post.Clone.coffee +++ b/src/classes/Post.Clone.coffee @@ -7,14 +7,10 @@ Post.Clone = class extends Post @[key] = @origin[key] {nodes} = @origin - cloneNode = if contractThumb - @cloneWithoutVideo + root = if contractThumb + @cloneWithoutVideo nodes.root else - (node) -> node.cloneNode true - root = cloneNode nodes.root - if @origin.isCatalogOP - $.prepend $('.post', root), cloneNode(nodes.fileRoot) if nodes.fileRoot - $.add $('.post', root), [cloneNode(nodes.info), cloneNode(nodes.comment)] + nodes.root.cloneNode true Post.Clone.prefix or= 0 for node in [root, $$('[id]', root)...] node.id = Post.Clone.prefix + node.id @@ -32,6 +28,10 @@ Post.Clone = class extends Post $.rmClass root, 'forwarded' # quote inlining $.rmClass @nodes.post, 'highlight' # keybind navigation, ID highlighting + # Remove catalog stuff. + $.rm $('.catalog-link', @nodes.post) + $.rm $('.catalog-stats', @nodes.post) + @parseQuotes() @quotes = [@origin.quotes...] diff --git a/src/classes/Post.coffee b/src/classes/Post.coffee index ea7cb1dbd..fef518036 100644 --- a/src/classes/Post.coffee +++ b/src/classes/Post.coffee @@ -36,9 +36,8 @@ class Post @parseQuotes() @parseFile() - @isDead = false - @isHidden = false - @isCatalogOP = false + @isDead = false + @isHidden = false @clones = [] <% if (readJSON('/.tests_enabled')) { %> @@ -259,11 +258,3 @@ class Post for clone in @clones[index..] clone.nodes.root.dataset.clone = index++ return - - setCatalogOP: (isCatalogOP) -> - return if @isCatalogOP is isCatalogOP - @isCatalogOP = isCatalogOP - node = if isCatalogOP then @thread.catalogView.nodes.root else @nodes.post - {fileRoot, info, comment} = @nodes - $.prepend node, fileRoot if fileRoot - $.add node, [info, comment] diff --git a/src/classes/Thread.coffee b/src/classes/Thread.coffee index fb3efe440..6e3541fbd 100644 --- a/src/classes/Thread.coffee +++ b/src/classes/Thread.coffee @@ -19,6 +19,7 @@ class Thread @nodes = root: null + placeholder: null @board.threads.push @ID, @ g.threads.push @fullID, @ diff --git a/src/css/burichan.css b/src/css/burichan.css index dc314d559..25c74aa1e 100644 --- a/src/css/burichan.css +++ b/src/css/burichan.css @@ -31,10 +31,10 @@ } /* Catalog */ -:root.burichan .catalog-thread:hover > * { +:root.burichan .catalog-thread:hover .post { background-color: #D6DAF0; } -:root.burichan.werkTyme .catalog-thread:not(:hover), :root.burichan .catalog-thread:hover > * { +:root.burichan.werkTyme .catalog-thread:not(:hover), :root.burichan .catalog-thread:hover .post { border-color: #B7C5D9; } diff --git a/src/css/futaba.css b/src/css/futaba.css index 7ef0e2e6a..afc6efcdc 100644 --- a/src/css/futaba.css +++ b/src/css/futaba.css @@ -31,10 +31,10 @@ } /* Catalog */ -:root.futaba .catalog-thread:hover > * { +:root.futaba .catalog-thread:hover .post { background-color: #F0E0D6; } -:root.futaba.werkTyme .catalog-thread:not(:hover), :root.futaba .catalog-thread:hover > * { +:root.futaba.werkTyme .catalog-thread:not(:hover), :root.futaba .catalog-thread:hover .post { border-color: #D9BFB7; } diff --git a/src/css/photon.css b/src/css/photon.css index 8cf5da4a4..518dd65d8 100644 --- a/src/css/photon.css +++ b/src/css/photon.css @@ -31,10 +31,10 @@ } /* Catalog */ -:root.photon .catalog-thread:hover > * { +:root.photon .catalog-thread:hover .post { background-color: #DDD; } -:root.photon.werkTyme .catalog-thread:not(:hover), :root.photon .catalog-thread:hover > * { +:root.photon.werkTyme .catalog-thread:not(:hover), :root.photon .catalog-thread:hover .post { border-color: #CCC; } :root.photon .catalog-code { diff --git a/src/css/style.css b/src/css/style.css index 266d776a1..f8e5f74bf 100644 --- a/src/css/style.css +++ b/src/css/style.css @@ -718,39 +718,31 @@ div[data-checked="false"] > .suboption-list { word-wrap: break-word; vertical-align: top; position: relative; - overflow: hidden; } div.catalog-thread { margin: 4px; } -.catalog-thread > * { - margin: 0 -1px; - border-left: 1px solid transparent; - border-right: 1px solid transparent; +.catalog-thread > .postContainer { + overflow: hidden; } -.catalog-thread > :first-child { - margin-top: -21px; - border-top: 1px solid transparent; +.catalog-small .catalog-thread, +.catalog-small .catalog-thread > .postContainer { + width: 165px; + height: 320px; } -.catalog-thread.noFile > :first-child { - padding-top: 20px; +.catalog-large .catalog-thread, +.catalog-large .catalog-thread > .postContainer { + width: 270px; + height: 410px; } -.catalog-thread > :last-child { - margin-bottom: -1px; - border-bottom: 1px solid transparent; +.catalog-thread .post { + margin: -1px; + border: 1px solid transparent; } .catalog-link { display: block; position: relative; } -.catalog-small .catalog-thread { - width: 165px; - height: 320px; -} -.catalog-large .catalog-thread { - width: 270px; - height: 410px; -} .catalog-thumb { border-radius: 2px; box-shadow: 0 0 5px rgba(0, 0, 0, .25); @@ -791,12 +783,18 @@ div.catalog-thread { .catalog-stats > [title] { cursor: help; } -#delform .catalog-thread:not(:hover) > .file, -#delform .catalog-thread:not(:hover) > .postInfo, -#delform .catalog-thread > .file > :not(.fileText), -#delform .catalog-thread > .file > .fileText > :not(:first-child), -#delform .catalog-thread > .postInfo > :not(.nameBlock):not(.dateTime), -#delform .catalog-thread .posteruid { +.catalog-thread blockquote { + margin: 0; +} +#delform .catalog-thread:not(:hover) .file, +#delform .catalog-thread:not(:hover) .postInfo, +#delform .catalog-thread > .postContainer > :not(.post), +#delform .catalog-thread .file > :not(.fileText), +#delform .catalog-thread .file > .fileText > :not(:first-child), +#delform .catalog-thread .postInfo > :not(.nameBlock):not(.dateTime), +#delform .catalog-thread .posteruid, +.thread:not(.catalog-thread) .catalog-link, +.thread:not(.catalog-thread) .catalog-stats { display: none; } .catalog-thread .fileText { @@ -805,7 +803,7 @@ div.catalog-thread { line-height: 1; padding: 2px; } -#delform .catalog-thread > .postInfo { +#delform .catalog-thread .postInfo { width: auto; } .catalog-thread .subject { @@ -816,12 +814,16 @@ div.catalog-thread { font-style: italic; } .catalog-thread:hover { - overflow: visible; z-index: 1; } -.catalog-thread:hover > * { - margin-left: -61px; - margin-right: -61px; +.catalog-thread:hover > .postContainer { + overflow: visible; +} +.catalog-thread:hover .post { + margin: -21px -61px -1px; +} +.catalog-thread.noFile:hover .post { + margin-top: -1px; } .catalog-thread .prettyprinted { max-width: 100%; diff --git a/src/css/tomorrow.css b/src/css/tomorrow.css index c65aea641..8f23c7562 100644 --- a/src/css/tomorrow.css +++ b/src/css/tomorrow.css @@ -30,10 +30,10 @@ } /* Catalog */ -:root.tomorrow .catalog-thread:hover > * { +:root.tomorrow .catalog-thread:hover .post { background-color: #282A2E; } -:root.tomorrow.werkTyme .catalog-thread:not(:hover), :root.tomorrow .catalog-thread:hover > * { +:root.tomorrow.werkTyme .catalog-thread:not(:hover), :root.tomorrow .catalog-thread:hover .post { border-color: #111; } :root.tomorrow .catalog-code { diff --git a/src/css/yotsuba-b.css b/src/css/yotsuba-b.css index 54e8b61ce..69ee75534 100644 --- a/src/css/yotsuba-b.css +++ b/src/css/yotsuba-b.css @@ -31,10 +31,10 @@ } /* Catalog */ -:root.yotsuba-b .catalog-thread:hover > * { +:root.yotsuba-b .catalog-thread:hover .post { background-color: #D6DAF0; } -:root.yotsuba-b.werkTyme .catalog-thread:not(:hover), :root.yotsuba-b .catalog-thread:hover > * { +:root.yotsuba-b.werkTyme .catalog-thread:not(:hover), :root.yotsuba-b .catalog-thread:hover .post { border-color: #B7C5D9; } diff --git a/src/css/yotsuba.css b/src/css/yotsuba.css index f56e324d9..e0f984c4d 100644 --- a/src/css/yotsuba.css +++ b/src/css/yotsuba.css @@ -31,10 +31,10 @@ } /* Catalog */ -:root.yotsuba .catalog-thread:hover > * { +:root.yotsuba .catalog-thread:hover .post { background-color: #F0E0D6; } -:root.yotsuba.werkTyme .catalog-thread:not(:hover), :root.yotsuba .catalog-thread:hover > * { +:root.yotsuba.werkTyme .catalog-thread:not(:hover), :root.yotsuba .catalog-thread:hover .post { border-color: #D9BFB7; }