From 154ad07cd7e57e2b5df0f1e829b273a379dc3a15 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sat, 25 Jan 2014 17:01:06 +0100 Subject: [PATCH 001/143] Initial index catalog mode work. --- css/style.css | 28 +++++++++++++++++ html/General/Thread-catalog-view.html | 8 +++++ src/General/Build.coffee | 44 +++++++++++++++++++++++++-- src/General/Index.coffee | 26 +++++++++++----- src/General/Thread.coffee | 4 +++ 5 files changed, 101 insertions(+), 9 deletions(-) create mode 100644 html/General/Thread-catalog-view.html diff --git a/css/style.css b/css/style.css index f697b45e2..8d23bde6c 100644 --- a/css/style.css +++ b/css/style.css @@ -401,6 +401,34 @@ a[href="javascript:;"] { .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; +} /* Announcement Hiding */ :root.hide-announcement #globalMessage, diff --git a/html/General/Thread-catalog-view.html b/html/General/Thread-catalog-view.html new file mode 100644 index 000000000..9592c56a0 --- /dev/null +++ b/html/General/Thread-catalog-view.html @@ -0,0 +1,8 @@ + + + +
+ #{postCount} / #{fileCount} / #{pageCount} +
+#{subject} +
#{comment}
diff --git a/src/General/Build.coffee b/src/General/Build.coffee index 6fa1278b8..ad1c14558 100644 --- a/src/General/Build.coffee +++ b/src/General/Build.coffee @@ -254,9 +254,49 @@ 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 $.add root, nodes root + threadCatalog: (thread) -> + for data in Index.liveThreadData + break if data.no is thread.ID + + if data.spoiler and !Conf['Reveal Spoilers'] + 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 = Math.floor Index.liveThreadIDs.indexOf(thread.ID) / Index.threadsNumPerPage + + subject = if thread.OP.info.subject + "
#{thread.OP.info.subject}
" + else + '' + comment = thread.OP.nodes.comment.innerHTML.replace /(
){2,}/g, '
' + + root = $.el 'div', + className: 'catalog-thread' + innerHTML: <%= importHTML('General/Thread-catalog-view') %> + + 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 79a935099..1d763746f 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -14,6 +14,7 @@ Index = subEntries: [ { el: $.el 'label', innerHTML: ' Paged' } { el: $.el 'label', innerHTML: ' All threads' } + { el: $.el 'label', innerHTML: ' Catalog' } ] for label in modeEntry.subEntries input = label.el.firstChild @@ -68,6 +69,7 @@ Index = $.addClass doc, 'index-loading' @update() @root = $.el 'div', className: 'board' + Index.cb.rootClass() @pagelist = $.el 'div', className: 'pagelist' hidden: true @@ -101,7 +103,10 @@ Index = $.replace $('.pagelist'), Index.pagelist 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: -> @@ -368,14 +373,21 @@ Index = Index.sortedNodes.splice offset++ * 2, 0, Index.sortedNodes.splice(i, 2)... return buildIndex: -> - if Conf['Index Mode'] is 'paged' - pageNum = Index.getCurrentPage() - nodesPerPage = Index.threadsNumPerPage * 2 - nodes = Index.sortedNodes[nodesPerPage * pageNum ... nodesPerPage * (pageNum + 1)] - else - nodes = Index.sortedNodes + switch Conf['Index Mode'] + when 'paged' + pageNum = Index.getCurrentPage() + nodesPerPage = Index.threadsNumPerPage * 2 + nodes = Index.sortedNodes[nodesPerPage * pageNum ... nodesPerPage * (pageNum + 1)] + when 'catalog' + nodes = Index.sortedNodes + .filter((n, i) -> !(i % 2)) + .map((threadRoot) -> Get.threadFromRoot threadRoot) + .filter((thread) -> !thread.isHidden) + .map (thread) -> thread.getCatalogView() + else + nodes = Index.sortedNodes $.rmAll Index.root - Index.buildReplies nodes if Conf['Show Replies'] + Index.buildReplies nodes if Conf['Show Replies'] and Conf['Index Mode'] isnt 'catalog' $.event 'IndexBuild', nodes $.add Index.root, nodes diff --git a/src/General/Thread.coffee b/src/General/Thread.coffee index 410a4288a..d7dd92fa3 100644 --- a/src/General/Thread.coffee +++ b/src/General/Thread.coffee @@ -39,6 +39,10 @@ class Thread $ '[title="Quote this post"]', @OP.nodes.info $.after root, [$.tn(' '), icon] + getCatalogView: -> + return @catalogView if @catalogView + @catalogView = Build.threadCatalog @ + kill: -> @isDead = true @timeOfDeath = Date.now() From 2024e0c50d943f5ceb5771d4924910dd3731f85b Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sat, 25 Jan 2014 19:00:26 +0100 Subject: [PATCH 002/143] Add sticky/closed status icons in the catalog. --- css/style.css | 23 +++++++++++++++++++++++ html/General/Thread-catalog-view.html | 3 ++- src/General/Build.coffee | 26 ++++++++++++++++++++------ 3 files changed, 45 insertions(+), 7 deletions(-) diff --git a/css/style.css b/css/style.css index 8d23bde6c..18a7a1e32 100644 --- a/css/style.css +++ b/css/style.css @@ -413,11 +413,34 @@ a[href="javascript:;"] { overflow: hidden; word-break: break-word; } +.catalog-thread > a { + display: inline-block; + position: relative; +} .thumb { max-width: 150px; max-height: 150px; box-shadow: 0 0 5px rgba(0, 0, 0, .25); } +.thunb.spoiler-file { + width: 100px; + height: 100px; +} +.thumb.deleted-file { + width: 127px; + height: 13px; + padding: 20px 11px; +} +.thumb.no-file { + width: 77px; + height: 13px; + padding: 20px 36px; +} +.thread-icons { + position: absolute; + top: 1px; + right: 1px; +} .thread-stats { cursor: help; font-size: 10px; diff --git a/html/General/Thread-catalog-view.html b/html/General/Thread-catalog-view.html index 9592c56a0..cf87775c9 100644 --- a/html/General/Thread-catalog-view.html +++ b/html/General/Thread-catalog-view.html @@ -1,5 +1,6 @@ - + +
#{postCount} / #{fileCount} / #{pageCount} diff --git a/src/General/Build.coffee b/src/General/Build.coffee index ad1c14558..def630799 100644 --- a/src/General/Build.coffee +++ b/src/General/Build.coffee @@ -260,25 +260,28 @@ Build = $.add root, nodes root threadCatalog: (thread) -> + {staticPath, gifIcon} = Build for data in Index.liveThreadData break if data.no is thread.ID if data.spoiler and !Conf['Reveal Spoilers'] - src = "#{Build.staticPath}spoiler" + src = "#{staticPath}spoiler" if spoilerRange = Build.spoilerRange[thread.board] # Randomize the spoiler image. src += "-#{thread.board}" + Math.floor 1 + spoilerRange * Math.random() src += '.png' - imgWidth = imgHeight = 100 + imgClass = 'spoiler-file' else if data.filedeleted - src = "#{Build.staticPath}filedeleted-res#{Build.gifIcon}" - imgWidth = 127 - imgHeight = 13 - else + src = "#{staticPath}filedeleted-res#{gifIcon}" + imgClass = 'deleted-file' + else if thread.OP.file src = thread.OP.file.thumbURL max = Math.max data.tn_w, data.tn_h imgWidth = data.tn_w * 150 / max imgHeight = data.tn_h * 150 / max + else + src = "#{staticPath}nofile.png" + imgClass = 'no-file' postCount = data.replies + 1 fileCount = data.images + !!data.ext @@ -294,6 +297,17 @@ Build = className: 'catalog-thread' innerHTML: <%= importHTML('General/Thread-catalog-view') %> + if thread.isSticky + $.add $('.thread-icons', root), $.el 'img', + src: "#{staticPath}sticky#{gifIcon}" + className: 'stickyIcon' + title: 'Sticky' + if thread.isClosed + $.add $('.thread-icons', root), $.el 'img', + src: "#{staticPath}closed#{gifIcon}" + className: 'closedIcon' + title: 'Closed' + if data.bumplimit $.addClass $('.post-count', root), 'warning' if data.imagelimit From d5f5349c63520a906c0938d68ac48bbc3feb7929 Mon Sep 17 00:00:00 2001 From: ParrotParrot <9bit.overflow@gmail.com> Date: Sat, 25 Jan 2014 20:10:24 +0100 Subject: [PATCH 003/143] Added %FNAME case to the HTML page --- html/General/Settings-section-Sauce.html | 1 + 1 file changed, 1 insertion(+) diff --git a/html/General/Settings-section-Sauce.html b/html/General/Settings-section-Sauce.html index b31017946..370b07142 100644 --- a/html/General/Settings-section-Sauce.html +++ b/html/General/Settings-section-Sauce.html @@ -5,6 +5,7 @@
  • %TURL: Thumbnail URL.
  • %URL: Full image URL.
  • %MD5: MD5 hash.
  • +
  • %FNAME: Original file name.
  • %board: Current board.
  • From 7a2faf861efe0984f5417fb555e9b462435b3228 Mon Sep 17 00:00:00 2001 From: ParrotParrot <9bit.overflow@gmail.com> Date: Sat, 25 Jan 2014 20:10:40 +0100 Subject: [PATCH 004/143] Added %FNAME case to link.replace switch --- src/Images/Sauce.coffee | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Images/Sauce.coffee b/src/Images/Sauce.coffee index b7ce89779..56a5abebc 100644 --- a/src/Images/Sauce.coffee +++ b/src/Images/Sauce.coffee @@ -15,7 +15,7 @@ Sauce = name: 'Sauce' cb: @node createSauceLink: (link) -> - link = link.replace /%(T?URL|MD5|board)/g, (parameter) -> + link = link.replace /%(T?URL|MD5|board|FNAME)/g, (parameter) -> switch parameter when '%TURL' "' + encodeURIComponent(post.file.thumbURL) + '" @@ -25,6 +25,8 @@ Sauce = "' + encodeURIComponent(post.file.MD5) + '" when '%board' "' + encodeURIComponent(post.board) + '" + when '%FNAME' + "' + encodeURIComponent(post.file.name) + '" else parameter text = if m = link.match(/;text:(.+)$/) then m[1] else link.match(/(\w+)\.\w+\//)[1] From 5752e082ab809068646d3e1bff437784b8d38487 Mon Sep 17 00:00:00 2001 From: ParrotParrot <9bit.overflow@gmail.com> Date: Sat, 25 Jan 2014 20:10:57 +0100 Subject: [PATCH 005/143] added %FNAME case to data.Conf.sauces I don't know what this actually does. Sounds stupid, but i only added a case because it's the only other place in the code that calls %URL and %TURL outside of HTML pages. Please review carefully. --- src/General/Settings.coffee | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/General/Settings.coffee b/src/General/Settings.coffee index 0d85a8d44..70d22171a 100644 --- a/src/General/Settings.coffee +++ b/src/General/Settings.coffee @@ -239,6 +239,8 @@ Settings = '%MD5' when '$4' '%board' + when '$5' + '%FNAME' else c for key, val of Config.hotkeys when key of data.Conf From 3d19f2ff11f7134be06372b8b124360179c8ab25 Mon Sep 17 00:00:00 2001 From: ParrotParrot <9bit.overflow@gmail.com> Date: Sat, 25 Jan 2014 20:30:24 +0100 Subject: [PATCH 006/143] %NAME is indeed better --- html/General/Settings-section-Sauce.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html/General/Settings-section-Sauce.html b/html/General/Settings-section-Sauce.html index 370b07142..d1b1555c6 100644 --- a/html/General/Settings-section-Sauce.html +++ b/html/General/Settings-section-Sauce.html @@ -5,7 +5,7 @@
  • %TURL: Thumbnail URL.
  • %URL: Full image URL.
  • %MD5: MD5 hash.
  • -
  • %FNAME: Original file name.
  • +
  • %NAME: Original file name.
  • %board: Current board.
  • From 1118b380265d2877d526362b366178b7d952b5b3 Mon Sep 17 00:00:00 2001 From: ParrotParrot <9bit.overflow@gmail.com> Date: Sat, 25 Jan 2014 20:30:55 +0100 Subject: [PATCH 007/143] Not Necessary --- src/General/Settings.coffee | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/General/Settings.coffee b/src/General/Settings.coffee index 70d22171a..0d85a8d44 100644 --- a/src/General/Settings.coffee +++ b/src/General/Settings.coffee @@ -239,8 +239,6 @@ Settings = '%MD5' when '$4' '%board' - when '$5' - '%FNAME' else c for key, val of Config.hotkeys when key of data.Conf From dbd4de88b1e64e3bb277fb48cc9f09fe58b33a05 Mon Sep 17 00:00:00 2001 From: ParrotParrot <9bit.overflow@gmail.com> Date: Sat, 25 Jan 2014 20:31:27 +0100 Subject: [PATCH 008/143] %NAME is indeed better --- src/Images/Sauce.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Images/Sauce.coffee b/src/Images/Sauce.coffee index 56a5abebc..a6c5da7ec 100644 --- a/src/Images/Sauce.coffee +++ b/src/Images/Sauce.coffee @@ -15,7 +15,7 @@ Sauce = name: 'Sauce' cb: @node createSauceLink: (link) -> - link = link.replace /%(T?URL|MD5|board|FNAME)/g, (parameter) -> + link = link.replace /%(T?URL|MD5|board|NAME)/g, (parameter) -> switch parameter when '%TURL' "' + encodeURIComponent(post.file.thumbURL) + '" @@ -25,7 +25,7 @@ Sauce = "' + encodeURIComponent(post.file.MD5) + '" when '%board' "' + encodeURIComponent(post.board) + '" - when '%FNAME' + when '%NAME' "' + encodeURIComponent(post.file.name) + '" else parameter From 7000c3c110cc69b718eec7e8ae6d762892a07b3b Mon Sep 17 00:00:00 2001 From: ParrotParrot <9bit.overflow@gmail.com> Date: Sat, 25 Jan 2014 20:34:45 +0100 Subject: [PATCH 009/143] changed to lowercase --- html/General/Settings-section-Sauce.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html/General/Settings-section-Sauce.html b/html/General/Settings-section-Sauce.html index d1b1555c6..c630955c4 100644 --- a/html/General/Settings-section-Sauce.html +++ b/html/General/Settings-section-Sauce.html @@ -5,7 +5,7 @@
  • %TURL: Thumbnail URL.
  • %URL: Full image URL.
  • %MD5: MD5 hash.
  • -
  • %NAME: Original file name.
  • +
  • %name: Original file name.
  • %board: Current board.
  • From 0aaa9af8cc5278e0b3fcf2e314d60818f96431eb Mon Sep 17 00:00:00 2001 From: ParrotParrot <9bit.overflow@gmail.com> Date: Sat, 25 Jan 2014 20:35:12 +0100 Subject: [PATCH 010/143] changed to lowercase --- src/Images/Sauce.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Images/Sauce.coffee b/src/Images/Sauce.coffee index a6c5da7ec..8e7f06e06 100644 --- a/src/Images/Sauce.coffee +++ b/src/Images/Sauce.coffee @@ -15,7 +15,7 @@ Sauce = name: 'Sauce' cb: @node createSauceLink: (link) -> - link = link.replace /%(T?URL|MD5|board|NAME)/g, (parameter) -> + link = link.replace /%(T?URL|MD5|board|name)/g, (parameter) -> switch parameter when '%TURL' "' + encodeURIComponent(post.file.thumbURL) + '" @@ -25,7 +25,7 @@ Sauce = "' + encodeURIComponent(post.file.MD5) + '" when '%board' "' + encodeURIComponent(post.board) + '" - when '%NAME' + when '%name' "' + encodeURIComponent(post.file.name) + '" else parameter From 985be3113d0bd2f4dc9e9aa83ae88b8d9747d2b9 Mon Sep 17 00:00:00 2001 From: ParrotParrot <9bit.overflow@gmail.com> Date: Sat, 25 Jan 2014 22:40:51 +0100 Subject: [PATCH 011/143] Added Original filename to Sauce --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f727a71bb..a2c95cd74 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,4 @@ +- Added `Original filename` variable to Sauce panel. - Added a `Reset Settings` button in the settings. ### 3.15.2 - *2014-01-22* From efd28e8ae42dba993dd48b425dce3c928160b7e6 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sun, 26 Jan 2014 17:02:55 +0100 Subject: [PATCH 012/143] Update page/sticky/closed status on index refresh for the catalog. --- src/General/Thread.coffee | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/General/Thread.coffee b/src/General/Thread.coffee index d7dd92fa3..0ab71f599 100644 --- a/src/General/Thread.coffee +++ b/src/General/Thread.coffee @@ -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 setStatus: (type, status) -> name = "is#{type}" return if @[name] is status @@ -25,20 +25,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="Quote 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 bdf2b4a6ba4a4396c035c9f3eaf0bc794a18d0ee Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sun, 26 Jan 2014 17:20:29 +0100 Subject: [PATCH 013/143] Update thread post/file count on index refresh in the catalog. --- src/General/Index.coffee | 2 ++ src/General/Thread.coffee | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/src/General/Index.coffee b/src/General/Index.coffee index 1d763746f..b86aa8ce2 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -294,6 +294,8 @@ Index = Index.nodes.push threadRoot, $.el 'hr' 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/Thread.coffee b/src/General/Thread.coffee index 0ab71f599..85a95ce05 100644 --- a/src/General/Thread.coffee +++ b/src/General/Thread.coffee @@ -17,6 +17,11 @@ class Thread for key in ['title', 'textContent'] icon[key] = icon[key].replace /\d+/, pageNum $('.page-count', @catalogView).textContent = pageNum if @catalogView + 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 76230405930496d8d294bddf688f7d11ec180516 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sun, 26 Jan 2014 18:19:23 +0100 Subject: [PATCH 014/143] Add filter-highlight to threads on the catalog. --- css/style.css | 4 ++++ src/Filtering/Filter.coffee | 1 + src/General/Build.coffee | 2 ++ 3 files changed, 7 insertions(+) diff --git a/css/style.css b/css/style.css index 18a7a1e32..41991048a 100644 --- a/css/style.css +++ b/css/style.css @@ -420,6 +420,7 @@ a[href="javascript:;"] { .thumb { max-width: 150px; max-height: 150px; + border-radius: 2px; box-shadow: 0 0 5px rgba(0, 0, 0, .25); } .thunb.spoiler-file { @@ -648,6 +649,9 @@ a.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); +} /* Thread & Reply Hiding */ .hide-thread-button, diff --git a/src/Filtering/Filter.coffee b/src/Filtering/Filter.coffee index eee0dfae9..f1362b48f 100644 --- a/src/Filtering/Filter.coffee +++ b/src/Filtering/Filter.coffee @@ -110,6 +110,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 def630799..82b51686e 100644 --- a/src/General/Build.coffee +++ b/src/General/Build.coffee @@ -297,6 +297,8 @@ Build = className: 'catalog-thread' innerHTML: <%= importHTML('General/Thread-catalog-view') %> + $.addClass root, thread.highlight if thread.highlight + if thread.isSticky $.add $('.thread-icons', root), $.el 'img', src: "#{staticPath}sticky#{gifIcon}" From 509156a95667f4b835808d9f1d804741b425a753 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sun, 26 Jan 2014 20:29:21 +0100 Subject: [PATCH 015/143] Don't use the IndexBuild event for hiding threads. --- src/Filtering/ThreadHiding.coffee | 6 +++--- src/General/Index.coffee | 2 +- src/Monitoring/ThreadWatcher.coffee | 3 +-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/Filtering/ThreadHiding.coffee b/src/Filtering/ThreadHiding.coffee index 6d5635201..b0ed6c60c 100644 --- a/src/Filtering/ThreadHiding.coffee +++ b/src/Filtering/ThreadHiding.coffee @@ -4,7 +4,7 @@ ThreadHiding = @db = new DataBoard 'hiddenThreads' @syncCatalog() - $.on d, 'IndexBuild', @onIndexBuild + $.on d, 'IndexRefresh', @onIndexRefresh Thread.callbacks.push name: 'Thread Hiding' cb: @node @@ -15,8 +15,8 @@ ThreadHiding = return unless Conf['Thread Hiding'] $.prepend @OP.nodes.root, ThreadHiding.makeButton @, 'hide' - onIndexBuild: ({detail: nodes}) -> - for root, i in nodes by 2 + onIndexRefresh: -> + for root, i in Index.nodes by 2 thread = Get.threadFromRoot root continue unless thread.isHidden unless thread.stub diff --git a/src/General/Index.coffee b/src/General/Index.coffee index b86aa8ce2..8b5a42320 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -390,8 +390,8 @@ Index = nodes = Index.sortedNodes $.rmAll Index.root Index.buildReplies nodes if Conf['Show Replies'] and Conf['Index Mode'] isnt 'catalog' - $.event 'IndexBuild', nodes $.add Index.root, nodes + $.event 'IndexBuild', nodes isSearching: false clearSearch: -> diff --git a/src/Monitoring/ThreadWatcher.coffee b/src/Monitoring/ThreadWatcher.coffee index 3eac7ae4c..ab570ebb0 100644 --- a/src/Monitoring/ThreadWatcher.coffee +++ b/src/Monitoring/ThreadWatcher.coffee @@ -72,9 +72,8 @@ ThreadWatcher = else if Conf['Auto Watch Reply'] ThreadWatcher.add board.threads[threadID] onIndexRefresh: -> - {db} = ThreadWatcher boardID = g.BOARD.ID - for threadID, data of db.data.boards[boardID] when not data.isDead and threadID not of g.BOARD.threads + for threadID, data of ThreadWatcher.db.data.boards[boardID] when not data.isDead and threadID not of g.BOARD.threads if Conf['Auto Prune'] ThreadWatcher.db.delete {boardID, threadID} else From 06e5ce4ef6a14ec8823c166f59a474ee7b8629de Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sun, 26 Jan 2014 21:25:18 +0100 Subject: [PATCH 016/143] It is now safe to use Node::remove. --- lib/$.coffee | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/lib/$.coffee b/lib/$.coffee index c50412cbf..3b39b3b30 100644 --- a/lib/$.coffee +++ b/lib/$.coffee @@ -99,16 +99,12 @@ $.rmClass = (el, className...) -> el.classList.remove className... $.hasClass = (el, className) -> el.classList.contains className -$.rm = do -> - if 'remove' of Element.prototype - (el) -> el.remove() - else - (el) -> el.parentNode?.removeChild el +$.rm = (el) -> + el.remove() $.rmAll = (root) -> # jsperf.com/emptify-element for node in [root.childNodes...] - # HTMLSelectElement.remove !== Element.remove - root.removeChild node + node.remove() return $.tn = (s) -> d.createTextNode s From a8002930f4e3250070c26fe8d142e7fa04bf78d5 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sun, 26 Jan 2014 22:18:29 +0100 Subject: [PATCH 017/143] Warn users of the official catalog of the incoming support removal. --- src/General/Index.coffee | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/General/Index.coffee b/src/General/Index.coffee index 8b5a42320..13be9c5d7 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -1,5 +1,15 @@ Index = init: -> + if g.VIEW is 'catalog' + $.ready -> + span = $.el 'a', + href: '<%= meta.repo %>blob/<%= meta.mainBranch %>/CHANGELOG.md' + textContent: 'Support for the official catalog to be removed' + title: '<%= meta.name %> now has a "catalog" Index mode.' + className: 'btn-wrap warning' + target: '_blank' + $.add $.id('info'), span + return if g.VIEW isnt 'index' or g.BOARD.ID is 'f' @button = $.el 'a', From fdca68fe38decd293f8f10d58157ac4910d3ad11 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Mon, 27 Jan 2014 11:21:32 +0100 Subject: [PATCH 018/143] Update $.rmAll according to a new benchmark. --- lib/$.coffee | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/$.coffee b/lib/$.coffee index 3b39b3b30..78e8f54f7 100644 --- a/lib/$.coffee +++ b/lib/$.coffee @@ -102,10 +102,8 @@ $.hasClass = (el, className) -> $.rm = (el) -> el.remove() $.rmAll = (root) -> - # jsperf.com/emptify-element - for node in [root.childNodes...] - node.remove() - return + # https://gist.github.com/MayhemYDG/8646194 + root.textContent = null $.tn = (s) -> d.createTextNode s $.nodes = (nodes) -> From 1d43fbc498f5f768d9de3ab7cb25987381b960c6 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Tue, 28 Jan 2014 09:59:49 +0100 Subject: [PATCH 019/143] Shift+click to hide threads in the catalog. --- src/Filtering/Filter.coffee | 3 ++- src/Filtering/ThreadHiding.coffee | 2 +- src/General/Build.coffee | 2 +- src/General/Thread.coffee | 11 +++++++++++ 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/Filtering/Filter.coffee b/src/Filtering/Filter.coffee index f1362b48f..b24b06238 100644 --- a/src/Filtering/Filter.coffee +++ b/src/Filtering/Filter.coffee @@ -110,7 +110,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 b0ed6c60c..155a94be1 100644 --- 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'] 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 82b51686e..b257ae628 100644 --- a/src/General/Build.coffee +++ b/src/General/Build.coffee @@ -297,7 +297,7 @@ Build = className: 'catalog-thread' innerHTML: <%= importHTML('General/Thread-catalog-view') %> - $.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/Thread.coffee b/src/General/Thread.coffee index 85a95ce05..0051c3f21 100644 --- a/src/General/Thread.coffee +++ b/src/General/Thread.coffee @@ -53,6 +53,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 9f682bea14388ac85cd33f2fb62b904e472e4549 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Tue, 28 Jan 2014 10:26:46 +0100 Subject: [PATCH 020/143] Alt+click to pin threads in the catalog. --- css/style.css | 1 + src/Filtering/Filter.coffee | 2 +- src/General/Build.coffee | 1 + src/General/DataBoard.coffee | 2 +- src/General/Index.coffee | 23 +++++++++++++++++++++++ src/General/Thread.coffee | 8 ++++++++ 6 files changed, 35 insertions(+), 2 deletions(-) diff --git a/css/style.css b/css/style.css index 41991048a..5abad3b16 100644 --- a/css/style.css +++ b/css/style.css @@ -649,6 +649,7 @@ a.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/Filtering/Filter.coffee b/src/Filtering/Filter.coffee index b24b06238..85c86d215 100644 --- a/src/Filtering/Filter.coffee +++ b/src/Filtering/Filter.coffee @@ -110,7 +110,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 b257ae628..cbcb86b06 100644 --- a/src/General/Build.coffee +++ b/src/General/Build.coffee @@ -297,6 +297,7 @@ Build = className: 'catalog-thread' innerHTML: <%= importHTML('General/Thread-catalog-view') %> + $.addClass root, 'pinned' if thread.isPinned $.addClass root, thread.OP.highlights... if thread.OP.highlights if thread.isSticky diff --git a/src/General/DataBoard.coffee b/src/General/DataBoard.coffee index aba14d68d..dc4319816 100644 --- a/src/General/DataBoard.coffee +++ b/src/General/DataBoard.coffee @@ -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/Index.coffee b/src/General/Index.coffee index 13be9c5d7..54386601b 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -12,6 +12,11 @@ Index = return if g.VIEW isnt 'index' or g.BOARD.ID is 'f' + @db = new DataBoard 'pinnedThreads' + Thread.callbacks.push + name: 'Thread Pinning' + cb: @node + @button = $.el 'a', className: 'index-refresh-shortcut fa fa-refresh' title: 'Refresh Index' @@ -112,6 +117,24 @@ Index = $.asap (-> $('.pagelist') or d.readyState isnt 'loading'), -> $.replace $('.pagelist'), Index.pagelist + 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/Thread.coffee b/src/General/Thread.coffee index 0051c3f21..3103d08f1 100644 --- a/src/General/Thread.coffee +++ b/src/General/Thread.coffee @@ -61,9 +61,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 a4ef601748778e8b6c4b3b79869e03d5b1da0e8e Mon Sep 17 00:00:00 2001 From: Mayhem Date: Wed, 29 Jan 2014 14:31:38 +0100 Subject: [PATCH 021/143] Refactor the catalog thread views business with a class. --- Gruntfile.coffee | 1 + src/General/Build.coffee | 6 ++--- src/General/CatalogThread.coffee | 14 ++++++++++++ src/General/Index.coffee | 38 ++++++++++++++++++++++++++------ src/General/Thread.coffee | 27 ++++++----------------- 5 files changed, 56 insertions(+), 30 deletions(-) create mode 100644 src/General/CatalogThread.coffee diff --git a/Gruntfile.coffee b/Gruntfile.coffee index c97e8e155..64a932158 100644 --- a/Gruntfile.coffee +++ b/Gruntfile.coffee @@ -40,6 +40,7 @@ module.exports = (grunt) -> # <--| 'src/General/Board.coffee' 'src/General/Thread.coffee' + 'src/General/CatalogThread.coffee' 'src/General/Post.coffee' 'src/General/Clone.coffee' 'src/General/DataBoard.coffee' diff --git a/src/General/Build.coffee b/src/General/Build.coffee index cbcb86b06..548cee44e 100644 --- a/src/General/Build.coffee +++ b/src/General/Build.coffee @@ -259,10 +259,9 @@ Build = $.add root, nodes root - 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 Spoilers'] src = "#{staticPath}spoiler" @@ -297,6 +296,7 @@ Build = className: 'catalog-thread' innerHTML: <%= importHTML('General/Thread-catalog-view') %> + 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/CatalogThread.coffee b/src/General/CatalogThread.coffee new file mode 100644 index 000000000..ae8f832d0 --- /dev/null +++ b/src/General/CatalogThread.coffee @@ -0,0 +1,14 @@ +class CatalogThread + @callbacks = [] + 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/Index.coffee b/src/General/Index.coffee index 54386601b..1ce167006 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -15,7 +15,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' @@ -117,9 +120,24 @@ Index = $.asap (-> $('.pagelist') or d.readyState isnt 'loading'), -> $.replace $('.pagelist'), Index.pagelist - 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() @@ -374,6 +392,16 @@ Index = Main.handleErrors errors if errors Main.callbackNodes Post, posts + buildCatalogViews: -> + threads = Index.sortedNodes + .filter((n, i) -> !(i % 2)) + .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: -> switch Conf['Index Sort'] when 'bump' @@ -414,11 +442,7 @@ Index = nodesPerPage = Index.threadsNumPerPage * 2 nodes = Index.sortedNodes[nodesPerPage * pageNum ... nodesPerPage * (pageNum + 1)] when 'catalog' - nodes = Index.sortedNodes - .filter((n, i) -> !(i % 2)) - .map((threadRoot) -> Get.threadFromRoot threadRoot) - .filter((thread) -> !thread.isHidden) - .map (thread) -> thread.getCatalogView() + nodes = Index.buildCatalogViews() else nodes = Index.sortedNodes $.rmAll Index.root diff --git a/src/General/Thread.coffee b/src/General/Thread.coffee index 3103d08f1..8037f09d2 100644 --- a/src/General/Thread.coffee +++ b/src/General/Thread.coffee @@ -10,16 +10,19 @@ class Thread @postLimit = false @fileLimit = false + @OP = null + @catalogView = null + g.threads[@fullID] = board.threads[@] = @ 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' setStatus: (type, status) -> @@ -50,28 +53,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 5383dbde05c6787729d108660c5ee66ee8c9600c Mon Sep 17 00:00:00 2001 From: Mayhem Date: Wed, 29 Jan 2014 14:48:52 +0100 Subject: [PATCH 022/143] 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 548cee44e..f5d81b137 100644 --- a/src/General/Build.coffee +++ b/src/General/Build.coffee @@ -300,6 +300,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 6dc91cfbdc3c2afd5c0ca1bc903bcf4a9db888dc Mon Sep 17 00:00:00 2001 From: Mayhem Date: Wed, 29 Jan 2014 15:01:29 +0100 Subject: [PATCH 023/143] Add Image Hover support in the catalog. Close #836 --- src/Images/ImageHover.coffee | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Images/ImageHover.coffee b/src/Images/ImageHover.coffee index 9494b0c71..f205c941c 100644 --- a/src/Images/ImageHover.coffee +++ b/src/Images/ImageHover.coffee @@ -5,11 +5,20 @@ ImageHover = Post.callbacks.push name: 'Image Hover' cb: @node + CatalogThread.callbacks.push + name: 'Image Hover' + cb: @catalogNode node: -> return unless @file?.isImage $.on @file.thumb, 'mouseover', ImageHover.mouseover + catalogNode: -> + return unless @thread.OP.file?.isImage + $.on @nodes.thumb, 'mouseover', ImageHover.mouseover mouseover: (e) -> - post = Get.postFromNode @ + post = if $.hasClass @, 'thumb' + g.posts[@parentNode.parentNode.dataset.fullID] + else + Get.postFromNode @ el = $.el 'img', id: 'ihover' src: post.file.URL From 10dfa74be0f0e0c9665fc41c1766942be41481bf Mon Sep 17 00:00:00 2001 From: Mayhem Date: Wed, 29 Jan 2014 15:16:12 +0100 Subject: [PATCH 024/143] Catalog changelog. --- CHANGELOG.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a2c95cd74..eab556a9b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,14 @@ +- More index navigation improvements: + - New index mode: `catalog` + - When in catalog mode, use `Shift+Click` to hide, and `Alt+Click` to pin threads. + - Existing features affect the catalog mode such as: +
      +
    • Filter (hiding, highlighting) +
    • Thread Hiding +
    • Linkify +
    • Image Hover +
    + - Support for the official catalog will be removed in the future, once the catalog mode for the index is deemed satisfactory. - Added `Original filename` variable to Sauce panel. - Added a `Reset Settings` button in the settings. From 44e28961fdd11d3ded0a002937e09c4dd76c0438 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Wed, 29 Jan 2014 15:22:46 +0100 Subject: [PATCH 025/143] Add Auto-GIF support in the catalog. --- CHANGELOG.md | 1 + src/Images/AutoGIF.coffee | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index eab556a9b..773f836d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@
  • Filter (hiding, highlighting)
  • Thread Hiding
  • Linkify +
  • Auto-GIF
  • Image Hover - Support for the official catalog will be removed in the future, once the catalog mode for the index is deemed satisfactory. diff --git a/src/Images/AutoGIF.coffee b/src/Images/AutoGIF.coffee index 71ccc7d8e..a80481407 100644 --- a/src/Images/AutoGIF.coffee +++ b/src/Images/AutoGIF.coffee @@ -5,6 +5,9 @@ AutoGIF = Post.callbacks.push name: 'Auto-GIF' cb: @node + CatalogThread.callbacks.push + name: 'Auto-GIF' + cb: @catalogNode node: -> return if @isClone or @isHidden or @thread.isHidden or !@file?.isImage {thumb, URL} = @file @@ -13,8 +16,17 @@ AutoGIF = # Revealed spoilers do not have height/width set, this fixes auto-gifs dimensions. {style} = thumb style.maxHeight = style.maxWidth = if @isReply then '125px' else '250px' + AutoGIF.replaceThumbnail thumb, URL + catalogNode: -> + {OP} = @thread + return unless OP.file?.isImage + {URL} = OP.file + return unless /gif$/.test URL + AutoGIF.replaceThumbnail @nodes.thumb, URL + replaceThumbnail: (thumb, URL) -> gif = $.el 'img' $.on gif, 'load', -> # Replace the thumbnail once the GIF has finished loading. thumb.src = URL gif.src = URL + From e95035a17fa0c0ca04d349d59cc3fb3950ecf56c Mon Sep 17 00:00:00 2001 From: Mayhem Date: Wed, 29 Jan 2014 15:38:20 +0100 Subject: [PATCH 026/143] Get rid of useless alt attributes. --- src/General/Build.coffee | 10 +++++----- src/General/Thread.coffee | 1 - 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/General/Build.coffee b/src/General/Build.coffee index f5d81b137..1a3efa7ed 100644 --- a/src/General/Build.coffee +++ b/src/General/Build.coffee @@ -110,18 +110,18 @@ Build = flag = unless flagCode '' else if boardID is 'pol' - " #{flagCode}" + " " else " " if file?.isDeleted fileHTML = if isOP "
    " + - "File deleted." + + "" + "
    " else "
    " + - "File deleted." + + "" + "
    " else if file fileSize = $.bytesToString file.size @@ -167,11 +167,11 @@ Build = fileHTML = '' sticky = if isSticky - " Sticky" + " " else '' closed = if isClosed - " Closed" + " " else '' diff --git a/src/General/Thread.coffee b/src/General/Thread.coffee index 8037f09d2..81acfc439 100644 --- a/src/General/Thread.coffee +++ b/src/General/Thread.coffee @@ -38,7 +38,6 @@ class Thread icon = $.el 'img', src: "#{Build.staticPath}#{typeLC}#{Build.gifIcon}" - alt: type title: type className: "#{typeLC}Icon" root = if type is 'Closed' and @isSticky From 1aa467b0518c85e59a93eed478d5603e6e15f058 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Wed, 29 Jan 2014 16:25:52 +0100 Subject: [PATCH 027/143] Remove all inline catalog-related code. --- html/General/Index-navlinks.html | 1 - html/General/Index-pagelist.html | 3 -- html/General/Settings-section-Rice.html | 3 -- src/Filtering/Filter.coffee | 4 +- src/Filtering/PostHiding.coffee | 4 +- src/Filtering/Recursive.coffee | 2 - src/Filtering/ThreadHiding.coffee | 49 ------------------------ src/General/Config.coffee | 1 - src/General/Header.coffee | 30 +-------------- src/General/Index.coffee | 11 ------ src/General/Main.coffee | 6 +-- src/General/Settings.coffee | 5 +-- src/Images/AutoGIF.coffee | 2 +- src/Images/ImageExpand.coffee | 4 +- src/Images/ImageHover.coffee | 2 +- src/Images/RevealSpoilers.coffee | 2 +- src/Images/Sauce.coffee | 2 +- src/Linkification/Linkify.coffee | 2 +- src/Menu/ArchiveLink.coffee | 2 +- src/Menu/DeleteLink.coffee | 2 +- src/Menu/DownloadLink.coffee | 2 +- src/Menu/Menu.coffee | 2 +- src/Menu/ReportLink.coffee | 2 +- src/Miscellaneous/Anonymize.coffee | 2 +- src/Miscellaneous/Dice.coffee | 2 +- src/Miscellaneous/FileInfo.coffee | 2 +- src/Miscellaneous/Fourchan.coffee | 2 - src/Miscellaneous/IDColor.coffee | 2 +- src/Miscellaneous/Keybinds.coffee | 2 +- src/Miscellaneous/Nav.coffee | 2 - src/Miscellaneous/Time.coffee | 2 +- src/Posting/QR.coffee | 2 +- src/Quotelinks/QuoteBacklink.coffee | 2 +- src/Quotelinks/QuoteCT.coffee | 2 +- src/Quotelinks/QuoteInline.coffee | 2 +- src/Quotelinks/QuoteOP.coffee | 2 +- src/Quotelinks/QuotePreview.coffee | 2 +- src/Quotelinks/QuoteStrikeThrough.coffee | 2 +- src/Quotelinks/QuoteYou.coffee | 2 +- src/Quotelinks/Quotify.coffee | 2 +- 40 files changed, 35 insertions(+), 142 deletions(-) diff --git a/html/General/Index-navlinks.html b/html/General/Index-navlinks.html index 7caf98685..1bd47c3cb 100644 --- a/html/General/Index-navlinks.html +++ b/html/General/Index-navlinks.html @@ -1,4 +1,3 @@ -[Catalog]  [ diff --git a/html/General/Index-pagelist.html b/html/General/Index-pagelist.html index fd5f4020b..e6923bb7a 100644 --- a/html/General/Index-pagelist.html +++ b/html/General/Index-pagelist.html @@ -9,6 +9,3 @@
  • - diff --git a/html/General/Settings-section-Rice.html b/html/General/Settings-section-Rice.html index 65ca4ffd7..43a9a8622 100644 --- a/html/General/Settings-section-Rice.html +++ b/html/General/Settings-section-Rice.html @@ -7,9 +7,6 @@
    Board link (Replace with title when on that board): board-replace
    Full text link: board-full
    Custom text link: board-text:"VIP Board"
    -
    Index-only link: board-index
    -
    Catalog-only link: board-catalog
    -
    Combinations are possible: board-index-text:"VIP Index"
    Full board list toggle: toggle-all
    diff --git a/src/Filtering/Filter.coffee b/src/Filtering/Filter.coffee index 85c86d215..62abf61c3 100644 --- a/src/Filtering/Filter.coffee +++ b/src/Filtering/Filter.coffee @@ -1,7 +1,7 @@ Filter = filters: {} init: -> - return if g.VIEW is 'catalog' or !Conf['Filter'] + return if !Conf['Filter'] for key of Config.filter @filters[key] = [] @@ -166,7 +166,7 @@ Filter = menu: init: -> - return if g.VIEW is 'catalog' or !Conf['Menu'] or !Conf['Filter'] + return if !Conf['Menu'] or !Conf['Filter'] div = $.el 'div', textContent: 'Filter' diff --git a/src/Filtering/PostHiding.coffee b/src/Filtering/PostHiding.coffee index 122a7c8c4..ed621d194 100644 --- a/src/Filtering/PostHiding.coffee +++ b/src/Filtering/PostHiding.coffee @@ -1,6 +1,6 @@ PostHiding = init: -> - return if g.VIEW is 'catalog' or !Conf['Reply Hiding'] and !Conf['Reply Hiding Link'] + return if !Conf['Reply Hiding'] and !Conf['Reply Hiding Link'] @db = new DataBoard 'hiddenPosts' Post.callbacks.push @@ -20,7 +20,7 @@ PostHiding = menu: init: -> - return if g.VIEW is 'catalog' or !Conf['Menu'] or !Conf['Reply Hiding Link'] + return if !Conf['Menu'] or !Conf['Reply Hiding Link'] # Hide div = $.el 'div', diff --git a/src/Filtering/Recursive.coffee b/src/Filtering/Recursive.coffee index da5496ceb..51d7a406b 100644 --- a/src/Filtering/Recursive.coffee +++ b/src/Filtering/Recursive.coffee @@ -1,8 +1,6 @@ Recursive = recursives: {} init: -> - return if g.VIEW is 'catalog' - Post.callbacks.push name: 'Recursive' cb: @node diff --git a/src/Filtering/ThreadHiding.coffee b/src/Filtering/ThreadHiding.coffee index 155a94be1..03d8ae635 100644 --- a/src/Filtering/ThreadHiding.coffee +++ b/src/Filtering/ThreadHiding.coffee @@ -3,7 +3,6 @@ ThreadHiding = return if g.VIEW isnt 'index' @db = new DataBoard 'hiddenThreads' - @syncCatalog() $.on d, 'IndexRefresh', @onIndexRefresh Thread.callbacks.push name: 'Thread Hiding' @@ -26,50 +25,6 @@ ThreadHiding = ThreadHiding.makeStub thread, root return - syncCatalog: -> - # Sync hidden threads from the catalog into the index. - hiddenThreads = ThreadHiding.db.get - boardID: g.BOARD.ID - defaultValue: {} - hiddenThreadsOnCatalog = JSON.parse(localStorage.getItem "4chan-hide-t-#{g.BOARD}") or {} - - # Add threads that were hidden in the catalog. - for threadID of hiddenThreadsOnCatalog - unless threadID of hiddenThreads - hiddenThreads[threadID] = {} - - # Remove threads that were un-hidden in the catalog. - for threadID of hiddenThreads - unless threadID of hiddenThreadsOnCatalog - delete hiddenThreads[threadID] - - if (ThreadHiding.db.data.lastChecked or 0) > Date.now() - $.MINUTE - # Was cleaned just now. - ThreadHiding.cleanCatalog hiddenThreadsOnCatalog - - unless Object.keys(hiddenThreads).length - ThreadHiding.db.delete boardID: g.BOARD.ID - return - ThreadHiding.db.set - boardID: g.BOARD.ID - val: hiddenThreads - - cleanCatalog: (hiddenThreadsOnCatalog) -> - # We need to clean hidden threads on the catalog ourselves, - # otherwise if we don't visit the catalog regularly - # it will pollute the localStorage and our data. - $.cache "//a.4cdn.org/#{g.BOARD}/threads.json", -> - return unless @status is 200 - threads = {} - for page in @response - for thread in page.threads - if thread.no of hiddenThreadsOnCatalog - threads[thread.no] = hiddenThreadsOnCatalog[thread.no] - if Object.keys(threads).length - localStorage.setItem "4chan-hide-t-#{g.BOARD}", JSON.stringify threads - else - localStorage.removeItem "4chan-hide-t-#{g.BOARD}" - menu: init: -> return if g.VIEW isnt 'index' or !Conf['Menu'] or !Conf['Thread Hiding Link'] @@ -130,19 +85,15 @@ ThreadHiding = $.prepend root, thread.stub saveHiddenState: (thread, makeStub) -> - hiddenThreadsOnCatalog = JSON.parse(localStorage.getItem "4chan-hide-t-#{g.BOARD}") or {} if thread.isHidden ThreadHiding.db.set boardID: thread.board.ID threadID: thread.ID val: {makeStub} - hiddenThreadsOnCatalog[thread] = true else ThreadHiding.db.delete boardID: thread.board.ID threadID: thread.ID - delete hiddenThreadsOnCatalog[thread] - localStorage.setItem "4chan-hide-t-#{g.BOARD}", JSON.stringify hiddenThreadsOnCatalog toggle: (thread) -> unless thread instanceof Thread diff --git a/src/General/Config.coffee b/src/General/Config.coffee index 14b665337..06322f331 100644 --- a/src/General/Config.coffee +++ b/src/General/Config.coffee @@ -149,7 +149,6 @@ Config = 'Header auto-hide': false 'Header auto-hide on scroll': false 'Bottom header': false - 'Header catalog links': false 'Top Board List': false 'Bottom Board List': false 'Custom Board Navigation': true diff --git a/src/General/Header.coffee b/src/General/Header.coffee index e97fcdf0f..6572b1146 100644 --- a/src/General/Header.coffee +++ b/src/General/Header.coffee @@ -25,8 +25,6 @@ Header = innerHTML: ' Auto-hide header on scroll' barPositionToggler = $.el 'label', innerHTML: ' Bottom header' - catalogToggler = $.el 'label', - innerHTML: ' Use catalog board links' topBoardToggler = $.el 'label', innerHTML: ' Top original board list' botBoardToggler = $.el 'label', @@ -40,7 +38,6 @@ Header = @headerToggler = headerToggler.firstElementChild @scrollHeaderToggler = scrollHeaderToggler.firstElementChild @barPositionToggler = barPositionToggler.firstElementChild - @catalogToggler = catalogToggler.firstElementChild @topBoardToggler = topBoardToggler.firstElementChild @botBoardToggler = botBoardToggler.firstElementChild @customNavToggler = customNavToggler.firstElementChild @@ -48,7 +45,6 @@ Header = $.on @headerToggler, 'change', @toggleBarVisibility $.on @scrollHeaderToggler, 'change', @toggleHideBarOnScroll $.on @barPositionToggler, 'change', @toggleBarPosition - $.on @catalogToggler, 'change', @toggleCatalogLinks $.on @topBoardToggler, 'change', @toggleOriginalBoardList $.on @botBoardToggler, 'change', @toggleOriginalBoardList $.on @customNavToggler, 'change', @toggleCustomNav @@ -74,7 +70,6 @@ Header = {el: headerToggler} {el: scrollHeaderToggler} {el: barPositionToggler} - {el: catalogToggler} {el: topBoardToggler} {el: botBoardToggler} {el: customNavToggler} @@ -92,9 +87,6 @@ Header = if a = $ "a[href*='/#{g.BOARD}/']", $.id 'boardNavDesktopFoot' a.className = 'current' - Header.setCatalogLinks Conf['Header catalog links'] - $.sync 'Header catalog links', Header.setCatalogLinks - @enableDesktopNotifications() setBoardList: -> @@ -121,7 +113,7 @@ Header = $.rmAll list return unless text as = $$ '#full-board-list a[title]', Header.bar - nodes = text.match(/[\w@]+(-(all|title|replace|full|index|catalog|text:"[^"]+"))*|[^\w@]+/g).map (t) -> + nodes = text.match(/[\w@]+(-(all|title|replace|full|text:"[^"]+"))*|[^\w@]+/g).map (t) -> if /^[^\w@]/.test t return $.tn t if /^toggle-all/.test t @@ -148,11 +140,6 @@ Header = else a.textContent - if m = t.match /-(index|catalog)/ - a.dataset.only = m[1] - a.href = "//boards.4chan.org/#{board}/" - a.href += 'catalog' if m[1] is 'catalog' - $.addClass a, 'navSmall' if board is '@' return a $.tn t @@ -219,21 +206,6 @@ Header = $.cb.checked.call @ Header.setBarPosition @checked - setCatalogLinks: (useCatalog) -> - Header.catalogToggler.checked = useCatalog - as = $$ [ - '#board-list a' - '#boardNavDesktop a' - '#boardNavDesktopFoot a' - ].join ', ' - path = if useCatalog then 'catalog' else '' - for a in as when a.hostname is 'boards.4chan.org' and not a.dataset.only - a.pathname = "/#{a.pathname.split('/')[1]}/#{path}" - return - toggleCatalogLinks: -> - $.cb.checked.call @ - Header.setCatalogLinks @checked - setTopBoardList: (show) -> Header.topBoardToggler.checked = show if show diff --git a/src/General/Index.coffee b/src/General/Index.coffee index 1ce167006..df3545264 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -1,15 +1,5 @@ Index = init: -> - if g.VIEW is 'catalog' - $.ready -> - span = $.el 'a', - href: '<%= meta.repo %>blob/<%= meta.mainBranch %>/CHANGELOG.md' - textContent: 'Support for the official catalog to be removed' - title: '<%= meta.name %> now has a "catalog" Index mode.' - className: 'btn-wrap warning' - target: '_blank' - $.add $.id('info'), span - return if g.VIEW isnt 'index' or g.BOARD.ID is 'f' @db = new DataBoard 'pinnedThreads' @@ -179,7 +169,6 @@ Index = a = e.target else return - return if a.textContent is 'Catalog' e.preventDefault() Index.userPageNav +a.pathname.split('/')[2] diff --git a/src/General/Main.coffee b/src/General/Main.coffee index 254d2cba4..d8dc3014b 100644 --- a/src/General/Main.coffee +++ b/src/General/Main.coffee @@ -11,6 +11,8 @@ Main = 'catalog' else 'index' + if g.VIEW is 'catalog' + return if g.VIEW is 'thread' g.THREADID = +pathname[3] @@ -131,10 +133,6 @@ Main = $.addClass doc, 'fourchan-x', '<% if (type === 'crx') { %>blink<% } else { %>gecko<% } %>' $.addStyle Main.css - if g.VIEW is 'catalog' - $.addClass doc, $.id('base-css').href.match(/catalog_(\w+)/)[1].replace('_new', '').replace /_+/g, '-' - return - style = 'yotsuba-b' mainStyleSheet = $ 'link[title=switch]', d.head styleSheets = $$ 'link[rel="alternate stylesheet"]', d.head diff --git a/src/General/Settings.coffee b/src/General/Settings.coffee index 0d85a8d44..3359a82db 100644 --- a/src/General/Settings.coffee +++ b/src/General/Settings.coffee @@ -133,10 +133,7 @@ Settings = button.textContent = "Hidden: #{hiddenNum}" $.on button, 'click', -> @textContent = 'Hidden: 0' - $.get 'hiddenThreads', {}, ({hiddenThreads}) -> - for boardID of hiddenThreads.boards - localStorage.removeItem "4chan-hide-t-#{boardID}" - $.delete ['hiddenThreads', 'hiddenPosts'] + $.delete ['hiddenThreads', 'hiddenPosts'] $.after $('input[name="Stubs"]', section).parentNode.parentNode, div export: -> # Make sure to export the most recent data. diff --git a/src/Images/AutoGIF.coffee b/src/Images/AutoGIF.coffee index a80481407..25907deb5 100644 --- a/src/Images/AutoGIF.coffee +++ b/src/Images/AutoGIF.coffee @@ -1,6 +1,6 @@ AutoGIF = init: -> - return if g.VIEW is 'catalog' or !Conf['Auto-GIF'] or g.BOARD.ID in ['gif', 'wsg'] + return if !Conf['Auto-GIF'] or g.BOARD.ID in ['gif', 'wsg'] Post.callbacks.push name: 'Auto-GIF' diff --git a/src/Images/ImageExpand.coffee b/src/Images/ImageExpand.coffee index 13816680c..29f72cfa1 100644 --- a/src/Images/ImageExpand.coffee +++ b/src/Images/ImageExpand.coffee @@ -1,6 +1,6 @@ ImageExpand = init: -> - return if g.VIEW is 'catalog' or !Conf['Image Expansion'] + return if !Conf['Image Expansion'] @EAI = $.el 'a', className: 'expand-all-shortcut fa fa-expand' @@ -156,7 +156,7 @@ ImageExpand = menu: init: -> - return if g.VIEW is 'catalog' or !Conf['Image Expansion'] + return if !Conf['Image Expansion'] el = $.el 'span', textContent: 'Image Expansion' diff --git a/src/Images/ImageHover.coffee b/src/Images/ImageHover.coffee index f205c941c..25363da5e 100644 --- a/src/Images/ImageHover.coffee +++ b/src/Images/ImageHover.coffee @@ -1,6 +1,6 @@ ImageHover = init: -> - return if g.VIEW is 'catalog' or !Conf['Image Hover'] + return if !Conf['Image Hover'] Post.callbacks.push name: 'Image Hover' diff --git a/src/Images/RevealSpoilers.coffee b/src/Images/RevealSpoilers.coffee index 52f7dffe6..1d925ce91 100644 --- a/src/Images/RevealSpoilers.coffee +++ b/src/Images/RevealSpoilers.coffee @@ -1,6 +1,6 @@ RevealSpoilers = init: -> - return if g.VIEW is 'catalog' or !Conf['Reveal Spoilers'] + return if !Conf['Reveal Spoilers'] Post.callbacks.push name: 'Reveal Spoilers' diff --git a/src/Images/Sauce.coffee b/src/Images/Sauce.coffee index 8e7f06e06..e2854b23c 100644 --- a/src/Images/Sauce.coffee +++ b/src/Images/Sauce.coffee @@ -1,6 +1,6 @@ Sauce = init: -> - return if g.VIEW is 'catalog' or !Conf['Sauce'] + return if !Conf['Sauce'] links = [] for link in Conf['sauces'].split '\n' diff --git a/src/Linkification/Linkify.coffee b/src/Linkification/Linkify.coffee index fd90879e6..bad4bedc1 100644 --- a/src/Linkification/Linkify.coffee +++ b/src/Linkification/Linkify.coffee @@ -1,6 +1,6 @@ Linkify = init: -> - return if g.VIEW is 'catalog' or !Conf['Linkify'] + return if !Conf['Linkify'] # gruber revised + magnet support # http://df4.us/fv9 diff --git a/src/Menu/ArchiveLink.coffee b/src/Menu/ArchiveLink.coffee index f691d6f95..88ecc21b5 100644 --- a/src/Menu/ArchiveLink.coffee +++ b/src/Menu/ArchiveLink.coffee @@ -1,6 +1,6 @@ ArchiveLink = init: -> - return if g.VIEW is 'catalog' or !Conf['Menu'] or !Conf['Archive Link'] + return if !Conf['Menu'] or !Conf['Archive Link'] div = $.el 'div', textContent: 'Archive' diff --git a/src/Menu/DeleteLink.coffee b/src/Menu/DeleteLink.coffee index 1805047f8..c79f24c98 100644 --- a/src/Menu/DeleteLink.coffee +++ b/src/Menu/DeleteLink.coffee @@ -1,6 +1,6 @@ DeleteLink = init: -> - return if g.VIEW is 'catalog' or !Conf['Menu'] or !Conf['Delete Link'] + return if !Conf['Menu'] or !Conf['Delete Link'] div = $.el 'div', className: 'delete-link' diff --git a/src/Menu/DownloadLink.coffee b/src/Menu/DownloadLink.coffee index 4dcc043f0..a93cfd8c0 100644 --- a/src/Menu/DownloadLink.coffee +++ b/src/Menu/DownloadLink.coffee @@ -1,6 +1,6 @@ DownloadLink = init: -> - return if g.VIEW is 'catalog' or !Conf['Menu'] or !Conf['Download Link'] + return if !Conf['Menu'] or !Conf['Download Link'] a = $.el 'a', className: 'download-link' diff --git a/src/Menu/Menu.coffee b/src/Menu/Menu.coffee index 23fb2ce91..134f6ec1e 100644 --- a/src/Menu/Menu.coffee +++ b/src/Menu/Menu.coffee @@ -1,6 +1,6 @@ Menu = init: -> - return if g.VIEW is 'catalog' or !Conf['Menu'] + return if !Conf['Menu'] @menu = new UI.Menu 'post' Post.callbacks.push diff --git a/src/Menu/ReportLink.coffee b/src/Menu/ReportLink.coffee index 435006c6d..c246c903f 100644 --- a/src/Menu/ReportLink.coffee +++ b/src/Menu/ReportLink.coffee @@ -1,6 +1,6 @@ ReportLink = init: -> - return if g.VIEW is 'catalog' or !Conf['Menu'] or !Conf['Report Link'] + return if !Conf['Menu'] or !Conf['Report Link'] a = $.el 'a', className: 'report-link' diff --git a/src/Miscellaneous/Anonymize.coffee b/src/Miscellaneous/Anonymize.coffee index 414c428e5..5b9f4e6a1 100644 --- a/src/Miscellaneous/Anonymize.coffee +++ b/src/Miscellaneous/Anonymize.coffee @@ -1,6 +1,6 @@ Anonymize = init: -> - return if g.VIEW is 'catalog' or !Conf['Anonymize'] + return if !Conf['Anonymize'] Post.callbacks.push name: 'Anonymize' diff --git a/src/Miscellaneous/Dice.coffee b/src/Miscellaneous/Dice.coffee index d02698344..8729d9faf 100644 --- a/src/Miscellaneous/Dice.coffee +++ b/src/Miscellaneous/Dice.coffee @@ -1,6 +1,6 @@ Dice = init: -> - return if g.BOARD.ID isnt 'tg' or g.VIEW is 'catalog' or !Conf['Show Dice Roll'] + return if g.BOARD.ID isnt 'tg' or !Conf['Show Dice Roll'] Post.callbacks.push name: 'Show Dice Roll' cb: @node diff --git a/src/Miscellaneous/FileInfo.coffee b/src/Miscellaneous/FileInfo.coffee index e58f9faef..0534b2c33 100644 --- a/src/Miscellaneous/FileInfo.coffee +++ b/src/Miscellaneous/FileInfo.coffee @@ -1,6 +1,6 @@ FileInfo = init: -> - return if g.VIEW is 'catalog' or !Conf['File Info Formatting'] + return if !Conf['File Info Formatting'] @funk = @createFunc Conf['fileInfo'] Post.callbacks.push diff --git a/src/Miscellaneous/Fourchan.coffee b/src/Miscellaneous/Fourchan.coffee index 6f290d662..ff904ecb2 100644 --- a/src/Miscellaneous/Fourchan.coffee +++ b/src/Miscellaneous/Fourchan.coffee @@ -1,7 +1,5 @@ Fourchan = init: -> - return if g.VIEW is 'catalog' - board = g.BOARD.ID if board is 'g' $.globalEval """ diff --git a/src/Miscellaneous/IDColor.coffee b/src/Miscellaneous/IDColor.coffee index 1fbdd5718..4ce769ad7 100644 --- a/src/Miscellaneous/IDColor.coffee +++ b/src/Miscellaneous/IDColor.coffee @@ -1,6 +1,6 @@ IDColor = init: -> - return if g.VIEW is 'catalog' or !Conf['Color User IDs'] + return if !Conf['Color User IDs'] @ids = {} Post.callbacks.push diff --git a/src/Miscellaneous/Keybinds.coffee b/src/Miscellaneous/Keybinds.coffee index c158cb183..6fd4de92c 100644 --- a/src/Miscellaneous/Keybinds.coffee +++ b/src/Miscellaneous/Keybinds.coffee @@ -1,6 +1,6 @@ Keybinds = init: -> - return if g.VIEW is 'catalog' or !Conf['Keybinds'] + return if !Conf['Keybinds'] for hotkey of Conf.hotkeys $.sync hotkey, Keybinds.sync diff --git a/src/Miscellaneous/Nav.coffee b/src/Miscellaneous/Nav.coffee index 659cce4e1..0c93cc2d5 100644 --- a/src/Miscellaneous/Nav.coffee +++ b/src/Miscellaneous/Nav.coffee @@ -5,8 +5,6 @@ Nav = return unless Conf['Index Navigation'] when 'thread' return unless Conf['Reply Navigation'] - else # catalog - return span = $.el 'span', id: 'navlinks' diff --git a/src/Miscellaneous/Time.coffee b/src/Miscellaneous/Time.coffee index 60239f627..4bb2b4919 100644 --- a/src/Miscellaneous/Time.coffee +++ b/src/Miscellaneous/Time.coffee @@ -1,6 +1,6 @@ Time = init: -> - return if g.VIEW is 'catalog' or !Conf['Time Formatting'] + return if !Conf['Time Formatting'] @funk = @createFunc Conf['time'] Post.callbacks.push diff --git a/src/Posting/QR.coffee b/src/Posting/QR.coffee index 2eed475ff..9b5f92aba 100644 --- a/src/Posting/QR.coffee +++ b/src/Posting/QR.coffee @@ -57,7 +57,7 @@ QR = persist: -> QR.open() - QR.hide() if Conf['Auto-Hide QR'] or g.VIEW is 'catalog' + QR.hide() if Conf['Auto-Hide QR'] open: -> if QR.nodes QR.nodes.el.hidden = false diff --git a/src/Quotelinks/QuoteBacklink.coffee b/src/Quotelinks/QuoteBacklink.coffee index cb407e50e..5383e1dfd 100644 --- a/src/Quotelinks/QuoteBacklink.coffee +++ b/src/Quotelinks/QuoteBacklink.coffee @@ -11,7 +11,7 @@ QuoteBacklink = # This is is so that fetched posts can get their backlinks, # and that as much backlinks are appended in the background as possible. init: -> - return if g.VIEW is 'catalog' or !Conf['Quote Backlinks'] + return if !Conf['Quote Backlinks'] format = Conf['backlink'].replace /%id/g, "' + id + '" @funk = Function 'id', "return '#{format}'" diff --git a/src/Quotelinks/QuoteCT.coffee b/src/Quotelinks/QuoteCT.coffee index 9ba959acd..62735db26 100644 --- a/src/Quotelinks/QuoteCT.coffee +++ b/src/Quotelinks/QuoteCT.coffee @@ -1,6 +1,6 @@ QuoteCT = init: -> - return if g.VIEW is 'catalog' or !Conf['Mark Cross-thread Quotes'] + return if !Conf['Mark Cross-thread Quotes'] # \u00A0 is nbsp @text = '\u00A0(Cross-thread)' diff --git a/src/Quotelinks/QuoteInline.coffee b/src/Quotelinks/QuoteInline.coffee index 526bf75fc..b61aa5af3 100644 --- a/src/Quotelinks/QuoteInline.coffee +++ b/src/Quotelinks/QuoteInline.coffee @@ -1,6 +1,6 @@ QuoteInline = init: -> - return if g.VIEW is 'catalog' or !Conf['Quote Inlining'] + return if !Conf['Quote Inlining'] Post.callbacks.push name: 'Quote Inlining' diff --git a/src/Quotelinks/QuoteOP.coffee b/src/Quotelinks/QuoteOP.coffee index 4e80520ff..65e468fe9 100644 --- a/src/Quotelinks/QuoteOP.coffee +++ b/src/Quotelinks/QuoteOP.coffee @@ -1,6 +1,6 @@ QuoteOP = init: -> - return if g.VIEW is 'catalog' or !Conf['Mark OP Quotes'] + return if !Conf['Mark OP Quotes'] # \u00A0 is nbsp @text = '\u00A0(OP)' diff --git a/src/Quotelinks/QuotePreview.coffee b/src/Quotelinks/QuotePreview.coffee index 1b1694344..d138cdd81 100644 --- a/src/Quotelinks/QuotePreview.coffee +++ b/src/Quotelinks/QuotePreview.coffee @@ -1,6 +1,6 @@ QuotePreview = init: -> - return if g.VIEW is 'catalog' or !Conf['Quote Previewing'] + return if !Conf['Quote Previewing'] Post.callbacks.push name: 'Quote Previewing' diff --git a/src/Quotelinks/QuoteStrikeThrough.coffee b/src/Quotelinks/QuoteStrikeThrough.coffee index b24273322..bf3120516 100644 --- a/src/Quotelinks/QuoteStrikeThrough.coffee +++ b/src/Quotelinks/QuoteStrikeThrough.coffee @@ -1,6 +1,6 @@ QuoteStrikeThrough = init: -> - return if g.VIEW is 'catalog' or !Conf['Reply Hiding'] and !Conf['Reply Hiding Link'] and !Conf['Filter'] + return if !Conf['Reply Hiding'] and !Conf['Reply Hiding Link'] and !Conf['Filter'] Post.callbacks.push name: 'Strike-through Quotes' diff --git a/src/Quotelinks/QuoteYou.coffee b/src/Quotelinks/QuoteYou.coffee index 4f7219149..a480916a8 100644 --- a/src/Quotelinks/QuoteYou.coffee +++ b/src/Quotelinks/QuoteYou.coffee @@ -1,6 +1,6 @@ QuoteYou = init: -> - return if g.VIEW is 'catalog' or !Conf['Mark Quotes of You'] or !Conf['Quick Reply'] + return if !Conf['Mark Quotes of You'] or !Conf['Quick Reply'] # \u00A0 is nbsp @text = '\u00A0(You)' diff --git a/src/Quotelinks/Quotify.coffee b/src/Quotelinks/Quotify.coffee index 0b7503b94..0cd5bbcea 100644 --- a/src/Quotelinks/Quotify.coffee +++ b/src/Quotelinks/Quotify.coffee @@ -1,6 +1,6 @@ Quotify = init: -> - return if g.VIEW is 'catalog' or !Conf['Resurrect Quotes'] + return if !Conf['Resurrect Quotes'] Post.callbacks.push name: 'Resurrect Quotes' From b05fa8159f990c0d7ba5548842ee3113b0ade44d Mon Sep 17 00:00:00 2001 From: Mayhem Date: Wed, 29 Jan 2014 16:40:34 +0100 Subject: [PATCH 028/143] Remove [Catalog] links in threads. --- css/style.css | 5 +++++ src/General/Index.coffee | 13 ++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/css/style.css b/css/style.css index 5abad3b16..9fe79e071 100644 --- a/css/style.css +++ b/css/style.css @@ -378,6 +378,11 @@ a[href="javascript:;"] { :root.index-loading .pagelist { display: none; } +:root.removing-catalog-links .navLinks { + /* can't `display:none;` the text node next to the link, + so we hide the container instead. */ + visibility: hidden; +} #index-search { padding-right: 1.5em; width: 100px; diff --git a/src/General/Index.coffee b/src/General/Index.coffee index df3545264..0f3ff07f5 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -1,6 +1,10 @@ Index = init: -> - return if g.VIEW isnt 'index' or g.BOARD.ID is 'f' + if g.VIEW isnt 'index' + @rmCatalogLinks() + return + return if g.BOARD.ID is 'f' + @db = new DataBoard 'pinnedThreads' Thread.callbacks.push @@ -142,6 +146,13 @@ Index = val: isPinned: thread.isPinned Index.sort() Index.buildIndex() + rmCatalogLinks: -> + $.addClass doc, 'removing-catalog-links' + $.ready -> + for el in $$ '.navLinks a[href$=catalog]' + $.rm el.previousSibling + $.rm el + $.rmClass doc, 'removing-catalog-links' cb: rootClass: -> From 81b2c8eef264afec6b3accaea24dc7aed6eec778 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Wed, 29 Jan 2014 17:51:19 +0100 Subject: [PATCH 029/143] Add catalog switcher button in the inline catalog. --- src/General/Index.coffee | 9 +++++++++ src/General/Main.coffee | 1 + 2 files changed, 10 insertions(+) diff --git a/src/General/Index.coffee b/src/General/Index.coffee index 0f3ff07f5..76eaf45e1 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -146,6 +146,15 @@ Index = val: isPinned: thread.isPinned Index.sort() Index.buildIndex() + addCatalogSwitch: -> + a = $.el 'a', + href: 'javascript:;' + textContent: 'Switch to <%= meta.name %>\'s catalog' + className: 'btn-wrap' + $.on a, 'click', -> + $.set 'Index Mode', 'catalog' + window.location = './' + $.add $.id('info'), a rmCatalogLinks: -> $.addClass doc, 'removing-catalog-links' $.ready -> diff --git a/src/General/Main.coffee b/src/General/Main.coffee index d8dc3014b..68bcade5f 100644 --- a/src/General/Main.coffee +++ b/src/General/Main.coffee @@ -12,6 +12,7 @@ Main = else 'index' if g.VIEW is 'catalog' + $.ready Index.addCatalogSwitch return if g.VIEW is 'thread' g.THREADID = +pathname[3] From f99481a168980d0c2c7d7eb5204111f148d479e0 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Wed, 29 Jan 2014 18:05:27 +0100 Subject: [PATCH 030/143] Add screenshot of the catalog mode radio box in the changelog. --- CHANGELOG.md | 3 ++- img/changelog/3.16.0/0.png | Bin 0 -> 32825 bytes 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 img/changelog/3.16.0/0.png diff --git a/CHANGELOG.md b/CHANGELOG.md index 773f836d6..e49f27198 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ - More index navigation improvements: - - New index mode: `catalog` + - New index mode: `catalog`
    + ![catalog mode](img/changelog/3.16.0/0.png) - When in catalog mode, use `Shift+Click` to hide, and `Alt+Click` to pin threads. - Existing features affect the catalog mode such as:
      diff --git a/img/changelog/3.16.0/0.png b/img/changelog/3.16.0/0.png new file mode 100644 index 0000000000000000000000000000000000000000..c7fe125f4997def0c81c68c515540aef3489b6d0 GIT binary patch literal 32825 zcma&NXFQx;*YGV$h~8_E=zS0b(LxZt_b`awMQ*7G=)D^?dM7&3iOy)l@Qj@2 zb>G+XzVCoYXZC`_CRQ(owCc%D*+Hg?La9^%0@=KSL>!>LpVCkfuT$ zpuAbpM2i_3#`OB938IwvRr|ZUU;Fv*_K%&-U!x;PUDvlYA_p8k0=rX!Yh~l#j?4^3EpAy8IzwIN8>P6wH18LnCi;>rvAl5rH!z6u5nfci?qx zVVXTda*URt=vj4exJ`#p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%HUtxQ2vJE53`yc$2bdr5oY^Qi%e>ZbiqhtGS$cx6tFKk;X~+sbr9Nv8ccYByGMR zOO>6U*Hqv5b-AtF>(~8v+bH<{mViZ~u&Lxfd>We=(UJarFk;dMp22fzP=x5*`~JGW zxc|Nwy_eiAV9JC7TMF1x2Ra%&0Lk)fGISTwavfc1DeT)5{FR9;yxE$kdTQx;$@l;t z;OYPbH_pq^$*HRD_{d)#Uc}I!q5;MXpa)KCkob$a*@w}_hJeG#eJd^5!L(YpMQ)>L zGk|AFgPG<5fCn5R5C!0rG50f<05rE>~WA^WadTH+Q=9TW;dn%BsK1Gj)rzJ|ImdhmIK` za`+B`v0x7={LbFPxkiR0JI4V2YfyQA&&B!pc3}iIlNPtP+`g#?IbvSZNPlBGL++9o zjefhe2Eq@CdJgQ<5ea6v-ERZs7zem2oKNjW7EnIh(8zh(vLA&+<&H}k?!Q3T)_H}6 zV)mr)Y%4TOSz$#lqx6)t+~IF(bYIyt_(g|bDBfQ^>b$qZ-(UCxM*G4f`N*V=+-@TU zcwn}*WF+_o?|gh;vH#*Qe|mEXB7R`!+mdR&=yg{%hydxmJ}y=~kd z*gMq--$f3mRJb>96`~n6CVmV|5i}i3Je^+*?BP^?-|!YvhJXofAWHBeZyy9ZEeJ%S zV#KAh(qf)P8jzp_uH&&y=#58$GrqkNY$!wvdjRPG5u9V(@dgfRjs)Mia||3Q4O{}d zll*<@EjI}WW)9*}Z$HUKxpT}0_FW&X0#5Q>(_r}h Date: Wed, 29 Jan 2014 23:45:55 +0100 Subject: [PATCH 031/143] Update deps. --- package.json | 4 ++-- src/General/Build.coffee | 4 ++-- src/General/Get.coffee | 2 +- src/General/Index.coffee | 10 +++++----- src/General/UI.coffee | 2 +- src/Posting/QR.cooldown.coffee | 4 ++-- src/Posting/QR.post.coffee | 2 +- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index 7c43bca47..85ae14ef0 100644 --- a/package.json +++ b/package.json @@ -26,13 +26,13 @@ "grunt-bump": "~0.0.13", "grunt-concurrent": "~0.4.3", "grunt-contrib-clean": "~0.5.0", - "grunt-contrib-coffee": "~0.8.2", + "grunt-contrib-coffee": "~0.9.0", "grunt-contrib-compress": "~0.6.0", "grunt-contrib-concat": "~0.3.0", "grunt-contrib-copy": "~0.5.0", "grunt-contrib-watch": "~0.5.3", "grunt-shell": "~0.6.4", - "load-grunt-tasks": "~0.2.1" + "load-grunt-tasks": "~0.3.0" }, "repository": { "type": "git", diff --git a/src/General/Build.coffee b/src/General/Build.coffee index 1a3efa7ed..f342857af 100644 --- a/src/General/Build.coffee +++ b/src/General/Build.coffee @@ -176,7 +176,7 @@ Build = '' if isOP and g.VIEW is 'index' - pageNum = Math.floor Index.liveThreadIDs.indexOf(postID) / Index.threadsNumPerPage + pageNum = Index.liveThreadIDs.indexOf(postID) // Index.threadsNumPerPage pageIcon = " Page #{pageNum}" replyLink = "   [Reply]" else @@ -284,7 +284,7 @@ Build = postCount = data.replies + 1 fileCount = data.images + !!data.ext - pageCount = Math.floor Index.liveThreadIDs.indexOf(thread.ID) / Index.threadsNumPerPage + pageCount = Index.liveThreadIDs.indexOf(thread.ID) // Index.threadsNumPerPage subject = if thread.OP.info.subject "
      #{thread.OP.info.subject}
      " diff --git a/src/General/Get.coffee b/src/General/Get.coffee index 9fe328a13..d05651789 100644 --- a/src/General/Get.coffee +++ b/src/General/Get.coffee @@ -188,7 +188,7 @@ Get = comment = bq.innerHTML # greentext - .replace(/(^|>)(>[^<$]*)(<|$)/g, '$1$2$3') + .replace /(^|>)(>[^<$]*)(<|$)/g, '$1$2$3' # quotes .replace /((>){2}(>\/[a-z\d]+\/)?\d+)/g, '$1' diff --git a/src/General/Index.coffee b/src/General/Index.coffee index 1ce167006..5c6cc8919 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -344,7 +344,7 @@ Index = threadRoot = Build.thread g.BOARD, threadData Index.nodes.push threadRoot, $.el 'hr' if thread = g.BOARD.threads[threadData.no] - thread.setPage Math.floor i / Index.threadsNumPerPage + thread.setPage 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 @@ -394,8 +394,8 @@ Index = Main.callbackNodes Post, posts buildCatalogViews: -> threads = Index.sortedNodes - .filter((n, i) -> !(i % 2)) - .map((threadRoot) -> Get.threadFromRoot threadRoot) + .filter (n, i) -> !(i % 2) + .map (threadRoot) -> Get.threadFromRoot threadRoot .filter (thread) -> !thread.isHidden catalogThreads = [] for thread in threads when !thread.catalogView @@ -408,8 +408,8 @@ Index = sortedThreadIDs = Index.liveThreadIDs when 'lastreply' sortedThreadIDs = [Index.liveThreadData...].sort((a, b) -> - a = a.last_replies[a.last_replies.length - 1] if 'last_replies' of a - b = b.last_replies[b.last_replies.length - 1] if 'last_replies' of b + [..., a] = a.last_replies if 'last_replies' of a + [..., b] = b.last_replies if 'last_replies' of b b.no - a.no ).map (data) -> data.no when 'birth' diff --git a/src/General/UI.coffee b/src/General/UI.coffee index e52774aea..ee852ccd4 100644 --- a/src/General/UI.coffee +++ b/src/General/UI.coffee @@ -191,7 +191,7 @@ UI = do -> # prevent text selection e.preventDefault() if isTouching = e.type is 'touchstart' - e = e.changedTouches[e.changedTouches.length - 1] + [..., e] = e.changedTouches # distance from pointer to el edge is constant; calculate it here. el = $.x 'ancestor::div[contains(@class,"dialog")][1]', @ rect = el.getBoundingClientRect() diff --git a/src/Posting/QR.cooldown.coffee b/src/Posting/QR.cooldown.coffee index ce0fa7960..e6dd14a8d 100644 --- a/src/Posting/QR.cooldown.coffee +++ b/src/Posting/QR.cooldown.coffee @@ -76,7 +76,7 @@ QR.cooldown = if isReply is cooldown.isReply # Only cooldowns relevant to this post can set the seconds variable: # reply cooldown with a reply, thread cooldown with a thread - elapsed = Math.floor (now - start) / $.SECOND + elapsed = (now - start) // $.SECOND continue if elapsed < 0 # clock changed since then? type = unless isReply 'thread' @@ -91,7 +91,7 @@ QR.cooldown = seconds = Math.max seconds, types[type] - elapsed if seconds and Conf['Cooldown Prediction'] and hasFile and upSpd - seconds -= Math.floor post.file.size / upSpd * upSpdAccuracy + seconds -= post.file.size // (upSpd * upSpdAccuracy) seconds = Math.max seconds, 0 # Update the status when we change posting type. # Don't get stuck at some random number. diff --git a/src/Posting/QR.post.coffee b/src/Posting/QR.post.coffee index 06194bbe3..a38362840 100644 --- a/src/Posting/QR.post.coffee +++ b/src/Posting/QR.post.coffee @@ -35,7 +35,7 @@ QR.post = class else 'new' - prev = QR.posts[QR.posts.length - 1] + [..., prev] = QR.posts QR.posts.push @ @nodes.spoiler.checked = @spoiler = if prev and Conf['Remember Spoiler'] prev.spoiler From 659b92aa9918bd0790fe9e0e3ef036c7df0f6bfd Mon Sep 17 00:00:00 2001 From: Mayhem Date: Thu, 30 Jan 2014 14:09:10 +0100 Subject: [PATCH 032/143] Release 4chan X v3.16.0. --- CHANGELOG.md | 2 ++ package.json | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e49f27198..2cbe9636d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +## 3.16.0 - *2014-01-30* + - More index navigation improvements: - New index mode: `catalog`
      ![catalog mode](img/changelog/3.16.0/0.png) diff --git a/package.json b/package.json index 85ae14ef0..43bb3ffb7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "4chan-X", - "version": "3.15.2", + "version": "3.16.0", "description": "Cross-browser extension for productive lurking on 4chan.", "meta": { "name": "4chan X", From 9a1eab31950f631fc7a21daf4c0a0c0719e6dca1 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Fri, 31 Jan 2014 16:10:30 +0100 Subject: [PATCH 033/143] Slightly safer Chrome storage setting. try/catch is probably useless. --- lib/$.coffee | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/lib/$.coffee b/lib/$.coffee index 78e8f54f7..b2029d711 100644 --- a/lib/$.coffee +++ b/lib/$.coffee @@ -267,7 +267,6 @@ $.set = do -> setArea = (area) -> data = items[area] return if !Object.keys(data).length or timeout[area] - items[area] = {} chrome.storage[area].set data, -> if chrome.runtime.lastError c.error chrome.runtime.lastError.message @@ -276,23 +275,20 @@ $.set = do -> timeout[area] = setTimeout setArea, $.MINUTE, area return delete timeout[area] + items[area] = {} - setAll = $.debounce $.SECOND, -> - for key in $.localKeys - if key of items.sync - items.local[key] = items.sync[key] - delete items.sync[key] - try - setArea 'local' - setArea 'sync' - catch err - c.error err.stack + setAll = $.debounce 5 * $.SECOND, -> + setArea 'local' + setArea 'sync' (key, val) -> if typeof key is 'string' items.sync[key] = val else $.extend items.sync, key + for key in $.localKeys when key of items.sync + items.local[key] = items.sync[key] + delete items.sync[key] setAll() $.clear = (cb) -> count = 2 From 444722fb9b67155e1ae36bc1324a7b80746f211b Mon Sep 17 00:00:00 2001 From: Mayhem Date: Fri, 31 Jan 2014 17:35:28 +0100 Subject: [PATCH 034/143] Fix thread status updating for the catalog view. --- src/General/CatalogThread.coffee | 9 +++++---- src/General/Thread.coffee | 5 ++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/General/CatalogThread.coffee b/src/General/CatalogThread.coffee index ae8f832d0..a7bebe7bc 100644 --- a/src/General/CatalogThread.coffee +++ b/src/General/CatalogThread.coffee @@ -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/Thread.coffee b/src/General/Thread.coffee index 81acfc439..8a9df031f 100644 --- a/src/General/Thread.coffee +++ b/src/General/Thread.coffee @@ -33,7 +33,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', @@ -49,8 +49,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 aaf5e8bb1a124e57d87773c10120fb4d43615fc1 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Fri, 31 Jan 2014 19:03:19 +0100 Subject: [PATCH 035/143] Fix ThreadHiding.onIndexRefresh(). --- src/Filtering/ThreadHiding.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Filtering/ThreadHiding.coffee b/src/Filtering/ThreadHiding.coffee index 155a94be1..0241703d2 100644 --- a/src/Filtering/ThreadHiding.coffee +++ b/src/Filtering/ThreadHiding.coffee @@ -20,7 +20,7 @@ ThreadHiding = thread = Get.threadFromRoot root continue unless thread.isHidden unless thread.stub - nodes[i + 1].hidden = true + Index.nodes[i + 1].hidden = true else unless root.contains thread.stub # When we come back to a page, the stub is already there. ThreadHiding.makeStub thread, root From 824695daafa90d51dc24ad34412378e93778cf3a Mon Sep 17 00:00:00 2001 From: Mayhem Date: Fri, 31 Jan 2014 22:46:40 +0100 Subject: [PATCH 036/143] Missing braces. --- src/General/DataBoard.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/General/DataBoard.coffee b/src/General/DataBoard.coffee index dc4319816..2aab44b17 100644 --- a/src/General/DataBoard.coffee +++ b/src/General/DataBoard.coffee @@ -71,7 +71,7 @@ class DataBoard ajaxClean: (boardID) -> $.cache "//a.4cdn.org/#{boardID}/threads.json", (e) => if e.target.status isnt 200 - @delete boardID if e.target.status is 404 + @delete {boardID} if e.target.status is 404 return board = @data.boards[boardID] threads = {} From dac4ccbeadffc8fcc5a67084b302cee5ac246c79 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Fri, 31 Jan 2014 23:30:54 +0100 Subject: [PATCH 037/143] Hide the persistent QR in the catalog. --- src/Posting/QR.coffee | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Posting/QR.coffee b/src/Posting/QR.coffee index 2eed475ff..acc79a1c7 100644 --- a/src/Posting/QR.coffee +++ b/src/Posting/QR.coffee @@ -50,14 +50,13 @@ QR = else QR.status() - QR.persist() if Conf['Persistent QR'] + return unless Conf['Persistent QR'] + QR.open() + QR.hide() if Conf['Auto-Hide QR'] or g.VIEW is 'catalog' or g.VIEW is 'index' and Conf['Index Mode'] is 'catalog' node: -> $.on $('a[title="Quote this post"]', @nodes.info), 'click', QR.quote - persist: -> - QR.open() - QR.hide() if Conf['Auto-Hide QR'] or g.VIEW is 'catalog' open: -> if QR.nodes QR.nodes.el.hidden = false From 2082e46cc5d4e08b48efee3afa608077b07a35bd Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sat, 1 Feb 2014 00:00:03 +0100 Subject: [PATCH 038/143] typo tee hee #1342 --- src/Posting/QR.cooldown.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Posting/QR.cooldown.coffee b/src/Posting/QR.cooldown.coffee index e6dd14a8d..2c0c7a4e0 100644 --- a/src/Posting/QR.cooldown.coffee +++ b/src/Posting/QR.cooldown.coffee @@ -48,7 +48,7 @@ QR.cooldown = $.delete "cooldown.#{g.BOARD}" count: -> unless Object.keys(QR.cooldown.cooldowns).length - $.delete "#{g.BOARD}.cooldown" + $.delete "cooldown.#{g.BOARD}" delete QR.cooldown.isCounting delete QR.cooldown.seconds QR.status() From c5490f6aecc6df139c08fce100479702835c1b26 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sat, 1 Feb 2014 15:41:36 +0100 Subject: [PATCH 039/143] Fix cooldowns never expiring. --- src/Posting/QR.cooldown.coffee | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Posting/QR.cooldown.coffee b/src/Posting/QR.cooldown.coffee index 2c0c7a4e0..2f6a16f71 100644 --- a/src/Posting/QR.cooldown.coffee +++ b/src/Posting/QR.cooldown.coffee @@ -15,8 +15,7 @@ QR.cooldown = QR.cooldown.start() $.sync key, QR.cooldown.sync start: -> - return unless Conf['Cooldown'] - return if QR.cooldown.isCounting + return if QR.cooldown.isCounting or !Object.keys(QR.cooldown.cooldowns).length QR.cooldown.isCounting = true QR.cooldown.count() sync: (cooldowns) -> @@ -65,6 +64,7 @@ QR.cooldown = {types, cooldowns, upSpd, upSpdAccuracy} = QR.cooldown for start, cooldown of cooldowns + start = +start if 'delay' of cooldown if cooldown.delay seconds = Math.max seconds, cooldown.delay-- @@ -77,7 +77,9 @@ QR.cooldown = # Only cooldowns relevant to this post can set the seconds variable: # reply cooldown with a reply, thread cooldown with a thread elapsed = (now - start) // $.SECOND - continue if elapsed < 0 # clock changed since then? + if elapsed < 0 # clock changed since then? + QR.cooldown.unset start + continue type = unless isReply 'thread' else if hasFile From 0092c53783fa4921c09c14e8391162e79c50d273 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sat, 1 Feb 2014 19:48:37 +0100 Subject: [PATCH 040/143] Add hidden threads count on the index. --- 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 0241703d2..ff9cfdd16 100644 --- a/src/Filtering/ThreadHiding.coffee +++ b/src/Filtering/ThreadHiding.coffee @@ -24,7 +24,29 @@ ThreadHiding = else unless root.contains thread.stub # When we come back to a page, the stub is already there. 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. @@ -157,6 +179,7 @@ ThreadHiding = return if thread.isHidden threadRoot = thread.OP.nodes.root.parentNode thread.isHidden = true + ThreadHiding.updateToggle() unless makeStub threadRoot.hidden = threadRoot.nextElementSibling.hidden = true #
      @@ -171,3 +194,4 @@ ThreadHiding = threadRoot = thread.OP.nodes.root.parentNode threadRoot.nextElementSibling.hidden = threadRoot.hidden = thread.isHidden = false + ThreadHiding.updateToggle() From aeb1147bb31b269105588d829c429fb72dfca931 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sat, 1 Feb 2014 20:21:15 +0100 Subject: [PATCH 041/143] Refactor hidden threads count. It concerns filtered threads too, not just manually hidden threads. --- 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 ff9cfdd16..28684f1fa 100644 --- a/src/Filtering/ThreadHiding.coffee +++ b/src/Filtering/ThreadHiding.coffee @@ -24,29 +24,7 @@ ThreadHiding = else unless root.contains thread.stub # When we come back to a page, the stub is already there. 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. @@ -179,7 +157,7 @@ ThreadHiding = return if thread.isHidden threadRoot = thread.OP.nodes.root.parentNode thread.isHidden = true - ThreadHiding.updateToggle() + Index.updateHideToggle() unless makeStub threadRoot.hidden = threadRoot.nextElementSibling.hidden = true #
      @@ -194,4 +172,4 @@ ThreadHiding = threadRoot = thread.OP.nodes.root.parentNode threadRoot.nextElementSibling.hidden = threadRoot.hidden = thread.isHidden = false - ThreadHiding.updateToggle() + Index.updateHideToggle() diff --git a/src/General/Index.coffee b/src/General/Index.coffee index 5c6cc8919..d71178d3d 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -249,6 +249,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) -> return unless navigator.onLine Index.req?.abort() @@ -367,6 +390,7 @@ Index = $.nodes Index.nodes Main.callbackNodes Thread, threads Main.callbackNodes Post, posts + Index.updateHideToggle() $.event 'IndexRefresh' buildReplies: (threadRoots) -> posts = [] From b9e8ff0b1964c767fe654114f86c8000687b5c7a Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sat, 1 Feb 2014 20:42:59 +0100 Subject: [PATCH 042/143] Make the hidden label an integral part of the index. --- html/General/Index-navlinks.html | 1 + src/Filtering/ThreadHiding.coffee | 4 ++-- src/General/Index.coffee | 19 +++++-------------- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/html/General/Index-navlinks.html b/html/General/Index-navlinks.html index 7caf98685..53a1304a5 100644 --- a/html/General/Index-navlinks.html +++ b/html/General/Index-navlinks.html @@ -2,3 +2,4 @@ [ + diff --git a/src/Filtering/ThreadHiding.coffee b/src/Filtering/ThreadHiding.coffee index 28684f1fa..39397d999 100644 --- a/src/Filtering/ThreadHiding.coffee +++ b/src/Filtering/ThreadHiding.coffee @@ -157,7 +157,7 @@ ThreadHiding = return if thread.isHidden threadRoot = thread.OP.nodes.root.parentNode thread.isHidden = true - Index.updateHideToggle() + Index.updateHideLabel() unless makeStub threadRoot.hidden = threadRoot.nextElementSibling.hidden = true #
      @@ -172,4 +172,4 @@ ThreadHiding = threadRoot = thread.OP.nodes.root.parentNode threadRoot.nextElementSibling.hidden = threadRoot.hidden = thread.isHidden = false - Index.updateHideToggle() + Index.updateHideLabel() diff --git a/src/General/Index.coffee b/src/General/Index.coffee index d71178d3d..f62752982 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -96,6 +96,7 @@ Index = className: 'navLinks' innerHTML: <%= importHTML('General/Index-navlinks') %> @searchInput = $ '#index-search', @navLinks + @hideLabel = $ '#hidden-label', @navLinks @currentPage = @getCurrentPage() $.on window, 'popstate', @cb.popstate $.on @pagelist, 'click', @cb.pageNav @@ -249,28 +250,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) -> return unless navigator.onLine @@ -390,7 +381,7 @@ Index = $.nodes Index.nodes Main.callbackNodes Thread, threads Main.callbackNodes Post, posts - Index.updateHideToggle() + Index.updateHideLabel() $.event 'IndexRefresh' buildReplies: (threadRoots) -> posts = [] From bbaac896e5a820c43b17341207697905ea6e7033 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sat, 1 Feb 2014 21:16:17 +0100 Subject: [PATCH 043/143] Add a show/hide hidden threads toggle for the catalog mode. --- html/General/Index-navlinks.html | 2 +- src/General/Index.coffee | 23 ++++++++++++++++++----- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/html/General/Index-navlinks.html b/html/General/Index-navlinks.html index 53a1304a5..82aa28561 100644 --- a/html/General/Index-navlinks.html +++ b/html/General/Index-navlinks.html @@ -2,4 +2,4 @@ [ - + diff --git a/src/General/Index.coffee b/src/General/Index.coffee index f62752982..3f0dc4d4d 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -87,7 +87,6 @@ Index = $.addClass doc, 'index-loading' @update() @root = $.el 'div', className: 'board' - Index.cb.rootClass() @pagelist = $.el 'div', className: 'pagelist' hidden: true @@ -102,6 +101,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() $.asap (-> $('.board', doc) or d.readyState isnt 'loading'), -> board = $ '.board' $.replace board, Index.root @@ -155,10 +156,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: -> @@ -411,7 +424,7 @@ Index = threads = Index.sortedNodes .filter (n, i) -> !(i % 2) .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 From d69df92c8e1f41a1c38abe6c0f5ff4add2c406c3 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sat, 1 Feb 2014 21:28:02 +0100 Subject: [PATCH 044/143] 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 3f0dc4d4d..ebb9512fe 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -132,14 +132,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() @@ -164,7 +170,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' @@ -269,6 +275,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 a77a6ac4f772c393c29a93ec03cb9eae92664357 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sat, 1 Feb 2014 21:39:18 +0100 Subject: [PATCH 045/143] Changelog. --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2cbe9636d..d10969f2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +- More index navigation improvements: + - The index will now display how threads are hidden. + - When in catalog mode, you can toggle between hidden/non-hidden threads. +- Fixed a bug which prevented QR cooldowns from being pruned from storage. + - On Chrome, the storage could reach the quota and prevent 4chan X from saving data like QR name/mail or auto-watch for example. + ## 3.16.0 - *2014-01-30* - More index navigation improvements: From 47aa9d3bba120326dc9cc238b999d1b93019b666 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sat, 1 Feb 2014 21:39:28 +0100 Subject: [PATCH 046/143] Release 4chan X v3.16.1. --- CHANGELOG.md | 2 ++ package.json | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d10969f2f..b87fc00c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +### 3.16.1 - *2014-02-01* + - More index navigation improvements: - The index will now display how threads are hidden. - When in catalog mode, you can toggle between hidden/non-hidden threads. diff --git a/package.json b/package.json index 43bb3ffb7..205c37eb2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "4chan-X", - "version": "3.16.0", + "version": "3.16.1", "description": "Cross-browser extension for productive lurking on 4chan.", "meta": { "name": "4chan X", From 85791a73ac75a444d2ec402825dcf0689e67410c Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sat, 1 Feb 2014 21:42:27 +0100 Subject: [PATCH 047/143] +many --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b87fc00c0..9ac9bcc24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ ### 3.16.1 - *2014-02-01* - More index navigation improvements: - - The index will now display how threads are hidden. + - The index will now display how many threads are hidden. - When in catalog mode, you can toggle between hidden/non-hidden threads. - Fixed a bug which prevented QR cooldowns from being pruned from storage. - On Chrome, the storage could reach the quota and prevent 4chan X from saving data like QR name/mail or auto-watch for example. From 6408818eef73a756dad1b78d05915727d34c20a4 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sun, 2 Feb 2014 17:27:08 +0100 Subject: [PATCH 048/143] 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 ebb9512fe..d1efd7ee3 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -1,4 +1,5 @@ Index = + showHiddenThreads: false init: -> if g.VIEW is 'catalog' $.ready -> @@ -142,9 +143,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 3887e184b8b9263b2859b6543af6a90d9d895471 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sun, 2 Feb 2014 17:45:29 +0100 Subject: [PATCH 049/143] Close #1416 --- src/Posting/QR.coffee | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Posting/QR.coffee b/src/Posting/QR.coffee index acc79a1c7..35caf4608 100644 --- a/src/Posting/QR.coffee +++ b/src/Posting/QR.coffee @@ -55,6 +55,8 @@ QR = QR.hide() if Conf['Auto-Hide QR'] or g.VIEW is 'catalog' or g.VIEW is 'index' and Conf['Index Mode'] is 'catalog' node: -> + if QR.db.get {boardID: @board.ID, threadID: @thread.ID, postID: @ID} + $.addClass @nodes.root, 'your-post' $.on $('a[title="Quote this post"]', @nodes.info), 'click', QR.quote open: -> From 99f4f14c473ebe8ee0607ac02954f2d9d47483f4 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sun, 2 Feb 2014 22:38:53 +0100 Subject: [PATCH 050/143] 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. --- css/style.css | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/css/style.css b/css/style.css index 5abad3b16..30b78cf0c 100644 --- a/css/style.css +++ b/css/style.css @@ -402,19 +402,21 @@ a[href="javascript:;"] { 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 { @@ -443,15 +445,23 @@ a[href="javascript:;"] { 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; } /* Announcement Hiding */ From 60e89e3f28dcb5cb5936f31940c786117ba5240a Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sun, 2 Feb 2014 23:30:04 +0100 Subject: [PATCH 051/143] Add the menu button to threads in the catalog. --- css/style.css | 6 ++++++ src/Menu/Menu.coffee | 39 +++++++++++++++++++++++++-------------- 2 files changed, 31 insertions(+), 14 deletions(-) diff --git a/css/style.css b/css/style.css index 30b78cf0c..4b705b943 100644 --- a/css/style.css +++ b/css/style.css @@ -444,6 +444,12 @@ a[href="javascript:;"] { 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 23fb2ce91..c5ba70c31 100644 --- a/src/Menu/Menu.coffee +++ b/src/Menu/Menu.coffee @@ -2,35 +2,46 @@ Menu = init: -> return if g.VIEW is 'catalog' or !Conf['Menu'] + a = $.el 'a', + className: 'menu-button' + innerHTML: '[]' + href: 'javascript:;' + @frag = $.nodes [$.tn(' '), a] + @menu = new UI.Menu 'post' Post.callbacks.push name: 'Menu' cb: @node + CatalogThread.callbacks.push + name: 'Image Hover' + cb: @catalogNode node: -> if @isClone $.on $('.menu-button', @nodes.info), 'click', Menu.toggle return $.add @nodes.info, Menu.makeButton() + catalogNode: -> + menuButton = $.el 'a', + className: 'menu-button' + innerHTML: '' + href: 'javascript:;' + $.on menuButton, 'click', Menu.toggle + $.add @nodes.icons, menuButton - makeButton: do -> - frag = null - -> - unless frag - a = $.el 'a', - className: 'menu-button' - innerHTML: '[]' - href: 'javascript:;' - frag = $.nodes [$.tn(' '), a] - clone = frag.cloneNode true - $.on clone.lastElementChild, 'click', Menu.toggle - clone + makeButton: -> + clone = Menu.frag.cloneNode true + $.on clone.lastElementChild, 'click', Menu.toggle + clone toggle: (e) -> try # Posts, inlined posts, hidden replies. post = Get.postFromNode @ catch - # Hidden threads. - post = Get.threadFromNode(@).OP + post = if fullID = @parentNode.parentNode.parentNode.dataset.fullID + g.threads[fullID].OP + else + # Hidden threads. + Get.threadFromNode(@).OP Menu.menu.toggle e, @, post From 22f785ea15e5406b383032194f476da07ae29c56 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Mon, 3 Feb 2014 01:30:35 +0100 Subject: [PATCH 052/143] Avoid overflowing comments. --- css/style.css | 1 + 1 file changed, 1 insertion(+) diff --git a/css/style.css b/css/style.css index 4b705b943..138c5aa9d 100644 --- a/css/style.css +++ b/css/style.css @@ -466,6 +466,7 @@ a[href="javascript:;"] { } .catalog-thread > .comment { flex-shrink: 1; + max-width: 100%; overflow: hidden; text-align: center; } From ad5f787c717087a896000962587c86b32eb687dd Mon Sep 17 00:00:00 2001 From: Mayhem Date: Mon, 3 Feb 2014 10:01:03 +0100 Subject: [PATCH 053/143] Add a bit of horizontal margin between threads in the catalog. --- css/style.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/css/style.css b/css/style.css index 138c5aa9d..f3b253287 100644 --- a/css/style.css +++ b/css/style.css @@ -411,7 +411,7 @@ a[href="javascript:;"] { flex-direction: column; align-items: center; width: 165px; - margin-bottom: 5px; + margin: 0 2px 5px; max-height: 320px; word-break: break-word; } From d6030f7df005d27a1c5c789d8c8426ed15434e4f Mon Sep 17 00:00:00 2001 From: Mayhem Date: Mon, 3 Feb 2014 13:51:25 +0100 Subject: [PATCH 054/143] Set the catalog thumbnail via background image, save one element. Also tiny fixes here and there. --- css/style.css | 23 +++++++-------- html/General/Thread-catalog-view.html | 3 +- src/General/Build.coffee | 40 ++++++++++++++------------- src/Images/AutoGIF.coffee | 9 ++++-- src/Images/ImageHover.coffee | 2 +- src/Menu/Menu.coffee | 2 +- 6 files changed, 42 insertions(+), 37 deletions(-) diff --git a/css/style.css b/css/style.css index f3b253287..3b39ee622 100644 --- a/css/style.css +++ b/css/style.css @@ -415,26 +415,28 @@ a[href="javascript:;"] { max-height: 320px; word-break: break-word; } -.catalog-thread > a { +.thumb { flex-shrink: 0; position: relative; -} -.thumb { - max-width: 150px; - max-height: 150px; + background-size: 100% 100%; + background-repeat: no-repeat; + background-position: center; border-radius: 2px; box-shadow: 0 0 5px rgba(0, 0, 0, .25); } -.thunb.spoiler-file { +.thumb.spoiler-file { + background-size: 100px; width: 100px; height: 100px; } .thumb.deleted-file { + background-size: 127px 13px; width: 127px; height: 13px; padding: 20px 11px; } .thumb.no-file { + background-size: 77px 13px; width: 77px; height: 13px; padding: 20px 36px; @@ -444,7 +446,7 @@ a[href="javascript:;"] { top: 1px; right: 1px; } -.catalog-thread > a:not(:hover) .menu-button { +.thumb:not(:hover) .menu-button > i { display: none; } .thread-icons > .menu-button > i { @@ -455,10 +457,9 @@ a[href="javascript:;"] { 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; @@ -466,7 +467,7 @@ a[href="javascript:;"] { } .catalog-thread > .comment { flex-shrink: 1; - max-width: 100%; + align-self: stretch; overflow: hidden; text-align: center; } diff --git a/html/General/Thread-catalog-view.html b/html/General/Thread-catalog-view.html index cf87775c9..f1d1d0cd9 100644 --- a/html/General/Thread-catalog-view.html +++ b/html/General/Thread-catalog-view.html @@ -1,5 +1,4 @@ - - +
      diff --git a/src/General/Build.coffee b/src/General/Build.coffee index f342857af..3a7a1430e 100644 --- a/src/General/Build.coffee +++ b/src/General/Build.coffee @@ -263,25 +263,6 @@ Build = {staticPath, gifIcon} = Build data = Index.liveThreadData[Index.liveThreadIDs.indexOf thread.ID] - if data.spoiler and !Conf['Reveal Spoilers'] - src = "#{staticPath}spoiler" - if spoilerRange = Build.spoilerRange[thread.board] - # Randomize the spoiler image. - src += "-#{thread.board}" + Math.floor 1 + spoilerRange * Math.random() - src += '.png' - imgClass = 'spoiler-file' - else if data.filedeleted - src = "#{staticPath}filedeleted-res#{gifIcon}" - imgClass = 'deleted-file' - else if thread.OP.file - src = thread.OP.file.thumbURL - max = Math.max data.tn_w, data.tn_h - imgWidth = data.tn_w * 150 / max - imgHeight = data.tn_h * 150 / max - else - src = "#{staticPath}nofile.png" - imgClass = 'no-file' - postCount = data.replies + 1 fileCount = data.images + !!data.ext pageCount = Index.liveThreadIDs.indexOf(thread.ID) // Index.threadsNumPerPage @@ -300,6 +281,27 @@ Build = $.addClass root, 'pinned' if thread.isPinned $.addClass root, thread.OP.highlights... if thread.OP.highlights + thumb = root.firstElementChild + if data.spoiler and !Conf['Reveal Spoilers'] + src = "#{staticPath}spoiler" + if spoilerRange = Build.spoilerRange[thread.board] + # Randomize the spoiler image. + src += "-#{thread.board}" + Math.floor 1 + spoilerRange * Math.random() + src += '.png' + $.addClass thumb, 'spoiler-file' + else if data.filedeleted + src = "#{staticPath}filedeleted-res#{gifIcon}" + $.addClass thumb, 'deleted-file' + else if thread.OP.file + src = thread.OP.file.thumbURL + max = Math.max data.tn_w, data.tn_h + thumb.style.width = data.tn_w * 150 / max + 'px' + thumb.style.height = data.tn_h * 150 / max + 'px' + else + src = "#{staticPath}nofile.png" + $.addClass thumb, 'no-file' + thumb.style.backgroundImage = "url(#{src})" + for quotelink in $$ '.quotelink', root.lastElementChild $.replace quotelink, [quotelink.childNodes...] diff --git a/src/Images/AutoGIF.coffee b/src/Images/AutoGIF.coffee index a80481407..572e977de 100644 --- a/src/Images/AutoGIF.coffee +++ b/src/Images/AutoGIF.coffee @@ -22,11 +22,14 @@ AutoGIF = return unless OP.file?.isImage {URL} = OP.file return unless /gif$/.test URL - AutoGIF.replaceThumbnail @nodes.thumb, URL - replaceThumbnail: (thumb, URL) -> + AutoGIF.replaceThumbnail @nodes.thumb, URL, true + replaceThumbnail: (thumb, URL, isCatalog) -> gif = $.el 'img' $.on gif, 'load', -> # Replace the thumbnail once the GIF has finished loading. - thumb.src = URL + if isCatalog + thumb.style.backgroundImage = "url(#{URL})" + else + thumb.src = URL gif.src = URL diff --git a/src/Images/ImageHover.coffee b/src/Images/ImageHover.coffee index f205c941c..37f26522c 100644 --- a/src/Images/ImageHover.coffee +++ b/src/Images/ImageHover.coffee @@ -16,7 +16,7 @@ ImageHover = $.on @nodes.thumb, 'mouseover', ImageHover.mouseover mouseover: (e) -> post = if $.hasClass @, 'thumb' - g.posts[@parentNode.parentNode.dataset.fullID] + g.posts[@parentNode.dataset.fullID] else Get.postFromNode @ el = $.el 'img', diff --git a/src/Menu/Menu.coffee b/src/Menu/Menu.coffee index c5ba70c31..df428a1b2 100644 --- a/src/Menu/Menu.coffee +++ b/src/Menu/Menu.coffee @@ -13,7 +13,7 @@ Menu = name: 'Menu' cb: @node CatalogThread.callbacks.push - name: 'Image Hover' + name: 'Menu' cb: @catalogNode node: -> From 811da4ec737a2b3b14de7382de6b2e10060907a9 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Mon, 3 Feb 2014 13:58:16 +0100 Subject: [PATCH 055/143] 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 3a7a1430e..94a9125fd 100644 --- a/src/General/Build.coffee +++ b/src/General/Build.coffee @@ -304,6 +304,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 8951e9cd1663bed4ad24fe8b822663b933998516 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Mon, 3 Feb 2014 14:16:36 +0100 Subject: [PATCH 056/143] Move the sticky/closed icons off of Saint Stallman's face. --- css/style.css | 16 +++++++++++----- html/General/Thread-catalog-view.html | 5 ++--- src/Menu/Menu.coffee | 4 ++-- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/css/style.css b/css/style.css index 3b39ee622..4e6812574 100644 --- a/css/style.css +++ b/css/style.css @@ -441,15 +441,21 @@ a[href="javascript:;"] { height: 13px; padding: 20px 36px; } -.thread-icons { +.thread-icons > img { + width: 1em; + height: 1em; + margin: 0; + vertical-align: text-top; +} +.thumb:not(:hover) > .menu-button > i { + display: none; +} +.thumb > .menu-button { position: absolute; top: 1px; right: 1px; } -.thumb:not(:hover) .menu-button > i { - display: none; -} -.thread-icons > .menu-button > i { +.thumb > .menu-button > i { font-size: 14px; } .thread-stats { diff --git a/html/General/Thread-catalog-view.html b/html/General/Thread-catalog-view.html index f1d1d0cd9..44cf8d5e2 100644 --- a/html/General/Thread-catalog-view.html +++ b/html/General/Thread-catalog-view.html @@ -1,8 +1,7 @@ - -
      -
      +
      #{postCount} / #{fileCount} / #{pageCount} +
      #{subject}
      #{comment}
      diff --git a/src/Menu/Menu.coffee b/src/Menu/Menu.coffee index df428a1b2..c4f7debf3 100644 --- a/src/Menu/Menu.coffee +++ b/src/Menu/Menu.coffee @@ -27,7 +27,7 @@ Menu = innerHTML: '' href: 'javascript:;' $.on menuButton, 'click', Menu.toggle - $.add @nodes.icons, menuButton + $.add @nodes.thumb, menuButton makeButton: -> clone = Menu.frag.cloneNode true @@ -39,7 +39,7 @@ Menu = # Posts, inlined posts, hidden replies. post = Get.postFromNode @ catch - post = if fullID = @parentNode.parentNode.parentNode.dataset.fullID + post = if fullID = @parentNode.parentNode.dataset.fullID g.threads[fullID].OP else # Hidden threads. From 600febc22e3057802b197cdc7d87c98a34821a37 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Mon, 3 Feb 2014 14:52:01 +0100 Subject: [PATCH 057/143] Make the menu button more visible in the catalog. --- css/style.css | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/css/style.css b/css/style.css index 4e6812574..28d2f01c9 100644 --- a/css/style.css +++ b/css/style.css @@ -448,7 +448,7 @@ a[href="javascript:;"] { vertical-align: text-top; } .thumb:not(:hover) > .menu-button > i { - display: none; + visibility: hidden; } .thumb > .menu-button { position: absolute; @@ -457,6 +457,10 @@ a[href="javascript:;"] { } .thumb > .menu-button > i { font-size: 14px; + text-shadow: 1px 1px 0 #FFF, + -1px 1px 0 #FFF, + -1px -1px 0 #FFF, + 1px -1px 0 #FFF; } .thread-stats { flex-shrink: 0; From e0a171c5583f74c41f2fb3b0d044cf478e16092d Mon Sep 17 00:00:00 2001 From: Mayhem Date: Mon, 3 Feb 2014 15:00:54 +0100 Subject: [PATCH 058/143] Fix shift/alt clicking regression in the catalog. --- 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 d1efd7ee3..7a1be3991 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -130,7 +130,7 @@ Index = $.on @nodes.thumb, 'click', Index.onClick onClick: (e) -> return if e.button isnt 0 - root = @parentNode.parentNode + root = @parentNode thread = g.threads[root.dataset.fullID] if e.shiftKey Index.toggleHide thread, root From 65e8b585bd8d7e33f1bc1f68d0cc5b853b64c7a0 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Tue, 4 Feb 2014 10:29:14 +0100 Subject: [PATCH 059/143] Better background for menu icons in the catalog. --- css/burichan.css | 3 +++ css/futaba.css | 3 +++ css/photon.css | 3 +++ css/style.css | 13 +++++++------ css/tomorrow.css | 3 +++ css/yotsuba-b.css | 3 +++ css/yotsuba.css | 3 +++ 7 files changed, 25 insertions(+), 6 deletions(-) diff --git a/css/burichan.css b/css/burichan.css index ac1dc8ba7..3fd787105 100644 --- a/css/burichan.css +++ b/css/burichan.css @@ -56,3 +56,6 @@ :root.burichan .focused.entry { background: rgba(255, 255, 255, .33); } +:root.yotsuba-b .thumb > .menu-button > i { + background: #EEF2FF; +} diff --git a/css/futaba.css b/css/futaba.css index 0f21afb04..c9588ccf4 100644 --- a/css/futaba.css +++ b/css/futaba.css @@ -56,3 +56,6 @@ :root.futaba .focused.entry { background: rgba(255, 255, 255, .33); } +:root.yotsuba-b .thumb > .menu-button > i { + background: #FFE; +} diff --git a/css/photon.css b/css/photon.css index 2580b0cf2..1d95e6a63 100644 --- a/css/photon.css +++ b/css/photon.css @@ -56,3 +56,6 @@ :root.photon .focused.entry { background: rgba(255, 255, 255, .33); } +:root.yotsuba-b .thumb > .menu-button > i { + background: #EEE; +} diff --git a/css/style.css b/css/style.css index 28d2f01c9..ee7881483 100644 --- a/css/style.css +++ b/css/style.css @@ -452,15 +452,16 @@ a[href="javascript:;"] { } .thumb > .menu-button { position: absolute; - top: 1px; - right: 1px; + top: 0; + right: 0; } .thumb > .menu-button > i { + width: 1em; + height: 1em; + padding: 1px; + border-radius: 0 2px 0 2px; font-size: 14px; - text-shadow: 1px 1px 0 #FFF, - -1px 1px 0 #FFF, - -1px -1px 0 #FFF, - 1px -1px 0 #FFF; + text-align: center; } .thread-stats { flex-shrink: 0; diff --git a/css/tomorrow.css b/css/tomorrow.css index e14ed417a..2805b062c 100644 --- a/css/tomorrow.css +++ b/css/tomorrow.css @@ -56,3 +56,6 @@ :root.tomorrow .focused.entry { background: rgba(0, 0, 0, .33); } +:root.yotsuba-b .thumb > .menu-button > i { + background: #1D1F21; +} diff --git a/css/yotsuba-b.css b/css/yotsuba-b.css index a39555c47..8dadd440a 100644 --- a/css/yotsuba-b.css +++ b/css/yotsuba-b.css @@ -56,3 +56,6 @@ :root.yotsuba-b .focused.entry { background: rgba(255, 255, 255, .33); } +:root.yotsuba-b .thumb > .menu-button > i { + background: #EEF2FF; +} diff --git a/css/yotsuba.css b/css/yotsuba.css index 5bb2e187b..b78fa0cb6 100644 --- a/css/yotsuba.css +++ b/css/yotsuba.css @@ -56,3 +56,6 @@ :root.yotsuba .focused.entry { background: rgba(255, 255, 255, .33); } +:root.yotsuba-b .thumb > .menu-button > i { + background: #FFE; +} From 12ffcb33097d5fe1592ab44eb0f1e382759ed63a Mon Sep 17 00:00:00 2001 From: Mayhem Date: Tue, 4 Feb 2014 10:37:51 +0100 Subject: [PATCH 060/143] Add an 'open' class to opened menus. Never hide opened menus in the catalog. --- css/style.css | 4 ++-- src/General/UI.coffee | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/css/style.css b/css/style.css index ee7881483..d6bb38d40 100644 --- a/css/style.css +++ b/css/style.css @@ -447,8 +447,8 @@ a[href="javascript:;"] { margin: 0; vertical-align: text-top; } -.thumb:not(:hover) > .menu-button > i { - visibility: hidden; +.thumb:not(:hover) > .menu-button:not(.open) > i { + display: none; } .thumb > .menu-button { position: absolute; diff --git a/src/General/UI.coffee b/src/General/UI.coffee index ee852ccd4..ef01e3497 100644 --- a/src/General/UI.coffee +++ b/src/General/UI.coffee @@ -47,6 +47,7 @@ UI = do -> menu = @makeMenu() currentMenu = menu lastToggledButton = button + $.addClass button, 'open' for entry in @entries @insertEntry entry, menu, data @@ -99,6 +100,7 @@ UI = do -> close: => $.rm currentMenu + $.rmClass lastToggledButton, 'open' currentMenu = null lastToggledButton = null $.off d, 'click CloseMenu', @close From 0675146d22a9a3572def29f36ec4bb55c2dc2193 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Tue, 4 Feb 2014 13:51:21 +0100 Subject: [PATCH 061/143] Add pin/hide/show thread menu entries for the catalog. --- src/Filtering/ThreadHiding.coffee | 2 +- src/General/Index.coffee | 48 +++++++++++++++++++++++++++---- src/General/Main.coffee | 1 + src/Images/AutoGIF.coffee | 4 +-- 4 files changed, 46 insertions(+), 9 deletions(-) diff --git a/src/Filtering/ThreadHiding.coffee b/src/Filtering/ThreadHiding.coffee index 39397d999..566abdd02 100644 --- a/src/Filtering/ThreadHiding.coffee +++ b/src/Filtering/ThreadHiding.coffee @@ -91,7 +91,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 7a1be3991..78df3322a 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -122,6 +122,43 @@ Index = $.rmClass doc, 'index-loading' $.asap (-> $('.pagelist') or d.readyState isnt 'loading'), -> $.replace $('.pagelist'), Index.pagelist + menu: + init: -> + return if g.VIEW isnt 'index' or !Conf['Menu'] or g.BOARD.ID is 'f' + + $.event 'AddMenuEntry', + type: 'post' + 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 + + $.event 'AddMenuEntry', + type: 'post' + 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} @@ -130,17 +167,16 @@ Index = $.on @nodes.thumb, 'click', Index.onClick onClick: (e) -> return if e.button isnt 0 - root = @parentNode - thread = g.threads[root.dataset.fullID] + thread = g.threads[@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} @@ -464,7 +500,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'] sortOnTop: (match) -> diff --git a/src/General/Main.coffee b/src/General/Main.coffee index 254d2cba4..87db28ba8 100644 --- a/src/General/Main.coffee +++ b/src/General/Main.coffee @@ -82,6 +82,7 @@ Main = initFeature 'Strike-through Quotes', QuoteStrikeThrough initFeature 'Quick Reply', QR initFeature 'Menu', Menu + initFeature 'Index Generator (Menu)', Index.menu initFeature 'Report Link', ReportLink initFeature 'Thread Hiding (Menu)', ThreadHiding.menu initFeature 'Reply Hiding (Menu)', PostHiding.menu diff --git a/src/Images/AutoGIF.coffee b/src/Images/AutoGIF.coffee index 572e977de..3aca0319c 100644 --- a/src/Images/AutoGIF.coffee +++ b/src/Images/AutoGIF.coffee @@ -23,11 +23,11 @@ AutoGIF = {URL} = OP.file return unless /gif$/.test URL AutoGIF.replaceThumbnail @nodes.thumb, URL, true - replaceThumbnail: (thumb, URL, isCatalog) -> + replaceThumbnail: (thumb, URL, isBackground) -> gif = $.el 'img' $.on gif, 'load', -> # Replace the thumbnail once the GIF has finished loading. - if isCatalog + if isBackground thumb.style.backgroundImage = "url(#{URL})" else thumb.src = URL From 0b00e393b6706154b248e368c935411b05329aa9 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Tue, 4 Feb 2014 15:15:02 +0100 Subject: [PATCH 062/143] Harden the Chrome storage API lib. Clear/delete should clear/delete data that's about to get set. --- lib/$.coffee | 98 +++++++++++++++++++++++++++++----------------------- 1 file changed, 54 insertions(+), 44 deletions(-) diff --git a/lib/$.coffee b/lib/$.coffee index b2029d711..04975ac7a 100644 --- a/lib/$.coffee +++ b/lib/$.coffee @@ -228,42 +228,49 @@ $.localKeys = [ 'usercss' ] # https://developer.chrome.com/extensions/storage.html -$.delete = (keys) -> - chrome.storage.sync.remove keys -$.get = (key, val, cb) -> - if typeof cb is 'function' - items = $.item key, val - else - items = key - cb = val - - localItems = null - syncItems = null - for key, val of items - if key in $.localKeys - (localItems or= {})[key] = val - else - (syncItems or= {})[key] = val - - count = 0 - done = (item) -> - if chrome.runtime.lastError - c.error chrome.runtime.lastError.message - $.extend items, item - cb items unless --count - - if localItems - count++ - chrome.storage.local.get localItems, done - if syncItems - count++ - chrome.storage.sync.get syncItems, done -$.set = do -> +do -> items = - sync: {} local: {} - timeout = {} + sync: {} + $.delete = (keys) -> + if typeof keys is 'string' + keys = [keys] + for key in keys + delete items.local[key] + delete items.sync[key] + chrome.storage.sync.remove keys + + $.get = (key, val, cb) -> + if typeof cb is 'function' + data = $.item key, val + else + data = key + cb = val + + localItems = null + syncItems = null + for key, val of data + if key in $.localKeys + (localItems or= {})[key] = val + else + (syncItems or= {})[key] = val + + count = 0 + done = (result) -> + if chrome.runtime.lastError + c.error chrome.runtime.lastError.message + $.extend data, result + cb data unless --count + + if localItems + count++ + chrome.storage.local.get localItems, done + if syncItems + count++ + chrome.storage.sync.get syncItems, done + + timeout = {} setArea = (area) -> data = items[area] return if !Object.keys(data).length or timeout[area] @@ -277,11 +284,11 @@ $.set = do -> delete timeout[area] items[area] = {} - setAll = $.debounce 5 * $.SECOND, -> + setAll = $.debounce $.SECOND, -> setArea 'local' setArea 'sync' - (key, val) -> + $.set = (key, val) -> if typeof key is 'string' items.sync[key] = val else @@ -290,15 +297,18 @@ $.set = do -> items.local[key] = items.sync[key] delete items.sync[key] setAll() -$.clear = (cb) -> - count = 2 - done = -> - if chrome.runtime.lastError - c.error chrome.runtime.lastError.message - return - cb?() unless --count - chrome.storage.local.clear done - chrome.storage.sync.clear done + + $.clear = (cb) -> + items.local = {} + items.sync = {} + count = 2 + done = -> + if chrome.runtime.lastError + c.error chrome.runtime.lastError.message + return + cb?() unless --count + chrome.storage.local.clear done + chrome.storage.sync.clear done <% } else { %> # http://wiki.greasespot.net/Main_Page $.sync = do -> From 5da0344a45aca0fe3a46868ec10ef207de7e2aae Mon Sep 17 00:00:00 2001 From: Mayhem Date: Tue, 4 Feb 2014 15:37:35 +0100 Subject: [PATCH 063/143] Drop data that exceeds QUOTA_BYTES_PER_ITEM. --- lib/$.coffee | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/$.coffee b/lib/$.coffee index 04975ac7a..12243a38f 100644 --- a/lib/$.coffee +++ b/lib/$.coffee @@ -278,6 +278,9 @@ do -> if chrome.runtime.lastError c.error chrome.runtime.lastError.message for key, val of data when key not of items[area] + if area is 'sync' and chrome.storage.sync.QUOTA_BYTES_PER_ITEM < JSON.stringify(val).length + key.length + c.error chrome.runtime.lastError.message, key, val + continue items[area][key] = val timeout[area] = setTimeout setArea, $.MINUTE, area return From e62eb6ebb1ee782ad2e6f4aac9267f561078c768 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Tue, 4 Feb 2014 15:58:49 +0100 Subject: [PATCH 064/143] Changelog. --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ac9bcc24..2b96396e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +- More index navigation improvements: + - Threads in catalog mode have the usual menu. + - When in catalog mode, the menu now also allows to pin/unpin threads. +- Minor bug fixes. + ### 3.16.1 - *2014-02-01* - More index navigation improvements: From 66f6c1f2a17069c45ddbacb6d6b2ed4fa3064dc9 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Tue, 4 Feb 2014 15:58:57 +0100 Subject: [PATCH 065/143] Release 4chan X v3.16.2. --- CHANGELOG.md | 2 ++ package.json | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b96396e0..0ca974517 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +### 3.16.2 - *2014-02-04* + - More index navigation improvements: - Threads in catalog mode have the usual menu. - When in catalog mode, the menu now also allows to pin/unpin threads. diff --git a/package.json b/package.json index 205c37eb2..eb42881c3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "4chan-X", - "version": "3.16.1", + "version": "3.16.2", "description": "Cross-browser extension for productive lurking on 4chan.", "meta": { "name": "4chan X", From 3bc3aabc05347945fb1497e9f2e724e008436d03 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Tue, 4 Feb 2014 18:37:36 +0100 Subject: [PATCH 066/143] fix catalog layout on firefox --- CHANGELOG.md | 2 ++ css/style.css | 7 +++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ca974517..3fe9dfa94 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +- Firefox release only: fix catalog layout. + ### 3.16.2 - *2014-02-04* - More index navigation improvements: diff --git a/css/style.css b/css/style.css index d6bb38d40..3c471b5c1 100644 --- a/css/style.css +++ b/css/style.css @@ -402,12 +402,11 @@ a[href="javascript:;"] { 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 c98e6352dd77cd979a665ca527f5c34168add9d3 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Tue, 4 Feb 2014 18:46:33 +0100 Subject: [PATCH 067/143] Release 4chan X v3.16.3. --- CHANGELOG.md | 2 ++ package.json | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3fe9dfa94..31a6a8714 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +### 3.16.3 - *2014-02-04* + - Firefox release only: fix catalog layout. ### 3.16.2 - *2014-02-04* diff --git a/package.json b/package.json index eb42881c3..8aabec1dc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "4chan-X", - "version": "3.16.2", + "version": "3.16.3", "description": "Cross-browser extension for productive lurking on 4chan.", "meta": { "name": "4chan X", From eb26a09ce575b75f53d7c5477aee9ecfe37a9b04 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Tue, 4 Feb 2014 18:54:59 +0100 Subject: [PATCH 068/143] Fix catalog layout alignment. --- CHANGELOG.md | 2 ++ css/style.css | 1 + 2 files changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 31a6a8714..41a97c500 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +- Firefox release only: fix catalog layout alignment. + ### 3.16.3 - *2014-02-04* - Firefox release only: fix catalog layout. diff --git a/css/style.css b/css/style.css index 3c471b5c1..99fdb3a20 100644 --- a/css/style.css +++ b/css/style.css @@ -413,6 +413,7 @@ a[href="javascript:;"] { margin: 0 2px 5px; max-height: 320px; word-break: break-word; + vertical-align: top; } .thumb { flex-shrink: 0; From 41910323814085ef431c150b4c658f068863dbe0 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Tue, 4 Feb 2014 18:55:16 +0100 Subject: [PATCH 069/143] Release 4chan X v3.16.4. --- CHANGELOG.md | 2 ++ package.json | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 41a97c500..72d0079a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +### 3.16.4 - *2014-02-04* + - Firefox release only: fix catalog layout alignment. ### 3.16.3 - *2014-02-04* diff --git a/package.json b/package.json index 8aabec1dc..43c5fa9a0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "4chan-X", - "version": "3.16.3", + "version": "3.16.4", "description": "Cross-browser extension for productive lurking on 4chan.", "meta": { "name": "4chan X", From 1653306439d66c8df3fd56c9c231fc1f9cc1b6d6 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Tue, 4 Feb 2014 19:54:43 +0100 Subject: [PATCH 070/143] Fix background-color of the menu button in the catalog. --- css/burichan.css | 2 +- css/futaba.css | 2 +- css/photon.css | 2 +- css/tomorrow.css | 2 +- css/yotsuba.css | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/css/burichan.css b/css/burichan.css index 3fd787105..6d3958aea 100644 --- a/css/burichan.css +++ b/css/burichan.css @@ -56,6 +56,6 @@ :root.burichan .focused.entry { background: rgba(255, 255, 255, .33); } -:root.yotsuba-b .thumb > .menu-button > i { +:root.burichan .thumb > .menu-button > i { background: #EEF2FF; } diff --git a/css/futaba.css b/css/futaba.css index c9588ccf4..9eccd158a 100644 --- a/css/futaba.css +++ b/css/futaba.css @@ -56,6 +56,6 @@ :root.futaba .focused.entry { background: rgba(255, 255, 255, .33); } -:root.yotsuba-b .thumb > .menu-button > i { +:root.futaba .thumb > .menu-button > i { background: #FFE; } diff --git a/css/photon.css b/css/photon.css index 1d95e6a63..1f1be5401 100644 --- a/css/photon.css +++ b/css/photon.css @@ -56,6 +56,6 @@ :root.photon .focused.entry { background: rgba(255, 255, 255, .33); } -:root.yotsuba-b .thumb > .menu-button > i { +:root.photon .thumb > .menu-button > i { background: #EEE; } diff --git a/css/tomorrow.css b/css/tomorrow.css index 2805b062c..453c18589 100644 --- a/css/tomorrow.css +++ b/css/tomorrow.css @@ -56,6 +56,6 @@ :root.tomorrow .focused.entry { background: rgba(0, 0, 0, .33); } -:root.yotsuba-b .thumb > .menu-button > i { +:root.tomorrow .thumb > .menu-button > i { background: #1D1F21; } diff --git a/css/yotsuba.css b/css/yotsuba.css index b78fa0cb6..80731f3f1 100644 --- a/css/yotsuba.css +++ b/css/yotsuba.css @@ -56,6 +56,6 @@ :root.yotsuba .focused.entry { background: rgba(255, 255, 255, .33); } -:root.yotsuba-b .thumb > .menu-button > i { +:root.yotsuba .thumb > .menu-button > i { background: #FFE; } From 5a29b745816b01b08fbb7ebd0afa82278e726dc3 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Wed, 5 Feb 2014 09:22:30 +0100 Subject: [PATCH 071/143] Fix title not being set on post previews in the QR when adding multiple files. --- src/Posting/QR.post.coffee | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Posting/QR.post.coffee b/src/Posting/QR.post.coffee index a38362840..275406e7e 100644 --- a/src/Posting/QR.post.coffee +++ b/src/Posting/QR.post.coffee @@ -153,7 +153,10 @@ QR.post = class @filesize = $.bytesToString file.size @nodes.label.hidden = false if QR.spoiler URL.revokeObjectURL @URL - @showFileData() if @ is QR.selected + if @ is QR.selected + @showFileData() + else + @updateFilename() unless /^image/.test file.type @nodes.el.style.backgroundImage = null return From d7905a0960670270f6d6f568a2c9764fe0eadd45 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Wed, 5 Feb 2014 09:27:26 +0100 Subject: [PATCH 072/143] Fix the search clear button displacing the hidden threads count. --- css/style.css | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/css/style.css b/css/style.css index 99fdb3a20..b058c9474 100644 --- a/css/style.css +++ b/css/style.css @@ -389,7 +389,9 @@ a[href="javascript:;"] { } #index-search-clear { color: gray; - margin-left: -1.25em; + position: relative; + left: -1.25em; + width: 0; } <% if (type === 'crx') { %> /* ``::-webkit-*'' selectors break selector lists on Firefox. */ From d1090b52fad9ef945ff37f9bbd9308d87d3202d8 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Wed, 5 Feb 2014 09:29:47 +0100 Subject: [PATCH 073/143] 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 78df3322a..62ea567cb 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -133,7 +133,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 e062f1626f16e1d4dcd85a7a0b71fa7aa4e51b82 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Wed, 5 Feb 2014 09:32:01 +0100 Subject: [PATCH 074/143] Remove Cooldown Prediction. --- src/General/Config.coffee | 1 - src/Posting/QR.cooldown.coffee | 11 +---------- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/src/General/Config.coffee b/src/General/Config.coffee index 14b665337..3ae30b93d 100644 --- a/src/General/Config.coffee +++ b/src/General/Config.coffee @@ -62,7 +62,6 @@ Config = 'Remember Spoiler': [false, 'Remember the spoiler state, instead of resetting after posting.'] 'Hide Original Post Form': [true, 'Hide the normal post form.'] 'Cooldown': [true, 'Indicate the remaining time before posting again.'] - 'Cooldown Prediction': [true, 'Decrease the cooldown time by taking into account upload speed. Disable it if it\'s inaccurate for you.'] <% if (type === 'crx') { %> 'Tab to Choose Files First': [false, 'Tab to the file input before the submit button.'] <% } %> diff --git a/src/Posting/QR.cooldown.coffee b/src/Posting/QR.cooldown.coffee index 2f6a16f71..4a5f3f08c 100644 --- a/src/Posting/QR.cooldown.coffee +++ b/src/Posting/QR.cooldown.coffee @@ -7,8 +7,6 @@ QR.cooldown = $.off window, 'cooldown:timers', setTimers for type of QR.cooldown.types QR.cooldown.types[type] = +QR.cooldown.types[type] - QR.cooldown.upSpd = 0 - QR.cooldown.upSpdAccuracy = .5 key = "cooldown.#{g.BOARD}" $.get key, {}, (item) -> QR.cooldown.cooldowns = item[key] @@ -31,10 +29,6 @@ QR.cooldown = if delay cooldown = {delay} else - if post.file - upSpd = post.file.size / ((start - req.uploadStartTime) / $.SECOND) - QR.cooldown.upSpdAccuracy = ((upSpd > QR.cooldown.upSpd * .9) + QR.cooldown.upSpdAccuracy) / 2 - QR.cooldown.upSpd = upSpd cooldown = {isReply, threadID} QR.cooldown.cooldowns[start] = cooldown $.set "cooldown.#{g.BOARD}", QR.cooldown.cooldowns @@ -61,7 +55,7 @@ QR.cooldown = isReply = post.thread isnt 'new' hasFile = !!post.file seconds = null - {types, cooldowns, upSpd, upSpdAccuracy} = QR.cooldown + {types, cooldowns} = QR.cooldown for start, cooldown of cooldowns start = +start @@ -92,9 +86,6 @@ QR.cooldown = type += '_intra' if isReply and +post.thread is cooldown.threadID seconds = Math.max seconds, types[type] - elapsed - if seconds and Conf['Cooldown Prediction'] and hasFile and upSpd - seconds -= post.file.size // (upSpd * upSpdAccuracy) - seconds = Math.max seconds, 0 # Update the status when we change posting type. # Don't get stuck at some random number. # Don't interfere with progress status updates. From 079e852277c20f11937c1b2d6ac26468134815e2 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Wed, 5 Feb 2014 10:01:21 +0100 Subject: [PATCH 075/143] Hide the QR when switching to catalog mode. --- src/General/Index.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/src/General/Index.coffee b/src/General/Index.coffee index 62ea567cb..7377b5f8b 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -218,6 +218,7 @@ Index = Index.cb.toggleCatalogMode() Index.togglePagelist() Index.buildIndex() + QR.hide() if QR.nodes and Conf['Index Mode'] is 'catalog' sort: -> Index.sort() Index.buildIndex() From cc4121070a73dde7ec95ad714de8e4f73d8f32e2 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Wed, 5 Feb 2014 15:14:39 +0100 Subject: [PATCH 076/143] Add Threads per Page setting. --- CHANGELOG.md | 2 ++ src/General/Build.coffee | 2 +- src/General/Config.coffee | 1 + src/General/Index.coffee | 33 ++++++++++++++++++++++++++------- 4 files changed, 30 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 72d0079a4..6d234a55b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +- Added a setting to configure the number of threads per page for the paged mode of the index. + ### 3.16.4 - *2014-02-04* - Firefox release only: fix catalog layout alignment. diff --git a/src/General/Build.coffee b/src/General/Build.coffee index 94a9125fd..027f09515 100644 --- a/src/General/Build.coffee +++ b/src/General/Build.coffee @@ -271,7 +271,7 @@ Build = "
      #{thread.OP.info.subject}
      " else '' - comment = thread.OP.nodes.comment.innerHTML.replace /(
      ){2,}/g, '
      ' + comment = thread.OP.nodes.comment.innerHTML.replace /(
      \s*){2,}/g, '
      ' root = $.el 'div', className: 'catalog-thread' diff --git a/src/General/Config.coffee b/src/General/Config.coffee index 3ae30b93d..ca18ba7d4 100644 --- a/src/General/Config.coffee +++ b/src/General/Config.coffee @@ -141,6 +141,7 @@ Config = Index: 'Index Mode': 'paged' 'Index Sort': 'bump' + 'Threads per Page': 0 'Show Replies': true 'Anchor Hidden Threads': true 'Refreshed Navigation': false diff --git a/src/General/Index.coffee b/src/General/Index.coffee index 7377b5f8b..2e6dd0497 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -56,6 +56,16 @@ Index = $.on input, 'change', $.cb.value $.on input, 'change', @cb.sort + threadNumEntry = + el: $.el 'span', textContent: 'Threads per page' + subEntries: [ + { el: $.el 'label', innerHTML: '', title: 'Use 0 for default value' } + ] + threadsNumInput = threadNumEntry.subEntries[0].el.firstChild + threadsNumInput.value = Conf['Threads per Page'] + $.on threadsNumInput, 'change', $.cb.value + $.on threadsNumInput, 'change', @cb.threadsNum + repliesEntry = el: $.el 'label', innerHTML: ' Show replies' @@ -83,7 +93,7 @@ Index = el: $.el 'span', textContent: 'Index Navigation' order: 90 - subEntries: [modeEntry, sortEntry, repliesEntry, anchorEntry, refNavEntry] + subEntries: [modeEntry, sortEntry, threadNumEntry, repliesEntry, anchorEntry, refNavEntry] $.addClass doc, 'index-loading' @update() @@ -222,6 +232,10 @@ Index = sort: -> Index.sort() Index.buildIndex() + threadsNum: -> + return unless Conf['Index Mode'] is 'paged' + Index.buildPagelist() + Index.buildIndex() replies: -> Index.buildThreads() Index.sort() @@ -263,11 +277,17 @@ Index = Index.setPage() Index.scrollToIndex() - getPagesNum: -> - if Index.isSearching - Math.ceil (Index.sortedNodes.length / 2) / Index.threadsNumPerPage + getThreadsNumPerPage: -> + if Conf['Threads per Page'] > 0 + +Conf['Threads per Page'] else - Index.pagesNum + Index.threadsNumPerPage + getPagesNum: -> + numThreads = if Index.isSearching + Index.sortedNodes.length / 2 + else + Index.liveThreadIDs.length + Math.ceil numThreads / Index.getThreadsNumPerPage() getMaxPageNum: -> Math.max 0, Index.getPagesNum() - 1 togglePagelist: -> @@ -402,7 +422,6 @@ Index = Index.buildIndex() Index.setPage() parseThreadList: (pages) -> - Index.pagesNum = pages.length Index.threadsNumPerPage = pages[0].threads.length Index.liveThreadData = pages.reduce ((arr, next) -> arr.concat next.threads), [] Index.liveThreadIDs = Index.liveThreadData.map (data) -> data.no @@ -513,7 +532,7 @@ Index = switch Conf['Index Mode'] when 'paged' pageNum = Index.getCurrentPage() - nodesPerPage = Index.threadsNumPerPage * 2 + nodesPerPage = Index.getThreadsNumPerPage() * 2 nodes = Index.sortedNodes[nodesPerPage * pageNum ... nodesPerPage * (pageNum + 1)] when 'catalog' nodes = Index.buildCatalogViews() From 50d9675c45fbeab7b1f4c56e1bb3196a156b8d51 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Wed, 5 Feb 2014 15:28:44 +0100 Subject: [PATCH 077/143] Fix crash with mobile navLinks. --- 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 7b4f9d8ae..4de807d38 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -158,7 +158,7 @@ Index = rmCatalogLinks: -> $.addClass doc, 'removing-catalog-links' $.ready -> - for el in $$ '.navLinks a[href$=catalog]' + for el in $$ '.navLinks.desktop a[href$=catalog]' $.rm el.previousSibling $.rm el $.rmClass doc, 'removing-catalog-links' From 3d7097fffbc875cb7995f1f3122b1dff6886ad40 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Wed, 5 Feb 2014 16:11:04 +0100 Subject: [PATCH 078/143] Screw supporting 4chan's inline features. --- src/Miscellaneous/ExpandThread.coffee | 10 +--------- src/Miscellaneous/Fourchan.coffee | 7 ------- src/Monitoring/ThreadUpdater.coffee | 8 -------- 3 files changed, 1 insertion(+), 24 deletions(-) diff --git a/src/Miscellaneous/ExpandThread.coffee b/src/Miscellaneous/ExpandThread.coffee index d7c6a6d59..8cfb24411 100644 --- a/src/Miscellaneous/ExpandThread.coffee +++ b/src/Miscellaneous/ExpandThread.coffee @@ -92,12 +92,4 @@ ExpandThread = postsRoot.push root Main.callbackNodes Post, posts $.after a, postsRoot - - postsCount = postsRoot.length - a.textContent = ExpandThread.text '-', postsCount, filesCount - - # Enable 4chan features. - if Conf['Enable 4chan\'s Extension'] - $.globalEval "Parser.parseThread(#{thread}, 1, #{postsCount})" - else - Fourchan.parseThread thread.ID, 1, postsCount + a.textContent = ExpandThread.text '-', postsRoot.length, filesCount diff --git a/src/Miscellaneous/Fourchan.coffee b/src/Miscellaneous/Fourchan.coffee index 6f290d662..a19611b47 100644 --- a/src/Miscellaneous/Fourchan.coffee +++ b/src/Miscellaneous/Fourchan.coffee @@ -42,10 +42,3 @@ Fourchan = math: -> return if @isClone or !$ '.math', @nodes.comment $.event 'jsmath', @nodes.post, window - parseThread: (threadID, offset, limit) -> - # Fix /sci/ - # Fix /g/ - $.event '4chanParsingDone', - threadId: threadID - offset: offset - limit: limit diff --git a/src/Monitoring/ThreadUpdater.coffee b/src/Monitoring/ThreadUpdater.coffee index 028a4ccd9..784c4738f 100644 --- a/src/Monitoring/ThreadUpdater.coffee +++ b/src/Monitoring/ThreadUpdater.coffee @@ -254,11 +254,3 @@ ThreadUpdater = window.scrollTo 0, d.body.clientHeight else Header.scrollTo nodes[0] - - # Enable 4chan features. - threadID = ThreadUpdater.thread.ID - {length} = $$ '.thread > .postContainer', ThreadUpdater.root - if Conf['Enable 4chan\'s Extension'] - $.globalEval "Parser.parseThread(#{threadID}, #{-count})" - else - Fourchan.parseThread threadID, length - count, length From 3284de0d06583f47176238b51eed2b4cfad6c4c0 Mon Sep 17 00:00:00 2001 From: milky Date: Thu, 6 Feb 2014 05:02:36 +1100 Subject: [PATCH 079/143] Archive link. --- html/General/Settings-section-Rice.html | 1 + src/Archive/Redirect.coffee | 5 ++++- src/General/Header.coffee | 6 +++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/html/General/Settings-section-Rice.html b/html/General/Settings-section-Rice.html index 43a9a8622..fe89c50ef 100644 --- a/html/General/Settings-section-Rice.html +++ b/html/General/Settings-section-Rice.html @@ -3,6 +3,7 @@
      In the following, board can translate to a board ID (a, b, etc...), the current board (current), or the Twitter link (@).
      Board link: board
      +
      Archive link: board-archive
      Title link: board-title
      Board link (Replace with title when on that board): board-replace
      Full text link: board-full
      diff --git a/src/Archive/Redirect.coffee b/src/Archive/Redirect.coffee index 67cf6d575..21c4c0614 100644 --- a/src/Archive/Redirect.coffee +++ b/src/Archive/Redirect.coffee @@ -45,7 +45,7 @@ Redirect = cb?() to: (dest, data) -> - archive = (if dest is 'search' then Redirect.data.thread else Redirect.data[dest])[data.boardID] + archive = (if dest is 'search' or 'board' then Redirect.data.thread else Redirect.data[dest])[data.boardID] return '' unless archive Redirect[dest] archive, data @@ -80,6 +80,9 @@ Redirect = file: (archive, {boardID, filename}) -> "#{Redirect.protocol archive}#{archive.domain}/#{boardID}/full_image/#{filename}" + board: (archive, {boardID}) -> + "#{Redirect.protocol archive}#{archive.domain}/#{boardID}/" + search: (archive, {boardID, type, value}) -> type = if type is 'name' 'username' diff --git a/src/General/Header.coffee b/src/General/Header.coffee index 6572b1146..2d04d262a 100644 --- a/src/General/Header.coffee +++ b/src/General/Header.coffee @@ -113,7 +113,7 @@ Header = $.rmAll list return unless text as = $$ '#full-board-list a[title]', Header.bar - nodes = text.match(/[\w@]+(-(all|title|replace|full|text:"[^"]+"))*|[^\w@]+/g).map (t) -> + nodes = text.match(/[\w@]+(-(all|title|replace|full|archive|text:"[^"]+"))*|[^\w@]+/g).map (t) -> if /^[^\w@]/.test t return $.tn t if /^toggle-all/.test t @@ -140,6 +140,10 @@ Header = else a.textContent + if /-archive/.test t + a.href = Redirect.to 'board', + boardID: board + $.addClass a, 'navSmall' if board is '@' return a $.tn t From 4eb0574505806676e030075d474dfbc11eacd71a Mon Sep 17 00:00:00 2001 From: milky Date: Thu, 6 Feb 2014 05:47:19 +1100 Subject: [PATCH 080/143] Further archive link work. --- src/Archive/Redirect.coffee | 2 +- src/General/Header.coffee | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Archive/Redirect.coffee b/src/Archive/Redirect.coffee index 21c4c0614..25a773fc8 100644 --- a/src/Archive/Redirect.coffee +++ b/src/Archive/Redirect.coffee @@ -45,7 +45,7 @@ Redirect = cb?() to: (dest, data) -> - archive = (if dest is 'search' or 'board' then Redirect.data.thread else Redirect.data[dest])[data.boardID] + archive = (if dest in ['search', 'board'] then Redirect.data.thread else Redirect.data[dest])[data.boardID] return '' unless archive Redirect[dest] archive, data diff --git a/src/General/Header.coffee b/src/General/Header.coffee index 2d04d262a..64d83ee37 100644 --- a/src/General/Header.coffee +++ b/src/General/Header.coffee @@ -140,9 +140,8 @@ Header = else a.textContent - if /-archive/.test t - a.href = Redirect.to 'board', - boardID: board + if /-archive/.test(t) and href = Redirect.to 'board', {boardID: board} + a.href = href $.addClass a, 'navSmall' if board is '@' return a From 6b45758198f123801e4fe969b3e63d19eb628655 Mon Sep 17 00:00:00 2001 From: milky Date: Thu, 6 Feb 2014 06:19:07 +1100 Subject: [PATCH 081/143] Changelog. --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d234a55b..4d5296d78 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,4 @@ +- Added `Archive link` to the Custom Board Navigation Rice - Added a setting to configure the number of threads per page for the paged mode of the index. ### 3.16.4 - *2014-02-04* From 7931acd942fcfae3a562f8b62cd50363079e4cce Mon Sep 17 00:00:00 2001 From: Mayhem Date: Thu, 6 Feb 2014 19:04:34 +0100 Subject: [PATCH 082/143] Fix the menu button offset in Firefox in the catalog. --- CHANGELOG.md | 1 + css/style.css | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d5296d78..a5032f062 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ - Added `Archive link` to the Custom Board Navigation Rice - Added a setting to configure the number of threads per page for the paged mode of the index. +- Dropped support for the official catalog. ### 3.16.4 - *2014-02-04* diff --git a/css/style.css b/css/style.css index e09a0c54f..cb5c54183 100644 --- a/css/style.css +++ b/css/style.css @@ -469,6 +469,9 @@ a[href="javascript:;"] { border-radius: 0 2px 0 2px; font-size: 14px; text-align: center; +<% if (type === 'userscript') { %> + line-height: normal; +<% } %> } .thread-stats { flex-shrink: 0; @@ -516,7 +519,7 @@ a.hide-announcement { #updater > div:last-child { text-align: center; } -#updater input[type=number] { +#updater input[type="number"] { width: 4em; } #updater:not(:hover) > div:not(.move) { From 245dfaa1f935ee97856f7c5f718d6af774c078e5 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Fri, 7 Feb 2014 18:45:19 +0100 Subject: [PATCH 083/143] Bring back return/catalog links. --- css/style.css | 5 ---- html/General/Index-navlinks.html | 1 + html/General/Index-pagelist.html | 3 +++ src/General/Index.coffee | 40 +++++++++++++++++++++++++------- 4 files changed, 35 insertions(+), 14 deletions(-) diff --git a/css/style.css b/css/style.css index cb5c54183..fd967d398 100644 --- a/css/style.css +++ b/css/style.css @@ -378,11 +378,6 @@ a[href="javascript:;"] { :root.index-loading .pagelist { display: none; } -:root.removing-catalog-links .navLinks { - /* can't `display:none;` the text node next to the link, - so we hide the container instead. */ - visibility: hidden; -} #index-search { padding-right: 1.5em; width: 100px; diff --git a/html/General/Index-navlinks.html b/html/General/Index-navlinks.html index f322941a7..da5b9bbaf 100644 --- a/html/General/Index-navlinks.html +++ b/html/General/Index-navlinks.html @@ -1,3 +1,4 @@ +[]  [ diff --git a/html/General/Index-pagelist.html b/html/General/Index-pagelist.html index e6923bb7a..803cdca54 100644 --- a/html/General/Index-pagelist.html +++ b/html/General/Index-pagelist.html @@ -9,3 +9,6 @@
      + diff --git a/src/General/Index.coffee b/src/General/Index.coffee index 410f6edea..888d3a552 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -2,7 +2,7 @@ Index = showHiddenThreads: false init: -> if g.VIEW isnt 'index' - @rmCatalogLinks() + $.ready @setupNavLinks return return if g.BOARD.ID is 'f' @@ -29,9 +29,13 @@ Index = { el: $.el 'label', innerHTML: ' All threads' } { el: $.el 'label', innerHTML: ' 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 @@ -99,11 +103,13 @@ Index = @navLinks = $.el 'div', className: 'navLinks' innerHTML: <%= importHTML('General/Index-navlinks') %> + @indexModeToggle = $ '#index-mode-toggle', @navLinks @searchInput = $ '#index-search', @navLinks @hideLabel = $ '#hidden-label', @navLinks @currentPage = @getCurrentPage() $.on window, 'popstate', @cb.popstate $.on @pagelist, 'click', @cb.pageNav + $.on @indexModeToggle, 'click', @cb.pageNav $.on @searchInput, 'input', @onSearchInput $.on $('#index-search-clear', @navLinks), 'click', @clearSearch $.on $('#hidden-toggle a', @navLinks), 'click', @cb.toggleHiddenThreads @@ -211,20 +217,26 @@ Index = $.set 'Index Mode', 'catalog' window.location = './' $.add $.id('info'), a - rmCatalogLinks: -> - $.addClass doc, 'removing-catalog-links' - $.ready -> - for el in $$ '.navLinks.desktop a[href$=catalog]' - $.rm el.previousSibling - $.rm el - $.rmClass doc, 'removing-catalog-links' + setupNavLinks: -> + for el in $$ '.navLinks.desktop > a' + if el.getAttribute('href') is '.././catalog' + el.href = '.././' + $.on el, 'click', -> + switch @textContent + when 'Return' + $.set 'Index Mode', 'paged' + when 'Catalog' + $.set 'Index Mode', 'catalog' + return cb: toggleCatalogMode: -> if Conf['Index Mode'] is 'catalog' + Index.indexModeToggle.textContent = 'Return' $.addClass Index.root, 'catalog-mode' $('#hidden-toggle', Index.navLinks).hidden = false else + Index.indexModeToggle.textContent = 'Catalog' $.rmClass Index.root, 'catalog-mode' $('#hidden-toggle', Index.navLinks).hidden = true toggleHiddenThreads: -> @@ -263,6 +275,16 @@ Index = else return e.preventDefault() + switch a.textContent + when 'Catalog' + mode = 'catalog' + when 'Return' + mode = 'paged' + if mode + $.set 'Index Mode', mode + Conf['Index Mode'] = mode + Index.cb.mode() + Index.scrollToIndex() Index.userPageNav +a.pathname.split('/')[2] scrollToIndex: -> From bb274afb9d1e516f87e2b44733a787bb1e29f649 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Fri, 7 Feb 2014 19:06:42 +0100 Subject: [PATCH 084/143] Min-width/height for catalog thumbs. --- css/style.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/css/style.css b/css/style.css index fd967d398..baee60a41 100644 --- a/css/style.css +++ b/css/style.css @@ -426,6 +426,10 @@ a[href="javascript:;"] { 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 { background-size: 100px; width: 100px; From 4755631ec811d231e024ef601ba52b55f317dd36 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Fri, 7 Feb 2014 21:20:31 +0100 Subject: [PATCH 085/143] Move the index nav links closer to the threads list. Also change its class to an ID. Also scroll to it rather than the threads list on refresh. --- src/General/Index.coffee | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/General/Index.coffee b/src/General/Index.coffee index 888d3a552..3135251ad 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -57,7 +57,7 @@ Index = threadNumEntry = el: $.el 'span', textContent: 'Threads per page' subEntries: [ - { el: $.el 'label', innerHTML: '', title: 'Use 0 for default value' } + { el: $.el 'label', innerHTML: '', title: 'Use 0 for default value' } ] threadsNumInput = threadNumEntry.subEntries[0].el.firstChild threadsNumInput.value = Conf['Threads per Page'] @@ -101,7 +101,7 @@ Index = hidden: true innerHTML: <%= importHTML('General/Index-pagelist') %> @navLinks = $.el 'div', - className: 'navLinks' + id: 'nav-links' innerHTML: <%= importHTML('General/Index-navlinks') %> @indexModeToggle = $ '#index-mode-toggle', @navLinks @searchInput = $ '#index-search', @navLinks @@ -128,7 +128,7 @@ Index = for navLink in $$ '.navLinks' $.rm navLink - $.after $.x('child::form/preceding-sibling::hr[1]'), Index.navLinks + $.before $.id('delform'), [Index.navLinks, $.x 'child::form/preceding-sibling::hr[1]'] $.rmClass doc, 'index-loading' $.asap (-> $('.pagelist') or d.readyState isnt 'loading'), -> $.replace $('.pagelist'), Index.pagelist @@ -288,7 +288,7 @@ Index = Index.userPageNav +a.pathname.split('/')[2] scrollToIndex: -> - Header.scrollToIfNeeded Index.root + Header.scrollToIfNeeded Index.navLinks getCurrentPage: -> +window.location.pathname.split('/')[2] From 67aafb4ec57f03ad635f9acc9b1c65344d4f6a45 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Fri, 7 Feb 2014 22:40:32 +0100 Subject: [PATCH 086/143] Return to the previous index mode that's not the catalog. --- src/General/Config.coffee | 1 + src/General/Index.coffee | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/General/Config.coffee b/src/General/Config.coffee index faa911ca0..e192edcfb 100644 --- a/src/General/Config.coffee +++ b/src/General/Config.coffee @@ -140,6 +140,7 @@ Config = 'Custom CSS': false Index: 'Index Mode': 'paged' + 'Previous Index Mode': 'paged' 'Index Sort': 'bump' 'Threads per Page': 0 'Show Replies': true diff --git a/src/General/Index.coffee b/src/General/Index.coffee index 3135251ad..2e5aa7bc3 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -224,7 +224,7 @@ Index = $.on el, 'click', -> switch @textContent when 'Return' - $.set 'Index Mode', 'paged' + $.set 'Index Mode', Conf['Previous Index Mode'] when 'Catalog' $.set 'Index Mode', 'catalog' return @@ -250,7 +250,11 @@ Index = Index.cb.toggleCatalogMode() Index.togglePagelist() Index.buildIndex() - QR.hide() if QR.nodes and Conf['Index Mode'] is 'catalog' + mode = Conf['Index Mode'] + if mode not in ['catalog', Conf['Previous Index Mode']] + Conf['Previous Index Mode'] = mode + $.set 'Previous Index Mode', mode + QR.hide() if QR.nodes and mode is 'catalog' sort: -> Index.sort() Index.buildIndex() @@ -279,7 +283,7 @@ Index = when 'Catalog' mode = 'catalog' when 'Return' - mode = 'paged' + mode = Conf['Previous Index Mode'] if mode $.set 'Index Mode', mode Conf['Index Mode'] = mode From 7ebfbe99de81fa78ad79689d6287a326c2a6b9f4 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Fri, 7 Feb 2014 23:14:15 +0100 Subject: [PATCH 087/143] Update deps. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 43c5fa9a0..6659bba9e 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "grunt-bump": "~0.0.13", "grunt-concurrent": "~0.4.3", "grunt-contrib-clean": "~0.5.0", - "grunt-contrib-coffee": "~0.9.0", + "grunt-contrib-coffee": "~0.10.0", "grunt-contrib-compress": "~0.6.0", "grunt-contrib-concat": "~0.3.0", "grunt-contrib-copy": "~0.5.0", From a072d67a8a0cc49e25fd051bb4374cc1ed3c24aa Mon Sep 17 00:00:00 2001 From: Mayhem Date: Fri, 7 Feb 2014 23:15:52 +0100 Subject: [PATCH 088/143] Release 4chan X v3.16.5. --- CHANGELOG.md | 2 ++ package.json | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a5032f062..182bd4685 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +### 3.16.5 - *2014-02-07* + - Added `Archive link` to the Custom Board Navigation Rice - Added a setting to configure the number of threads per page for the paged mode of the index. - Dropped support for the official catalog. diff --git a/package.json b/package.json index 6659bba9e..5bd83349d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "4chan-X", - "version": "3.16.4", + "version": "3.16.5", "description": "Cross-browser extension for productive lurking on 4chan.", "meta": { "name": "4chan X", From f6f1126130289a905bfdc92becf16bc414a6009c Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sat, 8 Feb 2014 18:05:33 +0100 Subject: [PATCH 089/143] Quote markers. --- CHANGELOG.md | 5 ++++ src/General/Config.coffee | 4 +-- src/General/Main.coffee | 4 +-- src/General/Post.coffee | 15 +++++++---- src/General/Settings.coffee | 4 +-- src/Quotelinks/QuoteBacklink.coffee | 11 ++++++-- src/Quotelinks/QuoteCT.coffee | 22 ---------------- src/Quotelinks/QuoteMarkers.coffee | 39 +++++++++++++++++++++++++++++ src/Quotelinks/QuoteOP.coffee | 29 --------------------- src/Quotelinks/QuoteYou.coffee | 14 ----------- src/Quotelinks/Quotify.coffee | 28 ++++++++------------- 11 files changed, 77 insertions(+), 98 deletions(-) delete mode 100644 src/Quotelinks/QuoteCT.coffee create mode 100644 src/Quotelinks/QuoteMarkers.coffee delete mode 100644 src/Quotelinks/QuoteOP.coffee delete mode 100644 src/Quotelinks/QuoteYou.coffee diff --git a/CHANGELOG.md b/CHANGELOG.md index 182bd4685..ed12aa9c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +- New setting: `Quote Markers`, enabled by default + - This merges `Mark Quotes of You`, `Mark OP Quotes` and `Mark Cross-thread Quotes` into one feature. + - Backlinks now also get these markers. + - Multiple markers are now more compact, for example `>>123 (You/OP)` instead of `>>123 (You) (OP)`. + ### 3.16.5 - *2014-02-07* - Added `Archive link` to the Custom Board Navigation Rice diff --git a/src/General/Config.coffee b/src/General/Config.coffee index e192edcfb..9b523b481 100644 --- a/src/General/Config.coffee +++ b/src/General/Config.coffee @@ -73,9 +73,7 @@ Config = 'Quote Previewing': [true, 'Show quoted post on hover.'] 'Quote Highlighting': [true, 'Highlight the previewed post.'] 'Resurrect Quotes': [true, 'Link dead quotes to the archives.'] - 'Mark Quotes of You': [true, 'Add \'(You)\' to quotes linking to your posts.'] - 'Mark OP Quotes': [true, 'Add \'(OP)\' to OP quotes.'] - 'Mark Cross-thread Quotes': [true, 'Add \'(Cross-thread)\' to cross-threads quotes.'] + 'Quote Markers': [true, 'Add "(You)", "(OP)", "(Cross-thread)", "(Dead)" markers to quote links.'] imageExpansion: 'Fit width': [true, ''] 'Fit height': [false, ''] diff --git a/src/General/Main.coffee b/src/General/Main.coffee index c7bdd1ecd..6f7a455ea 100644 --- a/src/General/Main.coffee +++ b/src/General/Main.coffee @@ -96,9 +96,7 @@ Main = initFeature 'Quote Inlining', QuoteInline initFeature 'Quote Previewing', QuotePreview initFeature 'Quote Backlinks', QuoteBacklink - initFeature 'Mark Quotes of You', QuoteYou - initFeature 'Mark OP Quotes', QuoteOP - initFeature 'Mark Cross-thread Quotes', QuoteCT + initFeature 'Quote Markers', QuoteMarkers initFeature 'Anonymize', Anonymize initFeature 'Color User IDs', IDColor initFeature 'Time Formatting', Time diff --git a/src/General/Post.coffee b/src/General/Post.coffee index f3b69895b..2226ff64b 100644 --- a/src/General/Post.coffee +++ b/src/General/Post.coffee @@ -177,8 +177,11 @@ class Post # Get quotelinks/backlinks to this post # and paint them (Dead). for quotelink in Get.allQuotelinksLinkingTo @ when not $.hasClass quotelink, 'deadlink' - $.add quotelink, $.tn '\u00A0(Dead)' $.addClass quotelink, 'deadlink' + continue unless Conf['Quote Markers'] + post = Get.postFromNode quotelink + {board, thread} = if post.isClone then post.context else post + QuoteMarkers.parseQuotelink board, thread, post, quotelink, true return # XXX tmp fix for 4chan's racing condition # giving us false-positive dead posts. @@ -197,10 +200,12 @@ class Post for clone in @clones clone.resurrect() - for quotelink in Get.allQuotelinksLinkingTo @ - if $.hasClass quotelink, 'deadlink' - quotelink.textContent = quotelink.textContent.replace '\u00A0(Dead)', '' - $.rmClass quotelink, 'deadlink' + for quotelink in Get.allQuotelinksLinkingTo @ when $.hasClass quotelink, 'deadlink' + $.rmClass quotelink, 'deadlink' + continue unless Conf['Quote Markers'] + post = Get.postFromNode quotelink + {board, thread} = if post.isClone then post.context else post + QuoteMarkers.parseQuotelink board, thread, post, quotelink, true return collect: -> diff --git a/src/General/Settings.coffee b/src/General/Settings.coffee index 3359a82db..86c027c4e 100644 --- a/src/General/Settings.coffee +++ b/src/General/Settings.coffee @@ -192,8 +192,8 @@ Settings = 'Remember QR size': '' 'Quote Inline': 'Quote Inlining' 'Quote Preview': 'Quote Previewing' - 'Indicate OP quote': 'Mark OP Quotes' - 'Indicate Cross-thread Quotes': 'Mark Cross-thread Quotes' + 'Indicate OP quote': '' + 'Indicate Cross-thread Quotes': '' # filter 'uniqueid': 'uniqueID' 'mod': 'capcode' diff --git a/src/Quotelinks/QuoteBacklink.coffee b/src/Quotelinks/QuoteBacklink.coffee index 5383e1dfd..b6b00d825 100644 --- a/src/Quotelinks/QuoteBacklink.coffee +++ b/src/Quotelinks/QuoteBacklink.coffee @@ -24,10 +24,17 @@ QuoteBacklink = cb: @secondNode firstNode: -> return if @isClone or !@quotes.length + text = QuoteBacklink.funk @ID a = $.el 'a', href: "/#{@board}/res/#{@thread}#p#{@}" - className: if @isHidden then 'filtered backlink' else 'backlink' - textContent: QuoteBacklink.funk @ID + className: 'backlink' + textContent: text + if @isHidden + $.addClass a, 'filtered' + if @isDead + $.addClass a, 'deadlink' + if Conf['Quote Markers'] + QuoteMarkers.parseQuotelink @board, @thread, @, a, false, text for quote in @quotes containers = [QuoteBacklink.getContainer quote] if (post = g.posts[quote]) and post.nodes.backlinkContainer diff --git a/src/Quotelinks/QuoteCT.coffee b/src/Quotelinks/QuoteCT.coffee deleted file mode 100644 index 62735db26..000000000 --- a/src/Quotelinks/QuoteCT.coffee +++ /dev/null @@ -1,22 +0,0 @@ -QuoteCT = - init: -> - return if !Conf['Mark Cross-thread Quotes'] - - # \u00A0 is nbsp - @text = '\u00A0(Cross-thread)' - Post.callbacks.push - name: 'Mark Cross-thread Quotes' - cb: @node - node: -> - # Stop there if it's a clone of a post in the same thread. - return if @isClone and @thread is @context.thread - - {board, thread} = if @isClone then @context else @ - for quotelink in @nodes.quotelinks - {boardID, threadID} = Get.postDataFromLink quotelink - continue unless threadID # deadlink - if @isClone - quotelink.textContent = quotelink.textContent.replace QuoteCT.text, '' - if boardID is board.ID and threadID isnt thread.ID - $.add quotelink, $.tn QuoteCT.text - return diff --git a/src/Quotelinks/QuoteMarkers.coffee b/src/Quotelinks/QuoteMarkers.coffee new file mode 100644 index 000000000..60433f7b6 --- /dev/null +++ b/src/Quotelinks/QuoteMarkers.coffee @@ -0,0 +1,39 @@ +QuoteMarkers = + init: -> + return if !Conf['Quote Markers'] + + Post.callbacks.push + name: 'Quote Markers' + cb: @node + node: -> + {board, thread} = if @isClone then @context else @ + for quotelink in @nodes.quotelinks + QuoteMarkers.parseQuotelink board, thread, @, quotelink, !!@isClone + return + parseQuotelink: (board, thread, post, quotelink, mayReset, customText) -> + markers = [] + {boardID, threadID, postID} = Get.postDataFromLink quotelink + + if QR.db?.get {boardID, threadID, postID} + markers.push 'You' + + if board.ID is boardID + if thread.ID is postID + markers.push 'OP' + + if threadID and threadID isnt thread.ID # threadID is 0 for deadlinks + markers.push 'Cross-thread' + + if $.hasClass quotelink, 'deadlink' + markers.push 'Dead' + + text = if customText + customText + else if boardID is post.board.ID + ">>#{postID}" + else + ">>>/#{boardID}/#{postID}" + if markers.length + quotelink.textContent = "#{text}\u00A0(#{markers.join '/'})" + else if mayReset + quotelink.textContent = text diff --git a/src/Quotelinks/QuoteOP.coffee b/src/Quotelinks/QuoteOP.coffee deleted file mode 100644 index 65e468fe9..000000000 --- a/src/Quotelinks/QuoteOP.coffee +++ /dev/null @@ -1,29 +0,0 @@ -QuoteOP = - init: -> - return if !Conf['Mark OP Quotes'] - - # \u00A0 is nbsp - @text = '\u00A0(OP)' - Post.callbacks.push - name: 'Mark OP Quotes' - cb: @node - node: -> - # Stop there if it's a clone of a post in the same thread. - return if @isClone and @thread is @context.thread - # Stop there if there's no quotes in that post. - return unless (quotes = @quotes).length - {quotelinks} = @nodes - - # rm (OP) from cross-thread quotes. - if @isClone and @thread.fullID in quotes - for quotelink in quotelinks - quotelink.textContent = quotelink.textContent.replace QuoteOP.text, '' - - {fullID} = (if @isClone then @context else @).thread - # add (OP) to quotes quoting this context's OP. - return unless fullID in quotes - for quotelink in quotelinks - {boardID, postID} = Get.postDataFromLink quotelink - if "#{boardID}.#{postID}" is fullID - $.add quotelink, $.tn QuoteOP.text - return diff --git a/src/Quotelinks/QuoteYou.coffee b/src/Quotelinks/QuoteYou.coffee deleted file mode 100644 index a480916a8..000000000 --- a/src/Quotelinks/QuoteYou.coffee +++ /dev/null @@ -1,14 +0,0 @@ -QuoteYou = - init: -> - return if !Conf['Mark Quotes of You'] or !Conf['Quick Reply'] - - # \u00A0 is nbsp - @text = '\u00A0(You)' - Post.callbacks.push - name: 'Mark Quotes of You' - cb: @node - node: -> - return if @isClone - for quotelink in @nodes.quotelinks when QR.db.get Get.postDataFromLink quotelink - $.add quotelink, $.tn QuoteYou.text - return diff --git a/src/Quotelinks/Quotify.coffee b/src/Quotelinks/Quotify.coffee index 0cd5bbcea..333f47ec1 100644 --- a/src/Quotelinks/Quotify.coffee +++ b/src/Quotelinks/Quotify.coffee @@ -37,28 +37,20 @@ Quotify = quoteID = "#{boardID}.#{postID}" if post = g.posts[quoteID] - unless post.isDead - # Don't (Dead) when quotifying in an archived post, - # and we know the post still exists. - a = $.el 'a', - href: "/#{boardID}/res/#{post.thread}#p#{postID}" - className: 'quotelink' - textContent: quote - else - # Replace the .deadlink span if we can redirect. - a = $.el 'a', - href: "/#{boardID}/res/#{post.thread}#p#{postID}" - className: 'quotelink deadlink' - target: '_blank' - textContent: "#{quote}\u00A0(Dead)" - $.extend a.dataset, {boardID, threadID: post.thread.ID, postID} - else if redirect = Redirect.to 'thread', {boardID, threadID: 0, postID} + # Don't add 'deadlink' when quotifying in an archived post, + # and we don't know if the post died yet. + a = $.el 'a', + href: "/#{boardID}/res/#{post.thread}#p#{postID}" + className: if post.isDead then 'quotelink deadlink' else 'quotelink' + textContent: quote + $.extend a.dataset, {boardID, threadID: post.thread.ID, postID} + else if redirect = Redirect.to 'thread', {boardID, postID} # Replace the .deadlink span if we can redirect. a = $.el 'a', href: redirect className: 'deadlink' + textContent: quote target: '_blank' - textContent: "#{quote}\u00A0(Dead)" if Redirect.to 'post', {boardID, postID} # Make it function as a normal quote if we can fetch the post. $.addClass a, 'quotelink' @@ -68,7 +60,7 @@ Quotify = @quotes.push quoteID unless a - deadlink.textContent = "#{quote}\u00A0(Dead)" + deadlink.textContent = "#{quote}\u00A0(Dead)" if Conf['Quote Markers'] return $.replace deadlink, a From 1d9b0d78a98d61949bf4de3d5d19e732dbaed705 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sat, 8 Feb 2014 18:07:11 +0100 Subject: [PATCH 090/143] board -> boardID in Header.generateBoardList(). --- src/General/Header.coffee | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/General/Header.coffee b/src/General/Header.coffee index 64d83ee37..254b68ffa 100644 --- a/src/General/Header.coffee +++ b/src/General/Header.coffee @@ -123,27 +123,27 @@ Header = href: 'javascript:;' $.on a, 'click', Header.toggleBoardList return a - board = if /^current/.test t + boardID = if /^current/.test t g.BOARD.ID else t.match(/^[^-]+/)[0] for a in as - if a.textContent is board + if a.textContent is boardID a = a.cloneNode true a.textContent = if /-title/.test(t) or /-replace/.test(t) and $.hasClass a, 'current' a.title else if /-full/.test t - "/#{board}/ - #{a.title}" + "/#{boardID}/ - #{a.title}" else if m = t.match /-text:"(.+)"/ m[1] else a.textContent - if /-archive/.test(t) and href = Redirect.to 'board', {boardID: board} + if /-archive/.test(t) and href = Redirect.to 'board', {boardID} a.href = href - $.addClass a, 'navSmall' if board is '@' + $.addClass a, 'navSmall' if boardID is '@' return a $.tn t $.add list, nodes From bbf7abd6fa2aface5ad932d754d138bd08726a85 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sat, 8 Feb 2014 18:19:37 +0100 Subject: [PATCH 091/143] Close #1433. --- CHANGELOG.md | 2 ++ src/General/Config.coffee | 1 + src/Images/ImageHover.coffee | 16 ++++++++-------- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ed12aa9c5..ef7ab650e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ - This merges `Mark Quotes of You`, `Mark OP Quotes` and `Mark Cross-thread Quotes` into one feature. - Backlinks now also get these markers. - Multiple markers are now more compact, for example `>>123 (You/OP)` instead of `>>123 (You) (OP)`. +- New setting: `Image Hover in Catalog` + - Like `Image Hover`, but for the catalog only. ### 3.16.5 - *2014-02-07* diff --git a/src/General/Config.coffee b/src/General/Config.coffee index 9b523b481..b836adbdd 100644 --- a/src/General/Config.coffee +++ b/src/General/Config.coffee @@ -24,6 +24,7 @@ Config = 'Auto-GIF': [false, 'Animate GIF thumbnails (disabled on /gif/, /wsg/).'] 'Image Expansion': [true, 'Expand images inline.'] 'Image Hover': [false, 'Show a floating expanded image on hover.'] + 'Image Hover in Catalog': [false, 'Show a floating expanded image on hover in the catalog.'] 'Sauce': [true, 'Add sauce links to images.'] 'Reveal Spoilers': [false, 'Reveal spoiler thumbnails.'] 'Linkification': diff --git a/src/Images/ImageHover.coffee b/src/Images/ImageHover.coffee index 21d9c2b4c..740d80972 100644 --- a/src/Images/ImageHover.coffee +++ b/src/Images/ImageHover.coffee @@ -1,13 +1,13 @@ ImageHover = init: -> - return if !Conf['Image Hover'] - - Post.callbacks.push - name: 'Image Hover' - cb: @node - CatalogThread.callbacks.push - name: 'Image Hover' - cb: @catalogNode + if Conf['Image Hover'] + Post.callbacks.push + name: 'Image Hover' + cb: @node + if Conf['Image Hover in Catalog'] + CatalogThread.callbacks.push + name: 'Image Hover' + cb: @catalogNode node: -> return unless @file?.isImage $.on @file.thumb, 'mouseover', ImageHover.mouseover From 0fac43ee46d25f69e7eb675bb9aadf252ccad902 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sat, 8 Feb 2014 18:43:40 +0100 Subject: [PATCH 092/143] Switch the menu button on posts to the fontawesome icon. --- css/style.css | 8 -------- src/Menu/Menu.coffee | 9 ++------- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/css/style.css b/css/style.css index baee60a41..665c30c0a 100644 --- a/css/style.css +++ b/css/style.css @@ -978,14 +978,6 @@ a.remove { .menu-button { position: relative; } -.menu-button i:not(.fa-bars) { - border-top: 6px solid; - border-right: 4px solid transparent; - border-left: 4px solid transparent; - display: inline-block; - margin: 2px; - vertical-align: middle; -} @media screen and (resolution: 1dppx) { .fa-bars { font-size: 14px; diff --git a/src/Menu/Menu.coffee b/src/Menu/Menu.coffee index b9ce33a63..5803ed0ed 100644 --- a/src/Menu/Menu.coffee +++ b/src/Menu/Menu.coffee @@ -4,7 +4,7 @@ Menu = a = $.el 'a', className: 'menu-button' - innerHTML: '[]' + innerHTML: '' href: 'javascript:;' @frag = $.nodes [$.tn(' '), a] @@ -22,12 +22,7 @@ Menu = return $.add @nodes.info, Menu.makeButton() catalogNode: -> - menuButton = $.el 'a', - className: 'menu-button' - innerHTML: '' - href: 'javascript:;' - $.on menuButton, 'click', Menu.toggle - $.add @nodes.thumb, menuButton + $.add @nodes.thumb, Menu.makeButton() makeButton: -> clone = Menu.frag.cloneNode true From f7b4e0556d3082cb8bed92d9b02d9615cd836fa9 Mon Sep 17 00:00:00 2001 From: milky Date: Sun, 9 Feb 2014 07:00:15 +1100 Subject: [PATCH 093/143] Clearer when archive links are N/A. --- css/style.css | 3 +++ src/General/Header.coffee | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/css/style.css b/css/style.css index 665c30c0a..20ec29b39 100644 --- a/css/style.css +++ b/css/style.css @@ -177,6 +177,9 @@ a[href="javascript:;"] { #header.bottom #header-bar.autohide #toggle-header-bar { cursor: n-resize; } +#header-bar a.inactive { + color: inherit !important; +} #header-bar a:not(.entry) { text-decoration: none; padding: 1px; diff --git a/src/General/Header.coffee b/src/General/Header.coffee index 254b68ffa..13f6690b1 100644 --- a/src/General/Header.coffee +++ b/src/General/Header.coffee @@ -140,8 +140,12 @@ Header = else a.textContent - if /-archive/.test(t) and href = Redirect.to 'board', {boardID} - a.href = href + if /-archive/.test(t) + if href = Redirect.to 'board', {boardID} + a.href = href + else + $.addClass a, 'inactive' + a.removeAttribute 'href' $.addClass a, 'navSmall' if boardID is '@' return a From e20e682736de06baedf2d5e222303d004df1b96a Mon Sep 17 00:00:00 2001 From: milky Date: Sun, 9 Feb 2014 07:17:56 +1100 Subject: [PATCH 094/143] Convert anchor to text node. --- css/style.css | 3 --- src/General/Header.coffee | 5 ++--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/css/style.css b/css/style.css index 20ec29b39..665c30c0a 100644 --- a/css/style.css +++ b/css/style.css @@ -177,9 +177,6 @@ a[href="javascript:;"] { #header.bottom #header-bar.autohide #toggle-header-bar { cursor: n-resize; } -#header-bar a.inactive { - color: inherit !important; -} #header-bar a:not(.entry) { text-decoration: none; padding: 1px; diff --git a/src/General/Header.coffee b/src/General/Header.coffee index 13f6690b1..164054adf 100644 --- a/src/General/Header.coffee +++ b/src/General/Header.coffee @@ -140,12 +140,11 @@ Header = else a.textContent - if /-archive/.test(t) + if /-archive/.test t if href = Redirect.to 'board', {boardID} a.href = href else - $.addClass a, 'inactive' - a.removeAttribute 'href' + return $.tn a.textContent $.addClass a, 'navSmall' if boardID is '@' return a From 2d830511fdd039b738a1771e31834eb76f847c23 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sun, 9 Feb 2014 18:33:48 +0100 Subject: [PATCH 095/143] Show the menu button on focus in the catalog. #1428 --- css/style.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/css/style.css b/css/style.css index 665c30c0a..4e6197143 100644 --- a/css/style.css +++ b/css/style.css @@ -453,7 +453,7 @@ a[href="javascript:;"] { margin: 0; vertical-align: text-top; } -.thumb:not(:hover) > .menu-button:not(.open) > i { +.thumb:not(:hover):not(:focus) > .menu-button:not(.open):not(:focus) > i { display: none; } .thumb > .menu-button { From 26954b6755aa013baf3547d570eeddf2a830770b Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sun, 9 Feb 2014 19:08:09 +0100 Subject: [PATCH 096/143] Fix captcha --- CHANGELOG.md | 1 + src/Posting/QR.captcha.coffee | 57 +++++++++++++++++++++++------------ 2 files changed, 38 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ef7ab650e..33ec6a767 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,4 @@ +- Fixed captcha loading in the QR. - New setting: `Quote Markers`, enabled by default - This merges `Mark Quotes of You`, `Mark OP Quotes` and `Mark Cross-thread Quotes` into one feature. - Backlinks now also get these markers. diff --git a/src/Posting/QR.captcha.coffee b/src/Posting/QR.captcha.coffee index c19e319ed..30314ed41 100644 --- a/src/Posting/QR.captcha.coffee +++ b/src/Posting/QR.captcha.coffee @@ -1,38 +1,25 @@ QR.captcha = init: -> return if d.cookie.indexOf('pass_enabled=1') >= 0 - return unless @isEnabled = !!$.id 'captchaFormPart' - $.asap (-> $.id 'recaptcha_challenge_field_holder'), @ready.bind @ - ready: -> - setLifetime = (e) => @lifetime = e.detail - $.on window, 'captcha:timeout', setLifetime - $.globalEval 'window.dispatchEvent(new CustomEvent("captcha:timeout", {detail: RecaptchaState.timeout}))' - $.off window, 'captcha:timeout', setLifetime + container = $.id 'captchaContainer' + return unless @isEnabled = !!container imgContainer = $.el 'div', className: 'captcha-img' title: 'Reload reCAPTCHA' innerHTML: '' + hidden: true input = $.el 'input', className: 'captcha-input field' title: 'Verification' + placeholder: 'Focus to load reCAPTCHA' autocomplete: 'off' spellcheck: false @nodes = - challenge: $.id 'recaptcha_challenge_field_holder' - img: imgContainer.firstChild - input: input + img: imgContainer.firstChild + input: input - new MutationObserver(@load.bind @).observe @nodes.challenge, - childList: true - - $.on imgContainer, 'click', @reload.bind @ - $.on input, 'keydown', @keydown.bind @ - $.get 'captchas', [], ({captchas}) => - @sync captchas - $.sync 'captchas', @sync - # start with an uncached captcha - @reload() + $.on input, 'focus', @setup <% if (type === 'userscript') { %> # XXX Firefox lacks focusin/focusout support. @@ -42,6 +29,35 @@ QR.captcha = $.addClass QR.nodes.el, 'has-captcha' $.after QR.nodes.com.parentNode, [imgContainer, input] + + @setupObserver = new MutationObserver @afterSetup + @setupObserver.observe container, childList: true + setup: -> + $.globalEval 'loadRecaptcha()' + afterSetup: -> + return unless challenge = $.id 'recaptcha_challenge_field_holder' + QR.captcha.setupObserver.disconnect() + delete QR.captcha.setupObserver + + setLifetime = (e) -> QR.captcha.lifetime = e.detail + $.on window, 'captcha:timeout', setLifetime + $.globalEval 'window.dispatchEvent(new CustomEvent("captcha:timeout", {detail: RecaptchaState.timeout}))' + $.off window, 'captcha:timeout', setLifetime + + {img, input} = QR.captcha.nodes + img.parentNode.hidden = false + $.off input, 'focus', QR.captcha.setup + $.on input, 'keydown', QR.captcha.keydown.bind QR.captcha + $.on img.parentNode, 'click', QR.captcha.reload.bind QR.captcha + + $.get 'captchas', [], ({captchas}) -> + QR.captcha.sync captchas + $.sync 'captchas', QR.captcha.sync + + QR.captcha.nodes.challenge = challenge + new MutationObserver(QR.captcha.load.bind QR.captcha).observe challenge, + childList: true + QR.captcha.load() sync: (captchas) -> QR.captcha.captchas = captchas QR.captcha.count() @@ -70,6 +86,7 @@ QR.captcha = @reload() $.set 'captchas', @captchas clear: -> + return unless @captchas.length now = Date.now() for captcha, i in @captchas break if captcha.timeout > now From f8785c5445da28ecc37f4495e9484647575bfa8a Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sun, 9 Feb 2014 19:08:16 +0100 Subject: [PATCH 097/143] Release 4chan X v3.17.0. --- CHANGELOG.md | 2 ++ package.json | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 33ec6a767..ecc8c5990 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +## 3.17.0 - *2014-02-09* + - Fixed captcha loading in the QR. - New setting: `Quote Markers`, enabled by default - This merges `Mark Quotes of You`, `Mark OP Quotes` and `Mark Cross-thread Quotes` into one feature. diff --git a/package.json b/package.json index 5bd83349d..0e5ff0abf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "4chan-X", - "version": "3.16.5", + "version": "3.17.0", "description": "Cross-browser extension for productive lurking on 4chan.", "meta": { "name": "4chan X", From 6b3495fb77809106cec645df3d4344c74fe3aae9 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sun, 9 Feb 2014 19:46:44 +0100 Subject: [PATCH 098/143] Minor captcha fix. --- src/Posting/QR.captcha.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Posting/QR.captcha.coffee b/src/Posting/QR.captcha.coffee index 30314ed41..a4d951726 100644 --- a/src/Posting/QR.captcha.coffee +++ b/src/Posting/QR.captcha.coffee @@ -32,6 +32,7 @@ QR.captcha = @setupObserver = new MutationObserver @afterSetup @setupObserver.observe container, childList: true + @afterSetup() # reCAPTCHA might have loaded before the QR. setup: -> $.globalEval 'loadRecaptcha()' afterSetup: -> From becb7982b1008d0e022d061d7e9e87bb5f8c13dc Mon Sep 17 00:00:00 2001 From: Mayhem Date: Mon, 10 Feb 2014 00:06:15 +0100 Subject: [PATCH 099/143] fgts.eu archive added /r/. --- json/archives.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/json/archives.json b/json/archives.json index a19808354..54c5b5812 100644 --- a/json/archives.json +++ b/json/archives.json @@ -95,8 +95,8 @@ "http": true, "https": true, "software": "foolfuuka", - "boards": ["soc"], - "files": ["soc"] + "boards": ["r", "soc"], + "files": ["r", "soc"] }, { "uid": 16, "name": "maware", From 3cfb9298855652a7d1be156249fa894087d786f8 Mon Sep 17 00:00:00 2001 From: James Campos Date: Sun, 9 Feb 2014 17:50:43 -0800 Subject: [PATCH 100/143] Update CONTRIBUTING.md sensible -> sensitive --- CONTRIBUTING.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3478e5082..f57b3dad0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,14 +4,14 @@ Reporting bugs: 1. Make sure both your **browser** and **4chan X** are up to date.
      Only **Chrome**, **Firefox** and **Opera** are supported.
      - **SRWare Iron**, **Firefox ESR**, **Pale Moon**, **Waterfox**, and other derivatives are not supported, use them at your own risk. + **SRWare Iron**, **Firefox ESR**, **Pale Moon**, **Waterfox**, and other derivatives are not supported; use them at your own risk. 2. Look at the list of [known problems and solutions](https://github.com/MayhemYDG/4chan-x/wiki/FAQ#known-problems). 3. Disable your other extensions & scripts to identify conflicts. 4. If your issue persists, open a [new issue](https://github.com/MayhemYDG/4chan-x/issues) with the following information: 1. Precise steps to reproduce the problem, with the expected and actual results. 2. [Console errors](https://github.com/MayhemYDG/4chan-x/wiki/FAQ#console-errors), if any. 3. 4chan X version, browser variant, browser version, and Greasemonkey version if you are using it. - 4. Your exported settings. If your settings contains sensible information (e.g. personas), edit the text file manually. + 4. Your exported settings. If your settings contain sensitive information (e.g. personas), edit the text file manually. Respect these guidelines: - Describe the issue clearly, put some effort into it. A one-liner isn't a good enough description. From 130462f3f94379a24a252a591a81f12c3b0927cb Mon Sep 17 00:00:00 2001 From: Mayhem Date: Mon, 10 Feb 2014 09:04:01 +0100 Subject: [PATCH 101/143] Minor captcha fix. --- src/Posting/QR.captcha.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Posting/QR.captcha.coffee b/src/Posting/QR.captcha.coffee index a4d951726..16d533f81 100644 --- a/src/Posting/QR.captcha.coffee +++ b/src/Posting/QR.captcha.coffee @@ -87,7 +87,7 @@ QR.captcha = @reload() $.set 'captchas', @captchas clear: -> - return unless @captchas.length + return unless @captchas # not loaded yet. now = Date.now() for captcha, i in @captchas break if captcha.timeout > now @@ -105,7 +105,7 @@ QR.captcha = @nodes.input.value = null @clear() count: -> - count = @captchas.length + count = if @captchas then @captchas.length else 0 @nodes.input.placeholder = switch count when 0 'Verification (Shift + Enter to cache)' From fd5a1e053fbb338c6c964833113725b395a395ef Mon Sep 17 00:00:00 2001 From: Mayhem Date: Mon, 10 Feb 2014 10:00:29 +0100 Subject: [PATCH 102/143] Don't open threads from the catalog in new tabs. --- html/General/Thread-catalog-view.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html/General/Thread-catalog-view.html b/html/General/Thread-catalog-view.html index 44cf8d5e2..798de0cb4 100644 --- a/html/General/Thread-catalog-view.html +++ b/html/General/Thread-catalog-view.html @@ -1,4 +1,4 @@ - +
      #{postCount} / #{fileCount} / #{pageCount} From 3ec442fc25457d4ad653c57223d191565abcf165 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Mon, 10 Feb 2014 11:49:52 +0100 Subject: [PATCH 103/143] Move index mode/sort settings into - + + + + diff --git a/src/General/Index.coffee b/src/General/Index.coffee index 2e5aa7bc3..bab27411b 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -6,7 +6,6 @@ Index = return return if g.BOARD.ID is 'f' - @db = new DataBoard 'pinnedThreads' Thread.callbacks.push name: 'Thread Pinning' @@ -22,38 +21,6 @@ Index = $.on @button, 'click', @update Header.addShortcut @button, 1 - modeEntry = - el: $.el 'span', textContent: 'Index mode' - subEntries: [ - { el: $.el 'label', innerHTML: ' Paged' } - { el: $.el 'label', innerHTML: ' All threads' } - { el: $.el 'label', innerHTML: ' 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 - $.on input, 'change', $.cb.value - $.on input, 'change', @cb.mode - - sortEntry = - el: $.el 'span', textContent: 'Sort by' - subEntries: [ - { el: $.el 'label', innerHTML: ' Bump order' } - { el: $.el 'label', innerHTML: ' Last reply' } - { el: $.el 'label', innerHTML: ' Creation date' } - { el: $.el 'label', innerHTML: ' Reply count' } - { el: $.el 'label', innerHTML: ' 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 - threadNumEntry = el: $.el 'span', textContent: 'Threads per page' subEntries: [ @@ -91,28 +58,35 @@ Index = el: $.el 'span', textContent: 'Index Navigation' order: 90 - subEntries: [modeEntry, sortEntry, threadNumEntry, repliesEntry, anchorEntry, refNavEntry] + subEntries: [threadNumEntry, repliesEntry, anchorEntry, refNavEntry] $.addClass doc, 'index-loading' @update() + + @navLinks = $.el 'div', + id: 'nav-links' + innerHTML: <%= importHTML('General/Index-navlinks') %> + @searchInput = $ '#index-search', @navLinks + @hideLabel = $ '#hidden-label', @navLinks + @selectMode = $ '#index-mode', @navLinks + @selectSort = $ '#index-sort', @navLinks + $.on @searchInput, 'input', @onSearchInput + $.on $('#index-search-clear', @navLinks), 'click', @clearSearch + $.on $('#hidden-toggle a', @navLinks), 'click', @cb.toggleHiddenThreads + for select in [@selectMode, @selectSort] + select.value = Conf[select.name] + $.on select, 'change', $.cb.value + $.on @selectMode, 'change', @cb.mode + $.on @selectSort, 'change', @cb.sort + @root = $.el 'div', className: 'board' @pagelist = $.el 'div', className: 'pagelist' hidden: true innerHTML: <%= importHTML('General/Index-pagelist') %> - @navLinks = $.el 'div', - id: 'nav-links' - innerHTML: <%= importHTML('General/Index-navlinks') %> - @indexModeToggle = $ '#index-mode-toggle', @navLinks - @searchInput = $ '#index-search', @navLinks - @hideLabel = $ '#hidden-label', @navLinks @currentPage = @getCurrentPage() $.on window, 'popstate', @cb.popstate $.on @pagelist, 'click', @cb.pageNav - $.on @indexModeToggle, 'click', @cb.pageNav - $.on @searchInput, 'input', @onSearchInput - $.on $('#index-search-clear', @navLinks), 'click', @clearSearch - $.on $('#hidden-toggle a', @navLinks), 'click', @cb.toggleHiddenThreads @cb.toggleCatalogMode() $.asap (-> $('.board', doc) or d.readyState isnt 'loading'), -> board = $ '.board' @@ -232,11 +206,9 @@ Index = cb: toggleCatalogMode: -> if Conf['Index Mode'] is 'catalog' - Index.indexModeToggle.textContent = 'Return' $.addClass Index.root, 'catalog-mode' $('#hidden-toggle', Index.navLinks).hidden = false else - Index.indexModeToggle.textContent = 'Catalog' $.rmClass Index.root, 'catalog-mode' $('#hidden-toggle', Index.navLinks).hidden = true toggleHiddenThreads: -> @@ -279,14 +251,10 @@ Index = else return e.preventDefault() - switch a.textContent - when 'Catalog' - mode = 'catalog' - when 'Return' - mode = Conf['Previous Index Mode'] - if mode - $.set 'Index Mode', mode - Conf['Index Mode'] = mode + if a.textContent is 'Catalog' + $.set 'Index Mode', 'catalog' + Conf['Index Mode'] = 'catalog' + Index.selectMode.value = 'catalog' Index.cb.mode() Index.scrollToIndex() Index.userPageNav +a.pathname.split('/')[2] From bf2af04ddbe452d07900117638f139ba5023d235 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Mon, 10 Feb 2014 17:06:25 +0100 Subject: [PATCH 104/143] Fix setArea never actually retrying after an error. --- lib/$.coffee | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/$.coffee b/lib/$.coffee index 12243a38f..801899dc6 100644 --- a/lib/$.coffee +++ b/lib/$.coffee @@ -273,7 +273,7 @@ do -> timeout = {} setArea = (area) -> data = items[area] - return if !Object.keys(data).length or timeout[area] + return if !Object.keys(data).length or timeout[area] > Date.now() chrome.storage[area].set data, -> if chrome.runtime.lastError c.error chrome.runtime.lastError.message @@ -282,7 +282,8 @@ do -> c.error chrome.runtime.lastError.message, key, val continue items[area][key] = val - timeout[area] = setTimeout setArea, $.MINUTE, area + setTimeout setArea, $.MINUTE, area + timeout[area] = Date.now() + $.MINUTE return delete timeout[area] items[area] = {} From 893778525d1ddda8bca34e615a16b2054dcdf533 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Mon, 10 Feb 2014 22:15:55 +0100 Subject: [PATCH 105/143] Changelog. --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ecc8c5990..1cdd3c8fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +- `Index Mode` and `Index Sort` have been moved out of the header's menu into index page. +- Minor captcha fixes. + ## 3.17.0 - *2014-02-09* - Fixed captcha loading in the QR. From bbc3b54b523411ffadf1fa99280d8bf53e851788 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Mon, 10 Feb 2014 22:16:03 +0100 Subject: [PATCH 106/143] Release 4chan X v3.17.1. --- CHANGELOG.md | 2 ++ package.json | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1cdd3c8fa..07f17e729 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +### 3.17.1 - *2014-02-10* + - `Index Mode` and `Index Sort` have been moved out of the header's menu into index page. - Minor captcha fixes. diff --git a/package.json b/package.json index 0e5ff0abf..21bde27e8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "4chan-X", - "version": "3.17.0", + "version": "3.17.1", "description": "Cross-browser extension for productive lurking on 4chan.", "meta": { "name": "4chan X", From 13e18f6c6c006fecc77180eca5e429801bb3a07f Mon Sep 17 00:00:00 2001 From: Mayhem Date: Mon, 10 Feb 2014 22:18:26 +0100 Subject: [PATCH 107/143] the --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 07f17e729..e3694f847 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ ### 3.17.1 - *2014-02-10* -- `Index Mode` and `Index Sort` have been moved out of the header's menu into index page. +- `Index Mode` and `Index Sort` have been moved out of the header's menu into the index page. - Minor captcha fixes. ## 3.17.0 - *2014-02-09* From 871cdfe0c919687b3455e1f3e39ec248af59e39a Mon Sep 17 00:00:00 2001 From: Mayhem Date: Tue, 11 Feb 2014 09:23:39 +0100 Subject: [PATCH 108/143] Add `Image Size`. --- CHANGELOG.md | 2 ++ css/style.css | 10 ++++++++-- html/General/Index-navlinks.html | 5 +++++ src/General/Build.coffee | 5 ++--- src/General/Config.coffee | 1 + src/General/Index.coffee | 30 +++++++++++++++++++++++++++++- 6 files changed, 47 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e3694f847..b1e4141ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +- Added `Image Size` setting for the catalog. + ### 3.17.1 - *2014-02-10* - `Index Mode` and `Index Sort` have been moved out of the header's menu into the index page. diff --git a/css/style.css b/css/style.css index 23ba8e1aa..63ff8fba3 100644 --- a/css/style.css +++ b/css/style.css @@ -415,12 +415,18 @@ a[href="javascript:;"] { text-align: left; flex-direction: column; align-items: center; - width: 165px; margin: 0 2px 5px; - max-height: 320px; word-break: break-word; vertical-align: top; } +.catalog-small .catalog-thread { + width: 165px; + max-height: 320px; +} +.catalog-large .catalog-thread { + width: 270px; + max-height: 410px; +} .thumb { flex-shrink: 0; position: relative; diff --git a/html/General/Index-navlinks.html b/html/General/Index-navlinks.html index 4dc35c53f..485d8489b 100644 --- a/html/General/Index-navlinks.html +++ b/html/General/Index-navlinks.html @@ -17,3 +17,8 @@ + diff --git a/src/General/Build.coffee b/src/General/Build.coffee index 027f09515..51e2fd9c4 100644 --- a/src/General/Build.coffee +++ b/src/General/Build.coffee @@ -294,9 +294,8 @@ Build = $.addClass thumb, 'deleted-file' else if thread.OP.file src = thread.OP.file.thumbURL - max = Math.max data.tn_w, data.tn_h - thumb.style.width = data.tn_w * 150 / max + 'px' - thumb.style.height = data.tn_h * 150 / max + 'px' + thumb.dataset.width = data.tn_w + thumb.dataset.height = data.tn_h else src = "#{staticPath}nofile.png" $.addClass thumb, 'no-file' diff --git a/src/General/Config.coffee b/src/General/Config.coffee index b836adbdd..3e127e782 100644 --- a/src/General/Config.coffee +++ b/src/General/Config.coffee @@ -141,6 +141,7 @@ Config = 'Index Mode': 'paged' 'Previous Index Mode': 'paged' 'Index Sort': 'bump' + 'Index Size': 'small' 'Threads per Page': 0 'Show Replies': true 'Anchor Hidden Threads': true diff --git a/src/General/Index.coffee b/src/General/Index.coffee index bab27411b..f341cb81f 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -70,14 +70,16 @@ Index = @hideLabel = $ '#hidden-label', @navLinks @selectMode = $ '#index-mode', @navLinks @selectSort = $ '#index-sort', @navLinks + @selectSize = $ '#index-size', @navLinks $.on @searchInput, 'input', @onSearchInput $.on $('#index-search-clear', @navLinks), 'click', @clearSearch $.on $('#hidden-toggle a', @navLinks), 'click', @cb.toggleHiddenThreads - for select in [@selectMode, @selectSort] + for select in [@selectMode, @selectSort, @selectSize] select.value = Conf[select.name] $.on select, 'change', $.cb.value $.on @selectMode, 'change', @cb.mode $.on @selectSort, 'change', @cb.sort + $.on @selectSize, 'change', @cb.size @root = $.el 'div', className: 'board' @pagelist = $.el 'div', @@ -87,7 +89,10 @@ Index = @currentPage = @getCurrentPage() $.on window, 'popstate', @cb.popstate $.on @pagelist, 'click', @cb.pageNav + @cb.toggleCatalogMode() + @cb.size() + $.asap (-> $('.board', doc) or d.readyState isnt 'loading'), -> board = $ '.board' $.replace board, Index.root @@ -230,6 +235,17 @@ Index = sort: -> Index.sort() Index.buildIndex() + size: (e) -> + if Conf['Index Mode'] isnt 'catalog' + $.rmClass Index.root, 'catalog-small' + $.rmClass Index.root, 'catalog-large' + else if Conf['Index Size'] is 'small' + $.addClass Index.root, 'catalog-small' + $.rmClass Index.root, 'catalog-large' + else + $.addClass Index.root, 'catalog-large' + $.rmClass Index.root, 'catalog-small' + Index.buildIndex() if e threadsNum: -> return unless Conf['Index Mode'] is 'paged' Index.buildPagelist() @@ -498,6 +514,17 @@ Index = catalogThreads.push new CatalogThread Build.catalogThread(thread), thread Main.callbackNodes CatalogThread, catalogThreads threads.map (thread) -> thread.catalogView.nodes.root + sizeCatalogViews: (nodes) -> + # XXX When browsers support CSS3 attr(), use it instead. + size = if Conf['Index Size'] is 'small' then 150 else 250 + for node in nodes + thumb = $ '.thumb', node + {width, height} = thumb.dataset + continue unless width + ratio = size / Math.max width, height + thumb.style.width = width * ratio + 'px' + thumb.style.height = height * ratio + 'px' + return sort: -> switch Conf['Index Sort'] when 'bump' @@ -539,6 +566,7 @@ Index = nodes = Index.sortedNodes[nodesPerPage * pageNum ... nodesPerPage * (pageNum + 1)] when 'catalog' nodes = Index.buildCatalogViews() + Index.sizeCatalogViews nodes else nodes = Index.sortedNodes $.rmAll Index.root From c685b0a5d64a3f4fd783da5b56518de12e134b33 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Tue, 11 Feb 2014 09:38:14 +0100 Subject: [PATCH 109/143] Fix ImageExpand/Hover's error handling xhring the wrong URL. --- src/Images/ImageExpand.coffee | 2 +- src/Images/ImageHover.coffee | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Images/ImageExpand.coffee b/src/Images/ImageExpand.coffee index 29f72cfa1..9d754da91 100644 --- a/src/Images/ImageExpand.coffee +++ b/src/Images/ImageExpand.coffee @@ -133,7 +133,7 @@ ImageExpand = timeoutID = setTimeout ImageExpand.expand, 10000, post <% if (type === 'crx') { %> - $.ajax @src, + $.ajax post.file.URL, onloadend: -> return if @status isnt 404 clearTimeout timeoutID diff --git a/src/Images/ImageHover.coffee b/src/Images/ImageHover.coffee index 740d80972..97e44971a 100644 --- a/src/Images/ImageHover.coffee +++ b/src/Images/ImageHover.coffee @@ -48,7 +48,7 @@ ImageHover = timeoutID = setTimeout (=> @src = post.file.URL + '?' + Date.now()), 3000 <% if (type === 'crx') { %> - $.ajax @src, + $.ajax post.file.URL, onloadend: -> return if @status isnt 404 clearTimeout timeoutID From 87dafbe643c91393821a914248f1aafa912b2cf5 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Tue, 11 Feb 2014 09:49:40 +0100 Subject: [PATCH 110/143] Move .catalog-mode to doc. --- css/style.css | 4 +++- html/General/Index-navlinks.html | 2 +- src/General/Index.coffee | 6 ++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/css/style.css b/css/style.css index 63ff8fba3..26b6883dc 100644 --- a/css/style.css +++ b/css/style.css @@ -375,7 +375,9 @@ a[href="javascript:;"] { /* 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; } #nav-links { diff --git a/html/General/Index-navlinks.html b/html/General/Index-navlinks.html index 485d8489b..6655ac4a9 100644 --- a/html/General/Index-navlinks.html +++ b/html/General/Index-navlinks.html @@ -1,7 +1,7 @@ [ - +
      -
      - -
      - - - No selected file - - - - -
      +
      + + + + No selected file + + + +
      From bcac6d1f82e6b5daf2cb7dc979ed584995956b2a Mon Sep 17 00:00:00 2001 From: Mayhem Date: Wed, 12 Feb 2014 15:36:03 +0100 Subject: [PATCH 120/143] Move the
      -
      -
      - -
      +
      +
      From cbc85407df37c256cbbf3d03bc0f715749c3b6a6 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Thu, 13 Feb 2014 14:41:24 +0100 Subject: [PATCH 123/143] Optimize setting data operations. Setting local data on Chrome is not throttled, only debounce sync. Don't make DBs save data on every page load, don't save cleaning operations if nothing's changed. Debounce Unread.saveLastReadPost() on Chrome to every 5 seconds. --- css/style.css | 1 + lib/$.coffee | 6 +++--- src/General/DataBoard.coffee | 27 ++++++++++++++------------- src/Monitoring/Unread.coffee | 2 +- 4 files changed, 19 insertions(+), 17 deletions(-) diff --git a/css/style.css b/css/style.css index 2de6a7af2..11916e177 100644 --- a/css/style.css +++ b/css/style.css @@ -787,6 +787,7 @@ a.hide-announcement { min-width: 100%; overflow: hidden; white-space: nowrap; + position: relative; -webkit-user-select: none; -moz-user-select: none; user-select: none; diff --git a/lib/$.coffee b/lib/$.coffee index 801899dc6..939c1577e 100644 --- a/lib/$.coffee +++ b/lib/$.coffee @@ -288,8 +288,7 @@ do -> delete timeout[area] items[area] = {} - setAll = $.debounce $.SECOND, -> - setArea 'local' + setSync = $.debounce $.SECOND, -> setArea 'sync' $.set = (key, val) -> @@ -300,7 +299,8 @@ do -> for key in $.localKeys when key of items.sync items.local[key] = items.sync[key] delete items.sync[key] - setAll() + setArea 'local' + setSync() $.clear = (cb) -> items.local = {} diff --git a/src/General/DataBoard.coffee b/src/General/DataBoard.coffee index 2aab44b17..d82ff1b65 100644 --- a/src/General/DataBoard.coffee +++ b/src/General/DataBoard.coffee @@ -58,15 +58,14 @@ class DataBoard val or defaultValue clean: -> - for boardID, val of @data.boards - @deleteIfEmpty {boardID} - now = Date.now() - if (@data.lastChecked or 0) < now - 2 * $.HOUR - @data.lastChecked = now - for boardID of @data.boards - @ajaxClean boardID + return if (@data.lastChecked or 0) > now - 2 * $.HOUR + for boardID of @data.boards + @deleteIfEmpty {boardID} + @ajaxClean boardID if boardID of @data.boards + + @data.lastChecked = now @save() ajaxClean: (boardID) -> $.cache "//a.4cdn.org/#{boardID}/threads.json", (e) => @@ -76,12 +75,14 @@ class DataBoard board = @data.boards[boardID] threads = {} for page in e.target.response - for thread in page.threads - if thread.no of board - threads[thread.no] = board[thread.no] - @data.boards[boardID] = threads - @deleteIfEmpty {boardID} - @save() + for thread in page.threads when thread.no of board + threads[thread.no] = board[thread.no] + count = Object.keys(threads).length + return if count is Object.keys(board).length # Nothing changed. + if count + @set {boardID, val: threads} + else + @delete {boardID} onSync: (data) => @data = data or boards: {} diff --git a/src/Monitoring/Unread.coffee b/src/Monitoring/Unread.coffee index 8e13c463e..39fc9fce9 100644 --- a/src/Monitoring/Unread.coffee +++ b/src/Monitoring/Unread.coffee @@ -139,7 +139,7 @@ Unread = Unread.readArray Unread.postsQuotingYou Unread.update() if e - saveLastReadPost: -> + saveLastReadPost: <% if (type === 'crx') { %>$.debounce 5 * $.SECOND,<% } %> -> return if Unread.thread.isDead Unread.db.set boardID: Unread.thread.board.ID From e2f26cfa6672f2a64749dc8c1e86f5672d9f0c02 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Thu, 13 Feb 2014 15:04:12 +0100 Subject: [PATCH 124/143] Keep the title in 404'd tabs. --- src/Monitoring/Unread.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Monitoring/Unread.coffee b/src/Monitoring/Unread.coffee index 39fc9fce9..fabe6782b 100644 --- a/src/Monitoring/Unread.coffee +++ b/src/Monitoring/Unread.coffee @@ -158,7 +158,7 @@ Unread = count = Unread.posts.length if Conf['Unread Count'] - d.title = "#{if count or !Conf['Hide Unread Count at (0)'] then "(#{count}) " else ''}#{if g.DEAD then "/#{g.BOARD}/ - 404" else "#{Unread.title}"}" + d.title = "#{if count or !Conf['Hide Unread Count at (0)'] then "(#{count}) " else ''}#{if g.DEAD then Unread.title.replace '-', '- 404 -' else Unread.title}" <% if (type === 'crx') { %> # XXX Chrome bug where it doesn't always update the tab title. # crbug.com/124381 From 740e408798b91ab9254777031c9d87bb03a5726a Mon Sep 17 00:00:00 2001 From: Mayhem Date: Thu, 13 Feb 2014 15:43:15 +0100 Subject: [PATCH 125/143] Add `Open threads in a new tab` setting. --- CHANGELOG.md | 1 + src/General/Build.coffee | 2 ++ src/General/Config.coffee | 1 + src/General/Index.coffee | 20 +++++++++++++++++--- 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2144cd125..f9917766e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ - Added `Image Size` setting for the catalog. +- Added `Open threads in a new tab` setting for the catalog. - Added a keybind to cycle through index sort types, `Ctrl+x` by default. - Added keybindings for index modes, `Ctrl+{1,2,3}` by default. diff --git a/src/General/Build.coffee b/src/General/Build.coffee index 51e2fd9c4..5cb9d1dca 100644 --- a/src/General/Build.coffee +++ b/src/General/Build.coffee @@ -300,6 +300,8 @@ Build = src = "#{staticPath}nofile.png" $.addClass thumb, 'no-file' thumb.style.backgroundImage = "url(#{src})" + if Conf['Open threads in a new tab'] + thumb.target = '_blank' for quotelink in $$ '.quotelink', root.lastElementChild $.replace quotelink, [quotelink.childNodes...] diff --git a/src/General/Config.coffee b/src/General/Config.coffee index 5345dd84f..45c8bc544 100644 --- a/src/General/Config.coffee +++ b/src/General/Config.coffee @@ -143,6 +143,7 @@ Config = 'Index Sort': 'bump' 'Index Size': 'small' 'Threads per Page': 0 + 'Open threads in a new tab': false 'Show Replies': true 'Anchor Hidden Threads': true 'Refreshed Navigation': false diff --git a/src/General/Index.coffee b/src/General/Index.coffee index 7faf94004..87662808e 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -31,6 +31,10 @@ Index = $.on threadsNumInput, 'change', $.cb.value $.on threadsNumInput, 'change', @cb.threadsNum + targetEntry = + el: $.el 'label', + innerHTML: ' Open threads in a new tab' + title: 'Catalog-only setting.' repliesEntry = el: $.el 'label', innerHTML: ' Show replies' @@ -42,12 +46,14 @@ Index = el: $.el 'label', innerHTML: ' Refreshed navigation' title: 'Refresh index when navigating through pages.' - for label in [repliesEntry, anchorEntry, refNavEntry] + for label in [targetEntry, repliesEntry, anchorEntry, refNavEntry] input = label.el.firstChild {name} = input input.checked = Conf[name] $.on input, 'change', $.cb.checked switch name + when 'Open threads in a new tab' + $.on input, 'change', @cb.target when 'Show Replies' $.on input, 'change', @cb.replies when 'Anchor Hidden Threads' @@ -58,7 +64,7 @@ Index = el: $.el 'span', textContent: 'Index Navigation' order: 90 - subEntries: [threadNumEntry, repliesEntry, anchorEntry, refNavEntry] + subEntries: [threadNumEntry, targetEntry, repliesEntry, anchorEntry, refNavEntry] $.addClass doc, 'index-loading' @update() @@ -261,6 +267,14 @@ Index = return unless Conf['Index Mode'] is 'paged' Index.buildPagelist() Index.buildIndex() + target: -> + for threadID, thread of g.BOARD.threads when thread.catalogView + {thumb} = thread.catalogView.nodes + if Conf['Open threads in a new tab'] + thumb.target = '_blank' + else + thumb.removeAttribute 'target' + return replies: -> Index.buildThreads() Index.sort() @@ -529,7 +543,7 @@ Index = # XXX When browsers support CSS3 attr(), use it instead. size = if Conf['Index Size'] is 'small' then 150 else 250 for node in nodes - thumb = $ '.thumb', node + thumb = node.firstElementChild {width, height} = thumb.dataset continue unless width ratio = size / Math.max width, height From 349009ab6779f6682a0af4172117535e99292f84 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Thu, 13 Feb 2014 17:24:14 +0100 Subject: [PATCH 126/143] Close #1449. --- src/General/UI.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/General/UI.coffee b/src/General/UI.coffee index ef01e3497..5831d3951 100644 --- a/src/General/UI.coffee +++ b/src/General/UI.coffee @@ -312,7 +312,7 @@ UI = do -> else top - [left, right] = if clientX <= @clientWidth - 400 + [left, right] = if clientX <= @clientWidth / 2 [clientX + 45 + 'px', null] else [null, @clientWidth - clientX + 45 + 'px'] From 7ec83c24bcbe4888b8cc86db6b973fd1d964f71e Mon Sep 17 00:00:00 2001 From: Mayhem Date: Thu, 13 Feb 2014 18:30:55 +0100 Subject: [PATCH 127/143] Add a tooltip showing the OP's post info in the catalog. --- css/style.css | 10 ++++++++++ src/General/Index.coffee | 24 ++++++++++++++++++++++++ src/General/UI.coffee | 19 +++++++++++-------- 3 files changed, 45 insertions(+), 8 deletions(-) diff --git a/css/style.css b/css/style.css index 11916e177..83e1e8d08 100644 --- a/css/style.css +++ b/css/style.css @@ -495,6 +495,16 @@ a[href="javascript:;"] { overflow: hidden; text-align: center; } +.thread-info { + position: fixed; + background: inherit; + padding: 2px; + border-radius: 2px; + box-shadow: 0 0 5px rgba(0, 0, 0, .25); +} +.thread-info .post { + margin: 0; +} /* Announcement Hiding */ :root.hide-announcement #globalMessage, diff --git a/src/General/Index.coffee b/src/General/Index.coffee index 87662808e..837c360ea 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -159,6 +159,8 @@ Index = @pin() if data.isPinned catalogNode: -> $.on @nodes.thumb, 'click', Index.onClick + return if Conf['Image Hover in Catalog'] + $.on @nodes.thumb, 'mouseover', Index.onOver onClick: (e) -> return if e.button isnt 0 thread = g.threads[@parentNode.dataset.fullID] @@ -169,6 +171,28 @@ Index = else return e.preventDefault() + onOver: (e) -> + # 4chan's less than stellar CSS forces us to include a .post and .postInfo + # in order to have proper styling for the .nameBlock's content. + {nodes} = g.threads[@parentNode.dataset.fullID].OP + el = $.el 'div', + innerHTML: '
      diff --git a/html/General/Settings-section-Rice.html b/html/General/Settings-section-Rice.html index fe89c50ef..b0a092bef 100644 --- a/html/General/Settings-section-Rice.html +++ b/html/General/Settings-section-Rice.html @@ -8,6 +8,9 @@
      Board link (Replace with title when on that board): board-replace
      Full text link: board-full
      Custom text link: board-text:"VIP Board"
      +
      Index mode: board-mode:"type" where type is paged, all threads or catalog
      +
      Index sort: board-sort:"type" where type is bump order, last reply, creation date, reply count or file count
      +
      Combinations are possible: board-text:"VIP Catalog"-mode:"catalog"-sort:"creation date"
      Full board list toggle: toggle-all
      diff --git a/src/General/Header.coffee b/src/General/Header.coffee index 164054adf..5260bb77c 100644 --- a/src/General/Header.coffee +++ b/src/General/Header.coffee @@ -112,10 +112,12 @@ Header = list = $ '#custom-board-list', Header.bar $.rmAll list return unless text - as = $$ '#full-board-list a[title]', Header.bar - nodes = text.match(/[\w@]+(-(all|title|replace|full|archive|text:"[^"]+"))*|[^\w@]+/g).map (t) -> + as = $$ '.boardList a[title]', Header.bar + re = /[\w@]+(-(all|title|replace|full|archive|(mode|sort|text):"[^"]+"))*|[^\w@]+/g + nodes = text.match(re).map (t) -> if /^[^\w@]/.test t return $.tn t + if /^toggle-all/.test t a = $.el 'a', className: 'show-board-list-button' @@ -123,32 +125,47 @@ Header = href: 'javascript:;' $.on a, 'click', Header.toggleBoardList return a - boardID = if /^current/.test t - g.BOARD.ID + + boardID = t.split('-')[0] + boardID = g.BOARD.ID if boardID is 'current' + for a in as when a.textContent is boardID + a = a.cloneNode() + break + return $.tn boardID if a.parentNode # Not a clone. + + if /-archive/.test t + if href = Redirect.to 'board', {boardID} + a.href = href + else + return a.firstChild # Its text node. + + a.textContent = if /-title/.test(t) or /-replace/.test(t) and boardID is g.BOARD.ID + a.title + else if /-full/.test t + "/#{boardID}/ - #{a.title}" + else if m = t.match /-text:"([^"]+)"/ + m[1] else - t.match(/^[^-]+/)[0] - for a in as - if a.textContent is boardID - a = a.cloneNode true + boardID - a.textContent = if /-title/.test(t) or /-replace/.test(t) and $.hasClass a, 'current' - a.title - else if /-full/.test t - "/#{boardID}/ - #{a.title}" - else if m = t.match /-text:"(.+)"/ - m[1] - else - a.textContent + if m = t.match /-mode:"([^"]+)"/ + type = m[1].toLowerCase() + a.dataset.indexMode = switch type + when 'all threads' then 'all pages' + when 'paged', 'catalog' then type + else 'paged' + if m = t.match /-sort:"([^"]+)"/ + type = m[1].toLowerCase() + a.dataset.indexSort = switch type + when 'bump order' then 'bump' + when 'last reply' then 'lastreply' + when 'creation date' then 'birth' + when 'reply count' then 'replycount' + when 'file count' then 'filecount' + else 'bump' - if /-archive/.test t - if href = Redirect.to 'board', {boardID} - a.href = href - else - return $.tn a.textContent - - $.addClass a, 'navSmall' if boardID is '@' - return a - $.tn t + $.addClass a, 'navSmall' if boardID is '@' + a $.add list, nodes toggleBoardList: -> diff --git a/src/General/Index.coffee b/src/General/Index.coffee index 837c360ea..bc484e48e 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -95,6 +95,7 @@ Index = @currentPage = @getCurrentPage() $.on window, 'popstate', @cb.popstate $.on @pagelist, 'click', @cb.pageNav + $.on $('#custom-board-list', Header.bar), 'click', @cb.headerNav @cb.toggleCatalogMode() @@ -260,10 +261,10 @@ Index = 'Show' Index.sort() Index.buildIndex() - mode: -> + mode: (e) -> Index.cb.toggleCatalogMode() Index.togglePagelist() - Index.buildIndex() + Index.buildIndex() if e mode = Conf['Index Mode'] if mode not in ['catalog', Conf['Previous Index Mode']] Conf['Previous Index Mode'] = mode @@ -273,9 +274,9 @@ Index = QR.hide() else QR.unhide() - sort: -> + sort: (e) -> Index.sort() - Index.buildIndex() + Index.buildIndex() if e size: (e) -> if Conf['Index Mode'] isnt 'catalog' $.rmClass Index.root, 'catalog-small' @@ -316,13 +317,36 @@ Index = else return e.preventDefault() - if a.textContent is 'Catalog' - $.set 'Index Mode', 'catalog' - Conf['Index Mode'] = 'catalog' - Index.selectMode.value = 'catalog' - Index.cb.mode() - Index.scrollToIndex() + return if Index.cb.indexNav a, true Index.userPageNav +a.pathname.split('/')[2] + headerNav: (e) -> + a = e.target + return if e.button isnt 0 or a.nodeName isnt 'A' or a.hostname isnt 'boards.4chan.org' + # Save settings + onSameBoard = a.pathname.split('/')[1] is g.BOARD.ID + Index.cb.indexNav a, onSameBoard + # Do nav if this isn't a simple click, or different board. + return if e.shiftKey or e.altKey or e.ctrlKey or e.metaKey or !onSameBoard + e.preventDefault() + indexNav: (a, onSameBoard) -> + {indexMode, indexSort} = a.dataset + if indexMode + $.set 'Index Mode', indexMode + Conf['Index Mode'] = indexMode + if g.VIEW is 'index' and onSameBoard + Index.selectMode.value = indexMode + Index.cb.mode() + if indexSort + $.set 'Index Sort', indexSort + Conf['Index Sort'] = indexSort + if g.VIEW is 'index' and onSameBoard + Index.selectSort.value = indexSort + Index.cb.sort() + if g.VIEW is 'index' and onSameBoard and (indexMode or indexSort) + Index.buildIndex() + Index.scrollToIndex() + return true + false scrollToIndex: -> Header.scrollToIfNeeded Index.navLinks From 715724df29de60bb6c1eaf230d1a11f673a19b1f Mon Sep 17 00:00:00 2001 From: Mayhem Date: Fri, 14 Feb 2014 23:41:52 +0100 Subject: [PATCH 130/143] {Add name,rm size} attributes on `.persona .field` inputs. --- css/style.css | 1 + html/Posting/QR.html | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/css/style.css b/css/style.css index 472dafcea..b75150231 100644 --- a/css/style.css +++ b/css/style.css @@ -763,6 +763,7 @@ a.hide-announcement { } .persona .field { flex: 1; + width: 0; } .persona .field:hover, .persona .field:focus { diff --git a/html/Posting/QR.html b/html/Posting/QR.html index 0ce242992..3b683ef2c 100644 --- a/html/Posting/QR.html +++ b/html/Posting/QR.html @@ -9,9 +9,9 @@
      - - - + + +
      From e6198d4014b5e995fc3789bb8f9f5d608a0ba0ab Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sat, 15 Feb 2014 00:37:39 +0100 Subject: [PATCH 131/143] Remove s in links, use CSS to break. --- css/style.css | 6 ++++-- src/Linkification/Linkify.coffee | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/css/style.css b/css/style.css index b75150231..475ae1166 100644 --- a/css/style.css +++ b/css/style.css @@ -1056,8 +1056,10 @@ a.remove { margin: 0; } -/* colored uid */ - +/* Other */ +.linkified { + word-break: break-all; +} .posteruid.painted { padding: 0 5px; border-radius: 1em; diff --git a/src/Linkification/Linkify.coffee b/src/Linkification/Linkify.coffee index bad4bedc1..1d9e15c34 100644 --- a/src/Linkification/Linkify.coffee +++ b/src/Linkification/Linkify.coffee @@ -65,6 +65,7 @@ Linkify = else walker.previousNode() range.detach() + @nodes.comment.normalize() find: (link, walker) -> # Walk through the nodes until we find the entire link. @@ -134,6 +135,8 @@ Linkify = cleanLink: (anchor, link) -> {length} = link + for node in $$ 'wbr', anchor + $.rm node for node in $$ 's, .prettyprint', anchor $.replace node, [node.childNodes...] if length > node.textContent.length return From 216f7c3abbe39dba079f73c54a620952a00aa01c Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sat, 15 Feb 2014 00:51:47 +0100 Subject: [PATCH 132/143] rm `Clean Links` config. --- src/General/Config.coffee | 4 +--- src/Linkification/Linkify.coffee | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/General/Config.coffee b/src/General/Config.coffee index 45c8bc544..426c17b37 100644 --- a/src/General/Config.coffee +++ b/src/General/Config.coffee @@ -6,6 +6,7 @@ Config = 'Announcement Hiding': [true, 'Add button to hide 4chan announcements.'] '404 Redirect': [true, 'Redirect dead threads and images.'] 'Keybinds': [true, 'Bind actions to keyboard shortcuts.'] + 'Linkify': [true, 'Convert text links into hyperlinks.'] 'Time Formatting': [true, 'Localize and format timestamps.'] 'Relative Post Dates': [false, 'Display dates like "3 minutes ago". Tooltip shows the timestamp.'] 'File Info Formatting': [true, 'Reformat the file information.'] @@ -27,9 +28,6 @@ Config = 'Image Hover in Catalog': [false, 'Show a floating expanded image on hover in the catalog.'] 'Sauce': [true, 'Add sauce links to images.'] 'Reveal Spoilers': [false, 'Reveal spoiler thumbnails.'] - 'Linkification': - 'Linkify': [true, 'Convert text links into hyperlinks.'] - 'Clean Links': [true, 'Remove spoiler and code tags commonly used to bypass blocked links.'] 'Menu': 'Menu': [true, 'Add a drop-down menu to posts.'] 'Report Link': [true, 'Add a report link to the menu.'] diff --git a/src/Linkification/Linkify.coffee b/src/Linkification/Linkify.coffee index 1d9e15c34..fce9bbe53 100644 --- a/src/Linkification/Linkify.coffee +++ b/src/Linkification/Linkify.coffee @@ -60,7 +60,7 @@ Linkify = # Replace already-linkified links, # f.e.: https://boards.4chan.org/b/% $.replace parent, anchor - Linkify.cleanLink anchor, link if Conf['Clean Links'] + Linkify.cleanLink anchor, link walker.currentNode = anchor.lastChild else walker.previousNode() From 759dc8abd72f748c263d2332a23c91ccd2c767de Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sat, 15 Feb 2014 15:54:47 +0100 Subject: [PATCH 133/143] Fix file info preview in the settings. --- html/General/Settings-section-Rice.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html/General/Settings-section-Rice.html b/html/General/Settings-section-Rice.html index b0a092bef..64535d93f 100644 --- a/html/General/Settings-section-Rice.html +++ b/html/General/Settings-section-Rice.html @@ -33,7 +33,7 @@
      File Info Formatting is disabled. -
      :
      +
      :
      Link: %l (truncated), %L (untruncated), %T (Unix timestamp)
      Original file name: %n (truncated), %N (untruncated), %t (Unix timestamp)
      Spoiler indicator: %p
      From 8b5912b77d0a14dcddb013bfdb8a45ab9987d22f Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sat, 15 Feb 2014 16:08:17 +0100 Subject: [PATCH 134/143] Archive links with no archive should keep custom text. Don't return too early then. --- src/General/Header.coffee | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/General/Header.coffee b/src/General/Header.coffee index 5260bb77c..74eb9648a 100644 --- a/src/General/Header.coffee +++ b/src/General/Header.coffee @@ -133,12 +133,6 @@ Header = break return $.tn boardID if a.parentNode # Not a clone. - if /-archive/.test t - if href = Redirect.to 'board', {boardID} - a.href = href - else - return a.firstChild # Its text node. - a.textContent = if /-title/.test(t) or /-replace/.test(t) and boardID is g.BOARD.ID a.title else if /-full/.test t @@ -148,6 +142,12 @@ Header = else boardID + if /-archive/.test t + if href = Redirect.to 'board', {boardID} + a.href = href + else + return a.firstChild # Its text node. + if m = t.match /-mode:"([^"]+)"/ type = m[1].toLowerCase() a.dataset.indexMode = switch type From f7d048de7b4826fbd598899cda273d1dfcda83bd Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sat, 15 Feb 2014 16:19:28 +0100 Subject: [PATCH 135/143] Release 4chan X v3.18.0. --- CHANGELOG.md | 2 ++ package.json | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a24c8778e..9a2f7b7d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +## 3.18.0 - *2014-02-15* + - Added `Image Size` setting for the catalog. - Added `Open threads in a new tab` setting for the catalog. - Added `board-mode:"type"` and `board-sort:"type"` parameters to custom board navigation. diff --git a/package.json b/package.json index 21bde27e8..0031ff640 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "4chan-X", - "version": "3.17.1", + "version": "3.18.0", "description": "Cross-browser extension for productive lurking on 4chan.", "meta": { "name": "4chan X", From 004c3f74edd1ae72abe6454d8eebb1a29e8578dd Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sat, 15 Feb 2014 21:01:59 +0100 Subject: [PATCH 136/143] Re-think the Quote Backlink implementation. Before this rewrite, containers and backlinks were created even if the relevant post did not exist in the page. If the post would never end up existing, it resulted in a waste of resources. QuoteBacklink's cache also prevented these containers and backlinks from being garbage collected. We now only store a map of fullIDs. This feature should be faster since less elements gets allocated, although the difference is probably negligible. --- src/Quotelinks/QuoteBacklink.coffee | 77 ++++++++++++++--------------- 1 file changed, 37 insertions(+), 40 deletions(-) diff --git a/src/Quotelinks/QuoteBacklink.coffee b/src/Quotelinks/QuoteBacklink.coffee index b6b00d825..ead8fe676 100644 --- a/src/Quotelinks/QuoteBacklink.coffee +++ b/src/Quotelinks/QuoteBacklink.coffee @@ -3,19 +3,19 @@ QuoteBacklink = # - previous, same, and following posts. # - existing and yet-to-exist posts. # - newly fetched posts. - # - in copies. + # - clones. # XXX what about order for fetched posts? # - # First callback creates backlinks and add them to relevant containers. - # Second callback adds relevant containers into posts. - # This is is so that fetched posts can get their backlinks, - # and that as much backlinks are appended in the background as possible. + # First callback creates a map of quoted -> [quoters], + # and append backlinks to posts that already have containers. + # Second callback creates, fill and append containers. init: -> return if !Conf['Quote Backlinks'] format = Conf['backlink'].replace /%id/g, "' + id + '" @funk = Function 'id', "return '#{format}'" - @containers = {} + @frag = $.nodes [$.tn(' '), $.el 'a', className: 'backlink'] + @map = {} Post.callbacks.push name: 'Quote Backlinking Part 1' cb: @firstNode @@ -23,42 +23,39 @@ QuoteBacklink = name: 'Quote Backlinking Part 2' cb: @secondNode firstNode: -> - return if @isClone or !@quotes.length - text = QuoteBacklink.funk @ID - a = $.el 'a', - href: "/#{@board}/res/#{@thread}#p#{@}" - className: 'backlink' - textContent: text - if @isHidden - $.addClass a, 'filtered' - if @isDead - $.addClass a, 'deadlink' - if Conf['Quote Markers'] - QuoteMarkers.parseQuotelink @board, @thread, @, a, false, text - for quote in @quotes - containers = [QuoteBacklink.getContainer quote] - if (post = g.posts[quote]) and post.nodes.backlinkContainer - # Don't add OP clones when OP Backlinks is disabled, - # as the clones won't have the backlink containers. - for clone in post.clones - containers.push clone.nodes.backlinkContainer - for container in containers - link = a.cloneNode true - if Conf['Quote Previewing'] - $.on link, 'mouseover', QuotePreview.mouseover - if Conf['Quote Inlining'] - $.on link, 'click', QuoteInline.toggle - $.add container, [$.tn(' '), link] + return if @isClone + for quoteID in @quotes + (QuoteBacklink.map[quoteID] or= []).push @fullID + continue unless (post = g.posts[quoteID]) and container = post?.nodes.backlinkContainer + for container in [container].concat post.clones.map((clone) -> clone.nodes.backlinkContainer) + $.add container, QuoteBacklink.buildBacklink @ return secondNode: -> - if @isClone and (@origin.isReply or Conf['OP Backlinks']) - @nodes.backlinkContainer = $ '.container', @nodes.info - return # Don't backlink the OP. return unless @isReply or Conf['OP Backlinks'] - container = QuoteBacklink.getContainer @fullID - @nodes.backlinkContainer = container + if @isClone + @nodes.backlinkContainer = $ '.backlink-container', @nodes.info + return + @nodes.backlinkContainer = container = $.el 'span', + className: 'backlink-container' + if @fullID of QuoteBacklink.map + for quoteID in QuoteBacklink.map[@fullID] + if post = g.posts[quoteID] # Post hasn't been collected since. + $.add container, QuoteBacklink.buildBacklink post $.add @nodes.info, container - getContainer: (id) -> - @containers[id] or= - $.el 'span', className: 'container' + buildBacklink: (post) -> + frag = QuoteBacklink.frag.cloneNode true + a = frag.lastElementChild + a.href = "/#{post.board}/res/#{post.thread}#p#{post}" + a.textContent = text = QuoteBacklink.funk post.ID + if post.isDead + $.addClass a, 'deadlink' + if post.isHidden + $.addClass a, 'filtered' + if Conf['Quote Markers'] + QuoteMarkers.parseQuotelink post.board, post.thread, post, a, false, text + if Conf['Quote Previewing'] + $.on a, 'mouseover', QuotePreview.mouseover + if Conf['Quote Inlining'] + $.on a, 'click', QuoteInline.toggle + frag From 7df0fd141416b2d9cd387cb505c66bba110e5e94 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sat, 15 Feb 2014 22:24:10 +0100 Subject: [PATCH 137/143] Simplify QuoteMarkers.parseQuotelink arguments. --- src/General/Post.coffee | 8 ++------ src/Quotelinks/QuoteBacklink.coffee | 2 +- src/Quotelinks/QuoteMarkers.coffee | 6 +++--- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/General/Post.coffee b/src/General/Post.coffee index 2226ff64b..b88c12cd6 100644 --- a/src/General/Post.coffee +++ b/src/General/Post.coffee @@ -179,9 +179,7 @@ class Post for quotelink in Get.allQuotelinksLinkingTo @ when not $.hasClass quotelink, 'deadlink' $.addClass quotelink, 'deadlink' continue unless Conf['Quote Markers'] - post = Get.postFromNode quotelink - {board, thread} = if post.isClone then post.context else post - QuoteMarkers.parseQuotelink board, thread, post, quotelink, true + QuoteMarkers.parseQuotelink Get.postFromNode(quotelink), quotelink, true return # XXX tmp fix for 4chan's racing condition # giving us false-positive dead posts. @@ -203,9 +201,7 @@ class Post for quotelink in Get.allQuotelinksLinkingTo @ when $.hasClass quotelink, 'deadlink' $.rmClass quotelink, 'deadlink' continue unless Conf['Quote Markers'] - post = Get.postFromNode quotelink - {board, thread} = if post.isClone then post.context else post - QuoteMarkers.parseQuotelink board, thread, post, quotelink, true + QuoteMarkers.parseQuotelink Get.postFromNode(quotelink), quotelink, true return collect: -> diff --git a/src/Quotelinks/QuoteBacklink.coffee b/src/Quotelinks/QuoteBacklink.coffee index ead8fe676..e45a2a4c8 100644 --- a/src/Quotelinks/QuoteBacklink.coffee +++ b/src/Quotelinks/QuoteBacklink.coffee @@ -53,7 +53,7 @@ QuoteBacklink = if post.isHidden $.addClass a, 'filtered' if Conf['Quote Markers'] - QuoteMarkers.parseQuotelink post.board, post.thread, post, a, false, text + QuoteMarkers.parseQuotelink post, a, false, text if Conf['Quote Previewing'] $.on a, 'mouseover', QuotePreview.mouseover if Conf['Quote Inlining'] diff --git a/src/Quotelinks/QuoteMarkers.coffee b/src/Quotelinks/QuoteMarkers.coffee index 60433f7b6..fe6a66d4a 100644 --- a/src/Quotelinks/QuoteMarkers.coffee +++ b/src/Quotelinks/QuoteMarkers.coffee @@ -6,11 +6,11 @@ QuoteMarkers = name: 'Quote Markers' cb: @node node: -> - {board, thread} = if @isClone then @context else @ for quotelink in @nodes.quotelinks - QuoteMarkers.parseQuotelink board, thread, @, quotelink, !!@isClone + QuoteMarkers.parseQuotelink @, quotelink, !!@isClone return - parseQuotelink: (board, thread, post, quotelink, mayReset, customText) -> + parseQuotelink: (post, quotelink, mayReset, customText) -> + {board, thread} = if post.isClone then post.context else post markers = [] {boardID, threadID, postID} = Get.postDataFromLink quotelink From d8049013f55f28d5f694c3643754bdbbbbaed7fb Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sat, 15 Feb 2014 22:35:15 +0100 Subject: [PATCH 138/143] Fix incorrect OP/cross-thread markers on some backlinks. --- src/Quotelinks/QuoteBacklink.coffee | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Quotelinks/QuoteBacklink.coffee b/src/Quotelinks/QuoteBacklink.coffee index e45a2a4c8..000b56a13 100644 --- a/src/Quotelinks/QuoteBacklink.coffee +++ b/src/Quotelinks/QuoteBacklink.coffee @@ -27,8 +27,8 @@ QuoteBacklink = for quoteID in @quotes (QuoteBacklink.map[quoteID] or= []).push @fullID continue unless (post = g.posts[quoteID]) and container = post?.nodes.backlinkContainer - for container in [container].concat post.clones.map((clone) -> clone.nodes.backlinkContainer) - $.add container, QuoteBacklink.buildBacklink @ + for post in [post].concat post.clones + $.add post.nodes.backlinkContainer, QuoteBacklink.buildBacklink post, @ return secondNode: -> # Don't backlink the OP. @@ -41,19 +41,19 @@ QuoteBacklink = if @fullID of QuoteBacklink.map for quoteID in QuoteBacklink.map[@fullID] if post = g.posts[quoteID] # Post hasn't been collected since. - $.add container, QuoteBacklink.buildBacklink post + $.add container, QuoteBacklink.buildBacklink @, post $.add @nodes.info, container - buildBacklink: (post) -> + buildBacklink: (quoted, quoter) -> frag = QuoteBacklink.frag.cloneNode true a = frag.lastElementChild - a.href = "/#{post.board}/res/#{post.thread}#p#{post}" - a.textContent = text = QuoteBacklink.funk post.ID - if post.isDead + a.href = "/#{quoter.board}/res/#{quoter.thread}#p#{quoter}" + a.textContent = text = QuoteBacklink.funk quoter.ID + if quoter.isDead $.addClass a, 'deadlink' - if post.isHidden + if quoter.isHidden $.addClass a, 'filtered' if Conf['Quote Markers'] - QuoteMarkers.parseQuotelink post, a, false, text + QuoteMarkers.parseQuotelink quoted, a, false, text if Conf['Quote Previewing'] $.on a, 'mouseover', QuotePreview.mouseover if Conf['Quote Inlining'] From 8e423493ac211164b06a97b299a18c1342c5ac1f Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sat, 15 Feb 2014 22:43:03 +0100 Subject: [PATCH 139/143] Fix quote markers on backlinks in clones. --- src/Quotelinks/QuoteBacklink.coffee | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Quotelinks/QuoteBacklink.coffee b/src/Quotelinks/QuoteBacklink.coffee index 000b56a13..f04c0a555 100644 --- a/src/Quotelinks/QuoteBacklink.coffee +++ b/src/Quotelinks/QuoteBacklink.coffee @@ -35,6 +35,9 @@ QuoteBacklink = return unless @isReply or Conf['OP Backlinks'] if @isClone @nodes.backlinkContainer = $ '.backlink-container', @nodes.info + return unless Conf['Quote Markers'] + for backlink in @nodes.backlinks + QuoteMarkers.parseQuotelink @, backlink, true, QuoteBacklink.funk Get.postDataFromLink(backlink).postID return @nodes.backlinkContainer = container = $.el 'span', className: 'backlink-container' From 70fd543073293166f6d31c639f5e33326a237349 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sat, 15 Feb 2014 22:58:34 +0100 Subject: [PATCH 140/143] Hide the .page-num in archived posts. --- src/General/Get.coffee | 1 + src/General/Thread.coffee | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/General/Get.coffee b/src/General/Get.coffee index d05651789..0490b8403 100644 --- a/src/General/Get.coffee +++ b/src/General/Get.coffee @@ -233,5 +233,6 @@ Get = thread = g.threads["#{boardID}.#{threadID}"] or new Thread threadID, board post = new Post Build.post(o, true), thread, board, {isArchived: true} + $('.page-num', post.nodes.info).hidden = true Main.callbackNodes Post, [post] Get.insert post, root, context diff --git a/src/General/Thread.coffee b/src/General/Thread.coffee index 8a9df031f..1cdd9a957 100644 --- a/src/General/Thread.coffee +++ b/src/General/Thread.coffee @@ -16,7 +16,7 @@ class Thread g.threads[@fullID] = board.threads[@] = @ setPage: (pageNum) -> - icon = $ '.page-num', @OP.nodes.post + icon = $ '.page-num', @OP.nodes.info for key in ['title', 'textContent'] icon[key] = icon[key].replace /\d+/, pageNum @catalogView.nodes.pageCount.textContent = pageNum if @catalogView From 03de2816cc3363a6fa5a234863b537238512bc54 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sun, 16 Feb 2014 01:09:44 +0100 Subject: [PATCH 141/143] warosu archives /biz/. Also add /d/ to foolz beta. --- json/archives.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/json/archives.json b/json/archives.json index 7ad14adf2..2f1df532a 100644 --- a/json/archives.json +++ b/json/archives.json @@ -86,8 +86,8 @@ "http": false, "https": true, "software": "fuuka", - "boards": ["3", "cgl", "ck", "fa", "ic", "jp", "lit", "tg", "vr"], - "files": ["3", "cgl", "ck", "fa", "ic", "jp", "lit", "tg", "vr"] + "boards": ["3", "biz", "cgl", "ck", "fa", "ic", "jp", "lit", "tg", "vr"], + "files": ["3", "biz", "cgl", "ck", "fa", "ic", "jp", "lit", "tg", "vr"] }, { "uid": 15, "name": "fgts", @@ -123,6 +123,6 @@ "https": true, "withCredentials": true, "software": "foolfuuka", - "boards": ["a", "biz", "co", "gd", "jp", "m", "s4s", "sp", "tg", "tv", "u", "v", "vg", "vp", "vr", "wsg"], - "files": ["a", "biz", "gd", "jp", "m", "s4s", "tg", "u", "vg", "vp", "vr", "wsg"] + "boards": ["a", "biz", "co", "d", "gd", "jp", "m", "s4s", "sp", "tg", "tv", "u", "v", "vg", "vp", "vr", "wsg"], + "files": ["a", "biz", "d", "gd", "jp", "m", "s4s", "tg", "u", "vg", "vp", "vr", "wsg"] }] From f8cd67b4ed8e9e477bed5ec44d2c9b20bb022ba2 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sun, 16 Feb 2014 22:57:03 +0100 Subject: [PATCH 142/143] Close #1455. --- json/archives.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/json/archives.json b/json/archives.json index 2f1df532a..0a8e29d4e 100644 --- a/json/archives.json +++ b/json/archives.json @@ -123,6 +123,6 @@ "https": true, "withCredentials": true, "software": "foolfuuka", - "boards": ["a", "biz", "co", "d", "gd", "jp", "m", "s4s", "sp", "tg", "tv", "u", "v", "vg", "vp", "vr", "wsg"], + "boards": ["a", "biz", "co", "d", "gd", "jp", "m", "mlp", "s4s", "sp", "tg", "tv", "u", "v", "vg", "vp", "vr", "wsg"], "files": ["a", "biz", "d", "gd", "jp", "m", "s4s", "tg", "u", "vg", "vp", "vr", "wsg"] }] From b9896b48d2b44d13a9ce7df64bb47e53d30716dd Mon Sep 17 00:00:00 2001 From: Mayhem Date: Mon, 17 Feb 2014 18:02:32 +0100 Subject: [PATCH 143/143] Add some default booleans to Posts and Threads. Remove timeOfDeath as I won't get to use it anytime soon. Fix #1456. --- src/General/Index.coffee | 19 +++++++++---------- src/General/Post.coffee | 12 +++++------- src/General/Thread.coffee | 9 ++++++--- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/General/Index.coffee b/src/General/Index.coffee index bc484e48e..2e794b116 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -156,8 +156,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 return if Conf['Image Hover in Catalog'] @@ -204,17 +204,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() setIndexMode: (mode) -> @@ -623,7 +622,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'] sortOnTop: (match) -> diff --git a/src/General/Post.coffee b/src/General/Post.coffee index b88c12cd6..5d5b63ed1 100644 --- a/src/General/Post.coffee +++ b/src/General/Post.coffee @@ -52,6 +52,9 @@ class Post @parseQuotes() @parseFile that + @isDead = false + @isHidden = false + @clones = [] g.posts[@fullID] = thread.posts[@] = board.posts[@] = @ @kill() if that.isArchived @@ -62,7 +65,6 @@ class Post # Get the comment's text. #
      -> \n # Remove: - # 'Comment too long'... # EXIF data. (/p/) # Rolls. (/tg/) # Preceding and following new lines. @@ -149,17 +151,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 @@ -171,7 +170,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 @@ -185,7 +184,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/Thread.coffee b/src/General/Thread.coffee index 1cdd9a957..b930661c8 100644 --- a/src/General/Thread.coffee +++ b/src/General/Thread.coffee @@ -5,6 +5,10 @@ class Thread constructor: (@ID, @board) -> @fullID = "#{@board}.#{@ID}" @posts = {} + @isDead = false + @isHidden = false + @isOnTop = false + @isPinned = false @isSticky = false @isClosed = false @postLimit = false @@ -52,15 +56,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: -> for postID, post of @posts