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

📄 common.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 $
///////////////////////////////////////////////////////////////////
function setHomepage()
{
	url = WEB_URL;
if (document.all)
    {
        document.body.style.behavior='url(#default#homepage)';
       document.body.setHomePage(url);

    }
    else if (window.sidebar)
    {
    if(window.netscape)
    {
         try
   { 
            netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); 
         } 
         catch (e) 
         { 
   alert( "该操作被浏览器拒绝,如果想启用该功能,请在地址栏内输入 about:config,然后将项 signed.applets.codebase_principal_support 值该为true" ); 
         }
    } 
    var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components. interfaces.nsIPrefBranch);
    prefs.setCharPref('browser.startup.homepage',url);
  }
}
function addFavourite(name)
{
    url = WEB_URL
	if (document.all)
       {
         window.external.addFavorite(url,name);
       }
      else if (window.sidebar)
      {
          window.sidebar.addPanel(name, url, "");
    }
}

function checkbox(form)
{
	for (var i=0;i<form.elements.length;i++)
	{
		var e = form.elements[i];
		if (e.checked==false)
		{
			e.checked = true;
		}
		else
		{
			e.checked = false;
		}
	}
}

function playAll(form)
{
	var music_id = "";
	for(var i = 0; i < form.elements.length-3; i++)
	{
		var e = form.elements[i];
		if(e.checked && i < form.elements.length-4)
		{
			music_id = music_id + e.value +"_";	
		}
		else if(e.checked && i == form.elements.length-4)
		{
			music_id = music_id + e.value;
		}
	}
	if(music_id)
	{
		window.open(WEB_URL+"player.php?id="+music_id);
	}
	else
	{
		alert("请选择歌曲后再点此按钮!");
	}
}
function more(url){if(url != "false")location.href=url}

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(){//点击标题栏触发的事件 
        if(bgObj) document.body.removeChild(bgObj);//删除背景层Div 
        if(title) document.getElementById("msgDiv").removeChild(title);//删除提示框的标题栏 
        if(msgObj) 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 getCommentPage(page,type,typeid)
{
	$.ajax({
		url:WEB_URL+"ajax.php?action=getComment&type="+type+"&typeid="+typeid+"&page="+page,
		type:"POST",
		success:function (data){handComment(data);}
	});
}
function handComment(data)
{
	var arr = eval("("+data+")");
	$$("page_code").innerHTML=arr[1];
	var list = arr[0];
	var html="";
	if(!list){return false;}
	for(var i=0;i<list.length;i++){
		html = html + '<div class="box"><div class="comment_title">Guest:'+list[i]['guest']+' E-mail:<a href="mailto:'+list[i]['mail']+'" title="'+list[i]['mail']+'">'+list[i]['mail']+'</a> QQ:'+list[i]['qq']+' <span title="'+list[i]['from']+'">From:'+list[i]['from']+'</span></div><div class="comment_content">'+list[i]['content'];
		if(list[i]['reply'])
		{
			html = html + '<div class="reply_box"><b>回复:</b>'+ list[i]['reply'] +'</div>';	
		}
		html = html +'<br><br><div class="box">IP:'+list[i]['ip']+' Time:'+list[i]['time']+'</div></div></div>';
	}
	$$("comment_list").innerHTML=html;
}

function comment(type,typeid)
{
	$("#addComment").ajaxSubmit({
		url:WEB_URL+"ajax.php?action=addComment&type="+type+"&typeid="+typeid,
		data:$("#addCommnet").formSerialize(),
		success:function (data){
				var info = eval("("+data+")");
				showDialog(info['msg']);
				if(info['reload']== "1"){
					getCommentPage('1',type,typeid);
				}
			}
	});
}
function $$(id){return document.getElementById(id)}
function download(id)
{
	if(id){
		$.ajax({
			url:WEB_URL+"download.php?id="+id,
			success:function(data){var info = eval("("+data+")"); if(info['msg']){showDialog(info['msg']); setTimeout(function(){location.href=info['url']},2000);}else{location.href = info['url']}}
		});
	}
}
function reportError(id)
{
	if(id)
	{
		$.ajax({
			url:WEB_URL+"ajax.php?action=reportError&id="+id,
			type:"POST",
			success:function(data){showDialog(data)}
		})
	}
}
function recommend(id)
{
	if(id)
	{
		$.ajax({
			url:WEB_URL+"ajax.php?action=recommend&id="+id,
			type:"POST",
			success:function(data){showDialog(data)}
		})
	}
}
function mRegister()
{
	if($$('name').value==""){showDialog('会员名不能为空!');return false;}
	if($$('pwd1').value==""){showDialog('密码不能为空!'); return false;}
	if($$('pwd2').value==""){showDialog('密码不能为空!'); return false;}
	if($$('mail').value==""){showDialog('邮箱部能为空!'); return false; }
	if($$('pwdquestion').value==""){showDialog("密码提示问题不能为空!");return false;}
	if($$('pwdanswer').value==""){showDialog("密码提示问题答案不能为空!");return false;}
	return true;
}
function mLogin(url)
{
	if($$('name').value==""){showDialog('会员名不能为空!');return false;}
	if($$('pwd').value==""){showDialog('密码不能为空!'); return false;}
	return true;
}
function showDiv(id)
{
	var styleDis = $$(id).style.display;
	$$(id).style.display = styleDis != "none" ? "none" : "block";
}
function addHit(type,typeid)
{
	$.ajax({
		url:WEB_URL+"ajax.php?action=addHit&type="+type+"&typeid="+typeid,
		success:function(data){var info = eval("("+data+")"); $$("add_hit").innerHTML = info['hit']}
	});
}

⌨️ 快捷键说明

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