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

📄 admin.js

📁 STCMS 音乐系统 v2.5 build 090501: 为达到最佳效果
💻 JS
字号:
///////////////////////////////////////////////////////////////////
// Author:daong | E-mail: dahongy@gmail.com
// Copyright &copy Http://www.phpstcms.cn
// This is not a free software, please to pay for more functions
// $Id: 2009-05-01 version V2.5 $
///////////////////////////////////////////////////////////////////
if(navigator.appVersion.indexOf("MSIE") == -1)
{
	alert("本程序后检测倒你的浏览器不是Microsoft Internet Explorer!\n\n由于本后台对IE支持最好,其它的浏览器下可能存在功能缺陷!");
}
$("*").ajaxStart(function(){showLoad()});
$("*").ajaxError(function(data){alert("Ajax 查询错误,其检查浏览器兼容或者访问本程序网站获取帮助!")});
$("*").ajaxComplete(function(){hideLoad();})
var STCMS_VERSION = "V2.5 build 20090501";
function showLoad()
{
	if($$("load_span")){hideLoad();}
	var x = event.x;
	var y = event.y;
	var loadObj = document.createElement("span");
	loadObj.setAttribute("id","load_span");
	loadObj.style.top=(y+10)+"px";
	loadObj.style.left=(10+x)+"px";
	loadObj.style.position = "absolute";
	loadObj.innerHTML = "<image src='../images/loading.gif' width='30' height='30'>正在加载中……";
	loadObj.style.zIndex = "1000";
	document.body.appendChild(loadObj);
}
function hideLoad()
{
	if($$("load_span")) {document.body.removeChild($$("load_span")) }	
}

