version 1.2, 2010/01/18 04:51:15 |
version 1.9, 2010/02/16 03:45:17 |
|
|
<html><head> |
<html><head> |
<title>todo.txt - javascript client</title> |
<!-- $AFresh1: index.html,v 1.8 2010/02/13 22:32:18 andrew Exp $ --> |
<script src="prototype.js" type="text/javascript"></script> |
<title>todo.txt - ajax client</title> |
|
<link rel="stylesheet" href="todo.css"> |
|
|
|
<script src="scriptaculous/lib/prototype.js"></script> |
|
<script src="scriptaculous/src/scriptaculous.js?load=effects,controls"></script> |
<script type='text/javascript'> |
<script type='text/javascript'> |
function getFiles() { |
|
document.getElementById('files').innerHTML = "Getting Files . . ."; |
var TODO = function () { |
new Ajax.Request('/~andrew/user-bin/todo.cgi/andrew.txt', { |
var base_url = '/~andrew/user-bin/todo.cgi', |
method: 'get', |
|
onSuccess: function(response) { |
updateList = function (list, transport) { |
document.getElementById('files').innerHTML = response.responseText; |
var i, |
} |
todo = transport.responseJSON, |
}); |
url = ''; |
} |
|
function getList(list) { |
$('list').update(''); |
document.getElementById('list').innerHTML = "Getting List . . ."; |
|
new Ajax.Request('/~andrew/user-bin/todo.cgi/andrew/' + list + '.txt', { |
for (i=0; i <= todo.length; i++) { |
method: 'get', |
$('list').insert({ |
onSuccess: function(response) { |
bottom: new Element('div', { |
document.getElementById('list').innerHTML = |
id: todo[i].md5, |
'<pre>' + response.responseText + '</pre>'; |
}).update(todo[i].text), |
} |
}); |
}); |
|
} |
url = base_url + '/' + list + '/entry/' + todo[i].md5; |
function getEntry(list, entry) { |
|
document.getElementById('entry').innerHTML = "Getting Entry . . ."; |
new Ajax.InPlaceEditor(todo[i].md5, url + '.json', { |
new Ajax.Request('/~andrew/user-bin/todo.cgi/andrew/' + list + '/entry/' + entry + '.md5', { |
cols: 80, |
method: 'get', |
loadTextURL: url + '.txt', |
onSuccess: function(response) { |
//getText: function () {}, |
document.getElementById('entry').innerHTML = |
}); |
'<pre>' + response.responseText + '</pre>'; |
} |
} |
}; |
}); |
|
} |
return { |
|
getFiles: function () { |
|
$('files').update("Getting Files . . ."); |
|
|
|
new Ajax.Updater('files', base_url, { |
|
method: 'get', |
|
}); |
|
}, |
|
|
|
getTags: function (list) { |
|
var url = base_url + '/' + list + '/tags'; |
|
$('tags').update("Getting Tags. . ."); |
|
|
|
new Ajax.Request(url + '.json', { |
|
method: 'get', |
|
onSuccess: function (transport) { |
|
var data = transport.responseJSON, |
|
k, |
|
html = ''; |
|
for (k in data) { |
|
if (data.hasOwnProperty(k)) { |
|
html += k + ": " + data[k] + "<br/>\n"; |
|
} |
|
} |
|
$("tags").innerHTML = html; |
|
}, |
|
}); |
|
}, |
|
|
|
getList: function (list) { |
|
var url = base_url + '/' + list; |
|
$('list').update("Getting List . . ."); |
|
|
|
new Ajax.Request(url + '.json', { |
|
method: 'get', |
|
onSuccess: function (transport) { |
|
updateList(list, transport) |
|
}, |
|
}); |
|
|
|
}, |
|
}; |
|
}(); |
|
|
</script> |
</script> |
</head> |
</head> |
<body onLoad="getFiles();getList('todo');getEntry('todo',5)"> |
|
<!-- $AFresh1$ --> |
<body onLoad="TODO.getList('todo');TODO.getTags('todo');TODO.getFiles()"> |
<div id='files'></div> |
<h1>Files:</h1><div id='files'></div> |
<div id='list'></div> |
<h1>Tags:</h1> <div id='tags'></div> |
<div id='entry'></div> |
<h1>List:</h1> <div id='list'></div> |
</body></html> |
</body></html> |