Difference between revisions of "Widget:Feed"

From COPTR
Jump to navigation Jump to search
Line 1: Line 1:
 
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
 
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
 
<script type="text/javascript">
 
<script type="text/javascript">
 
+
google.load("feeds", "1");
    google.load("feeds", "1");
+
function initialize() {
 
+
var feed = new google.feeds.Feed("<!--{$id|escape:'url'}-->");
    function initialize() {
+
feed.load(function(result) {
      var feed = new google.feeds.Feed("<!--{$id|escape:'url'}-->");
+
if (!result.error) {
      feed.load(function(result) {
+
var container = document.getElementById("feed");
        if (!result.error) {
+
for (var i = 0; i < result.feed.entries.length; i++) {
          var container = document.getElementById("feed");
+
var entry = result.feed.entries[i];
          for (var i = 0; i < result.feed.entries.length; i++) {
+
var div = document.createElement("div");
            var entry = result.feed.entries[i];
+
div.appendChild(document.createTextNode(entry.title));
            var div = document.createElement("div");
+
container.appendChild(div);
            div.appendChild(document.createTextNode(entry.title));
+
}
            container.appendChild(div);
+
}
          }
+
});
        }
+
}
      });
+
google.setOnLoadCallback(initialize);
    }
 
    google.setOnLoadCallback(initialize);
 
 
 
 
</script>
 
</script>
 
 
<div id="feed"></div>
 
<div id="feed"></div>

Revision as of 19:31, 12 November 2013

<script type="text/javascript" src="https://www.google.com/jsapi"></script> <script type="text/javascript"> google.load("feeds", "1"); function initialize() { var feed = new google.feeds.Feed(""); feed.load(function(result) { if (!result.error) { var container = document.getElementById("feed"); for (var i = 0; i < result.feed.entries.length; i++) { var entry = result.feed.entries[i]; var div = document.createElement("div"); div.appendChild(document.createTextNode(entry.title)); container.appendChild(div); } } }); } google.setOnLoadCallback(initialize); </script>