[BACK]Return to index.html CVS log [TXT][DIR] Up to [local] / todotxt / Text-Todo-REST-API / example / htdocs

Annotation of todotxt/Text-Todo-REST-API/example/htdocs/index.html, Revision 1.9

1.2       andrew      1: <html><head>
1.9     ! andrew      2:         <!-- $AFresh1: index.html,v 1.8 2010/02/13 22:32:18 andrew Exp $ -->
1.7       andrew      3:         <title>todo.txt - ajax client</title>
                      4:         <link rel="stylesheet" href="todo.css">
1.9     ! andrew      5:
1.7       andrew      6:         <script src="scriptaculous/lib/prototype.js"></script>
                      7:         <script src="scriptaculous/src/scriptaculous.js?load=effects,controls"></script>
1.2       andrew      8: <script type='text/javascript'>
1.4       andrew      9:
1.9     ! andrew     10: var TODO = function () {
        !            11:     var base_url = '/~andrew/user-bin/todo.cgi',
        !            12:
        !            13:     updateList = function (list, transport) {
        !            14:         var i,
        !            15:           todo = transport.responseJSON,
        !            16:           url = '';
        !            17:
        !            18:         $('list').update('');
        !            19:
        !            20:         for (i=0; i <= todo.length; i++) {
        !            21:             $('list').insert({
        !            22:                 bottom: new Element('div', {
        !            23:                     id: todo[i].md5,
        !            24:                     }).update(todo[i].text),
        !            25:             });
        !            26:
        !            27:             url = base_url + '/' + list + '/entry/' + todo[i].md5;
        !            28:
        !            29:             new Ajax.InPlaceEditor(todo[i].md5, url + '.json', {
        !            30:                 cols: 80,
        !            31:                 loadTextURL: url + '.txt',
        !            32:                 //getText: function () {},
        !            33:             });
        !            34:         }
        !            35:     };
        !            36:
        !            37:     return {
        !            38:         getFiles: function () {
        !            39:             $('files').update("Getting Files . . .");
        !            40:
        !            41:             new Ajax.Updater('files', base_url, {
        !            42:                 method: 'get',
        !            43:             });
        !            44:         },
        !            45:
        !            46:         getTags: function (list) {
        !            47:              var url = base_url + '/' + list + '/tags';
        !            48:              $('tags').update("Getting Tags. . .");
        !            49:
        !            50:              new Ajax.Request(url + '.json', {
        !            51:                 method: 'get',
        !            52:                 onSuccess: function (transport) {
        !            53:                     var data = transport.responseJSON,
        !            54:                     k,
        !            55:                     html = '';
        !            56:                     for (k in data) {
        !            57:                         if (data.hasOwnProperty(k)) {
        !            58:                             html += k + ": " + data[k] + "<br/>\n";
        !            59:                         }
        !            60:                     }
        !            61:                     $("tags").innerHTML = html;
        !            62:                 },
        !            63:             });
        !            64:         },
        !            65:
        !            66:         getList: function (list) {
        !            67:             var url = base_url + '/' + list;
        !            68:             $('list').update("Getting List . . .");
        !            69:
        !            70:             new Ajax.Request(url + '.json', {
        !            71:                 method: 'get',
        !            72:                 onSuccess: function (transport) {
        !            73:                     updateList(list, transport)
        !            74:                 },
        !            75:             });
        !            76:
        !            77:         },
        !            78:     };
        !            79: }();
1.7       andrew     80:
1.2       andrew     81: </script>
                     82: </head>
1.6       andrew     83:
1.9     ! andrew     84: <body onLoad="TODO.getList('todo');TODO.getTags('todo');TODO.getFiles()">
1.7       andrew     85:     <h1>Files:</h1><div id='files'></div>
1.9     ! andrew     86:     <h1>Tags:</h1> <div id='tags'></div>
1.7       andrew     87:     <h1>List:</h1> <div id='list'></div>
1.1       andrew     88: </body></html>

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>