function showDialog(str,width,height,isClose,time)
{ 
   var msgw,msgh,bordercolor,titleMsg;
	titleMsg = "提示信息";
	time = time ? time : 3000;
    msgw = width ? width : 600;	//提示窗口的宽度 
    msgh = height ? height : 75;	//提示窗口的高度 
    titleheight=20;  //提示窗口标题高度 
    bordercolor="#6692cb";	//提示窗口的边框颜色 
    titlecolor="#99CCFF";	//提示窗口的标题颜色 

    var sWidth,sHeight; 
    sWidth=document.body.offsetWidth;	//浏览器工作区域内页面宽度 
    sHeight=screen.height;	//屏幕高度(垂直分辨率) 

    var bgObj=document.createElement("div");//创建一个div对象(背景层) 
    bgObj.setAttribute("id","bgDiv");
    bgObj.style.position="absolute"; 
    bgObj.style.top="0px"; 
    bgObj.style.background="#FFFFFF"; 
    bgObj.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75"; 
    bgObj.style.opacity="0.6"; 
    bgObj.style.left="0"; 
    bgObj.style.width=sWidth + "px"; 
    bgObj.style.height=sHeight + document.documentElement.scrollTop+"px"; 
    bgObj.style.zIndex   =  "10000"; 
    document.body.appendChild(bgObj);//在body内添加该div对象 

	var msgObj=document.createElement("div")//创建一个div对象(提示框层) 
    msgObj.setAttribute("id","msgDiv"); 
    msgObj.setAttribute("align","center"); 
    msgObj.style.background="white"; 
    msgObj.style.border="1px   solid  "   +   bordercolor; 
    msgObj.style.position   =  "absolute"; 
    msgObj.style.left   =  (sWidth-msgw)/2+230; 
    msgObj.style.top   =  (sHeight-msgh)/2-50; 
    msgObj.style.font="12px/1.6em   Verdana,   Geneva,   Arial,   Helvetica,   sans-serif"; 
    msgObj.style.marginLeft =  "-225px"   ; 
    msgObj.style.marginTop  = -75+document.documentElement.scrollTop+"px"; 
    msgObj.style.width  =   msgw   +  "px"; 
    msgObj.style.height  = msgh   +  "px"; 
    msgObj.style.textAlign  =  "center"; 
    msgObj.style.lineHeight  = "25px"; 
    msgObj.style.zIndex = "10001"; 

    var   title=document.createElement("div");//创建一个h4对象(提示框标题栏) 
    title.setAttribute("id","msgTitle"); 
    title.setAttribute("align","left"); 
    title.style.margin="0"; 
    title.style.padding="3px"; 
    title.style.background=bordercolor; 
    //title.style.filter="progid:DXImageTransform.Microsoft.Alpha(startX=20, startY=20, finishX=100, finishY=100,style=1,opacity=75,finishOpacity=100);"; 
    title.style.opacity="0.75"; 
    title.style.border="1px solid  "   +   bordercolor; 
    title.style.height="12px"; 
    title.style.font="12px   Verdana,   Geneva,   Arial,   Helvetica,   sans-serif"; 
    title.style.color="white"; 
    title.style.cursor="pointer"; 
    title.innerHTML=titleMsg; 
    title.onclick=removeObj; 

    var   button=document.createElement("input");//创建一个input对象(提示框按钮) 
    button.setAttribute("type","button"); 
    button.setAttribute("value","关闭"); 
    button.style.width = "60px"; 
    button.style.align = "center"; 
    button.style.marginLeft = "250px"; 
    button.style.marginBottom = "10px"; 
    button.style.background = bordercolor; 
    button.style.border="1px  solid " + bordercolor; 
    button.style.color="white"; 
    button.onclick=removeObj; 

	function   removeObj(){//点击标题栏触发的事件 
        document.body.removeChild(bgObj);//删除背景层Div 
        document.getElementById("msgDiv").removeChild(title);//删除提示框的标题栏 
        document.body.removeChild(msgObj);//删除提示框层 
    } 
    document.body.appendChild(msgObj);//在body内添加提示框div对象msgObj 
    document.getElementById("msgDiv").appendChild(title);//在提示框div中添加标题栏对象title 

    var   txt=document.createElement("div");//创建一个p对象(提示框提示信息) 
    txt.setAttribute("id","msgTxt"); 
    txt.style.margin="0"; 
	txt.style.height = msgh-35+"px";
	txt.style.color="red";
	txt.style.fontSize = "16px";
    txt.style.padding="3px"; 
    txt.innerHTML=str;//来源于函数调用时的参数值 
    document.getElementById("msgDiv").appendChild(txt);//在提示框div中添加提示信息对象txt 
    document.getElementById("msgDiv").appendChild(button);//在提示框div中添加按钮对象button 
	if(isClose){
		setTimeout(function(){removeObj();},time)	
	}
	button.focus();
}

function del(url,id)
{
	if(confirm("删除后将无法恢复数据,是否真的要删除?"))
	{
		location.href = url + "?action=del&id=" + id;	
	}
}

