I've got a Greasemonkey script (written by another coder - Brock Adams) that loads sequentially the pages contained in the array at the beginning of the code. How to open a list of pages automatically and sequentially?
// ==UserScript==
// @name Multipage, MultiSite slideshow of sorts
// @include http://google.com/*
// @include http://site2/*
// @include http://site3/*
// @include http://site4/*
// @grant GM_addStyle
// ==/UserScript==
/*- The @grant directive is needed to work around a major design
change introduced in GM 1.0.
It restores the sandbox.
*/
var urlsToLoad = [
'http://google.com/'
, 'http://site2/somepage/'
, 'http://site3/somepage/'
, 'http://site4/somepage/'
];
/*--- Since many of these sites load large pictures, Chrome's and
Firefox's injection may fire a good deal before the image(s)
finish loading.
So, insure script fires after load:
*/
window.addEventListener ("load", FireTimer, false);
if (document.readyState == "complete") {
FireTimer ();
}
//--- Catch new pages loaded by WELL BEHAVED ajax.
window.addEventListener ("hashchange", FireTimer, false);
function FireTimer () {
setTimeout (GotoNextURL, 5000); // 5000 == 5 seconds
}
function GotoNextURL () {
var numUrls = urlsToLoad.length;
var urlIdx = urlsToLoad.indexOf (location.href);
urlIdx++;
if (urlIdx >= numUrls)
urlIdx = 0;
location.href = urlsToLoad[urlIdx];
}
The problem comes when I have 2 pages of the same website to be loaded sequentially: the script stops working because the website uses AJAX in order to have a faster loading of its pages.
How can I force this script to fully reload pages?
As you can see he already tried:
//--- Catch new pages loaded by WELL BEHAVED ajax.
window.addEventListener ("hashchange", FireTimer, false);
to solve this issue, but it doesn't work as expected.
In particular the site that gives me this issue is ink361.com. I've created a jsFiddle of an example of his source: http://jsfiddle.net/XjjfK/
Thanks in advance.