Move Pass Link out of Main.coffee, make optional, fix minor issues.

This commit is contained in:
ccd0 2015-11-07 23:36:27 -08:00
parent d7268d2518
commit 73fc544dea
3 changed files with 21 additions and 11 deletions

View File

@ -502,6 +502,10 @@ Config =
false
'Use the image selection captcha in the report window.'
]
'Pass Link': [
true
'Add a 4chan Pass login link to the bottom of the page.'
]
'Quote Links':
'Quote Backlinks': [

View File

@ -204,17 +204,6 @@ Main =
return if d.title in ['4chan - Temporarily Offline', '4chan - 404 Not Found']
# 4chan Pass Link
if styleSelector = $.id 'styleSelector'
passLink = $.el 'a',
textContent: '4chan Pass'
href: 'javascript:;'
$.on passLink, 'click', ->
window.open '//sys.4chan.org/auth',
'This will steal your data.'
'left=0,top=0,width=500,height=255,toolbar=0,resizable=0'
$.before styleSelector.previousSibling, [$.tn '['; passLink, $.tn ']\u00A0\u00A0']
# Parse HTML or skip it and start building from JSON.
unless Conf['JSON Navigation'] and g.VIEW is 'index'
Main.initThread()
@ -380,6 +369,7 @@ Main =
['Quick Reply', QR]
['Cooldown', QR.cooldown]
['Oekaki Links', QR.oekaki]
['Pass Link', PassLink]
['Menu', Menu]
['Index Generator (Menu)', Index.menu]
['Report Link', ReportLink]

View File

@ -0,0 +1,16 @@
PassLink =
init: ->
return unless Conf['Pass Link']
Main.ready @ready
ready: ->
return unless (styleSelector = $.id 'styleSelector')
passLink = $.el 'span',
className: 'brackets-wrap pass-link-container'
$.extend passLink, <%= html('<a href="javascript:;">4chan Pass</a>') %>
$.on passLink.firstElementChild, 'click', ->
window.open '//sys.4chan.org/auth',
Date.now()
'width=500,height=280,toolbar=0'
$.before styleSelector.previousSibling, [passLink, $.tn('\u00A0\u00A0')]