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

📄 starblogmain.js

📁 dev控件,C#开发中使用的控件
💻 JS
📖 第 1 页 / 共 5 页
字号:
var isStar=(getBitMapFlag(7)==1);
var isBiz=(getBitMapFlag(5)==1);

var PAGE_TITLE_NUM=20;
var PAGE_COMMENT_NUM=(parent.g_iUin==19990210)?45:15;
var MAX_COMMENT_LEN=4500;
var MAX_BLOG_LEN=20000;
var MAX_BLOG_TITLE_LEN=128;
var BLOG_DOMAIN=parent.g_NewBlog_Domain;
var IMGCACHE_DOMAIN=parent.imgcacheDomain;//根据前置机修改
var CGI_PATH="/cgi-bin/blognew/";
var COMMENT_LIST_TMP = "blogStaticCommentList"; 
var BUSY_MSG="服务器忙,请您稍候再试";
var ownerSig="";
//if(!!parent.g_XDoc[3] && !!selectXMLNode(parent.g_XDoc[3],"/data/signature"))
//	ownerSig=selectXMLNode(parent.g_XDoc[3],"/data/signature").text;

var serrCallback=function(){dalert(null,BUSY_MSG)};
var enterBlog=(/\/blog/i).test(parent.location.href);

var portraitTipsTimeout;
var blogLoginFnList=[];//登录后需要使用的功能function队列(FIFO)

if(parent.g_JData["portraitList"]===undefined)	parent.g_JData["portraitList"]={};

//日志标题效果影射表,type是效果种类
//0是className;
//1是prefix;
//2是postfix(如果type:0,后面的string中可以用"|"分割出categoryTips)
//3是标题内容替换
var titleEffectMap={
	"1":{type:2,string:"图",className:"icon_pic"},
	"2":{type:0,string:"xmd"},
	"8":{type:1,string:"转"},
	"16":{type:1,string:"顶"},
	"128":{type:0,string:"mobileblog|用手机发彩信随时随地写日志|彩信|http://m-qzone.qq.com/?from=qzoneJD"},
	"256":(parent.g_iLoginUin==parent.g_iUin?{type:2,string:"审核未通过"}:{type:3,string:"[此文章内容审核未通过]"}),//C17
	"1024":{type:0,string:"mobileblog|手机登陆z.qq.com,随时随地记录我心情|手机Qzone|http://3gqq.qq.com/qzone"},
	"2048":{type:0,string:"videoblog|视频日志|QQVideo|http://video.qq.com"},
	"4096":{type:2,string:"Flash",className:"icon_flash"},
	"8192":{type:2,string:"视频",className:"icon_video"},
	"16384":{type:2,string:"音频",className:"icon_music"},
	"32768":{type:0,string:"mobileblog|短信日志|短信|http://m-qzone.qq.com/function_3.jsp"},
	"131072":{type:0,string:"ppblog|网购经历|网购经历|http://www.paipai.com"},
	"1048576":{type:0,string:"qmailblog|QQMail日志|QQ邮箱|http://mail.qq.com"},
	"2097152":{type:1,string:"荐"},
	"4194304":(parent.g_iLoginUin==parent.g_iUin?{type:2,string:"审核中"}:{type:3,string:"[此文章内容正在审核中]"}),//C17
	"8388608":{type:2,string:"信纸",className:"icon_letter"},
	"16777216":{type:1,string:"看美女,找帅哥,来城市达人!(<a href='http://city.qzone.qq.com' target='_blank'>http://city.qzone.qq.com</a>)"},
	"33554432":{type:2,string:"动感影集",className:"icon_vphoto"},
	"67108864":{type:2,string:"QQ秀泡泡",className:"icon_qqshow_tip"},
	"268435456":{type:0,string:"cft|赈灾捐款"},
	"524288":{type:0,string:"|QQ校友|QQ校友|http://xiaoyou.qq.com"}
};

