Alt+click to pin threads in the catalog.

Conflicts:
	css/style.css
This commit is contained in:
Mayhem 2014-01-28 10:26:46 +01:00 committed by ccd0
parent ab42ad2409
commit c3e37a8077
6 changed files with 35 additions and 2 deletions

View File

@ -113,7 +113,7 @@ Filter =
# Highlight
$.addClass @nodes.root, result.class
unless result.class in @highlights
unless @highlights and result.class in @highlights
(@highlights or= []).push result.class
if !@isReply and result.top
@thread.isOnTop = true

View File

@ -363,6 +363,7 @@ Build =
'<div class="comment">&{thread.OP.nodes.comment}</div>'
) %>
$.addClass root, 'pinned' if thread.isPinned
$.addClass root, thread.OP.highlights... if thread.OP.highlights
if thread.isSticky

View File

@ -4,6 +4,11 @@ Index =
@board = "#{g.BOARD}"
@db = new DataBoard 'pinnedThreads'
Thread.callbacks.push
name: 'Thread Pinning'
cb: @node
@button = $.el 'a',
className: 'index-refresh-shortcut fa fa-refresh'
title: 'Refresh'
@ -131,6 +136,24 @@ Index =
new Notice 'info', "Last page reached.", 2
setTimeout reset, 3 * $.SECOND
node: ->
return unless data = Index.db.get {boardID: @board.ID, threadID: @ID}
@pin() if data.isPinned
togglePin: (thread) ->
if thread.isPinned
thread.unpin()
Index.db.delete
boardID: thread.board.ID
threadID: thread.ID
else
thread.pin()
Index.db.set
boardID: thread.board.ID
threadID: thread.ID
val: isPinned: thread.isPinned
Index.sort()
Index.buildIndex()
cb:
rootClass: ->
(if Conf['Index Mode'] is 'catalog' then $.addClass else $.rmClass) Index.root, 'catalog-mode'

View File

@ -824,6 +824,7 @@ span.hide-announcement {
.filter-highlight > .reply {
box-shadow: -5px 0 rgba(255, 0, 0, .5);
}
.pinned .thumb,
.filter-highlight .thumb {
border: 2px solid rgba(255, 0, 0, .5);
}

View File

@ -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]

View File

@ -63,9 +63,17 @@ class Thread
$.rm @catalogView
ThreadHiding.hide @
ThreadHiding.saveHiddenState @
else if e.altKey
Index.togglePin @
else
return
e.preventDefault()
pin: ->
@isOnTop = @isPinned = true
$.addClass @catalogView, 'pinned' if @catalogView
unpin: ->
@isOnTop = @isPinned = false
$.rmClass @catalogView, 'pinned' if @catalogView
kill: ->
@isDead = true