Skip to content

Instantly share code, notes, and snippets.

@takimo
Created December 8, 2010 08:41
Show Gist options
  • Save takimo/733043 to your computer and use it in GitHub Desktop.
Save takimo/733043 to your computer and use it in GitHub Desktop.
mixiのイイネをチェックキーだけ取得すればページに埋め込めるんじゃないか
<script>
/* チェックキーをserviceKeyに設定する */
(function(){
var writeFavoriteButton = function(){
var serviceKey = "xxxxxxxxxx";
var url = encodeURIComponent(location.href);
var html = '<iframe scrolling="no" frameborder="0" allowTransparency="true" style="overflow:hidden; border:0; width:450px; height:80px" src="http://plugins.mixi.jp/favorite.pl?href=' + url + '&amp;service_key=' + serviceKey + '&amp;show_faces=true&amp;width=450"></iframe>';
document.write(html);
}
if(document.readyState){
writeFavoriteButton();
}
if(document.addEventListener){
document.addEventListener("DOMContentLoaded", writeFavoriteButton);
}else if(document.attachEvent){
document.attachEvent("onreadystatechange", writeFavoriteButton);
}
})();
</script>
@takimo
Copy link
Author

takimo commented Dec 8, 2010

document.writeはレンダリングを止めちゃうからな。。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment