//Examine the browser 检测浏览器的函数 var userAgent = navigator.userAgent.toLowerCase(); var is_opera = (userAgent.indexOf('opera') != -1); var is_saf = ((userAgent.indexOf('applewebkit') != -1) || (navigator.vendor == 'Apple Computer, Inc.')); var is_webtv = (userAgent.indexOf('webtv') != -1); var is_ie = ((userAgent.indexOf('msie') != -1) && (!is_opera) && (!is_saf) && (!is_webtv)); var is_ie4 = ((is_ie) && (userAgent.indexOf('msie 4.') != -1)); var is_moz = ((navigator.product == 'Gecko') && (!is_saf)); var is_kon = (userAgent.indexOf('konqueror') != -1); var is_ns = ((userAgent.indexOf('compatible') == -1) && (userAgent.indexOf('mozilla') != -1) && (!is_opera) && (!is_webtv) && (!is_saf)); var is_ns4 = ((is_ns) && (parseInt(navigator.appVersion) == 4)); var is_mac = (userAgent.indexOf('mac') != -1);
//Global registers var currentblogid; var currentstarid; var currentcommentid; var switchcomandmes; var securitycodejs=null; var onetimecounter=1;
//Get absolute path, fix bug of IE when base path is set var gotourl = location.href; var absbaseurl; var abspath; var r_identifier=gotourl.lastIndexOf("/read.php/"); var r_identifier2=gotourl.lastIndexOf("/post/"); var r_identifier3=gotourl.lastIndexOf("/tag/"); if (r_identifier==-1) { r_identifier=r_identifier2; } if (r_identifier==-1) { r_identifier=r_identifier3; } if (r_identifier!=-1) { absbaseurl = gotourl.substr(0, r_identifier)+"/"; var simplegotourl=absbaseurl.replace("http://", ''); r_identifier2=simplegotourl.indexOf("/"); abspath=simplegotourl.substr(r_identifier2+1); } else { absbaseurl=''; abspath=null; } //Is Ajax supported? if ((is_ie & !is_ie4) || is_moz || is_saf || is_opera) var shutajax=0; else var shutajax=1;
//For firefox, tell Firefox not to display the content you input in last session if (is_moz) { var tmp_c=document.getElementById('v_content'); if (tmp_c) tmp_c.value=''; }
//Show/Hide a p function showhidep(id){ try{ var panel=document.getElementById(id); if(panel){ if(panel.style.display=='none'){ panel.style.display='block'; }else{ panel.style.display='none'; } } }catch(e){} }
function addhtml (id, htmlcode, uniqueid) { var panel=document.getElementById(id); var hiddenpannel=document.getElementById(uniqueid); if(panel){ hiddenpannel.value=''; hiddenpannel.value=panel.innerHTML; panel.innerHTML=hiddenpannel.value+htmlcode; hiddenpannel.value+=htmlcode; } }
function showadminreply (pid) { switchcomandmes='reply'; var cleanid=pid.replace('com_', ''); var inputcontent="
function showadminreplyformessage (pid) { switchcomandmes='message'; var cleanid=pid.replace('com_', ''); var inputcontent=""; document.getElementById(pid).innerHTML=inputcontent; document.getElementById(pid).style.display='block'; }
function hideadminreply (pid) { document.getElementById(pid).innerHTML=''; document.getElementById(pid).style.display='none'; }
function showdelblog(blogid) { var urldel=absbaseurl+"admin.php?go=entry_deleteblog_"+blogid+''; if(confirm(jslang[4])){ window.location=urldel; } else { return; } }
//Admin reply 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=='reply') ? 'editreply' : 'editmessage'; 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); }
//encode string function blogencode (str) { str=encodeURIComponent(str); if (is_moz) str=str.replace(/%0A/g, "%0D%0A"); //In IE, a new line is encoded as \r\n, while in Mozilla it's \n return str; }
//Avatar Selection 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]; } } }
//Insert Emots function insertemot (emotcode) { var current=document.getElementById('v_content'); var emot="[emot]"+emotcode+"[/emot]"; if (current) { if (current.value!='' && current.value!=null) { current.value+=emot; } else { current.value=emot; } document.getElementById('v_content').focus(); } }
function loadSidebar(){ try{ 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"; }else{ objSidebar.className="sidebar"; objSidebar.style.display="block"; objContent.className="content"; } }catch(e){} }
//Media Link function playmedia(strID,strType,strURL,intWidth,intHeight) { var objp=document.getElementById(strID); if (!objp) return 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'; } }
//Media Build function makemedia (strType,strURL,intWidth,intHeight,strID) { var strHtml; switch(strType) { case 'wmp': strHtml=""; break; case 'swf': strHtml=""; break; 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); break; case 'real': strHtml=" "; break; } return strHtml; }
//Font size control function doZoom(size) { document.getElementById('zoomtext').style.fontSize=size+'px'; }
function getCookie (name) { var CookieFound = false; var start = 0; var end = 0; var CookieString = document.cookie; var i = 0;
while (i <= CookieString.length) { start = i ; end = start + name.length; if (CookieString.substring(start, end) == name){ CookieFound = true; break; } i++; }
if (CookieFound){ start = end + 1; end = CookieString.indexOf(";",start); if (end < start) end = CookieString.length; return unescape(CookieString.substring(start, end)); } return ""; }
function deleteCookie(name) { var expires = new Date(); expires.setTime (expires.getTime() - 1); setCookie( name , "Delete Cookie", expires,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<=5; i++) { tmpSavecookie='savecookie'+i; if (document.getElementById(tmpSavecookie).checked) { var savecookie = blogencode(document.getElementById(tmpSavecookie).value); break; } } var postData = "unuse=unuse&username="+username+"&password="+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); } }
function decodetburl (str, ishidden, uniqueid) { var resultstr=''; if (ishidden==1) { //Hidden! var randomnumber1=Math.floor(Math.random()*10+1); var randomnumber2=Math.floor(Math.random()*10+1); resultstr=""+jslang[66]+" "+randomnumber1+"+"+randomnumber2+"="+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]); else { 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) return; else if (pswproperty.checked) { var pswtxt=prompt(jslang[69],''); if (pswtxt==null || pswtxt=='') { pswproperty.checked=''; return; } 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); } }
Kenyataan:
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn