google.load("feeds", "1");

function initialize() {
  var mynow = new Date();
  var q = mynow.getMonth(); //月を取得
  var q2 = mynow.getDate(); //日にちを取得
  var q3 = mynow.getHours(); //時間を取得
  var query = q+"0"+q2+"0"+q3; //月日時間
  var feed = new google.feeds.Feed("http://rssadelete.dokoda.jp/d/http/rssblog.ameba.jp/manmanoen/rss20.xml"+"?"+query);
  //var feed = new google.feeds.Feed("http://pipes.yahoo.com/pipes/pipe.run?URL=http%3A%2F%2Frssblog.ameba.jp%2Fmanmanoen%2Frss20.xml&_id=DrFZRK663RGaE1sE1pzWFw&_render=rss");  
feed.setNumEntries(8);
  feed.load(dispfeed);

  function dispfeed(result){
    if (!result.error){
      var container = document.getElementById("feed2");
      var htmlstr = "";

      htmlstr += "<ul>";
      for (var i = 0; i < result.feed.entries.length; i++) {
        var entry = result.feed.entries[i];

        htmlstr += "<li>"
        var strdate = createDateString(entry.publishedDate);
        htmlstr += "<em>" + strdate + "</em><br />";
        htmlstr += '<a href="' + entry.link + '" target="_blank"><strong>' + entry.title + '</strong></a><br />';
		htmlstr += entry.contentSnippet;
        htmlstr += "</li>"
      }
      htmlstr += "</ul>";

       container.innerHTML = htmlstr;
    }else{
       alert(result.error.code + ":" + result.error.message);
    }
  }
}

function createDateString(publishedDate){
  var pdate = new Date(publishedDate);

  var pday = pdate.getDate();
  var pmonth = pdate.getMonth() + 1;
  var pyear = pdate.getFullYear();
  var phour = pdate.getHours();
  var pminute = pdate.getMinutes();
  var psecond = pdate.getSeconds();
  var strdate = pyear + "/" + pmonth + "/" + pday;

  return strdate;
}

google.setOnLoadCallback(initialize);