function edit(sUrl,sId)
{
	location.href = sUrl + "?action=edit&id=" + sId;
}
function checkAll(id)
{
	$("#"+id+" input[type=checkbox]").each(function(){$(this).attr("checked", true);});
}
function cancleAll(id)
{
	$("#"+id+" input[type=checkbox]").each(function(){$(this).attr("checked",false);});
}
function delAll(id,url)
{
	var ids = "";
	$("#"+id+" input[type=checkbox][checked]").each(function(){ids = ids + $(this).val() + ",";});
	if(!ids)
	{showDialog("请选择列表!",'400','50',true,1000);return false;}
	else
	{
		if(confirm("删除后将无法恢复数据,是否真的要删除?"))
		{
			location.href = url + "?action=del&id=" + ids;
		}
	}
}
function cancle()
{
	history.back();	
}
function selectAdminType()
{
		var type = $$("admin_group").value;
		if(type == "categoryAdmin")
		{
			$.ajax({
				url:"ajax.php?action=getCategory",
				type:"POST",
				success:function(data){$$("categorySelect").innerHTML = data}
			});
		}
		else
		{
			$$("categorySelect").innerHTML="";
		}
}
function tblStruct(table)
{
	$.ajax({
		url:"data.php?action=tblStruct&table="+table,
		success:function(data){$$("result").innerHTML = "<pre>"+data+"</pre>";}
	});	
}
function backUp(table)
{
	var url="data.php?action=backup&table="+table;
	location.href=url;
}
function truncate(table)
{
	if(confirm("数据将无法恢复,你真的要清空吗?"))
	{
		var url="data.php?action=truncate&table="+table;
		location.href=url;
	}
}
function delBackUp(id)
{
	if(confirm("你真的要删该除备份吗?"))
	{
		var url="data.php?action=delbackup&id="+id;
		location.href=url;
	}
}
function backUpAll()
{
		location.href = "data.php?action=backup&table=allTable";
}
function delBackUpAll(id)
{
	var ids = "";
	$("#"+id+" input[type=checkbox][checked]").each(function(){ids = ids + $(this).val() + ",";});
	if(!ids)
	{showDialog("请选择列表!",'400','50',true,1000);return false;}
	else
	{
		if(confirm("删除后将无法恢复数据,是否真的要删除?"))
		{
			location.href = "data.php?action=delbackup&id=" + ids;
		}
	}
}
function repair()
{
	location.href="data.php?action=repair";	
}
function optimize()
{
	location.href="data.php?action=optimize";	
}
function alter()
{
	location.href="data.php?action=alter";	
}
function recover(id)
{
	if(confirm("还原后数据将改变,你真的要还原该次备份吗?"))	
	{
		location.href="data.php?action=recover&from=file&id="+id;
	}
}
function showDiv(id)
{
	var styleDis = $$(id).style.display;
	$$(id).style.display = styleDis != "none" ? "none" : "block";
}
function inputMedia(path,type)
{
	if(confirm("真的要录入该文件或文件夹下的音乐文件吗?")){
		location.href="input.php?action=input&path="+path+"&type="+type;
	}
}
function $$(id){return document.getElementById(id)}
function login(form,url)
{
	$("#"+form).ajaxSubmit({
		url:url,
		data:$("#"+form).formSerialize(),
		success:function(data){
				var info = eval("("+data+")");
				if(info['type']=="n")
				{
					showDialog(info['msg'])	;
				}
				else if(info['type']=="y")
				{
					showDialog(info['msg']);
				}
				else
				{
					alert(info['msg']);	
				}
				if(info['url']) location.href=info['url'];
		}
	});	
}

function selectSort(value)
{
	value = value ? value : $$("category").value; 
	$.ajax({
		   url:"ajax.php?action=selectSort&category="+value,
		   success:function(data){$$("select_sort").innerHTML=data}
	});
}
function selectArtist(value)
{
	$.ajax({
		   url:"ajax.php?action=selectArtist",
		   data:"sort="+value+"&category="+$$("category").value,
		   success:function(data){$$("select_artist").innerHTML=data}
	});
}
function selectOneArtist(value)
{
	$$("artist").value = value;
}
function selectSpecialSort()
{
	$.ajax({
		url:"ajax.php?action=selectSpecialSort",
		data:"category="+$$("category").value+"&artist="+$$("artist").value,
		success:function(data){$$("sort_list").innerHTML=data}
	});
}
function selectOneSort(sortid)
{
	$.ajax({
		url:"ajax.php?action=selectOneSort",
		data:"sort="+sortid+"&category="+$$("category").value,
		success:function(data){$$("special_list").innerHTML=data}
	});
}
function html(action)
{
	if(confirm("确定要生成吗?")){location.href="html.php?action="+action}
}

function checkVersion()
{
	$.ajax({
		url:"http://www.phpstcms.cn/check_version.php",
		data:"version="+STCMS_VERSION+"&type=STCMS_music",
		success:function(data){alert(data)}
	});
}
function getVersion()
{
	document.write(STCMS_VERSION);
}

⌨️ 快捷键说明

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