4chan-x/src/Menu/ReportLink.coffee
2015-01-04 09:47:03 -08:00

22 lines
655 B
CoffeeScript
Executable File

ReportLink =
init: ->
return if g.VIEW not in ['index', 'thread'] or !Conf['Menu'] or !Conf['Report Link']
a = $.el 'a',
className: 'report-link'
href: 'javascript:;'
textContent: 'Report this post'
$.on a, 'click', ReportLink.report
Menu.menu.addEntry
el: a
order: 10
open: (post) ->
ReportLink.post = post
!post.isDead
report: ->
{post} = ReportLink
url = "//sys.4chan.org/#{post.board}/imgboard.php?mode=report&no=#{post}"
id = Date.now()
set = "toolbar=0,scrollbars=0,location=0,status=1,menubar=0,resizable=1,width=685,height=285"
window.open url, id, set