Bring back index argument for Header.addShortcut.

This commit is contained in:
ccd0 2016-04-27 08:38:33 -07:00
parent 015db35c85
commit 2909e88223
9 changed files with 16 additions and 14 deletions

View File

@ -55,7 +55,7 @@ Header =
$.sync 'Centered links', @setLinkJustify
$.sync 'Bottom Board List', @setFooterVisibility
@addShortcut menuButton
@addShortcut menuButton, 900
@menu.addEntry
el: $.el 'span',
@ -119,7 +119,7 @@ Header =
cs.className = 'fa fa-leaf'
$.on cs, 'click', () ->
$.id('settingsWindowLink').click()
@addShortcut cs
@addShortcut cs, 810
@enableDesktopNotifications()
@ -495,11 +495,15 @@ Header =
else
top < 0
addShortcut: (el) ->
addShortcut: (el, index) ->
shortcut = $.el 'span',
className: 'shortcut brackets-wrap'
$.add shortcut, el
$.prepend Header.shortcuts, shortcut
shortcut.dataset.index = index
for item in $$('[data-index]', Header.shortcuts) when +item.dataset.index > +index
$.before item, shortcut
return
$.add Header.shortcuts, shortcut
rmShortcut: (el) ->
$.rm el.parentElement

View File

@ -32,7 +32,7 @@ Index =
href: 'javascript:;'
textContent: 'Refresh Index'
$.on @button, 'click', -> Index.update()
Header.addShortcut @button, 1
Header.addShortcut @button, 590
# Header "Index Navigation" submenu
repliesEntry = el: UI.checkbox 'Show Replies', 'Show replies'

View File

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

View File

@ -13,7 +13,7 @@ Gallery =
$.on el, 'click', @cb.toggle
Header.addShortcut el
Header.addShortcut el, 530
Callbacks.Post.push
name: 'Gallery'

View File

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

View File

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

View File

@ -8,8 +8,7 @@ ThreadUpdater =
@dialog = sc = $.el 'span',
id: 'updater'
$.extend sc, <%= html('<span id="update-status" class="empty"></span><span id="update-timer" class="empty" title="Update now"></span>') %>
$.ready ->
Header.addShortcut sc
Header.addShortcut sc, 100
else
@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>') %>

View File

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

View File

@ -51,7 +51,7 @@ QR =
else
QR.close()
Header.addShortcut sc
Header.addShortcut sc, 540
initReady: ->
$.off d, '4chanXInitFinished', @initReady