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,6 +132,7 @@ 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()
if Conf['QR Shortcut']
$.rmClass $('.qr-shortcut'), 'disabled' $.rmClass $('.qr-shortcut'), 'disabled'
tags: (tag, ta) -> tags: (tag, ta) ->

View File

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