Devi modificare la setText, in particolare l'assegnazione del valore alla variabile cursor.
Codice PHP:
function setText(index) {
if (index == null || index < 1) {
index = cursor;
}
$('#text').html(text[index]);
$('#footnote').html('[url="' + footnotes[index] + '"]' + footnotes[index] + '[/url]');
$('#index').html('#' + index);
$('#quip').text( quips[Math.floor(Math.random()*quips.length)] );
/*
//CAMBIA SOLO QUESTO
if(cursor >= text.length -1){
cursor = 1;
}
else{
cursor++;
}
*/
//...ECCO COME CAMBIA
cursor = Math.floor(Math.random() * (text.length)) + 1;
}