Ticket #9356: feed.html

File feed.html, 39.9 KB (added by dsjonny, 11 years ago)

Added refresh function. Added mark read. Some style changes.

Line 
1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2<html xmlns="http://www.w3.org/1999/xhtml">
3<head>
4 <title>Haiku feed viewer</title>
5 <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
6 <meta name="description" content="RSS, ATOM and RDF feed viewer."/>
7 <meta name="HandheldFriendly" content="true"/>
8 <meta name="MobileOptimized" content="480"/>
9 <link rel="shortcut icon" type="image/x-icon" href="http://www.haiku-os.org/sites/haiku-os.org/themes/current/favicon.ico"/>
10 <style type="text/css">
11 body {
12 line-height: 1.5;
13 font-size: 11px;
14 font-family: sans-serif;
15 margin: 0px;
16 padding: 0px;
17 text-align: justify;
18 }
19
20 a:link {
21 color: #dc3c01;
22 font-weight: bold;
23 text-decoration: none;
24 }
25
26 a:visited {
27 color: #892601;
28 font-weight: bold;
29 text-decoration: none;
30 }
31
32 a:hover {
33 color: #ff4500;
34 text-decoration: underline;
35 }
36
37 h2 {
38 color: #0c3762;
39 font-size: 16px;
40 font-weight: normal;
41 border-bottom: solid thin #e0e0e0;
42 padding-left: 5px;
43 }
44
45 h2 a:hover {
46 color: #0c3762;
47 text-decoration: none;
48 }
49
50 #banner {
51 background: #eeeeee right center no-repeat;
52 }
53
54 #banner div {
55 display: block;
56 padding: 5px;
57 font-size: 9px;
58 white-space: pre-line;
59 word-wrap: break-word;
60 }
61
62 #feedtitle {
63 bottom: 10px;
64 padding: 10px 20px;
65 color: #333333;
66 font-size: 16px;
67 text-transform: uppercase;
68 letter-spacing: 3px;
69 word-wrap: break-word;
70 }
71
72 #bannerbar {
73 position: relative;
74 left: 0px;
75 top: 0px;
76 background: #e0e0e0;
77 width: 100%;
78 opacity: 0.8;
79 display: table;
80 }
81
82 #bannerbar span, #bannerbar a {
83 margin: 0px 5px;
84 float: left;
85 cursor: pointer;
86 }
87
88 #bannerbar span:hover {
89 color: #0c3762;
90 text-decoration: underline;
91 }
92
93 #content {
94 max-width: 800px;
95 margin: 0px auto;
96 }
97
98 div {
99 word-wrap: break-word;
100 }
101
102 div.feedbox {
103 background-color: #e4ffde;
104 padding: 5px;
105 margin: 5px;
106 border: thin solid #dcdcdc;
107 }
108
109 div.feedbox span, div.group a {
110 margin-right: 10px;
111 cursor: pointer;
112 display: inline-block;
113 }
114
115 div.group span {
116 margin-right: 10px;
117 }
118
119 div.group {
120 padding: 5px;
121 padding-left: 20px;
122 font-size: 10px;
123 }
124
125 div.groupmark {
126 color: #0c3762;
127 font-weight: bold;
128 text-decoration: none;
129 text-align: right;
130 font-size: 9px;
131 cursor: pointer;
132 padding: 5px;
133 }
134
135 div.groupmark span {
136 margin-left: 10px;
137 }
138
139 span.itemlink:hover, div.feedbox span:hover {
140 color: #0c3762;
141 text-decoration: underline;
142 cursor: pointer;
143 }
144
145 p.description {
146 padding: 5px;
147 border: thin dotted #dcdcdc;
148 overflow: auto;
149 margin: 5px;
150 }
151
152 #page {
153 padding: 5px;
154 }
155
156 #page > div {
157 padding: 5px;
158 vertical-align: top;
159 margin: 5px;
160 }
161
162 #page > div:hover {
163 background-color: #f0fff0;
164 }
165
166 fieldset {
167 border: none;
168 }
169
170 legend {
171 font-weight: bold;
172 }
173
174 pre {
175 font: monospace;
176 border: thin solid #b0b0b0;
177 border-left: 5px solid #b0b0b0;
178 padding: 5px;
179 white-space: pre-line;
180 }
181
182 #pagesource {
183 border: thin solid #e0e0e0;
184 margin: 5px;
185 padding: 9px;
186 background-color: #f0f0f0;
187 white-space: pre-line;
188 word-wrap: break-word;
189 }
190
191 div.nodeText {
192 font-weight: bold;
193 cursor: pointer;
194 }
195
196 div.nodeValue {
197 color: #0c3762;
198 font-weight: normal;
199 background-color: #e0e0e0;
200 border-left: 2px solid #8a8a8a;
201 padding-left: 5px;
202 padding-right: 5px;
203 overflow: auto;
204 }
205
206 [type=div] {
207 border: thin solid #bababa;
208 background-color: #fafafa;
209 padding: 5px;
210 }
211
212 [type=root] {
213 margin: 0px;
214 padding-left: 0px;
215 }
216
217 [type=item], [type=entry] {
218 color: #ffffff;
219 border: thin solid #8a8a8a;
220 background-color: #0c3762;
221 margin-top: 5px;
222 padding-left: 5px;
223 }
224
225 span.sign {
226 position: absolute;
227 width: 0px;
228 height: 0px;
229 margin-left: -15px;
230 margin-top: 5px;
231 border-width: 4px;
232 border-style: inset;
233 border-color: transparent transparent transparent #0c3762;
234 visibility: hidden;
235 }
236
237 ul p {
238 font-weight: bold;
239 }
240
241 li {
242 margin-left: 15px;
243 line-height: 2.0;
244 }
245 </style>
246 <script type="text/javascript">
247 <!--
248 var language = window.navigator.userLanguage || window.navigator.language;
249 var feedlanguage = "";
250 var feed = "";
251 var interval;
252 var i = 0;
253 var imax = (15 * 60);
254 var lastread = new Date();
255 lastread.setFullYear(2000,01,1);
256 var news = 0;
257
258 feed = document.location.search.substring(5);
259
260 function setCookie(c_name, value, exdays) {
261 if (value == "false") exdays = null;
262 var exdate = new Date();
263 exdate.setDate(exdate.getDate() + exdays);
264 var c_value = escape(value) + ((exdays == null) ? "" : "; expires=" + exdate.toUTCString());
265 document.cookie = c_name + "=" + c_value;
266 }
267
268 function getCookie(c_name) {
269 var c_value = document.cookie;
270 var c_start = c_value.indexOf(" " + c_name + "=");
271 if (c_start == -1) c_start = c_value.indexOf(c_name + "=");
272 if (c_start == -1) c_value = null;
273 else {
274 c_start = c_value.indexOf("=", c_start) + 1;
275 var c_end = c_value.indexOf(";", c_start);
276 if (c_end == -1) c_end = c_value.length;
277 c_value = unescape(c_value.substring(c_start,c_end));
278 }
279 return (c_value == "false") ? "" : c_value;
280 }
281
282 function ShowHide(e) {
283 var o;
284 o = (e.nodeType > 0) ? o = e : document.getElementById(e);
285 if (o) o.style.display = (o.style.display != "block") ? "block" : "none";
286 }
287
288 function treeIt(t, e) {
289 if (t.hasChildNodes()) {
290 if (t.parentNode != t.ownerDocument) {
291 var u = document.createElement("ul");
292 var n = document.createElement("div");
293 var d = document.createElement("div");
294 n.innerHTML = "<span class='sign'></span><span>" + t.tagName + "</span>";
295 n.className = "nodeText";
296 n.setAttribute("type", t.tagName);
297 n.setAttribute("onclick", "ShowHide(this.nextSibling); this.firstChild.style.visibility = (this.nextSibling.style.display == 'none') ? 'visible' : 'hidden';");
298 d.style.display = "block";
299 if ((t.tagName == "item") || (t.tagName == "entry")) d.setAttribute("type", "div");
300 if (e == document.getElementById("pagesource")) u.setAttribute("type", "root");
301 u.appendChild(n);
302 u.appendChild(d);
303 e.appendChild(u);
304 }
305 for (var n = 0; n < t.childNodes.length; n++) {
306 if (t.parentNode == t.ownerDocument) treeIt(t.childNodes[n], e);
307 else treeIt(t.childNodes[n], d);
308 }
309 }
310 else {
311 if (t.nodeValue) {
312 if (t.nodeValue.trim() == "") return;
313 var d = document.createElement("div");
314 d.className = "nodeValue";
315 d.innerHTML = t.nodeValue;
316 e.appendChild(d);
317 }
318 }
319 if (document.getElementById("pagesource").childNodes.length > 0) document.getElementById("feedtree").style.display = "inline";
320 }
321
322 var xmlhttp = new XMLHttpRequest();
323
324 function FeedIt() {
325 i = 0;
326 news = 0;
327
328 document.getElementById("feedstatus").style.width = "0px";
329 document.getElementById("feedtitle").innerHTML = "";
330 document.getElementById("feeddescription").innerHTML = "";
331 document.getElementById("banner").style.backgroundImage = "";
332 document.getElementById("feedinfos").innerHTML = "";
333 document.getElementById("pagesource").innerHTML = "";
334 document.getElementById("feedinfo").style.display = "none";
335 document.getElementById("feedpublisher").style.display = "none";
336 document.getElementById("feedcategory").style.display = "none";
337 document.getElementById("feedtags").style.display = "none";
338 document.getElementById("feedtree").style.display = "none";
339 document.getElementById("feedfilter").style.display = "none";
340
341 if (feed.indexOf("http") != 0) feed = "http://" + feed;
342
343 document.getElementById("page").innerHTML = "";
344
345 xmlhttp.open("GET", feed, true);
346 document.getElementById("feedtitle").innerHTML = "Downloading...";
347 try {
348 xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
349 xmlhttp.onreadystatechange = xmlReady;
350 xmlhttp.send();
351 }
352 catch(err) {
353 document.getElementById("feedtitle").innerHTML = "FeedIt: " + err;
354 document.getElementById("feedtitle").style.color = "#ff0000";
355 }
356 }
357
358 var feedsource = "";
359 function xmlReady(e) {
360 switch (xmlhttp.readyState) {
361 case 0:
362 document.getElementById("feedstatus").style.width = "20%";
363 break;
364 case 1:
365 document.getElementById("feedstatus").style.width = "40%";
366 break;
367 case 2:
368 document.getElementById("feedstatus").style.width = "60%";
369 if (xmlhttp.status == 404) {
370 document.getElementById("feedtitle").innerHTML = "The feed not found!";
371 document.getElementById("feedtitle").style.color = "#ff0000";
372 document.getElementById("feedstatus").style.width = "0px";
373 }
374 break;
375 case 3:
376 document.getElementById("feedstatus").style.width = "80%";
377 break;
378 case 4:
379 document.getElementById("feedstatus").style.width = "100%";
380 if (xmlhttp.status == 200) {
381 feedsource = xmlhttp.responseText;
382 feedsource = feedsource.replace(/\>\s+/g, ">");
383 var parser = new DOMParser();
384 var x = parser.parseFromString(feedsource, "application/xml");
385 document.getElementById("feedtitle").innerHTML = "Processing...";
386 doFeed(x);
387 treeIt(x.documentElement, document.getElementById("pagesource"));
388 }
389 else if (xmlhttp.status == 404) document.getElementById("feedstatus").style.width = "0px";
390 else if (xmlhttp.status == 500) {
391 document.getElementById("feedtitle").innerHTML = "Remote server error!";
392 document.getElementById("feedtitle").style.color = "#ff0000";
393 document.getElementById("feedstatus").style.width = "0px";
394 }
395 break;
396 }
397 }
398
399 function doFeed(xml) {
400 var xmlDoc = xml;
401
402 document.getElementById("feedtitle").style.display = "block";
403 if (xml == "false") {
404 document.getElementById("feedtitle").innerHTML = "doFeed: Load failed!";
405 document.getElementById("feedstatus").style.width = "0px";
406 return;
407 }
408
409 if (!xmlDoc) {
410 document.getElementById("feedtitle").innerHTML = "doFeed doc: Feed is not available!";
411 document.getElementById("feedtitle").style.color = "#ff0000";
412 document.getElementById("feedstatus").style.width = "0px";
413 return;
414 }
415 else document.getElementById("feedtitle").style.color = "";
416
417 feedlanguage = "";
418
419 var infos = document.getElementById("feedinfos");
420 var items;
421 var type;
422 if (xmlDoc.getElementsByTagName("item").length > 0) {
423 type = (xmlDoc.getElementsByTagName("item")[0].parentNode.nodeName == "channel") ? "RSS (" + xmlDoc.getElementsByTagName("rss")[0].getAttribute("version") + ")" : "RDF (RSS 1.0)";
424 items = xmlDoc.getElementsByTagName("item");
425 }
426 else if (xmlDoc.getElementsByTagName("entry").length > 0) {
427 type = "ATOM";
428 items = xmlDoc.getElementsByTagName("entry");
429 }
430 else {
431 type = "HTML";
432 document.getElementById("feedtitle").innerHTML = xmlDoc.getElementsByTagName("title")[0].firstChild.nodeValue;
433 document.title = xmlDoc.getElementsByTagName("title")[0].firstChild.nodeValue;
434 document.getElementById("feedstatus").style.width = "0px";
435 document.getElementById("feedinfos").style.display = "block";
436 }
437 var infot = document.createElement("li");
438 infot.innerHTML = "<b>Type:</b> " + type;
439 infos.appendChild(infot);
440
441 var rc;
442 if (xmlDoc.getElementsByTagName("channel").length > 0) rc = xmlDoc.getElementsByTagName("channel");
443 else if (xmlDoc.getElementsByTagName("feed").length > 0) rc = xmlDoc.getElementsByTagName("feed");
444 else rc = xmlDoc;
445 if (rc.length == 1) rc = rc[0].childNodes;
446 for (var i = 0; i < rc.length; i++) {
447 switch (rc[i].tagName) {
448 case "title":
449 if (rc[i].firstChild) document.getElementById("feedtitle").innerHTML = rc[i].firstChild.nodeValue;
450 else document.getElementById("feedtitle").innerHTML = "";
451 document.title = document.getElementById("feedtitle").innerHTML;
452 break;
453 case "image":
454 var img = rc[i];
455 if (img.attributes.length > 0) {
456 if (img.attributes.item(0).nodeName.search("rdf:") == 0) document.getElementById("banner").style.backgroundImage = "url('" + img.attributes.item(0).nodeValue + "')";
457 }
458 else if (img.getElementsByTagName("url").length > 0) document.getElementById("banner").style.backgroundImage = "url('" + img.getElementsByTagName("url")[0].firstChild.nodeValue + "')";
459 break;
460 case "link":
461 document.getElementById("feedpublisher").innerHTML = "Publisher";
462 if (rc[i].firstChild) document.getElementById("feedpublisher").href = rc[i].firstChild.nodeValue;
463 else document.getElementById("feedpublisher").href = rc[i].attributes.getNamedItem("href").value;
464 document.getElementById("feedpublisher").style.display = "inline";
465 break;
466 case "description":
467 case "subtitle":
468 if (!rc[i].firstChild) continue;
469 document.getElementById("feeddescription").innerHTML = rc[i].firstChild.nodeValue.replace(/\r\n|\n|\t/g, "");
470 break;
471 case "language":
472 case "dc:language":
473 if (!rc[i].firstChild) continue;
474 var info = document.createElement("li");
475 info.innerHTML = "<b>Language:</b> " + rc[i].firstChild.nodeValue.substring(0, 2).toLowerCase();
476 feedlanguage = rc[i].firstChild.nodeValue.substring(0, 2);
477 infot.appendChild(info);
478 break;
479 case "generator":
480 case "creator":
481 case "dc:creator":
482 if (!rc[i].firstChild) continue;
483 var info = document.createElement("li");
484 info.innerHTML = "<b>Created by:</b> " + rc[i].firstChild.nodeValue;
485 infot.appendChild(info);
486 break;
487 case "dc:publisher":
488 if (!rc[i].firstChild) continue;
489 var info = document.createElement("li");
490 info.innerHTML = "<b>Publisher:</b> " + rc[i].firstChild.nodeValue;
491 infot.appendChild(info);
492 break;
493 case "category":
494 case "subject":
495 case "dc:subject":
496 if (!rc[i].firstChild) continue;
497 var info = document.createElement("li");
498 info.innerHTML = "<b>Category:</b> " + rc[i].firstChild.nodeValue;
499 infot.appendChild(info);
500 break;
501 case "managingEditor":
502 if (!rc[i].firstChild) continue;
503 var info = document.createElement("li");
504 info.innerHTML = "<b>Managing editor:</b> " + rc[i].firstChild.nodeValue;
505 infot.appendChild(info);
506 break;
507 case "webMaster":
508 if (!rc[i].firstChild) continue;
509 var info = document.createElement("li");
510 info.innerHTML = "<b>Web master:</b> " + rc[i].firstChild.nodeValue;
511 infot.appendChild(info);
512 break;
513 case "author":
514 if (!rc[i].firstChild) continue;
515 var info = document.createElement("li");
516 info.innerHTML = "<b>Author:</b> " + rc[i].getElementsByTagName("name")[0].firstChild.nodeValue;
517 infot.appendChild(info);
518 break;
519 case "copyright":
520 case "rights":
521 case "dc:rights":
522 if (!rc[i].firstChild) continue;
523 var info = document.createElement("li");
524 info.innerHTML = "<b>Copyright:</b> " + rc[i].firstChild.nodeValue;
525 infot.appendChild(info);
526 break;
527 case "pubDate":
528 case "date":
529 case "dc:date":
530 var fd = new Date(rc[i].firstChild.nodeValue);
531 if (Object.prototype.toString.call(fd) === "[object Date]") {
532 if (!isNaN(fd.getTime())) {
533 var info = document.createElement("li");
534 info.innerHTML = "<b>Published at:</b> " + fd.toLocaleString();
535 infot.appendChild(info);
536 }
537 }
538 break;
539 case "lastBuildDate":
540 case "update":
541 case "updated":
542 var fd = new Date(rc[i].firstChild.nodeValue);
543 if (Object.prototype.toString.call(fd) === "[object Date]") {
544 if (!isNaN(fd.getTime())) {
545 var info = document.createElement("li");
546 info.innerHTML = "<b>Created at:</b> " + fd.toLocaleString();
547 infot.appendChild(info);
548 }
549 }
550 break;
551 case "geo:lat":
552 var info = document.createElement("li");
553 info.innerHTML = "<b>Latitude:</b> " + rc[i].firstChild.nodeValue;
554 infot.appendChild(info);
555 break;
556 case "geo:long":
557 var info = document.createElement("li");
558 info.innerHTML = "<b>Longitude:</b> " + rc[i].firstChild.nodeValue;
559 infot.appendChild(info);
560 break;
561 default:
562 break;
563 }
564 }
565 document.getElementById("feedinfo").style.display = "inline";
566
567 var div = document.getElementById("page");
568 for (var i = 0; i < items.length; i++) {
569 var d = document.createElement("div");
570 d.style.width = document.getElementById("display").checked ? "375px" : "auto";
571 d.style.display = document.getElementById("display").checked ? "inline-block" : "block";
572
573 var dl = null;
574
575 var t = document.createElement("h2");
576 var ae0;
577 try {
578 if (items[i].getElementsByTagName("link")[0]) {
579 ae0 = document.createElement("a");
580 try {
581 ae0.href = items[i].getElementsByTagName("link")[0].attributes.getNamedItem("href").value;
582 } catch(err) {
583 try {
584 ae0.href = items[i].getElementsByTagName("link")[0].firstChild.nodeValue;
585 } catch(err) {}
586 }
587 ae0.innerHTML = ae0.href;
588 dl = ae0;
589 }
590 else {
591 ae0 = document.createElement("span");
592 }
593 t.appendChild(ae0);
594 if (items[i].getElementsByTagName("title")[0].firstChild) {
595 if (items[i].getElementsByTagName("title")[0].firstChild.nodeValue.trim() > "") ae0.innerHTML = items[i].getElementsByTagName("title")[0].firstChild.nodeValue;
596 }
597 d.appendChild(t);
598
599 var td = document.createElement("div");
600 td.className = "groupmark";
601 td.style.marginTop = "-15px";
602 totop = document.createElement("span");
603 totop.setAttribute("onclick", "window.scrollTo(0, 0);");
604 totop.innerHTML = "to top";
605 td.appendChild(totop);
606 d.appendChild(td);
607 }
608 catch(err) {ae0.innerHTML = err;}
609
610 var l = document.createElement("div");
611 l.className = "group";
612
613 var ae2 = document.createElement("span");
614 ae2.id = "pubDate" + i;
615 try {
616 ae2.name = items[i].getElementsByTagName("pubDate")[0].firstChild.nodeValue;
617 }
618 catch(err) {
619 try {
620 ae2.name = items[i].getElementsByTagName("date")[0].firstChild.nodeValue;
621 }
622 catch(err) {
623 try {
624 ae2.name = items[i].getElementsByTagName("published")[0].firstChild.nodeValue;
625 } catch(err) {}
626 }
627 }
628 var itemd = new Date(ae2.name);
629 if (Object.prototype.toString.call(itemd) === "[object Date]") {
630 if (!isNaN(itemd.getTime())) {
631 ae2.innerHTML = new Date(ae2.name).toLocaleString().replace(/ /g, "&nbsp;");
632 l.appendChild(ae2);
633 }
634 }
635
636 var ae4 = document.createElement("a");
637 try {
638 ae4.href = "mailto:" + items[i].getElementsByTagName("email")[0].firstChild.nodeValue;
639 try {
640 ae4.innerHTML = items[i].getElementsByTagName("author")[0].firstChild.nodeValue.replace(/ /g, "&nbsp;");
641 } catch(err) {
642 ae4.innerHTML = items[i].getElementsByTagName("name")[0].firstChild.nodeValue.replace(/ /g, "&nbsp;");
643 }
644 }
645 catch(err) {
646 try {
647 ae4.href = items[i].getElementsByTagName("authorUrl")[0].firstChild.nodeValue;
648 ae4.innerHTML = items[i].getElementsByTagName("author")[0].firstChild.nodeValue.replace(/ /g, "&nbsp;");
649 }
650 catch(err) {
651 var ae4 = document.createElement("span");
652 try {
653 ae4.innerHTML = items[i].getElementsByTagName("author")[0].firstChild.nodeValue.replace(/ /g, "&nbsp;");
654 }
655 catch(err) {
656 try {
657 ae4.innerHTML = items[i].getElementsByTagName("creator")[0].firstChild.nodeValue.replace(/ /g, "&nbsp;");
658 }
659 catch(err) {
660 try {
661 ae4.innerHTML = items[i].getElementsByTagName("name")[0].firstChild.nodeValue.replace(/ /g, "&nbsp;");
662 } catch(err) {ae4 = null;}
663 }
664 }
665 }
666 }
667 if (ae4) l.appendChild(ae4);
668
669 try {
670 var ae5 = document.createElement("a");
671 ae5.innerHTML = "Comments";
672 try {
673 var cc = items[i].getElementsByTagNameNS("http://purl.org/rss/1.0/modules/slash/", "comments")[0].firstChild.nodeValue;
674 ae5.innerHTML = (cc > 0) ? "Comments (" + cc + ")" : "Comments";
675 }
676 catch(err) {
677 try {
678 var cc = items[i].getElementsByTagNameNS("http://purl.org/atompub/rank/1.0", "rank")[0].firstChild.nodeValue;
679 ae5.innerHTML = (cc > 0) ? "Comments (" + cc + ")" : "Comments";
680 } catch(err) {}
681 }
682 ae5.href = items[i].getElementsByTagName("comments")[0].firstChild.nodeValue;
683 l.appendChild(ae5);
684 } catch(err) {}
685
686 var aec = document.createElement("div");
687 try {
688 var category = "";
689 if (items[i].getElementsByTagName("category")[0]) {
690 for (var c = 0; c < items[i].getElementsByTagName("category").length; c++) {
691 var cc;
692 try {
693 cc = items[i].getElementsByTagName("category")[c].attributes.getNamedItem("term").value;
694 } catch(err) {
695 cc = items[i].getElementsByTagName("category")[c].firstChild.nodeValue;
696 }
697 category = category + "<span onclick='FilterByTag(this)'>" + cc + "</span>";
698 if (document.getElementById("feedcategory").innerHTML.indexOf(cc) == -1) document.getElementById("feedcategory").innerHTML += "<span onclick='FilterByTag(this)'>" + cc + "</span>";
699 }
700 }
701 else if (items[i].getElementsByTagNameNS("http://enyim.com/schemas/blossom/2008/feed/", "tag")[0]) {
702 for (var c = 0; c < items[i].getElementsByTagNameNS("http://enyim.com/schemas/blossom/2008/feed/", "tag").length; c++) {
703 var cc = items[i].getElementsByTagNameNS("http://enyim.com/schemas/blossom/2008/feed/", "tag")[c].firstChild.nodeValue;
704 category = category + "<span onclick='FilterByTag(this)'>" + cc + "</span>";
705 if (document.getElementById("feedcategory").innerHTML.indexOf(cc) == -1) document.getElementById("feedcategory").innerHTML += "<span onclick='FilterByTag(this)'>" + cc + "</span>";
706 }
707 }
708 else if (items[i].getElementsByTagNameNS("http://purl.org/dc/elements/1.1/", "subject")[0]) {
709 var dcs = items[i].getElementsByTagNameNS("http://purl.org/dc/elements/1.1/", "subject")[0].firstChild.nodeValue;
710 for (var c = 0; c < dcs.split(",").length; c++) {
711 var cc = dcs.split(",")[c];
712 category = category + "<span onclick='FilterByTag(this)'>" + cc + "</span>";
713 if (document.getElementById("feedcategory").innerHTML.indexOf(cc) == -1) document.getElementById("feedcategory").innerHTML += "<span onclick='FilterByTag(this)'>" + cc + "</span>";
714 }
715 }
716
717 if (category != "") {
718 var aecl = document.createElement("span");
719 aecl.innerHTML = "Categories";
720 aecl.className = "itemlink";
721 aecl.setAttribute("onclick", "ShowHide('category" + i + "')");
722 l.appendChild(aecl);
723
724 aec.id = "category" + i;
725 aec.className = "feedbox";
726 aec.innerHTML = category;
727 aec.style.display = "none";
728
729 if (document.getElementById("feedcategory").childNodes.length > 0) document.getElementById("feedtags").style.display = "inline";
730 }
731 }
732 catch(err) {aec = null;}
733
734 var ddiv = document.createElement("div");
735
736 if (items[i].getElementsByTagName("image")[0]) {
737 var image = document.createElement("img");
738 image.style.display = "block";
739 image.style.marginLeft = "auto";
740 image.style.marginRight = "auto";
741 try {
742 image.src = items[i].getElementsByTagName("image")[0].firstChild.nodeValue;
743 ddiv.appendChild(image);
744 } catch(err) {image = null;}
745 }
746
747 if (items[i].getElementsByTagName("enclosure")[0]) {
748 var att = items[i].getElementsByTagName("enclosure")[0];
749 if (att.getAttribute("type")) {
750 if (att.getAttribute("type").indexOf("image") == 0) {
751 var image = document.createElement("img");
752 image.style.display = "block";
753 image.style.marginLeft = "auto";
754 image.style.marginRight = "auto";
755 image.src = att.getAttribute("url");
756 ddiv.appendChild(image);
757 }
758 }
759 else {
760 if (att.getAttribute("url").length > 0) {
761 var enclosure = document.createElement("a");
762 enclosure.innerHTML = "Enclosure";
763 enclosure.href = att.getAttribute("url");
764 l.appendChild(enclosure);
765 }
766 }
767 }
768
769 if (items[i].getElementsByTagNameNS("http://xml.theplatform.com/media/data/Media", "defaultThumbnailUrl")[0]) {
770 var image = document.createElement("img");
771 image.style.display = "block";
772 image.style.marginLeft = "auto";
773 image.style.marginRight = "auto";
774 try {
775 image.src = items[i].getElementsByTagNameNS("http://xml.theplatform.com/media/data/Media", "defaultThumbnailUrl")[0].firstChild.nodeValue;
776 ddiv.appendChild(image);
777 } catch(err) {image = null;}
778 }
779
780 try {
781 var ae3 = document.createElement("p");
782 ae3.className = "description";
783 ae3.id = "description" + i;
784 try {
785 ae3.innerHTML = items[i].getElementsByTagName("description")[0].childNodes[0].data;
786 } catch(err0) {
787 ae3.innerHTML = items[i].getElementsByTagName("content")[0].childNodes[0].data;
788 }
789 ae3.innerHTML = ae3.innerHTML.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&");
790 if (ae3.innerHTML == 0 || ae3.innerHTML == "&nbsp;") ae3.className = "none";
791 if (ae3.innerHTML != "undefined") ddiv.appendChild(ae3);
792 }
793 catch(err) {
794 try {
795 var ae3 = document.createElement("p");
796 ae3.className = "description";
797 try {
798 if (items[i].getElementsByTagName("description")[0].firstChild) ae3.innerHTML = err;
799 } catch(err2) {}
800 ae3.style.color = "red";
801 if (ae3.innerHTML == 0 || ae3.innerHTML == "&nbsp;") ae3.className = "none";
802 ddiv.appendChild(ae3);
803 } catch(err3) {}
804 }
805
806 var f = document.createElement("div");
807 if (ae3.innerHTML != 0 && ae3.innerHTML != "&nbsp;" && ae3.innerHTML != "undefined") {
808 var ff = document.createElement("div");
809 ff.className = "group";
810
811 var e = document.createElement("span");
812 e.innerHTML = "Translate with";
813 ff.appendChild(e);
814
815 var eg = document.createElement("a");
816 eg.innerHTML = "Google";
817 eg.href = "http://translate.google.com/#" + feedlanguage + "/" + language.substring(0, 2) + "/" + encodeURIComponent(ae3.outerText);
818 ff.appendChild(eg);
819
820 var eb = document.createElement("a");
821 eb.innerHTML = "Bing";
822 eb.href = "http://www.bing.com/translator/default.aspx?from=" + feedlanguage + "&to=" + language.substring(0, 2) + "&text=" + encodeURIComponent(ae3.outerText);
823 ff.appendChild(eb);
824
825 f.appendChild(ff);
826 }
827
828 if (dl) {
829 var fm = document.createElement("div");
830 fm.className = "group";
831
832 var e = document.createElement("span");
833 e.innerHTML = "Share by";
834 fm.appendChild(e);
835
836 var ee = document.createElement("a");
837 ee.innerHTML = "E-mail";
838 ee.href = "mailto:?subject=" + ae0.innerHTML + "&body=" + dl.href;
839 fm.appendChild(ee);
840
841 var ef = document.createElement("a");
842 ef.innerHTML = "Facebook";
843 ef.href = "http://www.facebook.com/sharer/sharer.php?u=" + encodeURIComponent(dl.href);
844 fm.appendChild(ef);
845
846 var et = document.createElement("a");
847 et.innerHTML = "Twitter";
848 et.href = "http://twitter.com/share?url=" + dl.href;
849 fm.appendChild(et);
850
851 var eg = document.createElement("a");
852 eg.innerHTML = "Google+";
853 eg.href = "https://plus.google.com/share?url=" + dl.href;
854 fm.appendChild(eg);
855
856 if (dl.href > "") f.appendChild(fm);
857 }
858
859 var m = document.createElement("div");
860 m.className = "groupmark";
861
862 markread = document.createElement("span");
863 markread.id = "markread" + i;
864 markread.style.display = "none";
865 markread.setAttribute("onclick", "this.parentNode.parentNode.style.backgroundColor = ''; this.style.display = 'none';");
866 markread.innerHTML = "mark read";
867 m.appendChild(markread);
868
869 mark = document.createElement("span");
870 mark.setAttribute("onclick", "this.parentNode.style.backgroundColor = (this.parentNode.style.backgroundColor == '') ? '#ffffb0' : '';");
871 mark.innerHTML = "highlight";
872 m.appendChild(mark);
873
874 if (l.childNodes.length > 0) d.appendChild(l);
875 if (aec) d.appendChild(aec);
876 d.appendChild(ddiv);
877 d.appendChild(f);
878 d.appendChild(m);
879 div.appendChild(d);
880 }
881
882 var parts = document.getElementById("page").childNodes;
883 if (parts.length > 0) document.getElementById("feedfilter").style.display = "block";
884 if (document.getElementById("checkit").checked) {
885 for (var i = 0; i < parts.length; i++) {
886 var d = new Date(document.getElementById("pubDate" + i).name);
887 if (d > lastread) {
888 parts[i].style.backgroundColor = "#fff0f0";
889 document.getElementById("markread" + i).style.display = "inline";
890 news += 1;
891 if (document.getElementById("scrollit").checked) parts[i].scrollIntoView(false);
892 }
893 else parts[i].style.backgroundColor = "";
894 }
895 }
896
897 var infoe = document.createElement("li");
898 if (news > 0) {
899 document.title = "(" + news + ") " + document.title;
900 infoe.innerHTML = "<b>Entries:</b> " + parts.length + " (" + news + " new)";
901 document.getElementById("feedmarkread").style.display = "block";
902 }
903 else infoe.innerHTML = "<b>Entries:</b> " + parts.length;
904 infos.appendChild(infoe);
905
906 document.getElementById("feedstatus").style.width = "0px";
907 }
908
909 function FilterByTag(t) {
910 var items = document.getElementById("page").childNodes;
911
912 for (var i = 0; i < items.length; i++) {
913 var p = items[i];
914 if (document.getElementById("category" + i)) {
915 p.style.display = (document.getElementById("category" + i).innerHTML.indexOf(t.innerHTML) >= 0) ? "block" : "none";
916 }
917 }
918 }
919
920 function Filter() {
921 var items = document.getElementById("page").childNodes;
922 var f = document.getElementById("filter").value
923
924 if (f == "") {
925 for (var i = 0; i < items.length; i++) {
926 var p = items[i];
927 p.style.display = "block";
928 }
929 }
930
931 if (f.indexOf("!") == 0) {
932 f = f.replace("!", "");
933 for (var i = 0; i < items.length; i++) {
934 var p = items[i];
935 p.style.display = ((document.getElementsByTagName("h2")[0].innerHTML.indexOf(f) >= 0) || (document.getElementById("description" + i).innerHTML.indexOf(f) >= 0)) ? "none" : "block";
936 }
937 }
938 else {
939 for (var i = 0; i < items.length; i++) {
940 var p = items[i];
941 p.style.display = ((document.getElementsByTagName("h2")[0].innerHTML.indexOf(f) >= 0) || (document.getElementById("description" + i).innerHTML.indexOf(f) >= 0)) ? "block" : "none";
942 }
943 }
944 }
945
946 function SetUpdate(o) {
947 if (o.checked) {
948 interval = setInterval(function(){Update()}, 1000);
949 document.getElementById("feedmarkread").style.display = "inline";
950 document.getElementById("reload").style.display = "inline";
951 }
952 else {
953 clearInterval(interval);
954 document.getElementById("feedmarkread").style.display = "none";
955 document.getElementById("reload").style.display = "none";
956 }
957 document.getElementById("update").disabled = !o.checked;
958 }
959
960 function Update() {
961 if (i >= imax) FeedIt();
962 else i += 1;
963
964 document.getElementById("reloadbar").style.width = (Number(document.getElementById("reload").style.width.replace(/[^\d\.\-]/g, "")) / (imax / i)) + "px";
965 }
966
967 function FeedMarkRead(c) {
968 lastread = new Date();
969 c.title = lastread.toLocaleString();
970 var items = document.getElementById("page").childNodes;
971 for (var i = 0; i < items.length; i++) {
972 items[i].style.backgroundColor = "";
973 document.getElementById("markread" + i).style.display = "none";
974 }
975 c.style.display = "none";
976 }
977
978 function FindIt() {
979 if (document.getElementById("urlit").value.indexOf("http") != 0) document.getElementById("urlit").value = "http://" + document.getElementById("urlit").value;
980 xmlhttp.open("GET", document.getElementById("urlit").value, true);
981 try {
982 xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
983 xmlhttp.onreadystatechange = xmlFindFeed;
984 xmlhttp.send();
985 } catch(err) {}
986 }
987
988 function xmlFindFeed(e) {
989 if (xmlhttp.readyState == 4) {
990 if (xmlhttp.status == 200) {
991 var html = xmlhttp.responseText;
992 html = html.replace(/\>\s+/g, ">");
993 var parser = new DOMParser();
994 var x = parser.parseFromString(html, "application/xml");
995 document.getElementById("urls").innerHTML = "";
996
997 var d = document.getElementById("urls");
998 var urls = x.getElementsByTagName("link");
999 if (urls) {
1000 var u = document.createElement("ul");
1001 var p = document.createElement("p");
1002 u.appendChild(p);
1003 d.appendChild(u);
1004
1005 for (var i = 0; i < urls.length; i++) {
1006 if ((urls[i].getAttribute("type") == "application/rss+xml") || (urls[i].getAttribute("type") == "application/atom+xml")) {
1007 var e = document.createElement("li");
1008 e.style.cursor = "pointer";
1009
1010 var h = urls[i].getAttribute("href");
1011 var a = document.createElement("a");
1012 a.href = document.getElementById("urlit").value;
1013 if (h.indexOf("/") == 0) h = h.replace("/", a.hostname + "/");
1014 if (h.indexOf("./") == 0) h = h.replace("./", document.getElementById("urlit").value + "/");
1015 if (h.indexOf("http") != 0) h = "http://" + h;
1016 e.setAttribute("onclick", "feed = '" + h + "'; document.getElementById('url').value = feed; FeedIt();");
1017 e.title = h;
1018
1019 e.innerHTML = urls[i].getAttribute("title");
1020 u.appendChild(e);
1021 }
1022 }
1023 p.innerHTML = "Feed found: " + (u.childNodes.length - 1);
1024 }
1025 }
1026 }
1027 }
1028 //-->
1029 </script>
1030 <base target="_blank"/>
1031</head>
1032<body>
1033 <div id="content">
1034 <div id="banner">
1035 <div id="feeddescription">&nbsp;</div>
1036 <span id="feedtitle"></span>
1037 <div id="feedstatus" style="height: 5px; width: 0px; background-color: #8080a0; padding: 0px; margin: 0px;">&nbsp;</div>
1038 </div>
1039 <div id="bannerbar">
1040 <div style="float: left;">
1041 <span id="feedinfo" onclick="ShowHide('feedinfos')" style="cursor: pointer; display: none;">Information</span>
1042 <a id="feedpublisher" href="" style="display: none;">Publisher</a>
1043 <span id="feedtags" onclick="ShowHide('feedcategory')" style="cursor: pointer; display: none;">Categories</span>
1044 </div>
1045 <div style="float: right;">
1046 <div id="reload" onclick="FeedIt();" style="width: 80px; border: solid thin #b0b0ff; padding: 1px; margin-right: 2px; background-color: white; font-size: 6px; cursor: pointer; float: right; display: none;">
1047 <div id="reloadbar" style="width: 0px; background-color: #b0b0ff;">&nbsp;</div>
1048 </div>
1049 <span onclick="ShowHide('feedpreferences');" style="float: right;">Settings</span>
1050 <span id="feedurl" onclick="ShowHide('feedurls')" style="float: right;">Feed</span>
1051 <span id="feedtree" onclick="ShowHide('pagesource')" style="float: right; display: none;">Source tree</span>
1052 <span id="feedmarkread" onclick="FeedMarkRead(this);" style="float: right; display: none;">Mark all read</span>
1053 </div>
1054 </div>
1055
1056 <div id="feedurls" class="feedbox" style="display: none;">
1057 <fieldset>
1058 <legend>Feed link</legend>
1059 <input id="url" value="" onchange="feed = this.value; FeedIt();" style="width: 100%;"/>
1060 <input value="Open" type="button" onclick="feed = document.getElementById('url').value; FeedIt();"/>
1061 <input value="Open on new tab" type="button" onclick="window.open(document.getElementById('url').value, '_blank');"/>
1062 <input value="Bookmarkable link" type="button" onclick="window.open(location.protocol + '//' + location.host + location.pathname + '?url=' + document.getElementById('url').value, '_blank');"/>
1063 <legend>Find feed by publisher</legend>
1064 <input id="urlit" value="" onchange="FindIt();" style="width: 100%;"/>
1065 <input value="Find it!" type="button" onclick="FindIt();"/>
1066 <div id="urls"></div>
1067 </fieldset>
1068 </div>
1069
1070 <div id="feedinfos" class="feedbox" style="display: none;"></div>
1071 <div id="feedcategory" class="feedbox" style="white-space: pre-line; display: none;"></div>
1072
1073 <div id="feedpreferences" class="feedbox" style="display: none;">
1074 <fieldset>
1075 <legend>Automatic update</legend>
1076 <input id="updateit" type="checkbox" onclick="SetUpdate(this); setCookie(this.id, this.checked, 365);"/>Update after
1077 <input id="update" value="5" onchange="if (this.value < 5) this.value = '5'; imax = (this.value * 60); setCookie(this.id, this.checked, 365);" style="width: 20px; text-align: center;" disabled="disabled"/>
1078 <span>minutes</span>
1079 </fieldset>
1080 <fieldset>
1081 <legend>Entries</legend>
1082 <input id="display" type="checkbox" onclick="setCookie(this.id, this.checked, 365);"/>Two column display style<br/>
1083 <input id="checkit" type="checkbox" onclick="this.nextSibling.nextSibling.disabled = !this.checked; setCookie(this.id, this.checked, 365);"/>Check for new
1084 <input id="scrollit" type="checkbox" onclick="setCookie(this.id, this.checked, 365);" disabled="disabled"/>Scroll to the earliest new
1085 </fieldset>
1086 <fieldset>
1087 <legend>Language settings</legend>
1088 Set language to translation of item
1089 <input id="langit" value="" onchange="setCookie(this.id, this.value, 365); language = this.value;" style="width: 20px; text-align: center;"/>
1090 <span id="blang"></span>
1091 </fieldset>
1092 <input id="submitOK" type="submit" value="OK" onclick="FeedIt(); document.getElementById('feedpreferences').style.display = 'none'"/>
1093 </div>
1094
1095 <div id="pagesource" style="display: none; margin-top: 9px;"></div>
1096
1097 <div id="feedfilter" style="position: relative; margin: 5px; text-align: right; font-size: 9px; display: none;">
1098 <label for="filter">Filter entries</label>
1099 <input id="filter" value="" onkeydown="Filter();" style="width: 80px;"/>
1100 </div>
1101
1102 <div id="page"></div>
1103 </div>
1104
1105 <script type="text/javascript">
1106 <!--
1107 document.getElementById("feedtitle").innerHTML = document.getElementsByTagName("title")[0].innerHTML;
1108 var m = document.getElementsByTagName("meta");
1109 for (var i = 0; i < m.length; i++) {
1110 if (m[i].getAttribute("name") == "description") document.getElementById("feeddescription").innerHTML = m[i].getAttribute("content");
1111 }
1112
1113 document.getElementById("updateit").checked = getCookie("updateit");
1114 if (document.getElementById("updateit").checked) document.getElementById("reload").style.display = "inline";
1115 document.getElementById("update").disabled = !document.getElementById("updateit").checked;
1116 document.getElementById("update").value = getCookie("update");
1117
1118 document.getElementById("display").checked = getCookie("display");
1119 document.getElementById("checkit").checked = getCookie("checkit");
1120 document.getElementById("scrollit").checked = getCookie("scrollit");
1121 document.getElementById("scrollit").disabled = !document.getElementById("checkit").checked;
1122
1123 document.getElementById("blang").innerHTML = "Browser's language: " + language;
1124 document.getElementById("langit").value = getCookie("langit");
1125 if (document.getElementById("langit").value.length == 2) language = document.getElementById("langit").value;
1126 else document.getElementById("langit").value = language.substring(0, 2);
1127
1128 if (feed != "") {
1129 document.getElementById("url").value = feed;
1130 FeedIt();
1131 if (document.getElementById("updateit").checked) interval = setInterval(function(){Update()}, 1000);
1132 }
1133 else {
1134 ShowHide("feedurls");
1135 document.getElementById("url").focus();
1136 }
1137 //-->
1138 </script>
1139</body>
1140</html>