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

📄 common.js

📁 Comblog 是一个适合在企事业单位、俱乐部及各类团体中使用的信息交流平台
💻 JS
字号:
function mh_topics_up(){
	var objpt = getobjectxy($("mh_topics"));
	$("mh_topics").className = "mh_select";
	$("mh_topics").firstChild.className = "select";
	$("ms_topics").style.left = objpt.x + "px";
	if (isiexplorer()){
		$("ms_topics").style.top = (objpt.y + objpt.height - 5) + "px";
		$("ms_topics").style.width = objpt.width + "px";
	}else{
		$("ms_topics").style.top = (objpt.y + objpt.height - 1) + "px";
		$("ms_topics").style.width = (objpt.width - 2) + "px";
	}
	$("ms_topics").style.display = "";
}
function mh_topics_down(){
	$("mh_topics").className = "mh_normal";
	$("mh_topics").firstChild.className = "";
	$("ms_topics").style.display = "none";
}
function previewimage(theimage, maxsize){
	if (theimage.width>0){
		if (theimage.width>maxsize){
			theimage.width = maxsize;
			theimage.height = Math.floor((theimage.height * maxsize) / theimage.width);
		}
	}
}
function sc_select_count(element){
	if (element==null) return false;
		if (typeof(element.length)=="undefined"){
			if (element.checked){
				return 1;
			}else{
				return 0;
			}
		}else{
			var icount = 0;
			for(i=0;i<element.length;i++){
				if (element[i].checked){
					icount += 1;
				}
			}
		return icount;
	}
}
function sc_select_all(current, element){
	if (element==null) return false;
	if (typeof(element.length)=="undefined"){
		element.checked = current.checked;
	}else{
		for(i=0;i<element.length;i++){
			element[i].checked = current.checked;
		}
	}
}
function sc_select_state(element){
	var parentTag = "checkbox";
	var curObject = element;
	while(parentTag!="TR"){
		if (element.parentElement!=null) {
			curObject = curObject.parentElement;
			parentTag = curObject.tagName;
		}else{
			return ;
		}
	}
	if ($("selectall")!=null){
		if (element.checked){
			curObject.bgColor = "#CEE4ED";
			if (!$("selectall").checked) {
				var elements = $n(element.name);
				if (sc_select_count(elements)==elements.length) { $("selectall").checked = true; }
			}
		}else{
			curObject.bgColor = "#ffffff";
			if ($("selectall").checked) { $("selectall").checked = false; }
		}
	}
}

