📄 jsfunction.js
字号:
/*
文件名:JSFunction.JS
作 用 :JS管理操作的函数集合
说 明 :在JS_Main.asp文件中调用此JS
*/
var DocElementArrInitialFlag=false;
var DocElementArr = new Array();
var DocContextMenuArr=new Array();
var SelectedFile='',SelectedFolder='';
function document.onreadystatechange()
{
if (DocElementArrInitialFlag) return;
InitialDocElementArr('FolderID','JSID');
InitialDocContextMenuArr();
DocElementArrInitialFlag=true;
}
function InitialDocContextMenuArr()
{
if (KeyWord=='')
{
DocContextMenuArr[DocContextMenuArr.length]=new ContextMenuItem("parent.CreateFolder();",'新建目录(N)','disabled');
DocContextMenuArr[DocContextMenuArr.length]=new ContextMenuItem("parent.AddJS('');",'新建JS(M)','disabled');
DocContextMenuArr[DocContextMenuArr.length]=new ContextMenuItem('seperator','','');
}
DocContextMenuArr[DocContextMenuArr.length]=new ContextMenuItem("parent.JSView();",'预 览(V)','disabled');
DocContextMenuArr[DocContextMenuArr.length]=new ContextMenuItem('seperator','','');
DocContextMenuArr[DocContextMenuArr.length]=new ContextMenuItem("parent.SelectAllElement();",'全 选(A)','disabled');
DocContextMenuArr[DocContextMenuArr.length]=new ContextMenuItem("parent.Edit('');",'编 辑(E)','disabled');
DocContextMenuArr[DocContextMenuArr.length]=new ContextMenuItem("parent.Delete('');",'删 除(D)','disabled');
DocContextMenuArr[DocContextMenuArr.length]=new ContextMenuItem('seperator','','');
DocContextMenuArr[DocContextMenuArr.length]=new ContextMenuItem('parent.ChangeUp();','后 退(B)','');
DocContextMenuArr[DocContextMenuArr.length]=new ContextMenuItem('parent.Reload();','刷 新(Z)','');
}
function DocDisabledContextMenu()
{
var TempDisabledStr='';
if (FolderID=='0') TempDisabledStr='后 退(B),';
DisabledContextMenu('FolderID','JSID',TempDisabledStr+'预 览(V),编 辑(E),删 除(D)','预览(V),编 辑(E)','','预 览(V),编 辑(E)','','')
}
function ChangeUp()
{
if (FolderID=='0') return;
location.href='JS_Main.asp?JSType='+JSType+'&FolderID='+ParentID;
if (JSType==0)
parent.frames['BottomFrame'].location.href='../Split.asp?OpStr=JS 管理 >> 系统 JS&ButtonSymbol=SysJSList&LabelFolderID='+ParentID;
else
parent.frames['BottomFrame'].location.href='../Split.asp?OpStr=JS 管理 >> 自由 JS&ButtonSymbol=FreeJSList&LabelFolderID='+ParentID;
}
function OpenFolder(FolderID)
{
location.href='JS_Main.asp?JSType='+JSType+'&FolderID='+FolderID;
if (JSType==0)
parent.frames['BottomFrame'].location.href='../Split.asp?OpStr=JS 管理 >> 系统 JS&ButtonSymbol=SysJSList&LabelFolderID='+FolderID;
else
parent.frames['BottomFrame'].location.href='../Split.asp?OpStr=JS 管理 >> 自由 JS&ButtonSymbol=FreeJSList&LabelFolderID='+FolderID;
}
function CreateFolder()
{
if (JSType==0)
OpenWindow('LabelFrame.asp?Url=LabelFolder.asp&PageTitle=新建系统JS目录&LabelType=2&FolderID='+FolderID,450,360,window);
else
OpenWindow('LabelFrame.asp?Url=LabelFolder.asp&PageTitle=新建自由JS目录&LabelType=3&FolderID='+FolderID,450,360,window);
Reload('');
}
function AddJS(TempUrl)
{
if (JSType==0)
{
location.href=TempUrl+'JS/AddSysJS.asp?FolderID='+FolderID+'&JSType="'+JSType+'&Action=AddNew';
parent.frames['BottomFrame'].location.href=TempUrl+'../split.asp?OpStr=JS 管理 >> <font color=red>添加系统 JS</font>&ButtonSymbol=JSAdd';
}
else
{location.href=TempUrl+'JS/AddFreeJS.asp?FolderID='+FolderID+'Action='+Action+'&JSID='+JSID+'&JSType='+JSType
parent.frames['BottomFrame'].location.href=TempUrl+'../split.asp?OpStr=JS 管理 >> <font color=red>添加自由 JS</font>&ButtonSymbol=JSAdd';
}
}
function EditJS(TempUrl,ID)
{ if (KeyWord=='')
{ if (JSType==0)
{
location.href=TempUrl+'EditJS.asp?Page='+Page+'&JSType='+JSType+'&Action=Edit&JSID='+ID;
parent.frames['BottomFrame'].location.href=TempUrl+'../Split.asp?OpStr=JS管理 >> <font color=red>修改系统JS</font>&ButtonSymbol=JSEdit';
}
else
{
location.href=TempUrl+'EditJS.asp?Page='+Page+'&JSType=1&Action=Edit&JSID='+ID;
parent.frames['BottomFrame'].location.href=TempUrl+'../Split.asp?OpStr=JS管理 >> <font color=red>修改自由JS</font>&ButtonSymbol=JSEdit';
}
}
else
{ if (JSType==0)
{
location.href=TempUrl+'EditJS.asp?'+SearchParam+'&Page='+Page+'&JSType='+JSType+'&Action=Edit&JSID='+ID;
parent.frames['BottomFrame'].location.href=TempUrl+'../Split.asp?OpStr=JS管理 >> 搜索系统JS结果 >><font color=red>修改系统JS</font>&ButtonSymbol=JSEdit';
}
else
{
location.href=TempUrl+'EditJS.asp?'+SearchParam+'&Page='+Page+'&JSType=1&Action=Edit&JSID='+ID;
parent.frames['BottomFrame'].location.href=TempUrl+'../Split.asp?OpStr=JS管理 >> 搜索自由JS结果 >> <font color=red>修改自由JS</font>&ButtonSymbol=JSEdit';
}
}
}
function EditFolder(ID)
{
OpenWindow('LabelFrame.asp?Url=LabelFolder.asp&PageTitle=编辑目录&Action=EditFolder&FolderID='+ID,450,360,window);
Reload('');
}
function Edit(TempUrl)
{ GetSelectStatus('FolderID','JSID');
if (!((SelectedFile=='')&&(SelectedFolder=='')))
{
if (SelectedFolder!='')
{
if (TempUrl=='Folder'||TempUrl=='')
if (SelectedFolder.indexOf(',')==-1)
{
EditFolder(SelectedFolder);
}
else alert('一次只能够编辑一个标签目录');
}
if (SelectedFile!='')
{
if (TempUrl!='Folder'||TempUrl=='')
{ if (SelectedFile.indexOf(',')==-1)
EditJS(TempUrl,SelectedFile);
else alert('一次只能够编辑一个JS');
}
}
}
else
{
alert('请选择要编辑的标签或目录');
}
}
function Delete(TempUrl)
{ GetSelectStatus('FolderID','JSID');
if (!((SelectedFile=='')&&(SelectedFolder=='')))
{
if (confirm('删除确认:\n\n真的要执行删除操作吗?'))
{ if (SelectedFolder!='')
if (TempUrl=='Folder'||TempUrl=='')
location='LabelFolderDel.asp?ID='+SelectedFolder;
if (SelectedFile!='')
if (TempUrl!='Folder'||TempUrl=='')
location=TempUrl+'JSDel.asp?Page='+Page+'&JSID='+SelectedFile;
}
}
else alert('请选择要删除的标签目录或标签');
SelectedFile='';
SelectedFolder='';
}
function GetKeyDown()
{
if (event.ctrlKey)
switch (event.keyCode)
{ case 90 : Reload(); break;
case 78 : event.keyCode=0;event.returnValue=false; CreateFolder();break;
case 77 : event.keyCode=0;event.returnValue=false; AddJS('');break;
case 65 : SelectAllElement();break;
case 66 : event.keyCode=0;event.returnValue=false;ChangeUp();break;
case 69 : event.keyCode=0;event.returnValue=false;Edit('');break;
case 68 : Delete('');break;
case 86 : JSView();break;
case 70 : event.keyCode=0;event.returnValue=false;
if (JSType==0)
parent.frames['LeftFrame'].initializeSearch('SysJS')
else
parent.frames['LeftFrame'].initializeSearch('FreeJS')
}
else if (event.keyCode==46)
Delete('');
}
function Reload()
{
location.href='js_Main.asp?FolderID='+FolderID+'&JSType='+JSType+'&'+SearchParam
}
function JSView()
{ GetSelectStatus('FolderID','JSID');
if (SelectedFile!='')
{
window.open('LabelFrame.asp?Url=JSView.asp&JSID='+SelectedFile+'&PageTitle=预览JS显示效果','new','width=620,height=450');
SelectedFile='';
}
else
alert('请选择您要预览的JS!')
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -