//브라우저 검사 检测浏览器的函数 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('호환') == -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);
//전역 등록 var currentblogid; var currentstarid; var currentcommentid; var switchcomandmes; var securitycodejs=null; var onetimecounter=1;
//절대 경로 가져오기, 기본 경로 설정 시 IE의 버그 수정 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; } //Ajax가 지원되나요? if ((is_ie & !is_ie4) || is_moz || is_saf || is_opera) var shutajax=0; 그 외 var shutajax=1;
//firefox의 경우 마지막 세션에서 입력한 콘텐츠를 표시하지 않도록 Firefox에 알립니다. if(is_moz){ var tmp_c=document.getElementById('v_content'); if (tmp_c) tmp_c.value=''; }
//표시/숨기기 p function showhidep(id){ try{ var panel=document.getElementById(id); if(패널){ if(panel.style.display=='none'){ panel.style.display='block'; }else{ panel.style.display='none'; } } }catch(e){} }
기능 addhtml(id, htmlcode, uniqueid) { var panel=document.getElementById(id) ; var hiddenpannel=document.getElementById(uniqueid); if(패널){ hiddenpannel.value=''; hiddenpannel.value=panel.innerHTML; panel.innerHTML=hiddenpannel.value htmlcode; hiddenpannel.value =htmlcode; } }
함수 showadminreply(pid) { switchcomandmes='답장'; var cleanid=pid.replace('com_', ''); var inputcontent="
함수 showadminreplyformessage(pid) { switchcomandmes='message'; var cleanid=pid.replace('com_', ''); var inputcontent=""; document.getElementById(pid).innerHTML=inputcontent; document.getElementById(pid).style.display='block'; }
함수 hideadminreply(pid) { document.getElementById(pid).innerHTML=''; document.getElementById(pid).style.display='none'; }
함수 showdelblog(blogid) { var urldel=absbaseurl "admin.php?go=entry_deleteblog_" blogid ''; if(confirm(jslang[4])){ window.location=urldel; } else { 반환; } }
함수 showdeladminreply(repid) { var urldel=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 { 반환; } }
함수 showdeladminreplyformessage(repid) { var urldel=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); } } 그렇지 않으면 { 반환; } }
함수 showdelreply(repid, blogid) { var urldel=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); } } 그렇지 않으면 { 반환; } }
함수 showdelreplyformessage(repid) { var urldel=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); } } 그렇지 않으면 { 반환; } }
함수 showblockreply(repid, blogid) { var urldel=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); } }
함수 showblockmessage(repid) { var urldel=absbaseurl "admin.php?go=message_block_" repid; if (shutajax==1) window.location=urldel; else { urldel ="&ajax=on"; currentcommentid=repid; makeRequest(urldel, 'quickdelreply', 'GET', null); } }
/* -- AJAX 관련 기능 -- */ //별표 함수 dostar(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; } }
//댓글 및 메시지 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; } else { 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 키 제출(텍스트 영역) 함수 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(); } }
함수 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); }
//인코드 문자열 함수 blogencode(str) { str=encodeURIComponent(str); if (is_moz) str=str.replace(/
/g, "
");//IE에서 새 줄은 rn으로 인코딩되지만 Mozilla에서는 n입니다. return str; }
//Avatar 선택 함수 변경 아바타(slname,area) ) { var current=document.getElementById(slname); var realvalue=current.options[current.selectedIndex].value; var areashow=document.getElementById(area); Areashow) { if (realvalue!='' && realvalue!=null) { areashow.innerHTML="" ; } else { areashow.innerHTML=jslang[13] } } }
//Emot 삽입 s 함수 insertmot( emotcode) { var current=document.getElementById('v_content') var emot="[emot]" emotcode "[/emot]"; if (현재) { if ( current.value!='' && current.value!=null) { 현재.값 =감정; } 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){} }
//미디어 링크 기능 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'; } }
//미디어 빌드 함수 makemedia(strType,strURL,intWidth,intHeight,strID) { var strHtml; 스위치(strType) { case 'wmp': strHtml=""; 휴식; 사례 'swf': strHtml=""; 휴식; 케이스 '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); 휴식; 사례 '실제': strHtml=" "; 휴식; } strHtml을 반환합니다. }
//글꼴 크기 제어 함수 doZoom(size) { document.getElementById('zoomtext').style.fontSize=size 'px'; }
//쿠키 함수 setCookie(name,value,expiry,path,domain,secure) { var nameString = name "=" value; var expiryString = (만료 == null) ? "" : " ;만료 = " expiry.toGMTString(); var pathString = (경로== null) ? "" : " ;경로 = " 경로; var domainString = (경로== null) ? "" : " ;도메인 = " 도메인; var secureString = (보안) ?";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 ; end = start name.length; if (CookieString.substring(start, end) == name){ CookieFound = true; 휴식; } 나 ; }
if (CookieFound){ 시작 = 끝 1; end = CookieString.indexOf(";",start); if (end < start) end = CookieString.length; return unescape(CookieString.substring(start, end)); } 반환 ""; }
function deleteCookie(이름) { var expires = new Date(); expires.setTime (expires.getTime() - 1); setCookie( name , "쿠키 삭제", expires,null,null,false); }
함수 새로 고침 보안 코드(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); 휴식; } } 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 " > " randomnumber2 "= <입력 유형 ='button' onclick='submithiddentbanswer("" Uniqueid "");' value='" jslang[1] "'/>" str ""; } else { var codestr; codestr=str.split('%'); var seed=codestr[0]; for (var i=1; i resultstr =String.fromCharCode(codestr[i]-seed); } } 반환 결과str; }
함수 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; } }
함수 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); } }
함수 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=''; } }
함수 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); } }