//	***********************************************************************************||
//	显示用户信息
//	***********************************************************************************||
function show_user_card(theobj, userid){
	var local = getlocal();
	var objpt = getobjectxy(theobj);
	var bodyw = document.body.clientWidth;
	var bodyh = document.body.clientHeight + document.body.scrollTop;
	var ucard = $("user_card_" + userid);
	if (ucard!=null){
		ucard.style.display = "";
		ucard.style.top = ((objpt.y + ucard.offsetHeight + 12) > bodyh?(objpt.y-ucard.offsetHeight - 3):objpt.y + 12) + "px";
		ucard.style.left = ((objpt.x + ucard.offsetWidth) > bodyw?(objpt.x-ucard.offsetWidth-12):objpt.x+12) + "px";
	}else{
		this.loaded = function(t){
			ucard.innerHTML = t;
		}
		var theajax = new ajax(false, this.loaded, null);
		ucard = $c("DIV");
		ucard.className = "cls_card";
		ucard.style.position = "absolute";
		ucard.style.top = ((objpt.y + ucard.offsetHeight + 12) > bodyh?(objpt.y-ucard.offsetHeight - 3):objpt.y + 12) + "px";
		ucard.style.left = ((objpt.x + ucard.offsetWidth) > bodyw?(objpt.x-ucard.offsetWidth-12):objpt.x+12) + "px";
		ucard.id = "user_card_" + userid;
		ucard.innerHTML = "<img src=\""+local +"resource/skins/default/icon_loading.gif\" align=\"absmiddle\"> 正在获取用户信息,请等待...";
		theajax.get(local + "web/service/ajax_action.aspx?Command=User_Detail&UserID=" + userid, true);
		ucard.onmouseover = function(){
			this.style.display = "";
		}
		ucard.onmouseout = function(){
			this.style.display = "none";
		}
		$a(ucard);
	}
}
function hide_user_card(userid){
	if ($("user_card_" + userid)!=null){
		$("user_card_" + userid).style.display = "none";
	}
}
function do_topic_judge(topicid){
	this.success = function(t){
		var _result = parseInt(trim(t));
		if (_result==0){
			window.alert("推荐主题成功。");
		}else if (_result==2){
			window.alert("对不起!同一个IP或用户一天只能对一个主题推荐一次。");
		}else if (_result==3){
			window.alert("对不起!作者不能推荐自己的主题。");
		}else if (_result==4){
			window.alert("对不起!此主题不存在或已删除。");
		}else if (_result==5){
			window.alert("对不起!您还没有登录,推荐主题之前请先登录。");
		}else{
			window.alert("推荐主题失败。");
		}
	}
	this.error = function(){
		window.alert("推荐主题失败。");
	}
	var local = getlocal();
	var theajax = new ajax(false, this.success, this.error);
	theajax.get(local + "web/service/ajax_action.aspx?Command=Topic_Jugde&TopicID="+topicid, true); 
}
function do_special_topic_vote(specialid, topicid){
	this.success = function(t){
		var _result = parseInt(trim(t));
		if (_result==0){
			window.alert("为专辑主题投票成功。");
		}else if (_result==2){
			window.alert("对不起!同一个IP或用户只能为一个专辑中的一个主题投票一次。");
		}else if (_result==3){
			window.alert("对不起!您还没有登录,投票之前请先登录。");
		}else{
			window.alert("为专辑主题投票失败。");
		}
	}
	this.error = function(){
		window.alert("为专辑主题投票失败。");
	}
	var local = getlocal();
	var theajax = new ajax(false, this.success, this.error);
	theajax.get(local + "web/service/ajax_action.aspx?Command=Special_Topic_Jugde&specialid="+specialid+"&topicid="+topicid, true);
}

function on_search_topics(){
	if (trim($("skey").value)==""){
		window.alert("对不起!搜索关键字不能为空。");
		$("skey").focus();
		return false;
	}
	return true;
}

function do_topic_quite(quiteid){
	if ($("quiteid")!=null){
		document.Form1.quiteid.value = quiteid;
	}
	window.open("#reply", "_self", "");
}

function on_topic_reply(){
	if (IWE_Frame!=null){
		if (IWE_Design_Mode)
		{
			document.Form1.content.value = IWE_Filter(IWE_Frame.document.body.innerHTML);
		}else{
			document.Form1.content.value = IWE_Frame.document.body.innerText
		}
	}
	if (trim(document.Form1.content.value)==""){
		window.alert("回复内容不能为空。");
		if (IWE_Frame!=null){
			IWE_Frame.focus();
		}else{
			document.Form1.content.focus();			
		}
		return false;
	}
	return true;
}

function on_topic_action(){
	if (trim(document.Form1.remark.value)==""){
		window.alert("请在下面选择或输入执行此操作的理由。");
		document.Form1.remark.focus();
		return false;
	}
	return true;
}

function do_topic_delete(parentid, topicid){
	if (parentid==0){
		if (confirm("您确定要删除这个主题吗?")){
			window.open("../Service/Topic_Action.aspx?Command=Topic_Delete&topicid=" + topicid, "_self", "");
		}
	}else{
		if (confirm("您确定要删除这条回复吗?")){
			window.open("../Service/Topic_Action.aspx?Command=Topic_Delete&topicid=" + topicid, "_self", "");
		}
	}
}

⌨️ 快捷键说明

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