XML Feeds

.

[javascript-dev] Re: Navigating Folders... going "up"

Aaron Faulstich afaulsti at hotmail.com
Fri May 30 10:22:37 MDT 2008


I was doing something similar to your code, but less efficient. The .lastIndexOf really speeds things up. My final code (for Windows) is:

function back_folder()
{
	//protect from going "up" at a drive
	if(prev_folder.charAt(prev_folder.length-2)!=":")
	{
		last_sep = prev_folder.lastIndexOf("/", prev_folder.length-2);
		var jump_to = prev_folder.slice(0, last_sep) + "/";
		jump_folder(jump_to);
	}
}

Where jump_folder is my folder loading function, and prev_folder is the last folder that's been loaded. 
It's working fine on Windows and is faster than what I had before. Thank you!


More information about the javascript-dev mailing list