//Examinethebrowser 检测浏览器的函数
varuserAgent=navigator.userAgent.toLowerCase();
varis_opera=(userAgent.indexOf('opera')!=-1);
varis_saf=((userAgent.indexOf('applewebkit')!=-1)||(navigator.vendor=='AppleComputer,Inc.'));
varis_webtv=(userAgent.indexOf('webtv')!=-1);
varis_ie=((userAgent.indexOf('msie')!=-1)&&(!is_opera)&&(!is_saf)&&(!is_webtv));
varis_ie4=((is_ie)&&(userAgent.indexOf('msie4.')!=-1));
varis_moz=((navigator.product=='Gecko')&&(!is_saf));
varis_kon=(userAgent.indexOf('konqueror')!=-1);
varis_ns=((userAgent.indexOf('compatible')==-1)&&(userAgent.indexOf('mozilla')!=-1)&&(!is_opera)&&(!is_webtv)&&(!is_saf));
varis_ns4=((is_ns)&&(parseInt(navigator.appVersion)==4));
varis_mac=(userAgent.indexOf('mac')!=-1);
//Globalregisters
varcurrentblogid;
varcurrentstarid;
varcurrentcommentid;
varswitchcomandmes;
varsecuritycodejs=null;
varonetimecounter=1;
//Getabsolutepath,fixbugofIEwhenbasepathisset
vargotourl=location.href;
varabsbaseurl;
varabspath;
varr_identifier=gotourl.lastIndexOf("/read.php/");
varr_identifier2=gotourl.lastIndexOf("/post/");
varr_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)+"/";
varsimplegotourl=absbaseurl.replace("http://",'');
r_identifier2=simplegotourl.indexOf("/");
abspath=simplegotourl.substr(r_identifier2+1);
}else{
absbaseurl='';
abspath=null;
}
//IsAjaxsupported?
if((is_ie&!is_ie4)||is_moz||is_saf||is_opera)varshutajax=0;
elsevarshutajax=1;
//Forfirefox,tellFirefoxnottodisplaythecontentyouinputinlastsession
if(is_moz){
vartmp_c=document.getElementById('v_content');
if(tmp_c)tmp_c.value='';
}
//Show/HideaDIV
functionshowhidediv(id){
try{
varpanel=document.getElementById(id);
if(panel){
if(panel.style.display=='none'){
panel.style.display='block';
}else{
panel.style.display='none';
}
}
}catch(e){}
}
functionaddhtml(id,htmlcode,uniqueid){
varpanel=document.getElementById(id);
varhiddenpannel=document.getElementById(uniqueid);
if(panel){
hiddenpannel.value='';
hiddenpannel.value=panel.innerHTML;
panel.innerHTML=hiddenpannel.value+htmlcode;
hiddenpannel.value+=htmlcode;
}
}
functionshowadminreply(divid){
switchcomandmes='reply';
varcleanid=divid.replace('com_','');
varinputcontent="<formaction='"+absbaseurl+"admin.php?go=reply_addadminreply_"+cleanid+"'method='post'id='formadminreply"+cleanid+"'>";
inputcontent+=jslang[0]+"<br/><textareacols='66'rows='3'name='adminreplycontent'id='adminreplycontent"+cleanid+"'></textarea><br/>";
inputcontent+="<inputtype='button'onclick="ajax_adminreply('"+cleanid+"');returnfalse;"value='"+jslang[1]+"'class='button'/><inputtype='reset'value='"+jslang[2]+"'class='button'/><inputtype='button'value='"+jslang[3]+"'onclick="hideadminreply('"+divid+"');"class='button'/></form>";
document.getElementById(divid).innerHTML=inputcontent;
document.getElementById(divid).style.display='block';
}
functionshowadminreplyformessage(divid){
switchcomandmes='message';
varcleanid=divid.replace('com_','');
varinputcontent="<formaction='"+absbaseurl+"admin.php?go=message_addadminreply_"+cleanid+"'method='post'id='formadminreply"+cleanid+"'>";
inputcontent+=jslang[0]+"<br/><textareacols='66'rows='3'name='adminreplycontent'id='adminreplycontent"+cleanid+"'></textarea><br/>";
inputcontent+="<inputtype='button'onclick="ajax_adminreply('"+cleanid+"');returnfalse;"value='"+jslang[1]+"'class='button'/><inputtype='reset'value='"+jslang[2]+"'class='button'/><inputtype='button'value='"+jslang[3]+"'onclick="hideadminreply('"+divid+"');"class='button'/></form>";
document.getElementById(divid).innerHTML=inputcontent;
document.getElementById(divid).style.display='block';
}
functionhideadminreply(divid){
document.getElementById(divid).innerHTML='';
document.getElementById(divid).style.display='none';
}
functionshowdelblog(blogid){
varurldel=absbaseurl+"admin.php?go=entry_deleteblog_"+blogid+'';
if(confirm(jslang[4])){
window.location=urldel;
}
else{
return;
}
}
functioncomfirmurl(urldel){
if(confirm(jslang[5])){
window.location=absbaseurl+urldel;
}
else{
return;
}
}
functionshowdeladminreply(repid){
varurldel=absbaseurl+"admin.php?go=reply_deladminreply_"+repid+'';
if(confirm(jslang[6])){
if(shutajax==1)window.location=urldel;
else{
urldel+="&ajax=on";
currentcommentid=repid;
makeRequest(urldel,'quickdeladminreply','GET',null);
}
}
else{
return;
}
}
functionshowdeladminreplyformessage(repid){
varurldel=absbaseurl+"admin.php?go=message_deladminreply_"+repid+'';
if(confirm(jslang[7])){
if(shutajax==1)window.location=urldel;
else{
urldel+="&ajax=on";
currentcommentid=repid;
makeRequest(urldel,'quickdeladminreply','GET',null);
}
}
else{
return;
}
}
functionshowdelreply(repid,blogid){
varurldel=absbaseurl+"admin.php?go=reply_delreply_"+repid+'-'+blogid;
if(confirm(jslang[8])){
if(shutajax==1)window.location=urldel;
else{
urldel+="&ajax=on";
currentcommentid=repid;
makeRequest(urldel,'quickdelreply','GET',null);
}
}
else{
return;
}
}
functionshowdelreplyformessage(repid){
varurldel=absbaseurl+"admin.php?go=message_delreply_"+repid;
if(confirm(jslang[9])){
if(shutajax==1)window.location=urldel;
else{
urldel+="&ajax=on";
currentcommentid=repid;
makeRequest(urldel,'quickdelreply','GET',null);
}
}
else{
return;
}
}
functionshowblockreply(repid,blogid){
varurldel=absbaseurl+"admin.php?go=reply_block_"+repid+'-'+blogid;
if(shutajax==1)window.location=urldel;
else{
urldel+="&ajax=on";
currentcommentid=repid;
makeRequest(urldel,'quickdelreply','GET',null);
}
}
functionshowblockmessage(repid){
varurldel=absbaseurl+"admin.php?go=message_block_"+repid;
if(shutajax==1)window.location=urldel;
else{
urldel+="&ajax=on";
currentcommentid=repid;
makeRequest(urldel,'quickdelreply','GET',null);
}
}
/*--AJAXRELATEDFUNCTIONS--*/
//Starring
functiondostar(blogid){
if(shutajax==0){
gourl=absbaseurl+"admin.php?go=star&ajax=on&blogid="+blogid;
currentblogid=blogid;
currentstarid="starid"+blogid;
makeRequest(gourl,'starblog','GET',null);
}else{
gourl=absbaseurl+"admin.php?go=star&ajax=off&blogid="+blogid;
window.location=gourl;
}
}
//CommentandMessage
functionajax_submit(job){
varstat_html=document.getElementById('stat_html').checked?1:0;
varstat_ubb=document.getElementById('stat_ubb').checked?1:0;
varstat_emot=document.getElementById('stat_emot').checked?1:0;
varstat_property=document.getElementById('stat_property').checked?1:0;
varv_replier=document.getElementById('v_replier').value+'';
varv_repurl=document.getElementById('v_repurl').value;
varv_repemail=document.getElementById('v_repemail').value;
varv_content=document.getElementById('v_content').value+'';
varv_password=document.getElementById('v_password').value;
varv_id=document.getElementById('v_id').value;
varv_reppsw=(document.getElementById('v_reppsw'))?document.getElementById('v_reppsw').value:'';
varv_security_plus;
if(document.getElementById('v_security')){
varv_security=document.getElementById('v_security').value;
if(v_security==''){
alert(jslang[10]);
returnfalse;
}
v_security_plus="&v_security="+v_security;
}else{
v_security_plus='';
}
if(v_replier==''||v_content==''||v_replier==''||v_content==''){
alert(jslang[11]);
returnfalse;
}
document.getElementById('btnSubmit').value=jslang[12];
document.getElementById('btnSubmit').disabled='disabled';
if(shutajax==0){//CurrentlyforIE,Safari,MozillaandOpera
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);
varpostData="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;
vargourl=absbaseurl+"visit.php?ajax=on&job="+job;
makeRequest(gourl,'quickreply','POST',postData);
}else{
document.getElementById('visitorinput').submit();
}
}
//Ctrl+Enterkeysubmitting(Textarea)
functionctrlenterkey(eventobject){
if(eventobject.ctrlKey&&eventobject.keyCode==13){
document.getElementById("btnSubmit").click();
}
}
//Adminreply
functionajax_adminreply(commentid){
if(shutajax==0){
varadmid='adminreplycontent'+commentid;
varadminreplycontent=blogencode(document.getElementById(admid).value);
varpostData="unuse=unuse&adminreplycontent="+adminreplycontent;
vargourl=absbaseurl+"admin.php?ajax=on&go="+switchcomandmes+"_addadminreply_"+commentid;
currentcommentid=commentid;
makeRequest(gourl,'quickadminreply','POST',postData);
}else{
varadmid='formadminreply'+commentid;
document.getElementById(admid).submit();
}
}
functionajax_adminreply_edit(commentid,rptype){
switchcomandmes=rptype;
ajax_adminreply(commentid);
}
当前1/2页12下一页阅读全文