From 987d59bb24b4086ccbab491cfbac31f7774e076c Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sat, 25 Jan 2014 17:01:06 +0100 Subject: [PATCH 01/74] Initial index catalog mode work. Conflicts: css/style.css src/General/Build.coffee src/General/Index.coffee --- src/General/Build.coffee | 55 ++++++++++++++++++++++++++++++++++-- src/General/Index.coffee | 26 +++++++++++++---- src/General/css/style.css | 31 ++++++++++++++++++++ src/General/lib/thread.class | 4 +++ 4 files changed, 108 insertions(+), 8 deletions(-) diff --git a/src/General/Build.coffee b/src/General/Build.coffee index 8752adf87..c646250d6 100755 --- a/src/General/Build.coffee +++ b/src/General/Build.coffee @@ -1,4 +1,6 @@ Build = + staticPath: '//s.4cdn.org/image/' + gifIcon: if window.devicePixelRatio >= 2 then '@2x.gif' else '.gif' initPixelRatio: window.devicePixelRatio spoilerRange: {} unescape: (text) -> @@ -303,9 +305,58 @@ Build = [posts, files] = if Conf['Show Replies'] [data.omitted_posts, data.omitted_images] else - # XXX data.images is not accurate. - [data.replies, data.omitted_images + data.last_replies.filter((data) -> !!data.ext).length] + [data.replies, data.images] nodes.push Build.summary board.ID, data.no, posts, files nodes fullThread: (board, data) -> Build.postFromObject data, board.ID + + threadCatalog: (thread) -> + for data in Index.liveThreadData + break if data.no is thread.ID + + if data.spoiler and !Conf['Reveal Spoiler Thumbnails'] + src = "#{Build.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 + else if data.filedeleted + src = "#{Build.staticPath}filedeleted-res#{Build.gifIcon}" + imgWidth = 127 + imgHeight = 13 + else + 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 + + postCount = data.replies + 1 + fileCount = data.images + !!data.ext + pageCount = Index.liveThreadIDs.indexOf(thread.ID) // Index.threadsNumPerPage + 1 + + subject = if thread.OP.info.subject + <%= html('
${thread.OP.info.subject}
') %> + else + <%= html('') %> + + root = $.el 'div', + className: 'catalog-thread' + $.extend root, <%= html( + '' + + '' + + '' + + '
' + + '${postCount} / ${fileCount} / ${pageCount}' + + '
' + + '&{subject}' + + '
&{thread.OP.nodes.comment}
' + ) %> + + if data.bumplimit + $.addClass $('.post-count', root), 'warning' + if data.imagelimit + $.addClass $('.file-count', root), 'warning' + + root diff --git a/src/General/Index.coffee b/src/General/Index.coffee index a4890b7df..94387d9d4 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -18,6 +18,7 @@ Index = { el: $.el 'label', <%= html(' Paged') %> } { el: $.el 'label', <%= html(' Infinite scrolling') %> } { el: $.el 'label', <%= html(' All threads') %> } + { el: $.el 'label', <%= html(' Catalog') %> } ] for label in modeEntry.subEntries input = label.el.firstChild @@ -63,6 +64,7 @@ Index = $.addClass doc, 'index-loading' @root = $.el 'div', className: 'board' + Index.cb.rootClass() @pagelist = $.el 'div', className: 'pagelist' hidden: true @@ -130,7 +132,10 @@ Index = setTimeout reset, 3 * $.SECOND cb: + rootClass: -> + (if Conf['Index Mode'] is 'catalog' then $.addClass else $.rmClass) Index.root, 'catalog-mode' mode: -> + Index.cb.rootClass() Index.togglePagelist() Index.buildIndex() sort: -> @@ -410,14 +415,23 @@ Index = Index.sortedNodes = topNodes.concat(bottomNodes) buildIndex: -> - if Conf['Index Mode'] isnt 'all pages' - nodes = Index.buildSinglePage Index.getCurrentPage() - else - nodes = Index.sortedNodes + switch Conf['Index Mode'] + when 'all pages' + nodes = Index.sortedNodes + when 'catalog' + nodes = Index.sortedNodes + .map((threadRoot) -> Get.threadFromRoot threadRoot) + .filter((thread) -> !thread.isHidden) + .map (thread) -> thread.getCatalogView() + else + nodes = Index.buildSinglePage Index.getCurrentPage() $.rmAll Index.root $.rmAll Header.hover - Index.buildReplies nodes if Conf['Show Replies'] - Index.buildStructure nodes + if Conf['Index Mode'] is 'catalog' + $.add Index.root, nodes + else + Index.buildReplies nodes if Conf['Show Replies'] + Index.buildStructure nodes buildSinglePage: (pageNum) -> nodesPerPage = Index.threadsNumPerPage diff --git a/src/General/css/style.css b/src/General/css/style.css index 187052c6e..120967692 100755 --- a/src/General/css/style.css +++ b/src/General/css/style.css @@ -497,6 +497,37 @@ hr ~ div.center:not(.ad-cnt) { .summary { text-decoration: none; } +.catalog-mode { + text-align: center; +} +.catalog-thread { + display: inline-block; + vertical-align: top; + padding-top: 5px; + width: 165px; + max-height: 320px; + overflow: hidden; + word-break: break-word; +} +.thumb { + max-width: 150px; + max-height: 150px; + box-shadow: 0 0 5px rgba(0, 0, 0, .25); +} +.thread-stats { + cursor: help; + font-size: 10px; + font-weight: 700; + line-height: .8; + margin-top: 1px; + float: none; +} +.catalog-thread .subject { + font-weight: 700; +} +.catalog-thread .comment br + br { + display: none; +} /* Announcement Hiding */ :root.hide-announcement #globalMessage { diff --git a/src/General/lib/thread.class b/src/General/lib/thread.class index ea17b1e1e..aa2dd000a 100755 --- a/src/General/lib/thread.class +++ b/src/General/lib/thread.class @@ -39,6 +39,10 @@ class Thread $ '[title="Reply to this post"]', @OP.nodes.info $.after root, [$.tn(' '), icon] + getCatalogView: -> + return @catalogView if @catalogView + @catalogView = Build.threadCatalog @ + kill: -> @isDead = true @timeOfDeath = Date.now() From 148b8f4c39850537414b45d6e614a243065761cf Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sun, 26 Jan 2014 17:20:29 +0100 Subject: [PATCH 02/74] Update thread post/file count on index refresh in the catalog. Conflicts: src/General/Index.coffee src/General/lib/thread.class --- src/General/Index.coffee | 2 ++ src/General/lib/thread.class | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/src/General/Index.coffee b/src/General/Index.coffee index 94387d9d4..9de94365c 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -323,6 +323,8 @@ Index = threadRoot = Build.thread g.BOARD, threadData if thread = g.BOARD.threads[threadData.no] thread.setPage Math.floor i / Index.threadsNumPerPage + thread.setCount 'post', threadData.replies + 1, threadData.bumplimit + thread.setCount 'file', threadData.images + !!threadData.ext, threadData.imagelimit thread.setStatus 'Sticky', !!threadData.sticky thread.setStatus 'Closed', !!threadData.closed else diff --git a/src/General/lib/thread.class b/src/General/lib/thread.class index aa2dd000a..267fde338 100755 --- a/src/General/lib/thread.class +++ b/src/General/lib/thread.class @@ -17,6 +17,13 @@ class Thread for key in ['title', 'textContent'] icon[key] = icon[key].replace /\d+/, pageNum return + + setCount: (type, count, reachedLimit) -> + return unless @catalogView + el = $ ".#{type}-count", @catalogView + el.textContent = count + (if reachedLimit then $.addClass else $.rmClass) el, 'warning' + setStatus: (type, status) -> name = "is#{type}" return if @[name] is status From 37d6b99627f160f276d6be33abf748a5b007df7b Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sat, 25 Jan 2014 19:00:26 +0100 Subject: [PATCH 03/74] Add sticky/closed status icons in the catalog. Conflicts: css/style.css html/General/Thread-catalog-view.html src/General/Build.coffee --- src/General/Build.coffee | 34 +++++++++++++++++++++++++++------- src/General/css/style.css | 23 +++++++++++++++++++++++ 2 files changed, 50 insertions(+), 7 deletions(-) diff --git a/src/General/Build.coffee b/src/General/Build.coffee index c646250d6..8720bd583 100755 --- a/src/General/Build.coffee +++ b/src/General/Build.coffee @@ -312,25 +312,33 @@ Build = fullThread: (board, data) -> Build.postFromObject data, board.ID threadCatalog: (thread) -> + {staticPath, gifIcon} = Build for data in Index.liveThreadData break if data.no is thread.ID if data.spoiler and !Conf['Reveal Spoiler Thumbnails'] - 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' + + thumb = if imgClass + <%= html('') %> + else + <%= html('') %> postCount = data.replies + 1 fileCount = data.images + !!data.ext @@ -345,7 +353,8 @@ Build = className: 'catalog-thread' $.extend root, <%= html( '' + - '' + + '&{thumb}' + + '
' + '
' + '
' + '${postCount} / ${fileCount} / ${pageCount}' + @@ -354,6 +363,17 @@ Build = '
&{thread.OP.nodes.comment}
' ) %> + 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 diff --git a/src/General/css/style.css b/src/General/css/style.css index 120967692..4bd92933f 100755 --- a/src/General/css/style.css +++ b/src/General/css/style.css @@ -509,11 +509,34 @@ hr ~ div.center:not(.ad-cnt) { 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; From 662a3660fed1ccfbeaf90a5fd88f99265fdc5ea2 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sun, 26 Jan 2014 17:02:55 +0100 Subject: [PATCH 04/74] Update page/sticky/closed status on index refresh for the catalog. Conflicts: src/General/lib/thread.class --- src/General/lib/thread.class | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/General/lib/thread.class b/src/General/lib/thread.class index 267fde338..1deb7c239 100755 --- a/src/General/lib/thread.class +++ b/src/General/lib/thread.class @@ -16,7 +16,7 @@ class Thread icon = $ '.page-num', @OP.nodes.post for key in ['title', 'textContent'] icon[key] = icon[key].replace /\d+/, pageNum - return + $('.page-count', @catalogView).textContent = pageNum if @catalogView setCount: (type, count, reachedLimit) -> return unless @catalogView @@ -32,20 +32,26 @@ class Thread typeLC = type.toLowerCase() unless status $.rm $ ".#{typeLC}Icon", @OP.nodes.info + $.rm $ ".#{typeLC}Icon", @catalogView if @catalogView return + icon = $.el 'img', - src: "//s.4cdn.org/image/#{typeLC}#{if window.devicePixelRatio >= 2 then '@2x' else ''}.gif" + src: "#{Build.staticPath}#{typeLC}#{Build.gifIcon}" alt: type title: type className: "#{typeLC}Icon" root = if type is 'Closed' and @isSticky $ '.stickyIcon', @OP.nodes.info else if g.VIEW is 'index' - $ '.page-num', @OP.nodes.info + $ '.page-num', @OP.nodes.info else $ '[title="Reply to this post"]', @OP.nodes.info $.after root, [$.tn(' '), icon] + return unless @catalogView + root = $ '.thread-icons', @catalogView + (if type is 'Sticky' and @isClosed then $.prepend else $.add) root, icon.cloneNode() + getCatalogView: -> return @catalogView if @catalogView @catalogView = Build.threadCatalog @ From 5a456f0cbe61c7a929f9e75ff886a1fa0a2da0ef Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sun, 26 Jan 2014 18:19:23 +0100 Subject: [PATCH 05/74] Add filter-highlight to threads on the catalog. Conflicts: css/style.css --- src/Filtering/Filter.coffee | 1 + src/General/Build.coffee | 2 ++ src/General/css/style.css | 4 ++++ 3 files changed, 7 insertions(+) diff --git a/src/Filtering/Filter.coffee b/src/Filtering/Filter.coffee index b33da2edb..ec6e0e9c1 100755 --- a/src/Filtering/Filter.coffee +++ b/src/Filtering/Filter.coffee @@ -113,6 +113,7 @@ Filter = # Highlight $.addClass @nodes.root, result.class + @thread.highlight = result.class if !@isReply and result.top @thread.isOnTop = true diff --git a/src/General/Build.coffee b/src/General/Build.coffee index 8720bd583..e6c4faf63 100755 --- a/src/General/Build.coffee +++ b/src/General/Build.coffee @@ -363,6 +363,8 @@ Build = '
&{thread.OP.nodes.comment}
' ) %> + $.addClass root, thread.highlight if thread.highlight + if thread.isSticky $.add $('.thread-icons', root), $.el 'img', src: "#{staticPath}sticky#{gifIcon}" diff --git a/src/General/css/style.css b/src/General/css/style.css index 4bd92933f..a74e37423 100755 --- a/src/General/css/style.css +++ b/src/General/css/style.css @@ -516,6 +516,7 @@ hr ~ div.center:not(.ad-cnt) { .thumb { max-width: 150px; max-height: 150px; + border-radius: 2px; box-shadow: 0 0 5px rgba(0, 0, 0, .25); } .thunb.spoiler-file { @@ -823,6 +824,9 @@ span.hide-announcement { .filter-highlight > .reply { box-shadow: -5px 0 rgba(255, 0, 0, .5); } +.filter-highlight .thumb { + border: 2px solid rgba(255, 0, 0, .5); +} /* Spoiler text */ :root.reveal-spoilers s { From ab42ad240968c4b85f2b61bd99d729d32b54a524 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Tue, 28 Jan 2014 09:59:49 +0100 Subject: [PATCH 06/74] Shift+click to hide threads in the catalog. Conflicts: src/Filtering/ThreadHiding.coffee --- src/Filtering/Filter.coffee | 3 ++- src/Filtering/ThreadHiding.coffee | 2 +- src/General/Build.coffee | 2 +- src/General/lib/thread.class | 11 +++++++++++ 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/Filtering/Filter.coffee b/src/Filtering/Filter.coffee index ec6e0e9c1..ca3551f36 100755 --- a/src/Filtering/Filter.coffee +++ b/src/Filtering/Filter.coffee @@ -113,7 +113,8 @@ Filter = # Highlight $.addClass @nodes.root, result.class - @thread.highlight = result.class + unless result.class in @highlights + (@highlights or= []).push result.class if !@isReply and result.top @thread.isOnTop = true diff --git a/src/Filtering/ThreadHiding.coffee b/src/Filtering/ThreadHiding.coffee index e0ed48f41..8eb7ad224 100755 --- a/src/Filtering/ThreadHiding.coffee +++ b/src/Filtering/ThreadHiding.coffee @@ -1,6 +1,6 @@ ThreadHiding = init: -> - return if g.VIEW isnt 'index' or !Conf['Thread Hiding Buttons'] and !Conf['Thread Hiding Link'] + return if g.VIEW isnt 'index' @db = new DataBoard 'hiddenThreads' @syncCatalog() diff --git a/src/General/Build.coffee b/src/General/Build.coffee index e6c4faf63..c74bf8dc2 100755 --- a/src/General/Build.coffee +++ b/src/General/Build.coffee @@ -363,7 +363,7 @@ Build = '
&{thread.OP.nodes.comment}
' ) %> - $.addClass root, thread.highlight if thread.highlight + $.addClass root, thread.OP.highlights... if thread.OP.highlights if thread.isSticky $.add $('.thread-icons', root), $.el 'img', diff --git a/src/General/lib/thread.class b/src/General/lib/thread.class index 1deb7c239..f351c5257 100755 --- a/src/General/lib/thread.class +++ b/src/General/lib/thread.class @@ -55,6 +55,17 @@ class Thread getCatalogView: -> return @catalogView if @catalogView @catalogView = Build.threadCatalog @ + $.on $('.thumb', @catalogView), 'click', @onCatalogViewClick + @catalogView + onCatalogViewClick: (e) => + return if e.button isnt 0 + if e.shiftKey + $.rm @catalogView + ThreadHiding.hide @ + ThreadHiding.saveHiddenState @ + else + return + e.preventDefault() kill: -> @isDead = true From c3e37a80774bad6f7e2fc954c12667fdf8204259 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Tue, 28 Jan 2014 10:26:46 +0100 Subject: [PATCH 07/74] Alt+click to pin threads in the catalog. Conflicts: css/style.css --- src/Filtering/Filter.coffee | 2 +- src/General/Build.coffee | 1 + src/General/Index.coffee | 23 +++++++++++++++++++++++ src/General/css/style.css | 1 + src/General/lib/databoard.class | 2 +- src/General/lib/thread.class | 8 ++++++++ 6 files changed, 35 insertions(+), 2 deletions(-) diff --git a/src/Filtering/Filter.coffee b/src/Filtering/Filter.coffee index ca3551f36..3ea85bd72 100755 --- a/src/Filtering/Filter.coffee +++ b/src/Filtering/Filter.coffee @@ -113,7 +113,7 @@ Filter = # Highlight $.addClass @nodes.root, result.class - unless result.class in @highlights + unless @highlights and result.class in @highlights (@highlights or= []).push result.class if !@isReply and result.top @thread.isOnTop = true diff --git a/src/General/Build.coffee b/src/General/Build.coffee index c74bf8dc2..2ae0788b2 100755 --- a/src/General/Build.coffee +++ b/src/General/Build.coffee @@ -363,6 +363,7 @@ Build = '
&{thread.OP.nodes.comment}
' ) %> + $.addClass root, 'pinned' if thread.isPinned $.addClass root, thread.OP.highlights... if thread.OP.highlights if thread.isSticky diff --git a/src/General/Index.coffee b/src/General/Index.coffee index 9de94365c..da390b367 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -4,6 +4,11 @@ Index = @board = "#{g.BOARD}" + @db = new DataBoard 'pinnedThreads' + Thread.callbacks.push + name: 'Thread Pinning' + cb: @node + @button = $.el 'a', className: 'index-refresh-shortcut fa fa-refresh' title: 'Refresh' @@ -131,6 +136,24 @@ Index = new Notice 'info', "Last page reached.", 2 setTimeout reset, 3 * $.SECOND + node: -> + return unless data = Index.db.get {boardID: @board.ID, threadID: @ID} + @pin() if data.isPinned + togglePin: (thread) -> + if thread.isPinned + thread.unpin() + Index.db.delete + boardID: thread.board.ID + threadID: thread.ID + else + thread.pin() + Index.db.set + boardID: thread.board.ID + threadID: thread.ID + val: isPinned: thread.isPinned + Index.sort() + Index.buildIndex() + cb: rootClass: -> (if Conf['Index Mode'] is 'catalog' then $.addClass else $.rmClass) Index.root, 'catalog-mode' diff --git a/src/General/css/style.css b/src/General/css/style.css index a74e37423..0de359872 100755 --- a/src/General/css/style.css +++ b/src/General/css/style.css @@ -824,6 +824,7 @@ span.hide-announcement { .filter-highlight > .reply { box-shadow: -5px 0 rgba(255, 0, 0, .5); } +.pinned .thumb, .filter-highlight .thumb { border: 2px solid rgba(255, 0, 0, .5); } diff --git a/src/General/lib/databoard.class b/src/General/lib/databoard.class index 5489e6867..3971006c3 100755 --- a/src/General/lib/databoard.class +++ b/src/General/lib/databoard.class @@ -1,5 +1,5 @@ class DataBoard - @keys = ['hiddenThreads', 'hiddenPosts', 'lastReadPosts', 'yourPosts', 'watchedThreads'] + @keys = ['pinnedThreads', 'hiddenThreads', 'hiddenPosts', 'lastReadPosts', 'yourPosts', 'watchedThreads'] constructor: (@key, sync, dontClean) -> @data = Conf[key] diff --git a/src/General/lib/thread.class b/src/General/lib/thread.class index f351c5257..b34a8fa6e 100755 --- a/src/General/lib/thread.class +++ b/src/General/lib/thread.class @@ -63,9 +63,17 @@ class Thread $.rm @catalogView ThreadHiding.hide @ ThreadHiding.saveHiddenState @ + else if e.altKey + Index.togglePin @ else return e.preventDefault() + pin: -> + @isOnTop = @isPinned = true + $.addClass @catalogView, 'pinned' if @catalogView + unpin: -> + @isOnTop = @isPinned = false + $.rmClass @catalogView, 'pinned' if @catalogView kill: -> @isDead = true From 12c2e7c0a2e697479f182d53491b4acca4840244 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Wed, 29 Jan 2014 14:31:38 +0100 Subject: [PATCH 08/74] Refactor the catalog thread views business with a class. Conflicts: Gruntfile.coffee src/General/Build.coffee src/General/Index.coffee src/General/lib/thread.class --- src/General/Build.coffee | 6 ++--- src/General/Index.coffee | 37 ++++++++++++++++++++++++----- src/General/lib/catalogthread.class | 14 +++++++++++ src/General/lib/classes.coffee | 3 ++- src/General/lib/thread.class | 28 ++++++---------------- 5 files changed, 57 insertions(+), 31 deletions(-) create mode 100644 src/General/lib/catalogthread.class diff --git a/src/General/Build.coffee b/src/General/Build.coffee index 2ae0788b2..d3a82f827 100755 --- a/src/General/Build.coffee +++ b/src/General/Build.coffee @@ -311,10 +311,9 @@ Build = fullThread: (board, data) -> Build.postFromObject data, board.ID - threadCatalog: (thread) -> + catalogThread: (thread) -> {staticPath, gifIcon} = Build - for data in Index.liveThreadData - break if data.no is thread.ID + data = Index.liveThreadData[Index.liveThreadIDs.indexOf thread.ID] if data.spoiler and !Conf['Reveal Spoiler Thumbnails'] src = "#{staticPath}spoiler" @@ -363,6 +362,7 @@ Build = '
&{thread.OP.nodes.comment}
' ) %> + root.dataset.fullID = thread.fullID $.addClass root, 'pinned' if thread.isPinned $.addClass root, thread.OP.highlights... if thread.OP.highlights diff --git a/src/General/Index.coffee b/src/General/Index.coffee index da390b367..9606a7791 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -7,7 +7,10 @@ Index = @db = new DataBoard 'pinnedThreads' Thread.callbacks.push name: 'Thread Pinning' - cb: @node + cb: @threadNode + CatalogThread.callbacks.push + name: 'Catalog Features' + cb: @catalogNode @button = $.el 'a', className: 'index-refresh-shortcut fa fa-refresh' @@ -136,9 +139,24 @@ Index = new Notice 'info', "Last page reached.", 2 setTimeout reset, 3 * $.SECOND - node: -> + threadNode: -> return unless data = Index.db.get {boardID: @board.ID, threadID: @ID} @pin() if data.isPinned + catalogNode: -> + $.on @nodes.thumb, 'click', Index.onClick + onClick: (e) -> + return if e.button isnt 0 + root = @parentNode.parentNode + thread = g.threads[root.dataset.fullID] + if e.shiftKey + $.rm root + ThreadHiding.hide thread + ThreadHiding.saveHiddenState thread + else if e.altKey + Index.togglePin thread + else + return + e.preventDefault() togglePin: (thread) -> if thread.isPinned thread.unpin() @@ -395,6 +413,16 @@ Index = Main.handleErrors errors if errors Main.callbackNodes Post, posts + buildCatalogViews: -> + threads = Index.sortedNodes + .map((threadRoot) -> Get.threadFromRoot threadRoot) + .filter (thread) -> !thread.isHidden + catalogThreads = [] + for thread in threads when !thread.catalogView + catalogThreads.push new CatalogThread Build.catalogThread(thread), thread + Main.callbackNodes CatalogThread, catalogThreads + threads.map (thread) -> thread.catalogView.nodes.root + sort: -> {liveThreadIDs, liveThreadData} = Index sortedThreadIDs = { @@ -444,10 +472,7 @@ Index = when 'all pages' nodes = Index.sortedNodes when 'catalog' - nodes = Index.sortedNodes - .map((threadRoot) -> Get.threadFromRoot threadRoot) - .filter((thread) -> !thread.isHidden) - .map (thread) -> thread.getCatalogView() + nodes = Index.buildCatalogViews() else nodes = Index.buildSinglePage Index.getCurrentPage() $.rmAll Index.root diff --git a/src/General/lib/catalogthread.class b/src/General/lib/catalogthread.class new file mode 100644 index 000000000..f656d2123 --- /dev/null +++ b/src/General/lib/catalogthread.class @@ -0,0 +1,14 @@ +class CatalogThread + @callbacks = new Callbacks 'CatalogThread' + toString: -> @ID + + constructor: (root, @thread) -> + @ID = @thread.ID + @board = @thread.board + @nodes = + root: root + thumb: $ '.thumb', root + postCount: $ '.post-count', root + fileCount: $ '.file-count', root + pageCount: $ '.page-count', root + @thread.catalogView = @ diff --git a/src/General/lib/classes.coffee b/src/General/lib/classes.coffee index eba1788af..3b0b36558 100755 --- a/src/General/lib/classes.coffee +++ b/src/General/lib/classes.coffee @@ -1,9 +1,10 @@ <%= grunt.file.read('src/General/lib/callbacks.class') %> <%= grunt.file.read('src/General/lib/board.class') %> <%= grunt.file.read('src/General/lib/thread.class') %> +<%= grunt.file.read('src/General/lib/catalogthread.class') %> <%= grunt.file.read('src/General/lib/post.class') %> <%= grunt.file.read('src/General/lib/clone.class') %> <%= grunt.file.read('src/General/lib/databoard.class') %> <%= grunt.file.read('src/General/lib/notice.class') %> <%= grunt.file.read('src/General/lib/randomaccesslist.class') %> -<%= grunt.file.read('src/General/lib/simpledict.class') %> \ No newline at end of file +<%= grunt.file.read('src/General/lib/simpledict.class') %> diff --git a/src/General/lib/thread.class b/src/General/lib/thread.class index b34a8fa6e..c81218e2d 100755 --- a/src/General/lib/thread.class +++ b/src/General/lib/thread.class @@ -10,17 +10,19 @@ class Thread @postLimit = false @fileLimit = false + @OP = null + @catalogView = null + g.threads.push @fullID, board.threads.push @, @ setPage: (pageNum) -> icon = $ '.page-num', @OP.nodes.post for key in ['title', 'textContent'] icon[key] = icon[key].replace /\d+/, pageNum - $('.page-count', @catalogView).textContent = pageNum if @catalogView - + @catalogView.nodes.pageCount.textContent = pageNum if @catalogView setCount: (type, count, reachedLimit) -> return unless @catalogView - el = $ ".#{type}-count", @catalogView + el = @catalogView.nodes["#{type}Count"] el.textContent = count (if reachedLimit then $.addClass else $.rmClass) el, 'warning' @@ -52,28 +54,12 @@ class Thread root = $ '.thread-icons', @catalogView (if type is 'Sticky' and @isClosed then $.prepend else $.add) root, icon.cloneNode() - getCatalogView: -> - return @catalogView if @catalogView - @catalogView = Build.threadCatalog @ - $.on $('.thumb', @catalogView), 'click', @onCatalogViewClick - @catalogView - onCatalogViewClick: (e) => - return if e.button isnt 0 - if e.shiftKey - $.rm @catalogView - ThreadHiding.hide @ - ThreadHiding.saveHiddenState @ - else if e.altKey - Index.togglePin @ - else - return - e.preventDefault() pin: -> @isOnTop = @isPinned = true - $.addClass @catalogView, 'pinned' if @catalogView + $.addClass @catalogView.nodes.root, 'pinned' if @catalogView unpin: -> @isOnTop = @isPinned = false - $.rmClass @catalogView, 'pinned' if @catalogView + $.rmClass @catalogView.nodes.root, 'pinned' if @catalogView kill: -> @isDead = true From 0bb93303e3c2ec4dc0d0810be172900fa1ae21d0 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Wed, 29 Jan 2014 14:48:52 +0100 Subject: [PATCH 09/74] Remove quotelinks in threads in the catalog. --- src/General/Build.coffee | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/General/Build.coffee b/src/General/Build.coffee index d3a82f827..dc7ffa58d 100755 --- a/src/General/Build.coffee +++ b/src/General/Build.coffee @@ -366,6 +366,9 @@ Build = $.addClass root, 'pinned' if thread.isPinned $.addClass root, thread.OP.highlights... if thread.OP.highlights + for quotelink in $$ '.quotelink', root.lastElementChild + $.replace quotelink, [quotelink.childNodes...] + if thread.isSticky $.add $('.thread-icons', root), $.el 'img', src: "#{staticPath}sticky#{gifIcon}" From faffa2d79297f0d59fc4a9784d5ba7b0ad6e6953 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Fri, 31 Jan 2014 17:35:28 +0100 Subject: [PATCH 10/74] Fix thread status updating for the catalog view. --- src/General/lib/catalogthread.class | 9 +++++---- src/General/lib/thread.class | 5 ++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/General/lib/catalogthread.class b/src/General/lib/catalogthread.class index f656d2123..2942a5eb6 100644 --- a/src/General/lib/catalogthread.class +++ b/src/General/lib/catalogthread.class @@ -7,8 +7,9 @@ class CatalogThread @board = @thread.board @nodes = root: root - thumb: $ '.thumb', root - postCount: $ '.post-count', root - fileCount: $ '.file-count', root - pageCount: $ '.page-count', root + thumb: $ '.thumb', root + icons: $ '.thread-icons', root + postCount: $ '.post-count', root + fileCount: $ '.file-count', root + pageCount: $ '.page-count', root @thread.catalogView = @ diff --git a/src/General/lib/thread.class b/src/General/lib/thread.class index c81218e2d..89cbe9bcd 100755 --- a/src/General/lib/thread.class +++ b/src/General/lib/thread.class @@ -34,7 +34,7 @@ class Thread typeLC = type.toLowerCase() unless status $.rm $ ".#{typeLC}Icon", @OP.nodes.info - $.rm $ ".#{typeLC}Icon", @catalogView if @catalogView + $.rm $ ".#{typeLC}Icon", @catalogView.nodes.icons if @catalogView return icon = $.el 'img', @@ -51,8 +51,7 @@ class Thread $.after root, [$.tn(' '), icon] return unless @catalogView - root = $ '.thread-icons', @catalogView - (if type is 'Sticky' and @isClosed then $.prepend else $.add) root, icon.cloneNode() + (if type is 'Sticky' and @isClosed then $.prepend else $.add) @catalogView.nodes.icons, icon.cloneNode() pin: -> @isOnTop = @isPinned = true From 84568431d82b7370f8e3ff1507f839e93d916440 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Fri, 5 Sep 2014 23:25:07 -0700 Subject: [PATCH 11/74] fix typo --- src/General/css/style.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/General/css/style.css b/src/General/css/style.css index 0de359872..6deda6559 100755 --- a/src/General/css/style.css +++ b/src/General/css/style.css @@ -519,7 +519,7 @@ hr ~ div.center:not(.ad-cnt) { border-radius: 2px; box-shadow: 0 0 5px rgba(0, 0, 0, .25); } -.thunb.spoiler-file { +.thumb.spoiler-file { width: 100px; height: 100px; } From 8a0becd7bf373e94fcca2a5bbac1bc5b18a9205e Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sun, 2 Feb 2014 22:38:53 +0100 Subject: [PATCH 12/74] Make the catalog flexbox-based. The new, identical layout allows us to add overflowing elements in threads. Previously, all overflowing content would be cut off. Now, only the comment can be cut off. --- src/General/css/style.css | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/General/css/style.css b/src/General/css/style.css index 6deda6559..6f5499a57 100755 --- a/src/General/css/style.css +++ b/src/General/css/style.css @@ -498,19 +498,21 @@ hr ~ div.center:not(.ad-cnt) { text-decoration: none; } .catalog-mode { - text-align: center; + display: flex; + flex-wrap: wrap; + justify-content: center; } .catalog-thread { - display: inline-block; - vertical-align: top; - padding-top: 5px; + display: flex; + flex-direction: column; + align-items: center; width: 165px; + margin-bottom: 5px; max-height: 320px; - overflow: hidden; word-break: break-word; } .catalog-thread > a { - display: inline-block; + flex-shrink: 0; position: relative; } .thumb { @@ -539,15 +541,23 @@ hr ~ div.center:not(.ad-cnt) { right: 1px; } .thread-stats { + flex-shrink: 0; cursor: help; font-size: 10px; font-weight: 700; line-height: .8; margin-top: 1px; - float: none; } .catalog-thread .subject { + flex-shrink: 0; font-weight: 700; + line-height: 1; + text-align: center; +} +.catalog-thread > .comment { + flex-shrink: 1; + overflow: hidden; + text-align: center; } .catalog-thread .comment br + br { display: none; From d0dd780d24e9aaa050d212fa2cd07ddfd92784b3 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sun, 2 Feb 2014 23:30:04 +0100 Subject: [PATCH 13/74] Add the menu button to threads in the catalog. Conflicts: src/Menu/Menu.coffee --- src/General/css/style.css | 6 ++++++ src/Menu/Menu.coffee | 30 ++++++++++++++++++++---------- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/src/General/css/style.css b/src/General/css/style.css index 6f5499a57..df2e3b152 100755 --- a/src/General/css/style.css +++ b/src/General/css/style.css @@ -540,6 +540,12 @@ hr ~ div.center:not(.ad-cnt) { top: 1px; right: 1px; } +.catalog-thread > a:not(:hover) .menu-button { + display: none; +} +.thread-icons > .menu-button > i { + font-size: 14px; +} .thread-stats { flex-shrink: 0; cursor: help; diff --git a/src/Menu/Menu.coffee b/src/Menu/Menu.coffee index 20a2992b6..10ee67eaa 100755 --- a/src/Menu/Menu.coffee +++ b/src/Menu/Menu.coffee @@ -2,10 +2,18 @@ Menu = init: -> return if g.VIEW is 'catalog' or !Conf['Menu'] + @button = $.el 'a', + className: 'menu-button' + href: 'javascript:;' + $.extend @button, <%= html('') %> + @menu = new UI.Menu 'post' Post.callbacks.push name: 'Menu' cb: @node + CatalogThread.callbacks.push + name: 'Image Hover' + cb: @catalogNode node: -> if @isClone @@ -13,16 +21,18 @@ Menu = return $.add @nodes.info, Menu.makeButton() - makeButton: do -> - a = $.el 'a', - className: 'menu-button' - href: 'javascript:;' - $.extend a, <%= html('') %> - -> - button = a.cloneNode true - $.on button, 'click', Menu.toggle - button + catalogNode: -> + $.add @nodes.icons, Menu.makeButton() + + makeButton: -> + clone = Menu.button.cloneNode true + $.on clone, 'click', Menu.toggle + clone toggle: (e) -> - post = Get.postFromNode @ + try + post = Get.postFromNode @ + catch + fullID = @parentNode.parentNode.parentNode.dataset.fullID + post = g.threads[fullID].OP Menu.menu.toggle e, @, post From 006b8eacd5a1867d4ac94a41d43bec091d9b31c1 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Mon, 3 Feb 2014 01:30:35 +0100 Subject: [PATCH 14/74] Avoid overflowing comments. --- src/General/css/style.css | 1 + 1 file changed, 1 insertion(+) diff --git a/src/General/css/style.css b/src/General/css/style.css index df2e3b152..adfb4bd17 100755 --- a/src/General/css/style.css +++ b/src/General/css/style.css @@ -562,6 +562,7 @@ hr ~ div.center:not(.ad-cnt) { } .catalog-thread > .comment { flex-shrink: 1; + max-width: 100%; overflow: hidden; text-align: center; } From a28d6223d41fafb1b13c23c87722d6221c3b1283 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Mon, 3 Feb 2014 10:01:03 +0100 Subject: [PATCH 15/74] Add a bit of horizontal margin between threads in the catalog. --- src/General/css/style.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/General/css/style.css b/src/General/css/style.css index adfb4bd17..e7b081cf1 100755 --- a/src/General/css/style.css +++ b/src/General/css/style.css @@ -507,7 +507,7 @@ hr ~ div.center:not(.ad-cnt) { flex-direction: column; align-items: center; width: 165px; - margin-bottom: 5px; + margin: 0 2px 5px; max-height: 320px; word-break: break-word; } From 100d8339394512cad6b85391e4c30480e3de6aa6 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Fri, 12 Sep 2014 20:48:37 -0700 Subject: [PATCH 16/74] Selected changes from Mayhem commit d6030f7df005d27a1c5c789d8c8426ed15434e4f WAS: Set the catalog thumbnail via background image, save one element. Also tiny fixes here and there. --- src/General/css/style.css | 7 +++---- src/Menu/Menu.coffee | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/General/css/style.css b/src/General/css/style.css index e7b081cf1..01859418f 100755 --- a/src/General/css/style.css +++ b/src/General/css/style.css @@ -551,10 +551,9 @@ hr ~ div.center:not(.ad-cnt) { cursor: help; font-size: 10px; font-weight: 700; - line-height: .8; - margin-top: 1px; + margin-top: 2px; } -.catalog-thread .subject { +.catalog-thread > .subject { flex-shrink: 0; font-weight: 700; line-height: 1; @@ -562,7 +561,7 @@ hr ~ div.center:not(.ad-cnt) { } .catalog-thread > .comment { flex-shrink: 1; - max-width: 100%; + align-self: stretch; overflow: hidden; text-align: center; } diff --git a/src/Menu/Menu.coffee b/src/Menu/Menu.coffee index 10ee67eaa..b9ec9350a 100755 --- a/src/Menu/Menu.coffee +++ b/src/Menu/Menu.coffee @@ -12,7 +12,7 @@ Menu = name: 'Menu' cb: @node CatalogThread.callbacks.push - name: 'Image Hover' + name: 'Menu' cb: @catalogNode node: -> From f4d40629dfd872e638ccd6637142c7bfdb263e37 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Mon, 3 Feb 2014 13:58:16 +0100 Subject: [PATCH 17/74] Replace pretty print tags with their content in the catalog. --- src/General/Build.coffee | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/General/Build.coffee b/src/General/Build.coffee index dc7ffa58d..6f63830a0 100755 --- a/src/General/Build.coffee +++ b/src/General/Build.coffee @@ -368,6 +368,8 @@ Build = for quotelink in $$ '.quotelink', root.lastElementChild $.replace quotelink, [quotelink.childNodes...] + for pp in $$ '.prettyprint', root.lastElementChild + $.replace pp, $.tn pp.textContent if thread.isSticky $.add $('.thread-icons', root), $.el 'img', From 1bff6f816dd7055de904f6b1e027c119d44bd7f4 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Mon, 3 Feb 2014 14:16:36 +0100 Subject: [PATCH 18/74] Move the sticky/closed icons off of Saint Stallman's face. Conflicts: html/General/Thread-catalog-view.html src/General/css/style.css src/Menu/Menu.coffee --- src/General/Build.coffee | 2 +- src/General/css/style.css | 16 +++++++++++----- src/Menu/Menu.coffee | 4 ++-- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/General/Build.coffee b/src/General/Build.coffee index 6f63830a0..180cc6671 100755 --- a/src/General/Build.coffee +++ b/src/General/Build.coffee @@ -353,10 +353,10 @@ Build = $.extend root, <%= html( '' + '&{thumb}' + - '
' + '
' + '
' + '${postCount} / ${fileCount} / ${pageCount}' + + '' + '
' + '&{subject}' + '
&{thread.OP.nodes.comment}
' diff --git a/src/General/css/style.css b/src/General/css/style.css index 01859418f..d941cff79 100755 --- a/src/General/css/style.css +++ b/src/General/css/style.css @@ -535,15 +535,21 @@ hr ~ div.center:not(.ad-cnt) { height: 13px; padding: 20px 36px; } -.thread-icons { +.thread-icons > img { + width: 1em; + height: 1em; + margin: 0; + vertical-align: text-top; +} +.catalog-thread > a:not(:hover) > .menu-button > i { + display: none; +} +.catalog-thread > a > .menu-button { position: absolute; top: 1px; right: 1px; } -.catalog-thread > a:not(:hover) .menu-button { - display: none; -} -.thread-icons > .menu-button > i { +.catalog-thread > a > .menu-button > i { font-size: 14px; } .thread-stats { diff --git a/src/Menu/Menu.coffee b/src/Menu/Menu.coffee index b9ec9350a..f33848f9b 100755 --- a/src/Menu/Menu.coffee +++ b/src/Menu/Menu.coffee @@ -22,7 +22,7 @@ Menu = $.add @nodes.info, Menu.makeButton() catalogNode: -> - $.add @nodes.icons, Menu.makeButton() + $.add @nodes.thumb.parentNode, Menu.makeButton() makeButton: -> clone = Menu.button.cloneNode true @@ -33,6 +33,6 @@ Menu = try post = Get.postFromNode @ catch - fullID = @parentNode.parentNode.parentNode.dataset.fullID + fullID = @parentNode.parentNode.dataset.fullID post = g.threads[fullID].OP Menu.menu.toggle e, @, post From 1f982020f6612bad715c7228db37f8eaef3f6402 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Fri, 12 Sep 2014 22:31:54 -0700 Subject: [PATCH 19/74] partially revert ef99677f142c6b2dadb0e3f70745f0c4b14cf7d4 --- src/General/Index.coffee | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/src/General/Index.coffee b/src/General/Index.coffee index 9606a7791..686c9f34b 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -443,22 +443,12 @@ Index = sortedNodes.push nodes[Index.liveThreadIDs.indexOf(threadID)] if Index.isSearching and nodes = Index.querySearch(Index.searchInput.value) Index.sortedNodes = nodes - items = [ - # Sticky threads - fn: (thread) -> thread.isSticky - cnd: true - , # Highlighted threads - fn: (thread) -> thread.isOnTop - cnd: Conf['Filter'] - , # Non-hidden threads - fn: (thread) -> !thread.isHidden - cnd: Conf['Anchor Hidden Threads'] - ] - i = 0 - while item = items[i++] - {fn, cnd} = item - Index.sortOnTop fn if cnd - return + # Sticky threads + Index.sortOnTop (thread) -> thread.isSticky + # Highlighted threads + Index.sortOnTop((thread) -> thread.isOnTop) if Conf['Filter'] + # Non-hidden threads + Index.sortOnTop((thread) -> !thread.isHidden) if Conf['Anchor Hidden Threads'] sortOnTop: (match) -> topNodes = [] From 3af338f23d7324b3a9108cf43d4a975f544c55b4 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sat, 1 Feb 2014 19:48:37 +0100 Subject: [PATCH 20/74] Add hidden threads count on the index. Conflicts: src/Filtering/ThreadHiding.coffee --- src/Filtering/ThreadHiding.coffee | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/Filtering/ThreadHiding.coffee b/src/Filtering/ThreadHiding.coffee index 8eb7ad224..307820770 100755 --- a/src/Filtering/ThreadHiding.coffee +++ b/src/Filtering/ThreadHiding.coffee @@ -19,7 +19,29 @@ ThreadHiding = thread = Get.threadFromRoot root if thread.isHidden and thread.stub and !root.contains thread.stub ThreadHiding.makeStub thread, root - return + ThreadHiding.updateToggle() + updateToggle: -> + hiddenCount = 0 + for threadID, thread of g.BOARD.threads when thread.isHidden + hiddenCount++ if thread.ID in Index.liveThreadIDs + unless hiddenCount + ThreadHiding.removeToggle() + return + unless ThreadHiding.toggler + ThreadHiding.addToggle() + $('#hidden-count', Index.navLinks).textContent = if hiddenCount is 1 + '1 hidden thread' + else + "#{hiddenCount} hidden threads" + addToggle: -> + ThreadHiding.toggler = $.el 'span', + id: 'hidden-label' + innerHTML: ' — ' + $.add Index.navLinks, ThreadHiding.toggler + removeToggle: -> + return unless ThreadHiding.toggler + $.rm ThreadHiding.toggler + delete ThreadHiding.toggler syncCatalog: -> # Sync hidden threads from the catalog into the index. @@ -188,6 +210,7 @@ ThreadHiding = return if thread.isHidden threadRoot = thread.OP.nodes.root.parentNode thread.isHidden = true + ThreadHiding.updateToggle() return threadRoot.hidden = true unless makeStub @@ -199,3 +222,4 @@ ThreadHiding = delete thread.stub threadRoot = thread.OP.nodes.root.parentNode threadRoot.hidden = thread.isHidden = false + ThreadHiding.updateToggle() From d9e4dcda4102d2b27b741377d623a412fe3042d8 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sat, 1 Feb 2014 20:21:15 +0100 Subject: [PATCH 21/74] Refactor hidden threads count. It concerns filtered threads too, not just manually hidden threads. Conflicts: src/Filtering/ThreadHiding.coffee src/General/Index.coffee --- src/Filtering/ThreadHiding.coffee | 28 +++------------------------- src/General/Index.coffee | 24 ++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 25 deletions(-) diff --git a/src/Filtering/ThreadHiding.coffee b/src/Filtering/ThreadHiding.coffee index 307820770..cd435b3aa 100755 --- a/src/Filtering/ThreadHiding.coffee +++ b/src/Filtering/ThreadHiding.coffee @@ -19,29 +19,7 @@ ThreadHiding = thread = Get.threadFromRoot root if thread.isHidden and thread.stub and !root.contains thread.stub ThreadHiding.makeStub thread, root - ThreadHiding.updateToggle() - updateToggle: -> - hiddenCount = 0 - for threadID, thread of g.BOARD.threads when thread.isHidden - hiddenCount++ if thread.ID in Index.liveThreadIDs - unless hiddenCount - ThreadHiding.removeToggle() - return - unless ThreadHiding.toggler - ThreadHiding.addToggle() - $('#hidden-count', Index.navLinks).textContent = if hiddenCount is 1 - '1 hidden thread' - else - "#{hiddenCount} hidden threads" - addToggle: -> - ThreadHiding.toggler = $.el 'span', - id: 'hidden-label' - innerHTML: ' — ' - $.add Index.navLinks, ThreadHiding.toggler - removeToggle: -> - return unless ThreadHiding.toggler - $.rm ThreadHiding.toggler - delete ThreadHiding.toggler + return syncCatalog: -> # Sync hidden threads from the catalog into the index. @@ -210,7 +188,7 @@ ThreadHiding = return if thread.isHidden threadRoot = thread.OP.nodes.root.parentNode thread.isHidden = true - ThreadHiding.updateToggle() + Index.updateHideToggle() return threadRoot.hidden = true unless makeStub @@ -222,4 +200,4 @@ ThreadHiding = delete thread.stub threadRoot = thread.OP.nodes.root.parentNode threadRoot.hidden = thread.isHidden = false - ThreadHiding.updateToggle() + Index.updateHideToggle() diff --git a/src/General/Index.coffee b/src/General/Index.coffee index 686c9f34b..113d9a6dd 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -267,6 +267,29 @@ Index = $.before a, strong $.add strong, a + updateHideToggle: -> + hiddenCount = 0 + for threadID, thread of g.BOARD.threads when thread.isHidden + hiddenCount++ if thread.ID in Index.liveThreadIDs + unless hiddenCount + Index.removeHideToggle() + return + unless Index.toggler + Index.addHideToggle() + $('#hidden-count', Index.navLinks).textContent = if hiddenCount is 1 + '1 hidden thread' + else + "#{hiddenCount} hidden threads" + addHideToggle: -> + Index.toggler = $.el 'span', + id: 'hidden-label' + innerHTML: ' — ' + $.add Index.navLinks, Index.toggler + removeHideToggle: -> + return unless Index.toggler + $.rm Index.toggler + delete Index.toggler + update: (pageNum, forceReparse) -> return unless navigator.onLine delete Index.pageNum @@ -386,6 +409,7 @@ Index = $.nodes Index.nodes Main.callbackNodes Thread, threads Main.callbackNodes Post, posts + Index.updateHideToggle() $.event 'IndexRefresh' buildReplies: (threadRoots) -> From b8bd58ceb8a3316306a3b408de0ba849d4a10302 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sat, 1 Feb 2014 20:42:59 +0100 Subject: [PATCH 22/74] Make the hidden label an integral part of the index. Conflicts: html/General/Index-navlinks.html src/Filtering/ThreadHiding.coffee --- src/Filtering/ThreadHiding.coffee | 4 ++-- src/General/Index.coffee | 19 +++++-------------- src/General/html/Features/Index-navlinks.html | 1 + 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/src/Filtering/ThreadHiding.coffee b/src/Filtering/ThreadHiding.coffee index cd435b3aa..9ac236d56 100755 --- a/src/Filtering/ThreadHiding.coffee +++ b/src/Filtering/ThreadHiding.coffee @@ -188,7 +188,7 @@ ThreadHiding = return if thread.isHidden threadRoot = thread.OP.nodes.root.parentNode thread.isHidden = true - Index.updateHideToggle() + Index.updateHideLabel() return threadRoot.hidden = true unless makeStub @@ -200,4 +200,4 @@ ThreadHiding = delete thread.stub threadRoot = thread.OP.nodes.root.parentNode threadRoot.hidden = thread.isHidden = false - Index.updateHideToggle() + Index.updateHideLabel() diff --git a/src/General/Index.coffee b/src/General/Index.coffee index 113d9a6dd..d82131355 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -83,6 +83,7 @@ Index = $('.returnlink a', @navLinks).href = "//boards.4chan.org/#{g.BOARD}/" $('.cataloglink a', @navLinks).href = "//boards.4chan.org/#{g.BOARD}/catalog" @searchInput = $ '#index-search', @navLinks + @hideLabel = $ '#hidden-label', @navLinks @currentPage = @getCurrentPage() $.on window, 'popstate', @cb.popstate @@ -267,28 +268,18 @@ Index = $.before a, strong $.add strong, a - updateHideToggle: -> + updateHideLabel: -> hiddenCount = 0 for threadID, thread of g.BOARD.threads when thread.isHidden hiddenCount++ if thread.ID in Index.liveThreadIDs unless hiddenCount - Index.removeHideToggle() + Index.hideLabel.hidden = true return - unless Index.toggler - Index.addHideToggle() + Index.hideLabel.hidden = false $('#hidden-count', Index.navLinks).textContent = if hiddenCount is 1 '1 hidden thread' else "#{hiddenCount} hidden threads" - addHideToggle: -> - Index.toggler = $.el 'span', - id: 'hidden-label' - innerHTML: ' — ' - $.add Index.navLinks, Index.toggler - removeHideToggle: -> - return unless Index.toggler - $.rm Index.toggler - delete Index.toggler update: (pageNum, forceReparse) -> return unless navigator.onLine @@ -409,7 +400,7 @@ Index = $.nodes Index.nodes Main.callbackNodes Thread, threads Main.callbackNodes Post, posts - Index.updateHideToggle() + Index.updateHideLabel() $.event 'IndexRefresh' buildReplies: (threadRoots) -> diff --git a/src/General/html/Features/Index-navlinks.html b/src/General/html/Features/Index-navlinks.html index 4ba933836..6979ed9e8 100644 --- a/src/General/html/Features/Index-navlinks.html +++ b/src/General/html/Features/Index-navlinks.html @@ -4,3 +4,4 @@ × + From 95cf0e04fddbfed7a5b84f40ce20fc24a89290aa Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sat, 1 Feb 2014 21:16:17 +0100 Subject: [PATCH 23/74] Add a show/hide hidden threads toggle for the catalog mode. Conflicts: html/General/Index-navlinks.html src/General/Index.coffee --- src/General/Index.coffee | 23 +++++++++++++++---- src/General/html/Features/Index-navlinks.html | 2 +- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/General/Index.coffee b/src/General/Index.coffee index d82131355..6653472ef 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -72,7 +72,6 @@ Index = $.addClass doc, 'index-loading' @root = $.el 'div', className: 'board' - Index.cb.rootClass() @pagelist = $.el 'div', className: 'pagelist' hidden: true @@ -91,6 +90,8 @@ Index = $.on @pagelist, 'click', @cb.pageNav $.on @searchInput, 'input', @onSearchInput $.on $('#index-search-clear', @navLinks), 'click', @clearSearch + $.on $('#hidden-toggle a', @navLinks), 'click', @cb.toggleHiddenThreads + @cb.toggleCatalogMode() @update() $.asap (-> $('.board', doc) or d.readyState isnt 'loading'), -> @@ -174,10 +175,22 @@ Index = Index.buildIndex() cb: - rootClass: -> - (if Conf['Index Mode'] is 'catalog' then $.addClass else $.rmClass) Index.root, 'catalog-mode' + toggleCatalogMode: -> + if Conf['Index Mode'] is 'catalog' + $.addClass Index.root, 'catalog-mode' + $('#hidden-toggle', Index.navLinks).hidden = false + else + $.rmClass Index.root, 'catalog-mode' + $('#hidden-toggle', Index.navLinks).hidden = true + toggleHiddenThreads: -> + @textContent = if Index.showHiddenThreads = !Index.showHiddenThreads + 'Hide' + else + 'Show' + Index.sort() + Index.buildIndex() mode: -> - Index.cb.rootClass() + Index.cb.toggleCatalogMode() Index.togglePagelist() Index.buildIndex() sort: -> @@ -431,7 +444,7 @@ Index = buildCatalogViews: -> threads = Index.sortedNodes .map((threadRoot) -> Get.threadFromRoot threadRoot) - .filter (thread) -> !thread.isHidden + .filter (thread) -> !thread.isHidden isnt Index.showHiddenThreads catalogThreads = [] for thread in threads when !thread.catalogView catalogThreads.push new CatalogThread Build.catalogThread(thread), thread diff --git a/src/General/html/Features/Index-navlinks.html b/src/General/html/Features/Index-navlinks.html index 6979ed9e8..e1f921fe6 100644 --- a/src/General/html/Features/Index-navlinks.html +++ b/src/General/html/Features/Index-navlinks.html @@ -4,4 +4,4 @@ × - + From 0334d8a9aab28679e473d7888a20feb920b23b53 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sat, 1 Feb 2014 21:28:02 +0100 Subject: [PATCH 24/74] Unhide threads when toggling hidden status of hidden ones. --- src/General/Index.coffee | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/General/Index.coffee b/src/General/Index.coffee index 6653472ef..c06aea093 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -151,14 +151,20 @@ Index = root = @parentNode.parentNode thread = g.threads[root.dataset.fullID] if e.shiftKey - $.rm root - ThreadHiding.hide thread - ThreadHiding.saveHiddenState thread + Index.toggleHide thread, root else if e.altKey Index.togglePin thread else return e.preventDefault() + toggleHide: (thread, root) -> + $.rm root + if Index.showHiddenThreads + ThreadHiding.show thread + else + ThreadHiding.hide thread + return unless ThreadHiding.db.get {boardID: thread.board.ID, threadID: thread.ID} + ThreadHiding.saveHiddenState thread togglePin: (thread) -> if thread.isPinned thread.unpin() @@ -183,7 +189,7 @@ Index = $.rmClass Index.root, 'catalog-mode' $('#hidden-toggle', Index.navLinks).hidden = true toggleHiddenThreads: -> - @textContent = if Index.showHiddenThreads = !Index.showHiddenThreads + $('#hidden-toggle a', Index.navLinks).textContent = if Index.showHiddenThreads = !Index.showHiddenThreads 'Hide' else 'Show' @@ -287,6 +293,7 @@ Index = hiddenCount++ if thread.ID in Index.liveThreadIDs unless hiddenCount Index.hideLabel.hidden = true + Index.cb.toggleHiddenThreads() if Index.showHiddenThreads return Index.hideLabel.hidden = false $('#hidden-count', Index.navLinks).textContent = if hiddenCount is 1 From 78ea850517beed937daefa21371059b8755d46e1 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sun, 2 Feb 2014 17:27:08 +0100 Subject: [PATCH 25/74] Fix hiding threads in the catalog not being saved. Fix hidden threads showing when refreshing the catalog. --- src/General/Index.coffee | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/General/Index.coffee b/src/General/Index.coffee index c06aea093..1e14a779f 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -1,4 +1,5 @@ Index = + showHiddenThreads: false init: -> return if g.BOARD.ID is 'f' or g.VIEW isnt 'index' or !Conf['JSON Navigation'] @@ -161,9 +162,10 @@ Index = $.rm root if Index.showHiddenThreads ThreadHiding.show thread + return unless ThreadHiding.db.get {boardID: thread.board.ID, threadID: thread.ID} + # Don't save when un-hiding filtered threads. else ThreadHiding.hide thread - return unless ThreadHiding.db.get {boardID: thread.board.ID, threadID: thread.ID} ThreadHiding.saveHiddenState thread togglePin: (thread) -> if thread.isPinned From 18b343671da86bbc0a7b65efa1f6cc8ff9523614 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Tue, 4 Feb 2014 13:51:21 +0100 Subject: [PATCH 26/74] Add pin/hide/show thread menu entries for the catalog. Conflicts: src/General/Index.coffee src/General/Main.coffee src/Images/AutoGIF.coffee --- src/Filtering/ThreadHiding.coffee | 2 +- src/General/Index.coffee | 47 +++++++++++++++++++++++++++---- src/General/Main.coffee | 1 + 3 files changed, 43 insertions(+), 7 deletions(-) diff --git a/src/Filtering/ThreadHiding.coffee b/src/Filtering/ThreadHiding.coffee index 9ac236d56..efd5258c6 100755 --- a/src/Filtering/ThreadHiding.coffee +++ b/src/Filtering/ThreadHiding.coffee @@ -81,7 +81,7 @@ ThreadHiding = el: div order: 20 open: ({thread, isReply}) -> - if isReply or thread.isHidden + if isReply or thread.isHidden or Conf['Index Mode'] is 'catalog' return false ThreadHiding.menu.thread = thread true diff --git a/src/General/Index.coffee b/src/General/Index.coffee index 1e14a779f..bca51cd93 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -142,6 +142,42 @@ Index = new Notice 'info', "Last page reached.", 2 setTimeout reset, 3 * $.SECOND + menu: + init: -> + return if g.VIEW isnt 'index' or !Conf['Menu'] or g.BOARD.ID is 'f' + + Menu.menu.addEntry + el: $.el 'a', href: 'javascript:;' + order: 5 + open: ({thread}) -> + return false if Conf['Index Mode'] isnt 'catalog' + @el.textContent = if thread.isHidden + 'Show thread' + else + 'Hide thread' + $.off @el, 'click', @cb if @cb + @cb = -> + $.event 'CloseMenu' + Index.toggleHide thread + $.on @el, 'click', @cb + true + + Menu.menu.addEntry + el: $.el 'a', href: 'javascript:;' + order: 6 + open: ({thread}) -> + return false if Conf['Index Mode'] isnt 'catalog' + @el.textContent = if thread.isPinned + 'Unpin thread' + else + 'Pin thread' + $.off @el, 'click', @cb if @cb + @cb = -> + $.event 'CloseMenu' + Index.togglePin thread + $.on @el, 'click', @cb + true + threadNode: -> return unless data = Index.db.get {boardID: @board.ID, threadID: @ID} @pin() if data.isPinned @@ -149,17 +185,16 @@ Index = $.on @nodes.thumb, 'click', Index.onClick onClick: (e) -> return if e.button isnt 0 - root = @parentNode.parentNode - thread = g.threads[root.dataset.fullID] + thread = g.threads[@parentNode.parentNode.dataset.fullID] if e.shiftKey - Index.toggleHide thread, root + Index.toggleHide thread else if e.altKey Index.togglePin thread else return e.preventDefault() - toggleHide: (thread, root) -> - $.rm root + toggleHide: (thread) -> + $.rm thread.catalogView.nodes.root if Index.showHiddenThreads ThreadHiding.show thread return unless ThreadHiding.db.get {boardID: thread.board.ID, threadID: thread.ID} @@ -483,7 +518,7 @@ Index = # Sticky threads Index.sortOnTop (thread) -> thread.isSticky # Highlighted threads - Index.sortOnTop((thread) -> thread.isOnTop) if Conf['Filter'] + Index.sortOnTop (thread) -> thread.isOnTop # Non-hidden threads Index.sortOnTop((thread) -> !thread.isHidden) if Conf['Anchor Hidden Threads'] diff --git a/src/General/Main.coffee b/src/General/Main.coffee index 932fac15e..f789700c8 100755 --- a/src/General/Main.coffee +++ b/src/General/Main.coffee @@ -295,6 +295,7 @@ Main = ['Strike-through Quotes', QuoteStrikeThrough] ['Quick Reply', QR] ['Menu', Menu] + ['Index Generator (Menu)', Index.menu] ['Report Link', ReportLink] ['Thread Hiding (Menu)', ThreadHiding.menu] ['Reply Hiding (Menu)', PostHiding.menu] From 53d1278171cad97b2350c5e9514aa1746358561e Mon Sep 17 00:00:00 2001 From: Mayhem Date: Tue, 4 Feb 2014 18:37:36 +0100 Subject: [PATCH 27/74] fix catalog layout on firefox Conflicts: CHANGELOG.md --- src/General/css/style.css | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/General/css/style.css b/src/General/css/style.css index d941cff79..668917baa 100755 --- a/src/General/css/style.css +++ b/src/General/css/style.css @@ -498,12 +498,11 @@ hr ~ div.center:not(.ad-cnt) { text-decoration: none; } .catalog-mode { - display: flex; - flex-wrap: wrap; - justify-content: center; + text-align: center; } .catalog-thread { - display: flex; + display: inline-flex; + text-align: left; flex-direction: column; align-items: center; width: 165px; From 08afb032503c60782c0f7cb2e53bbd3de545c1e8 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Tue, 4 Feb 2014 18:54:59 +0100 Subject: [PATCH 28/74] Fix catalog layout alignment. Conflicts: CHANGELOG.md --- src/General/css/style.css | 1 + 1 file changed, 1 insertion(+) diff --git a/src/General/css/style.css b/src/General/css/style.css index 668917baa..46cdd27bc 100755 --- a/src/General/css/style.css +++ b/src/General/css/style.css @@ -509,6 +509,7 @@ hr ~ div.center:not(.ad-cnt) { margin: 0 2px 5px; max-height: 320px; word-break: break-word; + vertical-align: top; } .catalog-thread > a { flex-shrink: 0; From 723e8cc3e79fba6d79b33337c135d6cd65968f64 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Wed, 5 Feb 2014 09:27:26 +0100 Subject: [PATCH 29/74] Fix the search clear button displacing the hidden threads count. Conflicts: src/General/css/style.css --- src/General/css/style.css | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/General/css/style.css b/src/General/css/style.css index 46cdd27bc..9afb4c64f 100755 --- a/src/General/css/style.css +++ b/src/General/css/style.css @@ -485,7 +485,10 @@ hr ~ div.center:not(.ad-cnt) { } #index-search-clear { color: gray; - margin-left: -1em; + display: inline-block; + position: relative; + left: -1em; + width: 0; } <% if (type === 'crx') { %> /* ``::-webkit-*'' selectors break selector lists on Firefox. */ From 3ab0523b89b793ed2cc219f130050212b022ccff Mon Sep 17 00:00:00 2001 From: Mayhem Date: Wed, 5 Feb 2014 09:29:47 +0100 Subject: [PATCH 30/74] show -> unhide --- src/General/Index.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/General/Index.coffee b/src/General/Index.coffee index bca51cd93..e1e476cdf 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -152,7 +152,7 @@ Index = open: ({thread}) -> return false if Conf['Index Mode'] isnt 'catalog' @el.textContent = if thread.isHidden - 'Show thread' + 'Unhide thread' else 'Hide thread' $.off @el, 'click', @cb if @cb From 1f56c301c06d6275353b9247b34f801c687d89ab Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sat, 13 Sep 2014 00:59:02 -0700 Subject: [PATCH 31/74] remove duplicat Persistent QR code --- src/Posting/QR.coffee | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/Posting/QR.coffee b/src/Posting/QR.coffee index 4c6d2b8c1..6afcb6711 100644 --- a/src/Posting/QR.coffee +++ b/src/Posting/QR.coffee @@ -29,12 +29,6 @@ QR = $.on d, '4chanXInitFinished', @initReady - if Conf['Persistent QR'] - unless g.BOARD.ID is 'f' and g.VIEW is 'index' - $.on d, '4chanXInitFinished', @persist - else - $.ready @persist - Post.callbacks.push name: 'Quick Reply' cb: @node @@ -94,11 +88,6 @@ QR = node: -> $.on $('a[title="Reply to this post"]', @nodes.info), 'click', QR.quote - persist: -> - return unless QR.postingIsEnabled - QR.open() - QR.hide() if Conf['Auto Hide QR'] or g.VIEW is 'catalog' - open: -> if QR.nodes QR.nodes.el.hidden = false From 4f00927be10a1306edd745366456ff7b1e80080f Mon Sep 17 00:00:00 2001 From: Mayhem Date: Fri, 7 Feb 2014 19:06:42 +0100 Subject: [PATCH 32/74] Min-width/height for catalog thumbs. --- src/General/css/style.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/General/css/style.css b/src/General/css/style.css index 9afb4c64f..8a6ed6f9a 100755 --- a/src/General/css/style.css +++ b/src/General/css/style.css @@ -524,6 +524,10 @@ hr ~ div.center:not(.ad-cnt) { border-radius: 2px; box-shadow: 0 0 5px rgba(0, 0, 0, .25); } +.thumb:not(.deleted-file):not(.no-file) { + min-width: 30px; + min-height: 30px; +} .thumb.spoiler-file { width: 100px; height: 100px; From 3dc56057ab145d97146a0333e67a366d6889ab8f Mon Sep 17 00:00:00 2001 From: Mayhem Date: Mon, 10 Feb 2014 10:00:29 +0100 Subject: [PATCH 33/74] Don't open threads from the catalog in new tabs. Conflicts: html/General/Thread-catalog-view.html --- src/General/Build.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/General/Build.coffee b/src/General/Build.coffee index 180cc6671..b3f8ead96 100755 --- a/src/General/Build.coffee +++ b/src/General/Build.coffee @@ -351,7 +351,7 @@ Build = root = $.el 'div', className: 'catalog-thread' $.extend root, <%= html( - '' + + '' + '&{thumb}' + '' + '
' + From 12d095b6c3159cc63ed1f1c56ea3e3d54f180e61 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Tue, 11 Feb 2014 09:49:40 +0100 Subject: [PATCH 34/74] Move .catalog-mode to doc. Conflicts: html/General/Index-navlinks.html --- src/General/Index.coffee | 6 ++---- src/General/css/style.css | 4 +++- src/General/html/Features/Index-navlinks.html | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/General/Index.coffee b/src/General/Index.coffee index a25cbd3c8..eb96d5094 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -220,11 +220,9 @@ Index = cb: toggleCatalogMode: -> if Conf['Index Mode'] is 'catalog' - $.addClass Index.root, 'catalog-mode' - $('#hidden-toggle', Index.navLinks).hidden = false + $.addClass doc, 'catalog-mode' else - $.rmClass Index.root, 'catalog-mode' - $('#hidden-toggle', Index.navLinks).hidden = true + $.rmClass doc, 'catalog-mode' toggleHiddenThreads: -> $('#hidden-toggle a', Index.navLinks).textContent = if Index.showHiddenThreads = !Index.showHiddenThreads 'Hide' diff --git a/src/General/css/style.css b/src/General/css/style.css index cd6728fb7..03a8b9b2f 100755 --- a/src/General/css/style.css +++ b/src/General/css/style.css @@ -471,7 +471,9 @@ hr + div.center:not(.ad-cnt):not(.topad):not(.middlead):not(.bottomad) { /* Index */ :root.index-loading .navLinks, :root.index-loading .board, -:root.index-loading .pagelist { +:root.index-loading .pagelist, +:root:not(.catalog-mode) #hidden-toggle, +:root:not(.catalog-mode) #index-size { display: none; } #index-search { diff --git a/src/General/html/Features/Index-navlinks.html b/src/General/html/Features/Index-navlinks.html index e1f921fe6..657978b5c 100644 --- a/src/General/html/Features/Index-navlinks.html +++ b/src/General/html/Features/Index-navlinks.html @@ -4,4 +4,4 @@ × - + From ae7d84407af831b113678b12712b478fde7372a3 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Tue, 11 Feb 2014 21:27:22 +0100 Subject: [PATCH 35/74] Fix catalog selector. --- src/General/css/style.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/General/css/style.css b/src/General/css/style.css index 03a8b9b2f..55ca7b393 100755 --- a/src/General/css/style.css +++ b/src/General/css/style.css @@ -502,7 +502,7 @@ hr + div.center:not(.ad-cnt):not(.topad):not(.middlead):not(.bottomad) { .summary { text-decoration: none; } -.catalog-mode { +.catalog-mode .board { text-align: center; } .catalog-thread { From 12c319dd2308e71a8ebce65aa5f9ffc7298a829a Mon Sep 17 00:00:00 2001 From: Mayhem Date: Mon, 17 Feb 2014 18:02:32 +0100 Subject: [PATCH 36/74] Add some default booleans to Posts and Threads. Remove timeOfDeath as I won't get to use it anytime soon. Fix #1456. Conflicts: src/General/lib/thread.class --- src/General/Index.coffee | 19 +++++++++---------- src/General/lib/post.class | 11 +++++------ src/General/lib/thread.class | 9 ++++++--- 3 files changed, 20 insertions(+), 19 deletions(-) diff --git a/src/General/Index.coffee b/src/General/Index.coffee index 8a5f439a6..3b4c0334c 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -179,8 +179,8 @@ Index = true threadNode: -> - return unless data = Index.db.get {boardID: @board.ID, threadID: @ID} - @pin() if data.isPinned + return unless Index.db.get {boardID: @board.ID, threadID: @ID} + @pin() catalogNode: -> $.on @nodes.thumb, 'click', Index.onClick onClick: (e) -> @@ -203,17 +203,16 @@ Index = ThreadHiding.hide thread ThreadHiding.saveHiddenState thread togglePin: (thread) -> + data = + boardID: thread.board.ID + threadID: thread.ID if thread.isPinned thread.unpin() - Index.db.delete - boardID: thread.board.ID - threadID: thread.ID + Index.db.delete data else thread.pin() - Index.db.set - boardID: thread.board.ID - threadID: thread.ID - val: isPinned: thread.isPinned + data.val = true + Index.db.set data Index.sort() Index.buildIndex() @@ -516,7 +515,7 @@ Index = # Sticky threads Index.sortOnTop (thread) -> thread.isSticky # Highlighted threads - Index.sortOnTop (thread) -> thread.isOnTop + Index.sortOnTop (thread) -> thread.isOnTop or thread.isPinned # Non-hidden threads Index.sortOnTop((thread) -> !thread.isHidden) if Conf['Anchor Hidden Threads'] diff --git a/src/General/lib/post.class b/src/General/lib/post.class index 66bb7966d..1eb61f645 100755 --- a/src/General/lib/post.class +++ b/src/General/lib/post.class @@ -76,6 +76,9 @@ class Post @parseQuotes() @parseFile that + @isDead = false + @isHidden = false + @clones = [] g.posts.push @fullID, thread.posts.push @, board.posts.push @, @ @kill() if that.isArchived @@ -175,17 +178,14 @@ class Post $.rmClass node, 'desktop' return - kill: (file, now) -> - now or= new Date() + kill: (file) -> if file return if @file.isDead @file.isDead = true - @file.timeOfDeath = now $.addClass @nodes.root, 'deleted-file' else return if @isDead @isDead = true - @timeOfDeath = now $.addClass @nodes.root, 'deleted-post' unless strong = $ 'strong.warning', @nodes.info @@ -197,7 +197,7 @@ class Post return if @isClone for clone in @clones - clone.kill file, now + clone.kill file return if file # Get quotelinks/backlinks to this post @@ -210,7 +210,6 @@ class Post # giving us false-positive dead posts. resurrect: -> delete @isDead - delete @timeOfDeath $.rmClass @nodes.root, 'deleted-post' strong = $ 'strong.warning', @nodes.info # no false-positive files diff --git a/src/General/lib/thread.class b/src/General/lib/thread.class index ff191c362..2fc060441 100755 --- a/src/General/lib/thread.class +++ b/src/General/lib/thread.class @@ -5,6 +5,10 @@ class Thread constructor: (@ID, @board) -> @fullID = "#{@board}.#{@ID}" @posts = new SimpleDict + @isDead = false + @isHidden = false + @isOnTop = false + @isPinned = false @isSticky = false @isClosed = false @postLimit = false @@ -55,15 +59,14 @@ class Thread (if type is 'Sticky' and @isClosed then $.prepend else $.add) @catalogView.nodes.icons, icon.cloneNode() pin: -> - @isOnTop = @isPinned = true + @isPinned = true $.addClass @catalogView.nodes.root, 'pinned' if @catalogView unpin: -> - @isOnTop = @isPinned = false + @isPinned = false $.rmClass @catalogView.nodes.root, 'pinned' if @catalogView kill: -> @isDead = true - @timeOfDeath = Date.now() collect: -> @posts.forEach (post) -> post.collect() From e4c05c81f00f17b56c4924f53f613e68e7f039d5 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Mon, 15 Sep 2014 22:50:22 -0700 Subject: [PATCH 37/74] don't use exceptions for catalog menu --- src/Menu/Menu.coffee | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/src/Menu/Menu.coffee b/src/Menu/Menu.coffee index f33848f9b..732a96010 100755 --- a/src/Menu/Menu.coffee +++ b/src/Menu/Menu.coffee @@ -17,22 +17,16 @@ Menu = node: -> if @isClone - $.on $('.menu-button', @nodes.info), 'click', Menu.toggle + Menu.makeButton @, $('.menu-button', @nodes.info) return - $.add @nodes.info, Menu.makeButton() + $.add @nodes.info, Menu.makeButton @ catalogNode: -> - $.add @nodes.thumb.parentNode, Menu.makeButton() + post = g.threads[@thread.fullID].OP + $.add @nodes.thumb.parentNode, Menu.makeButton post - makeButton: -> - clone = Menu.button.cloneNode true - $.on clone, 'click', Menu.toggle - clone - - toggle: (e) -> - try - post = Get.postFromNode @ - catch - fullID = @parentNode.parentNode.dataset.fullID - post = g.threads[fullID].OP - Menu.menu.toggle e, @, post + makeButton: (post, button) -> + button or= Menu.button.cloneNode true + $.on button, 'click', (e) -> + Menu.menu.toggle e, @, post + button From 11067f01d3bcedf8c7ebe913dff78432144a36f3 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Tue, 16 Sep 2014 00:02:53 -0700 Subject: [PATCH 38/74] catalog: move menu to thread stats line --- src/General/css/style.css | 17 ++++++----------- src/Menu/Menu.coffee | 2 +- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/General/css/style.css b/src/General/css/style.css index 55ca7b393..496af3ad3 100755 --- a/src/General/css/style.css +++ b/src/General/css/style.css @@ -544,22 +544,17 @@ hr + div.center:not(.ad-cnt):not(.topad):not(.middlead):not(.bottomad) { height: 13px; padding: 20px 36px; } -.thread-icons > img { +.thread-icons > img, +.catalog-thread > .thread-stats > .menu-button { width: 1em; height: 1em; margin: 0; vertical-align: text-top; } -.catalog-thread > a:not(:hover) > .menu-button > i { - display: none; -} -.catalog-thread > a > .menu-button { - position: absolute; - top: 1px; - right: 1px; -} -.catalog-thread > a > .menu-button > i { - font-size: 14px; +.catalog-thread > .thread-stats > .menu-button { + text-align: center; + bottom: 1px; + font-weight: normal; } .thread-stats { flex-shrink: 0; diff --git a/src/Menu/Menu.coffee b/src/Menu/Menu.coffee index 732a96010..7b19153b2 100755 --- a/src/Menu/Menu.coffee +++ b/src/Menu/Menu.coffee @@ -23,7 +23,7 @@ Menu = catalogNode: -> post = g.threads[@thread.fullID].OP - $.add @nodes.thumb.parentNode, Menu.makeButton post + $.after @nodes.icons, Menu.makeButton post makeButton: (post, button) -> button or= Menu.button.cloneNode true From a55daa2736c56a164e9c38b7534912534471d222 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Tue, 16 Sep 2014 00:53:41 -0700 Subject: [PATCH 39/74] move thumb class to link --- src/General/Build.coffee | 6 +++--- src/General/Index.coffee | 2 +- src/General/css/style.css | 16 ++++++++-------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/General/Build.coffee b/src/General/Build.coffee index 9aef30f6d..e80be5e14 100755 --- a/src/General/Build.coffee +++ b/src/General/Build.coffee @@ -329,9 +329,9 @@ Build = imgClass = 'no-file' thumb = if imgClass - <%= html('') %> + <%= html('') %> else - <%= html('') %> + <%= html('') %> postCount = data.replies + 1 fileCount = data.images + !!data.ext @@ -345,7 +345,7 @@ Build = root = $.el 'div', className: 'catalog-thread' $.extend root, <%= html( - '' + + '' + '&{thumb}' + '' + '
' + diff --git a/src/General/Index.coffee b/src/General/Index.coffee index 3b4c0334c..5ec05e24c 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -185,7 +185,7 @@ Index = $.on @nodes.thumb, 'click', Index.onClick onClick: (e) -> return if e.button isnt 0 - thread = g.threads[@parentNode.parentNode.dataset.fullID] + thread = g.threads[@parentNode.dataset.fullID] if e.shiftKey Index.toggleHide thread else if e.altKey diff --git a/src/General/css/style.css b/src/General/css/style.css index 496af3ad3..914af5f03 100755 --- a/src/General/css/style.css +++ b/src/General/css/style.css @@ -516,30 +516,30 @@ hr + div.center:not(.ad-cnt):not(.topad):not(.middlead):not(.bottomad) { word-break: break-word; vertical-align: top; } -.catalog-thread > a { +.thumb { flex-shrink: 0; position: relative; } -.thumb { +.thumb > img { max-width: 150px; max-height: 150px; border-radius: 2px; box-shadow: 0 0 5px rgba(0, 0, 0, .25); } -.thumb:not(.deleted-file):not(.no-file) { +.thumb:not(.deleted-file):not(.no-file) > img { min-width: 30px; min-height: 30px; } -.thumb.spoiler-file { +.thumb.spoiler-file > img { width: 100px; height: 100px; } -.thumb.deleted-file { +.thumb.deleted-file > img { width: 127px; height: 13px; padding: 20px 11px; } -.thumb.no-file { +.thumb.no-file > img { width: 77px; height: 13px; padding: 20px 36px; @@ -851,8 +851,8 @@ span.hide-announcement { .filter-highlight > .reply { box-shadow: -5px 0 rgba(255, 0, 0, .5); } -.pinned .thumb, -.filter-highlight .thumb { +.pinned .thumb > img, +.filter-highlight .thumb > img { border: 2px solid rgba(255, 0, 0, .5); } From 1d2e956d7ddbb1dd0eb02eaf328c248458649be3 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Tue, 16 Sep 2014 01:12:53 -0700 Subject: [PATCH 40/74] Werk Tyme in catalog --- src/General/css/style.css | 12 +++++++++++- src/Images/FappeTyme.coffee | 9 +++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/General/css/style.css b/src/General/css/style.css index 914af5f03..d031100d8 100755 --- a/src/General/css/style.css +++ b/src/General/css/style.css @@ -833,9 +833,19 @@ span.hide-announcement { display: none; } /* Werk Tyme */ -.werkTyme .post .file { +.werkTyme .post .file, +.werkTyme .thumb > img, +:root:not(.werkTyme) .thumb > span { display: none; } +.werkTyme .thumb { + font-weight: bold; + text-align: center; +} +.werkTyme .pinned .thumb, +.werkTyme .filter-highlight .thumb { + border: 2px solid rgba(255, 0, 0, .5); +} /* Index/Reply Navigation */ #navlinks { diff --git a/src/Images/FappeTyme.coffee b/src/Images/FappeTyme.coffee index a46b704aa..07c708784 100755 --- a/src/Images/FappeTyme.coffee +++ b/src/Images/FappeTyme.coffee @@ -20,10 +20,19 @@ FappeTyme = name: 'Fappe Tyme' cb: @node + CatalogThread.callbacks.push + name: 'Werk Tyme' + cb: @catalogNode + node: -> return if @file $.addClass @nodes.root, "noFile" + catalogNode: -> + {file} = @thread.OP + return if !file + $.add @nodes.thumb, $.el('span', textContent: file.name) + cb: set: (type) -> FappeTyme[type].checked = Conf[type] From 8bff3530d5e7c2622eb7489b6aa305e713bba316 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Tue, 16 Sep 2014 11:10:44 -0700 Subject: [PATCH 41/74] Revert "move thumb class to link" This reverts commit a55daa2736c56a164e9c38b7534912534471d222. --- src/General/Build.coffee | 6 +++--- src/General/Index.coffee | 2 +- src/General/css/style.css | 16 ++++++++-------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/General/Build.coffee b/src/General/Build.coffee index e80be5e14..9aef30f6d 100755 --- a/src/General/Build.coffee +++ b/src/General/Build.coffee @@ -329,9 +329,9 @@ Build = imgClass = 'no-file' thumb = if imgClass - <%= html('') %> + <%= html('') %> else - <%= html('') %> + <%= html('') %> postCount = data.replies + 1 fileCount = data.images + !!data.ext @@ -345,7 +345,7 @@ Build = root = $.el 'div', className: 'catalog-thread' $.extend root, <%= html( - '' + + '' + '&{thumb}' + '' + '
' + diff --git a/src/General/Index.coffee b/src/General/Index.coffee index 5ec05e24c..3b4c0334c 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -185,7 +185,7 @@ Index = $.on @nodes.thumb, 'click', Index.onClick onClick: (e) -> return if e.button isnt 0 - thread = g.threads[@parentNode.dataset.fullID] + thread = g.threads[@parentNode.parentNode.dataset.fullID] if e.shiftKey Index.toggleHide thread else if e.altKey diff --git a/src/General/css/style.css b/src/General/css/style.css index 7f9a521cf..1e80fd7f1 100755 --- a/src/General/css/style.css +++ b/src/General/css/style.css @@ -516,30 +516,30 @@ hr + div.center:not(.ad-cnt):not(.topad):not(.middlead):not(.bottomad) { word-break: break-word; vertical-align: top; } -.thumb { +.catalog-thread > a { flex-shrink: 0; position: relative; } -.thumb > img { +.thumb { max-width: 150px; max-height: 150px; border-radius: 2px; box-shadow: 0 0 5px rgba(0, 0, 0, .25); } -.thumb:not(.deleted-file):not(.no-file) > img { +.thumb:not(.deleted-file):not(.no-file) { min-width: 30px; min-height: 30px; } -.thumb.spoiler-file > img { +.thumb.spoiler-file { width: 100px; height: 100px; } -.thumb.deleted-file > img { +.thumb.deleted-file { width: 127px; height: 13px; padding: 20px 11px; } -.thumb.no-file > img { +.thumb.no-file { width: 77px; height: 13px; padding: 20px 36px; @@ -861,8 +861,8 @@ span.hide-announcement { .filter-highlight > .reply { box-shadow: -5px 0 rgba(255, 0, 0, .5); } -.pinned .thumb > img, -.filter-highlight .thumb > img { +.pinned .thumb, +.filter-highlight .thumb { border: 2px solid rgba(255, 0, 0, .5); } From 98292d76f9eb535d038714f8b575564984800a45 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Tue, 16 Sep 2014 11:33:13 -0700 Subject: [PATCH 42/74] fix WerkTyme after thumb class revert --- src/General/Index.coffee | 4 ++-- src/General/css/style.css | 12 +++++++----- src/Images/FappeTyme.coffee | 5 ++++- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/General/Index.coffee b/src/General/Index.coffee index 3b4c0334c..7427a9ead 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -182,10 +182,10 @@ Index = return unless Index.db.get {boardID: @board.ID, threadID: @ID} @pin() catalogNode: -> - $.on @nodes.thumb, 'click', Index.onClick + $.on @nodes.thumb.parentNode, 'click', Index.onClick onClick: (e) -> return if e.button isnt 0 - thread = g.threads[@parentNode.parentNode.dataset.fullID] + thread = g.threads[@parentNode.dataset.fullID] if e.shiftKey Index.toggleHide thread else if e.altKey diff --git a/src/General/css/style.css b/src/General/css/style.css index 1e80fd7f1..f951a9079 100755 --- a/src/General/css/style.css +++ b/src/General/css/style.css @@ -834,16 +834,18 @@ span.hide-announcement { } /* Werk Tyme */ :root.werkTyme .postContainer:not(.noFile) .fileThumb, -.werkTyme .thumb > img, -:root:not(.werkTyme) .thumb > span { +:root.werkTyme .thumb:not(.deleted-file):not(.no-file), +:root:not(.werkTyme) .werkTyme-filename { display: none; } -.werkTyme .thumb { +.werkTyme-filename { font-weight: bold; +} +:root.werkTyme .catalog-thread > a { text-align: center; } -.werkTyme .pinned .thumb, -.werkTyme .filter-highlight .thumb { +.pinned .werkTyme-filename, +.filter-highlight .werkTyme-filename { border: 2px solid rgba(255, 0, 0, .5); } diff --git a/src/Images/FappeTyme.coffee b/src/Images/FappeTyme.coffee index 07c708784..5c67b808a 100755 --- a/src/Images/FappeTyme.coffee +++ b/src/Images/FappeTyme.coffee @@ -31,7 +31,10 @@ FappeTyme = catalogNode: -> {file} = @thread.OP return if !file - $.add @nodes.thumb, $.el('span', textContent: file.name) + span = $.el 'span', + textContent: file.name + className: 'werkTyme-filename' + $.add @nodes.thumb.parentNode, span cb: set: (type) -> From 3ec9c747e4fe430569202b31e2dc3cdef785d5b6 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Tue, 16 Sep 2014 11:45:02 -0700 Subject: [PATCH 43/74] fix highlight around multiline filenames from WerkTyme --- src/Images/FappeTyme.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Images/FappeTyme.coffee b/src/Images/FappeTyme.coffee index 5c67b808a..a540410b1 100755 --- a/src/Images/FappeTyme.coffee +++ b/src/Images/FappeTyme.coffee @@ -31,10 +31,10 @@ FappeTyme = catalogNode: -> {file} = @thread.OP return if !file - span = $.el 'span', + filename = $.el 'div', textContent: file.name className: 'werkTyme-filename' - $.add @nodes.thumb.parentNode, span + $.add @nodes.thumb.parentNode, filename cb: set: (type) -> From 58973e465172e4b7baced47e4f9369377004011a Mon Sep 17 00:00:00 2001 From: ccd0 Date: Tue, 16 Sep 2014 19:42:45 -0700 Subject: [PATCH 44/74] catalog: use copy of comment HTML from before running features like Linkify/Embed --- src/General/Build.coffee | 2 +- src/General/lib/post.class | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/General/Build.coffee b/src/General/Build.coffee index 9aef30f6d..d9a2dafdd 100755 --- a/src/General/Build.coffee +++ b/src/General/Build.coffee @@ -353,7 +353,7 @@ Build = '' + '
' + '&{subject}' + - '
&{thread.OP.nodes.comment}
' + '
&{thread.OP.info.commentHTML}
' ) %> root.dataset.fullID = thread.fullID diff --git a/src/General/lib/post.class b/src/General/lib/post.class index 1eb61f645..645f0894e 100755 --- a/src/General/lib/post.class +++ b/src/General/lib/post.class @@ -86,6 +86,7 @@ class Post parseComment: -> # Merge text nodes and remove empty ones. @nodes.comment.normalize() + # Get the comment's text. #
-> \n # Remove: @@ -98,7 +99,11 @@ class Post for node in $$ '.abbr, .exif, b', bq $.rm node @info.comment = @nodesToText bq - # Hide spoilers. + + # Save cleaned comment HTML. + @info.commentHTML = <%= html('&{bq}') %> + + # Get the comment's text with spoilers hidden. spoilers = $$ 's', bq @info.commentSpoilered = if spoilers.length for node in spoilers From 7eb12bcf8194d254d3a24d1ab28260a926080d45 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Tue, 16 Sep 2014 20:09:49 -0700 Subject: [PATCH 45/74] hide Index Navigation links in catalog --- src/General/css/style.css | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/General/css/style.css b/src/General/css/style.css index f951a9079..7c37f97e7 100755 --- a/src/General/css/style.css +++ b/src/General/css/style.css @@ -855,6 +855,9 @@ span.hide-announcement { top: 25px; right: 10px; } +:root.catalog-mode #navlinks { + display: none; +} /* Filter */ .opContainer.filter-highlight { From bc377f96db332e92fe0f07f5b1f28fda908cf715 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Tue, 16 Sep 2014 21:21:46 -0700 Subject: [PATCH 46/74] disable inapplicable keybinds --- src/Miscellaneous/Keybinds.coffee | 65 ++++++++++++++++++------------- 1 file changed, 37 insertions(+), 28 deletions(-) diff --git a/src/Miscellaneous/Keybinds.coffee b/src/Miscellaneous/Keybinds.coffee index 93b4bdf26..02beb8ac4 100755 --- a/src/Miscellaneous/Keybinds.coffee +++ b/src/Miscellaneous/Keybinds.coffee @@ -21,21 +21,21 @@ Keybinds = {target} = e if target.nodeName in ['INPUT', 'TEXTAREA'] return unless /(Esc|Alt|Ctrl|Meta|Shift\+\w{2,})/.test key - unless g.VIEW is 'catalog' + unless g.VIEW is 'catalog' or g.VIEW is 'index' and Conf['JSON Navigation'] and Conf['Index Mode'] is 'catalog' threadRoot = Nav.getThread() if op = $ '.op', threadRoot thread = Get.postFromNode(op).thread switch key # QR & Options when Conf['Toggle board list'] - if Conf['Custom Board Navigation'] - Header.toggleBoardList() + return unless Conf['Custom Board Navigation'] + Header.toggleBoardList() when Conf['Toggle header'] Header.toggleBarVisibility() when Conf['Open empty QR'] Keybinds.qr() when Conf['Open QR'] - return if g.VIEW is 'catalog' + return unless threadRoot Keybinds.qr threadRoot when Conf['Open settings'] Settings.open() @@ -45,11 +45,13 @@ Keybinds = else if (notifications = $$ '.notification').length for notification in notifications $('.close', notification).click() - else if QR.nodes + else if QR.nodes and !QR.nodes.el.hidden if Conf['Persistent QR'] QR.hide() else QR.close() + else + return when Conf['Spoiler tags'] return if target.nodeName isnt 'TEXTAREA' Keybinds.tags 'spoiler', target @@ -63,25 +65,31 @@ Keybinds = return if target.nodeName isnt 'TEXTAREA' Keybinds.tags 'math', target when Conf['Toggle sage'] - Keybinds.sage() if QR.nodes + return unless QR.nodes and !QR.nodes.el.hidden + Keybinds.sage() when Conf['Submit QR'] - QR.submit() if QR.nodes and !QR.status() + return unless QR.nodes and !QR.nodes.el.hidden + QR.submit() if !QR.status() # Index/Thread related when Conf['Update'] switch g.VIEW when 'thread' - ThreadUpdater.update() if Conf['Thread Updater'] + return unless Conf['Thread Updater'] + ThreadUpdater.update() when 'index' - if Conf['JSON Navigation'] then Index.update() + return unless Conf['JSON Navigation'] + Index.update() + else + return when Conf['Watch'] - return if g.VIEW is 'catalog' + return unless thread ThreadWatcher.toggle thread # Images when Conf['Expand image'] - return if g.VIEW is 'catalog' + return unless threadRoot Keybinds.img threadRoot when Conf['Expand images'] - return if g.VIEW is 'catalog' + return unless threadRoot Keybinds.img threadRoot, true when Conf['Open Gallery'] return if g.VIEW is 'catalog' @@ -95,6 +103,7 @@ Keybinds = # Board Navigation when Conf['Front page'] if Conf['JSON Navigation'] and g.VIEW is 'index' + return unless Conf['Index Mode'] is 'paged' Index.userPageNav 1 else window.location = "/#{g.BOARD}/" @@ -103,16 +112,16 @@ Keybinds = when Conf['Next page'] return unless g.VIEW is 'index' if Conf['JSON Navigation'] - if Conf['Index Mode'] isnt 'all pages' - $('.next button', Index.pagelist).click() + return unless Conf['Index Mode'] is 'paged' + $('.next button', Index.pagelist).click() else if form = $ '.next form' window.location = form.action when Conf['Previous page'] return unless g.VIEW is 'index' if Conf['JSON Navigation'] - if Conf['Index Mode'] isnt 'all pages' - $('.prev button', Index.pagelist).click() + return unless Conf['Index Mode'] is 'paged' + $('.prev button', Index.pagelist).click() else if form = $ '.prev form' window.location = form.action @@ -128,42 +137,42 @@ Keybinds = window.location = "/#{g.BOARD}/catalog" # Thread Navigation when Conf['Next thread'] - return if g.VIEW isnt 'index' + return if g.VIEW isnt 'index' or !threadRoot Nav.scroll +1 when Conf['Previous thread'] - return if g.VIEW isnt 'index' + return if g.VIEW isnt 'index' or !threadRoot Nav.scroll -1 when Conf['Expand thread'] - return if g.VIEW isnt 'index' + return if g.VIEW isnt 'index' or !threadRoot ExpandThread.toggle thread when Conf['Open thread'] - return if g.VIEW isnt 'index' + return if g.VIEW isnt 'index' or !threadRoot Keybinds.open thread when Conf['Open thread tab'] - return if g.VIEW isnt 'index' + return if g.VIEW isnt 'index' or !threadRoot Keybinds.open thread, true # Reply Navigation when Conf['Next reply'] - return if g.VIEW is 'catalog' + return unless threadRoot Keybinds.hl +1, threadRoot when Conf['Previous reply'] - return if g.VIEW is 'catalog' + return unless threadRoot Keybinds.hl -1, threadRoot when Conf['Deselect reply'] - return if g.VIEW is 'catalog' + return unless threadRoot Keybinds.hl 0, threadRoot when Conf['Hide'] - return if g.VIEW is 'catalog' + return unless thread ThreadHiding.toggle thread if ThreadHiding.db when Conf['Previous Post Quoting You'] - return if g.VIEW is 'catalog' + return unless threadRoot QuoteYou.cb.seek 'preceding' when Conf['Next Post Quoting You'] - return if g.VIEW is 'catalog' + return unless threadRoot QuoteYou.cb.seek 'following' <% if (tests_enabled) { %> when 't' - return if g.VIEW is 'catalog' + return unless threadRoot BuildTest.testAll() <% } %> else From cbe9c5e72d16f8652a82218296106c2325fe6fb7 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Tue, 16 Sep 2014 22:09:17 -0700 Subject: [PATCH 47/74] fix double
removal --- src/General/Build.coffee | 2 ++ src/General/css/style.css | 3 --- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/General/Build.coffee b/src/General/Build.coffee index d9a2dafdd..d16eaedc9 100755 --- a/src/General/Build.coffee +++ b/src/General/Build.coffee @@ -364,6 +364,8 @@ Build = $.replace quotelink, [quotelink.childNodes...] for pp in $$ '.prettyprint', root.lastElementChild $.replace pp, $.tn pp.textContent + for br in $$ 'br', root.lastElementChild when br.previousSibling.nodeName is 'BR' + $.rm br if thread.isSticky $.add $('.thread-icons', root), $.el 'img', diff --git a/src/General/css/style.css b/src/General/css/style.css index 7c37f97e7..ed7b548ee 100755 --- a/src/General/css/style.css +++ b/src/General/css/style.css @@ -575,9 +575,6 @@ hr + div.center:not(.ad-cnt):not(.topad):not(.middlead):not(.bottomad) { overflow: hidden; text-align: center; } -.catalog-thread .comment br + br { - display: none; -} /* Announcement Hiding */ :root.hide-announcement #globalMessage { From 29a28169fe25b3fe833e01167b79c1272f06dddf Mon Sep 17 00:00:00 2001 From: ccd0 Date: Wed, 17 Sep 2014 23:36:02 -0700 Subject: [PATCH 48/74] make whole hidden thread count catalog-only --- src/General/css/style.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/General/css/style.css b/src/General/css/style.css index ed7b548ee..fc4a27fc7 100755 --- a/src/General/css/style.css +++ b/src/General/css/style.css @@ -472,7 +472,7 @@ hr + div.center:not(.ad-cnt):not(.topad):not(.middlead):not(.bottomad) { :root.index-loading .navLinks, :root.index-loading .board, :root.index-loading .pagelist, -:root:not(.catalog-mode) #hidden-toggle, +:root:not(.catalog-mode) #hidden-label, :root:not(.catalog-mode) #index-size { display: none; } From f3d11ccffc96d4d52200deb744e6db9ebc15d3d9 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Wed, 17 Sep 2014 23:44:27 -0700 Subject: [PATCH 49/74] make dead quote links ordinary text as we do for live quote links --- src/General/Build.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/General/Build.coffee b/src/General/Build.coffee index d16eaedc9..6442f7891 100755 --- a/src/General/Build.coffee +++ b/src/General/Build.coffee @@ -360,7 +360,7 @@ Build = $.addClass root, 'pinned' if thread.isPinned $.addClass root, thread.OP.highlights... if thread.OP.highlights - for quotelink in $$ '.quotelink', root.lastElementChild + for quotelink in $$ '.quotelink, .deadlink', root.lastElementChild $.replace quotelink, [quotelink.childNodes...] for pp in $$ '.prettyprint', root.lastElementChild $.replace pp, $.tn pp.textContent From 4f44b5ab5e60c51d905c8eb724d8f6da850b66b2 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Thu, 18 Sep 2014 20:23:20 -0700 Subject: [PATCH 50/74] Rename some CSS classes. thumb -> catalog-thumb and thread-stats -> catalog-stats due to name clashes with 4chan thread-stats -> catalog-stats for consistency --- src/General/Build.coffee | 12 ++++++------ src/General/css/style.css | 28 +++++++++++++++------------- src/General/lib/catalogthread.class | 10 +++++----- 3 files changed, 26 insertions(+), 24 deletions(-) diff --git a/src/General/Build.coffee b/src/General/Build.coffee index 6442f7891..d4ae3e130 100755 --- a/src/General/Build.coffee +++ b/src/General/Build.coffee @@ -329,9 +329,9 @@ Build = imgClass = 'no-file' thumb = if imgClass - <%= html('') %> + <%= html('') %> else - <%= html('') %> + <%= html('') %> postCount = data.replies + 1 fileCount = data.images + !!data.ext @@ -348,9 +348,9 @@ Build = '' + '&{thumb}' + '' + - '
' + + '
' + '${postCount} / ${fileCount} / ${pageCount}' + - '' + + '' + '
' + '&{subject}' + '
&{thread.OP.info.commentHTML}
' @@ -368,12 +368,12 @@ Build = $.rm br if thread.isSticky - $.add $('.thread-icons', root), $.el 'img', + $.add $('.catalog-icons', root), $.el 'img', src: "#{staticPath}sticky#{gifIcon}" className: 'stickyIcon' title: 'Sticky' if thread.isClosed - $.add $('.thread-icons', root), $.el 'img', + $.add $('.catalog-icons', root), $.el 'img', src: "#{staticPath}closed#{gifIcon}" className: 'closedIcon' title: 'Closed' diff --git a/src/General/css/style.css b/src/General/css/style.css index fc4a27fc7..18c09679e 100755 --- a/src/General/css/style.css +++ b/src/General/css/style.css @@ -502,7 +502,9 @@ hr + div.center:not(.ad-cnt):not(.topad):not(.middlead):not(.bottomad) { .summary { text-decoration: none; } -.catalog-mode .board { + +/* Catalog */ +:root.catalog-mode .board { text-align: center; } .catalog-thread { @@ -520,43 +522,43 @@ hr + div.center:not(.ad-cnt):not(.topad):not(.middlead):not(.bottomad) { flex-shrink: 0; position: relative; } -.thumb { +.catalog-thumb { max-width: 150px; max-height: 150px; border-radius: 2px; box-shadow: 0 0 5px rgba(0, 0, 0, .25); } -.thumb:not(.deleted-file):not(.no-file) { +.catalog-thumb:not(.deleted-file):not(.no-file) { min-width: 30px; min-height: 30px; } -.thumb.spoiler-file { +.catalog-thumb.spoiler-file { width: 100px; height: 100px; } -.thumb.deleted-file { +.catalog-thumb.deleted-file { width: 127px; height: 13px; padding: 20px 11px; } -.thumb.no-file { +.catalog-thumb.no-file { width: 77px; height: 13px; padding: 20px 36px; } -.thread-icons > img, -.catalog-thread > .thread-stats > .menu-button { +.catalog-icons > img, +.catalog-stats > .menu-button { width: 1em; height: 1em; margin: 0; vertical-align: text-top; } -.catalog-thread > .thread-stats > .menu-button { +.catalog-stats > .menu-button { text-align: center; bottom: 1px; font-weight: normal; } -.thread-stats { +.catalog-stats { flex-shrink: 0; cursor: help; font-size: 10px; @@ -831,7 +833,7 @@ span.hide-announcement { } /* Werk Tyme */ :root.werkTyme .postContainer:not(.noFile) .fileThumb, -:root.werkTyme .thumb:not(.deleted-file):not(.no-file), +:root.werkTyme .catalog-thumb:not(.deleted-file):not(.no-file), :root:not(.werkTyme) .werkTyme-filename { display: none; } @@ -863,8 +865,8 @@ span.hide-announcement { .filter-highlight > .reply { box-shadow: -5px 0 rgba(255, 0, 0, .5); } -.pinned .thumb, -.filter-highlight .thumb { +.pinned .catalog-thumb, +.filter-highlight .catalog-thumb { border: 2px solid rgba(255, 0, 0, .5); } diff --git a/src/General/lib/catalogthread.class b/src/General/lib/catalogthread.class index 2942a5eb6..0ae4a65b6 100644 --- a/src/General/lib/catalogthread.class +++ b/src/General/lib/catalogthread.class @@ -7,9 +7,9 @@ class CatalogThread @board = @thread.board @nodes = root: root - thumb: $ '.thumb', root - icons: $ '.thread-icons', root - postCount: $ '.post-count', root - fileCount: $ '.file-count', root - pageCount: $ '.page-count', root + thumb: $ '.catalog-thumb', root + icons: $ '.catalog-icons', root + postCount: $ '.post-count', root + fileCount: $ '.file-count', root + pageCount: $ '.page-count', root @thread.catalogView = @ From 4d43b48663d82cf2314d1dd61f561ad33f645d64 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Thu, 18 Sep 2014 22:29:47 -0700 Subject: [PATCH 51/74] fix menu button position --- src/General/css/style.css | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/General/css/style.css b/src/General/css/style.css index 18c09679e..3178c5a38 100755 --- a/src/General/css/style.css +++ b/src/General/css/style.css @@ -555,9 +555,11 @@ hr + div.center:not(.ad-cnt):not(.topad):not(.middlead):not(.bottomad) { } .catalog-stats > .menu-button { text-align: center; - bottom: 1px; font-weight: normal; } +.catalog-stats > .menu-button > i::before { + line-height: 11px; +} .catalog-stats { flex-shrink: 0; cursor: help; From 9dd83dcb1f422f14698e0a33097f5f21a77216b8 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Thu, 18 Sep 2014 23:53:57 -0700 Subject: [PATCH 52/74] fix bug in double
removal --- src/General/Build.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/General/Build.coffee b/src/General/Build.coffee index d4ae3e130..f85937bf5 100755 --- a/src/General/Build.coffee +++ b/src/General/Build.coffee @@ -364,7 +364,7 @@ Build = $.replace quotelink, [quotelink.childNodes...] for pp in $$ '.prettyprint', root.lastElementChild $.replace pp, $.tn pp.textContent - for br in $$ 'br', root.lastElementChild when br.previousSibling.nodeName is 'BR' + for br in $$ 'br', root.lastElementChild when !br.previousSibling or br.previousSibling.nodeName is 'BR' $.rm br if thread.isSticky From d70c7c0e5150683fc6dceb1e67c67d193e825204 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Fri, 19 Sep 2014 00:23:56 -0700 Subject: [PATCH 53/74] fix jsMath in catalog --- src/General/lib/catalogthread.class | 1 + src/Miscellaneous/Fourchan.coffee | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/General/lib/catalogthread.class b/src/General/lib/catalogthread.class index 0ae4a65b6..564f62bfb 100644 --- a/src/General/lib/catalogthread.class +++ b/src/General/lib/catalogthread.class @@ -12,4 +12,5 @@ class CatalogThread postCount: $ '.post-count', root fileCount: $ '.file-count', root pageCount: $ '.page-count', root + comment: $ '.comment', root @thread.catalogView = @ diff --git a/src/Miscellaneous/Fourchan.coffee b/src/Miscellaneous/Fourchan.coffee index 0014eb823..1e70fc2ce 100755 --- a/src/Miscellaneous/Fourchan.coffee +++ b/src/Miscellaneous/Fourchan.coffee @@ -21,7 +21,7 @@ Fourchan = if (!jsMath) return; if (jsMath.loaded) { // process one post - jsMath.ProcessBeforeShowing(document.getElementById(e.detail)); + jsMath.ProcessBeforeShowing(e.target); } else if (jsMath.Autoload && jsMath.Autoload.checked) { // load jsMath and process whole document jsMath.Autoload.Script.Push('ProcessBeforeShowing', [null]); @@ -32,6 +32,9 @@ Fourchan = Post.callbacks.push name: 'Parse /sci/ math' cb: @math + CatalogThread.callbacks.push + name: 'Parse /sci/ math' + cb: @math code: -> return if @isClone apply = (e) -> @@ -44,8 +47,8 @@ Fourchan = return math: -> return if (@isClone and doc.contains @origin.nodes.root) or !$ '.math', @nodes.comment - $.asap (=> doc.contains @nodes.post), => - $.event 'jsmath', @nodes.post.id, window + $.asap (=> doc.contains @nodes.comment), => + $.event 'jsmath', null, @nodes.comment parseThread: (threadID, offset, limit) -> # Fix /sci/ # Fix /g/ From 3e753bad21d4015fa61b69cff3b3d7b603b2ca3a Mon Sep 17 00:00:00 2001 From: ccd0 Date: Fri, 19 Sep 2014 14:51:18 -0700 Subject: [PATCH 54/74] fix stuff that should be conditional on 'JSON Navigation' setting --- src/Filtering/ThreadHiding.coffee | 8 ++++---- src/General/Index.coffee | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Filtering/ThreadHiding.coffee b/src/Filtering/ThreadHiding.coffee index efd5258c6..31e4c130f 100755 --- a/src/Filtering/ThreadHiding.coffee +++ b/src/Filtering/ThreadHiding.coffee @@ -1,6 +1,6 @@ ThreadHiding = init: -> - return if g.VIEW isnt 'index' + return if g.VIEW isnt 'index' or !Conf['Thread Hiding Buttons'] and !Conf['Thread Hiding Link'] and !Conf['JSON Navigation'] @db = new DataBoard 'hiddenThreads' @syncCatalog() @@ -81,7 +81,7 @@ ThreadHiding = el: div order: 20 open: ({thread, isReply}) -> - if isReply or thread.isHidden or Conf['Index Mode'] is 'catalog' + if isReply or thread.isHidden or Conf['JSON Navigation'] and Conf['Index Mode'] is 'catalog' return false ThreadHiding.menu.thread = thread true @@ -188,7 +188,7 @@ ThreadHiding = return if thread.isHidden threadRoot = thread.OP.nodes.root.parentNode thread.isHidden = true - Index.updateHideLabel() + Index.updateHideLabel() if Conf['JSON Navigation'] return threadRoot.hidden = true unless makeStub @@ -200,4 +200,4 @@ ThreadHiding = delete thread.stub threadRoot = thread.OP.nodes.root.parentNode threadRoot.hidden = thread.isHidden = false - Index.updateHideLabel() + Index.updateHideLabel() if Conf['JSON Navigation'] diff --git a/src/General/Index.coffee b/src/General/Index.coffee index 7427a9ead..1a887e054 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -144,7 +144,7 @@ Index = menu: init: -> - return if g.VIEW isnt 'index' or !Conf['Menu'] or g.BOARD.ID is 'f' + return if g.VIEW isnt 'index' or !Conf['JSON Navigation'] or !Conf['Menu'] or g.BOARD.ID is 'f' Menu.menu.addEntry el: $.el 'a', href: 'javascript:;' From c47c800de7c1b3dc00eac6424bce4a675ddcd35a Mon Sep 17 00:00:00 2001 From: ccd0 Date: Fri, 19 Sep 2014 21:51:35 -0700 Subject: [PATCH 55/74] remove CSS for #index-size until actually implemented --- src/General/css/style.css | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/General/css/style.css b/src/General/css/style.css index 3178c5a38..4cab6d679 100755 --- a/src/General/css/style.css +++ b/src/General/css/style.css @@ -472,8 +472,7 @@ hr + div.center:not(.ad-cnt):not(.topad):not(.middlead):not(.bottomad) { :root.index-loading .navLinks, :root.index-loading .board, :root.index-loading .pagelist, -:root:not(.catalog-mode) #hidden-label, -:root:not(.catalog-mode) #index-size { +:root:not(.catalog-mode) #hidden-label { display: none; } #index-search { From b280b3d26a44940ceeb1846c68c70753143c8baf Mon Sep 17 00:00:00 2001 From: ccd0 Date: Fri, 19 Sep 2014 22:09:19 -0700 Subject: [PATCH 56/74] fix CSS bug --- src/General/css/style.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/General/css/style.css b/src/General/css/style.css index 4cab6d679..783fb699a 100755 --- a/src/General/css/style.css +++ b/src/General/css/style.css @@ -514,7 +514,7 @@ hr + div.center:not(.ad-cnt):not(.topad):not(.middlead):not(.bottomad) { width: 165px; margin: 0 2px 5px; max-height: 320px; - word-break: break-word; + word-wrap: break-word; vertical-align: top; } .catalog-thread > a { From 99e302eb0c11242c301daac57aa13272ccba6550 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Fri, 19 Sep 2014 22:34:01 -0700 Subject: [PATCH 57/74] fix keybind conditions --- src/Miscellaneous/Keybinds.coffee | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Miscellaneous/Keybinds.coffee b/src/Miscellaneous/Keybinds.coffee index 02beb8ac4..0ad8be306 100755 --- a/src/Miscellaneous/Keybinds.coffee +++ b/src/Miscellaneous/Keybinds.coffee @@ -103,7 +103,6 @@ Keybinds = # Board Navigation when Conf['Front page'] if Conf['JSON Navigation'] and g.VIEW is 'index' - return unless Conf['Index Mode'] is 'paged' Index.userPageNav 1 else window.location = "/#{g.BOARD}/" @@ -112,7 +111,7 @@ Keybinds = when Conf['Next page'] return unless g.VIEW is 'index' if Conf['JSON Navigation'] - return unless Conf['Index Mode'] is 'paged' + return unless Conf['Index Mode'] in ['paged', 'infinite'] $('.next button', Index.pagelist).click() else if form = $ '.next form' @@ -120,7 +119,7 @@ Keybinds = when Conf['Previous page'] return unless g.VIEW is 'index' if Conf['JSON Navigation'] - return unless Conf['Index Mode'] is 'paged' + return unless Conf['Index Mode'] in ['paged', 'infinite'] $('.prev button', Index.pagelist).click() else if form = $ '.prev form' From 648c34444804ba47121527fcb6ba5ed9daa7dc34 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Fri, 19 Sep 2014 23:18:37 -0700 Subject: [PATCH 58/74] Now data.omitted_images is not accurate. --- src/General/Build.coffee | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/General/Build.coffee b/src/General/Build.coffee index d5c44df15..d0af8afdb 100755 --- a/src/General/Build.coffee +++ b/src/General/Build.coffee @@ -291,7 +291,8 @@ Build = nodes = [if OP then OP.nodes.root else Build.postFromObject data, board.ID] if data.omitted_posts or !Conf['Show Replies'] and data.replies [posts, files] = if Conf['Show Replies'] - [data.omitted_posts, data.omitted_images] + # XXX data.omitted_images is not accurate. + [data.omitted_posts, data.images - data.last_replies.filter((data) -> !!data.ext).length] else [data.replies, data.images] nodes.push Build.summary board.ID, data.no, posts, files From fa86daf2359fdb7e7fcdfec7a0a29a78aa64b999 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Fri, 19 Sep 2014 23:32:57 -0700 Subject: [PATCH 59/74] CSS prefixes for older webkit browsers --- src/General/css/style.css | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/General/css/style.css b/src/General/css/style.css index 783fb699a..72d75cb52 100755 --- a/src/General/css/style.css +++ b/src/General/css/style.css @@ -507,9 +507,12 @@ hr + div.center:not(.ad-cnt):not(.topad):not(.middlead):not(.bottomad) { text-align: center; } .catalog-thread { + display: -webkit-inline-flex; display: inline-flex; text-align: left; + -webkit-flex-direction: column; flex-direction: column; + -webkit-align-items: center; align-items: center; width: 165px; margin: 0 2px 5px; @@ -519,6 +522,7 @@ hr + div.center:not(.ad-cnt):not(.topad):not(.middlead):not(.bottomad) { } .catalog-thread > a { flex-shrink: 0; + -webkit-flex-shrink: 0; position: relative; } .catalog-thumb { @@ -560,6 +564,7 @@ hr + div.center:not(.ad-cnt):not(.topad):not(.middlead):not(.bottomad) { line-height: 11px; } .catalog-stats { + -webkit-flex-shrink: 0; flex-shrink: 0; cursor: help; font-size: 10px; @@ -567,13 +572,16 @@ hr + div.center:not(.ad-cnt):not(.topad):not(.middlead):not(.bottomad) { margin-top: 2px; } .catalog-thread > .subject { + -webkit-flex-shrink: 0; flex-shrink: 0; font-weight: 700; line-height: 1; text-align: center; } .catalog-thread > .comment { + -webkit-flex-shrink: 1; flex-shrink: 1; + -webkit-align-self: stretch; align-self: stretch; overflow: hidden; text-align: center; From e3add277573461ca9a959c361849dd48bfd37910 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Fri, 19 Sep 2014 23:52:58 -0700 Subject: [PATCH 60/74] CSS tweaks --- src/General/css/style.css | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/General/css/style.css b/src/General/css/style.css index 72d75cb52..8f7ef7f6d 100755 --- a/src/General/css/style.css +++ b/src/General/css/style.css @@ -555,6 +555,7 @@ hr + div.center:not(.ad-cnt):not(.topad):not(.middlead):not(.bottomad) { height: 1em; margin: 0; vertical-align: text-top; + padding-left: 2px; } .catalog-stats > .menu-button { text-align: center; @@ -574,6 +575,8 @@ hr + div.center:not(.ad-cnt):not(.topad):not(.middlead):not(.bottomad) { .catalog-thread > .subject { -webkit-flex-shrink: 0; flex-shrink: 0; + -webkit-align-self: stretch; + align-self: stretch; font-weight: 700; line-height: 1; text-align: center; From 26d00bf7ad63c60461d4e286098b956ae43203e9 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sat, 20 Sep 2014 07:29:42 -0700 Subject: [PATCH 61/74] scroll to navlinks on refresh --- src/General/Index.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/General/Index.coffee b/src/General/Index.coffee index 1a887e054..9810723f6 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -258,7 +258,7 @@ Index = Index.userPageNav +a.pathname.split('/')[2] or 1 scrollToIndex: -> - Header.scrollToIfNeeded Index.root + Header.scrollToIfNeeded Index.navLinks getCurrentPage: -> +window.location.pathname.split('/')[2] or 1 From 295dabb75670eb3551e55ec2b80cabe29887b86a Mon Sep 17 00:00:00 2001 From: Mayhem Date: Fri, 7 Feb 2014 22:40:32 +0100 Subject: [PATCH 62/74] Return to the previous index mode that's not the catalog. Conflicts: src/General/Index.coffee --- src/General/Config.coffee | 1 + src/General/Index.coffee | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/General/Config.coffee b/src/General/Config.coffee index 45408e983..063259202 100755 --- a/src/General/Config.coffee +++ b/src/General/Config.coffee @@ -553,6 +553,7 @@ http://iqdb.org/?url=%TURL Index: 'Index Mode': 'paged' + 'Previous Index Mode': 'paged' 'Index Sort': 'bump' 'Show Replies': true 'Anchor Hidden Threads': true diff --git a/src/General/Index.coffee b/src/General/Index.coffee index 9810723f6..2d8eb2125 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -233,6 +233,10 @@ Index = Index.cb.toggleCatalogMode() Index.togglePagelist() Index.buildIndex() + mode = Conf['Index Mode'] + if mode not in ['catalog', Conf['Previous Index Mode']] + Conf['Previous Index Mode'] = mode + $.set 'Previous Index Mode', mode sort: -> Index.sort() Index.buildIndex() From 6bffe734509f1fb42b1579bf2e3d198ff75f9c01 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sat, 20 Sep 2014 09:59:51 -0700 Subject: [PATCH 63/74] record index mode changes in history --- src/General/Index.coffee | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/src/General/Index.coffee b/src/General/Index.coffee index 2d8eb2125..32ee38462 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -2,6 +2,7 @@ Index = showHiddenThreads: false init: -> return if g.BOARD.ID is 'f' or g.VIEW isnt 'index' or !Conf['JSON Navigation'] + @cb.popstate() @board = "#{g.BOARD}" @@ -230,13 +231,10 @@ Index = Index.sort() Index.buildIndex() mode: -> - Index.cb.toggleCatalogMode() - Index.togglePagelist() - Index.buildIndex() mode = Conf['Index Mode'] - if mode not in ['catalog', Conf['Previous Index Mode']] - Conf['Previous Index Mode'] = mode - $.set 'Previous Index Mode', mode + Index.currentPage = 1 if mode in ['all pages', 'catalog'] + history.pushState {mode}, '', if Index.currentPage is 1 then './' else Index.currentPage + Index.setMode() sort: -> Index.sort() Index.buildIndex() @@ -245,8 +243,16 @@ Index = Index.sort() Index.buildIndex() popstate: (e) -> + unless e?.state + # page load or hash change + history.replaceState {mode: Conf['Index Mode']}, '' + return + {mode} = e.state pageNum = Index.getCurrentPage() - Index.pageLoad pageNum if Index.currentPage isnt pageNum + return if Conf['Index Mode'] is mode and Index.currentPage is pageNum + Conf['Index Mode'] = mode + Index.currentPage = pageNum + Index.setMode() pageNav: (e) -> return if e.shiftKey or e.altKey or e.ctrlKey or e.metaKey or e.button isnt 0 switch e.target.nodeName @@ -267,7 +273,7 @@ Index = getCurrentPage: -> +window.location.pathname.split('/')[2] or 1 userPageNav: (pageNum) -> - history.pushState null, '', if pageNum is 1 then './' else pageNum + history.pushState {mode: Conf['Index Mode']}, '', if pageNum is 1 then './' else pageNum if Conf['Refreshed Navigation'] and Conf['Index Mode'] isnt 'all pages' Index.update pageNum else @@ -279,6 +285,15 @@ Index = Index.buildIndex() Index.setPage() Index.scrollToIndex() + setMode: -> + Index.cb.toggleCatalogMode() + Index.togglePagelist() + Index.buildIndex() + Index.setPage() + mode = Conf['Index Mode'] + if mode not in ['catalog', Conf['Previous Index Mode']] + Conf['Previous Index Mode'] = mode + $.set 'Previous Index Mode', mode getPagesNum: -> if Index.isSearching @@ -590,7 +605,7 @@ Index = Index.buildIndex() Index.setPage() else - history.pushState null, '', if pageNum is 1 then './' else pageNum + history.pushState {mode: Conf['Index Mode']}, '', if pageNum is 1 then './' else pageNum Index.pageLoad pageNum querySearch: (query) -> From 30572f487680c29fe3128270b936c73c3be72a64 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sat, 20 Sep 2014 10:02:30 -0700 Subject: [PATCH 64/74] from Mayhem 245dfaa1f935ee97856f7c5f718d6af774c078e5: update index mode menu when opened --- src/General/Index.coffee | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/General/Index.coffee b/src/General/Index.coffee index 32ee38462..be57ed572 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -30,9 +30,13 @@ Index = { el: $.el 'label', <%= html(' All threads') %> } { el: $.el 'label', <%= html(' Catalog') %> } ] + open: -> + for label in @subEntries + input = label.el.firstChild + input.checked = Conf['Index Mode'] is input.value + true for label in modeEntry.subEntries input = label.el.firstChild - input.checked = Conf['Index Mode'] is input.value $.on input, 'change', $.cb.value $.on input, 'change', @cb.mode From a05044f88f451b13913d2d04d6d93284445897da Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sat, 20 Sep 2014 12:09:05 -0700 Subject: [PATCH 65/74] Save mode when set via navigating history. --- src/General/Index.coffee | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/General/Index.coffee b/src/General/Index.coffee index be57ed572..e51b73cb7 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -37,7 +37,6 @@ Index = true for label in modeEntry.subEntries input = label.el.firstChild - $.on input, 'change', $.cb.value $.on input, 'change', @cb.mode sortEntry = @@ -235,10 +234,9 @@ Index = Index.sort() Index.buildIndex() mode: -> - mode = Conf['Index Mode'] - Index.currentPage = 1 if mode in ['all pages', 'catalog'] - history.pushState {mode}, '', if Index.currentPage is 1 then './' else Index.currentPage - Index.setMode() + pageNum = if @value in ['all pages', 'catalog'] then 1 else Index.currentPage + Index.pushState @value, pageNum + Index.setMode @value, pageNum sort: -> Index.sort() Index.buildIndex() @@ -253,10 +251,8 @@ Index = return {mode} = e.state pageNum = Index.getCurrentPage() - return if Conf['Index Mode'] is mode and Index.currentPage is pageNum - Conf['Index Mode'] = mode - Index.currentPage = pageNum - Index.setMode() + unless Conf['Index Mode'] is mode and Index.currentPage is pageNum + Index.setMode mode, pageNum pageNav: (e) -> return if e.shiftKey or e.altKey or e.ctrlKey or e.metaKey or e.button isnt 0 switch e.target.nodeName @@ -277,24 +273,28 @@ Index = getCurrentPage: -> +window.location.pathname.split('/')[2] or 1 userPageNav: (pageNum) -> - history.pushState {mode: Conf['Index Mode']}, '', if pageNum is 1 then './' else pageNum + Index.pushState Conf['Index Mode'], pageNum if Conf['Refreshed Navigation'] and Conf['Index Mode'] isnt 'all pages' Index.update pageNum else return if Index.currentPage is pageNum Index.pageLoad pageNum + pushState: (mode, pageNum) -> + history.pushState {mode}, '', if pageNum is 1 then './' else pageNum pageLoad: (pageNum) -> Index.currentPage = pageNum return if Conf['Index Mode'] is 'all pages' Index.buildIndex() Index.setPage() Index.scrollToIndex() - setMode: -> + setMode: (mode, pageNum) -> + Conf['Index Mode'] = mode + $.set 'Index Mode', mode + Index.currentPage = pageNum Index.cb.toggleCatalogMode() Index.togglePagelist() Index.buildIndex() Index.setPage() - mode = Conf['Index Mode'] if mode not in ['catalog', Conf['Previous Index Mode']] Conf['Previous Index Mode'] = mode $.set 'Previous Index Mode', mode @@ -609,7 +609,7 @@ Index = Index.buildIndex() Index.setPage() else - history.pushState {mode: Conf['Index Mode']}, '', if pageNum is 1 then './' else pageNum + Index.pushState Conf['Index Mode'], pageNum Index.pageLoad pageNum querySearch: (query) -> From 2bf5c0100f7acbc6bbdb30024df7c4382abe43a2 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sat, 20 Sep 2014 12:24:09 -0700 Subject: [PATCH 66/74] forceReparse no longer needed --- src/General/Index.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/General/Index.coffee b/src/General/Index.coffee index e51b73cb7..5cc776942 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -358,7 +358,7 @@ Index = else "#{hiddenCount} hidden threads" - update: (pageNum, forceReparse) -> + update: (pageNum) -> return unless navigator.onLine delete Index.pageNum Index.req?.abort() @@ -378,7 +378,7 @@ Index = onabort: onload onloadend: onload , - whenModified: !forceReparse + whenModified: true $.addClass Index.button, 'fa-spin' load: (e, pageNum) -> From 55ea86d5cd521d2db83e653cd116ecaddf45cbff Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sat, 20 Sep 2014 12:36:06 -0700 Subject: [PATCH 67/74] restore index mode condition to Front page keybind --- src/Miscellaneous/Keybinds.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Miscellaneous/Keybinds.coffee b/src/Miscellaneous/Keybinds.coffee index 0ad8be306..c8577d57c 100755 --- a/src/Miscellaneous/Keybinds.coffee +++ b/src/Miscellaneous/Keybinds.coffee @@ -103,6 +103,7 @@ Keybinds = # Board Navigation when Conf['Front page'] if Conf['JSON Navigation'] and g.VIEW is 'index' + return unless Conf['Index Mode'] in ['paged', 'infinite'] Index.userPageNav 1 else window.location = "/#{g.BOARD}/" From d5e075cd1d411f48ef11fc3a606733220f6eb9ef Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sat, 20 Sep 2014 12:47:29 -0700 Subject: [PATCH 68/74] not needed --- src/General/Index.coffee | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/General/Index.coffee b/src/General/Index.coffee index 5cc776942..842e68324 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -274,7 +274,7 @@ Index = +window.location.pathname.split('/')[2] or 1 userPageNav: (pageNum) -> Index.pushState Conf['Index Mode'], pageNum - if Conf['Refreshed Navigation'] and Conf['Index Mode'] isnt 'all pages' + if Conf['Refreshed Navigation'] Index.update pageNum else return if Index.currentPage is pageNum @@ -283,7 +283,6 @@ Index = history.pushState {mode}, '', if pageNum is 1 then './' else pageNum pageLoad: (pageNum) -> Index.currentPage = pageNum - return if Conf['Index Mode'] is 'all pages' Index.buildIndex() Index.setPage() Index.scrollToIndex() From cf2197a6808c4f4aa60d853ecf6e320ad087edb4 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sat, 20 Sep 2014 12:59:08 -0700 Subject: [PATCH 69/74] remove unnecessary conditional compilation --- src/General/Index.coffee | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/General/Index.coffee b/src/General/Index.coffee index 842e68324..7f476c91d 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -594,12 +594,8 @@ Index = return unless Index.searchInput.dataset.searching pageNum = Index.pageBeforeSearch delete Index.pageBeforeSearch - <% if (type === 'userscript') { %> # XXX https://github.com/greasemonkey/greasemonkey/issues/1571 Index.searchInput.removeAttribute 'data-searching' - <% } else { %> - delete Index.searchInput.dataset.searching - <% } %> Index.sort() # Go to the last available page if we were past the limit. pageNum = Math.min pageNum, Index.getMaxPageNum() if Conf['Index Mode'] isnt 'all pages' From aa152969ae0fbcec8a01f0ee819a4b3b1c5b0e4d Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sat, 20 Sep 2014 13:41:20 -0700 Subject: [PATCH 70/74] add CSS classes for all index modes --- src/General/Index.coffee | 24 ++++++------------------ src/General/css/style.css | 3 +++ 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/src/General/Index.coffee b/src/General/Index.coffee index 7f476c91d..259fb1abb 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -75,14 +75,11 @@ Index = order: 98 subEntries: [repliesEntry, anchorEntry, refNavEntry, modeEntry, sortEntry] - $.addClass doc, 'index-loading' - @root = $.el 'div', className: 'board' - @pagelist = $.el 'div', - className: 'pagelist' - hidden: true + $.addClass doc, 'index-loading', "#{Conf['Index Mode'].replace /\ /g, '-'}-mode" + @root = $.el 'div', className: 'board' + @pagelist = $.el 'div', className: 'pagelist' $.extend @pagelist, <%= importHTML('Features/Index-pagelist') %> - @navLinks = $.el 'div', - className: 'navLinks' + @navLinks = $.el 'div', className: 'navLinks' $.extend @navLinks, <%= importHTML('Features/Index-navlinks') %> $('.returnlink a', @navLinks).href = "//boards.4chan.org/#{g.BOARD}/" $('.cataloglink a', @navLinks).href = "//boards.4chan.org/#{g.BOARD}/catalog" @@ -96,7 +93,6 @@ Index = $.on @searchInput, 'input', @onSearchInput $.on $('#index-search-clear', @navLinks), 'click', @clearSearch $.on $('#hidden-toggle a', @navLinks), 'click', @cb.toggleHiddenThreads - @cb.toggleCatalogMode() @update() $.asap (-> $('.board', doc) or d.readyState isnt 'loading'), -> @@ -221,11 +217,6 @@ Index = Index.buildIndex() cb: - toggleCatalogMode: -> - if Conf['Index Mode'] is 'catalog' - $.addClass doc, 'catalog-mode' - else - $.rmClass doc, 'catalog-mode' toggleHiddenThreads: -> $('#hidden-toggle a', Index.navLinks).textContent = if Index.showHiddenThreads = !Index.showHiddenThreads 'Hide' @@ -287,11 +278,11 @@ Index = Index.setPage() Index.scrollToIndex() setMode: (mode, pageNum) -> + $.rmClass doc, "#{Conf['Index Mode'].replace /\ /g, '-'}-mode" + $.addClass doc, "#{mode.replace /\ /g, '-'}-mode" Conf['Index Mode'] = mode $.set 'Index Mode', mode Index.currentPage = pageNum - Index.cb.toggleCatalogMode() - Index.togglePagelist() Index.buildIndex() Index.setPage() if mode not in ['catalog', Conf['Previous Index Mode']] @@ -305,8 +296,6 @@ Index = Index.pagesNum getMaxPageNum: -> Math.max 1, Index.getPagesNum() - togglePagelist: -> - Index.pagelist.hidden = Conf['Index Mode'] isnt 'paged' buildPagelist: -> pagesRoot = $ '.pages', Index.pagelist maxPageNum = Index.getMaxPageNum() @@ -319,7 +308,6 @@ Index = nodes.push $.tn('['), a, $.tn '] ' $.rmAll pagesRoot $.add pagesRoot, nodes - Index.togglePagelist() setPage: (pageNum) -> pageNum or= Index.getCurrentPage() maxPageNum = Index.getMaxPageNum() diff --git a/src/General/css/style.css b/src/General/css/style.css index 8f7ef7f6d..726869e85 100755 --- a/src/General/css/style.css +++ b/src/General/css/style.css @@ -472,6 +472,9 @@ hr + div.center:not(.ad-cnt):not(.topad):not(.middlead):not(.bottomad) { :root.index-loading .navLinks, :root.index-loading .board, :root.index-loading .pagelist, +:root.infinite-mode .pagelist, +:root.all-pages-mode .pagelist, +:root.catalog-mode .pagelist, :root:not(.catalog-mode) #hidden-label { display: none; } From 7a3e3acee85dcb3de9aac7b18f626e43e1692d21 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sat, 20 Sep 2014 15:10:46 -0700 Subject: [PATCH 71/74] change index modes with hash --- src/General/Index.coffee | 40 +++++++++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/src/General/Index.coffee b/src/General/Index.coffee index 259fb1abb..ead8053b8 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -225,9 +225,10 @@ Index = Index.sort() Index.buildIndex() mode: -> - pageNum = if @value in ['all pages', 'catalog'] then 1 else Index.currentPage - Index.pushState @value, pageNum - Index.setMode @value, pageNum + Index.setMode @value + Index.pushState Conf['Index Mode'], Index.currentPage + Index.buildIndex() + Index.setPage() sort: -> Index.sort() Index.buildIndex() @@ -235,15 +236,31 @@ Index = Index.buildThreads() Index.sort() Index.buildIndex() + hashchange: (e) -> + switch command = location.hash[1..] + when 'paged', 'infinite', 'all pages', 'catalog' + mode = command + when 'index' + mode = Conf['Previous Index Mode'] + if mode + Index.setMode mode + history.replaceState {mode}, '', if Index.currentPage is 1 then './' else Index.currentPage + if e + # hash change, not call from init + Index.buildIndex() + Index.setPage() + return + history.replaceState {mode: Conf['Index Mode']}, '' popstate: (e) -> unless e?.state # page load or hash change - history.replaceState {mode: Conf['Index Mode']}, '' - return + return Index.cb.hashchange.call @, e {mode} = e.state pageNum = Index.getCurrentPage() unless Conf['Index Mode'] is mode and Index.currentPage is pageNum - Index.setMode mode, pageNum + Index.setMode mode + Index.buildIndex() + Index.setPage() pageNav: (e) -> return if e.shiftKey or e.altKey or e.ctrlKey or e.metaKey or e.button isnt 0 switch e.target.nodeName @@ -262,7 +279,10 @@ Index = Header.scrollToIfNeeded Index.navLinks getCurrentPage: -> - +window.location.pathname.split('/')[2] or 1 + if Conf['Index Mode'] in ['all pages', 'catalog'] + 1 + else + +window.location.pathname.split('/')[2] or 1 userPageNav: (pageNum) -> Index.pushState Conf['Index Mode'], pageNum if Conf['Refreshed Navigation'] @@ -277,14 +297,12 @@ Index = Index.buildIndex() Index.setPage() Index.scrollToIndex() - setMode: (mode, pageNum) -> + setMode: (mode) -> $.rmClass doc, "#{Conf['Index Mode'].replace /\ /g, '-'}-mode" $.addClass doc, "#{mode.replace /\ /g, '-'}-mode" Conf['Index Mode'] = mode $.set 'Index Mode', mode - Index.currentPage = pageNum - Index.buildIndex() - Index.setPage() + Index.currentPage = Index.getCurrentPage() if mode not in ['catalog', Conf['Previous Index Mode']] Conf['Previous Index Mode'] = mode $.set 'Previous Index Mode', mode From 3dd0ed60262525b86fc75a807ddeacf37c615c41 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sat, 20 Sep 2014 18:02:46 -0700 Subject: [PATCH 72/74] add setting to link to 4chan X catalog --- src/General/Config.coffee | 4 ++++ src/General/Header.coffee | 2 +- src/General/Index.coffee | 21 +++++++++++++------ src/General/html/Features/Index-navlinks.html | 4 ++-- src/Miscellaneous/CatalogLinks.coffee | 5 ++++- src/Miscellaneous/Keybinds.coffee | 5 ++++- 6 files changed, 30 insertions(+), 11 deletions(-) diff --git a/src/General/Config.coffee b/src/General/Config.coffee index 063259202..2f995e035 100755 --- a/src/General/Config.coffee +++ b/src/General/Config.coffee @@ -5,6 +5,10 @@ Config = true 'Replace the board index with a dynamically generated one supporting searching, sorting, and infinite scrolling.' ] + 'Use 4chan X Catalog': [ + false + 'Link to 4chan X\'s catalog instead of the native 4chan one.' + ] 'Catalog Links': [ true 'Add toggle link in header menu to turn Navigation links into links to each board\'s catalog.' diff --git a/src/General/Header.coffee b/src/General/Header.coffee index ec293a3f4..c5ee2a4fc 100755 --- a/src/General/Header.coffee +++ b/src/General/Header.coffee @@ -197,7 +197,7 @@ Header = if Conf['External Catalog'] a.href = CatalogLinks.external board else - a.href += 'catalog' + a.href += if Conf['JSON Navigation'] and Conf['Use 4chan X Catalog'] then '#catalog' else 'catalog' $.addClass a, 'catalog' $.addClass a, 'navSmall' if board is '@' diff --git a/src/General/Index.coffee b/src/General/Index.coffee index ead8053b8..30100dfda 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -1,8 +1,12 @@ Index = showHiddenThreads: false init: -> - return if g.BOARD.ID is 'f' or g.VIEW isnt 'index' or !Conf['JSON Navigation'] - @cb.popstate() + return if g.BOARD.ID is 'f' or !Conf['JSON Navigation'] + if g.VIEW is 'thread' and Conf['Use 4chan X Catalog'] + $.ready -> + for link in $$ '.navLinks.desktop a' when link.pathname is "/#{g.BOARD}/catalog" + link.href = "/#{g.BOARD}/#catalog" + return if g.VIEW isnt 'index' @board = "#{g.BOARD}" @@ -14,6 +18,10 @@ Index = name: 'Catalog Features' cb: @catalogNode + if Conf['Use 4chan X Catalog'] and Conf['Index Mode'] is 'catalog' + Index.setMode Conf['Previous Index Mode'] + @cb.popstate() + @button = $.el 'a', className: 'index-refresh-shortcut fa fa-refresh' title: 'Refresh' @@ -79,10 +87,11 @@ Index = @root = $.el 'div', className: 'board' @pagelist = $.el 'div', className: 'pagelist' $.extend @pagelist, <%= importHTML('Features/Index-pagelist') %> + $('.cataloglink a', @pagelist).href = if Conf['Use 4chan X Catalog'] then '#catalog' else "/#{g.BOARD}/catalog" @navLinks = $.el 'div', className: 'navLinks' $.extend @navLinks, <%= importHTML('Features/Index-navlinks') %> - $('.returnlink a', @navLinks).href = "//boards.4chan.org/#{g.BOARD}/" - $('.cataloglink a', @navLinks).href = "//boards.4chan.org/#{g.BOARD}/catalog" + $('.returnlink a', @navLinks).href = if Conf['Use 4chan X Catalog'] then '#index' else "/#{g.BOARD}/" + $('.cataloglink a', @navLinks).href = if Conf['Use 4chan X Catalog'] then '#catalog' else "/#{g.BOARD}/catalog" @searchInput = $ '#index-search', @navLinks @hideLabel = $ '#hidden-label', @navLinks @currentPage = @getCurrentPage() @@ -238,8 +247,8 @@ Index = Index.buildIndex() hashchange: (e) -> switch command = location.hash[1..] - when 'paged', 'infinite', 'all pages', 'catalog' - mode = command + when 'paged', 'infinite', 'all-pages', 'catalog' + mode = command.replace /-/g, ' ' when 'index' mode = Conf['Previous Index Mode'] if mode diff --git a/src/General/html/Features/Index-navlinks.html b/src/General/html/Features/Index-navlinks.html index 657978b5c..340331d5e 100644 --- a/src/General/html/Features/Index-navlinks.html +++ b/src/General/html/Features/Index-navlinks.html @@ -1,5 +1,5 @@ -Return -Catalog +Return +Catalog Bottom diff --git a/src/Miscellaneous/CatalogLinks.coffee b/src/Miscellaneous/CatalogLinks.coffee index 09f36ed06..8649a5e7c 100755 --- a/src/Miscellaneous/CatalogLinks.coffee +++ b/src/Miscellaneous/CatalogLinks.coffee @@ -24,7 +24,10 @@ CatalogLinks = CatalogLinks.set @checked set: (useCatalog) -> - path = if useCatalog then 'catalog' else '' + path = if useCatalog + if Conf['JSON Navigation'] and Conf['Use 4chan X Catalog'] then '#catalog' else 'catalog' + else + '' generateURL = if useCatalog and Conf['External Catalog'] CatalogLinks.external diff --git a/src/Miscellaneous/Keybinds.coffee b/src/Miscellaneous/Keybinds.coffee index c8577d57c..0293783f5 100755 --- a/src/Miscellaneous/Keybinds.coffee +++ b/src/Miscellaneous/Keybinds.coffee @@ -103,6 +103,9 @@ Keybinds = # Board Navigation when Conf['Front page'] if Conf['JSON Navigation'] and g.VIEW is 'index' + if Conf['Use 4chan X Catalog'] and Conf['Index Mode'] is 'catalog' + window.location = '#index' + return return unless Conf['Index Mode'] in ['paged', 'infinite'] Index.userPageNav 1 else @@ -134,7 +137,7 @@ Keybinds = if Conf['External Catalog'] window.location = CatalogLinks.external(g.BOARD.ID) else - window.location = "/#{g.BOARD}/catalog" + window.location = "/#{g.BOARD}/" + if Conf['JSON Navigation'] and Conf['Use 4chan X Catalog'] then '#catalog' else 'catalog' # Thread Navigation when Conf['Next thread'] return if g.VIEW isnt 'index' or !threadRoot From 14172c00f070bf1b5f6f29bc5f4d1339fdf3117b Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sat, 20 Sep 2014 18:26:14 -0700 Subject: [PATCH 73/74] fix index-only header links --- src/Miscellaneous/CatalogLinks.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Miscellaneous/CatalogLinks.coffee b/src/Miscellaneous/CatalogLinks.coffee index 8649a5e7c..cff23dfe8 100755 --- a/src/Miscellaneous/CatalogLinks.coffee +++ b/src/Miscellaneous/CatalogLinks.coffee @@ -34,7 +34,7 @@ CatalogLinks = else (board) -> a.href = "/#{board}/#{path}" - for a in $$ """#board-list a:not(.catalog), #boardNavDesktopFoot a""" + for a in $$ """#board-list a:not([data-only]), #boardNavDesktopFoot a""" continue if a.hostname not in ['boards.4chan.org', 'catalog.neet.tv', '4index.gropes.us'] or !(board = a.pathname.split('/')[1]) or board in ['f', 'status', '4chan'] or From ab4bf1ea3b495a1c04dc4c7a3bafd01f414ed39b Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sat, 20 Sep 2014 21:11:55 -0700 Subject: [PATCH 74/74] Move index sort to a Bump order') %> } - { el: $.el 'label', <%= html(' Last reply') %> } - { el: $.el 'label', <%= html(' Creation date') %> } - { el: $.el 'label', <%= html(' Reply count') %> } - { el: $.el 'label', <%= html(' File count') %> } - ] - for label in sortEntry.subEntries - input = label.el.firstChild - input.checked = Conf['Index Sort'] is input.value - $.on input, 'change', $.cb.value - $.on input, 'change', @cb.sort - repliesEntry = el: UI.checkbox 'Show Replies', ' Show replies' anchorEntry = el: UI.checkbox 'Anchor Hidden Threads', ' Anchor hidden threads' refNavEntry = el: UI.checkbox 'Refreshed Navigation', ' Refreshed navigation' @@ -81,7 +66,7 @@ Index = el: $.el 'span', textContent: 'Index Navigation' order: 98 - subEntries: [repliesEntry, anchorEntry, refNavEntry, modeEntry, sortEntry] + subEntries: [repliesEntry, anchorEntry, refNavEntry, modeEntry] $.addClass doc, 'index-loading', "#{Conf['Index Mode'].replace /\ /g, '-'}-mode" @root = $.el 'div', className: 'board' @@ -94,6 +79,7 @@ Index = $('.cataloglink a', @navLinks).href = if Conf['Use 4chan X Catalog'] then '#catalog' else "/#{g.BOARD}/catalog" @searchInput = $ '#index-search', @navLinks @hideLabel = $ '#hidden-label', @navLinks + @selectSort = $ '#index-sort', @navLinks @currentPage = @getCurrentPage() $.on window, 'popstate', @cb.popstate @@ -102,6 +88,9 @@ Index = $.on @searchInput, 'input', @onSearchInput $.on $('#index-search-clear', @navLinks), 'click', @clearSearch $.on $('#hidden-toggle a', @navLinks), 'click', @cb.toggleHiddenThreads + @selectSort.value = Conf[@selectSort.name] + $.on @selectSort, 'change', $.cb.value + $.on @selectSort, 'change', @cb.sort @update() $.asap (-> $('.board', doc) or d.readyState isnt 'loading'), -> diff --git a/src/General/css/style.css b/src/General/css/style.css index 726869e85..a328ca8e6 100755 --- a/src/General/css/style.css +++ b/src/General/css/style.css @@ -501,6 +501,9 @@ hr + div.center:not(.ad-cnt):not(.topad):not(.middlead):not(.bottomad) { #index-search:not([data-searching]) + #index-search-clear { display: none; } +#index-sort { + float: right; +} .summary { text-decoration: none; } diff --git a/src/General/html/Features/Index-navlinks.html b/src/General/html/Features/Index-navlinks.html index 340331d5e..11f3dff85 100644 --- a/src/General/html/Features/Index-navlinks.html +++ b/src/General/html/Features/Index-navlinks.html @@ -5,3 +5,11 @@ × +