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

View File

@ -4,6 +4,7 @@ QR =
@db = new DataBoard 'yourPosts'
if Conf['QR Shortcut']
sc = $.el 'a',
className: "qr-shortcut #{unless Conf['Persistent QR'] then 'disabled' else ''}"
textContent: 'QR'
@ -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,6 +96,7 @@ QR =
QR.cleanNotifications()
d.activeElement.blur()
$.rmClass QR.nodes.el, 'dump'
if Conf['QR Shortcut']
$.toggleClass $('.qr-shortcut'), 'disabled'
for i in QR.posts
QR.posts[0].rm()
@ -294,6 +312,7 @@ QR =
QR.selected.save com
QR.selected.save thread
if Conf['QR Shortcut']
$.rmClass $('.qr-shortcut'), 'disabled'
characterCount: ->