Advertisement
rg443

feed browser

Aug 21st, 2015
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var position = "", feed_url = "http://rss.orf.at/news.xml", data, result = document.createElement("div");
  2. document.body.innerHTML = "";
  3. document.body.appendChild(result);
  4. result.style.backgroundColor = "white";
  5. result.style.color = "black";
  6. result.style.padding = "10px";
  7. result.style.width = "660px";
  8. result.style.textAlign = "justify";
  9. result.style.overflowY = "visibile";
  10. var next = document.createElement("a");
  11. next.href = "#";
  12. next.innerHTML = "more";
  13. next.style.fontSize = "14pt";
  14. next.style.backgroundColor = "white";
  15. document.body.appendChild(next);
  16. next.onclick = function() {
  17.   var a = new XMLHttpRequest;
  18.   result.innerHTML = "updating... ";
  19.   a.open("GET", "/jabry/q/dapi.asp?count=50&feed_url=" + encodeURIComponent(feed_url) + "&position=" + position, !0);
  20.   a.onload = function() {
  21.     result.innerHTML = "";
  22.     data = JSON.parse(a.responseText);
  23.     for (var c = 0, d = [], b;c < data.data.feed.length;c++) {
  24.       b = data.data.feed[c], d.push('<h3><a href="' + b.content.url + '" target="_blank" rel="noreferrer">' + b.content.title + '</a></h3><div style="min-height:180px;overflow:visible;">' + (b.content.media.images.length ? '<img src="' + b.content.media.images[0].url.replace(/^https*:\/\//,'http://i'+(c%3)+'.wp.com/')+'?w=240' + '" style="float:left;max-width:240px;max-height:180px;margin-right:10px;">' : "") + (b.content.body||b.content.description) + "</div>");
  25.     }
  26.     result.innerHTML = d.join("\n");
  27.     position = data.data.next_position;
  28.     document.title=new Date(data.data.feed[0].date*1000).toString().substring(0,21);
  29.     setTimeout(function(){
  30.        var x = new XMLHttpRequest;
  31.        x.open("GET", "/jabry/q/dapi.asp?count=50&feed_url=" + encodeURIComponent(feed_url) + "&position=" + position, !0);
  32.        x.send();
  33.        },1000);
  34.   };
  35.   a.send();
  36.   return !1;
  37. };
  38. setTimeout(next.click(), 50);
  39. document.onkeypress = function(a) {
  40.   106 == a.keyCode && next.click();
  41. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement