Skip to content

Instantly share code, notes, and snippets.

@jugyo
Created March 16, 2009 09:20
Show Gist options
  • Save jugyo/79805 to your computer and use it in GitHub Desktop.
Save jugyo/79805 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name termtter_user_checker
// @namespace http://jugyo.org/
// @include http://tweetrush.com/byclientdata/gettotdaytopclientusers/1303/*
// @description Let's visit http://tweetrush.com/byclientdata/gettotdaytopclientusers/1303/395
// ==/UserScript==
(function() {
/* source: http://www.hoge256.net/2007/08/64.html */
function computeDate(year, month, day, addDays) {
var dt = new Date(year, month - 1, day);
var baseSec = dt.getTime();
var addSec = addDays * 86400000;//日数 * 1日のミリ秒数
var targetSec = baseSec + addSec;
dt.setTime(targetSec);
return dt;
}
var elems = document.getElementsByTagName('a');
for (var i = 0; i < elems.length; i++) {
var elem = elems[i];
elem.href = elem.href.replace('tweetrush', 'twitter');
}
var num = self.location.href.match(/\d+$/);
var next = self.location.href.replace(num, (parseInt(num) + 1).toString());
var prev = self.location.href.replace(num, (parseInt(num) - 1).toString());
var date = computeDate(2009, 3, 16, parseInt(num) - 464)
var date_text = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate();
document.body.innerHTML = '<div style="color: gray; border-bottom: 1px silver solid;">' +
'<a href="' + prev + '">prev</a>' +
' | <a href="' + next + '">next</a> (' + date_text + ')' +
'</div>' + document.body.innerHTML;
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment