// MAIN Javascript /* this_url="세부적인 보드링크 url"; this_skin="현재출력 스킨 디렉토리의 url/path"; is_Admin="관리자 접속이면 1"; is_Member='회원로그인이면 1'; */ //-------------------------------------------------------------------------------------------------------# var is_iphone=0; var is_appbrowser=0; // set_standalone_apple_webkit(); // 아이폰 APP 전용모드 없애려면 이 라인을 제거 if(!location.href.match(/\#\w+$/) && !is_appbrowser){ try{ window.addEventListener('load', function(){ setTimeout(scrollTo, 0, 0, 1); }, false); } catch(e){} } if(typeof(fix_navi) != 'undefined' && fix_navi=='hidden'){ document.write(""); try{ window.addEventListener('load', function(){ top.scrollTo(1, 0); }, false); } catch(e){} } if(typeof(document.readyState)=='undefined'){ // fireFox document.readyState='loading'; setTimeout(function(){document.readyState='complete';},2000); } //-------------------------------------------------------------------------------------------------------# function TnT_addEvent(obj,type,listener){ if(document.readyState=='complete' || type=='load' || type=='onload') TnT_addEvent_now(obj,type,listener); else TnT_addEvent_onload(obj,type,listener); } function TnT_addEvent_onload(obj,type,listener){ if(window.addEventListener){ window.addEventListener("load",function(){ TnT_addEvent_now(obj,type,listener); },false); } else{ window.attachEvent('onload',function(){ TnT_addEvent_now(obj,type,listener); }); } } function TnT_addEvent_now(obj,type,listener){ if(typeof(obj)=='string'){ if(obj.match(/^\./)){ // class var str_class=obj.replace(/^\W/g,''); var tags = document.getElementsByTagName('*'); for(i in tags){ if(tags[i].className==str_class) TnT_addEvent_action(tags[i],type,listener); } } else TnT_addEvent_action(document.getElementById(obj.replace(/^\W/g,'')),type,listener); // id } else TnT_addEvent_action(obj,type,listener); // object } function TnT_addEvent_action(obj,type,listener){ if(!obj) return; if(window.addEventListener) obj.addEventListener(type.replace(/^on/i,''),listener,false); else if(window.attachEvent) obj.attachEvent('on'+type.replace(/^on/i,''),listener); } // ---------------------------- * function TnT_delEvent(obj,type,listener){ if(typeof(obj)!='object') obj=document.getElementById(obj); if(obj.removeEventListener) obj.removeEventListener(type.replace(/^on/i,''),listener,false); else obj.detachEvent('on'+type.replace(/^on/i,''),listener); } // ---------------------------- * function get_event_target(evt){ var is_target; if(!evt) evt = window.event; if(evt.target) is_target = evt.target; else if(evt.srcElement) is_target = evt.srcElement; else return; if(is_target.nodeType == 3) is_target = is_target.parentNode; // safari bug return is_target; } //-----------------------------------------------------------------------------------------------------------# // bottom tool bar var is_touchmove =0; ToolBarCtll_start = function(check){ if(check=='none') is_touchmove = 1; if(is_touchmove) return; toolBarLayerFloat.style.display='none'; is_touchmove = 1; } ToolBarCtll_end = function(){ if(is_touchmove) touchend_motion=setTimeout("ToolBarCtll_motion()",500); } ToolBarCtll_scroll = function(){ ToolBarCtll_motion(); } ToolBarCtll_motion = function(){ try{clearTimeout(touchend_motion);}catch(e){} is_touchmove = 0; toolBarLayerFloat.style.opacity = '0'; toolBarLayerFloat.style.display='block'; toolBarLayerFloat.style.bottom = '-' + (window.scrollY+1) + 'px'; toolBarLayerFloat.style.left = window.scrollX + 'px'; toolBarLayerFloat.style.opacity = '1'; } //--------------------------------------------------------------------------# // 아이폰 APP 모드 function set_standalone_apple_webkit(){ if(!navigator.userAgent.match(/iPhone|iPod|iPad/)) return; is_iphone=1; if(!navigator.standalone) return; is_appbrowser=1; window.addEventListener('load',function(){ setTimeout("ch_anc_to_js_location()",50); // Anchor tag to js location toolBarLayerFloat=$_ID('toolbar_float_layer'); if(toolBarLayerFloat){ document.addEventListener('touchstart',ToolBarCtll_start,false); document.addEventListener('touchend',ToolBarCtll_end,false); window.addEventListener('scroll',ToolBarCtll_scroll,false); window.addEventListener('orientationchange',ToolBarCtll_scroll,false); if(location.href.match(/#\w+$/)) setTimeout("ToolBarCtll_motion()",500); else toolBarLayerFloat.style.display='block'; $_ID('toolbar_float_space').style.display='block'; $_ID('foot_menu_dn').style.display='none'; } (function(){ var key_url = 'a7r'+this_skin_uni_str; var key_scroll = 'k8R'+this_skin_uni_str; var key_time = 'fG2'+this_skin_uni_str; var key_navi = 'h1I'+this_skin_uni_str; var key_log = 'v4S'+this_skin_uni_str; if(!sessionStorage.getItem(key_log)){ sessionStorage.setItem(key_log,1); view_prev_panel( localStorage.getItem(key_url), localStorage.getItem(key_scroll), localStorage.getItem(key_time), localStorage.getItem(key_navi) ); } else if(Temp=location.href.match(/&openscroll=(\d+)$/)){ setTimeout(scrollTo,10,0,Temp[1]); setTimeout("ToolBarCtll_motion()",100); } localStorage.setItem(key_url,location.href); localStorage.setItem(key_time,TnT_time()); localStorage.setItem(key_navi,fix_navi); window.addEventListener('scroll',function(){localStorage.setItem(key_scroll,get_Yscroll());},false); })(); },false); } // 이전접속 경과 시간 및 이전 페이지 링크 function view_prev_panel(prev_url,prev_scroll,prev_time,prev_navi){ var box,left,temp,h,m,s; if(prev_url.length<20 || !prev_time) return; if(prev_url != location.href){ if(!prev_url.match('?')) prev_url += '?'; if(prev_navi) prev_url += '&fix_navi='+prev_navi; if(prev_scroll) prev_url += '&openscroll='+prev_scroll; } left = (TnT_clientWidth() - 80) /2; prev_time = (TnT_time() - parseInt(prev_time)) / 1000; h = Math.floor(prev_time/3600); m = Math.floor(prev_time%3600/60); s = Math.floor(prev_time%60); box = "" + "
" + "
" + ((h>0) ? (h+'시간 '+m+'분') : ((m>0) ? m+'분 '+s+'초전' : s+' 초전')) + "
"; temp=document.createElement('div'); temp.innerHTML = box; document.body.appendChild(temp); setTimeout(function(){temp.style.display='none';},6000); } //--------------------------------------------------------------------------# function location_href(url,target){ if(target) window.open(url,target).focus(); else location.href=url; } function $_ID(id_str){ if(typeof(id_str) == 'object') return id_str; return document.getElementById(id_str) || null; } function $_CLASS(class_str,tag_name){ var Temp=[]; if(!tag_name) tag_name = '*'; var tags = document.getElementsByTagName(tag_name); for(i in tags){ if(tags[i].className==class_str) Temp.push(tags[i]); } return Temp; } function addEvent(ob_elem,ev_type,ad_func){ if(!ob_elem || !ev_type || !ad_func) return; if(typeof(ob_elem) == 'string') ob_elem=$_ID(ob_elem); ob_elem['on' + ev_type] = ad_func; } function ch_anc_to_js_location(){ var cnt,ch_anc; var Anchors = document.getElementsByTagName('a'); for(var cnt in Anchors){ ch_anc=Anchors[cnt]; if(!ch_anc.attributes['href']) continue; if(ch_anc.attributes['href'].nodeValue.length<5) continue; if(ch_anc.attributes['href'].nodeValue.match(/^\w+:\w+/i)) continue; if(ch_anc.attributes['href'].nodeValue.match(/^#/i)) continue; if(ch_anc.attributes['target'] && ch_anc.attributes['target'].nodeValue.length>1) continue; if(ch_anc.attributes['onclick']) continue; if(ch_anc.attributes['onmousedown']) continue; ch_anc['onclick']=function(){ location.href=this.attributes['href'].nodeValue; return false; } } } function display_toggle(obj,value){ if(typeof(obj) != 'object') obj=$_ID(obj); if(value) obj.style.display=value; else obj.style.display=(obj.style.display=='none') ? '' : 'none'; } function call_insert_url(url,param,open_target){ var url=this_url+'&command=skin_insert&exe=util_outer_url&outer_url='+encodeURIComponent(url); if(param) url += '&' + param; if(open_target) window.open(url,open_target); else location.href = url; } function call_insert_skin(skin_file,param,open_target){ var url=this_url+'&command=skin_insert&exe='+skin_file; if(param) url += '&' + param; if(open_target) window.open(url,open_target); else location.href = url; } //--------------------------- // 메뉴 아이콘 출력모드 표시 변경 function changeIcon_2_on(img_this,exe_str){ // 메뉴,검색,관리 if(cmd_exe==exe_str && !img_this.src.match(/_on\.png$/)) img_this.src=img_this.src.replace(/\.png$/,'_on.png'); } function changeIcon_2_mem(img_this){// 회원 로그인 if(!img_this.src.match(/gmenu_member\.png$/)) return; else if(is_Admin) img_this.src=img_this.src.replace(/\.png$/,'_red.png'); else if(is_Member) img_this.src=img_this.src.replace(/\.png$/,'_green.png'); } function changeIcon_2_login(){ // 회원로그인 클릭시 iwindow 레이어 측에서 parent 로 실행 var all_memLoginIcon = $_CLASS('memLoginIcon','img'); for(i in all_memLoginIcon){ all_memLoginIcon[i].src=all_memLoginIcon[i].src.replace('gmenu_member.png','gmenu_member_on.png'); } } //---------------------------------------------------------------- // 마이메뉴 - ipanel_OPEN() 출력직후 실행 key_mymenuStrg = this_skin_uni_str+'_myMenuTouch' ; // Store key function callback_after_mymenu(data,obj){ var title,img,url,new_data,save_data,rm_dlm,old_data; var naviAraray = []; var img_default = this_skin+"/b_img_pack/touch/touch_default.png"; if(naviConfString.length>10) naviAraray=naviConfString.split(naviConfDelimiter); if(mymenuOn_title) title = mymenuOn_title; // 스킨 파일내에서 지정한 타이틀 else if(naviAraray[0]) title = naviAraray[0]; // 네비메뉴설정에서 지정한 타이틀 else title = ''; try{if(body_data_no) title += "("+body_data_no+")";}catch(e){} // 글번호 if(mymenuOn_img) img = mymenuOn_img; // 스킨 파일내에서 지정한 이미지명 or url else if(naviAraray[2]) img = get_img_pack(naviAraray[2],'touch'); // 터치메뉴 ~ else img =img_default; // 기본 $_ID('my_menu_save_title').value=title; $_ID('my_menu_save_img').src=img; if(!navigator.userAgent.match(/Android/i)) $_ID('my_menu_save_img').className='my_img_gradient'; mymenu_save = function(){ // 저장 if(!window.localStorage){alert('This function is only available in mobile.'); return;} title = $_ID('my_menu_save_title').value; img = (img == img_default) ? '' : img; url = location.href; if(url.match(/\?/) && fix_navi) url += '&fix_navi='+fix_navi; if(title.length<2){$_ID('my_menu_save_title').focus(); return;} rm_dlm =new RegExp(naviConfDelimiter,'g'); title=title.replace(rm_dlm,''); new_data = title+naviConfDelimiter+url+naviConfDelimiter+img+"\n"; old_data=localStorage.getItem(key_mymenuStrg); old_data=(old_data) ? old_data.replace(new_data,'') : ''; save_data = new_data+old_data; localStorage.setItem(key_mymenuStrg,save_data); call_insert_skin('front_menu_my.php','fix_navi=0,4'); } } // 이미지 url : url 형식이 아니면 지정 폴더내의 이미지 주소 적용 function get_img_pack(img,folder){ if(!img) return; else if(img.match('/')) return img; else return this_skin+'/b_img_pack/'+folder+'/'+img; } //---------------------------------------------------------------- // ipanel_OPEN(스크랩) 출력직후 실행 function callback_after_scrap(data,obj){ return; } // trim String.prototype.trim = function(){ return this.replace(/(^\s*)|(\s*$)/g, ""); } //---------------------------------------------------------------- // 이하, 일반 게시판 스킨과 동일 // 기본 윈도우창 // (1파일명 or URL, 2가로크기, 3세로크기, 4가로위치, 5세로위치, 6글번호, 7GET인수, 8스키롤, 9크기변경, 10타겟, 11윈도우 구분) function xwindow_OPEN(exe, div_w, div_h, coord_x, coord_y, no, str, scroll, resize, target, wintype){ linkurlsrc=(Public_URL(exe))? exe : this_url+"&command=exp_window"+(no>0?'&no='+no:'')+"&exe="+exe+"&"+str; if(wintype!=1) OpenWin_smart(linkurlsrc,target,div_w,div_h,coord_x,coord_y,scroll,resize); // 메뉴없는 창 else OpenWin_variety(linkurlsrc,target,div_w,div_h,coord_x,coord_y,scroll,resize); // 메뉴있는 창 } // 응용레이어 추가 생성방법및 옵션지정은 매뉴얼 참조 // iwindow_OPEN(실행파일, iwin이름, get쿼리, 'width=,height=,left=,top=,move_left=,move_top=,btn_help=,btn_grow=,btn_close=,autoclose=1,titlebar=,new_iwin=,css_style=') function iwindow_OPEN(exe, iwin_name, str_query, option_set){ var Opt_Set=parse_param_str(option_set); if(value_renwl(Opt_Set['new_iwin'])){create_iwindow(TnT_time(),Opt_Set['css_style']);} else{ iwchk=$_ID('TnTeIwin'+iwin_name); if(!iwchk) create_iwindow(iwin_name,Opt_Set['css_style']); else{ if(value_renwl(Opt_Set['fix_left'])) Opt_Set['left']=''+parseInt(iwchk.style.left); if(value_renwl(Opt_Set['fix_top'])) Opt_Set['top']=''+parseInt(iwchk.style.top); iwchk.style.zIndex=++iwinzidx; set_iwindow_focus_change(iwin_name); } } TnTw_size=parseInt(Opt_Set['width']); if(!TnTw_size||TnTw_size<2) TnTw_size=250; TnTh_size=parseInt(Opt_Set['height']); if(!TnTh_size||TnTh_size<2) TnTh_size=250; if(Opt_Set['left'] && Opt_Set['left'].match(/[0-9]+%/)){ Opt_Set['left']=parseInt(Opt_Set['left']); Opt_Set['left']=(TnT_clientWidth()*Opt_Set['left']/100)+TnT_scrollLeft()-(TnTw_size/2); if(Opt_Set['left']응용,확장 참조) // innerhtml_ON(실행파일, div_id, get쿼리, 'width=,height=,left=,right=,bottom=,top=,move_left=,move_top=,class=,css_style=,post_form=,callback_display_before=,callback_display_after=,slide=,fade=,no_clean=') function innerhtml_ON(exe,div_id,str_query,option_set){ var layer_type,tm_evt_left,tm_evt_top,xm_obj,inner_obj,post_data; var Opt_Set=parse_param_str(option_set); if(!div_id) div_id='TnTinnerdiv1'; // create new inner_obj = (div_id=='_self') ? get_effect_obj() : $_ID(div_id); if(Opt_Set['post_form']) post_data=innerhtml_form_post(Opt_Set['post_form']); if(!inner_obj){ inner_obj=document.createElement('div'); inner_obj.setAttribute('id',div_id); document.body.appendChild(inner_obj); if(!Opt_Set['left'] && !Opt_Set['right'] && !Opt_Set['move_left']) Opt_Set['left']=get_Xscroll();// default left if(!Opt_Set['top'] && !Opt_Set['bottom'] && !Opt_Set['move_top']) Opt_Set['top']=get_Yscroll();// default top if(!Opt_Set['width'] && !Opt_Set['css_style'] && !Opt_Set['class']) Opt_Set['width']='100%';// default width layer_type=1; } else if(!Opt_Set['no_clean']) inner_obj.innerHTML=''; inner_obj.is_effect_node=1; if(inner_obj.style.display=='none') inner_obj.style.display=''; if(Opt_Set['class']) inner_obj.className=Opt_Set['class']; if(Opt_Set['css_style']) inner_obj.style.cssText=inner_obj.style.cssText+'; '+Opt_Set['css_style']; // css if(Opt_Set['width']) inner_obj.style.width=parseInt(Opt_Set['width'])+(Opt_Set['width'].replace(/\d/g,'') || 'px'); if(Opt_Set['height']) inner_obj.style.height=parseInt(Opt_Set['height'])+(Opt_Set['height'].replace(/\d/g,'') || 'px'); if(Opt_Set['left']) {layer_type=1; inner_obj.style.left= parseInt(Opt_Set['left']) + get_Xscroll() + 'px';} if(Opt_Set['top']) {layer_type=1; inner_obj.style.top= parseInt(Opt_Set['top']) + get_Yscroll() + 'px';} if(Opt_Set['right']) {layer_type=1; inner_obj.style.left=''; inner_obj.style.right=parseInt(Opt_Set['right']) - get_Xscroll() +'px';} if(Opt_Set['bottom']){ layer_type=1; inner_obj.style.top=''; inner_obj.style.bottom=parseInt(Opt_Set['bottom']) + (is_iphone && !is_appbrowser ? -60 : 0) - get_Yscroll() +'px'; } if(Opt_Set['move_left'] || Opt_Set['move_top']){ layer_type=1; if(this_browser=='n'){ tm_evt_top=ns_pageY(); tm_evt_left=ns_pageX(); } else{ tm_evt_top=ie_clientY(); tm_evt_left=ie_clientX(); } if(Opt_Set['move_left']) inner_obj.style.left=tm_evt_left+parseInt(Opt_Set['move_left'])+'px'; if(Opt_Set['move_top']) inner_obj.style.top=tm_evt_top+parseInt(Opt_Set['move_top'])+'px'; if(parseInt(inner_obj.style.left) < 1) inner_obj.style.left=5+'px'; if(parseInt(inner_obj.style.top) < 1) inner_obj.style.top=5+'px'; } if(layer_type || Opt_Set['slide']){ inner_obj.style.position='absolute'; inner_obj.style.visibility='visible'; inner_obj.style.zIndex=++iwinzidx; } str_query=(str_query)?TnT_queryEncode(str_query):''; if(!Public_URL(exe)) exe=TnT_urlEncode(this_url)+"&command=innerhtml&exe="+exe; else exe=TnT_urlEncode(exe); exe = exe+'&'+str_query+'&inner_div='+inner_obj.id+'&is_xmlhttp=1&clientTime='+TnT_time()+'&parent_charset='+(document.charset || document.characterSet).toLowerCase(); xm_obj = TnT_xmlRequest(); xm_obj.open("POST",exe,true); xm_obj.setRequestHeader('content-type','application/x-www-form-urlencoded;charset=utf-8'); loadingImg_open(); xm_obj.onreadystatechange = function(){ if(xm_obj.readyState == 4){ loadingImg_close(); if(Opt_Set['callback_display_before']) var next_mod=eval(Opt_Set['callback_display_before'])(xm_obj.responseText,inner_obj); if(next_mod=='stop') return; if(Opt_Set['slide'] || Opt_Set['fade']){inner_obj.style.webkitTransitionProperty='none'; inner_obj.style.opacity='0';} inner_obj.innerHTML= (this_browser=='n' ? '' : " ")+xm_obj.responseText; // .. : cut css bug for IE innerhtml_js_child(inner_obj); if(Opt_Set['slide']) EFFECT_slide_in(inner_obj,Opt_Set['slide']); else if(Opt_Set['fade']) EFFECT_fade_in(inner_obj); if(Opt_Set['callback_display_after']) eval(Opt_Set['callback_display_after'])(xm_obj.responseText,inner_obj); } } xm_obj.send(post_data); } // form function innerhtml_form_post(form_this){ var el_type,el_name,el_value; var join_str=''; if(typeof(form_this)!='object') form_this=($_ID(form_this) || document.forms[form_this]); var len=form_this.elements.length; for(i=0; i 0){ for(var j in seek_js[i].attributes){ if(typeof(seek_js[i].attributes[j]) == 'undefined') continue; if(typeof(seek_js[i].attributes[j].nodeName) == 'undefined') continue; if(seek_js[i].attributes[j].nodeValue == null) continue; if(seek_js[i].attributes[j].nodeValue == "") continue; create_js.setAttribute(seek_js[i].attributes[j].nodeName, seek_js[i].attributes[j].nodeValue); } } create_js.text = seek_js[i].text; seek_js[i].parentNode.replaceChild(create_js, seek_js[i]); } } //-------------------------------------------------------------------------------- // loading image tnt_loadImage= new Image(); tnt_loadImage.src=(this_skin+'/b_img/icons_mobile/loading.gif'); function loadingImg_open(){ var left = (TnT_clientWidth() - 64) /2; var top = (TnT_clientHeight() - 64) /2 + get_Yscroll(); if(!tnt_loadImage.added){ document.body.appendChild(tnt_loadImage); tnt_loadImage.style.position='absolute'; tnt_loadImage.style.webkitBorderRadius='30px'; tnt_loadImage.style.opacity=0.8; tnt_loadImage.added=1; } tnt_loadImage.style.left=left+'px'; tnt_loadImage.style.top=top+'px'; tnt_loadImage.style.display=''; } function loadingImg_close(){ setTimeout(function(){tnt_loadImage.style.display='none';},500); } //-------------------------------------------------------------------------------- /* EFFECT : slide_in obj (필수) : object 또는 id slide (필수) : left, right, bottom, top 중 (슬라이드 시작 위치) pos (옵션) : 출력위치 및 크기 (left=10,top=300,right=50,bottom=20,width=100,height=200) func_start (옵션) : 동작전 실행 function name (obj,slide){ ... } func_end (옵션) : 동작후 실행 function name (obj,slide){ ... } */ function EFFECT_slide_in(obj,slide,pos,func_start,func_end){ if(typeof(obj) != 'object') obj=$_ID(obj); var setPos=parse_param_str(pos); obj.slide=slide; obj.is_effect_node=1; obj.style.position = (setPos['position'] || 'absolute'); obj.style.zIndex=++iwinzidx; obj.style.webkitTransitionProperty='none'; if(setPos['width']) {obj.style.width=parseInt(setPos['width']) + (setPos['width'].match('%') ? '%' : 'px');} if(setPos['height']) {obj.style.height=parseInt(setPos['height']) + (setPos['height'].match('%') ? '%' : 'px');} if(func_start) eval(func_start)(obj,slide); setTimeout(function(){ // delay : new position ###### var finish_pos = TnT_objectSpec(obj); var pagesize = TnT_documentSize(); if(setPos['top']) {finish_pos.top=parseInt(setPos['top']) + get_Yscroll();} if(setPos['left']) {finish_pos.left=parseInt(setPos['left']) + get_Xscroll();} if(setPos['right']) {finish_pos.right=parseInt(setPos['right']) + pagesize.width-TnT_clientWidth() - get_Xscroll();} if(setPos['bottom']) {finish_pos.bottom=parseInt(setPos['bottom']) + pagesize.height-TnT_clientHeight() + (is_iphone && !is_appbrowser ? -60 : 0) - get_Yscroll();} if(slide=='top'){ if(finish_pos.bottom) {obj.style.bottom=pagesize.height - get_Yscroll() + 'px'; obj.style.top ='';} else{obj.style.top=get_Yscroll()-400 + 'px'; obj.style.bottom ='';} if(finish_pos.right) obj.style.right = finish_pos.right + 'px'; else if(finish_pos.left) obj.style.left = finish_pos.left + 'px'; } else if(slide=='left'){ if(finish_pos.right){obj.style.left =''; obj.style.right=pagesize.width - get_Xscroll() + 'px';} else{obj.style.left=get_Xscroll() - 300 + 'px'; obj.style.right ='';} if(finish_pos.bottom) obj.style.bottom = finish_pos.bottom + 'px'; else if(finish_pos.top) obj.style.top = finish_pos.top + 'px'; } else if (slide=='bottom'){ if(finish_pos.bottom) {obj.style.bottom= pagesize.height - TnT_clientHeight() - get_Yscroll() - 400 + 'px'; obj.style.top ='';} else {obj.style.top=TnT_clientHeight() + get_Yscroll() + 'px'; obj.style.bottom ='';} if(finish_pos.right) obj.style.right = finish_pos.right + 'px'; else if(finish_pos.left) obj.style.left = finish_pos.left + 'px'; } else if (slide=='right'){ if(finish_pos.right) {obj.style.right=pagesize.width - TnT_clientWidth() - get_Xscroll() - 300 + 'px'; obj.style.left ='';} else {obj.style.left=TnT_clientWidth()+get_Xscroll() + 'px'; obj.style.right ='';} if(finish_pos.bottom) obj.style.bottom = finish_pos.bottom + 'px'; else if(finish_pos.top) obj.style.top = finish_pos.top + 'px'; } if(obj.style.display=='none') obj.style.display='block'; if(obj.style.visibility=='hidden') obj.style.visibility='visible'; obj.style.opacity = '1'; setTimeout(function(){ // delay : new left,top ###### obj.style.webkitTransitionProperty='left,top,right,bottom'; obj.style.webkitTransitionDuration="0.7s"; if(finish_pos.bottom) {obj.style.bottom=finish_pos.bottom + 'px'; obj.style.top ='';} else if(finish_pos.top) {obj.style.top=finish_pos.top+'px'; obj.style.bottom ='';} if(finish_pos.right) {obj.style.right=finish_pos.right+'px'; obj.style.left='';} else if(finish_pos.left) {obj.style.left=finish_pos.left+'px'; obj.style.right='';} },20); if(func_end) setTimeout(function(){eval(func_end)(obj,slide);},800); // delay : run slide ###### },20); } /* EFFECT : slide_out obj : object 또는 id (obj 영역내에서 onclick 시 생략가능) slide : left, top, right, bottom 중 (미지정시 slide_in 했던 방향과 동일적용) */ function EFFECT_slide_out(obj,slide){ obj=get_effect_obj(obj); if(!obj){ alert('Error : Object not found!'); return;} if(slide) obj.slide = slide; var obj_pos = TnT_objectSpec(obj); var pagesize = TnT_documentSize(); obj.style.webkitTransitionProperty='none'; obj.style.position='absolute'; if(obj_pos.top && !obj.style.top) obj.style.top = obj_pos.top+'px'; if(obj_pos.left && !obj.style.left) obj.style.left = obj_pos.left+'px'; setTimeout(function(){ obj.style.webkitTransitionProperty='left,top'; obj.style.webkitTransitionDuration="0.6s"; },1); setTimeout(function(){ if(obj.slide=='top') obj.style.top= get_Yscroll() - 500 + 'px'; else if(obj.slide=='right') obj.style.left= get_Xscroll() + pagesize.width + 'px'; else if(obj.slide=='bottom') obj.style.top= get_Yscroll() + pagesize.height + 'px'; else if(obj.slide=='left') obj.style.left= get_Xscroll() - 500 + 'px'; else obj.style.display='none'; },10); setTimeout(function(){ obj.style.webkitTransitionProperty='none'; obj.style.display='none'; obj.style.top=obj_pos.top+'px'; obj.style.left=obj_pos.left+'px'; },1000); } /* EFFECT : fade_in obj (필수) : object 또는 id opacity (옵션) : 불투명도 0.0 ~ 1.0 , 미지정시 1적용 pos (옵션) : 출력위치, 크기 (left=10,top=300,right=50,bottom=20,width=100,height=200) func_start (옵션) : 동작전 실행 function name (obj,opacity){ ... } func_end (옵션) : 동작후 실행 function name (obj,opacity){ ... } */ function EFFECT_fade_in(obj,opacity,pos,func_start,func_end){ if(typeof(obj) != 'object') obj=$_ID(obj); var setPos=parse_param_str(pos); obj.fade=(opacity || 1); obj.is_effect_node=1; obj.style.position = (setPos['position'] || 'absolute'); obj.style.zIndex=++iwinzidx; obj.style.webkitTransitionProperty='none'; obj.style.opacity = '0'; if(setPos['width']) {obj.style.width=parseInt(setPos['width']) + (setPos['width'].match('%') ? '%' : 'px');} if(setPos['height']) {obj.style.height=parseInt(setPos['height']) + (setPos['height'].match('%') ? '%' : 'px');} if(func_start) eval(func_start)(obj,opacity); setTimeout(function(){ // delay : new position ###### var finish_pos = TnT_objectSpec(obj); var pagesize = TnT_documentSize(); if(setPos['top']) {finish_pos.top=parseInt(setPos['top']) + get_Yscroll();} if(setPos['left']) {finish_pos.left=parseInt(setPos['left']) + get_Xscroll();} if(setPos['right']) {finish_pos.right=parseInt(setPos['right']) + pagesize.width-TnT_clientWidth() - get_Xscroll();} if(setPos['bottom']) {finish_pos.bottom=parseInt(setPos['bottom']) + pagesize.height-TnT_clientHeight() + (is_iphone && !is_appbrowser ? -60 : 0) - get_Yscroll();} if(finish_pos.bottom) {obj.style.bottom=finish_pos.bottom + 'px'; obj.style.top ='';} else if(finish_pos.top) {obj.style.top=finish_pos.top+'px'; obj.style.bottom ='';} if(finish_pos.right) {obj.style.right=finish_pos.right+'px'; obj.style.left='';} else if(finish_pos.left) {obj.style.left=finish_pos.left+'px'; obj.style.right='';} if(obj.style.display=='none') obj.style.display='block'; if(obj.style.visibility=='hidden') obj.style.visibility='visible'; setTimeout(function(){ // delay : new left,top ###### obj.style.webkitTransitionProperty='opacity'; obj.style.webkitTransitionDuration="1.5s"; obj.style.opacity = obj.fade; },20); if(func_end) setTimeout(function(){eval(func_end)(obj,opacity);},1000); // delay : run opacity ###### },20); } /* EFFECT : fade_out obj : object 또는 id (obj 영역내에서 onclick 시 생략가능) */ function EFFECT_fade_out(obj){ obj=get_effect_obj(obj); if(!obj){ alert('Error : Object not found!'); return;} obj.style.webkitTransitionProperty='opacity'; obj.style.webkitTransitionDuration="1.0s"; obj.style.opacity = 0; setTimeout(function(){ obj.style.display='none'; obj.style.webkitTransitionProperty='none'; },1000); } // EFFECT : out function EFFECT_out(obj,slide){ obj=get_effect_obj(obj); if(!obj){ alert('Error : Object not found!'); return;} if(obj.slide) EFFECT_slide_out(obj,slide); else if(obj.fade) EFFECT_fade_out(obj); else obj.style.display='none'; } // EFFECT OBJECT function get_effect_obj(obj){ if(obj && typeof(obj) != 'object') obj=$_ID(obj); if(!obj){ var tmp = get_event_target(); // last event obj for(i=0; i<50; ++i){ if(tmp.is_effect_node){ obj = tmp; break; } if(!tmp.parentNode) break; tmp=tmp.parentNode; } } if(obj) return obj; } //-------------------------------------------------------------------------------- function TnT_queryEncode(query_str){ if(query_str=="") return; var enc_query=''; var Arr_tmp=query_str.split('&'); for(i=0;i0?'&no='+no:'')+"&exe="+exe+"&"+str; return OpenWin_Dialog(linkurlsrc,div_w,div_h,coord_x,coord_y,scroll,resize); } // 이미지 사이즈에 맞게 팝업창으로 출력(이미지url,가로,세로,이미지에link,재귀) function imgSize_OPEN(imgURL,Wi,Hi,clickLINK,recnt){ if(!imgURL) return; if(imgURL.match(/\.swf$/i)) popup_win=window.open('','ipupimg','width=400,height=250,resizable=1,scrollbars=1'); // flash else{ if(!recnt){tmpimg= new Image(); tmpimg.src=(imgURL);} if(tmpimg.width!=0 && tmpimg.height!=0){ Wi=tmpimg.width; Hi=tmpimg.height; var limit_w=screen.width - 80; // 최대사이즈 w var limit_h=screen.height - 100; // 최대사이즈 h var usescroll=''; if(limit_wImage Viewer"); popup_win.document.write(""); popup_win.document.write("
"); if(imgURL.match(/\.swf$/i)) popup_win.document.write(""); else popup_win.document.write(""); popup_win.document.write("
"); popup_win.document.close(); } // 이미지 사이즈에 맞게 iwindow 출력 function iview_setimg(str_imgurl,str_query,str_option,recnt){ var Wi=0; var Hi=0; if(!recnt){tmpimg= new Image(); tmpimg.src=(str_imgurl);} if((tmpimg.width!=0)&&(tmpimg.height!=0)){Wi=tmpimg.width; Hi=tmpimg.height;} else{setTimeout("iview_setimg('"+str_imgurl+"','"+str_query+"','"+str_option+"',1)",100); return;} with(HideBox_name.document){ write(""); write(""); write(""); if(this_browser=='n') body.style.overflow='hidden'; close(); } TnTw_size=Wi+1; TnTh_size=Hi+1; iwindow_TITLE(this_skin+'/iwindow/immg/title_imgview.gif'); iwindow_RESIZE(TnTw_size,TnTh_size); } // 접속형태가 일반 URL 인지 , 실행파일명인지 체크 function Public_URL(string){ if(!string.match(/^\w+$/)) return 1; } function TnT_time(){return (new Date()).getTime();} // 부라우저 상단 메뉴,버튼 '없는' 윈도우 창 function OpenWin_smart(Url,Target,Xsize,Ysize,left_is,top_is,Scroll,Resize){ if(!Xsize || Xsize<40) Xsize=500; if(!Ysize || Ysize<40) Ysize=450; if(Resize != 'no' && Resize != 0 ) Resize=1; if(!left_is || left_is<1) left_is= (screen.width-Xsize)/2; if(!top_is || top_is<1) top_is= (screen.height-Ysize-200)/2; smart_Browser=window.open(Url,Target,'width='+Xsize+',height='+Ysize + ',left=' +left_is+ ',top=' +top_is+ ',scrollbars='+Scroll+',resizable='+Resize+',status=0'); smart_Browser.focus(); } // 부라우저 상단 메뉴,버튼 '있는' 윈도우 창 function OpenWin_variety(Url,Target,Xsize,Ysize,left_is,top_is){ if(!Xsize || Xsize<40)Xsize=screen.width -80; if(!Ysize || Ysize<40)Ysize=screen.height -80; if(!left_is || left_is<1) left_is= (screen.width-Xsize)/2; if(!top_is || top_is<1) top_is= (screen.height-Ysize)/2; variety_Browser=window.open(Url,Target,'width='+Xsize+',height='+Ysize + ',left=' +left_is+ ',top=' +top_is + ',scrollbars=1,toolbar=1,location=1,directories=1,status=1,menubar=1,resizable=1,copyhistory=1'); variety_Browser.focus(); } // ModalDialog 박스1 function OpenWin_Dialog(Url,width_is,height_is,left_is,top_is,scroll_is,resize_is){ if(Url=="") return; if(!width_is || width_is<40) width_is= 250; if(!height_is || height_is<40) height_is= 250; if(!left_is || left_is<1) left_is= (screen.width-width_is)/2; if(!top_is || top_is<1) top_is= (screen.height-height_is-200)/2; scroll_is=(scroll_is>0)?'1':'0'; resize_is=(resize_is>0)?'1':'0'; return_value=showModalDialog(Url,0,'dialogWidth:'+width_is+'px; dialogHeight:'+height_is+'px; dialogLeft:'+left_is+'px; dialogTop:'+top_is+'px; status:0; scroll:'+scroll_is+'; help:0; resizable:'+resize_is+';'); return return_value; // showModalDialog("abcd.html","window","font-family:Verdana; font-size:12; dialogHeight:310px; dialogWidth:480px; dialogLeft:30px; dialogTop:500px; status:no; help:no; scroll:no"); } // ModalDialog 박스2(사용안함) function OpenWin_Always(Url,width_is,height_is,left_is,top_is,scroll_is,resize_is){ if(Url=="") return; if(!width_is || width_is<40) width_is= 250; if(!height_is || height_is<40) height_is= 250; if(!left_is || left_is<1) left_is= (screen.width-width_is)/2; if(!top_is || top_is<1) top_is= (screen.height-height_is-200)/2; scroll_is=(scroll_is>0)?'1':'0'; resize_is=(resize_is>0)?'1':'0'; return_value=showModelessDialog(Url,0,'dialogWidth:'+width_is+'px; dialogHeight:'+height_is+'px; dialogLeft:'+left_is+'px; dialogTop:'+top_is+'px; status:0; scroll:'+scroll_is+'; help:0; resizable:'+resize_is+';edge:raised;'); return return_value; // showModalDialog("abcd.html","window","font-family:Verdana; font-size:12; dialogHeight:310px; dialogWidth:480px; dialogLeft:30px; dialogTop:500px; status:no; help:no; scroll:no"); } //----------------------------------------------------------------------------------------- // TnT_layer_open(width,height,절대위치x,절대위치y,이동위치W,이동위치H) TnTL_clickTime=1; function TnT_layer_open(Table_w,Table_h,fs_X,fs_Y,mv_W,mv_H){ var clX,clY,mvX,mvY; mvX=(mv_W>=1 || mv_W<=-1)?mv_W:8;//x move mvY=(mv_H>=1 || mv_H<=-1)?mv_H:-40;//y move iwindowLAYER.opened=true; if(this_browser=='n'){ clX=(fs_X > 0)?fs_X:ns_pageX()+mvX; clY=(fs_Y > 0)?fs_Y:ns_pageY()+mvY; } else{ clX=(fs_X > 0)?fs_X: ie_clientX()+mvX; clY=(fs_Y > 0)?fs_Y: ie_clientY()+ mvY; } if(clX+Table_w+15>TnT_clientWidth()) clX=clX-Table_w-40; // 가로 //if(clY+Table_h+45>TnT_clientHeight()+TnT_scrollTop()) clY=clY-Table_h-40; // 세로 if(clX 50) L = 40; // 휴대폰 세로방향이면 left:40px 고정 if(L) iwindowLAYER.style.left=L+'px'; if(T) iwindowLAYER.style.top=T+'px'; if(mv_L) iwindowLAYER.style.left=parseInt(iwindowLAYER.style.left)+mv_L+'px'; if(mv_T) iwindowLAYER.style.top=parseInt(iwindowLAYER.style.top)+mv_T+'px'; } // iwindow 레이어 타이틀 이미지 function iwindow_TITLE(imgsrc){ if(tntactiwin) HideBox_title.src=imgsrc; // 레이어 타이틀바에 출력될 이미지 } // 레이어 크기변경 function iwindow_RESIZE(x,y){ x=parseInt(x); y=parseInt(y); if(x>0) TntiwindowTable.width=x; if(y>0){ TntiwindowTable.height=y; TntiwindowTable.style.height=y+'px'; } } // 레이어 close function iwindow_CLOSE(){ iwindowLAYER.opened = false; iwindowLAYER.style.visibility = 'hidden'; TnTL_clickTime=1; } // 레이어 메시지 출력 function iwindow_MESSAGE(msg,x,y,place,closetime){ var isactiwn; if(place=='self'){// iwindow 현재위치에서 출력 x=parseInt(iwindowLAYER.style.left); y=parseInt(iwindowLAYER.style.top); isactiwn=tntactiwin.replace(/TnTeIwin/,''); } iwindow_OPEN(this_url+'&command=public&exe=error_msg_iwindow&msg='+msg,isactiwn,'','width=250,height=120,left='+x+',top='+y); // 2010-05-09 if(place=='self'){ var x2=parseInt(iwindowLAYER.style.left); var y2=parseInt(iwindowLAYER.style.top); if(x != x2 || y != y2){ x=x-(x2-x); y=y-(y2-y); iwindow_MOVE(x,y); } } if(closetime>10) setTimeout("iwindow_CLOSE()",closetime); } // iwindow 에서 상위 프레임에 레이어 출력(event,레이어id,[절대위치left,절대위치top,상대위치left,상대위치top]) function iwindow_sub_OPEN(evt,layer_id,abs_left,abs_top,each_left,each_top){ var temp_layer=$_ID('TnT_TempLayer'); var act_frame=HideBox_name; var act_div=act_frame.document.getElementById(layer_id); var act_w=parseInt(act_div.style.width); var act_h=parseInt(act_div.style.height); var i_left=parseInt(iwindowLAYER.style.left); var i_top=parseInt(iwindowLAYER.style.top); if(abs_left!=0 || abs_top!=0){ // 절대위치 temp_layer.style.left = parseInt(abs_left)+'px'; temp_layer.style.top = parseInt(abs_top)+'px'; } else{//상대위치 if(this_browser=='n'){ temp_layer.style.left = evt.pageX+i_left+each_left+5+'px'; // 5: left border 보상 temp_layer.style.top = evt.pageY+i_top-each_top+20+'px'; //20: head td 보상 } else{ temp_layer.style.left = act_frame.event.clientX+ TnT_scrollLeft(act_frame)+i_left+each_left+5+'px'; // 5: left border 보상 temp_layer.style.top = act_frame.event.clientY+ TnT_scrollTop(act_frame)+i_top-each_top+20+'px'; //20: head td 보상 } } if(act_w>50){ //width 보상 temp_layer.style.width=act_w+'px'; if(parseInt(temp_layer.style.left)+act_w>TnT_clientWidth()+ TnT_scrollLeft()){ temp_layer.style.left=(parseInt(temp_layer.style.left)-act_w-each_left*2)+'px'; } if(parseInt(temp_layer.style.left)<1)temp_layer.style.left=1+'px'; // 가로 } else temp_layer.style.width=50+'px'; if(act_h>10){ //height 보상 temp_layer.style.height=act_h+'px'; if(parseInt(temp_layer.style.top)+act_h>TnT_clientHeight()+ TnT_scrollTop()){ temp_layer.style.top=(parseInt(temp_layer.style.top)-act_h+each_top*2)+'px'; } if(parseInt(temp_layer.style.top)<1)temp_layer.style.top=1+'px'; // 세로 } else temp_layer.style.height=10+'px'; temp_layer.innerHTML=act_div.innerHTML; temp_layer.style.visibility = 'visible'; temp_layer.style.zIndex=1000; } // 닫기 function iwindow_sub_CLOSE(){ $_ID('TnT_TempLayer').style.visibility = 'hidden'; } // 일반레이어 on/off 활용 (event,레이어id,[절대위치left,절대위치top,상대위치left,상대위치top]) function publicLayerDisplay(evt,layer_id,abs_left,abs_top,each_left,each_top,toggle){ thislayer=$_ID(layer_id); if(evt=='close'){thislayer.style.visibility = 'hidden'; return;} if(toggle && thislayer.style.visibility =='visible') {thislayer.style.visibility = 'hidden'; return;} abs_left=parseInt(abs_left); abs_top=parseInt(abs_top); each_left=parseInt(each_left); each_top=parseInt(each_top); if(abs_left==0 && abs_top==0){ abs_left=mouseDN_X+each_left; abs_top=mouseDN_Y-each_top; } thislayer.style.left = abs_left+'px'; thislayer.style.top =abs_top+'px'; thislayer.style.visibility = 'visible'; } // iwindow : Drag & Resize -------------------------------------------------------- DragResize_start=0; function DragResize_DN(it_Resize,evt,div_id){ if(div_id){ mv_act_objt=$_ID(div_id); if(mv_act_objt.style.position!='absolute'){ mv_act_objt.style.left=TnT_get_objLeft(mv_act_objt)+'px'; mv_act_objt.style.top=TnT_get_objTop(mv_act_objt)+'px'; mv_act_objt.style.position='absolute'; } mv_act_objt.style.zIndex=++iwinzidx; } else{mv_act_objt=iwindowLAYER;} DragResize_start=1; Drg_x=(this_browser=='n')? evt.pageX : event.clientX; Drg_y=(this_browser=='n')? evt.pageY : event.clientY; if(it_Resize<1){// Drag temp1=parseInt(mv_act_objt.style.left); temp2=parseInt(mv_act_objt.style.top); if(this_browser=='n') document.onmousemove=TnTmoveAct_n; else document.onmousemove=TnTmoveAct; } else{// Resize iwindoWidth=parseInt(TntiwindowTable.width); // 가로 iwindoHeight=parseInt(TntiwindowTable.height); // 세로 if(this_browser=='n') document.onmousemove=TnTresizeAct_n; else document.onmousemove=TnTresizeAct; } TnTL_clickTime=1; if(this_browser=='n') evt.preventDefault(); //ff } function drag_time_true(){ // when iframe onmouseover if(DragResize_start==1 && this_browser!='n') iwindowLAYER.style.top=parseInt(iwindowLAYER.style.top)+100+'px'; } function TnTmoveAct(){ // drag if(DragResize_start!=1) return; mv_act_objt.style.left=temp1+event.clientX-Drg_x+'px'; mv_act_objt.style.top=temp2+event.clientY-Drg_y+'px'; return false; } // resize move function TnTresizeAct(){ if(DragResize_start==1){ var re_x=iwindoWidth+event.clientX-Drg_x; var re_y=iwindoHeight+event.clientY-Drg_y; if(re_x<50 || re_y<50) return false; iwindow_RESIZE(re_x,re_y); return false; } } function TnTmoveAct_n(evt){ // drag if(DragResize_start!=1) return; mv_act_objt.style.left=temp1+evt.pageX-Drg_x+'px'; mv_act_objt.style.top=temp2+evt.pageY-Drg_y+'px'; return false; } // resize move function TnTresizeAct_n(evt){ if (DragResize_start==1){ var re_x=iwindoWidth+evt.pageX-Drg_x; var re_y=iwindoHeight+evt.pageY-Drg_y; if(re_x<50 || re_y<50) return false; iwindow_RESIZE(re_x,re_y); return false; } } // end function DragResize_UP(){ document.onmousemove=''; DragResize_start=0; } //----------------------------------------------------------------------------------- // 부라우저 바탕화면 클릭시 레이어 자동으로 닫히게함(사용안함) // document.onclick=iwindow_CLOSE_AUTO; // function iwindow_CLOSE_AUTO(){ // DragResize_start=0; // if(TnTL_clickTime==1) return; // iwindow 를 드래그 ro 크기변경 동작후에는 자동닫기 적용안함(무조건 자동닫기 적용하려면 이 라인을 삭제) // if(this_browser=='e'){ // if (event.srcElement.className=="TnT_Layer_dragin") return; // iwindow: Drag, Resize // if (event.srcElement.className=="TnT_Top_button") return; // iwindow : TopButton // if (event.srcElement.className=="TnT_Editor_button") return; // editor : Button // } // if((TnTL_clickTime+500)<(new Date()).getTime()){iwindow_CLOSE();} //} // 세션생성: ex) 이름 세션 생성 // 생성되는 세션키는 앞에 무조건 'TnTT' 가 붙게 된다. (로그인 보안 때문임) // 예) onclick="set_SESSION('myname','kiminho')" 로 세선 생성 했다면 ($_SESSION['TnTTmyname'] == 'kiminho') 가 생성됨. function set_SESSION(key,value){ if(key) $_ID('TnT_TempLayer').innerHTML = ""; } // 보드 검색폼 onloadCheck=0; function search_select(check_img,field_name){ hiddenselect=document.board_searchForm.shwhere; onloadCheck=1; if(hiddenselect.value=='wideSearch'){ hiddenselect.value=''; document.board_searchForm.search.value=''; document.itwideshIcon.src=document.itwideshIcon.src.replace(/2\.gif$/,'1.gif'); } if(hiddenselect.value.match(/[^\|]+$/))hiddenselect.value=hiddenselect.value+'|'; if(check_img.src.match(/1\.gif$/)){ if(field_name=='tbody_re'){// 댓글 hiddenselect.value=''; for(i=1; i<10; i++){ tnicoid=$_ID('sh_ico_'+i); if(tnicoid) tnicoid.src=tnicoid.src.replace(/2\.gif$/,'1.gif'); } } else{ hiddenselect.value=hiddenselect.value.replace(/tbody_re\|*/,''); tnicoid=$_ID('sh_ico_re'); if(tnicoid) tnicoid.src=tnicoid.src.replace(/2\.gif$/,'1.gif'); } check_img.src=check_img.src.replace(/1\.gif$/,'2.gif'); hiddenselect.value=hiddenselect.value+field_name+'|'; } else if(check_img.src.match(/2\.gif$/)){ check_img.src=check_img.src.replace(/2\.gif$/,'1.gif'); hiddenselect.value=hiddenselect.value.replace(field_name+'|',''); } } // 선택이미지 변환(검색폼) function selected_chk(check_img,field_name){ if(onloadCheck>0) return; if(field_name=='checked' && check_img.src.match(/1\.gif$/)) check_img.src=check_img.src.replace(/1\.gif$/,'2.gif'); } // 쿠키생성 : 쿠키이름은 반드시 앞에 TnT 로 시작되는 이름으로 '보안적 제한' 함 function TnT_setcookie(name,value,utime,path){ //utime 은 시간 단위 if(!name.match(/^TnT/)) name='TnT'+name; // 'TnT' 강제붙임 if(!path) path='/'; var todaydate = new Date(); unixtime = todaydate.getTime(); if(value==null) utime = 0; if(utime != null){ extime = unixtime+(utime*3600*1000); todaydate.setTime(extime); expiretime = " expires=" + todaydate.toUTCString() +";"; } else expiretime = ""; document.cookie = name + "=" + escape(value) + "; path="+path+";"+expiretime; } // 쿠키읽기 : 쿠키이름은 반드시 앞에 TnT 로 시작되는 이름으로 '보안적 제한' 함 function TnT_getcookie(name){ if(!name.match(/^TnT/)) name='TnT'+name; // 'TnT' 강제붙임 var flag=document.cookie.indexOf(name+'='); if(flag == -1) return; flag += name.length+1; end = document.cookie.indexOf(';', flag); if(end == -1) end = document.cookie.length; return unescape(document.cookie.substring(flag, end)); } // 글목록 섬네일 생성 img_w= , img_h= 를 지정하면 지정한 크기로 생성됨 function TnT_thumbnail(thisimg,imgpath,img_w,img_h){ if(thisimg.xrest) return; thisimg.xrest=1; thisimg.src=this_url+'&command=openfull&exe=img_nail&img_w='+img_w+'&img_h='+img_h+'&img='+imgpath; } // 글목록 섬네일 생성 function TnT_smt_thumbnail(thisimg,imgpath){ if(thisimg.xrest) return; thisimg.xrest=1; thisimg.src=this_url+'&command=exp_default&exe=img_thumbnail&img='+imgpath; } //-------------------------------------------------------------------- // // Top function TnT_get_objTop(obj){ return TnT_objectSpec(obj).top; } // Left function TnT_get_objLeft(obj){ return TnT_objectSpec(obj).left; } // Center function TnT_get_objCenter(obj){ return TnT_objectSpec(obj).center; } // object {left, top, width, height} function TnT_objectSpec(obj){ var Data = {}; if(typeof(obj) != 'object') obj=$_ID(obj); if(obj.getBoundingClientRect){ var BCR = obj.getBoundingClientRect(); Data.left = BCR.left + TnT_scrollLeft(); Data.top = BCR.top + TnT_scrollTop(); Data.width = BCR.right - BCR.left; Data.height = BCR.bottom - BCR.top; } else{ var BOF = document.getBoxObjectFor(obj); Data.left = BOF.x; Data.top = BOF.y; Data.width = BOF.width; Data.height = BOF.height; } Data.center= Data.left + Math.ceil(Data.width / 2); return Data; // object {} } // document {lwidth, height} function TnT_documentSize(){ var size={} var html = document.documentElement; var body = document.body; size.width = Math.max(body.scrollWidth, body.offsetWidth,html.clientWidth,html.scrollWidth,html.offsetWidth); size.height = Math.max(body.scrollHeight, body.offsetHeight,html.clientHeight,html.scrollHeight,html.offsetHeight); return size; // object {} } //----------------------------------------------- function TnT_scrollLeft(base){ if(base){ if(typeof(base) != 'object') base=$_ID(base); } else{ base=window; } return (base.document.documentElement.scrollLeft || base.document.body.scrollLeft); } function TnT_scrollTop(base){ if(base){ if(typeof(base) != 'object') base=$_ID(base); } else{ base=window; } return (base.document.documentElement.scrollTop || base.document.body.scrollTop); } function TnT_clientWidth(base){ if(base){ if(typeof(base) != 'object') base=$_ID(base); } else{ base=window; } return (base.document.body.clientWidth); } function TnT_clientHeight(base){ if(base){ if(typeof(base) != 'object') base=$_ID(base); } else{ base=window; } var tmp1=base.document.body.clientHeight; var tmp2=base.document.documentElement.clientHeight; if(tmp1 && tmp2) return (tmp1"+str+""; alt_square.style.left=TnT_get_objLeft(obj)+mv_right+'px'; alt_square.style.top=TnT_get_objTop(obj)-20-mv_up+'px'; alt_square.style.visibility = 'visible'; }function square_off(sw){$_ID('TnT_TempLayer2').style.visibility=sw?'visible':'hidden';} // 플래쉬 function insert_flash(src,w,h,conf_str){ if(w) conf_str+=' width='+w; if(h) conf_str+=' height='+h; flash_obj = ''; flash_obj += ''; flash_obj += ''; flash_obj += ''; flash_obj += ''; flash_obj += ''; flash_obj += ''; document.write(flash_obj); } // embed function document_write_embed(str){ document.write(''); } // object function document_write_object(str,param){ document.write(''+param+''); } //------------------------------------------------------- // onload 기본 mouseDN_X=0; mouseDN_Y=0; if(navigator.userAgent.indexOf('MSIE') == -1){ this_browser='n'; document.onmousedown=function(n_evt){ mouseDN_X=n_evt.pageX; mouseDN_Y=n_evt.pageY; } } else{ this_browser='e'; document.onmousedown=function(evt){ mouseDN_X=event.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft); mouseDN_Y=event.clientY + (document.documentElement.scrollTop || document.body.scrollTop); } } document.write(""); document.write(""); iwinzidx=10; //------------------------------------------------------- //-----------이하는 본문 출력 해당 부분임------------------------------------------------------------------------- // 댓글 입력칸 height 확대 function replyboxmove(form_name){ form_name.tbody.style.height=parseInt(form_name.tbody.style.height)+120+'px'; } // 댓글 전송 TnT_help_iwindow=0; function replysubmit(form_name,limitleng,maxicon_name,no_right,no){ if(form_name.tempspacE.value=='sending'){ alert('이미 전송했습니다.'); return false; } if(no_right!='') return; if(form_name.name.value.length<2){ alert('이름을 입력하십시오.'); form_name.name.focus(); return false; } if(form_name.tbody.value.length<7){ alert('본문내용을 입력하십시오.'); form_name.tbody.focus(); return false; } if(form_name.wmail && form_name.wmail.value){ form_name.wmail.value=form_name.wmail.value.replace(/\s/g,""); if(form_name.wmail.value && !form_name.wmail.value.match(/^\w+\@\w+\.\w+/)){ alert('메일주소를 재확인 하십시오.'); form_name.wmail.focus(); return false; } } // 비공개 && !회원로그인 && !비번입력 && 도움말open if(form_name.it_secret.value && !is_Member && !form_name.mypass.value && TnT_help_iwindow==0){ // 비공개 iwindow_OPEN('iwindow_help','','function=reply_no_passwd','width=300,height=110'); //답변대상글에 비번 없을때 return; } isgdspan=$_ID('gdimg'+no); if(isgdspan && isgdspan.innerHTML && form_name.imgword.value.length<3){ $_ID('gdimg_dt').style.display='block'; $_ID('gdimg_dd').style.display='block'; if(isgdspan && !isgdspan.innerHTML){ isgdspan.innerHTML=""; } alert('스팸차단 인증 문자를 입력하십시오.'); form_name.imgword.focus(); return false; } if(!cnTtexTleN(form_name,limitleng,maxicon_name)) return; // 댓글 용량체크 if(form_name.mail) form_name.mail.value=''; form_name.submit(); form_name.tempspacE.value='sending'; } // 기본 입력글자 지움(이름,메일,비번) function rep_img_clear(wh){ wh.style.backgroundImage=""; } // 댓글 -표정 아이콘 선택시 테두리선 변환 function faceicon_selection(formname,face_icon_ids,thisimg,invalue){ var iconID; formname.face.value=invalue; for(i=0; i<20; i++){ iconID=$_ID(face_icon_ids+'_'+i); if(iconID) iconID.style.cssText=''; } thisimg.style.cssText="border:1px solid #00a800; background-color:#E3FE02;"; } // 확장아이콘 open function reply_exp_face_open(form_name,display_name){ F_form=document.forms[form_name]; F_display=$_ID(display_name); iwindow_OPEN('iwindow_faceicon','faceicon','','width=300,height=260'); } // 확장아이콘 select function TnTface_f_icon(selected_face,chgimgsrc){ if(!selected_face) return; F_form.face.value=selected_face; F_display.innerHTML=''; } // 댓글쓰기 버튼 클릭 function minireply_wr_open(num){ var table_name=$_ID('TnTmiNiwtable'+num); if(table_name.style.display=='none'){ table_name.style.display=''; var re_wr_form=eval('document.TnT_re_'+num); if(re_wr_form.tbody.disabled!=true) re_wr_form.tbody.focus(); } else table_name.style.display='none'; } // 입력용량 체크(폼이름,제한용량,아이콘이름) function cnTtexTleN(form_name,limitleng,maxicon_name,no,isgdimg){ var textareaLeng = form_name.tbody.value.length; var cntlEn=limitleng-textareaLeng; //----------- if(!is_Admin){ if(cntlEn<0){ alert('제한용량을 초과 했습니다.'); if(form_name.tempspacE.value.length>10){ form_name.tbody.value=form_name.tempspacE.value; } return; } if(isgdimg=='1'){// 스팸차단 문자 입력 isgdspan=$_ID('gdimg'+no); $_ID('gdimg_dt').style.display='block'; $_ID('gdimg_dd').style.display='block'; if(isgdspan && !isgdspan.innerHTML){ isgdspan.innerHTML=""; } } } //---------- if(no){ $_ID('grapleft'+no).innerHTML=textareaLeng; $_ID('grapright'+no).innerHTML=cntlEn; } if(no && cntlEn<100){ $_ID('grapright'+no).style.color='#ff5555'; $_ID('grapright'+no).style.fontWeight='bold'; } maxicon_name.style.width = (textareaLeng/limitleng*100+0.5) + '%'; if(textareaLeng>10) form_name.tempspacE.value=form_name.tbody.value; return 1; } //android instead event : 'onkeyup()' -> 'onfocus()' function reply_android_focus(form,max,id,no,gdimg){ ReWrTxtOb={form:form, max:max, id:id, no:no, gdimg:gdimg} insteadKeyup=setInterval("cnTtexTleN(ReWrTxtOb.form,ReWrTxtOb.max,ReWrTxtOb.id,ReWrTxtOb.no,ReWrTxtOb.gdimg)",500); } function reply_android_blur(){ clearInterval(setInterval); } // 파일첨부,링크 로 본문삽입한 그림 : 링크창 띄우기 function TnT_Bimg_window(imgurl){ if(!imgurl) return; OpenWin_smart(this_url+'&command=openfull&srcURL='+imgurl,'img_win',250,250,0,0,1,1); } // 이미지 출력 사이즈 제한 function TnT_Bimg_limit(imgid,limitsize){ var imgname=$_ID(imgid); if(imgname.width>limitsize)imgname.width=limitsize; } // 댓글 쓰기 비공개 지정 var no_passwd_repl; function replySecretconf(formName,mode){ var reForm=eval(formName); var thisbutton=$_ID(formName+'_secret'); if(!thisbutton) return; // 공개 if(reForm.it_secret.value==1 || mode=='open'){ reForm.it_secret.value=''; thisbutton.style.color='#aaaaaa'; no_passwd_repl=''; } // 비공개 else{ reForm.it_secret.value=1; thisbutton.style.color='#000000'; if(no_passwd_repl) iwindow_OPEN('iwindow_help','','function=reply_secret&to_name='+no_passwd_repl,'width=310,height=240'); //답변대상글에 비번 없을때 } } // 본문 댓글 by 댓글 버튼 function mini_reply_re(parent_no,repl_no,repl_name,is_passwd,formstyle){ re_wr_form=eval('TnT_re_'+parent_no); repForm_display_on('TnT_re_'+parent_no); if(formstyle=='4'){iwindow_MESSAGE('댓글 입력이 제한되어 있습니다.','','','',2000); return;} // if(formstyle=='3'){iwindow_OPEN('iwindow_re_write','','repnum='+repl_no+'&no='+parent_no,'width=500,height=150,btn_grow=y,autoclose=n'); return;} // iwindow re_wr_form.reply_num.value=repl_no; //$_ID('TnTmiNiwtable'+parent_no).style.display=''; if(re_wr_form.tbody.disabled==true){ iwindow_MESSAGE('댓글 등록이 제한되어 있습니다.','','','',2000); return;} re_wr_form.tbody.focus(); re_wr_form.tbody.value='《Re》'+repl_name+" 님 ,\n"; replySecretconf('TnT_re_'+parent_no,'open'); // 비공개 해제 no_passwd_repl=(is_passwd) ? '' : repl_name ; // 답글대상에 비번이 있는지 bg_recolor('#DCFF87'); setTimeout("bg_recolor('')",300); setTimeout("bg_recolor('#DCFF87')",500); setTimeout("bg_recolor('')",1000); } // 댓글폼 깜박이기 function bg_recolor(bgcol){ re_wr_form.tbody.style.backgroundColor=bgcol; } // 댓글 쓰기 - 속성(관리자 전용) function replyAdminconf(formName){ istextstyle=eval(formName).textstyle.value; iwindow_OPEN('iwindow_replyoption','','formName='+formName+'&textstyle='+istextstyle,'width=140,height=150,btn_help=y'); } // 댓글폼 열기 function repForm_display_on(form_name){ $_ID('repForm_all').style.display='block'; this_form=document.forms[form_name]; try{ if(this_form.xname && this_form.xname.value=='') this_form.xname.focus(); else if(this_form.name && this_form.name.value=='') this_form.name.focus(); else this_form.tbody.focus(); }catch(e){} } // 본문내 파일첨부 삽입된것 확장자 변환(to 실행제한)저장된 파일 다운로드 function TnT_bodyOpenfile(thislink,filepath){ thislink.href=this_url+'&command=openview&exe=file_down&mode=inbody&filepath='+filepath+'&'; } // 본문글자크기 +,- function bodyfontSize(mvsize,no){ var bodycell=$_ID('bodytextID'+no); if(!bodycell) return; var tsize=parseInt(bodycell.style.fontSize); if(!tsize || tsize<12) tsize=12; tsize += 1; if(tsize>17) tsize = 12; bodycell.style.fontSize=tsize+'px'; $_ID('TnT_TempLayer').innerHTML = ""; var Replycell=$_CLASS('reply_body'); for(i in Replycell) Replycell[i].style.fontSize=tsize+'px'; } // 투표실행 버튼 클릭 function vote_poll_check(alert_msg,f_this){ if(alert_msg=='1'){alert('권한이 없습니다. 회원 로그인 하십시오'); return false;} if(alert_msg=='2'){alert('투표 권한이 없습니다.'); return false;} if(alert_msg=='3'){alert('이미 이 글에서 투표를 하셨습니다.'); return false;} radio_checked_in=0; for(i=0; i미적용 reForm.myimg_hide.value=''; thisbutton.src=thisbutton.src.replace(/\d\.gif$/,'1.gif'); } else{// 미적용->적용 reForm.myimg_hide.value='1'; thisbutton.src=thisbutton.src.replace(/\d\.gif$/,'2.gif'); } } // witter function isns_twitter(url,msg){ var str = "http://twitter.com/share?text="+msg+"&url="+url; window.open(str,'sns_twitter',''); } // Facebook function isns_facebook(url,msg){ var str = "http://www.facebook.com/sharer.php?u=" + url + "&t=" + msg; window.open(str,'sns_facebook',''); } // kakao story function isns_kakao(url,msg){ var str = "https://story.kakao.com/share?url="+url+"&display=popup&referrer="; window.open(str,'kakao_story',''); } // band function isns_band(url,msg){ var str = "http://www.band.us/plugin/share?body="+url+"&route="+location.hostname; window.open(str,'share_band',''); } // google plus function isns_google(url,msg){ var str = "https://plus.google.com/share?url="+url+"&hl=ko&gpsrc=frameless&btmpl=popup&hl=ko"; window.open(str,'google_plus',''); }