From 1227cbd847054f12f6559fbd2debd44f9e3c1383 Mon Sep 17 00:00:00 2001 From: Zixaphir Date: Tue, 6 Aug 2013 13:37:24 -0700 Subject: [PATCH] Small simplify --- builds/4chan-X.user.js | 7 +------ builds/crx/script.js | 7 +------ src/Images/ImageExpand.coffee | 8 ++++---- 3 files changed, 6 insertions(+), 16 deletions(-) diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index 970a9ac5a..50efb10d3 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -6292,12 +6292,7 @@ } ImageExpand.contract(post); root = post.nodes.root; - rect = (Conf['Advance on contract'] ? (function() { - var next; - - next = $.x("following::div[contains(@class,'postContainer')][1]", root); - return next || root; - })() : root).getBoundingClientRect(); + rect = (Conf['Advance on contract'] ? $.x("following::div[contains(@class,'postContainer')][1]", root) || root : root).getBoundingClientRect(); if (rect.top < 0) { y = rect.top; if (Conf['Fixed Header'] && !Conf['Bottom Header']) { diff --git a/builds/crx/script.js b/builds/crx/script.js index 0b6aa6596..bcdd59bae 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -6272,12 +6272,7 @@ } ImageExpand.contract(post); root = post.nodes.root; - rect = (Conf['Advance on contract'] ? (function() { - var next; - - next = $.x("following::div[contains(@class,'postContainer')][1]", root); - return next || root; - })() : root).getBoundingClientRect(); + rect = (Conf['Advance on contract'] ? $.x("following::div[contains(@class,'postContainer')][1]", root) || root : root).getBoundingClientRect(); if (rect.top < 0) { y = rect.top; if (Conf['Fixed Header'] && !Conf['Bottom Header']) { diff --git a/src/Images/ImageExpand.coffee b/src/Images/ImageExpand.coffee index 7d6a627b1..25105dd72 100644 --- a/src/Images/ImageExpand.coffee +++ b/src/Images/ImageExpand.coffee @@ -62,11 +62,11 @@ ImageExpand = # Scroll back to the thumbnail when contracting the image # to avoid being left miles away from the relevant post. {root} = post.nodes - rect = (if Conf['Advance on contract'] then do -> - next = $.x "following::div[contains(@class,'postContainer')][1]", root - next or root + rect = (if Conf['Advance on contract'] + $.x("following::div[contains(@class,'postContainer')][1]", root) or root else - root).getBoundingClientRect() + root + ).getBoundingClientRect() if rect.top < 0 y = rect.top