Revert "Remove Archive Report option since fgts.jp and its report form no longer exists. #933" #1260

This reverts commit 91aa12f8fd41ac2f7096ad55df357324b52a4118.
This commit is contained in:
ccd0 2017-01-21 22:29:03 -08:00
parent 1e21b67d0e
commit c0f7bf14cc
4 changed files with 38 additions and 0 deletions

View File

@ -18,6 +18,7 @@ Redirect =
thread: {} thread: {}
post: {} post: {}
file: {} file: {}
report: {}
archives = {} archives = {}
for data in Conf['archives'] for data in Conf['archives']
@ -30,6 +31,7 @@ Redirect =
o.thread[boardID] = data unless boardID of o.thread o.thread[boardID] = data unless boardID of o.thread
o.post[boardID] = data unless boardID of o.post or software isnt 'foolfuuka' o.post[boardID] = data unless boardID of o.post or software isnt 'foolfuuka'
o.file[boardID] = data unless boardID of o.file or boardID not in files o.file[boardID] = data unless boardID of o.file or boardID not in files
o.report[boardID] = data if name is 'fgts'
for boardID, record of Conf['selectedArchives'] for boardID, record of Conf['selectedArchives']
for type, id of record when (archive = archives[JSON.stringify id]) for type, id of record when (archive = archives[JSON.stringify id])
@ -152,6 +154,9 @@ Redirect =
"#{boardID}/?task=search2&search_#{type}=#{value}" "#{boardID}/?task=search2&search_#{type}=#{value}"
"#{Redirect.protocol archive}#{archive.domain}/#{path}" "#{Redirect.protocol archive}#{archive.domain}/#{path}"
report: (archive, {boardID, postID}) ->
"https://so.fgts.jp/report/?board=#{boardID}&no=#{postID}"
securityCheck: (url) -> securityCheck: (url) ->
/^https:\/\//.test(url) or /^https:\/\//.test(url) or
location.protocol is 'http:' or location.protocol is 'http:' or

View File

@ -19,6 +19,10 @@ ReportLink =
ReportLink.dims = 'width=350,height=275' ReportLink.dims = 'width=350,height=275'
else else
ReportLink.dims = 'width=400,height=550' ReportLink.dims = 'width=400,height=550'
else if Conf['Archive Report']
a.textContent = 'Report to archive'
ReportLink.url = Redirect.to 'report', {boardID: post.board.ID, postID: post.ID}
ReportLink.dims = 'width=700,height=475'
else else
ReportLink.url = '' ReportLink.url = ''
!!ReportLink.url !!ReportLink.url

View File

@ -8,6 +8,8 @@ Report =
ready: -> ready: ->
$.addStyle CSS.report $.addStyle CSS.report
Report.archive() if Conf['Archive Report']
if not Conf['Use Recaptcha v1 in Reports'] and not Conf['Force Noscript Captcha'] and Main.jsEnabled if not Conf['Use Recaptcha v1 in Reports'] and not Conf['Force Noscript Captcha'] and Main.jsEnabled
new MutationObserver(-> new MutationObserver(->
Report.fit 'iframe[src^="https://www.google.com/recaptcha/api2/frame"]' Report.fit 'iframe[src^="https://www.google.com/recaptcha/api2/frame"]'
@ -23,3 +25,26 @@ Report =
return if not ((el = $ selector, doc) and getComputedStyle(el).visibility isnt 'hidden') return if not ((el = $ selector, doc) and getComputedStyle(el).visibility isnt 'hidden')
dy = el.getBoundingClientRect().bottom - doc.clientHeight + 8 dy = el.getBoundingClientRect().bottom - doc.clientHeight + 8
window.resizeBy 0, dy if dy > 0 window.resizeBy 0, dy if dy > 0
archive: ->
Redirect.init()
return unless (url = Redirect.to 'report', {boardID: g.BOARD.ID, postID: Report.postID})
if (message = $ 'h3') and /Report submitted!/.test(message.textContent)
if location.hash is '#redirect'
$.globalEval 'self.close = function(){};'
window.resizeTo 700, 475
location.replace url
return
link = $.el 'a',
href: url
textContent: 'Report to archive'
$.on link, 'click', (e) ->
unless e.shiftKey or e.altKey or e.ctrlKey or e.metaKey or e.button isnt 0
window.resizeTo 700, 475
$.add d.body, [$.tn(' ['), link, $.tn(']')]
if types = $.id('reportTypes')
$.on types, 'change', (e) ->
$('form').action = if e.target.value is 'illegal' then '#redirect' else ''

View File

@ -39,6 +39,10 @@ Config =
true true
'Redirect dead threads and images to the archives.' 'Redirect dead threads and images to the archives.'
] ]
'Archive Report': [
true
'Enable reporting posts to supported archives.'
]
'Exempt Archives from Encryption': [ 'Exempt Archives from Encryption': [
true true
'Permit loading content from, and warningless redirects to, HTTP-only archives from HTTPS pages.' 'Permit loading content from, and warningless redirects to, HTTP-only archives from HTTPS pages.'