Browsing images back and forth with JavaScript bookmarks (Firefox)

Jumping to the next picture, when the current URL points directly to an image file ending in a digit (an example), can be achieved by <a href="javascript:(function(){ var e,s; IB=1; function isDigit(c) { return (%220%22 <= c && c =0; –e) if (isDigit(L.charAt(e))) { for(s=e-1; s>=0; –s) if (!isDigit(L.charAt(s))) break; break; } ++s; if (e<0) return; oldNum = L.substring(s,e+1); newNum = %22%22 + (parseInt(oldNum,10) + IB); while (newNum.length bookmarking this piece of code I picked up at reddit:

javascript:(function(){ var e,s; IB=1; function isDigit(c) { return (%220%22 <= c && c =0; --e) if (isDigit(L.charAt(e))) { for(s=e-1; s>=0; --s) if (!isDigit(L.charAt(s))) break; break; } ++s; if (e<0) return; oldNum = L.substring(s,e+1); newNum = %22%22 + (parseInt(oldNum,10) + IB); while (newNum.length < oldNum.length) newNum = %220%22 + newNum; location.href = L.substring(0,s) + newNum + L.slice(e+1); })();

Another <a href="javascript:(function(){ var e,s; IB=-1; function isDigit(c) { return (%220%22 <= c && c =0; –e) if (isDigit(L.charAt(e))) { for(s=e-1; s>=0; –s) if (!isDigit(L.charAt(s))) break; break; } ++s; if (e<0) return; oldNum = L.substring(s,e+1); newNum = %22%22 + (parseInt(oldNum,10) + IB); while (newNum.length bookmark for jumping to the previous picture is a simple modification of the above with the variable IB assigned the value -1:

javascript:(function(){ var e,s; IB=-1; function isDigit(c) { return (%220%22 <= c && c =0; --e) if (isDigit(L.charAt(e))) { for(s=e-1; s>=0; --s) if (!isDigit(L.charAt(s))) break; break; } ++s; if (e<0) return; oldNum = L.substring(s,e+1); newNum = %22%22 + (parseInt(oldNum,10) + IB); while (newNum.length < oldNum.length) newNum = %220%22 + newNum; location.href = L.substring(0,s) + newNum + L.slice(e+1); })();