From 1d43fbc498f5f768d9de3ab7cb25987381b960c6 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Tue, 28 Jan 2014 09:59:49 +0100 Subject: [PATCH] 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