diff --git a/src/General/Build/CatalogThread.html b/src/General/Build/CatalogThread.html index 2b8cf05c7..b058c4b14 100644 --- a/src/General/Build/CatalogThread.html +++ b/src/General/Build/CatalogThread.html @@ -8,4 +8,3 @@ ?{thread.OP.info.subject}{
${thread.OP.info.subject}
} -
&{comment}
diff --git a/src/General/Get.coffee b/src/General/Get.coffee index dceb0b36a..d28ec2cdf 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")][1]|following::div[contains(@class,"postContainer")][1])', root + Get.postFromRoot $.x '(ancestor::div[contains(@class,"postContainer") or contains(@class,"catalog-thread")][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 09e500193..71184a8c1 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -702,6 +702,8 @@ Index = if Conf['Index Mode'] is 'catalog' nodes = Index.buildCatalogViews() Index.sizeCatalogViews nodes + Index.moveComments threads + if Conf['Index Mode'] is 'catalog' $.add Index.root, nodes if doc.contains Index.root $.event 'PostsInserted' @@ -715,6 +717,16 @@ Index = offset = nodesPerPage * (pageNum - 1) Index.sortedThreads[offset ... offset + nodesPerPage] + moveComments: (threads) -> + isCatalog = (Conf['Index Mode'] is 'catalog') + for thread in threads + node = if isCatalog then thread.catalogView.nodes.root else thread.OP.nodes.post + {comment} = thread.OP.nodes + unless node.contains comment + comment.className = if isCatalog then 'comment' else 'postMessage' + $.add node, comment + return + buildStructure: (threads) -> for thread in threads if (file = thread.OP.file) and (thumb = thread.OP.file.thumb) and thumb.dataset.src diff --git a/src/Linkification/Embedding.coffee b/src/Linkification/Embedding.coffee index 295a882d4..c996a7c7b 100644 --- a/src/Linkification/Embedding.coffee +++ b/src/Linkification/Embedding.coffee @@ -4,7 +4,7 @@ Embedding = @types = {} @types[type.key] = type for type in @ordered_types - if Conf['Floating Embeds'] + if Conf['Embedding'] @dialog = UI.dialog 'embedding', 'top: 50px; right: 0px;', <%= readHTML('Embed.html') %> @media = $ '#media-embed', @dialog @@ -21,7 +21,7 @@ Embedding = i = 0 items = $$ '.embedder', post.nodes.comment while el = items[i++] - $.on el, 'click', Embedding.cb.toggle + $.on el, 'click', Embedding.cb.click Embedding.cb.toggle.call el if $.hasClass el, 'embedded' return @@ -49,16 +49,20 @@ Embedding = embed = $.el 'a', className: 'embedder' href: 'javascript:;' - textContent: '(embed)' + , + <%= html('(unembed)') %> embed.dataset[name] = value for name, value of {key, uid, options, href} - $.on embed, 'click', Embedding.cb.toggle + $.on embed, 'click', Embedding.cb.click $.after link, [$.tn(' '), embed] if Conf['Auto-embed'] and !Conf['Floating Embeds'] and !post.isFetchedQuote - $.asap (-> doc.contains embed), -> - Embedding.cb.toggle.call embed + autoEmbed = -> + if doc.contains(embed) and not $.hasClass(doc, 'catalog-mode') + $.off d, 'PostsInserted', autoEmbed + Embedding.cb.toggle.call embed + $.on d, 'PostsInserted', autoEmbed ready: -> $.addClass Embedding.dialog, 'empty' @@ -110,25 +114,26 @@ Embedding = return cb: - toggle: (e) -> - e?.preventDefault() - if Conf['Floating Embeds'] + click: (e) -> + e.preventDefault() + if Conf['Floating Embeds'] or $.hasClass(doc, 'catalog-mode') return unless div = Embedding.media.firstChild $.replace div, Embedding.cb.embed @ Embedding.lastEmbed = Get.postFromNode(@).nodes.root $.rmClass Embedding.dialog, 'empty' - return + else + Embedding.cb.toggle.call @ + + toggle: -> if $.hasClass @, "embedded" $.rm @nextElementSibling - @textContent = '(embed)' else $.after @, Embedding.cb.embed @ - @textContent = '(unembed)' $.toggleClass @, 'embedded' embed: (a) -> # We create an element to embed - container = $.el 'div' + container = $.el 'div', {className: 'media-embed'} $.add container, el = (type = Embedding.types[a.dataset.key]).el a # Set style values. diff --git a/src/Linkification/Linkify.coffee b/src/Linkification/Linkify.coffee index a97390a4b..12bd0c1e6 100644 --- a/src/Linkification/Linkify.coffee +++ b/src/Linkification/Linkify.coffee @@ -9,10 +9,6 @@ Linkify = name: 'Linkify' cb: @node - Callbacks.CatalogThread.push - name: 'Linkify' - cb: @catalogNode - Embedding.init() node: -> @@ -25,10 +21,6 @@ Linkify = Embedding.process link, @ for link in links return - catalogNode: -> - return unless Linkify.regString.test @thread.OP.info.comment - Linkify.process @nodes.comment - process: (node) -> test = /[^\s"]+/g space = /[\s"]/ diff --git a/src/Miscellaneous/AntiAutoplay.coffee b/src/Miscellaneous/AntiAutoplay.coffee index a8354e0e3..3cdba9c34 100644 --- a/src/Miscellaneous/AntiAutoplay.coffee +++ b/src/Miscellaneous/AntiAutoplay.coffee @@ -7,9 +7,6 @@ AntiAutoplay = Callbacks.Post.push name: 'Disable Autoplaying Sounds' cb: @node - Callbacks.CatalogThread.push - name: 'Disable Autoplaying Sounds' - cb: @node $.ready => @process d.body stop: (audio) -> @@ -21,7 +18,7 @@ AntiAutoplay = $.addClass audio, 'controls-added' node: -> - AntiAutoplay.process @nodes.root + AntiAutoplay.process @nodes.comment process: (root) -> for iframe in $$ 'iframe[src*="youtube"][src*="autoplay=1"]', root diff --git a/src/Miscellaneous/CatalogLinks.coffee b/src/Miscellaneous/CatalogLinks.coffee index 72155a6a0..a3db30253 100644 --- a/src/Miscellaneous/CatalogLinks.coffee +++ b/src/Miscellaneous/CatalogLinks.coffee @@ -24,9 +24,6 @@ CatalogLinks = Callbacks.Post.push name: 'Catalog Link Rewrite' cb: @node - Callbacks.CatalogThread.push - name: 'Catalog Link Rewrite' - cb: @node if Conf['Catalog Links'] CatalogLinks.el = el = UI.checkbox 'Header catalog links', 'Catalog Links' diff --git a/src/Miscellaneous/Fourchan.coffee b/src/Miscellaneous/Fourchan.coffee index 9629e3a74..4557b8a56 100644 --- a/src/Miscellaneous/Fourchan.coffee +++ b/src/Miscellaneous/Fourchan.coffee @@ -42,9 +42,6 @@ Fourchan = Callbacks.Post.push name: 'Parse /sci/ math' cb: @math - Callbacks.CatalogThread.push - name: 'Parse /sci/ math' - cb: @math # Disable 4chan's ID highlighting (replaced by IDHighlight) and reported post hiding. Main.ready -> diff --git a/src/Miscellaneous/RemoveSpoilers.coffee b/src/Miscellaneous/RemoveSpoilers.coffee index 47ee75a8d..45db77999 100644 --- a/src/Miscellaneous/RemoveSpoilers.coffee +++ b/src/Miscellaneous/RemoveSpoilers.coffee @@ -9,10 +9,6 @@ RemoveSpoilers = name: 'Reveal Spoilers' cb: @node - Callbacks.CatalogThread.push - name: 'Reveal Spoilers' - cb: @node - if g.VIEW is 'archive' $.ready -> RemoveSpoilers.unspoiler $.id 'arc-list' diff --git a/src/Quotelinks/QuoteInline.coffee b/src/Quotelinks/QuoteInline.coffee index d165b6759..f9c44aa9a 100644 --- a/src/Quotelinks/QuoteInline.coffee +++ b/src/Quotelinks/QuoteInline.coffee @@ -34,6 +34,7 @@ QuoteInline = {boardID, threadID, postID} = Get.postDataFromLink @ return if Conf['Inline Cross-thread Quotes Only'] and g.VIEW is 'thread' and g.posts["#{boardID}.#{postID}"]?.nodes.root.offsetParent # exists and not hidden + return if $.hasClass(doc, 'catalog-mode') e.preventDefault() quoter = Get.postFromNode @ diff --git a/src/classes/CatalogThread.coffee b/src/classes/CatalogThread.coffee index 041692a67..cabe9e057 100644 --- a/src/classes/CatalogThread.coffee +++ b/src/classes/CatalogThread.coffee @@ -11,5 +11,4 @@ class CatalogThread postCount: $ '.post-count', root fileCount: $ '.file-count', root pageCount: $ '.page-count', root - comment: $ '.comment', root @thread.catalogView = @ diff --git a/src/css/style.css b/src/css/style.css index 128eaa757..610ac1754 100644 --- a/src/css/style.css +++ b/src/css/style.css @@ -785,6 +785,7 @@ div[data-checked="false"] > .suboption-list { align-self: stretch; overflow: hidden; text-align: center; + margin: 0; } /* /tg/ dice rolls */ .board_tg .catalog-thread > .comment > b { @@ -980,7 +981,7 @@ span.hide-announcement { .quotelink.deadlink:not(.forwardlink) { text-decoration: underline !important; } -.inlined { +:root:not(.catalog-mode) .inlined { opacity: .5; } #qp input, .forwarded { @@ -1006,6 +1007,9 @@ span.hide-announcement { display: table; margin: 2px 0; } +:root.catalog-mode .inline { + display: none; +} .inline .post { border: 0 !important; background-color: transparent !important; @@ -1845,6 +1849,11 @@ a:only-of-type > .remove { } /* Embedding */ +.embedder:not(.embedded) > span, +:root.catalog-mode .embedder > span, +:root.catalog-mode .board .media-embed { + display: none; +} #embedding { padding: 1px 4px 1px 4px; position: fixed;