Resize report window as needed instead of opening it huge at beginning.
This commit is contained in:
parent
b7916eb25f
commit
bb7a8e008d
@ -20,6 +20,5 @@ ReportLink =
|
|||||||
report: ->
|
report: ->
|
||||||
{url} = ReportLink
|
{url} = ReportLink
|
||||||
id = Date.now()
|
id = Date.now()
|
||||||
height = if d.cookie.indexOf('pass_enabled=1') >= 0 then 200 else 675
|
set = "toolbar=0,scrollbars=1,location=0,status=1,menubar=0,resizable=1,width=685,height=200"
|
||||||
set = "toolbar=0,scrollbars=1,location=0,status=1,menubar=0,resizable=1,width=685,height=#{height}"
|
|
||||||
window.open url, id, set
|
window.open url, id, set
|
||||||
|
|||||||
@ -1,18 +1,34 @@
|
|||||||
Report =
|
Report =
|
||||||
init: ->
|
init: ->
|
||||||
return unless Conf['Archive Report'] and /\bmode=report\b/.test(location.search)
|
return unless /\bmode=report\b/.test(location.search) and match = location.search.match /\bno=(\d+)/
|
||||||
return unless match = location.search.match /\bno=(\d+)/
|
@postID = +match[1]
|
||||||
postID = +match[1]
|
$.ready @ready
|
||||||
Redirect.init()
|
|
||||||
if @archive = Redirect.to 'report', {boardID: g.BOARD.ID, postID}
|
|
||||||
$.ready @ready
|
|
||||||
|
|
||||||
ready: ->
|
ready: ->
|
||||||
|
new MutationObserver(Report.resize).observe d.body,
|
||||||
|
childList: true
|
||||||
|
attributes: true
|
||||||
|
subtree: true
|
||||||
|
Report.archive() if Conf['Archive Report']
|
||||||
|
|
||||||
|
resize: ->
|
||||||
|
return unless bubble = $ '.gc-bubbleDefault'
|
||||||
|
dy = bubble.getBoundingClientRect().bottom - doc.clientHeight
|
||||||
|
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 (message = $ 'h3') and /Report submitted!/.test(message.textContent)
|
||||||
$.globalEval 'self.close = function(){};'
|
$.globalEval 'self.close = function(){};'
|
||||||
location.replace Report.archive
|
window.resizeTo 685, 320
|
||||||
|
location.replace url
|
||||||
return
|
return
|
||||||
link = $.el 'a',
|
link = $.el 'a',
|
||||||
href: Report.archive
|
href: url
|
||||||
textContent: 'Report to fgts'
|
textContent: 'Report to fgts'
|
||||||
|
$.on link, 'click', (e) ->
|
||||||
|
unless e.shiftKey or e.altKey or e.ctrlKey or e.metaKey or e.button isnt 0
|
||||||
|
window.resizeTo 685, 320
|
||||||
$.add d.body, [$.tn(' ['), link, $.tn(']')]
|
$.add d.body, [$.tn(' ['), link, $.tn(']')]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user