Break up 'Toggleable Thread Watcher' into 'Fixed' and 'Toggleable' parts. #40

This commit is contained in:
ccd0 2015-04-07 10:11:11 -07:00
parent 0615be12de
commit 344f5a7c82
4 changed files with 15 additions and 8 deletions

View File

@ -377,9 +377,14 @@ Config =
true true
'Bookmark threads.' 'Bookmark threads.'
] ]
'Fixed Thread Watcher': [
null # XXX temporarily set in Main.coffee so old versions update to correct setting
'Makes the thread watcher scroll with the page.'
1
]
'Toggleable Thread Watcher': [ 'Toggleable Thread Watcher': [
true true
'Adds a shortcut for the thread watcher, hides the watcher by default, and makes it scroll with the page.' 'Adds a shortcut for the thread watcher and hides the watcher by default.'
1 1
] ]
'Mark New IPs': [ 'Mark New IPs': [

View File

@ -43,6 +43,8 @@ Main =
$.get Conf, (items) -> $.get Conf, (items) ->
$.extend Conf, items $.extend Conf, items
# XXX temporarily set here so old versions update to correct setting
Conf['Fixed Thread Watcher'] ?= Conf['Toggleable Thread Watcher']
$.asap (-> doc = d.documentElement), Main.initFeatures $.asap (-> doc = d.documentElement), Main.initFeatures
# set up CSS when <head> is completely loaded # set up CSS when <head> is completely loaded

View File

@ -803,7 +803,7 @@ span.hide-announcement {
:root.fixed-watcher #thread-watcher { :root.fixed-watcher #thread-watcher {
position: fixed; position: fixed;
} }
:root:not(.fixed-watcher) #thread-watcher:not(:hover) { :root:not(.toggleable-watcher) #thread-watcher:not(:hover) {
max-height: 210px; max-height: 210px;
overflow-y: hidden; overflow-y: hidden;
} }
@ -837,7 +837,7 @@ span.hide-announcement {
#thread-watcher a { #thread-watcher a {
text-decoration: none; text-decoration: none;
} }
:root:not(.fixed-watcher) #thread-watcher .move > .close { :root:not(.toggleable-watcher) #thread-watcher .move > .close {
display: none; display: none;
} }
#thread-watcher .move > .close { #thread-watcher .move > .close {

View File

@ -18,9 +18,6 @@ ThreadWatcher =
@closeButton = $('.move > .close', @dialog) @closeButton = $('.move > .close', @dialog)
@unreaddb = Unread.db or new DataBoard 'lastReadPosts' @unreaddb = Unread.db or new DataBoard 'lastReadPosts'
if Conf['Toggleable Thread Watcher']
@dialog.hidden = true
$.on d, 'QRPostSuccessful', @cb.post $.on d, 'QRPostSuccessful', @cb.post
$.on sc, 'click', @toggleWatcher $.on sc, 'click', @toggleWatcher
$.on @refreshButton, 'click', @fetchAllStatus $.on @refreshButton, 'click', @fetchAllStatus
@ -34,9 +31,12 @@ ThreadWatcher =
when 'thread' when 'thread'
$.on d, 'ThreadUpdate', @cb.onThreadRefresh $.on d, 'ThreadUpdate', @cb.onThreadRefresh
if Conf['Toggleable Thread Watcher'] if Conf['Fixed Thread Watcher']
Header.addShortcut sc
$.addClass doc, 'fixed-watcher' $.addClass doc, 'fixed-watcher'
if Conf['Toggleable Thread Watcher']
@dialog.hidden = true
Header.addShortcut sc
$.addClass doc, 'toggleable-watcher'
ThreadWatcher.fetchAuto() ThreadWatcher.fetchAuto()