またニコニコ動画見てる

ContentLengthがとれなくなったので勝手に直した。

// ==UserScript==
// @name      mata nicovideo
// @namespace http://kgr.s56.xrea.com/userscripts/
// @include   http://www.nicovideo.jp/watch/*
// ==/UserScript==

(function() {
	function $E(tagName) document.createElement(tagName);
	function $$(tagName, context) (context || document).getElementsByTagName(tagName);

	Number.prototype.zerofill = function(len) {
		return ((1 << len).toString(2) + this).slice(-len);
	};

	var h1 = $$('h2', document.body)[0];
	if (!h1) return;
	var span = h1.parentNode.insertBefore($E('span'), h1);

	var a = $E('a');
	a.textContent = '[また見てる]';
	a.href = 'javascript:void(0)';
	a.addEventListener('click', function() {
		this.parentNode.removeChild(this);

		var text = $E('input');
		text.size = '20';
		text.maxLength = 10;

		var a_ = a.cloneNode(false);
		a_.textContent = '[また見てる!]';
		a_.addEventListener('click', function() {
			var len = unsafeWindow.Video.length;
			var lmin = Math.floor(len / 60);
			var lsec = len % 60;
			GM_xmlhttpRequest({
			  method: 'POST',
			  url: 'https://twitter.com/statuses/update.json',
			  headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
			  data: 'status=' + encodeURIComponent([
				  'またニコニコ動画見てる:',
				  h1.textContent,
				  location.href,
				  '(' + lmin.zerofill(2) + ':' + lsec.zerofill(2) + ')',
				  text.value
				  ].join(' ')),
			  onload : function(res) { GM_log('投稿しました。'); },
			  onerror: function(res) { GM_log(res.status + ':' + res.statusText); }
			});
			span.parentNode.removeChild(span);
		}, false);

		span.appendChild(a_);
		span.appendChild(text);
		text.focus();
	}, false);

	span.appendChild(a);
})();
本家
http://muumoo.jp/news/2008/01/28/0matanicovideo.html
派生
g:twitter:id:deflis:20080322