Restore QR link, make shortcut optional

This commit is contained in:
Jordan Bates 2013-04-22 06:08:41 -07:00
parent 0b802fdd56
commit 906fc78ca7
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 true
'Show custom links instead of the full board list.' 'Show custom links instead of the full board list.'
] ]
'QR Shortcut': [
false,
'Adds a small [QR] link in the header.'
]
'Announcement Hiding': [ 'Announcement Hiding': [
true true
'Add button to hide 4chan announcements.' 'Add button to hide 4chan announcements.'

View File

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

View File

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

View File

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