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='+bannerId
817xno+'&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 = new Date().getTime() 831 ,_html = '<!--'+title+'-->' 832 + '<script type="text/javascript">var ___BANNER = "ban_'+_time+'";</script>' 833 + '<script type="text/javascript" charset="utf-8" src="/bannerpop/uploads/js/'+bannerIdxno+'.js?'+_time+'" id="ban_'+_time+'"></script>' 834 + '<!--//'+title+'-->'; 835 //} 836 837 adWrite.copyExe(_html); 838 break; 839 case "preview": 840 if(!window.___popup) return false; 841 842 var p = ___popup[bannerIdxno]; 843 844 if(!p) return false; 845 if(!window.___currentTime) window.___currentTime = Math.floor(new Date().getTime()/1000);// ìê°ì´ ì¤ì ëì§ ììë¤ë©´ js ìê°ì¼ë¡ ì¤ì í¨ 846 847 // ê´ë¦¬ìë§... 848 $(".layer_box").remove(); // ë¤ë¥¸ê² ì´ë ¤ìë¤ë©´ ìì 849 bannerpop.vars.popup.view = "manager"; 850 bannerpop.float(p); 851 break; 852 case "mdf": 853 var $ahref = '/bannerpop/'; 854 $ahref += edit_section ? 'edit.html' : 'write.html'; 855 $ahref += '?type='+banner_type+'&mode=modify&idxno='+bannerIdxno+'&page='+page; 856 if(edit_section) $ahref += '&edit_section=' + edit_section; 857 if(edit_area) $ahref += '&edit_area=' + edit_area; 858 if(edit_step) $ahref += '&edit_step=' + edit_step; 859 if(edit_idxno) $ahref += '&edit_idxno=' + edit_idxno; 860 if(edit_mode) $ahref += '&edit_mode=' + edit_mode; 861 //if(tmp_banner_idxno) $ahref += '&tmp_banner_idxno=' + tmp_banner_idxno; 862 if(org_banner_kind) $ahref += '&org_banner_kind=' + org_banner_kind; 863 if(banner_kind) $ahref += '&banner_kind=' + banner_kind; 864 if(sc_area) $ahref += '&sc_area=' + sc_area; 865 if(sc_word) $ahref += '&sc_word=' + sc_word; 866 location.href = $ahref; 867 break; 868 case "del": 869 if(window.confirm('ìì í ê¹ì?')) { 870 var $ahref = '/bannerpop/delete_act.php?type='+banner_type+'&idxno='+bannerIdxno+'&page='+page; 871 if(edit_section) $ahref += '&edit_section=' + edit_section; 872 if(edit_area) $ahref += '&edit_area=' + edit_area; 873 if(edit_step) $ahref += '&edit_step=' + edit_step; 874 if(edit_idxno) $ahref += '&edit_idxno=' + edit_idxno; 875 if(org_banner_kind) $ahref += '&org_banner_kind=' + org_banner_kind; 876 if(banner_kind) $ahref += '&banner_kind=' + banner_kind; 877 if(sc_area) $ahref += '&sc_area=' + sc_area; 878 if(sc_word) $ahref += '&sc_word=' + sc_word; 879 location.href = $ahref; 880 } 881 break; 882 case "mdf_activity": 883 var $ahref = '/bannerpop/'; 884 $ahref += edit_section ? 'edit.html' : 'write_activity.html'; 885 $ahref += '?type='+banner_type+'&mode=modify&activity_idxno='+bannerIdxno+'&page='+page; 886 if(edit_section) $ahref += '&edit_section=' + edit_section; 887 if(edit_area) $ahref += '&edit_area=' + edit_area; 888 if(edit_step) $ahref += '&edit_step=' + edit_step; 889 if(edit_idxno) $ahref += '&edit_idxno=' + edit_idxno; 890 if(edit_mode) $ahref += '&edit_mode=' + edit_mode; 891 if(org_banner_kind) $ahref += '&org_banner_kind=' + org_banner_kind; 892 if(banner_kind) $ahref += '&banner_kind=' + banner_kind; 893 //if(tmp_banner_idxno) $ahref += '&tmp_banner_idxno=' + tmp_banner_idxno; 894 if(sc_area) $ahref += '&sc_area=' + sc_area; 895 if(sc_word) $ahref += '&sc_word=' + sc_word; 896 location.href = $ahref; 897 break; 898 case "del_activity": 899 if(window.confirm('ìì í ê¹ì?')) { 900 var $ahref = '/bannerpop/delete_activity_act.php?type='+banner_type+'&activity_idxno='+bannerIdxno+'&page='+page; 901 if(edit_section) $ahref += '&edit_section=' + edit_section; 902 if(edit_area) $ahref += '&edit_area=' + edit_area; 903 if(edit_step) $ahref += '&edit_step=' + edit_step; 904 if(edit_idxno) $ahref += '&edit_idxno=' + edit_idxno; 905 if(org_banner_kind) $ahref += '&org_banner_kind=' + org_banner_kind; 906 if(banner_kind) $ahref += '&banner_kind=' + banner_kind; 907 if(sc_area) $ahref += '&sc_area=' + sc_area; 908 if(sc_word) $ahref += '&sc_word=' + sc_word; 909 location.href = $ahref; 910 } 911 break; 912 case "sourceCopy_activity": // ìì¤ë³µì¬ 913 var _time = new Date().getTime() 914 ,_html = '<!--'+title+'-->'
915 + '<script type="text/javascript">var ___BANNER = "ban_'+_time+'";</script>' 916 + '<script type="text/javascript" charset="utf-8" src="/bannerpop/uploads/js_activity/'+bannerIdxno+'.js?'+_time+'" id="ban_'+_time+'"></script>' 917 + '<!--//'+title+'-->'; 918 919 adWrite.copyExe(_html); 920 break; 921 case "mdf_multi": 922 var $ahref = '/bannerpop/'; 923 $ahref += edit_section ? 'edit.html' : 'write_activity_multi.html'; 924 $ahref += '?type='+banner_type+'&mode=modify&multi_idxno='+bannerIdxno+'&page='+page; 925 if(edit_section) $ahref += '&edit_section=' + edit_section; 926 if(edit_area) $ahref += '&edit_area=' + edit_area; 927 if(edit_step) $ahref += '&edit_step=' + edit_step; 928 if(edit_idxno) $ahref += '&edit_idxno=' + edit_idxno; 929 if(edit_mode) $ahref += '&edit_mode=' + edit_mode; 930 if(org_banner_kind) $ahref += '&org_banner_kind=' + org_banner_kind; 931 if(banner_kind) $ahref += '&banner_kind=' + banner_kind; 932 //if(tmp_banner_idxno) $ahref += '&tmp_banner_idxno=' + tmp_banner_idxno; 933 if(sc_area) $ahref += '&sc_area=' + sc_area; 934 if(sc_word) $ahref += '&sc_word=' + sc_word; 935 location.href = $ahref; 936 break; 937 case "del_multi": 938 if(window.confirm('ìì í ê¹ì?')) { 939 var $ahref = '/bannerpop/delete_activity_multi_act.php?type='+banner_type+'&multi_idxno='+bannerIdxno+'&page='+page; 940 if(edit_section) $ahref += '&edit_section=' + edit_section; 941 if(edit_area) $ahref += '&edit_area=' + edit_area; 942 if(edit_step) $ahref += '&edit_step=' + edit_step; 943 if(edit_idxno) $ahref += '&edit_idxno=' + edit_idxno; 944 if(org_banner_kind) $ahref += '&org_banner_kind=' + org_banner_kind; 945 if(banner_kind) $ahref += '&banner_kind=' + banner_kind; 946 if(sc_area) $ahref += '&sc_area=' + sc_area; 947 if(sc_word) $ahref += '&sc_word=' + sc_word; 948 location.href = $ahref; 949 } 950 break; 951 case "sourceCopy_multi": 952 var _time = new Date().getTime() 953 ,_html = '<!--'+title+'-->' 954 + '<script type="text/javascript">var ___BANNER = "ban_'+_time+'";</script>' 955 + '<script type="text/javascript" charset="utf-8" src="/bannerpop/uploads/js_multi/'+bannerIdxno+'.js?'+_time+'" id="ban_'+_time+'"></script>' 956 + '<!--//'+title+'-->'; 957 adWrite.copyExe(_html); 958 break; 959 } 960 961 return false; 962 }); 963 } 964 965 //ìì ì ì¹ì í 컨í ì¸ ì½ì 966 ,addEditContents:function(data) 967 { 968 //var flag = false; 969 var flag = true; 970 971 /*if(data.mode == 'modify') { 972 if(data.tmp_banner_idxno != data.banner_idxno) { 973 if(confirm(data.edit_msg)) flag = true; 974 else flag = false; 975 }else flag = true; 976 }else flag = true;*/ 977 978 if(flag) { 979 data = JSON.stringify(data); 980 $.ajax({ 981 url:"/edit/adminReservationBannerWrite.php" 982 ,type:'post' 983 ,dataType:'json' 984 ,contentType:'application/x-www-form-urlencoded; charset=utf-8' 985 ,data:{post_data:data} 986 ,success:function(json, result) { 987 if(result == 'success') { 988 if(json.response == 'ok') { 989 window.parent.location.reload(); 990 }else{ 991 alert(json.msg); 992 return false; 993 } 994 }else return false; 995 } 996 }); 997 }else{ 998 return false; 999 } 1000 } 1001 1002 //ìì ì ì¹ì í 컨í ì¸ ì½ì 1003 ,addEditPopupContents:function(data) 1004 { 1005 data = JSON.stringify(data); 1006 $.ajax({ 1007 url:"/edit/adminReservationPopupWrite.php" 1008 ,type:'post' 1009 ,dataType:'json' 1010 ,contentType:'application/x-www-form-urlencoded; charset=utf-8' 1011 ,data:{post_data:data} 1012 ,success:function(json, result) { 1013 if(result == 'success') { 1014 if(json.response == 'ok') { 1015 //window.parent.location.reload(); 1016 parent.$('#edit-modal').find('.close-button').trigger('click'); 1017 adWrite.addPopupContentsList(json); 1018 }else{ 1019 alert(json.msg); 1020 return false;
1021 } 1022 }else return false; 1023 } 1024 }); 1025 } 1026 1027 ,addPopupContentsList:function(json) { 1028 var html = ''; 1029 if(json.rows.length>0) { 1030 for(var i = 0; i < json.rows.length; i++) { 1031 var index = i+1; 1032 html += '<!-- íì //-->'; 1033 html += '<div class="option-popup-item">'; 1034 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 + '" />'; 1035 html += ' <label for="editPopup' + index + '">'; 1036 if(json.rows[i].popup_image && json.rows[i].extension != 'swf') { 1037 html += '<img src="/bannerpop/uploads/image/' + json.rows[i].popup_image + '" alt="' + adWrite.rawurldecode(json.rows[i].popup_title) + '" />'; 1038 }else{ 1039 if(json.rows[i].extension == 'swf') html += 'SWF'; 1040 else html += 'HTML'; 1041 } 1042 html += ' <div class="option-popup-item-title">' + adWrite.rawurldecode(json.rows[i].popup_title) + '</div>'; 1043 html += ' </label>'; 1044 html += '</div>'; 1045 html += '<!--// íì -->'; 1046 } 1047 } 1048 1049 parent.$('.option-popup-group').html(html); 1050 } 1051 1052 //ì ì²´ì íãí´ì 1053 ,allChk:function() 1054 { 1055 var $allChk = $('#allCheck'); 1056 $allChk.click(function(){ 1057 if($(this).is(':checked') == true) { 1058 $('.elembox').prop('checked',true); 1059 }else{ 1060 $('.elembox').prop('checked',false); 1061 } 1062 }); 1063 } 1064 1065 /** 1066 * í´ë¦½ë³´ë ë³µì¬ 1067 * source : ë³µì¬í ì ë³´ 1068 */ 1069 ,copyExe:function(source) 1070 { 1071 if(window.clipboardData){ // ie 1072 window.clipboardData.setData('Text',source); 1073 alert("ë³µì¬ëììµëë¤. ìíë ê³³ì ë¶ì¬ë£ê¸°íì¬ ì£¼ì¸ì."); 1074 }else{ // etc 1075 //var $tmpDiv=$('<div class="blind">'+source.replace(/</g,"<").replace(/>/g,">")+'</div>').appendTo("body") 1076 // blindê° display:none ìì± ë문ì ì ê±° 1077 var $tmpDiv=$('<div>'+source.replace(/</g,"<").replace(/>/g,">")+'</div>').appendTo("body") 1078 ,range=document.createRange() 1079 ,selection=null; 1080 1081 range.selectNodeContents($tmpDiv.get(0)); 1082 selection=window.getSelection(); 1083 selection.removeAllRanges(); 1084 selection.addRange(range); 1085 1086 if(document.execCommand("copy", false, null)) alert("ë³µì¬ëììµëë¤. ìíë ê³³ì ë¶ì¬ë£ê¸°íì¬ ì£¼ì¸ì."); 1087 else window.prompt('í¤ë³´ëì ctrl+C ëë ë§ì°ì¤ ì¤ë¥¸ìª½ì ë³µì¬í기를 ì´ì©í´ì£¼ì¸ì.', source); 1088 1089 $tmpDiv.remove(); 1090 } 1091 } 1092 1093 /** 1094 * 기ë¥ì± ë°°ë ì¶ê°/ììë³ê²½/ìì / 1095 */ 1096 ,evtClickActivityAdd:function() { 1097 //sessionStorage.removeItem("last_idx"); 1098 var activity_idxno=window.parent.$('#all-banner-list').closest('div').attr('data-activity-idxno')||''; 1099 $('#activity-add-btn').click(function() { 1100 var $this=$(this); 1101 //,$viewHref=$('#activity-view-btn').attr('href') 1102 //,$last_idx=(activity_idxno)?activity_idxno:sessionStorage.getItem('last_idx'); 1103 1104 if($('.banner_element_ckecked').is(':checked') == false) { 1105 alert('ë°°ë를 ì íí´ì£¼ì¸ì.'); 1106 //if(!$last_idx) $('#activity-view-btn').addClass('is-hidden'); 1107 return false; 1108 }else{ 1109 var $checked=$(".banner_element_ckecked:checked") 1110 ,arr = new Array(); 1111 if($checked.length>0) { 1112 $.each($checked, function(idx, v) { 1113 arr.push(v.value); 1114 }); 1115 1116 var data = {mode:activity_idxno?'modify':'input', activity_idxno:activity_idxno, banner_idxno:arr}; 1117 data = JSON.stringify(data); 1118 //console.log(data); 1119 $.ajax({ 1120 url:"/bannerpop/activity_act.php" 1121 ,type:'post' 1122 ,dataType:'json' 1123 ,contentType:'application/x-www-form-urlencoded; charset=utf-8' 1124 ,data:{post_data:data} 1125 ,success:function(json, result) { 1126 if(result == 'success') { 1127 if(json.response == 'ok') { 1128 //alert('ì¶ê°ëììµëë¤.\nì°ì¸¡ì ë²í¼ì í´ë¦íìë©´ ìì¸ íë©´ì¼ë¡ ì´ëí©ëë¤.'); 1129 /*if(!activity_idxno) { 1130 sessionStorage.setItem('last_idx', json.last_insert_id); 1131 $('#activity-view-btn').attr('href', $viewHref + '&activity_idxno='+json.last_insert_id); 1132 } 1133 $('#activity-view-btn').removeClass('is-hidden');*/ 1134 window.parent.location.reload(); 1135 }else{ 1136 //alert(json.msg); 1137 return false;
1138 } 1139 }else return false; 1140 }, 1141 error:function(request,status,error){ 1142 alert("code:"+request.status+"\n"+"message:"+request.responseText+"\n"+"error:"+error); 1143 } 1144 }); 1145 } 1146 } 1147 }); 1148 1149 $('#banner-activity-box').sortable({ 1150 axis: '', 1151 update: function() { 1152 //console.log($(this)); 1153 } 1154 }); 1155 1156 $('.trash').click(function() { 1157 if($('.banner-activity-list').length <= 1) { 1158 alert('ë§ì§ë§ ë°°ëë ìì í ì ììµëë¤.'); 1159 return false; 1160 } 1161 1162 var $this=$(this) 1163 ,$parent = $this.closest('.banner-activity-list'); 1164 1165 $parent.fadeOut('fast', function(){ 1166 $parent.remove(); 1167 }); 1168 }); 1169 1170 $('#all-banner-list').on('click', function(e) { 1171 1172 $this = $(this); 1173 href = $this.attr('href'); 1174 1175 $("#edit-modal-iframe").attr("src", href); 1176 $('#edit-modal').foundation('open'); 1177 1178 return false; 1179 }); 1180 1181 $('#edit-modal').on('open.zf.reveal', function(e){ 1182 $('#for-loading').show(); 1183 }); 1184 1185 $('#edit-modal').on('closed.zf.reveal', function(e){ 1186 $("#edit-modal-iframe").attr("src", "about:blank").height('0px').closest('#activity-modal').css('height', '0px'); 1187 }); 1188 } 1189 1190 ,valid_activity:function() { 1191 if($('#activity_title').val() == '') { 1192 alert('ì 목ì ì ë ¥íì¸ì.'); 1193 $('#activity_title').focus(); 1194 return false; 1195 } 1196 1197 if($('.banner-activity-list').length<=0) { 1198 alert('ë°°ë를 íë ì´ì ì¶ê°íì ì¼ í©ëë¤.'); 1199 return false; 1200 } 1201 1202 return true; 1203 } 1204 1205}; // end adWrite 1206 1207var bannerpop={ 1208 vars:{ 1209 popup:{ 1210 bodyWidth:0 1211 ,bodyLeft:0 1212 ,screenWidth:0 1213 ,popname:"popup_" 1214 ,width:{ window:[],layer:[] } 1215 ,height:{ window:[],layer:[] } 1216 ,top:{ window:[],layer:[] } 1217 ,left:{ window:[],layer:[] } 1218 ,order:0 // z-indexì© ìì°¨ì 1219 ,view:"normal" // ì¼ë° : normal or ê´ë¦¬ì : manager 1220 } 1221 } 1222 1223 /** 1224 * ë°°ë í¨ê³¼ 1225 * íê·¸ ìì± ì::: bannerpop.banner(".banner_event_box"); 1226 <div class="boder_box banner_event_box" data-type="slide" data-idxno="3" data-speed="0.3"> 1227 <div class="boder_box beb_box"> 1228 <ul class="no_type beb_ul"> 1229 <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> 1230 <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> 1231 <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> 1232 <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> 1233 <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> 1234 </ul> 1235 </div> 1236 <div class="beb_buttons"> 1237 <button type="button" class="beb_btns beb_btn_prev">ë¤ë¡</button> 1238 <button type="button" class="beb_btns beb_btn_stop">ë©ì¶¤</button> 1239 <button type="button" class="beb_btns beb_btn_next">ìì¼ë¡</button> 1240 </div> 1241 </div> 1242 */ 1243 ,effect:function() 1244 { 1245 var savePrefix = "banner_order_"; 1246 1247 // ë°°ë ëì´ 1248 function setSizeInfo($this){ 1249 var idxno = $this.attr("data-idxno") 1250 ,$ul = $this.find(".beb_ul") 1251 ,$li = $ul.find(".beb_li") 1252 ,boxWidth = $this.innerWidth()||$this.closest("#float_side_box").width() // ì ì¬ì´ëì ë°°ëì¼ê²½ì° ì¬ì¸¡ì 1253 ,liCount = $li.length||0; 1254 1255 // ê´ë¦¬ì íì´ì§ê° ìëë ì¤ì ë ¸ì¶ì¤ì¸ ê²ë§ ì°¾ì 1256 //if(ADM_DOMAIN.indexOf(location.host)<0){ 1257 $.each($li,function(){ 1258 var $this=$(this), len=$this.find(".banner_box").length; 1259 if(!len) $this.remove(); 1260 }); 1261 $li = $ul.find(".beb_li"); 1262 liCount = $li.length||0; 1263 //} 1264 1265 // ë¶ëª¨ë°ì¤ 기ì¤ì¼ë¡ ul ìµë ëì´ ì§ì 1266 $ul.width(boxWidth*liCount); 1267 1268 // ë°°ëë§ë¤ ëì´ê° ë¤ë¥¼ì ìì¼ë ë¶ëª¨ë°ì¤ ëì´ê¸°ì¤ì¼ë¡í¨ 1269 $li.width(boxWidth); 1270 1271 return { 1272 idxno : idxno 1273 ,$ul : $ul 1274 ,$li : $li 1275 ,boxWidth : boxWidth 1276 ,liCount : liCount 1277 }; 1278 } 1279 1280 return { 1281 // ììëë¡ íëì ë°°ëë§ ë³´ì 1282 order:function(){ 1283 var _this = this 1284 ,$this = $(_this) 1285 ,$info = setSizeInfo($this) 1286 ,idxno = $info.idxno 1287 ,$li =$info.$li 1288 ,liCount = $info.liCount-1 1289 ,saveKey = savePrefix+idxno 1290 ,order = Number(localStorage.getItem(saveKey))||0; 1291 1292 // ëë¤ ì íëê²ë§ ë³´ì, ë²í¼ ìì° 1293 $li.css("display","list-item").not(":eq("+order+")").css("display","none"); 1294 1295 localStorage.setItem(saveKey, (order>=liCount ? 0 : order+1)); 1296 } 1297 1298 // random banner 1299 ,random:function(){ 1300 var _this = this 1301 ,$this = $(_this) 1302 ,$info = setSizeInfo($this) 1303 ,$li =$info.$li 1304 ,liCount = $info.liCount 1305 ,random = Math.floor(Math.random()*liCount); 1306 1307 // ëë¤ ì íëê²ë§ ë³´ì, ë²í¼ ìì° 1308 $li.css("display","list-item").not(":eq("+random+")").css("display","none"); 1309 } 1310 1311 // random ë°°ë ì íí ì¬ë¼ì´ë 1312 ,randomSlide:function(){ 1313 bannerpop.effect()['slide'].call(this, true); 1314 } 1315 1316 // slide banner 1317 // rand true or false 1318 ,slide:function(rand){ 1319 var _this = this 1320 ,$this = $(_this) 1321 ,$info = setSizeInfo($this) 1322 ,$ul = $info.$ul 1323 ,$li =$info.$li.css("display","list-item") 1324 ,$btnBox = $this.find(".beb_buttons") 1325 ,$btnStop = $btnBox.find(".beb_btn_stop") 1326 ,$btnCurrent = null // íì¬ ì íë ë²í¼ prev,next,play,stop of buttons 1327 ,speed = Number(_this.getAttribute("data-speed"))||.3 1328 ,delayInfo = $li.map(function(){ return Number(this.getAttribute("data-delay"))||5; }).get() 1329 ,boxWidth =$info.boxWidth 1330 ,liCount = $info.liCount 1331 ,count = (rand===true?Math.floor(Math.random()*(liCount)):-1) // ì²ìë¶í° +1 íê³ ììí기ì -1ì´ê¸°ê°-randomì¼ëë ë°°ëìì¤ 1ê° 1332 ,delay = null // ë©ì¶°ìë ìê°(ì´) 1333 ,left = boxWidth // ìì§ì´ë ê°ê²© 1334 ,si = null // setInterval ë³ì : animate completeìì delayë¡ í´ê²°íë ¤ íëë° ëê° ì ìí림 1335 ,tmpDelay = null // next, prev ì delay ìì´ ëê¹ 1336 ,firstBtnClicked = 0; // prev,nextë¡ ì´ëíëê° - rotateìì ëíë² +,- í기ì ì²ìë§ ì¤íëì´ì¼ í¨ 1337 1338 /**** function //s ****/ 1339 /* 1340 ë¤ì ë°°ë 1341 @params 1342 loop : ë°ë³µë ê²ì¸ê° 1343 mode : + or - 1344 */ 1345 function rotate(loop, mode){ 1346 if(!mode) mode="+"; 1347 if(mode==="+") count++; 1348 else count--; 1349 1350 if(count>=liCount || count<=0) count = 0; // ì§ì°ìê° ë´ì ë°°ì´ì°¾ê¸° key 1351 var front = count+1; // ì§ì°í ìì§ì¬ì¼ íë 거리 미리 ë´ìë 1352 if(count>=(liCount-1)) front = 0; 1353 left = boxWidth*front*-1;
1354 delay = tmpDelay===null?delayInfo[count]:tmpDelay; 1355 1356 si = setTimeout(function(){ 1357 $ul.animate({ marginLeft:left } 1358 ,speed*1000, 1359 function(){ 1360 if(loop===false) $btnCurrent.prop("disabled", false); 1361 tmpDelay = null; 1362 });//.delay(delay*1000); 1363 if(loop!==false) rotate(); 1364 },delay*1000); 1365 } 1366 1367 // stop 1368 function stop(){ 1369 firstBtnClicked++; 1370 1371 //$ul.stop(true, false); 1372 clearTimeout(si); 1373 tmpDelay=null; 1374 $btnStop.addClass("beb_btn_start").text("play"); 1375 } 1376 1377 // restart 1378 function start(){ 1379 firstBtnClicked = 0; 1380 1381 count--; 1382 if(count<=0) count=0; 1383 1384 tmpDelay=null; 1385 rotate(); 1386 1387 $btnStop.removeClass("beb_btn_start").text("ë©ì¶¤"); 1388 } 1389 1390 // ì´ì 1391 function prev(){ 1392 stop(); 1393 1394 if(firstBtnClicked===1) count--; // ì²ìë§ ì´ë¯¸ ì¦ê°ëê°ì ê°ììí´ 1395 if(count<=0) count=liCount; 1396 1397 tmpDelay=0; 1398 rotate(false,"-"); 1399 1400 $btnCurrent.prop("disabled", true); 1401 } 1402 1403 // ì´í 1404 function next(){ 1405 stop(); 1406 1407 if(firstBtnClicked===1) count--; 1408 if(count>=liCount) count=0; 1409 1410 tmpDelay=0; 1411 rotate(false); 1412 1413 $btnCurrent.prop("disabled", true); 1414 } 1415 /**** function //e ****/ 1416 1417 // ì²ì ë°°ë를 ë³´ì´ì§ ìëë¤ë ê²ì ëë¤ ë°°ëì ì¬ë¼ì´ëë¼ë ê²-ì²ìë³´ì¼ë°°ë ì¤ì 1418 if(count>=0 && rand===true){ 1419 var _boxWidth = boxWidth*(count>=liCount?liCount-1:count)*-1; 1420 count--; 1421 $ul.css("margin-left",_boxWidth+"px"); 1422 } 1423 1424 // ì¤í 1425 rotate(); 1426 1427 // ë²í¼ë³´ì 1428 $btnBox/*.css("display","block")*/.find(".beb_btns").unbind("click") 1429 .click(function(){ 1430 var $this = $(this); 1431 1432 $btnCurrent = $this; 1433 if($this.is(".beb_btn_prev")) prev(); 1434 else if($this.is(".beb_btn_next")) next(); 1435 else if($this.is(".beb_btn_stop")){ 1436 if($this.is(".beb_btn_start")) start(); 1437 else stop(); 1438 } 1439 }); 1440 1441 // mouseover event 1442 $ul.on({ 1443 mouseenter:stop 1444 ,mouseleave:start 1445 }); 1446 } 1447 }; 1448 } 1449 1450 // ë°°ëí¸ì¶ 1451 ,banner:function(target) 1452 { 1453 var parents = this 1454 ,$target = !!target.jquery?target:$(target); 1455 1456 //console.log($target); 1457 $.each($target, function(i, ele){ 1458 var type = ele.getAttribute("data-type")||"random"; 1459 parents.effect()[type].call(this); 1460 }); 1461 } 1462 1463 ,getCookie:function(name) 1464 { /* 1465 var cookie = document.cookie; 1466 if(cookie.indexOf(name)<0) return ""; 1467 1468 var regexp = new RegExp("^(.*)"+name+"=(.*?);(.*)$","g"); 1469 return cookie.replace(regexp,"$2").replace(/^\s+|\s+$/g,""); 1470 */ 1471 name+="="; 1472 var ca = document.cookie.split(';'); 1473 for(var i=0; i<ca.length; i++) { 1474 var c = ca[i]; 1475 while (c.charAt(0)==' ') c = c.substring(1); 1476 if (c.indexOf(name) == 0) return c.substring(name.length,c.length); 1477 } 1478 return ""; 1479 } 1480 1481 ,setCookie:function(name, value, days, domain) 1482 { 1483 var expires = ""; 1484 if(days){ 1485 var date = new Date(); 1486 date.setTime(date.getTime()+(days*24*60*60*1000)); 1487 expires = "; expires="+date.toGMTString(); 1488 } 1489 1490 /* 1491 var dm=SITE_DOMAIN.replace('http://',''); 1492 dm=dm.replace('https://',''); 1493 if(!domain) domain="." + dm; 1494 */ 1495 1496 if(!domain) domain='.'+SITE_DOMAIN.replace(/^http(s)?:\/\//i,'').replace(/^(www|cms|slv|cdn|m)\./i,''); 1497 1498 document.cookie = name+"="+value+expires+"; path=/; " + (domain?"domain="+domain+";":""); 1499 } 1500 1501 // urlì arrayë¡ 1502 ,linkToJson:function(link) 1503 { 1504 if(!link) return false; 1505 1506 var json = {} 1507 ,tmp = link.replace(/^\/\?/,"").split("&"); 1508 1509 if(tmp.length<=0 || !tmp) return false; 1510 for(var i in tmp){ 1511 var param = tmp[i].split("=") 1512 ,key = param[0] 1513 ,value = param[1]; 1514 1515 json[key] = value; 1516 } 1517 return json; 1518 } 1519 1520 // ë°°ë append 1521 ,append:function() 1522 { 1523 var id = ___BANNER 1524 ,status = bannerStatus 1525 ,time = ___currentTime 1526 ,sTime = startTime 1527 ,eTime = endTime 1528 ,content = decodeURIComponent(bannerContent) 1529 ,title = typeof bannerTitle == "undefined" ? "":decodeURIComponent(bannerTitle) 1530 ,$target = $("#"+id) 1531 ,voteUse = typeof bannerVoteUse == "undefined" ? "N":bannerVoteUse 1532 ,explain = ''; 1533 //,explain = "\n<br />"+util.timestampToDatetime(sTime).strDateTime.substring(0,16)+"~"+util.timestampToDatetime(eTime).strDateTime.substring(0,16); 1534 1535 1536 if(!id || $target.length<=0 || $target.attr("data-append")=="true") return false; // ê°ì²´ê° ìê±°ë ììì ,ì´ë¯¸ ì¶ê°ëìë¤ë©´ ì¤ë¨ 1537 1538 // ìì ,ì¢ ë£ ë°°ë 1539 else if(sTime > time || time > eTime || status=="0"){ 1540 var adminPageBool = (location.href.indexOf('/edit/adminSection.html') < 0)? false:true; 1541 if(!adminPageBool) { 1542 if(!($('body').hasClass('ndip_user_body_view') && voteUse == 'Y' && status == "0")) { 1543 return false; // ì¢ ë£ ë©ìì§ ìëì°ê¸° 1544 } 1545 } 1546 var voteAdcClass = ""; 1547 var adcMsg="" 1548 ,adcClass=""; 1549 if(sTime > time && status!="0"){ 1550 adcMsg = 'ë ¸ì¶ìì ë°°ë'; 1551 adcClass = "banner-later"; 1552 }else if(time > eTime || status=="0"){ 1553 adcMsg = 'ì¢ ë£ë ë°°ë'; 1554 adcClass = "banner-finish"; 1555 if(voteUse == "Y") voteAdcClass = "vote_banner_box_finish"; 1556 } 1557 1558 if(!adminPageBool) $target.attr("data-append","true").after('<div class="ad-finished '+voteAdcClass+'"></div>'); // ì ê±°ë°°ë ì¢ ë£ DIV 1559 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>');
1559 // ì¢ ë£ ë©ìì§ ëì°ê³ ì¢ ë£ 1560 bannerTitle="";//ì´ê¸°í 1561 1562 return false; 1563 } 1564 1565 $target.attr("data-append","true").after(content); // ì¶ê° ëìì¼ë©´ data-append íê·¸ ëê¹ 1566 } 1567 1568 /****** íì ëì°ê¸° 1569 var ___popup = [{},...]; 1570 1571 * json ë´ì© * 1572 idxno - íì idxno ê³ ì ë²í¸ 1573 title - íì ì ì 목 1574 start - íì ììì¼ì 1575 end - íì ì¢ ë£ì¼ì 1576 status - ì§íìí (1=ì§í, 0=ì¢ ë£) 1577 popup_type - íì íí (layer=ë ì´ì´, window=ìëì°) 1578 popup_size - auto (ì¬ì©ìí¨) 1579 popup_width - íì ì°½í¬ê¸°(ê°ë¡) 1580 popup_height - íì ì°½í¬ê¸°(ì¸ë¡) 1581 position - auto (ì¬ì©ìí¨) 1582 x_position - ì°½ì x ìì¹ 1583 y_position - ì°½ì y ìì¹ 1584 apply_page - ì ì©íì´ì§ (main, section, list, view ê°ì´ ì ë ¥ ëì´ìì , phpìì íì´ì§ 구ë¶í´ì jsonì¼ë¡ ë§ë¤ì´ ì¤ëë¤.) 1585 bottom_close - íë¨íì ì°½ë«ê¸° ì¶ë ¥ì¬ë¶ (Y=ì¶ë ¥, N=ì¶ë ¥ìí¨) 1586 bottom_close_expire_ck - **ëì ì´ì§ì기 (none=ì¬ì©ìí¨, day=í루ëì ì´ì§ì기, days=ëªì¼ëì ì´ì§ì기) 1587 bottom_close_expire - ëªì¼ì¸ì§ 1588 layer_border - ë ì´ì´ íì ì¸ ê²½ì° ì¸ê³½ì (Y=ì¬ì©í¨, N=ì¬ì©ìí¨) 1589 layer_move - ë ì´ì´ íì ì¸ ê²½ì° ëëê·¸ ê°ë¥ (Y=ì¬ì©í¨, N=ì¬ì©ìí¨) 1590 layer_scroll - ë ì´ì´ íì ì¸ ê²½ì° ì¤í¬ë¡¤ ë°ë¼ë¤ë기 (Y=ì¬ì©í¨, N=ì¬ì©ìí¨) 1591 layer_close - ë ì´ì´ íì ì¸ ê²½ì° ë«ê¸° ìì´ì½ (Y=ì¬ì©í¨, N=ì¬ì©ìí¨) 1592 layer_close_icon - ë ì´ì´ íì ì¸ ê²½ì° ë«ê¸° ìì´ì½ ì í 1593 layer_close_position - ë ì´ì´ íì ì¸ ê²½ì° ë«ê¸° ìì´ì½ ì¶ë ¥ ìì¹ (TL-ì/ì¢, TR-ì/ì°, BL-í/ì¢, BR-í/ì°) 1594 window_scroll - ìëì° íì ì¸ ê²½ì° ì¤í¬ë¡¤ íì±í (Y=ì¬ì©í¨, N=ì¬ì©ìí¨) 1595 content - ì¶ë ¥ HTML ë´ì© 1596 *****/ 1597 ,float:function(j) 1598 { 1599 // json ê° 1600 var current = ___currentTime 1601 ,start = Number(j.start)||0 1602 ,end = Number(j.end)||(new Date().getTime()+100) // ì¢ ë£ì¼ì´ 기ì ëì§ ììë¤ë©´, íì¬ë³´ë¤ 100ì©ëí´ì ê³ì ë림 1603 ,status = j.status||"0"; 1604 1605 if(this.vars.popup.view!="manager" && (status=="0" || current < start || (current > end && end!==0))) return false; // ì¢ ë£ or 기ê°ì´ ìëë¼ë©´ íµê³¼ 1606 1607 var parents = this 1608 ,idxno = j.idxno||"0" 1609 ,oriTitle = j.title||"" 1610 ,title = decodeURIComponent(j.title)||"" 1611 ,popupType = j.popup_type||"window" 1612 ,popupSize = j.popup_size||"auto" 1613 ,popupWidth = Number(j.popup_width)||0 1614 ,popupHeight = (Number(j.popup_height)||0) + 32 1615 ,position = j.position||"auto" 1616 ,xPosition = Number(j.x_position)||0 1617 ,yPosition = Number(j.y_position)||0 1618 ,applyPage = j.apply_page||"main" 1619 ,bottomClose = j.bottom_close||"N" 1620 ,bottomCloseExpireCk = j.bottom_close_expire_ck||"none" 1621 ,bottomCloseExpire = j.bottom_close_expire||1 1622 ,layerBorder = j.layer_border||"N" 1623 ,layerMove = j.layer_move||"N" 1624 ,layerScroll = j.layer_scroll||"N" 1625 ,layerClose = j.layer_close||"N" 1626 ,layerCloseIcon = j.layer_close_icon||"" 1627 ,layerClosePosition = j.layer_close_position||"BR" 1628 ,windowScroll = j.window_scroll||"Y" 1629 ,content = decodeURIComponent(j.content)||"" 1630 ,popupUrl = j.popup_url||""// + (parents.vars.popup.view=="manager"?"?edit_mode=preview":"")||"" 1631 ,top = 0 1632 ,left = 0 1633 ,popname = parents.vars.popup.popname+idxno 1634 ,_type = popupType; // default: ê°ìëì - íì ê³¼ ë ì´ì´ê° ìì¹ê°ì ê³µì íì¬ ì°¨ë¡ë¡ ëì¸ë ¤ë©´ "window" or ê³µì íì§ ìê³ ê°ì ëì¸ë ¤ë©´ popupType; 1635 1636 var type = { 1637 calcPosition:function(){ 1638 // x,y ê° 0ì¼ëë autoë¡ ê°ì£¼ 1639 if((xPosition===0 && yPosition===0)/* || position=="auto"*/){ 1640 var maxHeight = parents.arrayMaxMin(parents.vars.popup.height[_type],"max") 1641 ,maxTop = parents.arrayMaxMin(parents.vars.popup.top[_type],"max") 1642 ,initLeft = popupType=="window"?0:parents.vars.popup.bodyLeft 1643 ,prevWidth = parents.vars.popup.width[_type][parents.vars.popup.width[_type].length-1]||0 1644 ,prevLeft = parents.vars.popup.left[_type][parents.vars.popup.left[_type].length-1]||initLeft; // ë°ë¡ ì´ì íì ëì´ë¥¼ leftê°ì¼ë¡ ì í¨-window:0, layer:contentì left 1645 1646 //console.log(popupWidth); 1647 left = prevLeft+prevWidth; 1648 1649 // íì´ì§ ëì´ë³´ë¤ ì리ì¡ì leftê°ì´ í¬ë¤ë©´ íë©´ì íë¨ê³ ë´ë¦¼ 1650 if(left>parents.vars.popup[popupType=="window"?"screenWidth":"bodyWidth"]){ 1651 top += maxHeight; 1652 left = initLeft; 1653 1654 // ë¤ì ë¨ê³ì´ëê¹ ì´ê¸°í í¨ 1655 parents.vars.popup.width[_type] = []; 1656 parents.vars.popup.height[_type] = []; 1657 parents.vars.popup.top[_type] = []; 1658 parents.vars.popup.left[_type] = []; 1659 }else{ 1660 top = (maxTop||0); 1661 } 1662 1663 // ë³íëê° ë°°ì´ì ë£ê¸° ìí´ ì¡°ì 1664 xPosition = left; 1665 yPosition = top; 1666 1667 // ë³ìì ë´ì 1668 parents.vars.popup.width[_type].push(popupWidth||0); 1669 parents.vars.popup.height[_type].push(popupHeight||0); 1670 parents.vars.popup.top[_type].push(yPosition||0); 1671 parents.vars.popup.left[_type].push(xPosition||0); 1672 1673 }else{ 1674 top = yPosition; 1675 left = xPosition; 1676 } 1677 } 1678 1679 // ê´ë¦¬ì 미리보기ì ì¤ìì 1680 ,setPositionCenter:function(){ 1681 var _width = (document.body.clientWidth/2)-(popupWidth/2) 1682 ,_scrollTop = document.body.scrollTop; 1683 1684 top = _scrollTop + 50; 1685 left = _width; 1686 } 1687 1688 // ëì¸ íì´ì§ applyPage 1689 ,isApplyPage:function() 1690 { 1691 // ê´ë¦¬ì íµê³¼ 1692 if(parents.vars.popup.view=="manager") return true; 1693 /* 1694 var params = bannerpop.linkToJson(location.search.replace("?","")) 1695 ,mod = params.mod||"" 1696 ,act = params.act||"" 1697 ,section = params.section||""; 1698 1699 // ë©ì¸ 1700 if(((mod=="main" && act=="index" && !section) || (!mod && !act && !section)) && applyPage.indexOf("main")>=0) return true; 1701 // ì¹ì 1702 else if(mod=="main" && act=="index" && section && applyPage.indexOf("section")>=0) return true; 1703 // ê¸°ì¬ ë¦¬ì¤í¸ 1704 else if(mod=="news" && act=="articleList" && applyPage.indexOf("list")>=0) return true; 1705 // 기ì¬ë·° 1706 else if(mod=="news" && act=="articleView" && applyPage.indexOf("view")>=0) return true; 1707 */ 1708 } 1709 1710 ,window:function(){ 1711 //if(this.isApplyPage()!==true) return false;
1712 1713 this.calcPosition(); // ìì¹ ê³ì° 1714 var winpopupUrl = '/bannerpop/popup.html?win_popup_idxno=' + idxno; 1715 window.open(winpopupUrl, popname, "width="+popupWidth+",height="+popupHeight+",scrollbars="+(windowScroll=="Y"?"yes":"no")+",resizable=yes,top="+top+",left="+left); 1716 } 1717 1718 ,layer:function(){ 1719 //if(this.isApplyPage()!==true) return false; 1720 1721 this.calcPosition(); // ìì¹ ê³ì° 1722 1723 var $content = $(content); 1724 1725 $content.attr({"id":popname}) 1726 .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":"")) 1727 .find(".popup_close_box").addClass("layer_close_box"); 1728 1729 // ëëê·¸ ê°ë¥ 1730 if(layerMove=="Y") $content.addClass("layer_box_cursor_move").draggable(); 1731 1732 // ì°½ë«ê¸°-icon ë«ê¸° ë²í¼ì ë³ê°ë¤ 1733 //if(bottomClose=="Y"){ 1734 var $btnClose = $content.find(".popup_close, .popup_close_map, .popup_icon_close"); 1735 $btnClose.each(function(){ 1736 var _$this = $(this); 1737 //if(_$this.is(".popup_close") && bottomClose=="Y") _$this.text('ì°½ë«ê¸°'); 1738 1739 if(_$this.is(".popup_icon_close")) { 1740 if(layerClosePosition == 'BL' || layerClosePosition == 'BR') { 1741 1742 if($content.find(".popup_close, .popup_close_map").length>0) { 1743 _$this.css('top',Number(j.popup_height)-40+'px'); 1744 } 1745 } 1746 1747 _$this.addClass("layer_position_"+layerClosePosition); 1748 } 1749 }); 1750 1751 $btnClose.click(function(){ 1752 parents.evtClose(popupType, idxno); 1753 return false; 1754 }); 1755 //} 1756 1757 // ì´ë¯¸ì§ë´ ë§í¬ê° ì°½ë«ê¸° ë¼ë©´ 1758 //$content.find("a[href*='javascript:window.close()']").click(function(){ 1759 $content.find("[href*='javascript:window.close()']").click(function(){ 1760 parents.evtClose(popupType, idxno); 1761 return false; 1762 }); 1763 1764 // í루, ëªì¼ëì ì´ì§ ì기 1765 parents.daysNotOpen(bottomCloseExpireCk, bottomCloseExpire, $content.find(".popup-days, .popup_day_close_map"), j); 1766 1767 // ê´ë¦¬ì 미리보기ì ì¤ìì 1768 if(parents.vars.popup.view=="manager"){ 1769 $content.appendTo(document.body); 1770 this.setPositionCenter(); 1771 $content.removeClass("layer_box_fixed").css({"top":top+"px", "left":left+"px"}); 1772 }else{ 1773 $content.appendTo($("#layer-popups")); 1774 } 1775 1776 // ì´ë¯¸ì§ë§µ 리ì¬ì´ì¦ 1777 $('img[usemap]', $content).rwdImageMaps(); 1778 } 1779 }; 1780 1781 type[popupType](); 1782 } 1783 1784 // íì ëì°ê¸° 1785 ,popup:function() 1786 { 1787 //try{ 1788 var parents = this; 1789 $(window).on("load", function(){ 1790 if(!window.___popup) return ; 1791 if($.isArray(___popup)===false && ___popup.length>0) return ; 1792 if(!window.___currentTime) ___currentTime = Math.floor(new Date().getTime()/1000);// ìê°ì´ ì¤ì ëì§ ììë¤ë©´ js ìê°ì¼ë¡ ì¤ì í¨ 1793 1794 var $content = $("#layer-popups"); 1795 1796 if($content.length<=0) return false; 1797 parents.vars.popup.bodyWidth = $content.innerWidth(); 1798 parents.vars.popup.bodyLeft = $content.position().left; 1799 parents.vars.popup.screenWidth = window.screen.width; 1800 for(var i=0,cnt=___popup.length; i<cnt; i++){ 1801 // ì¿ í¤ì¸ì§ íë¨í ì´ê¸° 1802 var coo = ""; 1803 coo = bannerpop.getCookie(parents.vars.popup.popname+___popup[i].idxno) 1804 1805 if(!coo){ 1806 parents.vars.popup.order++; 1807 parents.float(___popup[i]); 1808 } 1809 } 1810 }); 1811 //}catch(e){} 1812 } 1813 1814 1815 // ì°½ë«ê¸° 1816 ,evtClose:function(mode, idxno) 1817 { 1818 if(mode=="layer"){ 1819 var layerId = bannerpop.vars.popup.popname+idxno; 1820 1821 $("#"+layerId).fadeOut("fast", function(){ 1822 $(this).remove(); 1823 }); 1824 }else window.close(); 1825 } 1826 1827 // cookie 1828 ,evtCookieClose:function(name, days) 1829 { 1830 bannerpop.setCookie(name, "popup", days); 1831 } 1832 1833 // í루,ëªì¼ëì ì´ì§ ì기 1834 ,daysNotOpen:function(expire, period, $btn, p) 1835 { 1836 var parents = this 1837 ,idxno = p.idxno 1838 ,isClickedMap = false; 1839 1840 if(expire!="none"){ 1841 $btn.each(function(i,v) { 1842 var $thisBtn = $(this); 1843 if($thisBtn.is(".popup-days")){ 1844 // í루ëì 1845 if(expire=="day"){ 1846 $thisBtn.click(function(){ 1847 parents.evtCookieClose(parents.vars.popup.popname+idxno, "1"); 1848 parents.evtClose(p.popup_type, p.idxno); 1849 return false;
1850 }) 1851 // ë«ê¸° íê·¸ ìì ìê²ë ìë ê±° ì°¾ì ë«ê¸° í ì¤í¸ ë£ì´ì£¼ê¸° 1852 .not(":has(*)").html('<a href="#close-to-layer">í루ëì ë³´ì§ ì기</a>'); 1853 } 1854 // ëªì¼ëì daySubfix 1855 else if(expire=="days"){ 1856 var select = '<a href="#link">' 1857 +'<label class="show-for-sr" for="popDays"></label>' 1858 +'<select name="popDays" id="popDays" class="tiny" title="기ê°">' 1859 +' <option value="1">í루</option>' 1860 +' <option value="2">2ì¼</option>' 1861 +' <option value="3">3ì¼</option>' 1862 +' <option value="4">4ì¼</option>' 1863 +' <option value="5">5ì¼</option>' 1864 +' <option value="6">6ì¼</option>' 1865 +' <option value="7">7ì¼</option>' 1866 +'</select> ëì ì´ì§ì기' 1867 +'</a>'; 1868 var html = '<a href="#link">' 1869 + (period>1 ? 'ëªì¼ëì ë³´ì§ ì기' : 'í루ëì ë³´ì§ ì기') 1870 +'</a>'; 1871 //$btn.not(":has(*)").append(select).click(function(){ 1872 $thisBtn.append(html).click(function(){ 1873 var $this = $(this) 1874 //,days = $this.prev("select").val(); 1875 ,days = period; 1876 1877 parents.evtCookieClose(parents.vars.popup.popname+idxno, days); 1878 parents.evtClose(p.popup_type, p.idxno); 1879 return false; 1880 }); 1881 } 1882 }else{ 1883 // ì´ë¯¸ì§ë§µì¼ë, í루ëì ì´ì§ì기 1884 $thisBtn.click(function(){ 1885 parents.evtCookieClose(parents.vars.popup.popname+idxno, "1"); 1886 parents.evtClose(p.popup_type, p.idxno); 1887 return false; 1888 }); 1889 1890 isClickedMap = true; 1891 } 1892 }); 1893 } 1894 1895 // expire ê°ì´ë ê´ê³ìì´ ì´ë¯¸ì§ë§µì ì°¾ì ì²ë¦¬ 1896 if(isClickedMap===false && $btn.is(".popup_day_close_map")){ 1897 // ì´ë¯¸ì§ë§µì¼ë, í루ëì ì´ì§ì기 1898 $btn.click(function(){ 1899 parents.evtCookieClose(parents.vars.popup.popname+idxno, "1"); 1900 parents.evtClose(p.popup_type, p.idxno); 1901 return false; 1902 }); 1903 } 1904 } 1905 1906 // window popup control 1907 ,popupControl:function() 1908 { 1909 if(!___popup) return ; 1910 if((typeof ___popup)!=="object") return ; 1911 1912 var parents = this 1913 ,p = ___popup 1914 ,title = decodeURIComponent(p.title)||"" 1915 ,popupType = p.popup_type||"window" 1916 ,bottomClose = p.bottom_close||"Y" 1917 ,bottomCloseExpireCk = p.bottom_close_expire_ck||"day" // : day,days,none 1918 ,bottomCloseExpire = p.bottom_close_expire||1 // : ëªì¼ 1919 ,$btnClose = $(".popup_close, .popup_close_map, .popup_icon_close") 1920 ,$btnDayClose = $(".popup-days, .popup_day_close_map"); 1921 1922 if(popupType!="window") return ; 1923 1924 // ìëì° ë° íì´í êµì²´ 1925 document.title = title; 1926 1927 // ì°½ë«ê¸° 1928 if(bottomClose=="Y"){ 1929 $btnClose.each(function(){ 1930 var _$this = $(this); 1931 //if(_$this.is(".popup_close")) _$this.text('ì°½ë«ê¸°'); 1932 }); 1933 1934 $btnClose.click(function(){ 1935 parents.evtClose(p.popup_type, p.idxno); 1936 return false; 1937 }); 1938 } 1939 1940 // í루, ëªì¼ëì ì´ì§ ì기 1941 this.daysNotOpen(bottomCloseExpireCk, bottomCloseExpire, $btnDayClose, p); 1942 1943 } 1944 1945 // array ìµê³ ê° 1946 ,arrayMaxMin:function(arr, mode) 1947 { 1948 if($.isArray(arr)===false) return false; 1949 1950 if(!mode) mode = "max"; 1951 arr.sort(function(a, b){ 1952 return b-a; 1953 }); 1954 return (mode=="max"?arr[0]:arr[arr.length-1])||0; 1955 } 1956}; 1957 1958/****************************************************************************************************************** 1959* ë©í° 기ë¥ì± ë°°ë 1960* 1961* @update 2018/07/18 1962*/ 1963var bannerpopMulti = { 1964 // php ì ë¬ ë³ì 1965 vars:{ 1966 $banner_list:null, 1967 $edit_mode:"" 1968 } 1969 1970 // íì´ì§ ì´ê¸° ë¡ë 1971 ,init:function() { 1972 $('input[name="effect_type"]').on("click", function() { 1973 if ($(this).val()=='none') { 1974 $("#row_num").val(0).attr("disabled", true); 1975 $("#scroll_num").val(0).attr("disabled", true); 1976 } else { 1977 $("#row_num").removeAttr("disabled"); 1978 $("#scroll_num").removeAttr("disabled"); 1979 } 1980 }); 1981 1982 $('input[name="autoplay"]').on("click", function() { 1983 if ($(this).val()=='Y') { 1984 $("#autoplay_speed").removeAttr("disabled"); 1985 } else { 1986 $("#autoplay_speed").attr("disabled", true); 1987 } 1988 }); 1989 1990 $('#all-banner-list').on('click', function(e) { 1991 $this = $(this); 1992 href = $this.attr('href'); 1993 $("#edit-modal-iframe").attr("src", href); 1994 $('#edit-modal').foundation('open'); 1995 return false;
1996 }); 1997 1998 $('#banner-activity-box').sortable({ 1999 axis: '', 2000 update: function() { 2001 console.log($(this)); 2002 } 2003 }); 2004 2005 $('#edit-modal').on('open.zf.reveal', function(e){ 2006 $('#for-loading').show(); 2007 }); 2008 2009 $('#edit-modal').on('closed.zf.reveal', function(e){ 2010 $("#edit-modal-iframe").attr("src", "about:blank").height('0px').closest('#activity-modal').css('height', '0px'); 2011 }); 2012 2013 $(document).on("click", '.trash', function() { 2014 var $this=$(this) 2015 ,$parent = $this.closest('.banner-activity-list'); 2016 $parent.fadeOut('fast', function(){ 2017 $parent.remove(); 2018 }); 2019 }); 2020 } 2021 2022 // ë°°ë ê°ì ¸ì¤ê¸° 2023 ,evtClickMultipleAdd:function() { 2024 var multi_idxno=window.parent.$('#all-banner-list').closest('div').attr('data-multi-idxno')||''; 2025 $('#activity-add-btn').on("click", function() { // #activity-add-btn 기ë¥ì±ë°°ë ë²í¼ í´ë¦ ì´ë²¤í¸ë¥¼ ì´ì© 2026 var $this=$(this); 2027 if($('.banner_element_ckecked').is(':checked') == false) { 2028 alert('ë°°ë를 ì íí´ì£¼ì¸ì.'); 2029 return false; 2030 }else{ 2031 var $checked=$(".banner_element_ckecked:checked") 2032 ,arr = new Array(); 2033 if($checked.length>0) { 2034 $.each($checked, function(idx, v) { 2035 arr.push(v.value); 2036 }); 2037 2038 var data = {mode:multi_idxno?'modify':'input', multi_idxno:multi_idxno, banner_idxno:arr}; 2039 data = JSON.stringify(data); 2040 //console.log(data); 2041 2042 $.ajax({ 2043 url:"/bannerpop/activity_multi_act.php" 2044 ,type:'post' 2045 ,dataType:'json' 2046 ,contentType:'application/x-www-form-urlencoded; charset=utf-8' 2047 ,data:{post_data:data} 2048 ,success:function(json, result) { 2049 if(result == 'success') { 2050 if(json.response == 'ok') { 2051 var item = JSON.parse(json.data), 2052 $target = window.parent.$("#banner-activity-box"), 2053 $sample = window.parent.$("#sample"); 2054 bannerpopMulti.vars.$banner_list = item; 2055 bannerpopMulti.bannerCollocate($target, $sample); 2056 window.parent.$(".close-button").trigger("click"); 2057 }else{ 2058 return false; 2059 } 2060 }else return false; 2061 }, 2062 error:function(request,status,error){ 2063 alert("code:"+request.status+"\n"+"message:"+request.responseText+"\n"+"error:"+error); 2064 } 2065 }); 2066 } 2067 } 2068 }); 2069 } 2070 2071 // ë°°ë ë°°ì¹ í기 2072 ,bannerCollocate:function($targetArea, $sample) { 2073 if (!this.vars.$banner_list) return false; 2074 if (typeof $targetArea != "object" || typeof $sample != "object") return false; 2075 var item = this.vars.$banner_list; 2076 for (var i=0;i<item.length;i++) { 2077 var $areaBox = $targetArea, 2078 $clone = $sample.clone(), 2079 stateIcon = ""; 2080 if (typeof $clone == "object") { 2081 if (item[i].state=="previous") stateIcon = '<span class="label success tiny">ì§íì </span>'; 2082 else if (item[i].state=="proceeding") stateIcon = '<span class="label tiny">ì§íì¤</span>'; 2083 else stateIcon = '<span class="label secondary tiny">ì§íì¢ ë£</span>'; 2084 $clone.attr("data-banner-idxno", item[i].idxno); 2085 $clone.find(".banner-activity-list").attr("data-banner-idxno", item[i].idxno).end(). 2086 find(".dis-table-cell").append(item[i].banner).end(). 2087 find('input[name="banner_idxno[]"]').val(item[i].idxno).end(). 2088 find(".dis-status").empty().append(stateIcon).end(). 2089 find('input[name="delay[]"]').attr("id", "delay_"+item[i].idxno).attr("value", item[i].delay).end(). 2090 find('.input-group-label').attr("for", "delay_"+item[i].idxno); 2091 $areaBox.append($clone.html()); 2092 } 2093 } 2094 } 2095 2096 // ì íë ë°°ë íì 2097 ,selectBannerCheck:function() { 2098 var $areaBox = window.parent.$("#banner-activity-box"), 2099 $list = $areaBox.find('input[name="banner_idxno[]"]'), 2100 $bannerItems = $(".adccfg_list_items"), 2101 bannerList = [], 2102 i = 0; 2103 $list.each(function() { 2104 bannerList.push($(this).val()); 2105 }); 2106 //console.log(bannerList); 2107 2108 $bannerItems.each(function() { 2109 var $this = $(this), 2110 idxno = $this.attr("data-banner-idxno"); 2111 if ($.inArray(idxno, bannerList)!=-1) { 2112 $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>'); 2113 } 2114 }); 2115 } 2116 2117 // ë°°ë ë±ë¡í기 2118 ,valid_multi:function(form) { 2119 if(form.title.value == '') { 2120 alert('ì 목ì ì ë ¥íì¸ì.');
2121 form.title.focus(); 2122 return false; 2123 } 2124 2125 if (form.column_num.value>9) { 2126 alert("ì´ìë 1~9ê¹ì§ë§ ì ë ¥í ì ììµëë¤."); 2127 form.column_num.focus(); 2128 return false; 2129 } 2130 2131 if (form.row_num.value>9) { 2132 alert("íìë 1~9ê¹ì§ë§ ì ë ¥í ì ììµëë¤."); 2133 form.row_num.focus(); 2134 return false; 2135 } 2136 2137 if (form.scroll_num.value>9) { 2138 alert("ì¤í¬ë¡¤ìë 1~9ê¹ì§ë§ ì ë ¥í ì ììµëë¤."); 2139 form.scroll_num.focus(); 2140 return false; 2141 } 2142 2143 if($('.banner-activity-list').length-1<=0) { 2144 alert('ë°°ë를 íë ì´ì ì¶ê°íì ì¼ í©ëë¤.'); 2145 return false; 2146 } 2147 2148 return true; 2149 } 2150 2151 // ë©í° 기ë¥ì± ë°°ë ì´ë²¤í¸ ë¡ë 2152 ,bannerLoad:function() { 2153 $('.banner-multi-box').each(function() { 2154 var $effectType = $(this).attr("data-effect-type"), 2155 $rowNum = $(this).attr("data-row-num")||1,
2156 $colNum = $(this).attr("data-column-num")||1, 2157 $scrollNum = $(this).attr("data-scroll-num")||1, 2158 $moveDisplay = $(this).attr("data-move-display")||'none', 2159 $autoplay = $(this).attr("data-autoplay")||'N', 2160 $autoplaySpeed = $(this).attr("data-autoplay-speed")||5, 2161 $speed = $(this).attr("data-speed")||300, 2162 $random = $(this).attr("data-random")||'N', 2163 $bannerMultiBoxHtml = $(this); 2164 2165 // ìì½ë°°ëì´ê±°ë ì¢ ë£ ë°°ëì¼ ê²½ì° ì ì¸ ì²ë¦¬. 2166 if(location.href.indexOf('/edit/adminSection.html')<0) { 2167 $(this).find(".slick-slide").each(function(){ 2168 if($(this).find('.banner_box').length<=0) { 2169 $bannerMultiBoxHtml.find(".slick-slide").eq($(".slick-slide").index(this)).remove(); 2170 } 2171 }); 2172 } 2173 2174 if ($effectType!="none") { 2175 var totalSlide = $(this).find(".slick-slide").length||0, 2176 randomStart = Math.floor(Math.random() * totalSlide); 2177 randomStart = ($random=="Y") ? randomStart : 0; 2178 2179 var slickParam = {}; 2180 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>'; // ì´ì ë²í¼ 2181 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>'; // ë¤ìë²í¼ 2182 slickParam.infinite = true; // 무í ë기기 2183 slickParam.draggable = false; // ì ì¤ì²(모ë°ì¼ì©) 2184 2185 switch ($effectType) { 2186 case "vertical": 2187 slickParam.slidesToShow = parseInt($rowNum,10); 2188 slickParam.vertical = true; 2189 slickParam.verticalSwiping = true; 2190 if ($random=="Y"&&totalSlide>parseInt($rowNum,10)) slickParam.initialSlide = randomStart; 2191 break; 2192 case "horizon": 2193 default: 2194 slickParam.slidesToShow = parseInt($colNum,10); 2195 if (parseInt($rowNum,10)>1) slickParam.rows = parseInt($rowNum,10); 2196 if ($random=="Y") slickParam.initialSlide = randomStart; 2197 break; 2198 } 2199 2200 slickParam.slidesToScroll = parseInt($scrollNum,10); 2201 slickParam.arrows = ($moveDisplay=="arrow"&&bannerpopMulti.vars.$edit_mode!="delete")?true:false; 2202 slickParam.dots = ($moveDisplay=="dot"&&bannerpopMulti.vars.$edit_mode!="delete")?true:false; 2203 slickParam.dotsClass = "auto-pager"; 2204 slickParam.autoplay = ($autoplay== "Y")?true:false; 2205 slickParam.autoplaySpeed = ($autoplay== "Y")?parseInt($autoplaySpeed,10)*1000:0; 2206 slickParam.speed = parseInt($speed, 10); 2207 slickParam.centerMode = false; 2208 slickParam.variableWidth = false; 2209 slickParam.focusOnSelect = true; 2210 //console.log(slickParam); 2211 2212 $(this).slick(slickParam); 2213 } else { 2214 if ($random=="Y") shuffle($(this)); 2215 } 2216 2217 function shuffleArray(d) { 2218 for (var c = d.length - 1; c > 0; c--) { 2219 var b = Math.floor(Math.random() * (c + 1)); 2220 var a = d[c]; 2221 d[c] = d[b]; 2222 d[b] = a; 2223 } 2224 return d; 2225 } 2226 2227 function shuffle(target){ 2228 var $box = $(target).children(".slick-slide-none") 2229 ,$container = $box.children(".row") 2230 ,$li = $box.find(".columns") 2231 ,total = $li.length 2232 ,tmp = []; 2233 2234 for(var i=0;i<total;i++) tmp.push(i); 2235 2236 $container.empty(); 2237 setTimeout(
2238 shuffleArray(tmp).forEach(function(a,b){ 2239 var $bannerBoxs=$li[a].querySelectorAll(".banner_box") 2240 ,length=$bannerBoxs.length 2241 ,div=document.createElement("div"); 2242 for(var i=0;i<length;i++){ 2243 div.appendChild($bannerBoxs[i]); 2244 div.className = "columns"; 2245 } 2246 $container.append(div); 2247 }) 2248 ,0); 2249 } 2250 }); 2251 } 2252}; 2253 2254/* ****************************************** */ 2255/* /script/resizePhoto.js */ 2256/* ****************************************** */ 2257 2258function resizePhoto() { 2259 2260 var $_container = $('#article-view-content-div'); 2261 var articleViewDivWidth = $_container.width(); 2262 2263 $_container.find('img').each(function(e){ 2264 if($(this).closest('figure').length) { 2265 var ViewimageObj = new Image(); 2266 var $_thisImgObj = $(this); 2267 ViewimageObj.src = $(this).attr("src"); 2268 ViewimageObj.onload = function() { 2269 imageWidth = this.width; 2270 if(articleViewDivWidth <= imageWidth) { 2271 $_thisImgObj.closest('figure').addClass('bigsize'); 2272 } 2273 }; 2274 2275 } 2276 }); 2277 2278 $_container.on('click', 'figure.bigsize', function(e){ 2279 $('<form action="/news/userArticlePhoto.html" method="POST"><input type="hidden" name="src" value="'+$(this).find("img").attr('src')+'"></form>').appendTo('body').submit(); 2280 }) 2281 .on('click', 'figure.bigsize figcaption', function(e){ 2282 e.preventDefault(); 2283 e.stopPropagation(); 2284 }); 2285} 2286 2287/* ****************************************** */ 2288/* /script/floating.banner.js */ 2289/* ****************************************** */ 2290 2291$(window).scroll(function() { 2292 2293 if(!($('#floating_banner_left').length || $('#floating_banner_right').length)) return false; 2294 2295 var floatBannerLeft = $('#floating_banner_left'), 2296 floatBannerRight = $('#floating_banner_right'), 2297 2298 HeadHeight = $('#user-header').height(), 2299 footerBoxTop = $('#user-footer').offset().top, 2300 footerBoxHeight = $('#user-footer').height(), 2301 2302 scrollTop = $(window).scrollTop(), 2303 2304 flBnLHeight = floatBannerLeft.height(), 2305 flBnRHeight = floatBannerRight.height(), 2306 2307 ahtHeight = $('.aht-wrapper').height(), 2308 2309 flBnLscrollLimit = footerBoxTop - flBnLHeight - HeadHeight - floatBannerLeft.data('down-margin'), 2310 flBnLscrollLimitChk = flBnLscrollLimit + footerBoxHeight + floatBannerLeft.data('down-margin'), 2311 flBnRscrollLimit = footerBoxTop - flBnRHeight - HeadHeight - floatBannerRight.data('down-margin'), 2312 flBnRscrollLimitChk = flBnRscrollLimit + footerBoxHeight + floatBannerRight.data('down-margin'), 2313 flBnScrollMargin = floatBannerLeft.data('scroll-margin'), 2314 flBnLscrollTop = scrollTop - HeadHeight + ahtHeight + floatBannerLeft.data('top-margin'), 2315 flBnRscrollTop = scrollTop - HeadHeight + ahtHeight + floatBannerRight.data('top-margin'); 2316 2317 if(flBnScrollMargin == null || !flBnScrollMargin) flBnScrollMargin = 0; 2318 2319 if(floatBannerLeft.data('scroll') == 'y'){ 2320 if(floatBannerLeft.data('duration') > 0) floatBannerLeft.stop(); 2321 if(scrollTop < HeadHeight) floatBannerLeft.animate({top: flBnScrollMargin + 'px'}, floatBannerLeft.data('duration'), 'linear'); 2322 else if(scrollTop >= flBnLscrollLimitChk) floatBannerLeft.animate({top:flBnLscrollLimit + 'px'}, floatBannerLeft.data('duration'), 'linear'); 2323 else if(scrollTop >= HeadHeight) floatBannerLeft.animate({top:flBnLscrollTop + 'px'}, floatBannerLeft.data('duration'), 'linear'); 2324 } 2325 2326 if(floatBannerRight.data('scroll') == 'y'){ 2327 if(floatBannerRight.data('duration') > 0) floatBannerRight.stop(); 2328 if(scrollTop < HeadHeight) floatBannerRight.animate({top: flBnScrollMargin + 'px'}, floatBannerRight.data('duration'), 'linear'); 2329 else if(scrollTop >= flBnRscrollLimitChk) floatBannerRight.animate({top:flBnRscrollLimit + 'px'}, floatBannerRight.data('duration'), 'linear'); 2330 else if(scrollTop >= HeadHeight) floatBannerRight.animate({top:flBnRscrollTop + 'px'}, floatBannerRight.data('duration'), 'linear'); 2331 } 2332}); 2333 2334/* ****************************************** */ 2335/* /script/mosaic.js */ 2336/* ****************************************** */ 2337 2338function mosaic_autobox(data) { 2339 var $_container = $(data[0].container); 2340 var autoplay = data[0].autoplay; 2341 var autotime = data[0].autotime; 2342 var temp_autoplay = autoplay; 2343 var totalcount = $_container.find('ul.auto-nav > li').length; 2344 var point = 0; 2345 2346 $_container.on('mouseenter', '.auto-cursor', function(e){ 2347 mosaic_cmd('current', $(this).index()); 2348 }); 2349 2350 $_container.on('mouseenter', function(e){ 2351 if(autoplay) temp_autoplay = false;
2352 }).on('mouseleave', function(e){ 2353 if(autoplay) temp_autoplay = true; 2354 }); 2355 2356 if(autoplay) { 2357 var rolling = window.setInterval(function () { 2358 if(temp_autoplay) mosaic_cmd('next', 0); 2359 }, autotime); 2360 } 2361 2362 function mosaic_cmd(mode, current_point) { 2363 2364 if(mode == "prev") { 2365 point -= 1; 2366 if(point < 0) point = totalcount - 1; 2367 }else if(mode == "next") { 2368 point += 1; 2369 if(point >= totalcount) point = 0; 2370 }else if(mode == "current") { 2371 point = current_point; 2372 } 2373 2374 $_container.find('ul.auto-container > li').eq(point).show().siblings().hide(); 2375 $_container.find('ul.auto-nav > li').eq(point).addClass('active').siblings().removeClass('active'); 2376 2377 if(point < 2){ 2378 $_container.find('ul.auto-container').css({"left":"33.333333%","top":"33.333333%"}); 2379 } else if(point < 4 && point >= 2) { 2380 $_container.find('ul.auto-container').css({"left":"0px","top":"33.333333%"}); 2381 } else if(point < 6 && point >= 4) { 2382 $_container.find('ul.auto-container').css({"left":"0px","top":"0px"}); 2383 } else if(point >= 6) { 2384 $_container.find('ul.auto-container').css({"left":"33.333333%","top":"0px"}); 2385 } 2386 2387 return false; 2388 } 2389} 2390 2391/* ****************************************** */ 2392/* /script/newsAutoCall.js */ 2393/* ****************************************** */ 2394 2395function fn_articleAutoCall(mode, cycle) { 2396 2397 var autoCallMode = mode; 2398 var autoCallCycle = 1000*60*cycle; 2399 var _autoCallWatch = setInterval(action, autoCallCycle); 2400 2401 // DESKì¤ë³µìì ì´ë©´ ì´ê¸° 1í ë°ë¡ì¤í. 2402 if(autoCallMode == "desk") action(); 2403 2404 function action() { 2405 if(autoCallMode == "save") { 2406 if($('.auto-save', '#admin-aside').length > 0 && $('input:hidden[name="autoSave"]', '#newsWriteForm').val() != "") $('.auto-save', '#admin-aside').show(); 2407 TxRx("/news/articleAutoSave.ajax.php"); 2408 } 2409 else if(autoCallMode == "desk") TxRx("/news/articleAutoDesk.ajax.php"); 2410 else stop(); 2411 } 2412 2413 function TxRx(url) { 2414 2415 $.ajax({ 2416 type: "post", 2417 dataType: "json", 2418 url:url, 2419 data:$('#newsWriteForm').serialize(), 2420 success: function(data) { 2421 console.log(data[1]); 2422 }, 2423 error: function(error, request) { 2424 console.log("ìëì½ìë¬ - code:"+request.status+"\n"+"message:"+request.responseText+"\n"+"error:"+error); 2425 stop(); 2426 } 2427 }).always(function() { 2428 if($('.auto-save', '#admin-aside').length > 0) $('.auto-save', '#admin-aside').fadeOut(1500); 2429 }); 2430 } 2431 2432 function stop() { 2433 clearInterval(_autoCallWatch); 2434 console.log(autoCallMode + 'ì¤í±'); 2435 } 2436} 2437 2438/* ****************************************** */ 2439/* 기존 common.js */ 2440/* ****************************************** */ 2441 2442/*--------------------------------------------------------------------------------------------- 2443 JAVASCRIPT CODE 2444 --------------------------------------------------------------------------------------------- 2445 function name | description | use process 2446 --------------------------------------------------------------------------------------------- 2447 setCookie(ì¿ í¤ëª , ê°, ì í¨ê¸°ê°(ì¼)) | | ì¿ í¤ìì± 2448 getCookie(ì¿ í¤ëª ) | | ì¿ í¤ê°ì ¸ì¤ê¸° 2449 ---------------------------------------------------------------------------------------------*/ 2450 2451// ì¿ í¤ ìì± 2452function setCookie(cName, cValue, cDay, cDomain){ 2453 var expire = new Date(); 2454 expire.setDate(expire.getDate() + cDay); 2455 cookies = cName + '=' + escape(cValue) + '; path=/ '; // íê¸ ê¹¨ì§ì ë§ê¸°ìí´ escape(cValue)를 í©ëë¤. 2456 if(typeof cDay != 'undefined') cookies += ';expires=' + expire.toGMTString() + ';'; 2457 document.cookie = cookies; 2458 if (cDomain) { 2459 document.cookie += "domain=" + cDomain + ";"; 2460 } 2461} 2462 2463// ì¿ í¤ ê°ì ¸ì¤ê¸° 2464function getCookie(cName) { 2465 cName = cName + '='; 2466 var cookieData = document.cookie; 2467 var start = cookieData.indexOf(cName); 2468 var cValue = ''; 2469 if(start != -1){ 2470 start += cName.length; 2471 var end = cookieData.indexOf(';', start); 2472 if(end == -1)end = cookieData.length; 2473 cValue = cookieData.substring(start, end); 2474 } 2475 return unescape(cValue); 2476} 2477 2478// ì¿ í¤ ì§ì 2479function delCookie(cName) { 2480 var today = new Date(); 2481 2482 today.setTime(today.getTime() - 1); 2483 var value = getCookie(cName); 2484 if(value != "") 2485 document.cookie = cName + "=" + value + "; path=/; expires=" + today.toGMTString(); 2486} 2487 2488 2489/*--------------------------------------------------------------------------------------------- 2490 JAVASCRIPT CODE 2491 --------------------------------------------------------------------------------------------- 2492 function name | description | use process 2493 --------------------------------------------------------------------------------------------- 2494 checkMsgLength() | ì ë ¥ë 문ìì´ ê¸¸ì´ ê²ì¬ | ê¸°ì¬ ëê¸ 2495 calculateMsgLength() | 문ìì´ ê¸¸ì´ ë°í | ê¸°ì¬ ëê¸ 2496 assertMsgLength() | 문ìì´ ê¸¸ì´ë§í¼ ìë¼ ë³í | ê¸°ì¬ ëê¸ 2497 ---------------------------------------------------------------------------------------------*/ 2498 2499// 문ìì´ê¸¸ì´ ê²ì¬ 2500function checkMsgLength(frm, id, lenStr) { 2501 var length = calculateMsgLength(document.getElementById(frm).value); 2502 document.getElementById(id).innerHTML = length; 2503 if (length > lenStr) { 2504 alert("ìµë "+lenStr+" ë°ì´í¸ê¹ì§ ë¨ê¸°ì¤ ì ììµëë¤.\r\nì´ê³¼ë " + (length - lenStr) + "ë°ì´í¸ë ìëì¼ë¡ ìì ë©ëë¤."); 2505 document.getElementById(frm).value = assertMsgLength(document.getElementById(frm).value, lenStr, id); 2506 } 2507} 2508 2509//문ìì´ê¸¸ì´ ë°í 2510function calculateMsgLength(message) { 2511 var nbytes = 0; 2512 2513 for (i=0; i<message.length; i++) { 2514 var ch = message.charAt(i); 2515 2516 if (escape(ch).length > 4) { 2517 nbytes += 2; 2518 } else if (ch != "\r") { 2519 nbytes++; 2520 } 2521 } 2522 2523 return nbytes; 2524} 2525 2526//문ìì´ ê¸¸ì´ë§í¼ ìë¼ ë³í 2527function assertMsgLength(message, maximum, id) { 2528 var inc = 0; 2529 var nbytes = 0; 2530 var msg = ""; 2531 var msglen = message.length; 2532 2533 for (i=0; i<msglen; i++) { 2534 var ch = message.charAt(i); 2535 2536 if (escape(ch).length > 4) { 2537 inc = 2; 2538 } else if (ch != "\r") { 2539 inc = 1; 2540 } 2541 2542 if ((nbytes + inc) > maximum) { 2543 break; 2544 } 2545 2546 nbytes += inc; 2547 msg += ch; 2548 } 2549 2550 document.getElementById(id).innerHTML = nbytes; 2551 return msg; 2552} 2553
2554/*--------------------------------------------------------------------------------------------- 2555 JAVASCRIPT CODE 2556 --------------------------------------------------------------------------------------------- 2557 function name | description | use process 2558 --------------------------------------------------------------------------------------------- 2559 articleHeader() | 기ì¬ë·° í¤ë ë¤ë¹ | 기ì¬ë·° í¤ë ë¤ë¹ 2560 ---------------------------------------------------------------------------------------------*/ 2561 2562var articleHeader = { 2563 2564 // í¤ë ë¤ë¹ê²ì´ì ìì± 2565 setScroll:function(){ 2566 jQuery(window).scroll(function() { 2567 if (jQuery(this).scrollTop() > 300) { 2568 jQuery('#sticky-header').addClass('scroll'); 2569 } else { 2570 jQuery('#sticky-header').removeClass('scroll'); 2571 } 2572 }); 2573 }, 2574 2575 2576 // 기ì¬ì´ë 2577 move:function(mod, order_type, order_value, section_code, sub_section_code, serial_code){ 2578 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 ) { 2579 2580 if(f_idxno){ 2581 location.href = '/news/articleView.html?idxno='+f_idxno 2582 }else{ 2583 alert('기ì¬ê° ì¡´ì¬íì§ ììµëë¤'); 2584 } 2585 2586 }); 2587 } 2588 2589} 2590 2591 2592/*--------------------------------------------------------------------------------------------- 2593 JAVASCRIPT CODE 2594 --------------------------------------------------------------------------------------------- 2595 function name | description | use process 2596 --------------------------------------------------------------------------------------------- 2597 bbsPrint(idxno) | ê²ì물 ì¸ìì°½ ì¤í | ê²ì물 ì¸ìì°½ ì¤í 2598 articlePrint(idxno) | ì¸ìì°½ ì¤í | ì¸ìì°½ ì¤í 2599 articleMail(idxno) | ë©ì¼ë³´ë´ê¸°ì°½ ì¤í | ë©ì¼ë³´ë´ê¸°ì°½ ì¤í 2600 articleErr(idxno) | ì¤ë¥ì ê³ ì°½ ì¤í | ì¤ë¥ì ê³ ì°½ ì¤í 2601 articleSingo(idxno) | ëê¸ì ê³ ì°½ ì¤í | ëê¸ì ê³ ì°½ ì¤í 2602 fn_guid() | (ëë¤)ê³ ì ìì´ë ìì± | (ëë¤)ê³ ì ìì´ë ìì± 2603 ---------------------------------------------------------------------------------------------*/ 2604 2605//ì¸ìì°½ ì¤í 2606function bbsPrint( idxno, ps ) { 2607 var ps_str = ""; 2608 if(ps != "") ps_str = "&ps="+ps; 2609 window.open('/bbs/bbsPrint.html?idxno='+idxno+ps_str, 'bbsPrint', 'width=660,height=500,scrollbars=yes'); 2610} 2611 2612// ì¸ìì°½ ì¤í 2613function articlePrint( idxno ) { 2614 window.open('/news/articlePrint.html?idxno='+idxno, 'articlePrint', 'width=660,height=500,scrollbars=yes'); 2615} 2616 2617// ë©ì¼ë³´ë´ê¸°ì°½ ì¤í 2618function articleMail( idxno ) { 2619 window.open('/news/articleMail.html?idxno='+idxno, 'articleMail', 'width=660,height=500,scrollbars=yes'); 2620} 2621 2622// ì¤ë¥ì ê³ ì°½ ì¤í 2623function articleErr( idxno ) { 2624 window.open('/news/articleErr.html?idxno='+idxno, 'articleErr', 'width=660,height=500,scrollbars=yes'); 2625} 2626 2627// ëê¸ì ê³ ì°½ ì¤í 2628function articleSingo( idxno ) { 2629 window.open('/news/articleSingo.html?idxno='+idxno, 'articleSingo', 'width=660,height=500,scrollbars=yes'); 2630} 2631 2632//ê³ ì ê°ìì± (기ì¬ë±ë¡ ê´ë ¨ê¸°ì¬ ëì¸ë ì¬ì©) 2633function fn_guid() { 2634 function s4() { 2635 return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); 2636 } 2637 return s4() + s4() + s4() + s4() + s4() + s4() + s4() + s4(); 2638} 2639 2640/* ****************************************** */ 2641/* /script/app.js (íì´ë°ì´ì ì¤ííì¼ */ 2642/* ****************************************** */ 2643 2644$(function(){ 2645 $(document).foundation(); 2646});
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.