⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 folderfilelist.js

📁 SK信息采集2.0功能介绍: 1.可针对任何静态网页,动态网页进行采集。包括htm,html,shtml,ASP,ASPX,JSP,PHP等。 2.增加自定文件采集.用户可采集网页中的所有文件.
💻 JS
字号:
/*
文件名:FolderFileList.JS
作 用 :选择文件操作的函数集合
说 明 :在FolderFileList.asp文件中调用此JS
*/
var SelectedObj=null;
var DocContextMenuArr=new Array();
DocElementArrInitialFlag=false;
var DocPopupContextMenu=window.createPopup();
document.oncontextmenu=new Function("return ShowMouseRightMenu(window.event);");
function ShowMouseRightMenu(event)
{
	DocDisabledContextMenu();
	var width=100;
	var height=0;
	var lefter=event.clientX;
	var topper=event.clientY;
	var ObjPopDocument=DocPopupContextMenu.document;
	var ObjPopBody=DocPopupContextMenu.document.body;
	var MenuStr='';
	for (var i=0;i<DocContextMenuArr.length;i++)
	{
		if (DocContextMenuArr[i].ExeFunction=='seperator')
		{
			MenuStr+=FormatSeperator();
			height+=16;
		}
		else
		{
			MenuStr+=FormatMenuRow(DocContextMenuArr[i].ExeFunction,DocContextMenuArr[i].Description,DocContextMenuArr[i].EnabledStr);
			height+=20;
		}
	}
	MenuStr="<TABLE border=0 cellpadding=0 cellspacing=0 class=Menu width=100>"+MenuStr
	MenuStr=MenuStr+"<\/TABLE>";
	ObjPopDocument.open();
	ObjPopDocument.write("<head><link href=\"../inc/ContextMenu.css\" type=\"text/css\" rel=\"stylesheet\"></head><body scroll=\"no\" onConTextMenu=\"event.returnValue=false;\" onselectstart=\"event.returnValue=false;\">"+MenuStr);
	ObjPopDocument.close();
	height+=4;
	if(lefter+width > document.body.clientWidth) lefter=lefter-width;
	DocPopupContextMenu.show(lefter, topper, width, height, document.body);
	return false;
}
function FormatSeperator()
{
	var MenuRowStr="<tr><td height=16 valign=middle><hr><\/td><\/tr>";
	return MenuRowStr;
}
function FormatMenuRow(MenuOperation,MenuDescription,EnabledStr)
{
	var MenuRowStr="<tr "+EnabledStr+"><td align=left height=20 class=MouseOut onMouseOver=this.className='MouseOver'; onMouseOut=this.className='MouseOut'; valign=middle"
	if (EnabledStr=='') MenuRowStr+=" onclick=\""+MenuOperation+"parent.DocPopupContextMenu.hide();\">&nbsp;&nbsp;&nbsp;&nbsp;";
	else MenuRowStr+=">&nbsp;&nbsp;&nbsp;&nbsp;";
	MenuRowStr=MenuRowStr+MenuDescription+"<\/td><\/tr>";
	return MenuRowStr;
}
function document.onreadystatechange()
{
	if (DocElementArrInitialFlag) return;
	InitialDocContextMenuArr();
	DocElementArrInitialFlag=true;
}
function ContextMenuItem(ExeFunction,Description,EnabledStr)
{
	this.ExeFunction=ExeFunction;
	this.Description=Description;
	this.EnabledStr=EnabledStr;
}
function DocDisabledContextMenu()
{
	SelectFolder();
}
function InitialDocContextMenuArr()
{
	DocContextMenuArr[DocContextMenuArr.length]=new ContextMenuItem("parent.AddFolderOperation();",'新建目录','');
	DocContextMenuArr[DocContextMenuArr.length]=new ContextMenuItem("if (confirm('确定要删除吗?')==true) parent.DelFolderFile();",'删除','disabled');
	DocContextMenuArr[DocContextMenuArr.length]=new ContextMenuItem("parent.EditFolder();",'重命名','disabled');
	DocContextMenuArr[DocContextMenuArr.length]=new ContextMenuItem('seperator','','');
	DocContextMenuArr[DocContextMenuArr.length]=new ContextMenuItem("parent.location.reload();",'刷新页面','disabled');
}
function SelectFolder()
{
	Obj=event.srcElement,DisabledContextMenuStr='';
	if (SelectedObj!=null) SelectedObj.className='FolderItem';
	if ((Obj.Path!=null)||(Obj.File!=null))
	{
		Obj.className='FolderSelectItem';
		SelectedObj=Obj;
	}
	else SelectedObj=null;
	if (SelectedObj!=null)	DisabledContextMenuStr='';
	else DisabledContextMenuStr=',删除,重命名,';
	for (var i=0;i<DocContextMenuArr.length;i++)
	{
		if (DisabledContextMenuStr.indexOf(DocContextMenuArr[i].Description)!=-1) DocContextMenuArr[i].EnabledStr='disabled';
		else  DocContextMenuArr[i].EnabledStr='';
	}
}
function SelectFile(Obj)
{		var PathArticle='',TempPath='';
	for (var i=0;i<document.all.length;i++)
	{
		if (document.all(i).className=='FolderSelectItem') document.all(i).className='FolderItem';
	}
	Obj.className='FolderSelectItem';
		if (Hypothesized!='')
		{
			TempPath=CurrPath;
			PathArticle=TempPath.substr(TempPath.indexOf(Hypothesized)+Hypothesized.length);
		}
		else
		{
			PathArticle=CurrPath;
		}

	if (CurrPath=='/')	parent.document.all.FileUrl.value=Hypothesized+PathArticle+Obj.File;
	else parent.document.all.FileUrl.value=Hypothesized+PathArticle+'/'+Obj.File;
	PreviewFile(Obj);
}
function OpenParentFolder()
{
	if (CanBackFlag==0) return;
	   location.href='FolderFileList.asp?CurrPath='+ParentPath;
	  SearchOptionExists(parent.document.all.FolderSelectList,ParentPath);
}

