diff --git a/CHANGELOG.md b/CHANGELOG.md index 3195ead4c..6e93cc830 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,9 @@ The links to individual versions below are to copies of the script with the upda ### v1.10.9 +**v1.10.9.3** *(2015-04-17)* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.10.9.3/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.10.9.3/builds/4chan-X-noupdate.crx "Chromium version")] +- Resize report window as needed instead of opening it huge at beginning. + **v1.10.9.2** *(2015-04-16)* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.10.9.2/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.10.9.2/builds/4chan-X-noupdate.crx "Chromium version")] - (aCarbon) Normal report size box if pass is logged in. - Clean up leftover Recaptcha iframes to prevent memory leak. diff --git a/builds/4chan-X-beta.crx b/builds/4chan-X-beta.crx index bc36889c8..cbb32bab0 100644 Binary files a/builds/4chan-X-beta.crx and b/builds/4chan-X-beta.crx differ diff --git a/builds/4chan-X-beta.meta.js b/builds/4chan-X-beta.meta.js index 073ce5aff..c57d3c1c9 100644 --- a/builds/4chan-X-beta.meta.js +++ b/builds/4chan-X-beta.meta.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 4chan X beta -// @version 1.10.9.2 +// @version 1.10.9.3 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X diff --git a/builds/4chan-X-beta.user.js b/builds/4chan-X-beta.user.js index 0bfa26221..4bcc12154 100644 --- a/builds/4chan-X-beta.user.js +++ b/builds/4chan-X-beta.user.js @@ -1,7 +1,7 @@ // Generated by CoffeeScript // ==UserScript== // @name 4chan X beta -// @version 1.10.9.2 +// @version 1.10.9.3 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -397,7 +397,7 @@ doc = d.documentElement; g = { - VERSION: '1.10.9.2', + VERSION: '1.10.9.3', NAMESPACE: '4chan X.', boards: {} }; @@ -11698,11 +11698,10 @@ }); }, report: function() { - var height, id, set, url; + var id, set, url; url = ReportLink.url; id = Date.now(); - height = d.cookie.indexOf('pass_enabled=1') >= 0 ? 200 : 675; - set = "toolbar=0,scrollbars=1,location=0,status=1,menubar=0,resizable=1,width=685,height=" + height; + set = "toolbar=0,scrollbars=1,location=0,status=1,menubar=0,resizable=1,width=685,height=200"; return window.open(url, id, set); } }; @@ -15228,33 +15227,57 @@ Report = { init: function() { - var match, postID; - if (!(Conf['Archive Report'] && /\bmode=report\b/.test(location.search))) { + var match; + if (!(/\bmode=report\b/.test(location.search) && (match = location.search.match(/\bno=(\d+)/)))) { return; } - if (!(match = location.search.match(/\bno=(\d+)/))) { - return; - } - postID = +match[1]; - Redirect.init(); - if (this.archive = Redirect.to('report', { - boardID: g.BOARD.ID, - postID: postID - })) { - return $.ready(this.ready); - } + this.postID = +match[1]; + return $.ready(this.ready); }, ready: function() { - var link, message; + new MutationObserver(Report.resize).observe(d.body, { + childList: true, + attributes: true, + subtree: true + }); + if (Conf['Archive Report']) { + return Report.archive(); + } + }, + resize: function() { + var bubble, dy; + if (!(bubble = $('.gc-bubbleDefault'))) { + return; + } + dy = bubble.getBoundingClientRect().bottom - doc.clientHeight; + if (dy > 0) { + return window.resizeBy(0, dy); + } + }, + archive: function() { + var link, message, url; + Redirect.init(); + if (!(url = Redirect.to('report', { + boardID: g.BOARD.ID, + postID: Report.postID + }))) { + return; + } if ((message = $('h3')) && /Report submitted!/.test(message.textContent)) { $.globalEval('self.close = function(){};'); - location.replace(Report.archive); + window.resizeTo(685, 320); + location.replace(url); return; } link = $.el('a', { - href: Report.archive, + href: url, textContent: 'Report to fgts' }); + $.on(link, 'click', function(e) { + if (!(e.shiftKey || e.altKey || e.ctrlKey || e.metaKey || e.button !== 0)) { + return window.resizeTo(685, 320); + } + }); return $.add(d.body, [$.tn(' ['), link, $.tn(']')]); } }; diff --git a/builds/4chan-X-noupdate.crx b/builds/4chan-X-noupdate.crx index 3fe49c1f8..d6f1e573a 100644 Binary files a/builds/4chan-X-noupdate.crx and b/builds/4chan-X-noupdate.crx differ diff --git a/builds/4chan-X-noupdate.user.js b/builds/4chan-X-noupdate.user.js index ce62b6778..41f89ebfc 100644 --- a/builds/4chan-X-noupdate.user.js +++ b/builds/4chan-X-noupdate.user.js @@ -1,7 +1,7 @@ // Generated by CoffeeScript // ==UserScript== // @name 4chan X -// @version 1.10.9.2 +// @version 1.10.9.3 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -396,7 +396,7 @@ doc = d.documentElement; g = { - VERSION: '1.10.9.2', + VERSION: '1.10.9.3', NAMESPACE: '4chan X.', boards: {} }; @@ -11697,11 +11697,10 @@ }); }, report: function() { - var height, id, set, url; + var id, set, url; url = ReportLink.url; id = Date.now(); - height = d.cookie.indexOf('pass_enabled=1') >= 0 ? 200 : 675; - set = "toolbar=0,scrollbars=1,location=0,status=1,menubar=0,resizable=1,width=685,height=" + height; + set = "toolbar=0,scrollbars=1,location=0,status=1,menubar=0,resizable=1,width=685,height=200"; return window.open(url, id, set); } }; @@ -15227,33 +15226,57 @@ Report = { init: function() { - var match, postID; - if (!(Conf['Archive Report'] && /\bmode=report\b/.test(location.search))) { + var match; + if (!(/\bmode=report\b/.test(location.search) && (match = location.search.match(/\bno=(\d+)/)))) { return; } - if (!(match = location.search.match(/\bno=(\d+)/))) { - return; - } - postID = +match[1]; - Redirect.init(); - if (this.archive = Redirect.to('report', { - boardID: g.BOARD.ID, - postID: postID - })) { - return $.ready(this.ready); - } + this.postID = +match[1]; + return $.ready(this.ready); }, ready: function() { - var link, message; + new MutationObserver(Report.resize).observe(d.body, { + childList: true, + attributes: true, + subtree: true + }); + if (Conf['Archive Report']) { + return Report.archive(); + } + }, + resize: function() { + var bubble, dy; + if (!(bubble = $('.gc-bubbleDefault'))) { + return; + } + dy = bubble.getBoundingClientRect().bottom - doc.clientHeight; + if (dy > 0) { + return window.resizeBy(0, dy); + } + }, + archive: function() { + var link, message, url; + Redirect.init(); + if (!(url = Redirect.to('report', { + boardID: g.BOARD.ID, + postID: Report.postID + }))) { + return; + } if ((message = $('h3')) && /Report submitted!/.test(message.textContent)) { $.globalEval('self.close = function(){};'); - location.replace(Report.archive); + window.resizeTo(685, 320); + location.replace(url); return; } link = $.el('a', { - href: Report.archive, + href: url, textContent: 'Report to fgts' }); + $.on(link, 'click', function(e) { + if (!(e.shiftKey || e.altKey || e.ctrlKey || e.metaKey || e.button !== 0)) { + return window.resizeTo(685, 320); + } + }); return $.add(d.body, [$.tn(' ['), link, $.tn(']')]); } }; diff --git a/builds/4chan-X.crx b/builds/4chan-X.crx index ce86d1f85..dd74c2ac5 100644 Binary files a/builds/4chan-X.crx and b/builds/4chan-X.crx differ diff --git a/builds/4chan-X.meta.js b/builds/4chan-X.meta.js index ecc17c997..9186b5ab0 100644 --- a/builds/4chan-X.meta.js +++ b/builds/4chan-X.meta.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 4chan X -// @version 1.10.9.2 +// @version 1.10.9.3 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index f16db7df3..319a20bbf 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -1,7 +1,7 @@ // Generated by CoffeeScript // ==UserScript== // @name 4chan X -// @version 1.10.9.2 +// @version 1.10.9.3 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -397,7 +397,7 @@ doc = d.documentElement; g = { - VERSION: '1.10.9.2', + VERSION: '1.10.9.3', NAMESPACE: '4chan X.', boards: {} }; @@ -11698,11 +11698,10 @@ }); }, report: function() { - var height, id, set, url; + var id, set, url; url = ReportLink.url; id = Date.now(); - height = d.cookie.indexOf('pass_enabled=1') >= 0 ? 200 : 675; - set = "toolbar=0,scrollbars=1,location=0,status=1,menubar=0,resizable=1,width=685,height=" + height; + set = "toolbar=0,scrollbars=1,location=0,status=1,menubar=0,resizable=1,width=685,height=200"; return window.open(url, id, set); } }; @@ -15228,33 +15227,57 @@ Report = { init: function() { - var match, postID; - if (!(Conf['Archive Report'] && /\bmode=report\b/.test(location.search))) { + var match; + if (!(/\bmode=report\b/.test(location.search) && (match = location.search.match(/\bno=(\d+)/)))) { return; } - if (!(match = location.search.match(/\bno=(\d+)/))) { - return; - } - postID = +match[1]; - Redirect.init(); - if (this.archive = Redirect.to('report', { - boardID: g.BOARD.ID, - postID: postID - })) { - return $.ready(this.ready); - } + this.postID = +match[1]; + return $.ready(this.ready); }, ready: function() { - var link, message; + new MutationObserver(Report.resize).observe(d.body, { + childList: true, + attributes: true, + subtree: true + }); + if (Conf['Archive Report']) { + return Report.archive(); + } + }, + resize: function() { + var bubble, dy; + if (!(bubble = $('.gc-bubbleDefault'))) { + return; + } + dy = bubble.getBoundingClientRect().bottom - doc.clientHeight; + if (dy > 0) { + return window.resizeBy(0, dy); + } + }, + archive: function() { + var link, message, url; + Redirect.init(); + if (!(url = Redirect.to('report', { + boardID: g.BOARD.ID, + postID: Report.postID + }))) { + return; + } if ((message = $('h3')) && /Report submitted!/.test(message.textContent)) { $.globalEval('self.close = function(){};'); - location.replace(Report.archive); + window.resizeTo(685, 320); + location.replace(url); return; } link = $.el('a', { - href: Report.archive, + href: url, textContent: 'Report to fgts' }); + $.on(link, 'click', function(e) { + if (!(e.shiftKey || e.altKey || e.ctrlKey || e.metaKey || e.button !== 0)) { + return window.resizeTo(685, 320); + } + }); return $.add(d.body, [$.tn(' ['), link, $.tn(']')]); } }; diff --git a/builds/4chan-X.zip b/builds/4chan-X.zip index 0d5d38b02..f6981fe71 100644 Binary files a/builds/4chan-X.zip and b/builds/4chan-X.zip differ diff --git a/builds/updates-beta.xml b/builds/updates-beta.xml index f99537264..56050f1c2 100644 --- a/builds/updates-beta.xml +++ b/builds/updates-beta.xml @@ -1,7 +1,7 @@ - + diff --git a/builds/updates.xml b/builds/updates.xml index 183097dd5..570ffa423 100644 --- a/builds/updates.xml +++ b/builds/updates.xml @@ -1,7 +1,7 @@ - + diff --git a/package.json b/package.json index a685dcd69..e766ebe2b 100755 --- a/package.json +++ b/package.json @@ -3,8 +3,8 @@ "description": "Cross-browser userscript for maximum lurking on 4chan.", "meta": { "name": "4chan X", - "version": "1.10.9.2", - "date": "2015-04-16T23:44:25.631Z", + "version": "1.10.9.3", + "date": "2015-04-18T03:10:25.048Z", "repo": "https://github.com/ccd0/4chan-x/", "page": "https://github.com/ccd0/4chan-x", "downloads": "https://ccd0.github.io/4chan-x/builds/", diff --git a/src/Menu/ReportLink.coffee b/src/Menu/ReportLink.coffee index 6942ee0ee..23621a317 100755 --- a/src/Menu/ReportLink.coffee +++ b/src/Menu/ReportLink.coffee @@ -20,6 +20,5 @@ ReportLink = report: -> {url} = ReportLink 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=#{height}" + set = "toolbar=0,scrollbars=1,location=0,status=1,menubar=0,resizable=1,width=685,height=200" window.open url, id, set diff --git a/src/Miscellaneous/Report.coffee b/src/Miscellaneous/Report.coffee index 5a3284565..7c76af437 100755 --- a/src/Miscellaneous/Report.coffee +++ b/src/Miscellaneous/Report.coffee @@ -1,18 +1,34 @@ Report = init: -> - return unless Conf['Archive Report'] and /\bmode=report\b/.test(location.search) - return unless match = location.search.match /\bno=(\d+)/ - postID = +match[1] - Redirect.init() - if @archive = Redirect.to 'report', {boardID: g.BOARD.ID, postID} - $.ready @ready + return unless /\bmode=report\b/.test(location.search) and match = location.search.match /\bno=(\d+)/ + @postID = +match[1] + $.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) $.globalEval 'self.close = function(){};' - location.replace Report.archive + window.resizeTo 685, 320 + location.replace url return link = $.el 'a', - href: Report.archive + href: url 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(']')]