Skip to content

Commit c8b0792

Browse files
authored
Merge pull request #3 from t-f-m/patch-1
ページ高さの判定を安全寄りに
2 parents fe5b8f4 + 4090781 commit c8b0792

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

AutoPatchWork.safariextension/includes/AutoPatchWork.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,7 @@
676676
append_point.insertBefore(root, insert_point);
677677
var docHeight = documentHeight();
678678
var docs = get_next_elements(htmlDoc);
679+
var elementHeight = pageElementHeight(docs[docs.length - 1]);
679680
var first = docs[0];
680681
if (!first) {
681682
dispatch_event('AutoPatchWork.terminated', {message: 'The next page\'s pageElement was empty.'});
@@ -699,7 +700,7 @@
699700
docs[i] = insert_node;
700701
});
701702
if (status.bottom) status.bottom.style.height = Root.scrollHeight + 'px';
702-
if (docHeight === documentHeight()) {
703+
if (elementHeight === pageElementHeight(docs[docs.length - 1]) && docHeight === documentHeight()) {
703704
return dispatch_event('AutoPatchWork.error', {message: 'missing next page contents'});
704705
}
705706
next = get_next(htmlDoc);
@@ -724,6 +725,10 @@
724725
function documentHeight() {
725726
return Math.max(document.documentElement.scrollHeight, document.body.scrollHeight)
726727
}
728+
729+
function pageElementHeight(element) {
730+
return element.parentNode.scrollHeight;
731+
}
727732

728733
function createXHTML(str) {
729734
return new DOMParser().parseFromString(str, 'application/xhtml+xml');

0 commit comments

Comments
 (0)