Consolidate QR Shortcut code.

This commit is contained in:
ccd0 2015-01-25 18:19:31 -08:00
parent 0e10415d71
commit e079c55e60
2 changed files with 13 additions and 21 deletions

View File

@ -215,8 +215,6 @@ Keybinds =
if thread?
QR.quote.call $ 'input', $('.post.highlight', thread) or thread
QR.nodes.com.focus()
if Conf['QR Shortcut']
$.rmClass $('.qr-shortcut'), 'disabled'
tags: (tag, ta) ->
supported = switch tag

View File

@ -15,7 +15,7 @@ QR =
if Conf['QR Shortcut']
sc = $.el 'a',
className: "qr-shortcut fa fa-comment-o #{unless Conf['Persistent QR'] then 'disabled' else ''}"
className: 'qr-shortcut fa fa-comment-o disabled'
textContent: 'QR'
title: 'Quick Reply'
href: 'javascript:;'
@ -24,10 +24,8 @@ QR =
if Conf['Persistent QR'] or !QR.nodes or QR.nodes.el.hidden
QR.open()
QR.nodes.com.focus()
$.rmClass @, 'disabled'
else
QR.close()
$.addClass @, 'disabled'
Header.addShortcut sc
@ -62,8 +60,6 @@ QR =
$.event 'CloseMenu'
QR.open()
QR.nodes.com.focus()
if Conf['QR Shortcut']
$.rmClass $('.qr-shortcut'), 'disabled'
if Conf['Bottom QR Link'] and g.VIEW is 'thread'
linkBot = $.el 'div',
@ -74,8 +70,6 @@ QR =
$.event 'CloseMenu'
QR.open()
QR.nodes.com.focus()
if Conf['QR Shortcut']
$.rmClass $('.qr-shortcut'), 'disabled'
$.prepend $('.navLinksBot'), linkBot
@ -110,14 +104,17 @@ QR =
QR.captcha.setup() if QR.nodes.el.hidden
QR.nodes.el.hidden = false
QR.unhide()
return
try
QR.dialog()
catch err
delete QR.nodes
Main.handleErrors
message: 'Quick Reply dialog creation crashed.'
error: err
else
try
QR.dialog()
catch err
delete QR.nodes
Main.handleErrors
message: 'Quick Reply dialog creation crashed.'
error: err
return
if Conf['QR Shortcut']
$.rmClass $('.qr-shortcut'), 'disabled'
close: ->
if QR.req
QR.abort()
@ -127,7 +124,7 @@ QR =
d.activeElement.blur()
$.rmClass QR.nodes.el, 'dump'
if Conf['QR Shortcut']
$.toggleClass $('.qr-shortcut'), 'disabled'
$.addClass $('.qr-shortcut'), 'disabled'
new QR.post true
for post in QR.posts.splice 0, QR.posts.length - 1
post.delete()
@ -280,9 +277,6 @@ QR =
QR.selected.save com
QR.selected.save thread
if Conf['QR Shortcut']
$.rmClass $('.qr-shortcut'), 'disabled'
characterCount: ->
counter = QR.nodes.charCount
count = QR.nodes.com.textLength