Increment & Decrement URL bookmarklets
Monday, February 21, 2005 9:09:07 PM
Just a quick post to share this little tip. Click & drag these two links to your bookmarks list or to a toolbar:
Edit: Gah! All the javascrippery doesn't mix well with the Opera Journals system (hi Stephen!). So instead you'll need to create two new bookmarks (press 'Ctrl' + 'T') then copy & paste the following snippets of code into the address field, one for each bookmark. The bold text used as titles will also be useful in the name field.
Increment URL
javascript:(function(){ var e,s; IB=1; function isDigit(c) { return ("0" <= c && c <= "9") } L = location.href; LL = L.length; for (e=LL-1; e>=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 = "" + (parseInt(oldNum,10) + IB); while (newNum.length < oldNum.length) newNum = "0" + newNum; location.href = L.substring(0,s) + newNum + L.slice(e+1); })();
Decrement URL
javascript:(function(){ var e,s; IB=-1; function isDigit(c) { return ("0" <= c && c <= "9") } L = location.href; LL = L.length; for (e=LL-1; e>=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 = "" + (parseInt(oldNum,10) + IB); while (newNum.length < oldNum.length) newNum = "0" + newNum; location.href = L.substring(0,s) + newNum + L.slice(e+1); })();
Clicking on each will increment/decrement the last numerical digit in the URL currently located in the address bar.
Ideal for catching up on people's Opera journals if you've missed a few weeks. ;)
Edit: Gah! All the javascrippery doesn't mix well with the Opera Journals system (hi Stephen!). So instead you'll need to create two new bookmarks (press 'Ctrl' + 'T') then copy & paste the following snippets of code into the address field, one for each bookmark. The bold text used as titles will also be useful in the name field.
Increment URL
javascript:(function(){ var e,s; IB=1; function isDigit(c) { return ("0" <= c && c <= "9") } L = location.href; LL = L.length; for (e=LL-1; e>=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 = "" + (parseInt(oldNum,10) + IB); while (newNum.length < oldNum.length) newNum = "0" + newNum; location.href = L.substring(0,s) + newNum + L.slice(e+1); })();
Decrement URL
javascript:(function(){ var e,s; IB=-1; function isDigit(c) { return ("0" <= c && c <= "9") } L = location.href; LL = L.length; for (e=LL-1; e>=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 = "" + (parseInt(oldNum,10) + IB); while (newNum.length < oldNum.length) newNum = "0" + newNum; location.href = L.substring(0,s) + newNum + L.slice(e+1); })();
Clicking on each will increment/decrement the last numerical digit in the URL currently located in the address bar.
Ideal for catching up on people's Opera journals if you've missed a few weeks. ;)

Rijk # Monday, February 21, 2005 9:09:07 PM
bcrogers # Wednesday, May 23, 2007 11:38:36 PM