Unlimited Paginator Works

By Mango Last update Apr 14, 2012 — Installed 15,206 times.

PageBreak-less mode broken everywhere the latest release, and Chrome still doesn't work at all

in
Subscribe to PageBreak-less mode broken everywhere the latest release, and Chrome still doesn't work at all 8 posts, 2 voices



habanero User
Firefox

Hi,

The latest release seems to have broken pageBreak-less mode on all browsers. When I scroll to the bottom with pageBreak = false set, nothing happens.

Also, it still doesn't quite work on Chrome. When I scroll to the bottom it loads the next page as it should, but when I scroll to the next bottom it stops, you only get the first two pages. Please consider looking into this issue. This script is the only thing keeping me on Firefox!

 
Mango Script's Author
Firefox

The 4/30 update fixes the pageBreak=false issue.

As for Chrome, I don't feel like installing it just for testing right now. Try adding alert(nextPage); on the line after nextPage = getNextPage(sourcePaginator); and see what happens on that browser. If you turn on pageBreak, do you get a paginator and/or line break after the second page?

 
habanero User
Firefox

Thanks for fixing pageBreak = false so quick!

Hm, on closer inspection, Chrome doesn't load the second page, it just loads the first page twice. I get an alert with a "page=3" url when I scroll to the bottom of the first page, and then it loads the first page again. Scrolling to the bottom again yields no alert. The paginator and line break are present at the bottom of both copies of the page. The first copy just has "Next >>" and the second copy has "<< Previous Next >>".

 
habanero User
Firefox

Fixed it!

Disclaimer: I have almost zero javascript experience; I fixed it though a ton of Googling and sheer determination.

I don't know why I was seeing the first page load twice; it seems that doesn’t happen anymore. But it was still only loading two pages.

There were two problems: First, fullPage.offsetHeight (used in testScrollPosition) returns an incorrect value on Chrome, god knows why. I replaced that with document.documentElement.scrollHeight and it returns the correct value on both Firefox and Chrome. Again, that's only from trying different values and finding one that worked; I don't know if there are reasons not to use that.

Second problem: The block commented "Register content" in appendNewContent throws on Chrome, I assume because of the unsafeWindow wackiness. Which means, the pending = false right below it never gets executed, which explains everything. I don't know what this block does, but Chrome seems to get by fine without it. Stick a try/catch block around Register Content, and all is well.

With these two changes, it seems to work perfectly on Chrome.

 
Mango Script's Author
Firefox

First, fullPage.offsetHeight (used in testScrollPosition) returns an incorrect value on Chrome, god knows why. I replaced that with document.documentElement.scrollHeight and it returns the correct value on both Firefox and Chrome. Again, that's only from trying different values and finding one that worked; I don't know if there are reasons not to use that.
I've been using this page as a reference, and it claims offsetHeight works on all browsers (which is why I picked it). It also says that scrollHeight doesn't work on Opera. Hmm, what to do... What are the incorrect values you were getting on Chrome? Does document.documentElement.offsetHeight get you the right values?

Second problem: The block commented "Register content" in appendNewContent throws on Chrome, I assume because of the unsafeWindow wackiness.
Huh, I was under the impression that Chrome didn't have unsafeWindow and so wouldn't execute that block due to a previous "typeof unsafeWindow" check. What do you get in Chrome when you put alert(typeof unsafeWindow) at the top of the script?

I don't know what this block does, but Chrome seems to get by fine without it.
It un-breaks certain minor JavaScript features provided by certain sites like Danbooru.

Thanks for the info.

 
habanero User
Chrome

Here are the values of fullPage.offsetHeight, db.scrollHeight, db.offsetHeight, db.clientHeight, de.scrollHeight, de.offsetHeight, de.clientHeight (in order, where db = document.body and de = document.documentElement) on a fullscreened Chrome after loading Danbooru's post page, and again after page 2 has been appended:
135, 925, 135, 135, 701, 135, 925
135, 1234, 135, 135, 1234, 135, 925

And on Firefox:
876, 136, 136, 136, 876, 876, 830
1416, 136, 136, 136, 1416, 1416, 830

As you can see, document.documentElement.scrollHeight is the only one that works on both. Perhaps you could use math.Max with fullPage.offsetHeight to support Opera as well?

Also, alert(typeof unsafeWindow) displays object, so I guess it does exist on Chrome.

 
Mango Script's Author
Firefox

As you can see, document.documentElement.scrollHeight is the only one that works on both. Perhaps you could use math.Max with fullPage.offsetHeight to support Opera as well?
That'll have to do for now. The 5/6 update working for you?

 
habanero User
Chrome

Works perfectly. Thanks very much :)
Sayonara Firefox!

Cross
Presentational HTML allowed.
Use <code> for inline code and <pre> for code blocks. Use &lt; and &gt; for literal < and >.
We help break paragraphs and link your links.
or cancel