Make sure all shortcuts have IDs. #904

This commit is contained in:
ccd0 2016-06-17 17:59:53 -07:00
parent ca5deed798
commit 6a2b05a629
11 changed files with 18 additions and 19 deletions

View File

@ -55,7 +55,7 @@ Header =
$.sync 'Centered links', @setLinkJustify $.sync 'Centered links', @setLinkJustify
$.sync 'Bottom Board List', @setFooterVisibility $.sync 'Bottom Board List', @setFooterVisibility
@addShortcut menuButton, 900 @addShortcut 'menu', menuButton, 900
@menu.addEntry @menu.addEntry
el: $.el 'span', el: $.el 'span',
@ -119,7 +119,7 @@ Header =
cs.className = 'native-settings' cs.className = 'native-settings'
$.on cs, 'click', () -> $.on cs, 'click', () ->
$.id('settingsWindowLink').click() $.id('settingsWindowLink').click()
@addShortcut cs, 810 @addShortcut 'native', cs, 810
@enableDesktopNotifications() @enableDesktopNotifications()
@ -495,8 +495,9 @@ Header =
else else
top < 0 top < 0
addShortcut: (el, index) -> addShortcut: (id, el, index) ->
shortcut = $.el 'span', shortcut = $.el 'span',
id: "shortcut-#{id}"
className: 'shortcut brackets-wrap' className: 'shortcut brackets-wrap'
$.add shortcut, el $.add shortcut, el
shortcut.dataset.index = index shortcut.dataset.index = index

View File

@ -27,12 +27,12 @@ Index =
# Header refresh button # Header refresh button
@button = $.el 'a', @button = $.el 'a',
className: 'index-refresh-shortcut fa fa-refresh' className: 'fa fa-refresh'
title: 'Refresh' title: 'Refresh'
href: 'javascript:;' href: 'javascript:;'
textContent: 'Refresh Index' textContent: 'Refresh Index'
$.on @button, 'click', -> Index.update() $.on @button, 'click', -> Index.update()
Header.addShortcut @button, 590 Header.addShortcut 'index-refresh', @button, 590
# Header "Index Navigation" submenu # Header "Index Navigation" submenu
repliesEntry = el: UI.checkbox 'Show Replies', 'Show replies' repliesEntry = el: UI.checkbox 'Show Replies', 'Show replies'

View File

@ -8,7 +8,7 @@ Settings =
href: 'javascript:;' href: 'javascript:;'
$.on link, 'click', Settings.open $.on link, 'click', Settings.open
Header.addShortcut link, 820 Header.addShortcut 'settings', link, 820
add = @addSection add = @addSection

View File

@ -25,11 +25,10 @@ FappeTyme =
textContent: type[0] textContent: type[0]
title: "#{type} Tyme active" title: "#{type} Tyme active"
$.on indicator, 'click', -> $.on indicator, 'click', ->
check = FappeTyme.nodes[@parentNode.id.split('-')[0]] check = FappeTyme.nodes[@parentNode.id.replace('shortcut-', '')]
check.checked = !check.checked check.checked = !check.checked
$.event 'change', null, check $.event 'change', null, check
Header.addShortcut indicator, 410 Header.addShortcut lc, indicator, 410
indicator.parentNode.id = "#{lc}-indicator"
if Conf['Werk Tyme'] if Conf['Werk Tyme']
$.sync 'werk', @set.bind(@, 'werk') $.sync 'werk', @set.bind(@, 'werk')

View File

@ -6,14 +6,13 @@ Gallery =
el = $.el 'a', el = $.el 'a',
href: 'javascript:;' href: 'javascript:;'
id: 'appchan-gal'
title: 'Gallery' title: 'Gallery'
className: 'fa fa-picture-o' className: 'fa fa-picture-o'
textContent: 'Gallery' textContent: 'Gallery'
$.on el, 'click', @cb.toggle $.on el, 'click', @cb.toggle
Header.addShortcut el, 530 Header.addShortcut 'gallery', el, 530
Callbacks.Post.push Callbacks.Post.push
name: 'Gallery' name: 'Gallery'

