//评论和消息 function ajax_submit (job) { var stat_html = document.getElementById('stat_html').checked ? 1:0; var stat_ubb = document.getElementById('stat_ubb').checked? 1:0; var stat_emot = document.getElementById('stat_emot').checked ? 1:0; var stat_property = document.getElementById('stat_property').checked ? 1:0; var v_replier = document.getElementById('v_replier').value ' '; var v_repurl = document.getElementById('v_repurl').value; var v_repemail = document.getElementById('v_repemail').value; var v_content = document.getElementById('v_content').value ' '; var v_password = document.getElementById('v_password').value; var v_id = document.getElementById('v_id').value; var v_reppsw = (document.getElementById('v_reppsw')) ? document.getElementById('v_reppsw').value : ''; var v_security_plus; if (document.getElementById('v_security')) { var v_security = document.getElementById('v_security').value; if (v_security=='') { alert(jslang[10]); 返回 false; } v_security_plus="&v_security=" v_security; } 其他 { v_security_plus=''; } if (v_replier=='' || v_content==''|| v_replier==' ' || v_content==' ' ) { alert(jslang[11]); 返回 false; } document.getElementById('btnSubmit').value=jslang[12]; document.getElementById('btnSubmit').disabled='disabled'; if (shutajax==0) { //目前适用于 IE、Safari、Mozilla 和 Opera v_replier = blogencode(v_replier); v_repurl = blogencode(v_repurl); v_repemail = blogencode(v_repemail); v_content = blogencode(v_content); v_password = blogencode(v_password); v_id = blogencode(v_id); v_reppsw = blogencode(v_reppsw); var postData = “unuse=unuse&onetimecounter=”onetimecounter”&v_id=“v_id”&v_replier=“v_replier”&v_password=“v_password”&v_repurl=“v_repurl”&v_repemail=“v_repemail”&v_content=“v_content”&stat_html=“stat_html”&stat_ubb =“stat_ubb”&stat_emot=“stat_emot”&v_reppsw=“v_reppsw”&stat_property=“stat_property v_security_plus; var gourl=absbaseurl "visit.php?ajax=on&job="job; makeRequest(gourl, 'quickreply', 'POST', postData); } else { document.getElementById('visitorinput').submit(); } }
//Ctrl Enter 键提交(Textarea) function ctrlenterkey (eventobject){ if(eventobject.ctrlKey && eventobject.keyCode==13) { document.getElementById("btnSubmit").click(); } }
//管理员回复 function ajax_adminreply (commentid) { if (shutajax==0) { var admid='adminreplycontent' commentid; var adminreplycontent = blogencode(document.getElementById(admid).value); var postData = “unuse=unuse&adminreplycontent=”adminreplycontent; var gourl=absbaseurl "admin.php?ajax=on&go=" switchcomandmes "_addadminreply_" commentid; currentcommentid=commentid; makeRequest(gourl, 'quickadminreply', 'POST', postData); } else { var admid='formadminreply' commentid; document.getElementById(admid).submit(); } }
function ajax_adminreply_edit (commentid, rptype) { switchcomandmes=rptype; ajax_adminreply(commentid); }
function ajax_editcomment(repid, submitaction, onetimecounter) { var admid='editcomcontent' repid; var v_content = blogencode(document.getElementById(admid).value); var editjob=(submitaction=='回复') ? 'editreply' : '编辑消息'; var postData = “unuse=unuse&onetimecounter=”onetimecounter”&v_content=”v_content; var gourl=absbaseurl "visit.php?ajax=on&go=" editjob "&repid=" repid; currentcommentid=repid; makeRequest(gourl, 'quickeditcomment', 'POST', postData); }
//编码字符串 function blogencode (str) { str=encodeURIComponent(str); if (is_moz) str=str.replace(/
/g,”
"); //在 IE 中,新行编码为 rn,而在 Mozilla 中为 n return str; }
//头像选择 function changeavatar (slname, area ) { var current=document.getElementById(slname); var realvalue=current.options[current.selectedIndex].value; var areashow=document.getElementById(area); if ( areashow) { if (realvalue!='' && realvalue!=null) { areashow.innerHTML="" ; } else { areashow.innerHTML=jslang[13]; } } }
//插入表情s 函数插入( emotcode) { var current=document.getElementById('v_content'); var emot="[emot]" emotcode "[/emot]" if { if ( current.value!='' && current.value!=null) { 当前.值=emot; } 其他 { current.value=emo; } document.getElementById('v_content').focus(); } }
// 显示/隐藏侧边栏 function showHideSidebar(){ try{ var objSidebar=document.getElementById("sidebar"); var objContent=document.getElementById("content"); if(objSidebar.className!="sidebar-hide"){ objSidebar.className="sidebar-hide"; objSidebar.style.display="none"; objContent.className="content-wide"; setCookie('sidebaroff', 1,null, null, null, false); }其他{ objSidebar.className="sidebar"; objSidebar.style.display="block"; objContent.className="content"; setCookie('sidebaroff', 0,null, null, null, false); } }catch(e){} }
函数 loadSidebar(){ 尝试{ var objSidebar=document.getElementById("sidebar"); var objContent=document.getElementById("content"); var sidebaroff=getCookie ('sidebaroff'); if(sidebaroff==1){ objSidebar.className="sidebar-hide"; objSidebar.style.display="none"; objContent.className="content-wide"; }其他{ objSidebar.className="sidebar"; objSidebar.style.display="block"; objContent.className="content"; } }catch(e){} }
//媒体链接 function playmedia(strID,strType,strURL,intWidth ,intHeight) { var objp=document.getElementById(strID); if (!objp) 返回 false; if (objp.style.display!='none') { objp.innerHTML=''; objp.style.display='none'; } else { objp.innerHTML=makemedia(strType,strURL,intWidth,intHeight,strID); objp.style.display='block'; } }
//媒体构建 function makemedia (strType,strURL,intWidth,intHeight,strID) { var strHtml; switch(strType) { case 'wmp': strHtml=""; 休息; 案例“swf”: strHtml=""; 休息; case 'flv': var FU = {movie:"images/others/mediaplayer.swf",width:intWidth,height: intHeight,majorversion:"8",build:"0",bgcolor:" #FFFFFF",allowfullscreen:"true",flashvars:"file=" strURL "&fullscreenpage=images/others/fullscreen.html&fsreturnpage=" location.href};UFO.create(FU, strID); 休息; case 'real': strHtml="; <对象 classid='clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA' width='" intWidth "' height='44'>< ;param name='autostart' value='true' //>"; 休息; } return strHtml; }
//字体大小控制 function doZoom(size) { document.getElementById('zoomtext').style.fontSize=size 'px'; }
//Cookie function setCookie(name,value,expiry,path,domain,secure) { var nameString = name "=" value; var expiryString = (expiry == null) ? "" : " ;expires = " expiry.toGMTString(); var pathString = (path == null) ? “”:“”;路径=“路径; var domainString = (path == null) ? “”:“”;域=“域; var secureString = (secure) ?";secure" :""; document.cookie = nameString expiryString pathString domainString secureString; }
函数 getCookie(名称){ var CookieFound = false; var start = 0; var end = 0; var CookieString = document.cookie; var i = 0;
while (i <= CookieString.length) { start = i ; 结束 = 开始 名称.长度; if (CookieString.substring(start, end) == 名称){ CookieFound = true; 休息; } i ; }
if (CookieFound){ start = end 1; end = CookieString.indexOf(";",start); if (end < start) end = CookieString.length; return unescape(CookieString.substring(start, end)); } 返回 ""; }
function deleteCookie(name) { var expires = new Date(); expires.setTime (expires.getTime() - 1); setCookie(名称,“删除 Cookie”,过期,null,null,false); }
function refreshsecuritycode(areaid, inputid) { if (document.getElementById(areaid)) { var rnds=Math.random(); document.getElementById(areaid).innerHTML=""; } if (document.getElementById(inputid)) document.getElementById(inputid).value=''; }
function ajax_login () { if (shutajax==0) { var username = blogencode(document.getElementById('username').value); var password = blogencode(document.getElementById('password').value); var tmpSavecookie; for (var i=1; i tmpSavecookie='savecookie' i; if (document.getElementById(tmpSavecookie).checked) { var savecookie = blogencode(document.getElementById(tmpSavecookie).value); 休息; } } var postData = "unuse=unuse&username="用户名"&password="密码"&savecookie="savecookie; if (document.getElementById('securitycode')) postData ="&securitycode=" blogencode(document.getElementById('securitycode').value); var gourl=absbaseurl "login.php?ajax=on&job=ajaxverify"; makeRequest(gourl, 'quicklogin', 'POST', postData); } }
函数decodetburl(str,ishidden,uniqueid){ var resultstr =''; if (ishidden==1) {//隐藏! var randomnumber1=Math.floor(Math.random()*10 1); var randomnumber2=Math.floor(Math.random()*10 1); resultstr="" jslang[66] " " randomnumber1 "" str ""; } else { var codestr; codestr=str.split('%'); var seed=codestr[0]; for (var i=1; i resultstr =String.fromCharCode(codestr[i]-seed); } } return resultstr; }
function submithiddentbanswer(uniqueid) { var randomnumber1=(document.getElementById("qa" uniqueid)) ? parseInt(document.getElementById("qa" uniqueid).innerHTML) : 0; var randomnumber2=(document.getElementById("qb" uniqueid)) ? parseInt(document.getElementById("qb" uniqueid).innerHTML) : 0; var anssubmited=(document.getElementById("ans" uniqueid)) ? parseInt(document.getElementById("ans" uniqueid).value) : 0; if (randomnumber1 randomnumber2!=anssubmited) alert (jslang[67]); 其他 { var resultstr=(document.getElementById("answertb" uniqueid))? document.getElementById("answertb" uniqueid).innerHTML : null; resultstr=decodetburl (resultstr, 0, 0); if (document.getElementById("showtbq" uniqueid)) document.getElementById("showtbq" uniqueid).innerHTML=resultstr; } }
function getprotectedblog (blogid, way) { var blogpsw=blogencode(document.getElementById('entrypsw' blogid).value); currentblogid=blogid; var postData = "unuse=unuse&job=getcontentonly&way="way"&blogid="blogid"&blogpsw="blogpsw; if (shutajax==0) { var gourl=absbaseurl "visit.php?ajax=on"; makeRequest(gourl, 'quickgetprotectedblog', 'POST', postData); } }
function promptreppsw () { var pswproperty=document.getElementById('stat_property'); if (!pswproperty) 返回; else if (pswproperty.checked) { var pswtxt=prompt(jslang[69],''); if (pswtxt==null || pswtxt=='') { pswproperty.checked=''; 返回; } else { if (pswtxt.length>12) { alert(jslang[70]); promptreppsw(); } document.getElementById('v_reppsw').value=pswtxt; } } else { document.getElementById('v_reppsw').value=''; } }
function getprotectedreply (repid, way, onetimecounter) { var reppsw=blogencode(document.getElementById('reppsw' repid).value); currentcommentid=repid; var postData = "unuse=unuse&job=getreplyonly&way="way"&reppsw="reppsw"&repid="currentcommentid"&onetimecounter"onetimecounter; if (shutajax==0) { var gourl=absbaseurl "visit.php?ajax=on"; makeRequest(gourl, 'quickeditcomment', 'POST', postData); } }