From 40907814314f177632211be879249bd765a16f69 Mon Sep 17 00:00:00 2001 From: t-f-m Date: Fri, 19 Sep 2014 09:08:45 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=9A=E3=83=BC=E3=82=B8=E9=AB=98=E3=81=95?= =?UTF-8?q?=E3=81=AE=E5=88=A4=E5=AE=9A=E3=82=92=E5=AE=89=E5=85=A8=E5=AF=84?= =?UTF-8?q?=E3=82=8A=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ページ高さの判定を安全寄りに --- AutoPatchWork.safariextension/includes/AutoPatchWork.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/AutoPatchWork.safariextension/includes/AutoPatchWork.js b/AutoPatchWork.safariextension/includes/AutoPatchWork.js index 5d337f5..612bcc6 100644 --- a/AutoPatchWork.safariextension/includes/AutoPatchWork.js +++ b/AutoPatchWork.safariextension/includes/AutoPatchWork.js @@ -676,6 +676,7 @@ append_point.insertBefore(root, insert_point); var docHeight = documentHeight(); var docs = get_next_elements(htmlDoc); + var elementHeight = pageElementHeight(docs[docs.length - 1]); var first = docs[0]; if (!first) { dispatch_event('AutoPatchWork.terminated', {message: 'The next page\'s pageElement was empty.'}); @@ -699,7 +700,7 @@ docs[i] = insert_node; }); if (status.bottom) status.bottom.style.height = Root.scrollHeight + 'px'; - if (docHeight === documentHeight()) { + if (elementHeight === pageElementHeight(docs[docs.length - 1]) && docHeight === documentHeight()) { return dispatch_event('AutoPatchWork.error', {message: 'missing next page contents'}); } next = get_next(htmlDoc); @@ -724,6 +725,10 @@ function documentHeight() { return Math.max(document.documentElement.scrollHeight, document.body.scrollHeight) } + + function pageElementHeight(element) { + return element.parentNode.scrollHeight; + } function createXHTML(str) { return new DOMParser().parseFromString(str, 'application/xhtml+xml');