1/* 22018.07.10 JS íµí©ìì 3 4######################################################### 5* í©ì³ì§ë íì¼ 6######################################################### 71. /script/bannerpop.js 9ê° 82. /script/resizePhoto.js 5ê° 93. /script/floating.banner.js 2ê° 104. /script/mosaic.js 6ê° 115. /script/newsAutoCall.js 2ê° 126. /script/common.js 8ê° 137. /script/app.js 49ê° 14 15=> /script/common.js ë¡ íµí© 16########################################################## 17*/ 18 19/* ****************************************** */ 20/* /script/bannerpop.js */ 21/* ****************************************** */ 22 23var adWrite={ 24 // php ì ë¬ ë³ì 25 vars:{ 26 separator : "|" 27 ,editId : null // ìì í id 28 ,box : '<div class="ad-map" />' // ìì±ë ë°ì¤ 29 ,buttons : '<div class="ad-map-btns"><div class="btn-group-vertical"><button type="button" class="btn_com btn_com_0_699 adcmb_button adcmb_modify button secondary tiny" title="ìì "><i class="icon-link"></i></button><button type="button" class="btn_com btn_com_35_699 adcmb_button adcmb_delete button tiny nd-gray" title="ìì "><i class="icon-trash-o"></i></button></div></div>' //ìì ë ë°ì¤ì ë²í¼ë¤ 30 ,$textBox : null 31 ,act : "" // ì¬ì§ ì ë¡ëíê³ ì´ë¬ì íê² ì주 actê°ì´ ë°ëëë°, ê·¸ê²ì ìë ê° 32 ,iframe : '<iframe src="about:blank" name="adc_up_frame" id="adc_up_frame" width="0" height="0" frameborder="0"></iframe>' // uploadì© iframe 33 ,loadData : {} 34 } 35 36 // ì´ë¯¸ì§ ë¡ë©ëë©´ í¬ê¸° ì¬ì´ì¤ê¸° 37 // IEë§ ì´ë¯¸ì§ ë¡ë©ëí ì´ë²¤í¸ê° 먹ì´ì ¸ì í¬ê¸°ë¥¼ ì ëë¡ ì¬ì´ì¤ì§ 못í´ì inlineì¼ë¡ ì¤í¬ë¦½í¸ ìì±í¨ 38 ,getSizeLoadImage:function(_this) 39 { 40 var _w = _this.width 41 ,_h = _this.height; 42 43 _this.setAttribute("data-display-width", _w); 44 _this.setAttribute("data-display-height", _h); 45 46 // ì´ë¯¸ì§ë§µ ì´ë²¤í¸ 47 adWrite.map($(_this)); 48 } 49 50 // ë±ë¡ì ì´ë²¤í¸ë¤ 51 ,evtCrtForm:function() 52 { 53 var parents = this 54 ,$type = $("#adc_crt_type_html, #adc_crt_type_file") 55 ,$htmlBox = $("#adc_crt_html_box") 56 ,$fileBox = $("#adc_crt_attach_file_box") 57 58 ,$popupType = $("#adc_crt_popup_type_layer, #adc_crt_popup_type_window") 59 ,$layer = $("#adc_crt_popup_layer_opt_box") 60 ,$window = $("#adc_crt_popup_window_opt_box") 61 62 ,$closeIcon = $("#adc_crt_popup_layer_icon") 63 ,$iconBox = $("#adc_crt_popup_layer_icon_box") 64 65 ,$closeExpire = $("#bottom_close_expire_label") 66 ,$closeExpireBox = $("#bottom_close_expire_box") 67 68 ,$attachFile = $("#adc_crt_attach_file") 69 ,$previewFile = $("#adc_crt_file_image") 70 ,$previewBox = $("#adc_crt_image_preview_box") 71 72 ,$max_file_size = $("#file_upload_max_size").val(); 73 74 // ì ë ¥ë¶ë¶ ë´ìë기 75 this.vars.$textBox = $("#adc_crt_image_link_box"); 76 77 // html, file ì ë ¥ 78 $type.click(function(){ 79 var isChecked = $(this).attr("value"); 80 81 $htmlBox[isChecked==="HTML"?"removeClass":"addClass"]("is-hidden"); 82 $fileBox[isChecked==="FILE"?"removeClass":"addClass"]("is-hidden"); 83 }); 84 85 // 미리보기 í¸ì¶ // 86 $attachFile.change(function(){ 87 var form = document.adc_form; 88 89 if (typeof (FileReader) != "undefined") { 90 91 var file = $(this)[0].files[0] 92 ,regex = ['jpg', 'jpeg', 'png', 'gif', 'swf'] 93 ,filesize = file.size 94 ,extension = file.name.split('.').pop().toLowerCase(); 95 96 if(filesize > $max_file_size){ 97 alert('ì ë¡ë ì©ëì´ ì´ê³¼ëììµëë¤.'); 98 $attachFile.val(""); 99 return false; 100 } 101 102 if((regex.indexOf(extension) > -1) === false){ 103 alert('jpg, png, gif, swf íì¥ìë§ ì ííì¬ ì£¼ì¸ì.'); 104 $attachFile.val(""); 105 106 //ì ë ¥ìë§ í¨ì ë°ë ìì 107 $previewBox.addClass("is-hidden"); 108 return false; 109 } 110 111 if(extension == "swf"){ 112 $previewBox.addClass("is-hidden"); 113 return false; 114 } 115 116 var reader = new FileReader(); 117 reader.onload = function (e) { 118 var img = new Image(); 119 img.src = e.target.result; 120 121 img.onload = function(){ 122 $previewFile.attr({"src":e.target.result,"data-display-width":this.width, "data-display-height":this.height, "data-width":this.width, "data-height":this.height, "alt":(form.title.value)?form.title.value:form.idxno.value}); 123 $previewBox.removeClass("is-hidden"); 124 125 // ì´ë¯¸ì§ê° ì¤ì ì¬ì´ì¦ê° ë³´ì´ë ì¬ì´ì¦ë³´ë¤ í¬ë©´ ë¤ì ë³´ì´ë ì¬ì´ì¦ë¥¼ ë£ì 126 if(this.width > $previewFile.width()) { 127 $previewFile.attr({"data-display-width":$previewFile.width(), "data-display-height":$previewFile.height()}); 128 } 129 130 $('#size_width').val(this.width); 131 $('#size_height').val(this.height); 132 133 $('#popup_width').val(this.width); 134 $('#popup_height').val(this.height); 135 136 // ì´ë¯¸ì§ë§µ ì´ë²¤í¸ 137 parents.map($previewFile); 138 } 139 } 140
141 reader.readAsDataURL(file); 142 parents.mapDeleteAll(); 143 } 144 }); 145 146 var $mapRadio = $("#adc_crt_image_link_total, #adc_crt_image_link_part, #adc_crt_image_link_not") 147 ,$imgLinkSelect = $(".adcil_btns") 148 ,$imgLink = $("#adc_crt_image_link") 149 ,$imgLinkFile = $("#adc_crt_image_link_file") 150 ,$selectPopup = $("#adc_crt_image_link_popup") 151 ,$btnMapRegist = $("#adc_crt_img_link_btn_regist") 152 ,$linkAction = ''; 153 154 // ì ì²´ ëë ì´ë¯¸ì§ ë§µ ì íì 155 $mapRadio.click(function(){ 156 var $this = $(this) 157 ,type = $this.attr("data-type"); 158 159 if(type == 'total' || type == 'map'){ 160 161 //if(type == 'map') $('#link_event_tag').hide(); 162 //else $('#link_event_tag').show(); 163 164 $("#adc_crt_image_link_box").removeClass('is-hidden'); 165 166 $btnMapRegist[type==="map"?"removeClass":"addClass"]("is-hidden"); 167 168 if(type==="total") parents.mapDeleteAll(); // ì ì²´ì íì¼ë, ì´ì ë°ì´í 모ë ì§ì 169 170 }else{ 171 $("#adc_crt_image_link_box").addClass('is-hidden'); 172 } 173 }); 174 175 // layer or window ì í 176 $popupType.click(function(){ 177 var isChecked = $(this).attr("data-type"); 178 179 $layer[isChecked==="layer"?"removeClass":"addClass"]("is-hidden"); 180 $window[isChecked==="window"?"removeClass":"addClass"]("is-hidden"); 181 }); 182 183 // ë«ê¸° ìì´ì½ í´ë¦ì ìì´ì½ íí ì í ë°ì¤ ì´ê² 184 $closeIcon.click(function(){ 185 var $label_attr_for = $(this).attr('for') 186 ,isChecked = $('#'+$label_attr_for).is(":checked"); 187 188 $iconBox[isChecked===false?"removeClass":"addClass"]("is-hidden"); 189 }); 190 191 // ëªì¼ ëì ì´ì§ ì기 ì ë ¥ë°ì¤ ì´ê¸° 192 $closeExpire.click(function(){ 193 var $label_attr_for = $(this).attr('for') 194 ,isChecked = $('#'+$label_attr_for).is(":checked"); 195 196 $closeExpireBox[isChecked===false?"removeClass":"addClass"]("is-hidden"); 197 }); 198 199 // ì´ë¤ííì ë§í¬ì¸ì§ íì¸ 200 // link, popup, file, close, day_close 201 $imgLinkSelect.click(function(){ 202 var $this = $(this) 203 ,type = $this.attr("data-type"); 204 205 if(type==="popup" || type==="close" || type==="day_close"){ 206 $imgLink.add($imgLinkFile).addClass("is-hidden"); 207 $selectPopup[type==="popup"?"removeClass":"addClass"]("is-hidden"); 208 }else{ 209 $imgLink[type==="link"?"removeClass":"addClass"]("is-hidden"); 210 $imgLinkFile[type==="link"?"addClass":"removeClass"]("is-hidden"); 211 $selectPopup.addClass("is-hidden"); 212 } 213 }); 214 215 $btnMapRegist.click(function(){ 216 217 // ë§µ ë±ë¡ ìì 218 var $popupSelect = $("#adc_crt_image_link_popup_select") 219 ,$linkText = $("#adcil_link_text") 220 ,$etcFile = $("#adcilf_attach") 221 ,$linkTarget = $(".adcil_btns_link option:selected"); 222 223 if(!parents.vars.editId){ 224 alert('ì´ë¯¸ì§ìì ìì í ë§µë°ì´í를 ì ííì¬ì£¼ì¸ì.'); 225 return false; 226 } 227 228 // close, day_close 모ë ë±ë¡ ëë¬ì¼ ì ì¥ëê²...ìê·¸ë¼ radioí´ë¦ë§ì¼ë¡ ì´ì ì ë³´ ì체를 ë ë ¤ë²ë¦¼ 229 var type = $(".adcil_btns:checked").attr('data-type') 230 ,url = "" 231 ,target = ""; 232 233 if(!type) return false; 234 if(type==="link"){ 235 url = $linkText.val(); 236 if(!url){ 237 alert('ë§í¬ë¥¼ ì ë ¥íì¬ ì£¼ì¸ì.'); 238 $linkText.focus(); 239 return false; 240 } 241 242 target = $linkTarget.val(); 243 }else if(type==="popup"){ 244 url = $popupSelect.val(); 245 if(!url){ 246 alert('íì ì ì ííì¬ ì£¼ì¸ì.') 247 $popupSelect.focus(); 248 return false; 249 } 250 }else if(type==="file"){ 251 if(!$etcFile.val()){ 252 alert('íì¼ì ì ííì¬ ì£¼ì¸ì.'); 253 $etcFile.focus(); 254 return false; 255 } 256 257 parents.uploadAttachTmpFile(); 258 259 return false; 260 } 261 262 parents.insertData({ 263 type:type 264 ,url:url 265 ,target:target
266 }) 267 return false; 268 }); 269 } 270 271 // ì´ë¯¸ì§ë§µì íì¼ì¼ë ì ì¥ 272 ,uploadAttachTmpFile:function() 273 { 274 var parents = this 275 ,iframe = this.vars.iframe 276 ,form = document.adc_form; 277 278 $(document.body).append(iframe); 279 280 form.action = "/bannerpop/upload_act.php"; 281 form.target = "adc_up_frame"; 282 form.submit(); 283 } 284 285 // ì´ë¯¸ì§ë§µì ììíì¼ì ì¥í ë¦¬í´ ê° 286 ,afterUploadAttachTmpFile:function(result) 287 { 288 // ì±ê³µì´ë ìëë í¼ì ì¼ë¨ ì´ê¸°íí¨ 289 this.releaseForm(); 290 $("#adc_up_frame").remove(); 291 292 var json = $.parseJSON(adWrite.rawurldecode(result)) 293 ,filename = json[0].filename; 294 295 if(!filename){ 296 alert('ì ë¡ëì ìë¬ê° ë°ìíìµëë¤. ë¤ì ì ë¡ëíì¬ ì£¼ì¸ì.'); 297 return false; 298 } 299 300 this.insertData({type:"file",url:filename,target:"self",json_obj:result}); 301 } 302 303 //rawurldecode 304 ,rawurldecode:function(str) { 305 return decodeURIComponent((str + '') 306 .replace(/%(?![\da-f]{2})/gi, function() { 307 return '%25'; 308 })); 309 } 310 311 // ì´ë¯¸ì§ë§µ ì ë ¥í¼ ì´ê¸°í 312 ,initInsertForm:function(data) 313 { 314 var parents = this 315 ,type = data.type||"link" 316 ,$btns = $(".adcil_btns") 317 ,$imgLink = $("#adc_crt_image_link") 318 ,$imgLinkFile = $("#adc_crt_image_link_file") 319 ,$selectPopup = $("#adc_crt_image_link_popup") 320 ,$filebox = $("#adcilf_uploaded_file"); 321 322 //$btns.filter("[data-type='"+type+"']").prop("checked", true); 323 $btns.filter("[data-type='"+type+"']").click(); // 커ì¤í radio box ë¼ì ì´ë ê² ì²ë¦¬ 324 $filebox.hide(); 325 326 if(type==="popup" || type==="close" || type==="day_close"){ 327 $imgLink.add($imgLinkFile).addClass("is-hidden"); 328 $selectPopup[type==="popup"?"removeClass":"addClass"]("is-hidden"); 329 330 if(type==="popup") $("#adc_crt_image_link_popup_select").val(data.url); 331 332 }else{ 333 $imgLink[type==="link"?"removeClass":"addClass"]("is-hidden"); 334 $imgLinkFile[type==="link"?"addClass":"removeClass"]("is-hidden"); 335 $selectPopup.addClass("is-hidden"); 336 337 if(type==="link"){ 338 $(".adcil_btns_link option[value="+(data.target||"blank")+"]").prop("selected", true); 339 $("#adcil_link_text").val(data.url) 340 }else if(type==="file"){ 341 var $attach = $("#adcilf_attach") 342 ,$delBtn = $("#adcilfuf_btn") 343 ,$filename = $("#adcilfuf_file") 344 ,$fmode = $filename.attr('data-type'); 345 346 $attach.replaceWith($attach.clone()); 347 348 if(data.url){ 349 // íì¼ìì 350 $filebox.show(); 351 $filename.html(data.url); 352 $delBtn.unbind("click").on("click", function(){ 353 if(confirm("ìë²ìì íì¼ì´ ë°ë¡ ì ê±°ë©ëë¤.\nê·¸ëë ìì íìê² ìµëê¹?")) { 354 var file = data.url 355 ,extension = file.split('.').pop().toLowerCase() 356 ,filename = file.replace('.'+extension,''); 357 358 $.post(SITE_DOMAIN + "/bannerpop/upload_act.php" 359 ,{mode:'dlt', fmode:$fmode, idxno:document.adc_form.idxno.value||"", filename:file} 360 ,function(data,rst){ 361 if(rst==="success"){ 362 if(data.result==="success"){ 363 $filename.empty(); 364 $filebox.hide(); 365 parents.insertData({type:"file", url:"", target:"", json_obj:""}, "no"); 366 //alert(decodeURIComponent(data.msg)); 367 }else alert(decodeURIComponent(data.msg)); 368 }else alert('ìì±í ì ìë í ì íì를 ì´ê³¼íììµëë¤.'); 369 },"json"); 370 } 371 }); 372 } 373 } 374 } 375 } 376 377 // ììí¼ ì´ê¸°í 378 ,releaseForm:function(form) 379 { 380 if(!form) form = document.adc_form; 381 382 // í´ì 383 form.action = this.vars.act; 384 form.target = ""; 385 } 386 387 // ë°ì´í ì»ì´ì¤ê¸° 388 ,getHiddenData:function() 389 { 390 var $id = $("#input_"+this.vars.editId) 391 ,val = $id.val().split(this.vars.separator); 392 393 return {id:$id, val:val}; 394 } 395 396 // input type ì ë£ì 397 ,insertData:function(data, isInit) 398 { 399 if(!data) data={}; 400 if(!this.vars.editId) return false; 401 if(!isInit) isInit = "ok"; 402 403 var $data = this.getHiddenData() 404 ,$id = $data.id 405 ,val = $data.val; 406 407 if(val.length<=0) return false; 408 409 val.splice(4, 4, data.type, data.url, data.target, (data.type == 'file' && data.url) ? data.json_obj : '') 410 var value = val.join(this.vars.separator); 411 412 $id.val(value); 413 414 if(isInit==="ok") { 415 //$("#link_event_tag").val("") 416 this.initInsertForm({type:"link", url:"", target:"self"}); 417 } 418 this.vars.editId = null; 419 420 alert('ì ì©ëììµëë¤.'); 421 } 422 423 // ìì í¼ 424 ,modifyForm:function(id) 425 { 426 if(!id) return false; 427 this.vars.editId = id; 428 429 var $data = this.getHiddenData() 430 ,val = $data.val 431 ,type = val[4]||"link" 432 ,url = val[5]||"" 433 ,target = val[6]||"self"; 434 435 //ì´ë¯¸ì§ë§µì íì¼ì¸ì§, ì ì²´ë§í¬ì íì¼ì¸ì§ 구ë¶ì§ê¸° ìí¨ 436 $("#adcilfuf_file").attr('data-type', 'M' + (Number(this.vars.editId.replace(/[^0-9]/g,'')) + 1)); 437 438 this.initInsertForm({type:type, url:url, target:target}); 439 this.mapBlinkArea(); 440 } 441 442 // ì´ë¯¸ì§ ë§µ ì¡ê¸° ìí´ ìì ì ì¥ 443 ,afterUploadTmpFile:function(json) 444 { 445 var form = document.adc_form 446 ,result = json.result||"error" 447 ,data = json.data||"" 448 ,width = json.width||"" 449 ,height = json.height||"" 450 ,mime = json.mime||""; 451 452 // í´ì 453 this.releaseForm(form); 454 455 if(result === "error"){ 456 alert(data); 457 return false; 458 } 459 460 // ëì¤ì í¼ nameì¼ë¡ ë°ê¿ê²!!! 461 //$("#adc_crt_popup_size_width").val(width); 462 //$("#adc_crt_popup_size_height").val(height); 463 if(form.popup_width) form.popup_width.value = width; 464 if(form.popup_height) form.popup_height.value = height; 465 466 // ì°½ ë³´ì´ê³ , ì´ë¯¸ì§ 미리보기 - íìëë ì¬ì´ì¦ ì¬ì¤ê¸° 467 $("#adc_crt_image_preview_box").show(); 468 $("#adc_crt_file_image").attr({"src":"data:"+mime+";base64,"+data, "data-width":width, "data-height":height}); 469 470 // ìë¡ ì¬ë¦°ê²ì´ë, ë¡ë©ëí 모ë ì´ì ì ì ì¥ë ë§µ ì ë³´ ë 림 471 // ì´ì ë°ì´í ìì 472 this.mapDeleteAll(); 473 } 474 475 476 // ë¹ì¨ëë¡ ì¢í ê³ì°í기 477 ,mapCalcPositionRatio:function(val, ratio) 478 { 479 if(ratio === 1) return val; 480 481 return Math.round(val * ratio); 482 } 483 484 // ë¹ì¨ëë¡ ì¢í ê³ì°í기-ì¶ì 485 ,mapScalePositionRatio:function(val, ratio) 486 { 487 if(ratio === 1) return val; 488 489 return Math.round(val / ratio); 490 } 491 492 /** 493 * input type="hidden" ìì± 494 * id : string 495 * pos : object - ì¤ì ìì¹ 496 * kind : string - ë§í¬,íì¼ ë± 497 * url : string - ë§í¬, javascript function 498 * target : string - íì¬ì°½,ìì°½,ë¶ëª¨ì°½ 499 */ 500 ,mapHidden:function($form, id, pos, kind, url, target) 501 { 502 var inputId = "input_"+id 503 ,val = [pos.x1, pos.y1, pos.x2, pos.y2, kind, url, target].join(this.vars.separator) 504 ,input = '<input type="hidden" name="link_url[]" id="'+inputId+'" class="adc_crt_image_map_data" value="'+val+'" />'; 505 506 $form.append(input); 507 } 508 509 // ìì±ë ë§µ ìì 510 ,mapDelete:function(id) 511 { 512 var bId = "btn_"+id 513 ,inputId = "input_"+id; 514 515 $("#"+id+",#"+bId+",#"+inputId).remove(); 516 this.initInsertForm({type:"link", url:"", target:"self"}); 517 alert('ìì ëììµëë¤.'); 518 } 519 520 // ìì±ë ë§´ ì ì²´ ìì 521 ,mapDeleteAll:function() 522 { 523 $(".adc_crt_image_map_data, .ad-map, .ad-map-btns").remove(); 524 } 525 526 // ì ë ¥ë¶ë¶ ê¹ë¹¡ì 527 ,mapBlinkArea:function() 528 { 529 var parents = this; 530 parents.vars.$textBox.addClass("ad-map-bg"); 531 setTimeout(function(){ 532 parents.vars.$textBox.removeClass("ad-map-bg") 533 },500); 534 } 535 536 // ì´ë¯¸ì§ ë§µ ì¡ê¸° 537 ,map:function(target) 538 { 539 var parents = this 540 ,$img = !!target.jquery ? target : $(target) 541 ,width = Number($img.attr("data-width"))||0 // ì¤ì ì¬ì´ì¦ 542 ,height = Number($img.attr("data-height"))||0 543 ,dWidth = Number($img.attr("data-display-width"))||0 // íì ì¬ì´ì¦ 544 ,dHeight = Number($img.attr("data-display-height"))||0 545 ,ratio = width>dWidth ? Number((width/dWidth).toFixed(1)) : 1 // ì¤ì ì¬ì´ì¦ê° íìë ì¬ì´ì¦ë³´ë¤ í´ê²½ì° ë¹ì¨ ë§ì¶ê¸° ìí´ 546 ,box = parents.vars.box 547 ,buttons = parents.vars.buttons 548 ,$imgmapRadio = $("#adc_crt_image_link_part") 549 ,$imgmapBtnRegist = $("#adc_crt_img_link_btn_regist") 550 ,$form = $("#adc_form"); 551 552 553 return { 554 exe:function() 555 { 556 this.canvas().loadData().addEvent(); 557 } 558 559 // ë§ë¶ì´ê¸° 560 ,canvas:function() 561 { 562 $img.next("#adc_crt_edit_canvas").remove().end().after('<div id="adc_crt_edit_canvas" class="ad-canvas" style="left:'+$img.position().left+'px;width:'+dWidth+'px;height:'+dHeight+'px"></div>'); 563 return this; 564 } 565 566 // ë¡ëë ë§µ ë°ì´íì ë°ë¼ 그리기 567 ,loadData:function() 568 { 569 var _parent = this 570 ,$input = $(".adc_crt_image_map_data") 571 ,$canvas = $("#adc_crt_edit_canvas"); 572 573 // ì ì²´ì íì´ë¼ë©´ 574 if($input.length<=0){ 575 parents.initInsertForm(parents.vars.loadData); 576 return this; 577 } 578 579 //if($input.length>0) $('#link_event_tag').hide(); 580 581 // ì´ë¯¸ì§ ë§µ ì¤ì ì¼ë¡ ìì 582 $imgmapRadio.not(":checked").prop("checked", true); 583 $imgmapBtnRegist.show(); 584 585 $.each($input, function(i,ele){ 586 var $ele = $(ele) 587 ,id = ele.id.replace("input_","") 588 ,val = $ele.val().split(parents.vars.separator)||[] 589 ,x1 = val[0]||0 590 ,y1 = val[1]||0 591 ,x2 = val[2]||0 592 ,y2 = val[3]||0 593 ,type = val[4]||"link" 594 ,url = val[5]||"" 595 ,target = val[6]||"self"; 596 597 _parent.display($canvas, id, {x1:x1, y1:y1, x2:x2, y2:y2}); 598 }); 599 600 return this; 601 } 602 603 // ìì 그림 604 ,display:function($canvas, id, data) 605 { 606 if(!data) data={}; 607 608 var $box = $(parents.vars.box) 609 ,$buttons = $(parents.vars.buttons) 610 ,offsetGap = $canvas.position().left||0 // ì ë ì¢íì´ê¸°ì ìºë°ì¤ë³´ë¤ ìì ì´ë¯¸ì§ì¼ê²½ì° gapë§í¼ ëí´ì íìí´ì¤ 611 ,bId = "btn_"+id 612 ,x1 = (Number(parents.mapScalePositionRatio(data.x1, ratio))+offsetGap)||0 613 ,y1 = parents.mapScalePositionRatio(data.y1, ratio)||0 614 ,x2 = (Number(parents.mapScalePositionRatio(data.x2, ratio))+offsetGap)||0 615 ,y2 = parents.mapScalePositionRatio(data.y2, ratio)||0 616 ,width = Math.abs(x1-x2) 617 ,height = Math.abs(y1-y2); 618 619 // ë²í¼ ë§ë¤ê¸°
620 $buttons.css({"top":y1+"px", "left":x2+"px"}).attr({"id":bId}) 621 .find(".adcmb_button").click(function(){ 622 var $this = $(this) 623 ,isModify = $this.is(".adcmb_modify"); 624 625 if(isModify===true){ 626 parents.modifyForm(id); 627 }else{ 628 parents.mapDelete(id); 629 } 630 }); 631 632 // box ë§ë¤ê¸° 633 $box.css({"top":y1+"px", "left":x1+"px", "width":width, "height":height}).attr({"id":id}); 634 635 $canvas.after($box); 636 $box.after($buttons); 637 638 return this; 639 } 640 641 // event 642 ,addEvent:function() 643 { 644 var _this = this 645 ,position = {x:0, y:0} 646 ,$box = null 647 ,start = false; 648 649 $(document.body).off("mousedown mousemove mouseup touchstart touchmove touchend","#adc_crt_edit_canvas") 650 .on({ 651 "mousedown touchstart":function(event) 652 { 653 start = true; 654 655 var $this = $(this) 656 ,evt = parents.getEventObject(window.event || event) 657 ,$evtTarget = $(evt.target||evt.srcElement) 658 ,offsetGap = $evtTarget.position().left // ìëìì¹ê¸° ë문ì ê° left ê°ì ëí´ì¤ì¼ í¨ 659 ,x = Math.round(evt.offsetX||(evt.pageX-$evtTarget.offset().left)) 660 ,y = Math.round(evt.offsetY||(evt.pageY-$evtTarget.offset().top)) 661 ,id = "acem_"+new Date().getTime(); 662 663 position.x = x; 664 position.y = y; 665 666 $box = $(box).css({"top":y, "left":x+offsetGap}).attr({"id":id}) 667 $this.after($box); 668 669 //evt.cancelBubble = true; 670 //evt.stopPropagation(); 671 //evt.preventDefault(); 672 } 673 674 ,"mousemove touchmove":function(event) 675 { 676 if(start === true){ 677 var evt = parents.getEventObject(window.event || event) 678 ,$evtTarget = $(evt.target||evt.srcElement) 679 ,offsetGap = $evtTarget.position().left // ìëìì¹ê¸° ë문ì ê° left ê°ì ëí´ì¤ì¼ í¨ 680 ,x = Math.round(evt.offsetX||(evt.pageX-$evtTarget.offset().left)) 681 ,y = Math.round(evt.offsetY||(evt.pageY-$evtTarget.offset().top)) 682 //,width = Math.abs(x-position.x)-5 683 //,height = Math.abs(y-position.y)-5 684 ,width = Math.abs(x-position.x) 685 ,height = Math.abs(y-position.y) 686 ,css = {}; 687 688 css = {"width":width, "height":height}; 689 690 if(position.x>x && position.y>y){ // ì¢ì 691 css.left = position.x-width+offsetGap; 692 css.top = position.y-height; 693 }else if(position.x>x && position.y<y){ // ì¢í 694 css.left = position.x-width+offsetGap; 695 }else if(position.x<x && position.y>y){ // ì°ì 696 css.top = position.y-height; 697 } 698 699 $box.css(css); 700 } 701 } 702 703 ,"mouseup touchend":function(event) 704 { 705 start = false; 706 707 // $box기ì¤ì¼ë¡ x1,y1,x2,y2 ê°ì ¸ì´ 708 var width = $box.width() 709 ,height = $box.height(); 710 711 if(width<20 && height<20){ 712 $box.remove(); 713 return false; 714 } 715 716 var $buttons = $(buttons) 717 ,evt = parents.getEventObject(window.event || event) 718 ,$evtTarget = $(evt.target||evt.srcElement) 719 ,offsetGap = $evtTarget.position().left // ìëìì¹ê¸° ë문ì ê° left ê°ì ë¹¼ì¤ì¼ì§ ì§ì§ ë§µì´ ë¨ 720 ,pos = $box.css(["top","left"]) 721 ,x1 = parents.castIntFromCss(pos.left) 722 ,y1 = parents.castIntFromCss(pos.top) 723 ,id = $box.attr("id") 724 ,bId = "btn_"+id 725 ,inputId = "input_"+id 726 ,info = { x1 : x1, y1 : y1, x2 : x1 + width, y2 : y1 + height } 727 ,real = { x1 : parents.mapCalcPositionRatio(info.x1, ratio)-offsetGap, y1 : parents.mapCalcPositionRatio(info.y1, ratio), x2 : parents.mapCalcPositionRatio(info.x2, ratio)-offsetGap, y2 : parents.mapCalcPositionRatio(info.y2, ratio)}; 728 729 // ìì ìì ì´ë²¤í¸ 730 $buttons.css({"top":info.y1, "left":info.x2}).attr({"id":bId}) 731 .find(".adcmb_button").click(function(){ 732 var $this = $(this) 733 ,isModify = $this.is(".adcmb_modify"); 734 735 if(isModify===true){ 736 parents.modifyForm(id); 737 }else{ 738 parents.mapDelete(id); 739 } 740 });
741 742 $box.after($buttons); 743 parents.mapHidden($form, id, real, "", "", ""); 744 parents.initInsertForm({type:"link", url:"", target:"self"}); // í¼ ì´ê¸°í 745 parents.vars.editId = id; 746 747 // ì´ë¯¸ì§ë§µì¼ë¡ ì²´í¬ 748 $imgmapRadio.not(":checked").click().prop("checked", true); 749 $imgmapBtnRegist.show(); 750 751 parents.mapBlinkArea(); // ê¸ì°ê¸° í¼ ì´íí¸ 752 753 //util.toast(lang.adcRequireLink); 754 } 755 },"#adc_crt_edit_canvas"); 756 757 return this; 758 } 759 760 }.exe(); 761 } 762 763 // jquery ì´ë²¤í¸ ë±ë¡ ì¬ì©ì, ì´ë²¤í¸ ììë´ê¸° 764 ,getEventObject:function(e) 765 { 766 var evt = window.event||e; 767 evt = evt.targetTouches?evt.targetTouches[0]:evt; // jquery touch event 768 return evt; 769 } 770 771 // css pxì ê±°í ì«ìíì¼ë¡ 772 ,castIntFromCss:function(v) 773 { 774 return Number(v.replace("px","")); 775 } 776 777 // listìì ë²í¼ ì´ë²¤í¸ 778 ,evtClickedButtons:function() 779 { 780 // edit 781 var edit_info = $('#admin-ad-list') 782 ,edit_section = edit_info.attr("data-edit-section") 783 ,edit_area = edit_info.attr("data-edit-area") 784 ,edit_step = edit_info.attr("data-edit-step") 785 ,edit_idxno = edit_info.attr("data-edit-idxno") 786 ,edit_mode = edit_info.attr("data-edit-mode") 787 ,org_banner_kind = edit_info.attr("data-edit-org-banner-kind") 788 ,banner_kind = edit_info.attr("data-edit-banner-kind") 789 ,page = edit_info.attr("data-page") 790 //,tmp_banner_idxno = edit_info.attr("data-edit-tmp-banner-idxno") 791 ,sc_area = edit_info.attr("data-search-scarea") 792 ,sc_word = encodeURIComponent(edit_info.attr("data-search-scword")) 793 794 $(".ad-tile-toolkit, .content-inert").on("click", "button" 795 , function(){ 796 var $this = $(this) 797 ,type = $this.attr("data-btn-type") 798 ,$parent = $this.closest(".adccfg_list_items") 799 ,bannerIdxno = $parent.attr("data-banner-idxno") 800 ,banner_type = $parent.attr("data-banner-type") 801 ,linkInfo = $parent.attr("data-link-info") 802 ,title = $.trim($parent.find(".acli_title").text()) 803 ,state = $.trim($parent.find(".ad-tile-state").text()) 804 ,Imgbp_Tag = $.trim($parent.find(".Imgbp_Tag").html()); 805 806 switch(type){ 807 case "add": 808 if(banner_type == 'popup') { 809 var data = {'mode':edit_mode,'section':edit_section,'popup_title':encodeURIComponent(title),'popup_idxno':bannerIdxno} 810 adWrite.addEditPopupContents(data); 811 }else{ 812 var data = {mode:edit_mode,'idxno':edit_idxno,'area':edit_area,'section':edit_section,'step':edit_step,'banner_title':encodeURIComponent(title),'banner_idxno':bannerIdxno,'kind':banner_kind,'edit_msg':'ì íí ë°°ëë¡ êµì²´íìê² ìµëê¹?'}; 813 adWrite.addEditContents(data); 814 } 815 break; 816 case "down": 817 location.href = '/bannerpop/attach_down.php?idxno='+bannerIdxno+'&mode=O'; 818 break; 819 case "linkInfo": // ì ë¡ëë íì¼ ë§í¬ ë³µì¬ 820 var source = '/bannerpop/uploads/image/'+linkInfo; 821 adWrite.copyExe(source); 822 break; 823 case "sourceCopy": // ìì¤ë³µì¬ 824 /*if(state == '무ì í') { 825 if(!Imgbp_Tag) return false; 826 var _html = '<!--'+title+'-->' 827 + Imgbp_Tag 828 + '<!--//'+title+'-->'; 829 }else{*/ 830 var _time = Math.floor(new Date().getTime()/1000) 831 ,_banid = _time + '_' + bannerIdxno 832 ,_html = '<!--'+title+'-->' 833 + '<script type="text/javascript">var ___BANNER = "ban_'+_banid+'";</script>' 834 + '<script type="text/javascript" charset="utf-8" src="/bannerpop/uploads/js/'+bannerId
834xno+'.js?'+_time+'" id="ban_'+_banid+'"></script>' 835 + '<!--//'+title+'-->'; 836 //} 837 838 adWrite.copyExe(_html); 839 break; 840 case "preview": 841 if(!window.___popup) return false; 842 843 var p = ___popup[bannerIdxno]; 844 845 if(!p) return false; 846 if(!window.___currentTime) window.___currentTime = Math.floor(new Date().getTime()/1000);// ìê°ì´ ì¤ì ëì§ ììë¤ë©´ js ìê°ì¼ë¡ ì¤ì í¨ 847 848 // ê´ë¦¬ìë§... 849 $(".layer_box").remove(); // ë¤ë¥¸ê² ì´ë ¤ìë¤ë©´ ìì 850 bannerpop.vars.popup.view = "manager"; 851 bannerpop.float(p); 852 break; 853 case "mdf": 854 var $ahref = '/bannerpop/'; 855 $ahref += edit_section ? 'edit.html' : 'write.html'; 856 $ahref += '?type='+banner_type+'&mode=modify&idxno='+bannerIdxno+'&page='+page; 857 if(edit_section) $ahref += '&edit_section=' + edit_section; 858 if(edit_area) $ahref += '&edit_area=' + edit_area; 859 if(edit_step) $ahref += '&edit_step=' + edit_step; 860 if(edit_idxno) $ahref += '&edit_idxno=' + edit_idxno; 861 if(edit_mode) $ahref += '&edit_mode=' + edit_mode; 862 //if(tmp_banner_idxno) $ahref += '&tmp_banner_idxno=' + tmp_banner_idxno; 863 if(org_banner_kind) $ahref += '&org_banner_kind=' + org_banner_kind; 864 if(banner_kind) $ahref += '&banner_kind=' + banner_kind; 865 if(sc_area) $ahref += '&sc_area=' + sc_area; 866 if(sc_word) $ahref += '&sc_word=' + sc_word; 867 location.href = $ahref; 868 break; 869 case "del": 870 if(window.confirm('ìì í ê¹ì?')) { 871 var $ahref = '/bannerpop/delete_act.php?type='+banner_type+'&idxno='+bannerIdxno+'&page='+page; 872 if(edit_section) $ahref += '&edit_section=' + edit_section; 873 if(edit_area) $ahref += '&edit_area=' + edit_area; 874 if(edit_step) $ahref += '&edit_step=' + edit_step; 875 if(edit_idxno) $ahref += '&edit_idxno=' + edit_idxno; 876 if(org_banner_kind) $ahref += '&org_banner_kind=' + org_banner_kind; 877 if(banner_kind) $ahref += '&banner_kind=' + banner_kind; 878 if(sc_area) $ahref += '&sc_area=' + sc_area; 879 if(sc_word) $ahref += '&sc_word=' + sc_word; 880 location.href = $ahref; 881 } 882 break; 883 case "mdf_activity": 884 var $ahref = '/bannerpop/'; 885 $ahref += edit_section ? 'edit.html' : 'write_activity.html'; 886 $ahref += '?type='+banner_type+'&mode=modify&activity_idxno='+bannerIdxno+'&page='+page; 887 if(edit_section) $ahref += '&edit_section=' + edit_section; 888 if(edit_area) $ahref += '&edit_area=' + edit_area; 889 if(edit_step) $ahref += '&edit_step=' + edit_step; 890 if(edit_idxno) $ahref += '&edit_idxno=' + edit_idxno; 891 if(edit_mode) $ahref += '&edit_mode=' + edit_mode; 892 if(org_banner_kind) $ahref += '&org_banner_kind=' + org_banner_kind; 893 if(banner_kind) $ahref += '&banner_kind=' + banner_kind; 894 //if(tmp_banner_idxno) $ahref += '&tmp_banner_idxno=' + tmp_banner_idxno; 895 if(sc_area) $ahref += '&sc_area=' + sc_area; 896 if(sc_word) $ahref += '&sc_word=' + sc_word; 897 location.href = $ahref; 898 break; 899 case "del_activity": 900 if(window.confirm('ìì í ê¹ì?')) { 901 var $ahref = '/bannerpop/delete_activity_act.php?type='+banner_type+'&activity_idxno='+bannerIdxno+'&page='+page; 902 if(edit_section) $ahref += '&edit_section=' + edit_section; 903 if(edit_area) $ahref += '&edit_area=' + edit_area; 904 if(edit_step) $ahref += '&edit_step=' + edit_step; 905 if(edit_idxno) $ahref += '&edit_idxno=' + edit_idxno; 906 if(org_banner_kind) $ahref += '&org_banner_kind=' + org_banner_kind; 907 if(banner_kind) $ahref += '&banner_kind=' + banner_kind; 908 if(sc_area) $ahref += '&sc_area=' + sc_area; 909 if(sc_word) $ahref += '&sc_word=' + sc_word; 910 location.href = $ahref; 911 } 912 break; 913 case "sourceCopy_activity": // ìì¤ë³µì¬ 914 var _time = Math.floor(new Date().getTime()/1000) 915 ,_banid = _time + '_' + bannerIdxno 916 ,_html = '<!--'+title+'-->' 917 + '<script type="text/javascript">var ___BANNER = "ban_'+_banid+'";</script>' 918 + '<script type="text/javascript" charset="utf-8" src="/bannerpop/uploads/js_activity/'+bannerId
918xno+'.js?'+_time+'" id="ban_'+_banid+'"></script>' 919 + '<!--//'+title+'-->'; 920 921 adWrite.copyExe(_html); 922 break; 923 case "mdf_multi": 924 var $ahref = '/bannerpop/'; 925 $ahref += edit_section ? 'edit.html' : 'write_activity_multi.html'; 926 $ahref += '?type='+banner_type+'&mode=modify&multi_idxno='+bannerIdxno+'&page='+page; 927 if(edit_section) $ahref += '&edit_section=' + edit_section; 928 if(edit_area) $ahref += '&edit_area=' + edit_area; 929 if(edit_step) $ahref += '&edit_step=' + edit_step; 930 if(edit_idxno) $ahref += '&edit_idxno=' + edit_idxno; 931 if(edit_mode) $ahref += '&edit_mode=' + edit_mode; 932 if(org_banner_kind) $ahref += '&org_banner_kind=' + org_banner_kind; 933 if(banner_kind) $ahref += '&banner_kind=' + banner_kind; 934 //if(tmp_banner_idxno) $ahref += '&tmp_banner_idxno=' + tmp_banner_idxno; 935 if(sc_area) $ahref += '&sc_area=' + sc_area; 936 if(sc_word) $ahref += '&sc_word=' + sc_word; 937 location.href = $ahref; 938 break; 939 case "del_multi": 940 if(window.confirm('ìì í ê¹ì?')) { 941 var $ahref = '/bannerpop/delete_activity_multi_act.php?type='+banner_type+'&multi_idxno='+bannerIdxno+'&page='+page; 942 if(edit_section) $ahref += '&edit_section=' + edit_section; 943 if(edit_area) $ahref += '&edit_area=' + edit_area; 944 if(edit_step) $ahref += '&edit_step=' + edit_step; 945 if(edit_idxno) $ahref += '&edit_idxno=' + edit_idxno; 946 if(org_banner_kind) $ahref += '&org_banner_kind=' + org_banner_kind; 947 if(banner_kind) $ahref += '&banner_kind=' + banner_kind; 948 if(sc_area) $ahref += '&sc_area=' + sc_area; 949 if(sc_word) $ahref += '&sc_word=' + sc_word; 950 location.href = $ahref; 951 } 952 break; 953 case "sourceCopy_multi": 954 var _time = Math.floor(new Date().getTime()/1000) 955 ,_banid = _time + '_' + bannerIdxno 956 ,_html = '<!--'+title+'-->' 957 + '<script type="text/javascript">var ___BANNER = "ban_multi_'+_banid+'";</script>' 958 + '<script type="text/javascript" charset="utf-8" src="/bannerpop/uploads/js_multi/'+bannerIdxno+'.js?'+_time+'" id="ban_multi_'+_banid+'"></script>' 959 + '<!--//'+title+'-->'; 960 adWrite.copyExe(_html); 961 break; 962 } 963 964 return false; 965 }); 966 } 967 968 //ìì ì ì¹ì í 컨í ì¸ ì½ì 969 ,addEditContents:function(data) 970 { 971 //var flag = false; 972 var flag = true; 973 974 /*if(data.mode == 'modify') { 975 if(data.tmp_banner_idxno != data.banner_idxno) { 976 if(confirm(data.edit_msg)) flag = true; 977 else flag = false; 978 }else flag = true; 979 }else flag = true;*/ 980 981 if(flag) { 982 data = JSON.stringify(data); 983 $.ajax({ 984 url:"/edit/adminReservationBannerWrite.php" 985 ,type:'post' 986 ,dataType:'json' 987 ,contentType:'application/x-www-form-urlencoded; charset=utf-8' 988 ,data:{post_data:data} 989 ,success:function(json, result) { 990 if(result == 'success') { 991 if(json.response == 'ok') { 992 window.parent.location.reload(); 993 }else{ 994 alert(json.msg); 995 return false; 996 } 997 }else return false; 998 } 999 }); 1000 }else{ 1001 return false; 1002 } 1003 } 1004 1005 //ìì ì ì¹ì í 컨í ì¸ ì½ì 1006 ,addEditPopupContents:function(data) 1007 { 1008 data = JSON.stringify(data); 1009 $.ajax({ 1010 url:"/edit/adminReservationPopupWrite.php" 1011 ,type:'post' 1012 ,dataType:'json' 1013 ,contentType:'application/x-www-form-urlencoded; charset=utf-8' 1014 ,data:{post_data:data} 1015 ,success:function(json, result) { 1016 if(result == 'success') { 1017 if(json.response == 'ok') { 1018 //window.parent.location.reload(); 1019 parent.$('#edit-modal').find('.close-button').trigger('click'); 1020 adWrite.addPopupContentsList(json); 1021 }else{ 1022 alert(json.msg); 1023 return false; 1024 } 1025 }else return false; 1026 } 1027 }); 1028 } 1029 1030 ,addPopupContentsList:function(json) { 1031 var html = ''; 1032 if(json.rows.length>0) { 1033 for(var i = 0; i < json.rows.length; i++) { 1034 var index = i+1; 1035 html += '<!-- íì //-->';
1036 html += '<div class="option-popup-item">'; 1037 html += ' <input type="radio" name="editPopup" id="editPopup' + index + '" class="popup_element_ckecked" title="' + adWrite.rawurldecode(json.rows[i].popup_title) + '" data-idxno="' + json.rows[i].idxno + '" data-step="' + json.rows[i].step + '" value="' + json.rows[i].popup_idxno + '" />'; 1038 html += ' <label for="editPopup' + index + '">'; 1039 if(json.rows[i].popup_image && json.rows[i].extension != 'swf') { 1040 html += '<img src="/bannerpop/uploads/image/' + json.rows[i].popup_image + '" alt="' + adWrite.rawurldecode(json.rows[i].popup_title) + '" />'; 1041 }else{ 1042 if(json.rows[i].extension == 'swf') html += 'SWF'; 1043 else html += 'HTML'; 1044 } 1045 html += ' <div class="option-popup-item-title">' + adWrite.rawurldecode(json.rows[i].popup_title) + '</div>'; 1046 html += ' </label>'; 1047 html += '</div>'; 1048 html += '<!--// íì -->'; 1049 } 1050 } 1051 1052 parent.$('.option-popup-group').html(html); 1053 } 1054 1055 //ì ì²´ì íãí´ì 1056 ,allChk:function() 1057 { 1058 var $allChk = $('#allCheck'); 1059 $allChk.click(function(){ 1060 if($(this).is(':checked') == true) { 1061 $('.elembox').prop('checked',true); 1062 }else{ 1063 $('.elembox').prop('checked',false); 1064 } 1065 }); 1066 } 1067 1068 /** 1069 * í´ë¦½ë³´ë ë³µì¬ 1070 * source : ë³µì¬í ì ë³´ 1071 */ 1072 ,copyExe:function(source) 1073 { 1074 if(window.clipboardData){ // ie 1075 window.clipboardData.setData('Text',source); 1076 alert("ë³µì¬ëììµëë¤. ìíë ê³³ì ë¶ì¬ë£ê¸°íì¬ ì£¼ì¸ì."); 1077 }else{ // etc 1078 //var $tmpDiv=$('<div class="blind">'+source.replace(/</g,"<").replace(/>/g,">")+'</div>').appendTo("body") 1079 // blindê° display:none ìì± ë문ì ì ê±° 1080 var $tmpDiv=$('<div>'+source.replace(/</g,"<").replace(/>/g,">")+'</div>').appendTo("body") 1081 ,range=document.createRange() 1082 ,selection=null; 1083 1084 range.selectNodeContents($tmpDiv.get(0)); 1085 selection=window.getSelection(); 1086 selection.removeAllRanges(); 1087 selection.addRange(range); 1088 1089 if(document.execCommand("copy", false, null)) alert("ë³µì¬ëììµëë¤. ìíë ê³³ì ë¶ì¬ë£ê¸°íì¬ ì£¼ì¸ì."); 1090 else window.prompt('í¤ë³´ëì ctrl+C ëë ë§ì°ì¤ ì¤ë¥¸ìª½ì ë³µì¬í기를 ì´ì©í´ì£¼ì¸ì.', source); 1091 1092 $tmpDiv.remove(); 1093 } 1094 } 1095 1096 /** 1097 * 기ë¥ì± ë°°ë ì¶ê°/ììë³ê²½/ìì / 1098 */ 1099 ,evtClickActivityAdd:function() { 1100 //sessionStorage.removeItem("last_idx"); 1101 var activity_idxno=window.parent.$('#all-banner-list').closest('div').attr('data-activity-idxno')||''; 1102 $('#activity-add-btn').click(function() { 1103 var $this=$(this); 1104 //,$viewHref=$('#activity-view-btn').attr('href') 1105 //,$last_idx=(activity_idxno)?activity_idxno:sessionStorage.getItem('last_idx'); 1106 1107 if($('.banner_element_ckecked').is(':checked') == false) { 1108 alert('ë°°ë를 ì íí´ì£¼ì¸ì.'); 1109 //if(!$last_idx) $('#activity-view-btn').addClass('is-hidden'); 1110 return false; 1111 }else{ 1112 var $checked=$(".banner_element_ckecked:checked") 1113 ,arr = new Array(); 1114 if($checked.length>0) { 1115 $.each($checked, function(idx, v) { 1116 arr.push(v.value); 1117 }); 1118 1119 var data = {mode:activity_idxno?'modify':'input', activity_idxno:activity_idxno, banner_idxno:arr}; 1120 data = JSON.stringify(data); 1121 //console.log(data); 1122 $.ajax({
1123 url:"/bannerpop/activity_act.php" 1124 ,type:'post' 1125 ,dataType:'json' 1126 ,contentType:'application/x-www-form-urlencoded; charset=utf-8' 1127 ,data:{post_data:data} 1128 ,success:function(json, result) { 1129 if(result == 'success') { 1130 if(json.response == 'ok') { 1131 //alert('ì¶ê°ëììµëë¤.\nì°ì¸¡ì ë²í¼ì í´ë¦íìë©´ ìì¸ íë©´ì¼ë¡ ì´ëí©ëë¤.'); 1132 /*if(!activity_idxno) { 1133 sessionStorage.setItem('last_idx', json.last_insert_id); 1134 $('#activity-view-btn').attr('href', $viewHref + '&activity_idxno='+json.last_insert_id); 1135 } 1136 $('#activity-view-btn').removeClass('is-hidden');*/ 1137 window.parent.location.reload(); 1138 }else{ 1139 //alert(json.msg); 1140 return false; 1141 } 1142 }else return false; 1143 }, 1144 error:function(request,status,error){ 1145 alert("code:"+request.status+"\n"+"message:"+request.responseText+"\n"+"error:"+error); 1146 } 1147 }); 1148 } 1149 } 1150 }); 1151 1152 $('#banner-activity-box').sortable({ 1153 axis: '', 1154 update: function() { 1155 //console.log($(this)); 1156 } 1157 }); 1158 1159 $('.trash').click(function() { 1160 if($('.banner-activity-list').length <= 1) { 1161 alert('ë§ì§ë§ ë°°ëë ìì í ì ììµëë¤.'); 1162 return false; 1163 } 1164 1165 var $this=$(this) 1166 ,$parent = $this.closest('.banner-activity-list'); 1167 1168 $parent.fadeOut('fast', function(){ 1169 $parent.remove(); 1170 }); 1171 }); 1172 1173 $('#all-banner-list').on('click', function(e) { 1174 1175 $this = $(this); 1176 href = $this.attr('href'); 1177 1178 $("#edit-modal-iframe").attr("src", href); 1179 $('#edit-modal').foundation('open'); 1180 1181 return false; 1182 }); 1183 1184 $('#edit-modal').on('open.zf.reveal', function(e){ 1185 $('#for-loading').show(); 1186 }); 1187 1188 $('#edit-modal').on('closed.zf.reveal', function(e){ 1189 $("#edit-modal-iframe").attr("src", "about:blank").height('0px').closest('#activity-modal').css('height', '0px'); 1190 }); 1191 } 1192 1193 ,valid_activity:function() { 1194 if($('#activity_title').val() == '') { 1195 alert('ì 목ì ì ë ¥íì¸ì.'); 1196 $('#activity_title').focus(); 1197 return false; 1198 } 1199 1200 if($('.banner-activity-list').length<=0) { 1201 alert('ë°°ë를 íë ì´ì ì¶ê°íì ì¼ í©ëë¤.'); 1202 return false; 1203 } 1204 1205 return true; 1206 } 1207 1208}; // end adWrite 1209 1210var bannerpop={ 1211 vars:{ 1212 popup:{ 1213 bodyWidth:0 1214 ,bodyLeft:0 1215 ,screenWidth:0 1216 ,popname:"popup_" 1217 ,width:{ window:[],layer:[] } 1218 ,height:{ window:[],layer:[] } 1219 ,top:{ window:[],layer:[] } 1220 ,left:{ window:[],layer:[] } 1221 ,order:0 // z-indexì© ìì°¨ì 1222 ,view:"normal" // ì¼ë° : normal or ê´ë¦¬ì : manager 1223 } 1224 ,isMobileMode:false 1225 } 1226 1227 /** 1228 * ë°°ë í¨ê³¼ 1229 * íê·¸ ìì± ì::: bannerpop.banner(".banner_event_box"); 1230 <div class="boder_box banner_event_box" data-type="slide" data-idxno="3" data-speed="0.3"> 1231 <div class="boder_box beb_box"> 1232 <ul class="no_type beb_ul"> 1233 <li class="beb_li" data-delay="1"><a href=""><img src="http://sample.ndsoftnews.com/template_sian/download.php?idxno=856&file_extension=jpg&filename=Untitled-1.jpg" alt="ë°°ë : ì 목" /></a></li> 1234 <li class="beb_li" data-delay="1"><a href=""><img src="http://sample.ndsoftnews.com/template_sian/download.php?idxno=854&file_extension=jpg&filename=250%B0%E6%B3%B2%B5%B5%B9%CE%BD%C5%B9%AE.jpg" alt="ë°°ë : ì 목" /></a></li> 1235 <li class="beb_li" data-delay="1"><a href=""><img src="http://sample.ndsoftnews.com/template_sian/download.php?idxno=846&file_extension=jpg&filename=330%C6%F7%C5%E4.jpg" alt="ë°°ë : ì 목" /></a></li> 1236 <li class="beb_li" data-delay="1"><a href=""><img src="http://sample.ndsoftnews.com/template_sian/download.php?idxno=848&file_extension=jpg&filename=675_weeklyjournal.jpg" alt="ë°°ë : ì 목" /></a></li> 1237 <li class="beb_li" data-delay="5"><iframe width="640" height="360" src="http://www.youtube.com/embed/dykTgBpgbVs?feature=player_detailpage" frameborder="0" allowfullscreen></iframe></li> 1238 </ul> 1239 </div> 1240 <div class="beb_buttons"> 1241 <button type="button" class="beb_btns beb_btn_prev">ë¤ë¡</button> 1242 <button type="button" class="beb_btns beb_btn_stop">ë©ì¶¤</button> 1243 <button type="button" class="beb_btns beb_btn_next">ìì¼ë¡</button>
1244 </div> 1245 </div> 1246 */ 1247 ,effect:function() 1248 { 1249 var savePrefix = "banner_order_"; 1250 1251 // ë°°ë ëì´ 1252 function setSizeInfo($this){ 1253 var idxno = $this.attr("data-idxno") 1254 ,$ul = $this.find(".beb_ul") 1255 ,$li = $ul.find(".beb_li") 1256 ,boxWidth = $this.innerWidth()||$this.closest("#float_side_box").width() // ì ì¬ì´ëì ë°°ëì¼ê²½ì° ì¬ì¸¡ì 1257 ,liCount = $li.length||0; 1258 1259 // ê´ë¦¬ì íì´ì§ê° ìëë ì¤ì ë ¸ì¶ì¤ì¸ ê²ë§ ì°¾ì 1260 //if(ADM_DOMAIN.indexOf(location.host)<0){ 1261 $.each($li,function(){ 1262 var $this=$(this), len=$this.find(".banner_box").length; 1263 if(!len) $this.remove(); 1264 }); 1265 $li = $ul.find(".beb_li"); 1266 liCount = $li.length||0; 1267 //} 1268 1269 // ë¶ëª¨ë°ì¤ 기ì¤ì¼ë¡ ul ìµë ëì´ ì§ì 1270 $ul.width(boxWidth*liCount); 1271 1272 // ë°°ëë§ë¤ ëì´ê° ë¤ë¥¼ì ìì¼ë ë¶ëª¨ë°ì¤ ëì´ê¸°ì¤ì¼ë¡í¨ 1273 $li.width(boxWidth); 1274 1275 return { 1276 idxno : idxno 1277 ,$ul : $ul 1278 ,$li : $li 1279 ,boxWidth : boxWidth 1280 ,liCount : liCount 1281 }; 1282 } 1283 1284 return { 1285 // ììëë¡ íëì ë°°ëë§ ë³´ì 1286 order:function(){ 1287 var _this = this 1288 ,$this = $(_this) 1289 ,$info = setSizeInfo($this) 1290 ,idxno = $info.idxno 1291 ,$li =$info.$li 1292 ,liCount = $info.liCount-1 1293 ,saveKey = savePrefix+idxno 1294 ,order = Number(localStorage.getItem(saveKey))||0; 1295 1296 // ëë¤ ì íëê²ë§ ë³´ì, ë²í¼ ìì° 1297 $li.css("display","list-item").not(":eq("+order+")").css("display","none"); 1298 1299 localStorage.setItem(saveKey, (order>=liCount ? 0 : order+1)); 1300 } 1301 1302 // random banner 1303 ,random:function(){ 1304 var _this = this 1305 ,$this = $(_this) 1306 ,$info = setSizeInfo($this) 1307 ,$li =$info.$li 1308 ,liCount = $info.liCount 1309 ,random = Math.floor(Math.random()*liCount); 1310 1311 // ëë¤ ì íëê²ë§ ë³´ì, ë²í¼ ìì° 1312 $li.css("display","list-item").not(":eq("+random+")").css("display","none"); 1313 } 1314 1315 // random ë°°ë ì íí ì¬ë¼ì´ë 1316 ,randomSlide:function(){ 1317 bannerpop.effect()['slide'].call(this, true); 1318 } 1319 1320 // slide banner 1321 // rand true or false 1322 ,slide:function(rand){ 1323 var _this = this 1324 ,$this = $(_this) 1325 ,$info = setSizeInfo($this) 1326 ,$ul = $info.$ul 1327 ,$li =$info.$li.css("display","list-item") 1328 ,$btnBox = $this.find(".beb_buttons") 1329 ,$btnStop = $btnBox.find(".beb_btn_stop") 1330 ,$btnCurrent = null // íì¬ ì íë ë²í¼ prev,next,play,stop of buttons 1331 ,speed = Number(_this.getAttribute("data-speed"))||.3 1332 ,delayInfo = $li.map(function(){ return Number(this.getAttribute("data-delay"))||5; }).get() 1333 ,boxWidth =$info.boxWidth 1334 ,liCount = $info.liCount 1335 ,count = (rand===true?Math.floor(Math.random()*(liCount)):-1) // ì²ìë¶í° +1 íê³ ììí기ì -1ì´ê¸°ê°-randomì¼ëë ë°°ëìì¤ 1ê° 1336 ,delay = null // ë©ì¶°ìë ìê°(ì´) 1337 ,left = boxWidth // ìì§ì´ë ê°ê²© 1338 ,si = null // setInterval ë³ì : animate completeìì delayë¡ í´ê²°íë ¤ íëë° ëê° ì ìí림 1339 ,tmpDelay = null // next, prev ì delay ìì´ ëê¹ 1340 ,firstBtnClicked = 0; // prev,nextë¡ ì´ëíëê° - rotateìì ëíë² +,- í기ì ì²ìë§ ì¤íëì´ì¼ í¨ 1341 1342 /**** function //s ****/ 1343 /* 1344 ë¤ì ë°°ë 1345 @params 1346 loop : ë°ë³µë ê²ì¸ê° 1347 mode : + or - 1348 */ 1349 function rotate(loop, mode){ 1350 if(!mode) mode="+"; 1351 if(mode==="+") count++; 1352 else count--; 1353 1354 if(count>=liCount || count<=0) count = 0; // ì§ì°ìê° ë´ì ë°°ì´ì°¾ê¸° key 1355 var front = count+1; // ì§ì°í ìì§ì¬ì¼ íë 거리 미리 ë´ìë 1356 if(count>=(liCount-1)) front = 0; 1357 left = boxWidth*front*-1;
1358 delay = tmpDelay===null?delayInfo[count]:tmpDelay; 1359 1360 si = setTimeout(function(){ 1361 $ul.animate({ marginLeft:left } 1362 ,speed*1000, 1363 function(){ 1364 if(loop===false) $btnCurrent.prop("disabled", false); 1365 tmpDelay = null; 1366 });//.delay(delay*1000); 1367 if(loop!==false) rotate(); 1368 },delay*1000); 1369 } 1370 1371 // stop 1372 function stop(){ 1373 firstBtnClicked++; 1374 1375 //$ul.stop(true, false); 1376 clearTimeout(si); 1377 tmpDelay=null; 1378 $btnStop.addClass("beb_btn_start").text("play"); 1379 } 1380 1381 // restart 1382 function start(){ 1383 firstBtnClicked = 0; 1384 1385 count--; 1386 if(count<=0) count=0; 1387 1388 tmpDelay=null; 1389 rotate(); 1390 1391 $btnStop.removeClass("beb_btn_start").text("ë©ì¶¤"); 1392 } 1393 1394 // ì´ì 1395 function prev(){ 1396 stop(); 1397 1398 if(firstBtnClicked===1) count--; // ì²ìë§ ì´ë¯¸ ì¦ê°ëê°ì ê°ììí´ 1399 if(count<=0) count=liCount; 1400 1401 tmpDelay=0; 1402 rotate(false,"-"); 1403 1404 $btnCurrent.prop("disabled", true); 1405 } 1406 1407 // ì´í 1408 function next(){ 1409 stop(); 1410 1411 if(firstBtnClicked===1) count--; 1412 if(count>=liCount) count=0; 1413 1414 tmpDelay=0; 1415 rotate(false); 1416 1417 $btnCurrent.prop("disabled", true); 1418 } 1419 /**** function //e ****/ 1420 1421 // ì²ì ë°°ë를 ë³´ì´ì§ ìëë¤ë ê²ì ëë¤ ë°°ëì ì¬ë¼ì´ëë¼ë ê²-ì²ìë³´ì¼ë°°ë ì¤ì 1422 if(count>=0 && rand===true){ 1423 var _boxWidth = boxWidth*(count>=liCount?liCount-1:count)*-1; 1424 count--; 1425 $ul.css("margin-left",_boxWidth+"px"); 1426 } 1427 1428 // ì¤í 1429 rotate(); 1430 1431 // ë²í¼ë³´ì 1432 $btnBox/*.css("display","block")*/.find(".beb_btns").unbind("click") 1433 .click(function(){ 1434 var $this = $(this); 1435 1436 $btnCurrent = $this; 1437 if($this.is(".beb_btn_prev")) prev(); 1438 else if($this.is(".beb_btn_next")) next(); 1439 else if($this.is(".beb_btn_stop")){ 1440 if($this.is(".beb_btn_start")) start(); 1441 else stop(); 1442 } 1443 }); 1444 1445 // mouseover event 1446 $ul.on(bannerpop.vars.isMobileMode?{touchstart:stop,touchend:start}:{mouseenter:stop,mouseleave:start}); 1447 } 1448 }; 1449 } 1450 1451 // ë°°ëí¸ì¶ 1452 ,banner:function(target) 1453 { 1454 var parents = this 1455 ,$target = !!target.jquery?target:$(target); 1456 1457 // mobile or pc mode? 1458 try{ bannerpop.vars.isMobileMode=document.querySelector("#user-wrap").className.indexOf("mobile")>=0||false }catch(e){ } 1459 1460 //console.log($target); 1461 $.each($target, function(i, ele){ 1462 var type = ele.getAttribute("data-type")||"random"; 1463 parents.effect()[type].call(this); 1464 }); 1465 } 1466 1467 ,getCookie:function(name) 1468 { /* 1469 var cookie = document.cookie; 1470 if(cookie.indexOf(name)<0) return ""; 1471 1472 var regexp = new RegExp("^(.*)"+name+"=(.*?);(.*)$","g"); 1473 return cookie.replace(regexp,"$2").replace(/^\s+|\s+$/g,""); 1474 */ 1475 name+="="; 1476 var ca = document.cookie.split(';'); 1477 for(var i=0; i<ca.length; i++) { 1478 var c = ca[i]; 1479 while (c.charAt(0)==' ') c = c.substring(1); 1480 if (c.indexOf(name) == 0) return c.substring(name.length,c.length); 1481 } 1482 return ""; 1483 } 1484 1485 ,setCookie:function(name, value, days, domain) 1486 { 1487 var expires = ""; 1488 if(days){ 1489 var date = new Date(); 1490 date.setTime(date.getTime()+(days*24*60*60*1000)); 1491 expires = "; expires="+date.toGMTString(); 1492 } 1493 1494 /* 1495 var dm=SITE_DOMAIN.replace('http://',''); 1496 dm=dm.replace('https://',''); 1497 if(!domain) domain="." + dm; 1498 */ 1499 1500 if(!domain) domain='.'+SITE_DOMAIN.replace(/^http(s)?:\/\//i,'').replace(/^(www|cms|slv|cdn|m)\./i,''); 1501 1502 document.cookie = name+"="+value+expires+"; path=/; " + (domain?"domain="+domain+";":""); 1503 } 1504 1505 // urlì arrayë¡ 1506 ,linkToJson:function(link) 1507 { 1508 if(!link) return false; 1509 1510 var json = {} 1511 ,tmp = link.replace(/^\/\?/,"").split("&"); 1512 1513 if(tmp.length<=0 || !tmp) return false; 1514 for(var i in tmp){ 1515 var param = tmp[i].split("=") 1516 ,key = param[0] 1517 ,value = param[1]; 1518 1519 json[key] = value; 1520 } 1521 return json; 1522 } 1523 1524 // ë°°ë append 1525 ,append:function() 1526 { 1527 var id = ___BANNER 1528 ,status = bannerStatus 1529 ,time = ___currentTime 1530 ,sTime = startTime 1531 ,eTime = endTime 1532 ,content = decodeURIComponent(bannerContent) 1533 ,title = typeof bannerTitle == "undefined" ? "":decodeURIComponent(bannerTitle) 1534 ,$target = $("#"+id) 1535 ,voteUse = typeof bannerVoteUse == "undefined" ? "N":bannerVoteUse 1536 ,explain = ''; 1537 //,explain = "\n<br />"+util.timestampToDatetime(sTime).strDateTime.substring(0,16)+"~"+util.timestampToDatetime(eTime).strDateTime.substring(0,16); 1538 1539 1540 if(!id || $target.length<=0 || $target.attr("data-append")=="true") return false; // ê°ì²´ê° ìê±°ë ììì ,ì´ë¯¸ ì¶ê°ëìë¤ë©´ ì¤ë¨ 1541 1542 // ìì ,ì¢ ë£ ë°°ë 1543 else if(sTime > time || time > eTime || status=="0"){ 1544 var adminPageBool = (location.href.indexOf('/edit/adminSection.html') < 0)? false:true; 1545 if(!adminPageBool) { 1546 if(!($('body').hasClass('ndip_user_body_view') && voteUse == 'Y' && status == "0")) { 1547 return false; // ì¢ ë£ ë©ìì§ ìëì°ê¸° 1548 } 1549 } 1550 var voteAdcClass = ""; 1551 var adcMsg="" 1552 ,adcClass=""; 1553 if(sTime > time && status!="0"){ 1554 adcMsg = 'ë ¸ì¶ìì ë°°ë'; 1555 adcClass = "banner-later"; 1556 }else if(time > eTime || status=="0"){ 1557 adcMsg = 'ì¢ ë£ë ë°°ë'; 1558 adcClass = "banner-finish"; 1559 if(voteUse == "Y") voteAdcClass = "vote_banner_box_finish"; 1560 } 1561 1562 if(!adminPageBool) $target.attr("data-append","true").after('<div class="ad-finished '+voteAdcClass+'"></div>'); // ì ê±°ë°°ë ì¢ ë£ DIV 1563 else $target.attr("data-append","true").after('<div class="ad-finished"><span class="'+adcClass+'"><i class="icon-clock-o"></i> '+adcMsg+' "'+title+'"</span>'+explain+'</div>');
1563 // ì¢ ë£ ë©ìì§ ëì°ê³ ì¢ ë£ 1564 bannerTitle="";//ì´ê¸°í 1565 1566 return false; 1567 } 1568 1569 // cdn host ë°ë¼ê°ê² 1570 var _uri=$target[0].src 1571 ,_host=((typeof URL === "function")?new URL(_uri).origin:_uri.match(/^(http.*)\/bannerpop\//)[1]||""); 1572 if(_host) content=content.replace('<img src="/bannerpop/', '<img src="'+(_host.search(/^http(s)?:\/\/cms\./)<0?_host:SITE_DOMAIN)+'/bannerpop/'); 1573 1574 $target.attr("data-append","true").after(content); // ì¶ê° ëìì¼ë©´ data-append íê·¸ ëê¹ 1575 } 1576 1577 /****** íì ëì°ê¸° 1578 var ___popup = [{},...]; 1579 1580 * json ë´ì© * 1581 idxno - íì idxno ê³ ì ë²í¸ 1582 title - íì ì ì 목 1583 start - íì ììì¼ì 1584 end - íì ì¢ ë£ì¼ì 1585 status - ì§íìí (1=ì§í, 0=ì¢ ë£) 1586 popup_type - íì íí (layer=ë ì´ì´, window=ìëì°) 1587 popup_size - auto (ì¬ì©ìí¨) 1588 popup_width - íì ì°½í¬ê¸°(ê°ë¡) 1589 popup_height - íì ì°½í¬ê¸°(ì¸ë¡) 1590 position - auto (ì¬ì©ìí¨) 1591 x_position - ì°½ì x ìì¹ 1592 y_position - ì°½ì y ìì¹ 1593 apply_page - ì ì©íì´ì§ (main, section, list, view ê°ì´ ì ë ¥ ëì´ìì , phpìì íì´ì§ 구ë¶í´ì jsonì¼ë¡ ë§ë¤ì´ ì¤ëë¤.) 1594 bottom_close - íë¨íì ì°½ë«ê¸° ì¶ë ¥ì¬ë¶ (Y=ì¶ë ¥, N=ì¶ë ¥ìí¨) 1595 bottom_close_expire_ck - **ëì ì´ì§ì기 (none=ì¬ì©ìí¨, day=í루ëì ì´ì§ì기, days=ëªì¼ëì ì´ì§ì기) 1596 bottom_close_expire - ëªì¼ì¸ì§ 1597 layer_border - ë ì´ì´ íì ì¸ ê²½ì° ì¸ê³½ì (Y=ì¬ì©í¨, N=ì¬ì©ìí¨) 1598 layer_move - ë ì´ì´ íì ì¸ ê²½ì° ëëê·¸ ê°ë¥ (Y=ì¬ì©í¨, N=ì¬ì©ìí¨) 1599 layer_scroll - ë ì´ì´ íì ì¸ ê²½ì° ì¤í¬ë¡¤ ë°ë¼ë¤ë기 (Y=ì¬ì©í¨, N=ì¬ì©ìí¨) 1600 layer_close - ë ì´ì´ íì ì¸ ê²½ì° ë«ê¸° ìì´ì½ (Y=ì¬ì©í¨, N=ì¬ì©ìí¨) 1601 layer_close_icon - ë ì´ì´ íì ì¸ ê²½ì° ë«ê¸° ìì´ì½ ì í 1602 layer_close_position - ë ì´ì´ íì ì¸ ê²½ì° ë«ê¸° ìì´ì½ ì¶ë ¥ ìì¹ (TL-ì/ì¢, TR-ì/ì°, BL-í/ì¢, BR-í/ì°) 1603 window_scroll - ìëì° íì ì¸ ê²½ì° ì¤í¬ë¡¤ íì±í (Y=ì¬ì©í¨, N=ì¬ì©ìí¨) 1604 content - ì¶ë ¥ HTML ë´ì© 1605 *****/ 1606 ,float:function(j) 1607 { 1608 // json ê° 1609 var current = ___currentTime 1610 ,start = Number(j.start)||0 1611 ,end = Number(j.end)||(new Date().getTime()+100) // ì¢ ë£ì¼ì´ 기ì ëì§ ììë¤ë©´, íì¬ë³´ë¤ 100ì©ëí´ì ê³ì ë림 1612 ,status = j.status||"0"; 1613 1614 if(this.vars.popup.view!="manager" && (status=="0" || current < start || (current > end && end!==0))) return false; // ì¢ ë£ or 기ê°ì´ ìëë¼ë©´ íµê³¼ 1615 1616 var parents = this 1617 ,idxno = j.idxno||"0" 1618 ,oriTitle = j.title||"" 1619 ,title = decodeURIComponent(j.title)||"" 1620 ,popupType = j.popup_type||"window" 1621 ,popupSize = j.popup_size||"auto" 1622 ,popupWidth = Number(j.popup_width)||0 1623 ,popupHeight = (Number(j.popup_height)||0) + 32 1624 ,position = j.position||"auto" 1625 ,xPosition = Number(j.x_position)||0 1626 ,yPosition = Number(j.y_position)||0 1627 ,applyPage = j.apply_page||"main" 1628 ,bottomClose = j.bottom_close||"N" 1629 ,bottomCloseExpireCk = j.bottom_close_expire_ck||"none" 1630 ,bottomCloseExpire = j.bottom_close_expire||1 1631 ,layerBorder = j.layer_border||"N" 1632 ,layerMove = j.layer_move||"N" 1633 ,layerScroll = j.layer_scroll||"N" 1634 ,layerClose = j.layer_close||"N" 1635 ,layerCloseIcon = j.layer_close_icon||"" 1636 ,layerClosePosition = j.layer_close_position||"BR" 1637 ,windowScroll = j.window_scroll||"Y" 1638 ,content = decodeURIComponent(j.content)||"" 1639 ,popupUrl = j.popup_url||""// + (parents.vars.popup.view=="manager"?"?edit_mode=preview":"")||"" 1640 ,top = 0 1641 ,left = 0 1642 ,popname = parents.vars.popup.popname+idxno 1643 ,_type = popupType; // default: ê°ìëì - íì ê³¼ ë ì´ì´ê° ìì¹ê°ì ê³µì íì¬ ì°¨ë¡ë¡ ëì¸ë ¤ë©´ "window" or ê³µì íì§ ìê³ ê°ì ëì¸ë ¤ë©´ popupType; 1644 1645 var type = { 1646 calcPosition:function(){ 1647 // x,y ê° 0ì¼ëë autoë¡ ê°ì£¼ 1648 if((xPosition===0 && yPosition===0)/* || position=="auto"*/){ 1649 var maxHeight = parents.arrayMaxMin(parents.vars.popup.height[_type],"max") 1650 ,maxTop = parents.arrayMaxMin(parents.vars.popup.top[_type],"max") 1651 ,initLeft = popupType=="window"?0:parents.vars.popup.bodyLeft 1652 ,prevWidth = parents.vars.popup.width[_type][parents.vars.popup.width[_type].length-1]||0 1653 ,prevLeft = parents.vars.popup.left[_type][parents.vars.popup.left[_type].length-1]||initLeft; // ë°ë¡ ì´ì íì ëì´ë¥¼ leftê°ì¼ë¡ ì í¨-window:0, layer:contentì left 1654 1655 //console.log(popupWidth); 1656 left = prevLeft+prevWidth; 1657 1658 // íì´ì§ ëì´ë³´ë¤ ì리ì¡ì leftê°ì´ í¬ë¤ë©´ íë©´ì íë¨ê³ ë´ë¦¼ 1659 if(left>parents.vars.popup[popupType=="window"?"screenWidth":"bodyWidth"]){ 1660 top += maxHeight; 1661 left = initLeft; 1662 1663 // ë¤ì ë¨ê³ì´ëê¹ ì´ê¸°í í¨ 1664 parents.vars.popup.width[_type] = []; 1665 parents.vars.popup.height[_type] = []; 1666 parents.vars.popup.top[_type] = []; 1667 parents.vars.popup.left[_type] = []; 1668 }else{ 1669 top = (maxTop||0); 1670 } 1671 1672 // ë³íëê° ë°°ì´ì ë£ê¸° ìí´ ì¡°ì 1673 xPosition = left; 1674 yPosition = top; 1675 1676 // ë³ìì ë´ì 1677 parents.vars.popup.width[_type].push(popupWidth||0); 1678 parents.vars.popup.height[_type].push(popupHeight||0); 1679 parents.vars.popup.top[_type].push(yPosition||0); 1680 parents.vars.popup.left[_type].push(xPosition||0); 1681 1682 }else{ 1683 top = yPosition; 1684 left = xPosition; 1685 } 1686 } 1687 1688 // ê´ë¦¬ì 미리보기ì ì¤ìì 1689 ,setPositionCenter:function(){ 1690 var _width = (document.body.clientWidth/2)-(popupWidth/2) 1691 ,_scrollTop = document.body.scrollTop; 1692 1693 top = _scrollTop + 50; 1694 left = _width; 1695 } 1696 1697 // ëì¸ íì´ì§ applyPage 1698 ,isApplyPage:function() 1699 { 1700 // ê´ë¦¬ì íµê³¼ 1701 if(parents.vars.popup.view=="manager") return true; 1702 /* 1703 var params = bannerpop.linkToJson(location.search.replace("?","")) 1704 ,mod = params.mod||"" 1705 ,act = params.act||"" 1706 ,section = params.section||""; 1707 1708 // ë©ì¸ 1709 if(((mod=="main" && act=="index" && !section) || (!mod && !act && !section)) && applyPage.indexOf("main")>=0) return true; 1710 // ì¹ì 1711 else if(mod=="main" && act=="index" && section && applyPage.indexOf("section")>=0) return true; 1712 // ê¸°ì¬ ë¦¬ì¤í¸ 1713 else if(mod=="news" && act=="articleList" && applyPage.indexOf("list")>=0) return true; 1714 // 기ì¬ë·° 1715 else if(mod=="news" && act=="articleView" && applyPage.indexOf("view")>=0) return true; 1716 */ 1717 } 1718 1719 ,window:function(){ 1720 //if(this.isApplyPage()!==true) return false; 1721 1722 this.calcPosition(); // ìì¹ ê³ì° 1723 var winpopupUrl = '/bannerpop/popup.html?win_popup_idxno=' + idxno; 1724 window.open(winpopupUrl, popname, "width="+popupWidth+",height="+popupHeight+",scrollbars="+(windowScroll=="Y"?"yes":"no")+",resizable=yes,top="+top+",left="+left); 1725 } 1726 1727 ,layer:function(){ 1728 //if(this.isApplyPage()!==true) return false; 1729 1730 this.calcPosition(); // ìì¹ ê³ì° 1731 1732 var $content = $(content); 1733 1734 $content.attr({"id":popname}) 1735 .css({"top":top+"px","left":left+"px","max-width":popupWidth+"px","min-height":popupHeight+"px","z-index":"100" + parents.vars.popup.order}).addClass("layer_box"+(layerScroll=="Y"?" layer_box_fixed":"")+(layerBorder=="Y"?" layer_box_border":"")) 1736 .find(".popup_close_box").addClass("layer_close_box"); 1737 1738 // ëëê·¸ ê°ë¥ 1739 if(layerMove=="Y") $content.addClass("layer_box_cursor_move").draggable(); 1740 1741 // ì°½ë«ê¸°-icon ë«ê¸° ë²í¼ì ë³ê°ë¤ 1742 //if(bottomClose=="Y"){ 1743 var $btnClose = $content.find(".popup_close, .popup_close_map, .popup_icon_close"); 1744 $btnClose.each(function(){ 1745 var _$this = $(this); 1746 //if(_$this.is(".popup_close") && bottomClose=="Y") _$this.text('ì°½ë«ê¸°'); 1747 1748 if(_$this.is(".popup_icon_close")) { 1749 if(layerClosePosition == 'BL' || layerClosePosition == 'BR') { 1750 1751 if($content.find(".popup_close, .popup_close_map").length>0) { 1752 _$this.css('top',Number(j.popup_height)-40+'px'); 1753 } 1754 } 1755 1756 _$this.addClass("layer_position_"+layerClosePosition); 1757 } 1758 }); 1759 1760 $btnClose.click(function(){ 1761 parents.evtClose(popupType, idxno); 1762 return false; 1763 }); 1764 //} 1765 1766 // ì´ë¯¸ì§ë´ ë§í¬ê° ì°½ë«ê¸° ë¼ë©´ 1767 //$content.find("a[href*='javascript:window.close()']").click(function(){ 1768 $content.find("[href*='javascript:window.close()']").click(function(){ 1769 parents.evtClose(popupType, idxno); 1770 return false; 1771 }); 1772 1773 // í루, ëªì¼ëì ì´ì§ ì기 1774 parents.daysNotOpen(bottomCloseExpireCk, bottomCloseExpire, $content.find(".popup-days, .popup_day_close_map"), j); 1775 1776 // ê´ë¦¬ì 미리보기ì ì¤ìì 1777 if(parents.vars.popup.view=="manager"){ 1778 $content.appendTo(document.body); 1779 this.setPositionCenter(); 1780 $content.removeClass("layer_box_fixed").css({"top":top+"px", "left"
1780:left+"px"}); 1781 }else{ 1782 $content.appendTo($("#layer-popups")); 1783 } 1784 1785 // ì´ë¯¸ì§ë§µ 리ì¬ì´ì¦ 1786 $('img[usemap]', $content).rwdImageMaps(); 1787 } 1788 }; 1789 1790 type[popupType](); 1791 } 1792 1793 // íì ëì°ê¸° 1794 ,popup:function() 1795 { 1796 //try{ 1797 var parents = this; 1798 $(window).on("load", function(){ 1799 if(!window.___popup) return ; 1800 if($.isArray(___popup)===false && ___popup.length>0) return ; 1801 if(!window.___currentTime) ___currentTime = Math.floor(new Date().getTime()/1000);// ìê°ì´ ì¤ì ëì§ ììë¤ë©´ js ìê°ì¼ë¡ ì¤ì í¨ 1802 1803 var $content = $("#layer-popups"); 1804 1805 if($content.length<=0) return false; 1806 parents.vars.popup.bodyWidth = $content.innerWidth(); 1807 parents.vars.popup.bodyLeft = $content.position().left; 1808 parents.vars.popup.screenWidth = window.screen.width; 1809 for(var i=0,cnt=___popup.length; i<cnt; i++){ 1810 // ì¿ í¤ì¸ì§ íë¨í ì´ê¸° 1811 var coo = ""; 1812 coo = bannerpop.getCookie(parents.vars.popup.popname+___popup[i].idxno) 1813 1814 if(!coo){ 1815 parents.vars.popup.order++; 1816 parents.float(___popup[i]); 1817 } 1818 } 1819 }); 1820 //}catch(e){} 1821 } 1822 1823 // ì°½ë«ê¸° 1824 ,evtClose:function(mode, idxno) 1825 { 1826 if(mode=="layer"){ 1827 var layerId = bannerpop.vars.popup.popname+idxno; 1828 1829 $("#"+layerId).fadeOut("fast", function(){ 1830 $(this).remove(); 1831 }); 1832 }else window.close(); 1833 } 1834 1835 // cookie 1836 ,evtCookieClose:function(name, days) 1837 { 1838 bannerpop.setCookie(name, "popup", days); 1839 } 1840 1841 // í루,ëªì¼ëì ì´ì§ ì기 1842 ,daysNotOpen:function(expire, period, $btn, p) 1843 { 1844 var parents = this 1845 ,idxno = p.idxno 1846 ,isClickedMap = false; 1847 1848 if(expire!="none"){ 1849 $btn.each(function(i,v) { 1850 var $thisBtn = $(this); 1851 if($thisBtn.is(".popup-days")){ 1852 // í루ëì 1853 if(expire=="day"){ 1854 $thisBtn.click(function(){ 1855 parents.evtCookieClose(parents.vars.popup.popname+idxno, "1"); 1856 parents.evtClose(p.popup_type, p.idxno); 1857 return false; 1858 }) 1859 // ë«ê¸° íê·¸ ìì ìê²ë ìë ê±° ì°¾ì ë«ê¸° í ì¤í¸ ë£ì´ì£¼ê¸° 1860 .not(":has(*)").html('<a href="#close-to-layer">í루ëì ë³´ì§ ì기</a>'); 1861 } 1862 // ëªì¼ëì daySubfix 1863 else if(expire=="days"){ 1864 var select = '<a href="#link">' 1865 +'<label class="show-for-sr" for="popDays"></label>' 1866 +'<select name="popDays" id="popDays" class="tiny" title="기ê°">' 1867 +' <option value="1">í루</option>' 1868 +' <option value="2">2ì¼</option>' 1869 +' <option value="3">3ì¼</option>' 1870 +' <option value="4">4ì¼</option>' 1871 +' <option value="5">5ì¼</option>' 1872 +' <option value="6">6ì¼</option>' 1873 +' <option value="7">7ì¼</option>' 1874 +'</select> ëì ì´ì§ì기' 1875 +'</a>'; 1876 var html = '<a href="#link">' 1877 + (period>1 ? 'ëªì¼ëì ë³´ì§ ì기' : 'í루ëì ë³´ì§ ì기') 1878 +'</a>'; 1879 //$btn.not(":has(*)").append(select).click(function(){ 1880 $thisBtn.append(html).click(function(){ 1881 var $this = $(this) 1882 //,days = $this.prev("select").val(); 1883 ,days = period; 1884 1885 parents.evtCookieClose(parents.vars.popup.popname+idxno, days); 1886 parents.evtClose(p.popup_type, p.idxno); 1887 return false; 1888 }); 1889 } 1890 }else{ 1891 // ì´ë¯¸ì§ë§µì¼ë, í루ëì ì´ì§ì기 1892 $thisBtn.click(function(){ 1893 parents.evtCookieClose(parents.vars.popup.popname+idxno, "1"); 1894 parents.evtClose(p.popup_type, p.idxno); 1895 return false; 1896 }); 1897 1898 isClickedMap = true; 1899 } 1900 }); 1901 } 1902 1903 // expire ê°ì´ë ê´ê³ìì´ ì´ë¯¸ì§ë§µì ì°¾ì ì²ë¦¬ 1904 if(isClickedMap===false && $btn.is(".popup_day_close_map")){ 1905 // ì´ë¯¸ì§ë§µì¼ë, í루ëì ì´ì§ì기 1906 $btn.click(function(){ 1907 parents.evtCookieClose(parents.vars.popup.popname+idxno, "1"); 1908 parents.evtClose(p.popup_type, p.idxno); 1909 return false; 1910 }); 1911 } 1912 } 1913 1914 // window popup control 1915 ,popupControl:function() 1916 { 1917 if(!___popup) return ; 1918 if((typeof ___popup)!=="object") return ; 1919 1920 var parents = this 1921 ,p = ___popup 1922 ,title = decodeURIComponent(p.title)||"" 1923 ,popupType = p.popup_type||"window" 1924 ,bottomClose = p.bottom_close||"Y" 1925 ,bottomCloseExpireCk = p.bottom_close_expire_ck||"day" // : day,days,none 1926 ,bottomCloseExpire = p.bottom_close_expire||1 // : ëªì¼ 1927 ,$btnClose = $(".popup_close, .popup_close_map, .popup_icon_close") 1928 ,$btnDayClose = $(".popup-days, .popup_day_close_map"); 1929 1930 if(popupType!="window") return ; 1931 1932 // ìëì° ë° íì´í êµì²´ 1933 document.title = title; 1934 1935 // ì°½ë«ê¸° 1936 if(bottomClose=="Y"){ 1937 $btnClose.each(function(){ 1938 var _$this = $(this); 1939 //if(_$this.is(".popup_close")) _$this.text('ì°½ë«ê¸°'); 1940 }); 1941 1942 $btnClose.click(function(){ 1943 parents.evtClose(p.popup_type, p.idxno); 1944 return false; 1945 }); 1946 } 1947 1948 // í루, ëªì¼ëì ì´ì§ ì기 1949 this.daysNotOpen(bottomCloseExpireCk, bottomCloseExpire, $btnDayClose, p);
1950 1951 } 1952 1953 // array ìµê³ ê° 1954 ,arrayMaxMin:function(arr, mode) 1955 { 1956 if($.isArray(arr)===false) return false; 1957 1958 if(!mode) mode = "max"; 1959 arr.sort(function(a, b){ 1960 return b-a; 1961 }); 1962 return (mode=="max"?arr[0]:arr[arr.length-1])||0; 1963 } 1964 1965 // íµê³ ì ë리í±ì¤ ì´ë²¤í¸ ì°ê²° 1966 ,analytics:function(type, banner, agent) { 1967 if (!type||!banner||!agent) return; 1968 1969 switch (type) { 1970 case "view": 1971 agent.forEach(function(agt) { 1972 try{ 1973 if (agt=="ga" && typeof ga!="undefined") { 1974 ga('send', 'event', 'ë°°ëë·°', 'NDVIEWBANNER', banner); 1975 } 1976 if (agt=="gtag" && typeof gtag!="undefined") { 1977 gtag('event', 'NDVIEWBANNER', {'event_category': 'ë°°ëë·°', 'event_label': banner}); 1978 } 1979 if (agt=="gtm" && typeof dataLayer!="undefined") { 1980 dataLayer.push({'event':'NDVIEWBANNER','event_category':'ë°°ëë·°', 'event_label':banner}); 1981 } 1982 if (agt=="wcsnaver" && typeof wcs!="undefined") { 1983 wcs.event(banner, 'NDVIEWBANNER'); 1984 } 1985 } catch (e) {} 1986 }); 1987 break; 1988 1989 case "click": 1990 agent.forEach(function(agt) { 1991 try { 1992 if (agt=="ga" && typeof ga!="undefined") { 1993 ga('send', 'event', 'ë°°ëí´ë¦', 'NDCLICKBANNER', banner); 1994 } 1995 if (agt=="gtag" && typeof gtag!="undefined") { 1996 gtag('event', 'NDCLICKBANNER', {'event_category': 'ë°°ëí´ë¦', 'event_label': banner}); 1997 } 1998 if (agt=="gtm" && typeof dataLayer!="undefined") { 1999 dataLayer.push({'event':'NDCLICKBANNER','event_category':'ë°°ëí´ë¦', 'event_label':banner}); 2000 } 2001 if (agt=="wcsnaver" && typeof wcs!="undefined") { 2002 wcs.event(banner, 'NDCLICKBANNER'); 2003 } 2004 } catch(e) {} 2005 }); 2006 break; 2007 } 2008 2009 // Tip!! 2010 // ga('send', 'event', ì¹´í ê³ ë¦¬, ì¡ì , ë¼ë²¨) // êµ¬ê¸ ì ëë²ì¤ ì ë리í±ì¤ íê·¸ ì¬ì©ì (analytics.js) 2011 // gtag('event', event_name, {event_category, event_label}) // êµ¬ê¸ ê¸ë¡ë² ì¬ì´í¸ íê·¸ ì¬ì©ì (gtag.js) 2012 // dataLayer.push({var:value}); // êµ¬ê¸ íê·¸ ê´ë¦¬ì ë°ì´í° ìì ë³ì íìì (GA4 êµ¬ì± ì¬ì©) 2013 // wcs.event('ì´ë²¤í¸ì¹´í ê³ ë¦¬ëª ', 'ì´ë²¤í¸ëª ') // ë¤ì´ë² ì ë리í±ì¤ ì¬ì©ì 2014 } 2015 2016 ,isMobileDevice:function(){ 2017 return /(iPhone|iPod|IPad|Android|Blackberry|Opera Mini|Windows CE|Nokia|Sony|Samsung|LGTelecom|SKT|Mobile|Phone)/.test(navigator.userAgent); 2018 } 2019}; 2020 2021/****************************************************************************************************************** 2022* ë©í° 기ë¥ì± ë°°ë 2023* 2024* @update 2018/07/18 2025*/ 2026var bannerpopMulti = { 2027 // php ì ë¬ ë³ì 2028 vars:{ 2029 $banner_list:null, 2030 $edit_mode:"" 2031 } 2032 2033 // íì´ì§ ì´ê¸° ë¡ë 2034 ,init:function() { 2035 $('input[name="effect_type"]').on("click", function() { 2036 if ($(this).val()=='none') { 2037 $("#row_num").val(0).attr("disabled", true); 2038 $("#scroll_num").val(0).attr("disabled", true); 2039 } else { 2040 $("#row_num").removeAttr("disabled"); 2041 $("#scroll_num").removeAttr("disabled"); 2042 } 2043 }); 2044 2045 $('input[name="autoplay"]').on("click", function() { 2046 if ($(this).val()=='Y') { 2047 $("#autoplay_speed").removeAttr("disabled"); 2048 } else { 2049 $("#autoplay_speed").attr("disabled", true); 2050 } 2051 }); 2052 2053 $('#all-banner-list').on('click', function(e) { 2054 $this = $(this); 2055 href = $this.attr('href'); 2056 $("#edit-modal-iframe").attr("src", href); 2057 $('#edit-modal').foundation('open'); 2058 return false; 2059 }); 2060 2061 $('#banner-activity-box').sortable({ 2062 axis: '', 2063 update: function() { 2064 console.log($(this)); 2065 } 2066 }); 2067 2068 $('#edit-modal').on('open.zf.reveal', function(e){
2069 $('#for-loading').show(); 2070 }); 2071 2072 $('#edit-modal').on('closed.zf.reveal', function(e){ 2073 $("#edit-modal-iframe").attr("src", "about:blank").height('0px').closest('#activity-modal').css('height', '0px'); 2074 }); 2075 2076 $(document).on("click", '.trash', function() { 2077 var $this=$(this) 2078 ,$parent = $this.closest('.banner-activity-list'); 2079 $parent.fadeOut('fast', function(){ 2080 $parent.remove(); 2081 }); 2082 }); 2083 } 2084 2085 // ë°°ë ê°ì ¸ì¤ê¸° 2086 ,evtClickMultipleAdd:function() { 2087 var multi_idxno=window.parent.$('#all-banner-list').closest('div').attr('data-multi-idxno')||''; 2088 $('#activity-add-btn').on("click", function() { // #activity-add-btn 기ë¥ì±ë°°ë ë²í¼ í´ë¦ ì´ë²¤í¸ë¥¼ ì´ì© 2089 var $this=$(this); 2090 if($('.banner_element_ckecked').is(':checked') == false) { 2091 alert('ë°°ë를 ì íí´ì£¼ì¸ì.'); 2092 return false; 2093 }else{ 2094 var $checked=$(".banner_element_ckecked:checked") 2095 ,arr = new Array(); 2096 if($checked.length>0) { 2097 $.each($checked, function(idx, v) { 2098 arr.push(v.value); 2099 }); 2100 2101 var data = {mode:multi_idxno?'modify':'input', multi_idxno:multi_idxno, banner_idxno:arr}; 2102 data = JSON.stringify(data); 2103 //console.log(data); 2104 2105 $.ajax({
2106 url:"/bannerpop/activity_multi_act.php" 2107 ,type:'post' 2108 ,dataType:'json' 2109 ,contentType:'application/x-www-form-urlencoded; charset=utf-8' 2110 ,data:{post_data:data} 2111 ,success:function(json, result) { 2112 if(result == 'success') { 2113 if(json.response == 'ok') { 2114 var item = JSON.parse(json.data), 2115 $target = window.parent.$("#banner-activity-box"), 2116 $sample = window.parent.$("#sample"); 2117 bannerpopMulti.vars.$banner_list = item; 2118 bannerpopMulti.bannerCollocate($target, $sample); 2119 window.parent.$(".close-button").trigger("click"); 2120 }else{ 2121 return false; 2122 } 2123 }else return false; 2124 }, 2125 error:function(request,status,error){ 2126 alert("code:"+request.status+"\n"+"message:"+request.responseText+"\n"+"error:"+error); 2127 } 2128 }); 2129 } 2130 } 2131 }); 2132 } 2133 2134 // ë°°ë ë°°ì¹ í기 2135 ,bannerCollocate:function($targetArea, $sample) { 2136 if (!this.vars.$banner_list) return false; 2137 if (typeof $targetArea != "object" || typeof $sample != "object") return false; 2138 var item = this.vars.$banner_list; 2139 for (var i=0;i<item.length;i++) { 2140 var $areaBox = $targetArea, 2141 $clone = $sample.clone(), 2142 stateIcon = ""; 2143 if (typeof $clone == "object") { 2144 if (item[i].state=="previous") stateIcon = '<span class="label success tiny">ì§íì </span>'; 2145 else if (item[i].state=="proceeding") stateIcon = '<span class="label tiny">ì§íì¤</span>'; 2146 else stateIcon = '<span class="label secondary tiny">ì§íì¢ ë£</span>'; 2147 $clone.attr("data-banner-idxno", item[i].idxno); 2148 $clone.find(".banner-activity-list").attr("data-banner-idxno", item[i].idxno).end(). 2149 find(".dis-table-cell").append(item[i].banner).end(). 2150 find('input[name="banner_idxno[]"]').val(item[i].idxno).end(). 2151 find(".dis-status").empty().append(stateIcon).end(). 2152 find('input[name="delay[]"]').attr("id", "delay_"+item[i].idxno).attr("value", item[i].delay).end(). 2153 find('.input-group-label').attr("for", "delay_"+item[i].idxno); 2154 $areaBox.append($clone.html()); 2155 } 2156 } 2157 } 2158 2159 // ì íë ë°°ë íì 2160 ,selectBannerCheck:function() { 2161 var $areaBox = window.parent.$("#banner-activity-box"), 2162 $list = $areaBox.find('input[name="banner_idxno[]"]'), 2163 $bannerItems = $(".adccfg_list_items"), 2164 bannerList = [], 2165 i = 0; 2166 $list.each(function() { 2167 bannerList.push($(this).val()); 2168 }); 2169 //console.log(bannerList); 2170 2171 $bannerItems.each(function() { 2172 var $this = $(this), 2173 idxno = $this.attr("data-banner-idxno"); 2174 if ($.inArray(idxno, bannerList)!=-1) { 2175 $this.find(".ad-tile").append('<div class="content-inert"><button type="button" class="content-buttons display has-tip" title="ì½ì ëë°°ë" data-tooltip><i class="icon-tv"><span class="show-for-sr">ì½ì ëë°°ë</span></i></button></div>'); 2176 } 2177 }); 2178 } 2179 2180 // ë°°ë ë±ë¡í기 2181 ,valid_multi:function(form) { 2182 if(form.title.value == '') { 2183 alert('ì 목ì ì ë ¥íì¸ì.'); 2184 form.title.focus(); 2185 return false; 2186 } 2187 2188 if (form.column_num.value>9) { 2189 alert("ì´ìë 1~9ê¹ì§ë§ ì ë ¥í ì ììµëë¤."); 2190 form.column_num.focus(); 2191 return false; 2192 } 2193 2194 if (form.row_num.value>9) { 2195 alert("íìë 1~9ê¹ì§ë§ ì ë ¥í ì ììµëë¤."); 2196 form.row_num.focus(); 2197 return false; 2198 } 2199 2200 if (form.scroll_num.value>9) { 2201 alert("ì¤í¬ë¡¤ìë 1~9ê¹ì§ë§ ì ë ¥í ì ììµëë¤."); 2202 form.scroll_num.focus(); 2203 return false; 2204 } 2205 2206 if($('.banner-activity-list').length-1<=0) { 2207 alert('ë°°ë를 íë ì´ì ì¶ê°íì ì¼ í©ëë¤.'); 2208 return false; 2209 } 2210 2211 return true; 2212 } 2213 2214 // ë©í° 기ë¥ì± ë°°ë ì´ë²¤í¸ ë¡ë 2215 ,bannerLoad:function() { 2216 $('.banner-multi-box').each(function() { 2217 var $effectType = $(this).attr("data-effect-type"), 2218 $rowNum = $(this).attr("data-row-num")||1,
2219 $colNum = $(this).attr("data-column-num")||1, 2220 $scrollNum = $(this).attr("data-scroll-num")||1, 2221 $moveDisplay = $(this).attr("data-move-display")||'none', 2222 $autoplay = $(this).attr("data-autoplay")||'N', 2223 $autoplaySpeed = $(this).attr("data-autoplay-speed")||5, 2224 $speed = $(this).attr("data-speed")||300, 2225 $random = $(this).attr("data-random")||'N', 2226 $bannerMultiBoxHtml = $(this); 2227 2228 // ìì½ë°°ëì´ê±°ë ì¢ ë£ ë°°ëì¼ ê²½ì° ì ì¸ ì²ë¦¬. 2229 if(location.href.indexOf('/edit/adminSection.html')<0) { 2230 $(this).find(".slick-slide").each(function(){ 2231 if($(this).find('.banner_box').length<=0) { 2232 //$bannerMultiBoxHtml.find(".slick-slide").eq($(".slick-slide", $bannerMultiBoxHtml).index(this)).remove(); 2233 $(this).remove(); 2234 } 2235 }); 2236 } 2237 2238 if ($effectType!="none") { 2239 var totalSlide=$(this).find(".slick-slide").length||0, 2240 slideCount=$effectType=="horizon"?(totalSlide/Number($rowNum))||0:totalSlide, 2241 randomStart=Math.floor(Math.random()*slideCount); 2242 randomStart = ($random=="Y") ? randomStart : 0; 2243 2244 var slickParam = {}; 2245 slickParam.prevArrow = '<button type="button" class="roll-btns btn-prev"><i class="icon-angle-left-thin"><span class="show-for-sr">prev</span></i></button>'; // ì´ì ë²í¼ 2246 slickParam.nextArrow = '<button type="button" class="roll-btns btn-next"><i class="icon-angle-right-thin"><span class="show-for-sr">next</span></i></button>'; // ë¤ìë²í¼ 2247 slickParam.infinite = true; // 무í ë기기 2248 slickParam.draggable = false; // ì ì¤ì²(모ë°ì¼ì©) 2249 2250 switch ($effectType) { 2251 case "vertical": 2252 slickParam.slidesToShow = parseInt($rowNum,10); 2253 slickParam.vertical = true; 2254 slickParam.verticalSwiping = true; 2255 if ($random=="Y"&&totalSlide>parseInt($rowNum,10)) slickParam.initialSlide = randomStart; 2256 break; 2257 case "horizon": 2258 default: 2259 slickParam.slidesToShow = parseInt($colNum,10); 2260 if (parseInt($rowNum,10)>1) slickParam.rows = parseInt($rowNum,10); 2261 if ($random=="Y") slickParam.initialSlide = randomStart; 2262 break; 2263 } 2264 2265 slickParam.slidesToScroll = parseInt($scrollNum,10); 2266 slickParam.arrows = ($moveDisplay=="arrow"&&bannerpopMulti.vars.$edit_mode!="delete")?true:false; 2267 slickParam.dots = ($moveDisplay=="dot"&&bannerpopMulti.vars.$edit_mode!="delete")?true:false; 2268 slickParam.dotsClass = "auto-pager"; 2269 slickParam.autoplay = ($autoplay== "Y")?true:false; 2270 slickParam.autoplaySpeed = ($autoplay== "Y")?parseInt($autoplaySpeed,10)*1000:0; 2271 slickParam.speed = parseInt($speed, 10); 2272 slickParam.centerMode = false; 2273 slickParam.variableWidth = false; 2274 slickParam.focusOnSelect = true; 2275 //console.log(slickParam); 2276 2277 $(this).slick(slickParam); 2278 } else { 2279 if ($random=="Y") shuffle($(this)); 2280 } 2281 2282 function shuffleArray(d) { 2283 for (var c = d.length - 1; c > 0; c--) { 2284 var b = Math.floor(Math.random() * (c + 1)); 2285 var a = d[c]; 2286 d[c] = d[b]; 2287 d[b] = a; 2288 } 2289 return d; 2290 } 2291 2292 function shuffle(target){ 2293 var $box = $(target).children(".slick-slide-none") 2294 ,$container = $box.children(".row") 2295 ,$li = $box.find(".columns") 2296 ,total = $li.length 2297 ,tmp = []; 2298 2299 for(var i=0;i<total;i++) tmp.push(i); 2300 2301 $container.empty(); 2302 setTimeout(
2303 shuffleArray(tmp).forEach(function(a,b){ 2304 var $bannerBoxs=$li[a].querySelectorAll(".banner_box") 2305 ,length=$bannerBoxs.length 2306 ,div=document.createElement("div"); 2307 for(var i=0;i<length;i++){ 2308 div.appendChild($bannerBoxs[i]); 2309 div.className = "columns"; 2310 } 2311 $container.append(div); 2312 }) 2313 ,0); 2314 } 2315 }); 2316 } 2317}; 2318 2319/* ****************************************** */ 2320/* /script/resizePhoto.js */ 2321/* ****************************************** */ 2322 2323function resizePhoto() { 2324 2325 var $_container = $('#article-view-content-div'); 2326 var articleViewDivWidth = $_container.width(); 2327 2328 $_container.find('img').each(function(e){ 2329 if($(this).closest('figure').length) { 2330 var ViewimageObj = new Image(); 2331 var $_thisImgObj = $(this); 2332 ViewimageObj.src = $(this).attr("src"); 2333 ViewimageObj.onload = function() { 2334 imageWidth = this.width; 2335 if(articleViewDivWidth <= imageWidth) { 2336 $_thisImgObj.closest('figure').addClass('bigsize'); 2337 } 2338 }; 2339 2340 } 2341 }); 2342 2343 $_container.on('click', 'figure.bigsize', function(e){ 2344 $('<form action="/news/userArticlePhoto.html" method="POST"><input type="hidden" name="src" value="'+$(this).find("img").attr('src')+'"></form>').appendTo('body').submit(); 2345 }) 2346 .on('click', 'figure.bigsize figcaption', function(e){ 2347 e.preventDefault(); 2348 e.stopPropagation(); 2349 }); 2350} 2351 2352/* ****************************************** */ 2353/* /script/floating.banner.js */ 2354/* ****************************************** */ 2355$(function() { 2356 $(window).scroll(function() { 2357 2358 if(!($('#floating_banner_left').length || $('#floating_banner_right').length)) return false; 2359 2360 var floatBannerLeft = $('#floating_banner_left'), 2361 floatBannerRight = $('#floating_banner_right'), 2362 2363 HeadHeight = $('#user-header').height(), 2364 footerBoxTop = $('#user-footer').offset().top, 2365 footerBoxHeight = $('#user-footer').height(), 2366 2367 scrollTop = $(window).scrollTop(), 2368 2369 flBnLHeight = floatBannerLeft.height(), 2370 flBnRHeight = floatBannerRight.height(), 2371 2372 ahtHeight = $('.aht-wrapper').height(), 2373 2374 flBnLscrollLimit = footerBoxTop - flBnLHeight - HeadHeight - floatBannerLeft.data('down-margin'), 2375 flBnLscrollLimitChk = flBnLscrollLimit + footerBoxHeight + floatBannerLeft.data('down-margin'), 2376 flBnRscrollLimit = footerBoxTop - flBnRHeight - HeadHeight - floatBannerRight.data('down-margin'), 2377 flBnRscrollLimitChk = flBnRscrollLimit + footerBoxHeight + floatBannerRight.data('down-margin'), 2378 2379 flBnLscrollTop = scrollTop - HeadHeight + ahtHeight + floatBannerLeft.data('top-margin'), 2380 flBnRscrollTop = scrollTop - HeadHeight + ahtHeight + floatBannerRight.data('top-margin'); 2381 2382 if(floatBannerLeft.data('scroll') == 'y'){ 2383 if(floatBannerLeft.data('duration') > 0) floatBannerLeft.stop(); 2384 if(scrollTop < HeadHeight) floatBannerLeft.animate({top: '0px'}, floatBannerLeft.data('duration'), 'linear'); 2385 else if(scrollTop >= flBnLscrollLimitChk) floatBannerLeft.animate({top:flBnLscrollLimit + 'px'}, floatBannerLeft.data('duration'), 'linear'); 2386 else if(scrollTop >= HeadHeight) floatBannerLeft.animate({top:flBnLscrollTop + 'px'}, floatBannerLeft.data('duration'), 'linear'); 2387 } 2388 2389 if(floatBannerRight.data('scroll') == 'y'){ 2390 if(floatBannerRight.data('duration') > 0) floatBannerRight.stop(); 2391 if(scrollTop < HeadHeight) floatBannerRight.animate({top: '0px'}, floatBannerRight.data('duration'), 'linear'); 2392 else if(scrollTop >= flBnRscrollLimitChk) floatBannerRight.animate({top:flBnRscrollLimit + 'px'}, floatBannerRight.data('duration'), 'linear'); 2393 else if(scrollTop >= HeadHeight) floatBannerRight.animate({top:flBnRscrollTop + 'px'}, floatBannerRight.data('duration'), 'linear'); 2394 } 2395 }); 2396}); 2397 2398/* ****************************************** */ 2399/* /script/mosaic.js */ 2400/* ****************************************** */ 2401 2402function mosaic_autobox(data) { 2403 var $_container = $(data[0].container); 2404 var autoplay = data[0].autoplay; 2405 var autotime = data[0].autotime; 2406 var temp_autoplay = autoplay; 2407 var totalcount = $_container.find('ul.auto-nav > li').length; 2408 var point = 0; 2409 2410 $_container.on('mouseenter', '.auto-cursor', function(e){
2411 mosaic_cmd('current', $(this).index()); 2412 }); 2413 2414 $_container.on('mouseenter', function(e){ 2415 if(autoplay) temp_autoplay = false; 2416 }).on('mouseleave', function(e){ 2417 if(autoplay) temp_autoplay = true; 2418 }); 2419 2420 if(autoplay) { 2421 var rolling = window.setInterval(function () { 2422 if(temp_autoplay) mosaic_cmd('next', 0); 2423 }, autotime); 2424 } 2425 2426 function mosaic_cmd(mode, current_point) { 2427 2428 if(mode == "prev") { 2429 point -= 1; 2430 if(point < 0) point = totalcount - 1; 2431 }else if(mode == "next") { 2432 point += 1; 2433 if(point >= totalcount) point = 0; 2434 }else if(mode == "current") { 2435 point = current_point; 2436 } 2437 2438 $_container.find('ul.auto-container > li').eq(point).show().siblings().hide(); 2439 $_container.find('ul.auto-nav > li').eq(point).addClass('active').siblings().removeClass('active'); 2440 2441 if(point < 2){ 2442 $_container.find('ul.auto-container').css({"left":"33.333333%","top":"33.333333%"}); 2443 } else if(point < 4 && point >= 2) { 2444 $_container.find('ul.auto-container').css({"left":"0px","top":"33.333333%"}); 2445 } else if(point < 6 && point >= 4) { 2446 $_container.find('ul.auto-container').css({"left":"0px","top":"0px"}); 2447 } else if(point >= 6) { 2448 $_container.find('ul.auto-container').css({"left":"33.333333%","top":"0px"}); 2449 } 2450 2451 return false; 2452 } 2453} 2454 2455/* ****************************************** */ 2456/* /script/newsAutoCall.js */ 2457/* ****************************************** */ 2458 2459function fn_articleAutoCall(mode, cycle) { 2460 2461 var autoCallMode = mode; 2462 var autoCallCycle = 1000*60*cycle; 2463 var _autoCallWatch = setInterval(action, autoCallCycle); 2464 2465 // DESKì¤ë³µìì ì´ë©´ ì´ê¸° 1í ë°ë¡ì¤í. 2466 if(autoCallMode == "desk") action(); 2467 2468 function action() { 2469 if(autoCallMode == "save") { 2470 if($('.auto-save', '#admin-aside').length > 0 && $('input:hidden[name="autoSave"]', '#newsWriteForm').val() != "") $('.auto-save', '#admin-aside').show(); 2471 TxRx("/news/articleAutoSave.ajax.php"); 2472 } 2473 else if(autoCallMode == "desk") TxRx("/news/articleAutoDesk.ajax.php"); 2474 else stop(); 2475 } 2476 2477 function TxRx(url) { 2478 2479 $.ajax({ 2480 type: "post", 2481 dataType: "json", 2482 url:url, 2483 data:$('#newsWriteForm').serialize(), 2484 success: function(data) { 2485 console.log(data[1]); 2486 }, 2487 error: function(error, request) { 2488 console.log("ìëì½ìë¬ - code:"+request.status+"\n"+"message:"+request.responseText+"\n"+"error:"+error); 2489 stop(); 2490 } 2491 }).always(function() { 2492 if($('.auto-save', '#admin-aside').length > 0) $('.auto-save', '#admin-aside').fadeOut(1500); 2493 }); 2494 } 2495 2496 function stop() { 2497 clearInterval(_autoCallWatch); 2498 console.log(autoCallMode + 'ì¤í±'); 2499 } 2500} 2501 2502/* ****************************************** */ 2503/* 기존 common.js */ 2504/* ****************************************** */ 2505 2506/*--------------------------------------------------------------------------------------------- 2507 JAVASCRIPT CODE 2508 --------------------------------------------------------------------------------------------- 2509 function name | description | use process 2510 --------------------------------------------------------------------------------------------- 2511 setCookie(ì¿ í¤ëª , ê°, ì í¨ê¸°ê°(ì¼)) | | ì¿ í¤ìì± 2512 getCookie(ì¿ í¤ëª ) | | ì¿ í¤ê°ì ¸ì¤ê¸° 2513 ---------------------------------------------------------------------------------------------*/ 2514 2515// ì¿ í¤ ìì± 2516function setCookie(cName, cValue, cDay, cDomain){ 2517 var expire = new Date(); 2518 expire.setDate(expire.getDate() + cDay); 2519 var cookies = cName + '=' + escape(cValue) + '; path=/; '; // íê¸ ê¹¨ì§ì ë§ê¸°ìí´ escape(cValue)를 í©ëë¤. 2520 if(typeof cDay!='undefined') cookies += 'expires=' + expire.toGMTString() + '; '; 2521 if(typeof cDomain!='undefined') cookies += "domain=" + cDomain + ';'; 2522 else { 2523 var host=(typeof SITE_DOMAIN!='undefined')?SITE_DOMAIN:window.location.host 2524 ,domain='.'+host.replace(/^http(s)?:\/\//i,'').replace(/^(www|cms|slv|cdn|m)\./i,''); 2525 cookies += "domain=" + domain + ';'; 2526 } 2527 document.cookie = cookies; 2528} 2529
2530// ì¿ í¤ ê°ì ¸ì¤ê¸° 2531function getCookie(cName) { 2532 cName = cName + '='; 2533 var cookieData = document.cookie; 2534 var start = cookieData.indexOf(cName); 2535 var cValue = ''; 2536 if(start != -1){ 2537 start += cName.length; 2538 var end = cookieData.indexOf(';', start); 2539 if(end == -1)end = cookieData.length; 2540 cValue = cookieData.substring(start, end); 2541 } 2542 return unescape(cValue); 2543} 2544 2545// ì¿ í¤ ì§ì 2546function delCookie(cName) { 2547 var today = new Date(); 2548 today.setTime(today.getTime() - 1); 2549 var value = getCookie(cName); 2550 if(value != "") { 2551 var host=(typeof SITE_DOMAIN!='undefined')?SITE_DOMAIN:window.location.host 2552 ,domain='.'+host.replace(/^http(s)?:\/\//i,'').replace(/^(www|cms|slv|cdn|m)\./i,'') 2553 ,cookies = cName + "=" + value + "; path=/; expires=" + today.toGMTString() + '; ' + "domain=" + domain + ';'; 2554 document.cookie = cookies; 2555 } 2556} 2557 2558 2559/*--------------------------------------------------------------------------------------------- 2560 JAVASCRIPT CODE 2561 --------------------------------------------------------------------------------------------- 2562 function name | description | use process 2563 --------------------------------------------------------------------------------------------- 2564 checkMsgLength() | ì ë ¥ë 문ìì´ ê¸¸ì´ ê²ì¬ | ê¸°ì¬ ëê¸ 2565 calculateMsgLength() | 문ìì´ ê¸¸ì´ ë°í | ê¸°ì¬ ëê¸ 2566 assertMsgLength() | 문ìì´ ê¸¸ì´ë§í¼ ìë¼ ë³í | ê¸°ì¬ ëê¸ 2567 ---------------------------------------------------------------------------------------------*/ 2568 2569// 문ìì´ê¸¸ì´ ê²ì¬ 2570function checkMsgLength(frm, id, lenStr) { 2571 var length = calculateMsgLength(document.getElementById(frm).value); 2572 document.getElementById(id).innerHTML = length; 2573 if (length > lenStr) { 2574 alert("ìµë "+lenStr+" ë°ì´í¸ê¹ì§ ë¨ê¸°ì¤ ì ììµëë¤.\r\nì´ê³¼ë " + (length - lenStr) + "ë°ì´í¸ë ìëì¼ë¡ ìì ë©ëë¤."); 2575 document.getElementById(frm).value = assertMsgLength(document.getElementById(frm).value, lenStr, id); 2576 } 2577} 2578 2579//문ìì´ê¸¸ì´ ë°í 2580function calculateMsgLength(message) { 2581 var nbytes = 0; 2582 2583 for (i=0; i<message.length; i++) { 2584 var ch = message.charAt(i); 2585 2586 if (escape(ch).length > 4) { 2587 nbytes += 2; 2588 } else if (ch != "\r") { 2589 nbytes++; 2590 } 2591 } 2592 2593 return nbytes; 2594} 2595 2596//문ìì´ ê¸¸ì´ë§í¼ ìë¼ ë³í 2597function assertMsgLength(message, maximum, id) { 2598 var inc = 0; 2599 var nbytes = 0; 2600 var msg = ""; 2601 var msglen = message.length; 2602 2603 for (i=0; i<msglen; i++) { 2604 var ch = message.charAt(i); 2605 2606 if (escape(ch).length > 4) { 2607 inc = 2; 2608 } else if (ch != "\r") { 2609 inc = 1; 2610 } 2611 2612 if ((nbytes + inc) > maximum) { 2613 break; 2614 } 2615 2616 nbytes += inc; 2617 msg += ch; 2618 } 2619 2620 document.getElementById(id).innerHTML = nbytes; 2621 return msg; 2622} 2623 2624 2625// ê´ë¦¬ììì 기ì¬ë³¸ë¬¸ ë³µì¬íì¬ ë¸ë¡ê·¸ì í¼ ë를ì ë§í¬ê° ê´ë¦¬ì ë§í¬ë¡ ëì´ ì´ë¥¼ ë³´ì 2626function avReplaceImgUrlOnCopy(){ 2627 var $aView=document.querySelector('#article-view') 2628 ,chgUrl=CDN_DOMAIN||SITE_DOMAIN; 2629 2630 if(!$aView || !chgUrl) return ; 2631 $aView.addEventListener("copy", function(e){ 2632 Array.prototype.slice.call(e.currentTarget.querySelectorAll("img,a[href^='/news/download.php']")).map(function($o, i){ 2633 if($o.tagName.toLowerCase() == 'a'){ // download link 2634 var href=$o.getAttribute("href"); 2635 $o.href=SITE_DOMAIN+href; 2636 }else{ // image 2637 var src=$o.getAttribute("src"); 2638 if(!/^http(s)?:\/\//i.test(src)) $o.src=chgUrl+src; 2639 } 2640 }); 2641 }); 2642} 2643 2644/*--------------------------------------------------------------------------------------------- 2645 JAVASCRIPT CODE 2646 --------------------------------------------------------------------------------------------- 2647 function name | description | use process 2648 --------------------------------------------------------------------------------------------- 2649 articleHeader() | 기ì¬ë·° í¤ë ë¤ë¹ | 기ì¬ë·° í¤ë ë¤ë¹ 2650 ---------------------------------------------------------------------------------------------*/ 2651 2652var articleHeader = { 2653 2654 // í¤ë ë¤ë¹ê²ì´ì ìì± 2655 setScroll:function(){ 2656 jQuery(window).scroll(function() { 2657 if (jQuery(this).scrollTop() > 300) { 2658 jQuery('#sticky-header').addClass('scroll'); 2659 } else { 2660 jQuery('#sticky-header').removeClass('scroll'); 2661 } 2662 }); 2663 }, 2664 2665 2666 // 기ì¬ì´ë 2667 move:function(mod, order_type, order_value, section_code, sub_section_code, serial_code){ 2668 jQuery.post( "ajaxGetForwardIdxno.php", { mod: mod, order_type:order_type, order_value: order_value, section_code: section_code, sub_section_code: sub_section_code, serial_code: serial_code }, function( f_idxno ) { 2669 2670 if(f_idxno){ 2671 location.href = '/news/articleView.html?idxno='+f_idxno 2672 }else{ 2673 alert('기ì¬ê° ì¡´ì¬íì§ ììµëë¤'); 2674 } 2675 2676 }); 2677 } 2678 2679} 2680 2681 2682/*--------------------------------------------------------------------------------------------- 2683 JAVASCRIPT CODE 2684 --------------------------------------------------------------------------------------------- 2685 function name | description | use process 2686 --------------------------------------------------------------------------------------------- 2687 bbsPrint(idxno) | ê²ì물 ì¸ìì°½ ì¤í | ê²ì물 ì¸ìì°½ ì¤í 2688 articlePrint(idxno) | ì¸ìì°½ ì¤í | ì¸ìì°½ ì¤í 2689 articleMail(idxno) | ë©ì¼ë³´ë´ê¸°ì°½ ì¤í | ë©ì¼ë³´ë´ê¸°ì°½ ì¤í 2690 articleErr(idxno) | ì¤ë¥ì ê³ ì°½ ì¤í | ì¤ë¥ì ê³ ì°½ ì¤í 2691 articleSingo(idxno) | ëê¸ì ê³ ì°½ ì¤í | ëê¸ì ê³ ì°½ ì¤í
2692 fn_guid() | (ëë¤)ê³ ì ìì´ë ìì± | (ëë¤)ê³ ì ìì´ë ìì± 2693 ---------------------------------------------------------------------------------------------*/ 2694 2695//ì¸ìì°½ ì¤í 2696function bbsPrint( idxno, ps ) { 2697 var ps_str = ""; 2698 if(ps != "") ps_str = "&ps="+ps; 2699 window.open('/bbs/bbsPrint.html?idxno='+idxno+ps_str, 'bbsPrint', 'width=660,height=500,scrollbars=yes'); 2700} 2701 2702// ì¸ìì°½ ì¤í 2703function articlePrint( idxno ) { 2704 window.open('/news/articlePrint.html?idxno='+idxno, 'articlePrint', 'width=660,height=500,scrollbars=yes'); 2705} 2706 2707// ë©ì¼ë³´ë´ê¸°ì°½ ì¤í 2708function articleMail( idxno ) { 2709 window.open('/news/articleMail.html?idxno='+idxno, 'articleMail', 'width=660,height=500,scrollbars=yes'); 2710} 2711 2712// ì¤ë¥ì ê³ ì°½ ì¤í 2713function articleErr( idxno ) { 2714 window.open('/news/articleErr.html?idxno='+idxno, 'articleErr', 'width=660,height=500,scrollbars=yes'); 2715} 2716 2717// ëê¸ì ê³ ì°½ ì¤í 2718function articleSingo( idxno ) { 2719 window.open('/news/articleSingo.html?idxno='+idxno, 'articleSingo', 'width=660,height=500,scrollbars=yes'); 2720} 2721 2722//ê³ ì ê°ìì± (기ì¬ë±ë¡ ê´ë ¨ê¸°ì¬ ëì¸ë ì¬ì©) 2723function fn_guid() { 2724 function s4() { 2725 return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); 2726 } 2727 return s4() + s4() + s4() + s4() + s4() + s4() + s4() + s4(); 2728} 2729 2730/***************************************************************************** 2731*ê²ìí ì¹´í ê³ ë¦¬ ì¤ì 2732*****************************************************************************/ 2733var bbsCfg={ 2734 2735 // ì¹´í ê³ ë¦¬ ì í 2736 setCategory:function() { 2737 2738 // ì¶ê° 2739 $('#admin-content').on('click', '#btn_category_add, .btn_category_delete, .btn_category_modify', function(e){ 2740 2741 var _this = this 2742 ,$this = $(_this) 2743 ,isAddButton = $this.is("#btn_category_add") 2744 ,isDltButton = $this.is(".btn_category_delete") 2745 ,isModalButton = $this.is(".btn_category_modify") 2746 ,$categoryName = $('#category_name').val() 2747 ,categoryArr = $categoryName.split(','); 2748 2749 if(isAddButton){ // ì¶ê° 2750 categoryArr =categoryArr.filter(Boolean); 2751 for (var i in categoryArr) { 2752 var category = categoryArr[i]; 2753 2754 // íì í목 ì²´í¬ 2755 if(!category || category == "") { 2756 alert("ì¹´í ê³ ë¦¬ëª ì ì ííê² ì ë ¥í´ì£¼ì¸ì."); 2757 return false; 2758 } 2759 2760 // ì¤ë³µì²´í¬ 2761 if($('#category-div').find("input[class='category'][value='"+category+"']").length>0) { 2762 alert(category+' ì¹´í ê³ ë¦¬ë ì¡´ì¬í©ëë¤.'); 2763 $('#category_name').val(''); 2764 return false; 2765 } 2766 2767 var _time = (Math.random()*new Date().getTime()).toFixed(0); 2768 var html=''; 2769 html += "<li class='add-category-entity'> "; 2770 html += " <input type='hidden' name='category["+_time+"]' class='category' value='"+category+"'>"; 2771 html += " <span class='button nd-pink small default-cursor btn_category_modify' data-cate-idxno='"+_time+"'><i class='icon-wrench'> </i>"+category+"</span><button type='button' class='button secondary small btn_category_delete' data-cate-idxno='"+_time+"' ><i class='icon-trash-o'></i></button>"; 2772 html += "</li>"; 2773 $('#add-category').append(html); 2774 } 2775 2776 //ì´ê¸°í 2777 $('#category_name').val(''); 2778 2779 } else if(isModalButton) { // ìì ëª¨ë¬ 2780 2781 var $this = $(this) 2782 ,$form = $('#form_bbs_category') 2783 ,$item = $this.closest(".add-category-entity") 2784 ,$span = $this.closest(".btn_category_modify") 2785 ,cate_idxno = $span.data("cate-idxno") 2786 ,category = $item.find("input:hidden[name='category["+cate_idxno+"]']").val(); 2787 2788 $form.find('input:hidden[name="cate_idxno"]').val(cate_idxno); 2789 $form.find('input:text[name="category"]').val(category); 2790 2791 $('#categoryAddModal').foundation('open'); 2792 2793 // ìì 2794 $form.on('click', '.chk', function(e){ 2795 if($item) { 2796 var cate_idxno= $form.find('input:hidden[name="cate_idxno"]').val() 2797 ,category = $form.find('input[name="category"]').val(); 2798 2799 if($form.find('[name="category"]').val() == ""){ 2800 alert('ì¹´í ê³ ë¦¬ ëª ì ì ííê² ì ë ¥í´ì£¼ì¸ì'); 2801 $form.find('[name="category"]').focus(); 2802 return false; 2803 } 2804 2805 $item.find("input:hidden[name='category["+cate_idxno+"]']").val(category); 2806 $item.find("span[data-cate-idxno='"+cate_idxno+"']").html("<i class='icon-wrench'> </i>"+category).attr("data-category",category); 2807 } 2808 2809 $('#categoryAddModal').foundation('close'); 2810 }); 2811 2812 } else if(isDltButton) { //ìì 2813 var cate_idxno = $(this).closest(".btn_category_delete").data("cate-idxno"); 2814 if(!window.confirm("ìì íìê² ìµëê¹?")) return false; 2815 $.post( "/bbs/axBbsCategory.php" 2816 ,{mode:"categoryChk",cate_idxno:cate_idxno} 2817 ,function(data, rst){ 2818 if(data.result === "success"){ 2819 $this.closest(".add-category-entity").fadeOut("fast",function(){$(this).remove();}); 2820 }else alert(decodeURIComponent(data.msg)); 2821 2822 },"json"); 2823 return false; 2824 } 2825 }); 2826 } 2827 2828 //ì ë ¬ 2829 ,evtSortableCategory:function(){ 2830 var $box = $("#add-category"), 2831 table_name = $box.attr("data-table"); 2832 2833 $box.sortable({ 2834 placeholder: "ui-state-highlight" 2835 ,forcePlaceholderSize:true 2836 ,update:function(event, ui){ 2837 // ì ì¥ìí¨ 2838 } 2839 }); 2840 } 2841 2842 //ì¹´í ê³ ë¦¬ ì´ë 2843 ,categoryMove:function(checkBoxIdxno){ 2844 2845 // ì ì²´ì í 2846 $("#all-dummy").click(function(e){
2847 $('input:checkbox[name="bbs_idxno[]"]', '#bbs_table').each(function(i){ 2848 this.checked = $('input:checkbox[name="all_dummy"]', '#bbs_table').is(':checked'); 2849 }); 2850 }); 2851 2852 // ì¶ê° 2853 $('.bbs-skin').on('click', '.categoryModalBtn', function(e){ 2854 var data=$(checkBoxIdxno).filter(function(i){ return this.checked?true:false; }).map(function(a,b){ return b.value; }).get(); 2855 if(data.length<=0){ 2856 alert("ì¹´í ê³ ë¦¬ ì´ë í ê²ì물ì ì íí´ì£¼ì¸ì."); 2857 return false; 2858 } 2859 //console.log(data); 2860 $('#categoryMoveModal').foundation('open'); 2861 2862 $('#categoryMoveForm').on('click', '.category_move_btn', function(e){ 2863 var to_category = $('#categoryMoveForm').find('#toCategory option:selected').val(), 2864 table_name = $('#categoryMoveForm').find('input:hidden[name="table_name"]').val(); 2865 2866 if(!window.confirm("ì¹´í ê³ ë¦¬ ì´ë í ê²ìë¬¼ë¡ ë³ê²½íìê² ìµëê¹?")) return false; 2867 $.post("/bbs/axBbsCategory.php" 2868 ,{mode:"bbsCategoryMove","bbs_idxno[]":data,"to_category":to_category,"table_name":table_name} 2869 ,function(data,rst){ 2870 console.log(data); 2871 if(data.result!="success"){ 2872 alert(data.msg||"문ì ê° ìê²¼ìµëë¤. ì ìí ë¤ì ìë íì¬ ì£¼ì¸ì."); 2873 return false; 2874 } 2875 //alert("ì¹´í ê³ ë¦¬ ì´ëì´ ìë£ëììµëë¤."); 2876 location.reload(true); 2877 },"json"); 2878 2879 return false; 2880 }); 2881 }); 2882 } 2883} 2884 2885/***************************************************************************** 2886* ë¤ì¤ì¹ì ì¤ì 2887*****************************************************************************/ 2888var multiSection ={ 2889 2890 // ì¹ì ë¡ë 2891 sectionLoad:function() { 2892 2893 $('#admin-content').on('change', '.add-section-select', function(e){ 2894 var tp = $(this).data('type'); 2895 var code = $(this).val(); 2896 var $_obj = $('#add_section'); 2897 2898 if(tp == 1) multiSection.changeSectionCode(tp, code); 2899 else if(tp == 2) { 2900 if($(this).val() == "") { 2901 multiSection.changeSectionCode(1, $_obj.val()); 2902 } 2903 else multiSection.changeSectionCode(tp, code); 2904 } 2905 }); 2906 2907 //ìì 2908 $('#section-div').on('click', '.delete-button', function(e){ 2909 var tp = $(this).data('type'); 2910 $(this).closest('.'+tp+'-section-entity').remove(); 2911 }); 2912 } 2913 2914 //ì¹ì ì½ë í¸ì¶ 2915 ,changeSectionCode:function(tp,code) { 2916 2917 var $_subsection = $('#add_subsection'); 2918 var $_serial = $('#add_serial'); 2919 2920 $.ajax({ 2921 type: "post", 2922 dataType: "json", 2923 url: "/news/changeSectionCode.ajax.php", 2924 data:{tp:tp, code:code}, 2925 success: function(data) { 2926 if(data[0] == "Y"){ 2927 if(tp == 1){ 2928 $_subsection.html(data[1]); 2929 $_serial.html(data[2]); 2930 }else if(tp == 2){ 2931 $_serial.html(data[2]); 2932 } 2933 } 2934 }, 2935 error: function(error, request) { 2936 alert('error!!!'); 2937 console.log("code:"+request.status+"\n"+"message:"+request.responseText+"\n"+"error:"+error); 2938 } 2939 }); 2940 2941 return false; 2942 } 2943 2944 // ìëë°ì¤ ì¹ì ì¶ê°&ì ì¸ 2945 ,addSectionCode:function() { 2946 2947 // ì¹ì ë¨ë½ ë ¸ì¶ ì¬ë¶ 2948 if($('.add-section-entity').length > 0) $('#section-div').show(); 2949 else $('#section-div').hide(); 2950 2951 $('#admin-content').on('click', '#sectionBtn', function(e){ 2952 2953 // ì¶ê° or ì ì¸ 2954 var tp = $(this).data('type'); 2955 2956 //1ì°¨ì¹ì 2957 var sectioncode = $('#add_section option:selected').val(); 2958 var sectionname = $('#add_section option:selected').text(); 2959 //2ì°¨ì¹ì 2960 var subsectioncode = $('#add_subsection option:selected').val(); 2961 var subsectionname = $('#add_subsection option:selected').text(); 2962 //3ì°¨ì¹ì 2963 var serialcode = $('#add_serial option:selected').val(); 2964 var serialname = $('#add_serial option:selected').text(); 2965 2966 //1ì°¨ì¹ì ì ì í ìíìì... 2967 if(!sectioncode || sectioncode == "") { 2968 alert("ì¶ê°í ì¹ì ì ì íí´ì£¼ì¸ì."); 2969 return false; 2970 } 2971 2972 // ì¤ë³µì½ë ì²´í¬ 2973 var addSecCode = sectioncode; 2974 if(subsectioncode) addSecCode += '>'+subsectioncode; 2975 if(serialcode) addSecCode += '>'+serialcode; 2976 2977 var duplicateChk = false; 2978 2979 // ëì¼í ì¹ì 구ì±ì´ ì¶ê°&ì ì¸ ëì ì¶ê° ì ì´ 2980 $('.input_setion_data').each(function(){ 2981 if( $(this).val() == addSecCode) { 2982 alert('ì´ë¯¸ ì¤ë³µ ë ì½ëê° ì¡´ì¬í©ëë¤.'); 2983 eixt; 2984 duplicateChk = true; 2985 return false; 2986 } 2987 }); 2988 2989 if(tp == 'add') { 2990 //ì ì²´ê° ì í ë ê²½ì° ë¨ì¼ ì í ì ì´ 2991 $('.add_section_data').each(function(){ 2992 if($(this).val() == "ALL"){ 2993 alert('ì 체를 ì ííì¤ ê²½ì° ë¨ì¼ ì¹ì ì íì íì¤ ì ììµëë¤.'); 2994 duplicateChk = true; 2995 return false; 2996 } 2997 }); 2998 2999 // ë¨ì¼ ì¹ì ì íì ì ì²´ ì í ì ì´ 3000 if($('.add-section-entity').length > 0) { 3001 if(addSecCode == "ALL"){ 3002 alert('ë¨ì¼ ì¹ì ì´ ì´ë¯¸ ì íëì´ ììµëë¤. ì ì²´ë ì ííì¤ ì ììµëë¤.'); 3003 duplicateChk = true; 3004 return false; 3005 } 3006 } 3007 3008 } else if(tp == "exc") { 3009 3010 if(addSecCode == "ALL"){ 3011 alert('ì ì¸ ì¹ì ì¼ë¡ë ì 체를 ì ííì¤ ì ììµëë¤.'); 3012 duplicateChk = true; 3013 return false; 3014 } else { 3015 3016 if($('.add-section-entity').length > 0) { 3017 $('.add_section_data').each(function(){
3018 if($(this).val().indexOf(addSecCode) != -1) { //í¬í¨í ê²½ì° 3019 alert('ì¶ê° ì¹ì ì í¬í¨ ë 1ì°¨ ì¹ì ì¼ë¡ ì ì¸í ì ììµëë¤. '); 3020 duplicateChk = true; 3021 return false; 3022 } 3023 if($(this).val() != "ALL"){ 3024 if(addSecCode.indexOf(">") == -1) { 3025 alert('ì ì¸ ì¹ì ì¼ë¡ ì²ë¦¬í ì ììµëë¤.'); 3026 duplicateChk = true; 3027 return false; 3028 } 3029 } 3030 }); 3031 } 3032 } 3033 3034 if($('.add-section-entity').length == 0) { 3035 alert('ì¶ê° ì¹ì ì 먼ì ì íí´ì£¼ì¸ì.'); 3036 duplicateChk = true; 3037 return false; 3038 } 3039 } 3040 3041 if(duplicateChk) return false; 3042 3043 // ì¶ê° ë ê²½ì° ë ¸ì¶ 3044 $('#section-div').show(); 3045 3046 var title = "<span class='hollow button nd-pink default-cursor'>"+sectionname+"</span>"; 3047 if(subsectioncode || subsectioncode != "") title += "<span class='hollow button warning default-cursor'>"+subsectionname+"</span>"; 3048 if(serialcode || serialcode != "") title += "<span class='hollow button alert default-cursor'>"+serialname+"</span>"; 3049 3050 var html=''; 3051 html += "<div class='button-group small "+tp+"-section-entity'>"; 3052 html += " <input type='hidden' name='"+tp+"_section_data[]' class='"+tp+"_section_data input_setion_data' value='"+addSecCode+"'>"; 3053 // html += " <input type='hidden' class='"+tp+"-chk-sec' value='"+addSecCode+"'>"; 3054 html += title; 3055 html += " <button type='button' class='button nd-white tiny delete-button' data-type='"+tp+"' title='"+sectionname+" ìì '><i class='icon-trash-o'></i><span class='show-for-sr'>ìì </span></button>"; 3056 html += "</div>"; 3057 3058 $('#'+tp+'-section').append(html); 3059 3060 //.attr("data-code",category) 3061 3062 }); 3063 } 3064 3065 //ì ì¡ 3066 ,multiSectionSumbit:function(form) 3067 { 3068 3069 if(!form.description.value) 3070 { 3071 alert("리ì¤í¸ëª ì ì ë ¥í´ì£¼ì¸ì."); 3072 description.focus(); 3073 return false; 3074 } 3075 3076 if($('.add-section-entity').length == 0) { 3077 alert("ì°ê²° ì¹ì ì ì íí´ì£¼ì¸ì."); 3078 return false; 3079 } 3080 3081 if(confirm("ì íí ì¹ì ì íëì 리ì¤í¸ë¡ 구ì±í©ëë¤. \nì ë§ë¡ ì¤ííìê² ìµëê¹?")) return true; 3082 else return false; 3083 3084 } 3085 3086} 3087 3088/* ****************************************** */ 3089/* /script/app.js (íì´ë°ì´ì ì¤ííì¼ */ 3090/* ****************************************** */ 3091 3092$(function(){ 3093 $(document).foundation(); 3094}); 3095 3096/***************************************************************************** 3097*ê¸°ì¬ ì¹´ì´í¸ 3098*****************************************************************************/ 3099var _statistics={ 3100 articleCookieCount:function(article_idxno){ 3101 if(!article_idxno) return false; 3102 3103 var cookieRestore = false 3104 ,articleIdxno = article_idxno 3105 ,articleUniqView = _statistics.getCookie('___AUV') 3106 ,dateTime = new Date(); 3107 3108 var regexp = new RegExp("_"+articleIdxno+"\.(\\d{10})x","i"); 3109 var dataArr = articleUniqView.match(regexp); 3110 3111 if(dataArr !== null){ 3112 var limitTime = dateTime.setHours(dateTime.getHours() - 1); 3113 limitTime = Math.floor(limitTime / 1000); 3114 if (limitTime > dataArr[1]){ 3115 articleUniqView = articleUniqView.replace(dataArr[0], ''); 3116 cookieRestore = true; 3117 } 3118 } else cookieRestore = true; 3119 3120 if(cookieRestore === true) { 3121 var newData = '_'+articleIdxno+'.'+ Math.floor(new Date().getTime() / 1000) +'x'; 3122 $.ajax({ 3123 url:'/news/makeArticleUniqSave.ajax.php', 3124 type:'POST', 3125 dataType:'json', 3126 cahse: false, 3127 data: {article_idxno:articleIdxno}, 3128 success:function(rst,data){ 3129 if(rst.result == "success"){ 3130 var tmpTotalSize = 8 + articleUniqView.length + newData.length; 3131 if (tmpTotalSize >= 2048) articleUniqView = articleUniqView.substr(0, (articleUniqView.length - newData.length)); 3132 articleUniqView = newData + articleUniqView; 3133 3134 var domain = '.'+ countDomain.replace(/^http(s)?:\/\//i,'').replace(/^(www|m)\./i,''); 3135 _statistics.setCookie("___AUV", articleUniqView.trim(), 30, domain); 3136 } 3137 }, 3138 error: function(error, request) { 3139 console.log("error:"+error+"\n"+"request:"+request); 3140 } 3141 }); 3142 } 3143 } 3144 ,getCookie:function(name) 3145 { 3146 name+="="; 3147 var ca = document.cookie.split(';'); 3148 for(var i=0; i<ca.length; i++) { 3149 var c = ca[i];
3150 while (c.charAt(0)==' ') c = c.substring(1); 3151 if (c.indexOf(name) == 0) return c.substring(name.length,c.length); 3152 } 3153 return ""; 3154 } 3155 ,setCookie:function(name, value, days, domain) 3156 { 3157 var expires = ""; 3158 if(days){ 3159 var date = new Date(); 3160 date.setTime(date.getTime()+(days*24*60*60*1000)); 3161 expires = "; expires="+date.toGMTString(); 3162 } 3163 if(!domain) domain = countDomain.replace(/^http(s)?:\/\//i,'').replace(/^(www|m)\./i,''); 3164 document.cookie = name+"="+value+expires+"; path=/; " + (domain?"domain="+domain+";":""); 3165 } 3166}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.