//各个模版定义模版中的空格不可取消
var blogTemplete = {
	voteList:'<table class="poll_table"><caption class="none"></caption><colgroup><col /><col style="width:auto" /><col style="width:6em" /><col style="width:3em" /></colgroup><thead class="none"><tr><th scope="col" class="bbor">选项</th><th scope="col" class="bbor">票数</th></tr></thead><tbody><%repeat_0 match="/data/optionlist"%><tr title="<%=@title%> -- <%=@count%>票 [<%=@percentStr%>]"><td class="blog_vote_option"><span class="fix"><label for="option_<%=@id%>"><input type="<%=@optionType%>" name="voteOption" value="<%=@id%>" id="option_<%=@id%>" /><%=@title%></label></span></td><td ><div class="poll_plan<%=@icon%>"><span class="plan" style="width:<%=@barWidth%>"></span> <%=@count%>票[<%=@percentStr%>]</div></td><td></td></tr><%_repeat_0%></tbody></table><div class="bt_vote"><button class="bt_tx2" onclick="vote()">投票</button></div>',
	blogStaticCommentList:'<%repeat_0 match="/replylist"%><div class="comment_list bgr"><div class="comment_info bg2"><span class="right"><span id="mirror_<%=@replyid%>"><%=@mirror_%></span><span id="btnReply<%=@replyid%>" class="ownermode <%=@replybutton%>"><a href="javascript:;" class="c_tx" onClick="showReplyEditor(<%=@replyid%>);return false;"><img src="http://'+imgcacheDomain+'/ac/b.gif" alt="回复该评论" class="icon_person_face" />回复</a> | </span><a href="javascript:;" title="引用该评论" style="text-underline:none" onclick="quoteReply(<%=@replyid%>);return false;" class="c_tx <%=@canquote%>"><img src="/ac/b.gif" class="icon_info_message" />引用</a><span class="<%=@reportbutton%>"> | </span><span class="<%=@reportbutton%> <%=@campusHide%>" style="cursor:pointer" id="btnReport<%=@replyid%>" onclick="reportReply(\'<%=@replyuin%>\',<%=@replyid%>,<%=@replyarch%>);" title="举报此评论"><img src="http://'+parent.imgcacheDomain+'/ac/b.gif" alt="举报" class="icon_report" align="absmiddle"/>举报</span><span class="ownermode"> | </span><a href="javascript:;" onclick="delReply(\'<%=@replyuin%>\', <%=@replyid%>,<%=@replyarch%>);return false;" class="ownermode" style="cursor:pointer" title="删除该评论"><img src="/ac/b.gif" class="icon_del" align="absmiddle"/>删除</a></span><span name="floorNum"><%=@floornum%></span>楼 <span id="effectNick_<%=@replyid%>"><%=@effectNick_%></span>&nbsp;<span><%=@angel_%></span>&nbsp;评论时间:<span class="c_tx3"><%=@replytime%></span></div><div class="comment_cont"><%=@replycontentParsed%><div style="margin-top:13px;"><div id="masterComment<%=@replyid%>" class="<%=@replyclass%>" style="padding-top:5px;"><%=@revert%></div><div id="mcEditor<%=@replyid%>" style="display:none;"></div></div></div></div><div class="mode_sign showsign" style="display:none"><%=@replyautograph%></div></div><%_repeat_0%>'	
};

var campusName = {};
var campusLink = {};
var replyUins = [];
var replyCampusUins = [];
var campusportaritRqList = [];

function BlogTopCache(){
	this.contentHSList={};
	this.voteHSList={};
	this.titleList={};
	this.spaceOwnerSign=null;
	this.visitorTrace=null;
	this.categoryList=null;
	this.listCache={};
	this.titlePageMap={};
	this.replyNumUpdateHSmap={};
}

window.firstPage=window.lastPage=window.prePage=window.nextPage=function(){};

