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