Merge pull request #254 from seaweedchan/qr-link

Restore QR link, make shortcut optional
This commit is contained in:
Zixaphir 2013-04-22 13:03:11 -07:00
commit a2704e92a6
7 changed files with 194 additions and 80 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -13,6 +13,10 @@ Config =
true
'Show custom links instead of the full board list.'
]
'QR Shortcut': [
false,
'Adds a small [QR] link in the header.'
]
'Announcement Hiding': [
true
'Add button to hide 4chan announcements.'

View File

@ -590,6 +590,9 @@ a.hide-announcement {
border-width: 1px;
border-style: solid;
}
.qr-link {
text-align: center;
}
.persona {
width: 248px;
max-width: 100%;

View File

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

View File

@ -4,21 +4,22 @@ QR =
@db = new DataBoard 'yourPosts'
sc = $.el 'a',
className: "qr-shortcut #{unless Conf['Persistent QR'] then 'disabled' else ''}"
textContent: 'QR'
title: 'Quick Reply'
href: 'javascript:;'
$.on sc, 'click', ->
if !QR.nodes or QR.nodes.el.hidden
$.event 'CloseMenu'
QR.open()
QR.nodes.com.focus()
else
QR.close()
$.toggleClass @, 'disabled'
if Conf['QR Shortcut']
sc = $.el 'a',
className: "qr-shortcut #{unless Conf['Persistent QR'] then 'disabled' else ''}"
textContent: 'QR'
title: 'Quick Reply'
href: 'javascript:;'
$.on sc, 'click', ->
if !QR.nodes or QR.nodes.el.hidden
$.event 'CloseMenu'
QR.open()
QR.nodes.com.focus()
else
QR.close()
$.toggleClass @, 'disabled'
Header.addShortcut sc
Header.addShortcut sc
if Conf['Hide Original Post Form']
$.asap (-> doc), -> $.addClass doc, 'hide-original-post-form'
@ -34,6 +35,22 @@ QR =
QR.postingIsEnabled = !!$.id 'postForm'
return unless QR.postingIsEnabled
link = $.el 'h1',
innerHTML: "<a href=javascript:;>#{title = if g.VIEW is 'thread' then 'Reply to Thread' else 'Start a Thread'}</a>"
title: title
className: "qr-link"
$.on link, 'click', ->
if !QR.nodes or QR.nodes.el.hidden
$.event 'CloseMenu'
QR.open()
QR.nodes.com.focus()
if Conf['QR Shortcut']
$.rmClass $('.qr-shortcut'), 'disabled'
else
QR.close()
$.before $.id('postForm'), link
$.on d, 'QRGetSelectedPost', ({detail: cb}) ->
cb QR.selected
$.on d, 'QRAddPreSubmitHook', ({detail: cb}) ->
@ -79,7 +96,8 @@ QR =
QR.cleanNotifications()
d.activeElement.blur()
$.rmClass QR.nodes.el, 'dump'
$.toggleClass $('.qr-shortcut'), 'disabled'
if Conf['QR Shortcut']
$.toggleClass $('.qr-shortcut'), 'disabled'
for i in QR.posts
QR.posts[0].rm()
QR.cooldown.auto = false
@ -294,7 +312,8 @@ QR =
QR.selected.save com
QR.selected.save thread
$.rmClass $('.qr-shortcut'), 'disabled'
if Conf['QR Shortcut']
$.rmClass $('.qr-shortcut'), 'disabled'
characterCount: ->
counter = QR.nodes.charCount