﻿google.load("feeds", "1"); //Google AJAX Feed APIを読み込む
 
function initialize() {
 
	//
	// 社長日記
	//
    //ブログなどのURL設定
    var feed = new google.feeds.Feed("http://rss.exblog.jp/rss/exblog/earth1/index.xml");
     // 読み込み件数を設定
    feed.setNumEntries(1);
    //ブログ記事の読み込み開始
    feed.load(dispfeed);
 

	//
	// アースダイアリー
	//
    //ブログなどのURL設定
    var feed2 = new google.feeds.Feed("http://rss.exblog.jp/rss/exblog/asucuri/index.xml");
     // 読み込み件数を設定
    feed2.setNumEntries(1);
    //ブログ記事の読み込み開始
    feed2.load(dispfeed2);


    function dispfeed(result){
 
        //HTML内のdiv#feedを取得
        var container = document.getElementById("feedList");
 
        //出力内容を空っぽに初期化
        var htmlstr = "";
 
        //記事の数分(最大：読み込み件数分)だけ取得を繰り返す
        for (var i = 0; i < result.feed.entries.length; i++) {
 
            //記事1個取得
            var entry = result.feed.entries[i];
 
 			// 日付
			var pdate = new Date(entry.publishedDate);
			var pday = pdate.getDate();
			var pmonth = pdate.getMonth() + 1;
			var pyear = pdate.getFullYear();
 
            //出力内容に日付けを入れる
            //htmlstr += '<p style="font-size:12px;">' + entry.publishedDate + '</p>';
			htmlstr += '<p style="font-size:12px;">' + pyear + '年' + pmonth + '月' + pday + '日</p>';

            //出力内容にタイトルを入れる
            htmlstr += '<p style="font-size:12px;"><a href="' + entry.link + '">' + entry.title + '</a></hp>';
 
 
        }
 
        //HTML（div#feedList内）に出力する
        container.innerHTML = htmlstr;
 
    }// end function

    function dispfeed2(result){
 
        //HTML内のdiv#feedを取得
        var container = document.getElementById("feedList2");
 
        //出力内容を空っぽに初期化
        var htmlstr = "";
 
        //記事の数分(最大：読み込み件数分)だけ取得を繰り返す
        for (var i = 0; i < result.feed.entries.length; i++) {
 
            //記事1個取得
            var entry = result.feed.entries[i];

 			// 日付
			var pdate = new Date(entry.publishedDate);
			var pday = pdate.getDate();
			var pmonth = pdate.getMonth() + 1;
			var pyear = pdate.getFullYear();
 
            //出力内容に日付けを入れる
            //htmlstr += '<p style="font-size:12px;">' + entry.publishedDate + '</p>';
			htmlstr += '<p style="font-size:12px;">' + pyear + '年' + pmonth + '月' + pday + '日</p>';

            //出力内容にタイトルを入れる
            htmlstr += '<p style="font-size:12px;"><a href="' + entry.link + '">' + entry.title + '</a></hp>';
 
        }
 
        //HTML（div#feedList2内）に出力する
        container.innerHTML = htmlstr;
 
    }// end function

}
 
//HTMLファイルが読み込まれたときに上記のfunction initializeのスクリプトを実行
google.setOnLoadCallback(initialize);

