Difference between revisions of "Widget:Feed"
Jump to navigation
Jump to search
(11 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | <script type="text/javascript" src="https://www.google.com/jsapi"></script> | + | <noinclude>__NOTOC__ |
+ | |||
+ | |||
+ | |||
+ | </noinclude><includeonly><script type="text/javascript" src="https://www.google.com/jsapi"></script> | ||
<script type="text/javascript"> | <script type="text/javascript"> | ||
− | google.load("feeds", "1"); | + | |
− | function initialize() { | + | google.load("feeds", "1"); |
− | var feed = new google.feeds.Feed("<!--{$ | + | |
− | feed.load(function(result) { | + | function initialize() { |
− | if (!result.error) { | + | var feed = new google.feeds.Feed("<!--{$url}-->"); |
− | var container = document.getElementById("feed"); | + | feed.load(function(result) { |
− | for (var i = 0; i < result.feed.entries.length; i++) { | + | if (!result.error) { |
− | var entry = result.feed.entries[i]; | + | var container = document.getElementById("feed-{$url|escape:'url'}"); |
− | var div = document.createElement("div"); | + | for (var i = 0; i < result.feed.entries.length; i++) { |
− | div.appendChild(document.createTextNode(entry.title)); | + | var entry = result.feed.entries[i]; |
− | container.appendChild(div); | + | var div = document.createElement("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-{$url|escape:'url'}"></div> |
+ | URL <!--{$url|escape:'url'}--> | ||
+ | </includeonly> |
Latest revision as of 20:11, 12 November 2013