My favorites | Sign in
Project Home Downloads Wiki Issues Source
Project Information
Members
Links

indexes.js is pure(?) Javascript filelist library.

- Get the list of files and directories "as Array" or "with Callback". No need serverside scripts, but require Apache "mod_autoindex" module (and "jQuery" or "Prototype").

Usage

Target Directory

target/
 - dir1/
 - dir2/
 - file1.txt
 - file2.html

Setting (Apache)

target/.htaccess

Options +Indexes

or

httpd.conf

<Directory /path/to/target/>
  Options +Indexes
</Directory>

Example

with jQuery (Callback)

<script type="text/javascript" src="http://indexes.googlecode.com/svn/trunk/indexes.js"></script>
<script type="text/javascript">
$(funtion() {
	var indexes = new Indexes();
	indexes.index('target', function(a) {
		alert(decodeURIComponent(a.join('\n')));
	});
});
</script>

with Prototype (get Array)

<script type="text/javascript" src="http://indexes.googlecode.com/svn/trunk/indexes.js"></script>
<script type="text/javascript">
document.observe('dom:loaded', function() {
	var indexes = new Indexes();
	var a = indexes.index('target');
	alert(decodeURIComponent(a.join('\n')));
});
</script>

Result

dir1/
dir2/
file1.txt
file2.html

Demo

Test site is here.

Lisence

The MIT Lisence.

Powered by Google Project Hosting