Alt+click to pin threads in the catalog.
This commit is contained in:
parent
1d43fbc498
commit
9f682bea14
@ -649,6 +649,7 @@ a.hide-announcement {
|
|||||||
.filter-highlight > .reply {
|
.filter-highlight > .reply {
|
||||||
box-shadow: -5px 0 rgba(255, 0, 0, .5);
|
box-shadow: -5px 0 rgba(255, 0, 0, .5);
|
||||||
}
|
}
|
||||||
|
.pinned .thumb,
|
||||||
.filter-highlight .thumb {
|
.filter-highlight .thumb {
|
||||||
border: 2px solid rgba(255, 0, 0, .5);
|
border: 2px solid rgba(255, 0, 0, .5);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -110,7 +110,7 @@ Filter =
|
|||||||
|
|
||||||
# Highlight
|
# Highlight
|
||||||
$.addClass @nodes.root, result.class
|
$.addClass @nodes.root, result.class
|
||||||
unless result.class in @highlights
|
unless @highlights and result.class in @highlights
|
||||||
(@highlights or= []).push result.class
|
(@highlights or= []).push result.class
|
||||||
if !@isReply and result.top
|
if !@isReply and result.top
|
||||||
@thread.isOnTop = true
|
@thread.isOnTop = true
|
||||||
|
|||||||
@ -297,6 +297,7 @@ Build =
|
|||||||
className: 'catalog-thread'
|
className: 'catalog-thread'
|
||||||
innerHTML: <%= importHTML('General/Thread-catalog-view') %>
|
innerHTML: <%= importHTML('General/Thread-catalog-view') %>
|
||||||
|
|
||||||
|
$.addClass root, 'pinned' if thread.isPinned
|
||||||
$.addClass root, thread.OP.highlights... if thread.OP.highlights
|
$.addClass root, thread.OP.highlights... if thread.OP.highlights
|
||||||
|
|
||||||
if thread.isSticky
|
if thread.isSticky
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
class DataBoard
|
class DataBoard
|
||||||
@keys = ['hiddenThreads', 'hiddenPosts', 'lastReadPosts', 'yourPosts', 'watchedThreads']
|
@keys = ['pinnedThreads', 'hiddenThreads', 'hiddenPosts', 'lastReadPosts', 'yourPosts', 'watchedThreads']
|
||||||
|
|
||||||
constructor: (@key, sync, dontClean) ->
|
constructor: (@key, sync, dontClean) ->
|
||||||
@data = Conf[key]
|
@data = Conf[key]
|
||||||
|
|||||||
@ -12,6 +12,11 @@ Index =
|
|||||||
|
|
||||||
return if g.VIEW isnt 'index' or g.BOARD.ID is 'f'
|
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',
|
@button = $.el 'a',
|
||||||
className: 'index-refresh-shortcut fa fa-refresh'
|
className: 'index-refresh-shortcut fa fa-refresh'
|
||||||
title: 'Refresh Index'
|
title: 'Refresh Index'
|
||||||
@ -112,6 +117,24 @@ Index =
|
|||||||
$.asap (-> $('.pagelist') or d.readyState isnt 'loading'), ->
|
$.asap (-> $('.pagelist') or d.readyState isnt 'loading'), ->
|
||||||
$.replace $('.pagelist'), Index.pagelist
|
$.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:
|
cb:
|
||||||
rootClass: ->
|
rootClass: ->
|
||||||
(if Conf['Index Mode'] is 'catalog' then $.addClass else $.rmClass) Index.root, 'catalog-mode'
|
(if Conf['Index Mode'] is 'catalog' then $.addClass else $.rmClass) Index.root, 'catalog-mode'
|
||||||
|
|||||||
@ -61,9 +61,17 @@ class Thread
|
|||||||
$.rm @catalogView
|
$.rm @catalogView
|
||||||
ThreadHiding.hide @
|
ThreadHiding.hide @
|
||||||
ThreadHiding.saveHiddenState @
|
ThreadHiding.saveHiddenState @
|
||||||
|
else if e.altKey
|
||||||
|
Index.togglePin @
|
||||||
else
|
else
|
||||||
return
|
return
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
pin: ->
|
||||||
|
@isOnTop = @isPinned = true
|
||||||
|
$.addClass @catalogView, 'pinned' if @catalogView
|
||||||
|
unpin: ->
|
||||||
|
@isOnTop = @isPinned = false
|
||||||
|
$.rmClass @catalogView, 'pinned' if @catalogView
|
||||||
|
|
||||||
kill: ->
|
kill: ->
|
||||||
@isDead = true
|
@isDead = true
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user