From a683331a9e5317a38a2483b02e1dec996412b00d Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sun, 1 May 2011 17:34:40 +0200 Subject: [PATCH] Fix OP image expanding if there is not reply, fix #53 --- 4chan_x.js | 9 +++++---- script.coffee | 8 ++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/4chan_x.js b/4chan_x.js index 8e42b2b83..85c837c30 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -1999,10 +1999,11 @@ foo: function() { var crap, formWidth, left, table, td; formWidth = $('form[name=delform]').getBoundingClientRect().width; - td = $('td.reply'); - table = td.parentNode.parentNode.parentNode; - left = td.getBoundingClientRect().left - table.getBoundingClientRect().left; - crap = td.getBoundingClientRect().width - parseInt(getComputedStyle(td).width); + if (td = $('td.reply')) { + table = td.parentNode.parentNode.parentNode; + left = td.getBoundingClientRect().left - table.getBoundingClientRect().left; + crap = td.getBoundingClientRect().width - parseInt(getComputedStyle(td).width); + } imgExpand.maxWidthOP = formWidth; imgExpand.maxWidthReply = formWidth - left - crap; imgExpand.maxHeight = d.body.clientHeight; diff --git a/script.coffee b/script.coffee index 7edab72ad..1a2366686 100644 --- a/script.coffee +++ b/script.coffee @@ -1518,10 +1518,10 @@ imgExpand = foo: -> formWidth = $('form[name=delform]').getBoundingClientRect().width - td = $('td.reply') - table = td.parentNode.parentNode.parentNode - left = td.getBoundingClientRect().left - table.getBoundingClientRect().left - crap = td.getBoundingClientRect().width - parseInt(getComputedStyle(td).width) + if td = $('td.reply') + table = td.parentNode.parentNode.parentNode + left = td.getBoundingClientRect().left - table.getBoundingClientRect().left + crap = td.getBoundingClientRect().width - parseInt(getComputedStyle(td).width) imgExpand.maxWidthOP = formWidth imgExpand.maxWidthReply = formWidth - left - crap