prototype 实现网络相册的ajax界面。

源代码在线查看: images.js.svn-base

软件大小: 3707 K
上传用户: huajunun
关键词: prototype ajax 网络
下载地址: 免注册下载 普通下载 VIP

相关代码

								var ui={};				var currPath="/";				Ajax.Responders.register(				  {				    onComplete:function(request,transport,json){				      showBreadcrumbs();				      showFolders(json.folders);				      if (json.count!=null){				        if (json.count>0){				          Element.show(ui.images);				        }else{				          Element.hide(ui.images);				        }				      }				    }				  }				);								Event.observe(				  window,				  'load',				  function(){				    ui.title=$('title');				    ui.closeup=$('closeup');				    ui.closeupImg=$('closeup_img');				    ui.folders=$('folders');				    ui.images=$('images');				    Element.hide(ui.closeup,ui.folders);				    load();				  }				);								function load(newPath){				  if (newPath!=null){ currPath=newPath; }				  new Ajax.Updater(				    "images",				    "images.php?path="+currPath,				    { 				      method: "GET",				      evalScripts: true,				      onComplete: function(){ 				        Element.hide(ui.closeup);				      }				    }				  );				}								function showBreadcrumbs(){				  var crumbs=currPath.split("/");				  var crumbHTML=" > home";				  for(var i=0;i				    var crumb=crumbs[i];				    if (crumb.length>0){				      var path=subpath(currPath,"/",i);				      crumbHTML+=" > "+crumb+"";				    }				  }				  ui.title.innerHTML=crumbHTML;				}								function subpath(str,delim,ix){				  var all=str.split(delim);				  var some=all.findAll(				    function(v,i){				      //alert("i="+i+", ix="+ix+", v="+v+", result: "+(i				      return (i				    }				  );				  return some.join(delim);				}								function showFolders(folders){				  if (folders.length==0){				    Element.hide(ui.folders);				  }else{				    var folderHTML="";				    for (var i=0;i				      var folder=folders[i];				      var path=(currPath=="/") ? "/"+folder : [currPath,folder].join("/");				      folderHTML+=""+folder+"";				    }				    Element.show(ui.folders);				    ui.folders.innerHTML=folderHTML;				  }				}												function showCloseup(imgSrc){				  Element.hide(ui.images);				  Element.show(ui.closeup);				  ui.closeupImg.src=imgSrc;				}							

相关资源