1
/* Inspired by JUITTER 1.0.0 BY RODRIGO FANTE -- Thanks Mr. Juitter :)*/
4
function RTRCrunMainLoop(){
5
setTimeout('RTRCrunMainLoop()', 5000);
6
$.getJSON("http://" + host + "/ep/search?format=json",
8
RTRCdoSomethingWithJSON(data);
12
function RTRCdoSomethingWithJSON(json){
13
if (json != undefined && json != ""){
15
var maxNumMessages = 10;
16
$("div.realtimedata").empty();
17
$("div.realtimedata").append('<ul class="allmatches">')
19
/* Mark up each of the matching pads. */
20
jQuery.each(json.matchingPads, function(i,item){
21
/* Inserting and marking up the items we obtained. */
22
if (item.ID != undefined) {
24
/* We collect all of the tags into one
25
/* string -- better markup could be used
26
/* to be consistent with the usual look &
31
for (j = 0; j < json.matchingPads[i].TAGS.length; j++){
33
tagString = tagString + ' ' +
34
'<a href=http://' + host + '/ep/search?query=' +
35
json.matchingPads[i].TAGS[j] +
36
' class="padtag" + title="' + json.matchingPads[i].TAGS[j] +
37
' matches">#' + json.matchingPads[i].TAGS[j] + '</a>';
40
$("ul.allmatches").append(
41
'<li id="matchingpad' + msgNb + '">' +
42
'<a href=http://'+ host +'/' + item.ID + '>' +
44
' ' + item.lastWriteTime +
45
'<br>' + tagString + '<br><br>');
47
jQuery('matchingpad'+msgNb).hide();
48
jQuery('matchingpad'+msgNb).show("slow");
51
/* After dealing with the new stuff, remove any old
52
/* entries (Do we have to deal with some kind of reset
53
/* of msgNb?) Though frankly I find this somewhat
54
/* confusing... Should get out a notebook and trace
55
/* through the flow, I guess. */
57
if(msgNb>=maxNumMessages){
58
jQuery(".matchingpad").each(
60
if(k >= maxNumMessages)
61
jQuery(this).hide("slow");
66
// do stuff to start things on client side
67
// (set up the start, timer, all that stuff)
68
$("div.realtimedata").empty();
b'\\ No newline at end of file'