Skip to content

Commit

Permalink
improvements to autoscroll: (#82)
Browse files Browse the repository at this point in the history
- always autoscroll if at least 2 iframes
- use smooth scrolling during autoscroll check
- facebook: disable site-specific behavior until it is fixed, for now to just use autoscrol
- bump to 0.6.6
  • Loading branch information
ikreymer authored Dec 5, 2024
1 parent 6e9c90b commit 0c90cd0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "browsertrix-behaviors",
"version": "0.6.5",
"version": "0.6.6",
"main": "index.js",
"author": "Webrecorder Software",
"license": "AGPL-3.0-or-later",
Expand Down
7 changes: 6 additions & 1 deletion src/autoscroll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,18 @@ export class AutoScroll extends Behavior {
return false;
}

// if page has iframes, do scroll
if (window.frames.length >= 2) {
return true;
}

const lastScrollHeight = self.document.scrollingElement.scrollHeight;
const numFetching = this.autoFetcher.numFetching;

// scroll to almost end of page
const scrollEnd = (document.scrollingElement.scrollHeight * 0.98) - self.innerHeight;

window.scrollTo({ top: scrollEnd, left: 0, behavior: "auto" });
window.scrollTo({ top: scrollEnd, left: 0, behavior: "smooth" });

// wait for any updates
await sleep(500);
Expand Down
4 changes: 3 additions & 1 deletion src/site/facebook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ export class FacebookTimelineBehavior {
static id = "Facebook";

static isMatch() {
return !!window.location.href.match(/https:\/\/(www\.)?facebook\.com\//);
// disable for now
return false;
//return !!window.location.href.match(/https:\/\/(www\.)?facebook\.com\//);
}

static init() {
Expand Down

0 comments on commit 0c90cd0

Please sign in to comment.