//名博商博单独PV统计
function sendUPV(blogid){
	if(isStar){
		send_stat_request("http://n.qzone.qq.com/cgi-bin/pvuv/set_pvuv?uin="+parent.g_iUin+"&module=1&submodule=1&debug=1&jl="+Math.random(), 100);	
	}
	else if(isBiz) {
		send_stat_request("http://p3.qzone.qq.com/fcg-bin/fcg_brand_pu_view?branduin="+parent.g_iUin+"&command=4&info=2,0&sds="+Math.random(),1000);
	}
}

//发送PV请求
function sendPV(action, domain){
	var pvCurDomain = "";
	if(!!domain) pvCurDomain = domain;
	else pvCurDomain = (isBiz?"biz.qzone.qq.com":(isStar?"star.qzone.qq.com":"blog.qzone.qq.com"));
	var pvCurUrl="/"+action;
	var data=[
		"dm="+pvCurDomain,
		"url="+encodeURIComponent(pvCurUrl),
	];
	var r=/https?:\/\/(\w+(\.\w+)+)(\/[^?#]*)?/;
	var m=document.referrer.match(r);
	if(!!m){
		if(m.length>1)
			data.push("rdm="+m[1]);
		if(m.length>3)
			data.push("rurl="+encodeURIComponent(m[3]));
	}
	var c=parent.getCookie("pvid");
	if(!c){
		c=(Math.round(Math.random()* 2147483647)*(new Date().getUTCMilliseconds()))%10000000000;
	}
	data.push("pvid="+c);

	send_stat_request("http://pingfore.qq.com/pingd?scr=-&scl=-&lang=-&java=1&cc=-&pf=-&tz=-8&ct=-&vs=3.3&tt=-&"+data.join("&")+"&sds="+Math.random(),1000);
}

//错误输出
function dalert(o,s,t,type){
	if(!type)
		type=3;
	if(!!o && !!o.error)
		s=o.error.msg;
	parent.showMsgbox(s,type,(!!t)?t:2500);
}

//发送小纸条
function fnWriteMsg(uin){
	if (checkLogin()<=10000){
		parent.showLoginBox("blogComment",false,"发小纸条前需要先确认您的身份");
		return;
	}
	parent.showMsgSender(uin);
}

//由CGI返回的long型时间转换成友好时间字符串
function long2time(n){
	var _time=new Date(n*1000);
	return ([_time.getFullYear(),"年",_time.getMonth()+1,"月",_time.getDate(),"日 ",_time.getHours(),"时",_time.getMinutes(),"分",_time.getSeconds(),"秒"]).join("");
}

//由CGI返回的long型时间转换成友好时间字符串
function long2ShortTime(n){
	var _time=new Date(n*1000);
	var _m = _time.getMinutes().toString();
	var _s = _time.getSeconds().toString();
	_m = _m.length<2?"0"+_m:_m;
	_s = _s.length<2?"0"+_s:_s;

	return ([_time.getHours(),":",_m,":",_s]).join("");
}

//修正主客模式显示
function setLoginStatus(){
	var uin=checkLogin();
	var o=document.styleSheets["dynamicStyle"];
	if(!o) return; // 在编辑页面中该对象不存在,而且页面中没有对应的样式
	try{
		with(o){
			(rules || cssRules)[1].style.display=(uin>10000 && uin==parent.g_iUin)?"":"none";//owner 主人类显示控制
			(rules || cssRules)[2].style.display=(uin>10000)?"":"none";//logins 登录用户显示控制
			(rules || cssRules)[3].style.display=(uin!=parent.g_iUin)?"":"none";//clients 客人显示控制
			(rules || cssRules)[5].style.display=(!!window.currentDraftID ? "" : "none");//草稿内容控制
			(rules || cssRules)[6].style.display=(!!window.currentDraftID ? "none" : "");//草稿内容控制
		}
	}catch(err) {}
}

//登录后回调,调整状态
function loginCallback(){
	setLoginStatus();
	try{
		while(blogLoginFnList.length>0)
			(blogLoginFnList.shift())();  // callback func maybe undefined
	}catch(err) {}
}

//分离效果位域
function effectSplit(n){
	if(n==0 || isNaN(n))
		return [];
	var resultArr=[];
	var s=n.toString(2);
	var m=s.length;
	var re=/^1[0]*/;
	while(m>0){
		resultArr.push((1<<(m-1))+"");
		s=s.replace(re,"");
		m=s.length
	}
	return resultArr;
}

//填充缓存
function fillCache(o){
	if(!!o && !!o.data){
		if(!!o.data.replylist){//正文以及评论列表部分
			if(!!o.data.content)
				parent.g_XDoc["blogRoot"].contentHSList[o.data.blogid]=o.data;
			var t=contentProperty.currentCommentPage;
			if(t==0){
				contentProperty.pageIndexMap[t]="0_0_1";
				if(!contentProperty.pageList)
					contentProperty.pageList={};
				contentProperty.pageList[contentProperty.pageIndexMap[t]]=parent.g_XDoc["blogRoot"].contentHSList[contentProperty.currentBlogid];
			}
			else if(t>0){
				if(!contentProperty.pageList)
					contentProperty.pageList={};
				var _o=contentProperty.pageList[contentProperty.pageIndexMap[t-1]];
				if(!!_o){
					var hs=([_o.next_arch,_o.next_pos,1]).join("_");
					contentProperty.pageIndexMap[t]=hs;
					contentProperty.pageList[hs]=o.data;
				}
			}
		}		
	}
}

//准备翻页处理函数
function preparePageNavigator(o){
	if(!!parent.g_XDoc["blogRoot"].listCache.bDraftFlag) {
		$("pageDiv").style.display = "none";
		return;
	}

	if(!!$("pageDiv")) $("pageDiv").style.display = "";

	if(!!o && !!o.data){
		if(!!o.data.replylist){//评论列表准备
			if(!!o.data.replynum)
				contentProperty.totalCommentNumber=o.data.replynum;

			var tp=Math.ceil(contentProperty.totalCommentNumber/PAGE_COMMENT_NUM);

			with(contentProperty){
				if(currentCommentPage==tp)
					currentCommentPage--;
				if(currentCommentPage<0){
					currentCommentPage=tp+currentCommentPage+1;
				}
			}

			if(o.data.next_pos==-2) {
				window.nextPage=window.lastPage=new Function("return false;");
				updatePageIndex($("commentPageIndexBottom"), 1, false);
				updatePageIndex($("commentPageIndexTop"), 1, false);
			}
			else{
				var n=PAGE_COMMENT_NUM;
				if(contentProperty.currentCommentPage==(tp-2)){
					n=contentProperty.totalCommentNumber%PAGE_COMMENT_NUM;
					if(n==0)
						n=PAGE_COMMENT_NUM;
				}
				window.nextPage=new Function("with(contentProperty){lastCommentPage=currentCommentPage;currentCommentPage++;}getOnePageComment("+n+","+o.data.next_arch+","+o.data.next_pos+",1,blogCommentListCallback,1);return true;");
				window.lastPage=getLatestCommentPage;
				updatePageIndex($("commentPageIndexBottom"), 1, true);
				updatePageIndex($("commentPageIndexTop"), 1, true);
			}
			
			if(o.data.pre_pos==-2){
				window.prePage=window.firstPage=new Function("return false;");
				contentProperty.lastCommentPage=contentProperty.currentCommentPage=0;
				updatePageIndex($("commentPageIndexBottom"), -1, false);
				updatePageIndex($("commentPageIndexTop"), -1, false);
			}
			else{
				window.prePage=new Function("with(contentProperty){lastCommentPage=currentCommentPage;currentCommentPage--;}getOnePageComment("+PAGE_COMMENT_NUM+","+o.data.pre_arch+","+o.data.pre_pos+",0,blogCommentListCallback,1);return true;");
				window.firstPage=getFirstCommentPage;
				updatePageIndex($("commentPageIndexBottom"), -1, true);
				updatePageIndex($("commentPageIndexTop"), -1, true);
			}
		}
	}
	else {
		window.firstPage=window.lastPage=window.prePage=window.nextPage=function(){};
	}
}

//显示页码导航
function showPageNums(){
	var total=0;
	var cp=0;
	var tp=0;
	var _t;
	if(!!window.contentProperty){
		total=contentProperty.totalCommentNumber;
		tp=Math.ceil(contentProperty.totalCommentNumber/PAGE_COMMENT_NUM);
		cp=(contentProperty.currentCommentPage+1);
		var sp=$n("span", "totalCommentNum");
		sp[1].innerHTML=sp[0].innerHTML=total;
		sp=$n("span","totalPageNum");
		sp[1].innerHTML=sp[0].innerHTML=tp;
		sp=$n("span", "currentPageNum");		
		sp[1].innerHTML=sp[0].innerHTML=(cp==-1)?tp:cp;
	}
	else{
		var t=parent.g_XDoc["blogRoot"].listCache;
		total=t.currentTotalNum;
		tp=Math.ceil(t.currentTotalNum/PAGE_TITLE_NUM);
		cp=(t.currentPage+1);
		$("totalCommentNum").innerHTML=total;
		$("totalPageNum").innerHTML=tp;
		if(tp==0)
			cp=-1;
		$("currentPageNum").innerHTML = ((cp==-1) ? tp :(cp>tp ? tp : cp));
	}
}

//将给定的标题列表数组系列化成html
function listSerialize(listname,l){
	if(!!l && !!listname)
		return parent.doFill(blogTemplete[listname],l,0);
	else
		return "";
}

//解析完善CGI返回的categoryList数据 PS:会改变JSON数据
function prepareBlogContent(o){
	var rcPool=parent.g_XDoc["blogCommentCount"];

	clearArray(crRequestList);
	if(rcPool[o.data.blogid]===undefined){
		rcPool[o.data.blogid]={};
		rcPool[o.data.blogid].c=rcPool[o.data.blogid].reply=o.data.replynum;
	}
	if(rcPool[o.data.blogid].read===undefined || rcPool[o.data.blogid].read=="-")
		crRequestList.push("blogids="+o.data.blogid);
	else
		o.data.viewnum=rcPool[o.data.blogid].read;

	o.data.title=o.data.title.convSP();
	if(!!o.data.parsed)
		return;
		
	//处理日志正文 !!新增属性contentParsed 保护起content供转载
	window._showLinkBubbleSwitch = parent.isBiz; //商博原文去掉链接气泡

	//处理时间特性
	o.data.pubtimeParse = (!!window.currentDraftID ? "保存于:" : "发表于:") + long2time(o.data.pubtime);

	o.data.authorsign=ubbReplace(ownerSig.convSP().convCR(),"face anchor image email sign glow_limit font",null,null,IMGCACHE_DOMAIN);

	o.data.parsed=true;
	window._showLinkBubbleSwitch = false;
}

//获取日志的访问量和评论量
function getBlogCR(cb){
	if(!cb)
		cb=blogCRcallback;
	if(crRequestList.length>0){
		parent.loadJsonData("crget","http://"+BLOG_DOMAIN+CGI_PATH+"blog_get_countlist?type=1&uin="+parent.g_iUin+"&"+crRequestList.join("&")+"&sds="+Math.random(),cb,serrCallback,true,void(0),"_Callback");			
	}
}

//异步获取阅读数的回调
function blogCRcallback(o){
	if(!!o.error)
		return;
	var rcPool=parent.g_XDoc["blogCommentCount"];
	var ac;
	for(var i=0;i<o.data.itemlist.length;i++){

⌨️ 快捷键说明

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