[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.7

1.2       andrew      1: <html><head>
1.7     ! andrew      2:         <!-- $AFresh1: index.html,v 1.6 2010/01/31 03:40:21 andrew Exp $ -->
        !             3:         <title>todo.txt - ajax client</title>
        !             4:         <link rel="stylesheet" href="todo.css">
        !             5:         <script src="scriptaculous/lib/prototype.js"></script>
        !             6:         <script src="scriptaculous/src/scriptaculous.js?load=effects,controls"></script>
1.2       andrew      7: <script type='text/javascript'>
1.4       andrew      8: var base_url = '/~andrew/user-bin/todo.cgi';
                      9:
1.7     ! andrew     10: function getFiles() {
        !            11:     $('files').update("Getting Files . . .");
        !            12:     new Ajax.Updater('files', base_url, {
        !            13:         method: 'get',
        !            14:         //insertion: Insertion.Top
        !            15:     });
1.6       andrew     16: }
                     17:
1.7     ! andrew     18: function updateList(list, transport) {
        !            19:     var todo = transport.responseJSON;
        !            20:
        !            21:     $('list').update('');
        !            22:     for (var i=0; i <= todo.length; i++) {
        !            23:         $('list').insert({ bottom: new Element('div', { id: todo[i].md5 }) });
        !            24:         $(todo[i].md5).update(todo[i].text);
        !            25:
        !            26:         var entry_url = base_url + '/' + list + '/' + todo[i].md5;
1.4       andrew     27:
1.7     ! andrew     28:         new Ajax.InPlaceEditor(todo[i].md5, entry_url + '.txt', {
        !            29:             loadTextURL: entry_url + '.txt',
        !            30:         });
        !            31:     }
1.2       andrew     32: }
1.7     ! andrew     33:
1.2       andrew     34: function getList(list) {
1.7     ! andrew     35:     $('list').update("Getting List . . .");
        !            36:     var list_url = base_url + '/' + list;
        !            37:
        !            38:     new Ajax.Request(list_url + '.json', {
        !            39:         method: 'get',
        !            40:         onSuccess: function(transport) { updateList(list, transport) },
        !            41:     });
1.2       andrew     42: }
1.7     ! andrew     43:
1.2       andrew     44: </script>
                     45: </head>
1.6       andrew     46:
1.7     ! andrew     47: <body onLoad="getFiles();getList('todo')">
        !            48:     <h1>Files:</h1><div id='files'></div>
        !            49:     <h1>List:</h1> <div id='list'></div>
1.1       andrew     50: </body></html>

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