Skip to content

Instantly share code, notes, and snippets.

@tuki0918
Created November 3, 2013 05:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tuki0918/7287228 to your computer and use it in GitHub Desktop.
Save tuki0918/7287228 to your computer and use it in GitHub Desktop.
ブックマークレット:TOPSY ページの自動オフセット切り替え
var countUp = 24;
var field = 'offset';
var re = new RegExp('('+field+'=)(\\d{0,})');
var offset = location.search.match(re);
var num = 0;
var href = location.href;
if (offset) {
num = parseInt(offset[2], 10)+countUp;
href = href.replace(re, "$1"+num);
} else {
href += '&'+field+'='+countUp
}
location.href = href;
@tuki0918
Copy link
Author

tuki0918 commented Nov 3, 2013

javascript:(function(){
var d=document;
var s=d.createElement('script');
s.src='https://gist.github.com/tuki0918/7287228/raw/topsy_pager.js';
d.body.appendChild(s);
})();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment