Created
June 7, 2009 16:32
-
-
Save ucnv/125389 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // based on <http://muumoo.jp/news/2007/07/28/0matanicovideo.html> | |
| // | |
| // ==UserScript== | |
| // @name mata PUREkev | |
| // @namespace http://userscripts.org/users/ucnv | |
| // @include http://www.purekev.com/ | |
| // ==/UserScript== | |
| (function(){ | |
| Number.prototype.z = function(len){ | |
| var s = '0'.fill(len) + this.toString(); | |
| return s.substr(s.length - len); | |
| }; | |
| String.prototype.fill = function(len){ | |
| var result = ''; | |
| for(var i = 0; i < len; i++) result += this; | |
| return result; | |
| }; | |
| var h1 = document.getElementsByTagName('center')[0]; | |
| if(!h1) return; | |
| var span = document.createElement('span'); | |
| span.id = 'mata', GM_addStyle('#mata a {color: #fff}'); | |
| h1.parentNode.insertBefore(span, h1); | |
| var a = document.createElement('a'); | |
| a.appendChild(document.createTextNode('[\u307e\u305f\u898b\u3066\u308b]')); | |
| a.href = 'javascript:void(0);'; | |
| a.addEventListener('click', | |
| function(){ | |
| this.parentNode.removeChild(this); | |
| var text = document.createElement('input'); | |
| text.type = 'text'; | |
| text.value = ''; | |
| text.size = 20; | |
| text.setAttribute('maxlength', 10); | |
| var a = document.createElement('a'); | |
| a.appendChild(document.createTextNode('[\u307e\u305f\u898b\u3066\u308b!]')); | |
| a.href = 'javascript:void(0);'; | |
| a.addEventListener('click', | |
| function(){ | |
| var url = location.href; | |
| GM_xmlhttpRequest({ | |
| method: 'POST', | |
| url: 'http://twitter.com/statuses/update.json', | |
| headers: { 'Content-type': 'application/x-www-form-urlencoded' }, | |
| data: 'status=' + encodeURIComponent( | |
| '\u307e\u305f PUREkev \u898b\u3066\u308b : ' + url + | |
| ((0 < text.value.length) ? ' ' + text.value : '') | |
| ), | |
| onload: function(res){ GM_log('\u6295\u7a3f\u3057\u307e\u3057\u305f\u3002'); }, | |
| onerror: function(res){ GM_log(res.status + ':' + res.statusText); } | |
| }); | |
| this.parentNode.parentNode.removeChild(this.parentNode); | |
| }, false); | |
| span.appendChild(a); | |
| span.appendChild(text); | |
| text.focus(); | |
| }, false); | |
| span.appendChild(a); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment