summaryrefslogtreecommitdiff
path: root/htroot/rssTerminal.html
diff options
context:
space:
mode:
authororbiter <orbiter@6c8d7289-2bf4-0310-a012-ef5d649a1542>2008-04-22 23:09:24 +0000
committerorbiter <orbiter@6c8d7289-2bf4-0310-a012-ef5d649a1542>2008-04-22 23:09:24 +0000
commite90282da1ceda0f76655a2ee75f8bd8cb13e1c5c (patch)
tree36c021dbfd4bd2d5c7adfb027a91e987f0e31afa /htroot/rssTerminal.html
parentda386a192409d10e748526d77938686f674e3d85 (diff)
added experimental javascript terminal for rss feeds (not used yet anywhere yet, expect the worst)
.. possibly to be used as content for iframes within monitoring pages not ready yet! git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@4727 6c8d7289-2bf4-0310-a012-ef5d649a1542
Diffstat (limited to 'htroot/rssTerminal.html')
-rwxr-xr-xhtroot/rssTerminal.html151
1 files changed, 151 insertions, 0 deletions
diff --git a/htroot/rssTerminal.html b/htroot/rssTerminal.html
new file mode 100755
index 000000000..f3b1ac225
--- /dev/null
+++ b/htroot/rssTerminal.html
@@ -0,0 +1,151 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+<title>rss terminal</title>
+<style type="text/css">
+
+div#container {
+ padding:6px;
+ background:#fff;
+ border:1px solid #000;
+ width: 600px;
+ height: 360px;
+ margin:0 auto;
+ text-align:left;
+}
+
+div#container p {
+ margin:0px 0;
+}
+
+div#scrollObject {
+ position: absolute;
+ overflow: hidden;
+ width: 600px;
+ height: 360px;
+}
+
+div#content {
+ position:absolute;
+ font:9px 'Lucida Console', 'Courier New', monospace;
+ top:0;
+ left:0;
+}
+</style>
+
+<script type="text/javascript" src="/js/ajax.js"></script>
+<script type="text/javascript" src="/js/rss2.js"></script>
+<script type="text/javascript">
+
+var lines = new Array();
+var maxlines = 360 / 9;
+var maxwidth = 600 / 5;
+var maxtime = 30000; // time that should be wasted until everything is scrolled
+var minwait = 50; // if this is too short, the CPU will eat all performance
+var maxwait = 500;
+var scroller = null;
+var idleping = null;
+var lastwait = 1000;
+var tab = "&nbsp;&nbsp;";
+
+function fillLines() {
+ for (var i = 0; i < maxlines; i++) {
+ addLine("");
+ }
+}
+
+function addLine(line) {
+ while (line.length > maxwidth) {
+ lines.push(line.substring(0, maxwidth));
+ line = tab + line.substring(maxwidth);
+ }
+ lines.push(line);
+ if (lines.length > maxlines) {
+ if (scroller != null) {
+ window.clearInterval(scroller);
+ scroller = null;
+ }
+ scroller=window.setInterval("scroll()", newwait());
+ }
+ show();
+}
+
+function show() {
+ var doc = document.getElementById("content");
+ doc.innerHTML = "";
+ for (var i = 0; i < maxlines; i++) {
+ doc.innerHTML += lines[i] + "<br />";
+ }
+}
+
+function newwait() {
+ if (lines.length > maxlines) {
+ var time = maxtime / (lines.length - maxlines);
+ if (time < minwait) time = minwait;
+ if (time > maxwait) time = maxwait;
+ } else {
+ time = maxwait;
+ }
+ if (time < lastwait) time = (time + maxlines * lastwait) / (maxlines + 1);
+ lastwait = time;
+ return time;
+}
+
+function scroll() {
+ if (scroller != null) {
+ window.clearInterval(scroller);
+ scroller = null;
+ }
+ if (lines.length > maxlines) {
+ var factor = (lines.length - maxlines) / maxlines / 10;
+ if (factor < 0) factor = 1;
+ if (factor > 3) factor = 3;
+ for (var i = 0; i < factor; i++) {
+ lines.shift();
+ }
+ show();
+ scroller=window.setInterval("scroll()", newwait());
+ }
+}
+
+function showRSS(RSS) {
+ //populate the items
+ for (var i=0; i<RSS.items.length; i++) {
+ if (RSS.items[i].title != null) addLine(RSS.items[i].title);
+ if (RSS.items[i].link != null) addLine(tab + RSS.items[i].link);
+ if (RSS.items[i].description != null) addLine(tab + RSS.items[i].description);
+ }
+ return true;
+}
+
+function idlepingInit() {
+ idleping = window.setInterval("idlepingExec()", 10000);
+}
+
+function idlepingExec() {
+ if (lines.length <= maxlines) {
+ // feed in some empty lines to make the list appear alive
+ addLine("");
+ }
+}
+
+</script>
+
+</head>
+ <body>
+ <div id="container">
+ <div id="scrollObject">
+ <div id="content"></div>
+ </div>
+ </div>
+ </body>
+
+<script type="text/javascript">
+fillLines();
+idlepingInit();
+getRSS("http://localhost:8080/yacysearch.rss?search=java&count=100");
+//getRSS("http://news.google.com/news?output=rss");
+</script>
+
+</html>