View File

@ -9,7 +9,7 @@ ImageExpand =
href: 'javascript:;' href: 'javascript:;'
$.on @EAI, 'click', @cb.toggleAll $.on @EAI, 'click', @cb.toggleAll
Header.addShortcut @EAI, 520 Header.addShortcut 'expand-all', @EAI, 520
$.on d, 'scroll visibilitychange', @cb.playVideos $.on d, 'scroll visibilitychange', @cb.playVideos
@videoControls = $.el 'span', className: 'video-controls' @videoControls = $.el 'span', className: 'video-controls'
$.extend @videoControls, <%= html(' <a href="javascript:;" title="You can also contract the video by dragging it to the left.">contract</a>') %> $.extend @videoControls, <%= html(' <a href="javascript:;" title="You can also contract the video by dragging it to the left.">contract</a>') %>

View File

@ -16,7 +16,7 @@ ThreadStats =
id: 'thread-stats' id: 'thread-stats'
title: statsTitle title: statsTitle
$.extend sc, statsHTML $.extend sc, statsHTML
Header.addShortcut sc, 200 Header.addShortcut 'stats', sc, 200
else else
@dialog = sc = UI.dialog 'thread-stats', 'bottom: 0px; right: 0px;', @dialog = sc = UI.dialog 'thread-stats', 'bottom: 0px; right: 0px;',

View File

@ -12,7 +12,7 @@ ThreadUpdater =
@dialog = sc = $.el 'span', @dialog = sc = $.el 'span',
id: 'updater' id: 'updater'
$.extend sc, <%= html('<span id="update-status" class="empty"></span><span id="update-timer" class="empty" title="Update now"></span>') %> $.extend sc, <%= html('<span id="update-status" class="empty"></span><span id="update-timer" class="empty" title="Update now"></span>') %>
Header.addShortcut sc, 100 Header.addShortcut 'updater', sc, 100
else else
@dialog = sc = UI.dialog 'updater', 'bottom: 0px; left: 0px;', @dialog = sc = UI.dialog 'updater', 'bottom: 0px; left: 0px;',
<%= html('<div class="move"></div><span id="update-status"></span><span id="update-timer" title="Update now"></span>') %> <%= html('<div class="move"></div><span id="update-status"></span><span id="update-timer" title="Update now"></span>') %>

View File

@ -36,7 +36,7 @@ ThreadWatcher =
$.addClass doc, 'fixed-watcher' $.addClass doc, 'fixed-watcher'
if Conf['Toggleable Thread Watcher'] if Conf['Toggleable Thread Watcher']
@dialog.hidden = true @dialog.hidden = true
Header.addShortcut sc, 510 Header.addShortcut 'watcher', sc, 510
$.addClass doc, 'toggleable-watcher' $.addClass doc, 'toggleable-watcher'
ThreadWatcher.fetchAuto() ThreadWatcher.fetchAuto()

View File

@ -39,7 +39,7 @@ QR =
if Conf['QR Shortcut'] if Conf['QR Shortcut']
@shortcut = sc = $.el 'a', @shortcut = sc = $.el 'a',
className: 'qr-shortcut fa fa-comment-o disabled' className: 'fa fa-comment-o disabled'
textContent: 'QR' textContent: 'QR'
title: 'Quick Reply' title: 'Quick Reply'
href: 'javascript:;' href: 'javascript:;'
@ -51,7 +51,7 @@ QR =
else else
QR.close() QR.close()
Header.addShortcut sc, 540 Header.addShortcut 'qr', sc, 540
initReady: -> initReady: ->
$.off d, '4chanXInitFinished', @initReady $.off d, '4chanXInitFinished', @initReady

View File

@ -1139,8 +1139,8 @@ input[name="Default Volume"] {
border-radius: 2px; border-radius: 2px;
cursor: pointer; cursor: pointer;
} }
:root:not(.fappeTyme) #fappe-indicator, :root:not(.fappeTyme) #shortcut-fappe,
:root:not(.werkTyme) #werk-indicator { :root:not(.werkTyme) #shortcut-werk {
display: none; display: none;
} }