/*
* @title +Subscribe Twitter RSS
* @description Twitter RSS Subscribe to Feed Reader (Forked)
* @contributor m4i http://let.hatelabo.jp/m4i/let/gYC-yZKMjtONHg (Fork of)
* @include http://twitter.com/*
* @include https://twitter.com/*
* @license MIT License http://nrm.mit-license.org/2012
*/
// c.f. http://ptech.g.hatena.ne.jp/noromanba/20121019/1350673927
(function () {
// TODO refactor: smart data-* handling
// http://www.w3.org/TR/html5/global-attributes.html#embedding-custom-non-visible-data-with-the-data-attributes
var id;
if (!(/^https?:\/\/twitter\.com\/\w+/.test(location.href)) ||
!(id = document.querySelector('div[data-user-id]')) ||
!(id = id.dataset.userId)) { // or id.getAttribute('data-user-id')
return;
}
var reader = 'https://www.google.com/reader/view/feed/';
// lifetime: 2013-03-05
var feed = encodeURIComponent('https://api.twitter.com/1/statuses/user_timeline/' + id + '.rss');
location.href = reader + feed;
})();