Skip to content

@mooz /incre-decre-url.js
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
key.setViewKey('>', function (ev, arg) {
let pattern = /(.*?)([0]*)([0-9]+)([^0-9]*)$/;
let url = content.location.href;
let digit = url.match(pattern);
if (digit[1] && digit[3])
{
let len = digit[3].length;
let next = +digit[3] + (arg ? arg : 1);
content.location.href = digit[1] + (digit[2] ||"").slice(next.toString().length - len) + next + (digit[4] ||"");
}
}, 'Increment last digit in the URL');
key.setViewKey('<', function (ev, arg) {
let pattern = /(.*?)([0]*)([0-9]+)([^0-9]*)$/;
let url = content.location.href;
let digit = url.match(pattern);
if (digit[1] && digit[3])
{
let len = digit[3].length;
let next = +digit[3] - (arg ? arg : 1);
content.location.href = digit[1] + (digit[2] ||"").slice(next.toString().length - len) + next + (digit[4] ||"");
}
}, 'Decrement last digit in the URL');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.