Flickr Auto Page

By Mortimer Last update Nov 30, 2008 — Installed 30,911 times.

Fix for jumbled page numbers

in
Subscribe to Fix for jumbled page numbers 1 post, 1 voice

tubedogg Scriptwright
MozillaMacintosh

The script has a small bug in the pagination feature. When enabled, the script generates a page listing on the left-hand side of the screen, including up to 3 pages before and 3 pages after the current page. Once you scroll past the fourth page (current page plus three more), it has to add links to the additional pages you are now viewing. This is fine, except due to a small bug it puts the page number at the top instead of underneath the previous page number.

In other words, when you start viewing pages the page links on the left-hand side might look like this:

1
2
...
10
11
12
13 <-->
14
15
16
...
25
26

Once you scroll past page 16, instead of putting the link to page 17 below the link to page 16, it places it below the link to page 2, creating this:

1
2
17
...
10
11
12
13
14
15
16
...
25
26

It then places page 18 under 17, but by this time it's all out of whack.

There is a quick fix to the script. First, find this line:

							link = $x1("//div[@id='Pages']//div[@class='Paginator']//span[text()='...']");

Replace it with this:
							link = $x1("//div[@id='Pages']//div[@class='Paginator']//span[@id='break2']");

Then find this:
							link = $x1("//div[@class='Paginator']//span[text()='...']");

And replace with this:
							link = $x1("//div[@class='Paginator']//span[@id='break2']");

Find this:

				for(i=0;i<this.paginator.childNodes.length;i++) {

Right *above* it, add this:
				j=0;

Lastly, find this:

						item.style.margin='0';

Right *below* it, add the following:
						if (item.innerHTML == '...') {
							j++;
							item.setAttribute('id', 'break' + j);
						}

This will resolve the issue.

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