bookmarklet
by
kmdsbng
2011-10-24 [2011/10/24 23:54:09]
http://d.hatena.ne.jp/ishikawam/touch/20111024/p1のリンクをフォローボタンに置換する
-
/*
* @title bookmarklet
* @description http://d.hatena.ne.jp/ishikawam/touch/20111024/p1のリンクをフォローボタンに置換する
* @include http://d.hatena.ne.jp/ishikawam/touch/20111024/p1
* @license MIT License
* @require
*/
var s=document.createElement('script');s.setAttribute('src', 'http://code.jquery.com/jquery-latest.pack.js');s.setAttribute('onload','modifyButton()');document.getElementsByTagName('body')[0].appendChild(s);
var modifyButton = function () {
window.as = jQuery('a[href*="http://twitter.com/"]');
modifyButtonPart();
}
var modifyButtonPart = function () {
if (window.as.length == 0)
return;
var part = window.as.splice(0, 10);
jQuery.each(part, function () {
var e = this;
var img = jQuery('img', e).css('width', 30).css('height', 30);
jQuery(e).after('<br>').addClass("twitter-follow-button").attr('data-show-count', 'false').attr('data-lang', 'ja');
jQuery(e).before(img);
});
jQuery('body').append(jQuery('<script src="//platform.twitter.com/widgets.js" type="text/javascript"></script>'));
setTimeout(modifyButtonPart, 3000);
}
-
- Permalink
- このページへの個別リンクです。
- RAW
- 書かれたコードへの直接のリンクです。
- Packed
- 文字列が圧縮された書かれたコードへのリンクです。
- Userscript
- Greasemonkey 等で利用する場合の .user.js へのリンクです。
- Loader
- @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
- Metadata
- コード中にコメントで @xxx と書かれたメタデータの JSON です。