function OpenFolder(Obj)
{
	var SubmitPath='';
	if (CurrPath=='/') SubmitPath=CurrPath+Obj.Path;
	else SubmitPath=CurrPath+'/'+Obj.Path;
	location.href='FolderFileList.asp?CurrPath='+SubmitPath;
	AddFolderList(parent.document.all.FolderSelectList,SubmitPath,SubmitPath);
}

function SelectUpFolder(Obj)
{
	for (var i=0;i<document.all.length;i++)
	{
		if (document.all(i).className=='FolderSelectItem') document.all(i).className='FolderItem';
	}
	Obj.className='FolderSelectItem';
}
function PreviewFile(Obj)
{
	var Url='';
	var Path=escape();
	if (CurrPath=='/') Path=escape(CurrPath+Obj.File);
	else Path=escape(CurrPath+'/'+Obj.File);
	Url='Preview.asp?FilePath='+Path;
	parent.frames["PreviewArea"].location=Url;
}
function AddFolderList(SelectObj,Label,LabelContent)
{
	var i=0,AddOption;
	if (!SearchOptionExists(SelectObj,Label))
	{
		AddOption = document.createElement("OPTION");
		AddOption.text=Label;
		AddOption.value=LabelContent;
		SelectObj.add(AddOption);
		SelectObj.options(SelectObj.length-1).selected=true;
	}
}
function SearchOptionExists(Obj,SearchText)
{
	var i,flag=false;
	var AddOption;
	for(i=0;i<Obj.length;i++)
	{
		if (Obj.options(i).text==SearchText)
		{
			Obj.options(i).selected=true;
			flag=true;
			return true;
		}
	}
	if (!flag)
	{
		AddOption = document.createElement("OPTION");
		AddOption.text=SearchText;
		AddOption.value=SearchText;
		Obj.add(AddOption);
		Obj.options(Obj.length-1).selected=true;
		}
	return false;
}
function SetFile(Obj)
{
		var PathArticle='',TempPath='';
		if (Hypothesized!='')
		{
			TempPath=CurrPath;
			PathArticle=TempPath.substr(TempPath.indexOf(Hypothesized)+Hypothesized.length);
		}
		else
		{
			PathArticle=CurrPath;
		}

	if (CurrPath=='/')	window.returnValue=Hypothesized+PathArticle+Obj.File;
	else window.returnValue=Hypothesized+PathArticle+'/'+Obj.File;
	window.close();
}
window.onunload=CheckReturnValue;
function CheckReturnValue()
{
	if (typeof(window.returnValue)!='string') window.returnValue='';
}
function AddFolderOperation()
{
	var ReturnValue=prompt('请输入新建目录名称:','');
	if ((ReturnValue!='') && (ReturnValue!=null))
		window.location.href='FolderFileList.asp?Type=AddFolder&Path='+CurrPath+'/'+ReturnValue+'&CurrPath='+CurrPath;
}
function DelFolderFile()
{
	if (SelectedObj!=null)
	{
		if (SelectedObj.Path!=null) window.location.href='?Type=DelFolder&Path='+CurrPath+'/'+SelectedObj.Path+'&CurrPath='+CurrPath;
		if (SelectedObj.File!=null) window.location.href='?Type=DelFile&Path='+CurrPath+'&FileName='+SelectedObj.File+'&CurrPath='+CurrPath;
	}
	else alert('请选择要删除的目录');
}
function EditFolder()
{
	var ReturnValue='';
	if (SelectedObj!=null)
	{
		if (SelectedObj.Path!=null)
		{
			ReturnValue=prompt('修改的名称:',SelectedObj.Path);
			if ((ReturnValue!='') && (ReturnValue!=null)) window.location.href='?Type=FolderReName&Path='+CurrPath+'&CurrPath='+CurrPath+'&OldPathName='+SelectedObj.Path+'&NewPathName='+ReturnValue;
		}
		if (SelectedObj.File!=null)
		{
			ReturnValue=prompt('修改的名称:',SelectedObj.File);
			if ((ReturnValue!='') && (ReturnValue!=null)) window.location.href='?Type=FileReName&Path='+CurrPath+'&CurrPath='+CurrPath+'&OldFileName='+SelectedObj.File+'&NewFileName='+ReturnValue;
		}
	}
	else alert('请填写要更名的目录名称');
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -