~etherpad/etherpad/ubuntu-lucid-backport

« back to all changes in this revision

Viewing changes to etherpad/src/plugins/realTimeRecentChanges/static/js/rtrc.js

  • Committer: James Page
  • Date: 2011-04-13 08:00:43 UTC
  • Revision ID: james.page@canonical.com-20110413080043-eee2nq7y1v7cv2mp
* Refactoring to use native Ubuntu Java libraries. 
* debian/control:
  - use openjdk instead of sun's java
  - update maintainer
* debian/etherpad.init.orig, debian/etherpad.upstart:
  - move the init script out of the way
  - create a basic upstart script
  - note that the open office document conversion daemon was dropped
    from the upstart configuration; if this behavior is desired, please
    create a separate upstart job for it
* debian/rules:
  - just use basic dh_installinit, as it will pick up the new upstart job
* New release
* Changed maintainer to Packaging
* Fixed installation scripts
* Initial Release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Inspired by JUITTER 1.0.0 BY RODRIGO FANTE -- Thanks Mr. Juitter :)*/
 
2
 
 
3
 
 
4
function RTRCrunMainLoop(){
 
5
  setTimeout('RTRCrunMainLoop()', 5000);
 
6
  $.getJSON("http://" + host + "/ep/search?format=json",
 
7
      function(data){
 
8
        RTRCdoSomethingWithJSON(data);
 
9
  });
 
10
}
 
11
 
 
12
function RTRCdoSomethingWithJSON(json){
 
13
  if (json != undefined && json != ""){
 
14
    var msgNb = 0;
 
15
    var maxNumMessages = 10;
 
16
    $("div.realtimedata").empty();
 
17
    $("div.realtimedata").append('<ul class="allmatches">')
 
18
 
 
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) {
 
23
 
 
24
                /* We collect all of the tags into one
 
25
                /* string -- better markup could be used
 
26
                /* to be consistent with the usual look &
 
27
                /* feel. */
 
28
 
 
29
                var tagString = "";
 
30
 
 
31
                for (j = 0; j < json.matchingPads[i].TAGS.length; j++){
 
32
 
 
33
                    tagString = tagString + '&nbsp; ' +
 
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>';
 
38
                }
 
39
 
 
40
                $("ul.allmatches").append(
 
41
                   '<li id="matchingpad' + msgNb + '">' +
 
42
                   '<a href=http://'+ host +'/' + item.ID + '>' +
 
43
                   item.ID + '</a>' +
 
44
                   '&nbsp; ' + item.lastWriteTime +
 
45
                   '<br>' + tagString + '<br><br>');
 
46
 
 
47
                jQuery('matchingpad'+msgNb).hide();
 
48
                jQuery('matchingpad'+msgNb).show("slow");
 
49
                msgNb++; }});
 
50
 
 
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. */
 
56
 
 
57
    if(msgNb>=maxNumMessages){
 
58
        jQuery(".matchingpad").each(
 
59
            function(k,elemLI){
 
60
                if(k >= maxNumMessages)
 
61
                    jQuery(this).hide("slow");
 
62
            });}
 
63
}}
 
64
 
 
65
 
 
66
  // do stuff to start things on client side
 
67
  // (set up the start, timer, all that stuff)
 
68
$("div.realtimedata").empty();
 
69
RTRCrunMainLoop();
 
 
b'\\ No newline at end of file'