というわけで、作ってみたグリモン

Mac用の通知ソフトGrowl風にtwitterのtimelineを表示するだけのグリモン。
どのページを開いていても動作するようになっているので、複数のタブを開いている場合、
CPUが大変熱くなるかもしれませんなw
一応、iframeでは動かないようにチェックを入れた。
めんどくさくて手抜きなところもいくつか、、、(^^;

あ、それから、since_idで取ってくるデータを制限したいのに、
制限できていない状況っす。中のぬこさんたちに大変迷惑だと思うので、
これ、あまり使わない方が良いでしょうな。

// ==UserScript==
// @name            twitter_greasemonkey2
// @namespace       http://fn7.s194.xrea.com/
// @description       none description
// @include         http://twitter.com/home
// ==/UserScript==



(function(){
	if(unsafeWindow.flameElement){
		return;
	}
  var fadeout = function(elem){
    return function(){
      (function(){
        elem.style.opacity -= 0.2;
        if(elem.style.opacity < 0){
          elem.parentNode.removeChild(elem);
        }else{
					setTimeout(arguments.callee,100)
				}
      })()
    }
  }
  var originalNode = document.createElement('div');
  var imgNode = document.createElement('img');
  var messageNode = document.createElement('span');
  {
    with(originalNode.style){
      display = 'none'
      background = 'transparent url("http://fn7.s194.xrea.com/growl.png") no-repeat';
      width = '190px';
      height = '65px';
      color = '#444';
      padding = '6px 0px 0px 20px';
      opacity = 1;
      fontSize = '9px';
    }
    imgNode.width = '30';
    imgNode.height = '30';
		with(imgNode.style){
			width = '30px';
			height = '30px';
			cssFloat = 'left';
		}
    originalNode.appendChild(imgNode);
    originalNode.appendChild(messageNode);
  }
  var baseNode = document.createElement('div');
  {
    document.body.appendChild(baseNode);
    with(baseNode.style){
      position = 'fixed';
      top = '0px';
      right = '0px';
      zIndex = 1000;
    }
    baseNode.appendChild(originalNode);
  }
  var notify = function(img_url,txt,time){
    var newNode = originalNode.cloneNode(true);
    baseNode.insertBefore(newNode,baseNode.childNodes[0]);
    newNode.childNodes[0].src = img_url;
    newNode.childNodes[1].appendChild(document.createTextNode(txt));
		newNode.childNodes[1].appendChild(document.createElement('br'));
		newNode.childNodes[1].appendChild(document.createTextNode(time));
    newNode.style.display = 'block';
    setTimeout(fadeout(newNode),2000);
  }

  var get_url = function(base_url,key){
		var param = GM_getValue(key);
		if(param){
			param = ['?',key,'=',param].join('');
		}else{
			param = ''
		}
		return base_url+param;
  }
	var public_timeline = get_url('http://twitter.com/statuses/public_timeline.json','since_id');
	var friends_timeline = get_url('http://twitter.com/statuses/friends_timeline.json','since');
  (function(){
    GM_xmlhttpRequest({
      method : 'GET',
    	url : public_timeline,
    	headers: {
    		'Content-Type':'application/x-www-form-urlencoded',
    		'X-Twitter-Client': 'TwitterGM',
    		'X-Twitter-Client-Version': '0.0.1'
    	},
    	onload: function(res){
				var d = [];
				if(res.responseText.length > 2){
					eval('d='+res.responseText);	
				}
				if(d.length < 1){return}
				var since_id = (GM_getValue('since_id') || 0);
        GM_setValue('since',d[0].created_at);
        GM_setValue('since_id',d[0].id);

        (function(){
          var t = d.pop();
          if(t && (since_id < t.id)){
            notify(t.user.profile_image_url,t.text.slice(0,100),new Date(t.created_at).toLocaleString());

          }
    	  	setTimeout(arguments.callee,100);

    	 	})();
    	}
    });
		setTimeout(arguments.callee,5*1000);
  })();
})()