version 1.1, 2010/01/18 04:19:04 |
version 1.7, 2010/02/02 06:11:31 |
|
|
<html><head><title></title></head><body> |
<html><head> |
|
<!-- $AFresh1: index.html,v 1.6 2010/01/31 03:40:21 andrew Exp $ --> |
|
<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'> |
|
var base_url = '/~andrew/user-bin/todo.cgi'; |
|
|
|
function getFiles() { |
|
$('files').update("Getting Files . . ."); |
|
new Ajax.Updater('files', base_url, { |
|
method: 'get', |
|
//insertion: Insertion.Top |
|
}); |
|
} |
|
|
|
function updateList(list, transport) { |
|
var todo = transport.responseJSON; |
|
|
|
$('list').update(''); |
|
for (var i=0; i <= todo.length; i++) { |
|
$('list').insert({ bottom: new Element('div', { id: todo[i].md5 }) }); |
|
$(todo[i].md5).update(todo[i].text); |
|
|
|
var entry_url = base_url + '/' + list + '/' + todo[i].md5; |
|
|
|
new Ajax.InPlaceEditor(todo[i].md5, entry_url + '.txt', { |
|
loadTextURL: entry_url + '.txt', |
|
}); |
|
} |
|
} |
|
|
|
function getList(list) { |
|
$('list').update("Getting List . . ."); |
|
var list_url = base_url + '/' + list; |
|
|
|
new Ajax.Request(list_url + '.json', { |
|
method: 'get', |
|
onSuccess: function(transport) { updateList(list, transport) }, |
|
}); |
|
} |
|
|
|
</script> |
|
</head> |
|
|
|
<body onLoad="getFiles();getList('todo')"> |
|
<h1>Files:</h1><div id='files'></div> |
|
<h1>List:</h1> <div id='list'></div> |
</body></html> |
</body></html> |