1var adWrite={ 2 // php ì ë¬ ë³ì 3 vars:{ 4 separator : "|" 5 ,editId : null // ìì í id 6 ,box : '<div class="ad-map" />' // ìì±ë ë°ì¤ 7 ,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="fa fa-link fa-fw" aria-hidden="true"></i></button><button type="button" class="btn_com btn_com_35_699 adcmb_button adcmb_delete button tiny nd-gray" title="ìì "><i class="fa fa-trash-o fa-fw" aria-hidden="true"></i></button></div></div>' //ìì ë ë°ì¤ì ë²í¼ë¤ 8 ,$textBox : null 9 ,act : "" // ì¬ì§ ì ë¡ëíê³ ì´ë¬ì íê² ì주 actê°ì´ ë°ëëë°, ê·¸ê²ì ìë ê° 10 ,iframe : '<iframe src="about:blank" name="adc_up_frame" id="adc_up_frame" width="0" height="0" frameborder="0"></iframe>' // uploadì© iframe 11 ,loadData : {} 12 } 13 14 // ì´ë¯¸ì§ ë¡ë©ëë©´ í¬ê¸° ì¬ì´ì¤ê¸° 15 // IEë§ ì´ë¯¸ì§ ë¡ë©ëí ì´ë²¤í¸ê° 먹ì´ì ¸ì í¬ê¸°ë¥¼ ì ëë¡ ì¬ì´ì¤ì§ 못í´ì inlineì¼ë¡ ì¤í¬ë¦½í¸ ìì±í¨ 16 ,getSizeLoadImage:function(_this) 17 { 18 var _w = _this.width 19 ,_h = _this.height; 20 21 _this.setAttribute("data-display-width", _w); 22 _this.setAttribute("data-display-height", _h); 23 24 // ì´ë¯¸ì§ë§µ ì´ë²¤í¸ 25 adWrite.map($(_this)); 26 } 27 28 // ë±ë¡ì ì´ë²¤í¸ë¤ 29 ,evtCrtForm:function() 30 { 31 var parents = this 32 ,$type = $("#adc_crt_type_html, #adc_crt_type_file") 33 ,$htmlBox = $("#adc_crt_html_box") 34 ,$fileBox = $("#adc_crt_attach_file_box") 35 36 ,$popupType = $("#adc_crt_popup_type_layer, #adc_crt_popup_type_window") 37 ,$layer = $("#adc_crt_popup_layer_opt_box") 38 ,$window = $("#adc_crt_popup_window_opt_box") 39 40 ,$closeIcon = $("#adc_crt_popup_layer_icon") 41 ,$iconBox = $("#adc_crt_popup_layer_icon_box") 42 43 ,$closeExpire = $("#bottom_close_expire_label") 44 ,$closeExpireBox = $("#bottom_close_expire_box") 45 46 ,$attachFile = $("#adc_crt_attach_file") 47 ,$previewFile = $("#adc_crt_file_image") 48 ,$previewBox = $("#adc_crt_image_preview_box") 49 50 ,$max_file_size = $("#file_upload_max_size").val(); 51
52 // ì ë ¥ë¶ë¶ ë´ìë기 53 this.vars.$textBox = $("#adc_crt_image_link_box"); 54 55 // html, file ì ë ¥ 56 $type.click(function(){ 57 var isChecked = $(this).attr("value"); 58 59 $htmlBox[isChecked==="HTML"?"removeClass":"addClass"]("is-hidden"); 60 $fileBox[isChecked==="FILE"?"removeClass":"addClass"]("is-hidden"); 61 }); 62 63 // 미리보기 í¸ì¶ // 64 $attachFile.change(function(){ 65 var form = document.adc_form; 66 67 if (typeof (FileReader) != "undefined") { 68 69 var file = $(this)[0].files[0] 70 ,regex = ['jpg', 'jpeg', 'png', 'gif', 'swf'] 71 ,filesize = file.size 72 ,extension = file.name.split('.').pop().toLowerCase(); 73 74 if(filesize > $max_file_size){ 75 alert('ì ë¡ë ì©ëì´ ì´ê³¼ëììµëë¤.'); 76 $attachFile.val(""); 77 return false; 78 } 79 80 if((regex.indexOf(extension) > -1) === false){ 81 alert('jpg, png, gif, swf íì¥ìë§ ì ííì¬ ì£¼ì¸ì.'); 82 $attachFile.val(""); 83 84 //ì ë ¥ìë§ í¨ì ë°ë ìì 85 $previewBox.addClass("is-hidden"); 86 return false; 87 } 88 89 if(extension == "swf"){ 90 $previewBox.addClass("is-hidden"); 91 return false; 92 } 93 94 var reader = new FileReader(); 95 reader.onload = function (e) { 96 var img = new Image(); 97 img.src = e.target.result; 98 99 img.onload = function(){ 100 $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}); 101 $previewBox.removeClass("is-hidden"); 102 103 $('#size_width').val(this.width); 104 $('#size_height').val(this.height); 105 106 $('#popup_width').val(this.width); 107 $('#popup_height').val(this.height); 108 109 // ì´ë¯¸ì§ë§µ ì´ë²¤í¸ 110 parents.map($previewFile); 111 } 112 } 113 114 reader.readAsDataURL(file); 115 parents.mapDeleteAll(); 116 } 117 }); 118 119 var $mapRadio = $("#adc_crt_image_link_total, #adc_crt_image_link_part, #adc_crt_image_link_not") 120 ,$imgLinkSelect = $(".adcil_btns") 121 ,$imgLink = $("#adc_crt_image_link") 122 ,$imgLinkFile = $("#adc_crt_image_link_file") 123 ,$selectPopup = $("#adc_crt_image_link_popup") 124 ,$btnMapRegist = $("#adc_crt_img_link_btn_regist") 125 ,$linkAction = ''; 126 127 // ì ì²´ ëë ì´ë¯¸ì§ ë§µ ì íì 128 $mapRadio.click(function(){ 129 var $this = $(this) 130 ,type = $this.attr("data-type"); 131 132 if(type == 'total' || type == 'map'){ 133 134 $("#adc_crt_image_link_box").removeClass('is-hidden'); 135 136 $btnMapRegist[type==="map"?"removeClass":"addClass"]("is-hidden"); 137 138 if(type==="total") parents.mapDeleteAll(); // ì ì²´ì íì¼ë, ì´ì ë°ì´í 모ë ì§ì 139 140 }else{ 141 $("#adc_crt_image_link_box").addClass('is-hidden'); 142 } 143 }); 144 145 // layer or window ì í 146 $popupType.click(function(){ 147 var isChecked = $(this).attr("data-type"); 148 149 $layer[isChecked==="layer"?"removeClass":"addClass"]("is-hidden"); 150 $window[isChecked==="window"?"removeClass":"addClass"]("is-hidden"); 151 }); 152 153 // ë«ê¸° ìì´ì½ í´ë¦ì ìì´ì½ íí ì í ë°ì¤ ì´ê² 154 $closeIcon.click(function(){ 155 var $label_attr_for = $(this).attr('for') 156 ,isChecked = $('#'+$label_attr_for).is(":checked"); 157 158 $iconBox[isChecked===false?"removeClass":"addClass"]("is-hidden"); 159 }); 160 161 // ëªì¼ ëì ì´ì§ ì기 ì ë ¥ë°ì¤ ì´ê¸° 162 $closeExpire.click(function(){ 163 var $label_attr_for = $(this).attr('for') 164 ,isChecked = $('#'+$label_attr_for).is(":checked"); 165 166 $closeExpireBox[isChecked===false?"removeClass":"addClass"]("is-hidden"); 167 }); 168 169 // ì´ë¤ííì ë§í¬ì¸ì§ íì¸ 170 // link, popup, file, close, day_close 171 $imgLinkSelect.click(function(){ 172 var $this = $(this) 173 ,type = $this.attr("data-type"); 174 175 if(type==="popup" || type==="close" || type==="day_close"){ 176 $imgLink.add($imgLinkFile).addClass("is-hidden"); 177 $selectPopup[type==="popup"?"removeClass":"addClass"]("is-hidden"); 178 }else{ 179 $imgLink[type==="link"?"removeClass":"addClass"]("is-hidden"); 180 $imgLinkFile[type==="link"?"addClass":"removeClass"]("is-hidden"); 181 $selectPopup.addClass("is-hidden"); 182 } 183 }); 184 185 $btnMapRegist.click(function(){ 186 187 // ë§µ ë±ë¡ ìì 188 var $popupSelect = $("#adc_crt_image_link_popup_select") 189 ,$linkText = $("#adcil_link_text") 190 ,$etcFile = $("#adcilf_attach") 191 ,$linkTarget = $(".adcil_btns_link option:selected"); 192 193 if(!parents.vars.editId){ 194 alert('ì´ë¯¸ì§ìì ìì í ë§µë°ì´í를 ì ííì¬ì£¼ì¸ì.'); 195 return false;
196 } 197 198 // close, day_close 모ë ë±ë¡ ëë¬ì¼ ì ì¥ëê²...ìê·¸ë¼ radioí´ë¦ë§ì¼ë¡ ì´ì ì ë³´ ì체를 ë ë ¤ë²ë¦¼ 199 var type = $(".adcil_btns:checked").attr('data-type') 200 ,url = "" 201 ,target = ""; 202 203 if(!type) return false; 204 if(type==="link"){ 205 url = $linkText.val(); 206 if(!url){ 207 alert('ë§í¬ë¥¼ ì ë ¥íì¬ ì£¼ì¸ì.'); 208 $linkText.focus(); 209 return false; 210 } 211 212 target = $linkTarget.val(); 213 }else if(type==="popup"){ 214 url = $popupSelect.val(); 215 if(!url){ 216 alert('íì ì ì ííì¬ ì£¼ì¸ì.') 217 $popupSelect.focus(); 218 return false; 219 } 220 }else if(type==="file"){ 221 if(!$etcFile.val()){ 222 alert('íì¼ì ì ííì¬ ì£¼ì¸ì.'); 223 $etcFile.focus(); 224 return false; 225 } 226 227 parents.uploadAttachTmpFile(); 228 229 return false; 230 } 231 232 parents.insertData({ 233 type:type 234 ,url:url 235 ,target:target 236 }) 237 return false; 238 }); 239 } 240 241 // ì´ë¯¸ì§ë§µì íì¼ì¼ë ì ì¥ 242 ,uploadAttachTmpFile:function() 243 { 244 var parents = this 245 ,iframe = this.vars.iframe 246 ,form = document.adc_form; 247 248 $(document.body).append(iframe); 249 250 form.action = "/bannerpop/upload_act.php"; 251 form.target = "adc_up_frame"; 252 form.submit(); 253 } 254 255 // ì´ë¯¸ì§ë§µì ììíì¼ì ì¥í ë¦¬í´ ê° 256 ,afterUploadAttachTmpFile:function(result) 257 { 258 // ì±ê³µì´ë ìëë í¼ì ì¼ë¨ ì´ê¸°íí¨ 259 this.releaseForm(); 260 $("#adc_up_frame").remove(); 261 262 var json = $.parseJSON(adWrite.rawurldecode(result)) 263 ,filename = json[0].filename; 264 265 if(!filename){ 266 alert('ì ë¡ëì ìë¬ê° ë°ìíìµëë¤. ë¤ì ì ë¡ëíì¬ ì£¼ì¸ì.'); 267 return false; 268 } 269 270 this.insertData({type:"file",url:filename,target:"self",json_obj:result}); 271 } 272 273 //rawurldecode 274 ,rawurldecode:function(str) { 275 return decodeURIComponent((str + '') 276 .replace(/%(?![\da-f]{2})/gi, function() { 277 return '%25'; 278 })); 279 } 280 281 // ì´ë¯¸ì§ë§µ ì ë ¥í¼ ì´ê¸°í 282 ,initInsertForm:function(data) 283 { 284 var parents = this 285 ,type = data.type||"link" 286 ,$btns = $(".adcil_btns") 287 ,$imgLink = $("#adc_crt_image_link") 288 ,$imgLinkFile = $("#adc_crt_image_link_file") 289 ,$selectPopup = $("#adc_crt_image_link_popup") 290 ,$filebox = $("#adcilf_uploaded_file"); 291 292 //$btns.filter("[data-type='"+type+"']").prop("checked", true); 293 $btns.filter("[data-type='"+type+"']").click(); // 커ì¤í radio box ë¼ì ì´ë ê² ì²ë¦¬ 294 $filebox.hide(); 295 296 if(type==="popup" || type==="close" || type==="day_close"){ 297 $imgLink.add($imgLinkFile).addClass("is-hidden"); 298 $selectPopup[type==="popup"?"removeClass":"addClass"]("is-hidden"); 299 300 if(type==="popup") $("#adc_crt_image_link_popup_select").val(data.url); 301 302 }else{ 303 $imgLink[type==="link"?"removeClass":"addClass"]("is-hidden"); 304 $imgLinkFile[type==="link"?"addClass":"removeClass"]("is-hidden"); 305 $selectPopup.addClass("is-hidden"); 306 307 if(type==="link"){ 308 $(".adcil_btns_link option[value="+(data.target||"blank")+"]").prop("selected", true); 309 $("#adcil_link_text").val(data.url) 310 }else if(type==="file"){ 311 var $attach = $("#adcilf_attach") 312 ,$delBtn = $("#adcilfuf_btn") 313 ,$filename = $("#adcilfuf_file") 314 ,$fmode = $filename.attr('data-type'); 315 316 $attach.replaceWith($attach.clone()); 317 318 if(data.url){ 319 // íì¼ìì 320 $filebox.show(); 321 $filename.html(data.url); 322 $delBtn.unbind("click").on("click", function(){ 323 if(confirm("ìë²ìì íì¼ì´ ë°ë¡ ì ê±°ë©ëë¤.\nê·¸ëë ìì íìê² ìµëê¹?")) { 324 var file = data.url 325 ,extension = file.split('.').pop().toLowerCase() 326 ,filename = file.replace('.'+extension,''); 327 328 $.post(SITE_DOMAIN + "/bannerpop/upload_act.php" 329 ,{mode:'dlt', fmode:$fmode, idxno:document.adc_form.idxno.value||"", filename:file} 330 ,function(data,rst){ 331 if(rst==="success"){ 332 if(data.result==="success"){ 333 $filename.empty(); 334 $filebox.hide(); 335 parents.insertData({type:"file", url:"", target:"", json_obj:""}, "no"); 336 //alert(decodeURIComponent(data.msg)); 337 }else alert(decodeURIComponent(data.msg)); 338 }else alert('ìì±í ì ìë í ì íì를 ì´ê³¼íììµëë¤.'); 339 },"json"); 340 } 341 }); 342 } 343 } 344 } 345 } 346 347 // ììí¼ ì´ê¸°í 348 ,releaseForm:function(form) 349 { 350 if(!form) form = document.adc_form; 351 352 // í´ì 353 form.action = this.vars.act; 354 form.target = ""; 355 } 356 357 // ë°ì´í ì»ì´ì¤ê¸° 358 ,getHiddenData:function() 359 { 360 var $id = $("#input_"+this.vars.editId) 361 ,val = $id.val().split(this.vars.separator); 362 363 return {id:$id, val:val}; 364 } 365 366 // input type ì ë£ì 367 ,insertData:function(data, isInit) 368 { 369 if(!data) data={}; 370 if(!this.vars.editId) return false;
371 if(!isInit) isInit = "ok"; 372 373 var $data = this.getHiddenData() 374 ,$id = $data.id 375 ,val = $data.val; 376 377 if(val.length<=0) return false; 378 379 val.splice(4, 4, data.type, data.url, data.target, (data.type == 'file' && data.url) ? data.json_obj : '') 380 var value = val.join(this.vars.separator); 381 382 $id.val(value); 383 384 if(isInit==="ok") this.initInsertForm({type:"link", url:"", target:"self"}); 385 this.vars.editId = null; 386 387 alert('ì ì©ëììµëë¤.'); 388 } 389 390 // ìì í¼ 391 ,modifyForm:function(id) 392 { 393 if(!id) return false; 394 this.vars.editId = id; 395 396 var $data = this.getHiddenData() 397 ,val = $data.val 398 ,type = val[4]||"link" 399 ,url = val[5]||"" 400 ,target = val[6]||"self"; 401 402 //ì´ë¯¸ì§ë§µì íì¼ì¸ì§, ì ì²´ë§í¬ì íì¼ì¸ì§ 구ë¶ì§ê¸° ìí¨ 403 $("#adcilfuf_file").attr('data-type', 'M' + (Number(this.vars.editId.replace(/[^0-9]/g,'')) + 1)); 404 405 this.initInsertForm({type:type, url:url, target:target}); 406 this.mapBlinkArea(); 407 } 408 409 // ì´ë¯¸ì§ ë§µ ì¡ê¸° ìí´ ìì ì ì¥ 410 ,afterUploadTmpFile:function(json) 411 { 412 var form = document.adc_form 413 ,result = json.result||"error" 414 ,data = json.data||"" 415 ,width = json.width||"" 416 ,height = json.height||"" 417 ,mime = json.mime||""; 418 419 // í´ì 420 this.releaseForm(form); 421 422 if(result === "error"){ 423 alert(data); 424 return false; 425 } 426 427 // ëì¤ì í¼ nameì¼ë¡ ë°ê¿ê²!!! 428 //$("#adc_crt_popup_size_width").val(width); 429 //$("#adc_crt_popup_size_height").val(height); 430 if(form.popup_width) form.popup_width.value = width; 431 if(form.popup_height) form.popup_height.value = height; 432 433 // ì°½ ë³´ì´ê³ , ì´ë¯¸ì§ 미리보기 - íìëë ì¬ì´ì¦ ì¬ì¤ê¸° 434 $("#adc_crt_image_preview_box").show(); 435 $("#adc_crt_file_image").attr({"src":"data:"+mime+";base64,"+data, "data-width":width, "data-height":height}); 436 437 // ìë¡ ì¬ë¦°ê²ì´ë, ë¡ë©ëí 모ë ì´ì ì ì ì¥ë ë§µ ì ë³´ ë 림 438 // ì´ì ë°ì´í ìì 439 this.mapDeleteAll(); 440 } 441 442 443 // ë¹ì¨ëë¡ ì¢í ê³ì°í기 444 ,mapCalcPositionRatio:function(val, ratio) 445 { 446 if(ratio === 1) return val; 447 448 return Math.round(val * ratio); 449 } 450 451 // ë¹ì¨ëë¡ ì¢í ê³ì°í기-ì¶ì 452 ,mapScalePositionRatio:function(val, ratio) 453 { 454 if(ratio === 1) return val; 455 456 return Math.round(val / ratio); 457 } 458 459 /** 460 * input type="hidden" ìì± 461 * id : string 462 * pos : object - ì¤ì ìì¹ 463 * kind : string - ë§í¬,íì¼ ë± 464 * url : string - ë§í¬, javascript function 465 * target : string - íì¬ì°½,ìì°½,ë¶ëª¨ì°½ 466 */ 467 ,mapHidden:function($form, id, pos, kind, url, target) 468 { 469 var inputId = "input_"+id 470 ,val = [pos.x1, pos.y1, pos.x2, pos.y2, kind, url, target].join(this.vars.separator) 471 ,input = '<input type="hidden" name="link_url[]" id="'+inputId+'" class="adc_crt_image_map_data" value="'+val+'" />'; 472 473 $form.append(input); 474 } 475 476 // ìì±ë ë§µ ìì 477 ,mapDelete:function(id) 478 { 479 var bId = "btn_"+id 480 ,inputId = "input_"+id; 481 482 $("#"+id+",#"+bId+",#"+inputId).remove(); 483 this.initInsertForm({type:"link", url:"", target:"self"}); 484 alert('ìì ëììµëë¤.'); 485 } 486 487 // ìì±ë ë§´ ì ì²´ ìì 488 ,mapDeleteAll:function() 489 { 490 $(".adc_crt_image_map_data, .ad-map, .ad-map-btns").remove(); 491 } 492 493 // ì ë ¥ë¶ë¶ ê¹ë¹¡ì 494 ,mapBlinkArea:function() 495 { 496 var parents = this; 497 parents.vars.$textBox.addClass("ad-map-bg"); 498 setTimeout(function(){ 499 parents.vars.$textBox.removeClass("ad-map-bg") 500 },500); 501 } 502 503 // ì´ë¯¸ì§ ë§µ ì¡ê¸° 504 ,map:function(target) 505 { 506 var parents = this 507 ,$img = !!target.jquery ? target : $(target) 508 ,width = Number($img.attr("data-width"))||0 // ì¤ì ì¬ì´ì¦ 509 ,height = Number($img.attr("data-height"))||0 510 ,dWidth = Number($img.attr("data-display-width"))||0 // íì ì¬ì´ì¦ 511 ,dHeight = Number($img.attr("data-display-height"))||0 512 ,ratio = width>dWidth ? Number((width/dWidth).toFixed(1)) : 1 // ì¤ì ì¬ì´ì¦ê° íìë ì¬ì´ì¦ë³´ë¤ í´ê²½ì° ë¹ì¨ ë§ì¶ê¸° ìí´ 513 ,box = parents.vars.box 514 ,buttons = parents.vars.buttons 515 ,$imgmapRadio = $("#adc_crt_image_link_part") 516 ,$imgmapBtnRegist = $("#adc_crt_img_link_btn_regist") 517 ,$form = $("#adc_form"); 518 519 520 return { 521 exe:function() 522 { 523 this.canvas().loadData().addEvent(); 524 } 525 526 // ë§ë¶ì´ê¸° 527 ,canvas:function() 528 { 529 $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>'); 530 return this; 531 } 532 533 // ë¡ëë ë§µ ë°ì´íì ë°ë¼ 그리기 534 ,loadData:function() 535 { 536 var _parent = this 537 ,$input = $(".adc_crt_image_map_data") 538 ,$canvas = $("#adc_crt_edit_canvas"); 539 540 // ì ì²´ì íì´ë¼ë©´ 541 if($input.length<=0){ 542 parents.initInsertForm(parents.vars.loadData); 543 return this; 544 } 545 546 // ì´ë¯¸ì§ ë§µ ì¤ì ì¼ë¡ ìì 547 $imgmapRadio.not(":checked").prop("checked", true); 548 $imgmapBtnRegist.show(); 549 550 $.each($input, function(i,ele){ 551 var $ele = $(ele) 552 ,id = ele.id.replace("input_","") 553 ,val = $ele.val().split(parents.vars.separator)||[] 554 ,x1 = val[0]||0 555 ,y1 = val[1]||0 556 ,x2 = val[2]||0 557 ,y2 = val[3]||0 558 ,type = val[4]||"link" 559 ,url = val[5]||"" 560 ,target = val[6]||"self"; 561 562 _parent.display($canvas, id, {x1:x1, y1:y1, x2:x2, y2:y2}); 563 }); 564 565 return this; 566 } 567 568 // ìì 그림
569 ,display:function($canvas, id, data) 570 { 571 if(!data) data={}; 572 573 var $box = $(parents.vars.box) 574 ,$buttons = $(parents.vars.buttons) 575 ,offsetGap = $canvas.position().left||0 // ì ë ì¢íì´ê¸°ì ìºë°ì¤ë³´ë¤ ìì ì´ë¯¸ì§ì¼ê²½ì° gapë§í¼ ëí´ì íìí´ì¤ 576 ,bId = "btn_"+id 577 ,x1 = (Number(parents.mapScalePositionRatio(data.x1, ratio))+offsetGap)||0 578 ,y1 = parents.mapScalePositionRatio(data.y1, ratio)||0 579 ,x2 = (Number(parents.mapScalePositionRatio(data.x2, ratio))+offsetGap)||0 580 ,y2 = parents.mapScalePositionRatio(data.y2, ratio)||0 581 ,width = Math.abs(x1-x2) 582 ,height = Math.abs(y1-y2); 583 584 // ë²í¼ ë§ë¤ê¸° 585 $buttons.css({"top":y1+"px", "left":x2+"px"}).attr({"id":bId}) 586 .find(".adcmb_button").click(function(){ 587 var $this = $(this) 588 ,isModify = $this.is(".adcmb_modify"); 589 590 if(isModify===true){ 591 parents.modifyForm(id); 592 }else{ 593 parents.mapDelete(id); 594 } 595 }); 596 597 // box ë§ë¤ê¸° 598 $box.css({"top":y1+"px", "left":x1+"px", "width":width, "height":height}).attr({"id":id}); 599 600 $canvas.after($box); 601 $box.after($buttons); 602 603 return this; 604 } 605 606 // event 607 ,addEvent:function() 608 { 609 var _this = this 610 ,position = {x:0, y:0} 611 ,$box = null 612 ,start = false;
613 614 $(document.body).off("mousedown mousemove mouseup touchstart touchmove touchend","#adc_crt_edit_canvas") 615 .on({ 616 "mousedown touchstart":function(event) 617 { 618 start = true; 619 620 var $this = $(this) 621 ,evt = parents.getEventObject(window.event || event) 622 ,$evtTarget = $(evt.target||evt.srcElement) 623 ,offsetGap = $evtTarget.position().left // ìëìì¹ê¸° ë문ì ê° left ê°ì ëí´ì¤ì¼ í¨ 624 ,x = Math.round(evt.offsetX||(evt.pageX-$evtTarget.offset().left)) 625 ,y = Math.round(evt.offsetY||(evt.pageY-$evtTarget.offset().top)) 626 ,id = "acem_"+new Date().getTime(); 627 628 position.x = x; 629 position.y = y; 630 631 $box = $(box).css({"top":y, "left":x+offsetGap}).attr({"id":id}) 632 $this.after($box); 633 634 //evt.cancelBubble = true; 635 //evt.stopPropagation(); 636 //evt.preventDefault(); 637 } 638 639 ,"mousemove touchmove":function(event) 640 { 641 if(start === true){ 642 var evt = parents.getEventObject(window.event || event) 643 ,$evtTarget = $(evt.target||evt.srcElement) 644 ,offsetGap = $evtTarget.position().left // ìëìì¹ê¸° ë문ì ê° left ê°ì ëí´ì¤ì¼ í¨ 645 ,x = Math.round(evt.offsetX||(evt.pageX-$evtTarget.offset().left)) 646 ,y = Math.round(evt.offsetY||(evt.pageY-$evtTarget.offset().top)) 647 //,width = Math.abs(x-position.x)-5 648 //,height = Math.abs(y-position.y)-5 649 ,width = Math.abs(x-position.x) 650 ,height = Math.abs(y-position.y) 651 ,css = {}; 652 653 css = {"width":width, "height":height}; 654 655 if(position.x>x && position.y>y){ // ì¢ì 656 css.left = position.x-width+offsetGap; 657 css.top = position.y-height; 658 }else if(position.x>x && position.y<y){ // ì¢í 659 css.left = position.x-width+offsetGap; 660 }else if(position.x<x && position.y>y){ // ì°ì 661 css.top = position.y-height; 662 } 663 664 $box.css(css); 665 } 666 } 667 668 ,"mouseup touchend":function(event) 669 { 670 start = false;
671 672 // $box기ì¤ì¼ë¡ x1,y1,x2,y2 ê°ì ¸ì´ 673 var width = $box.width() 674 ,height = $box.height(); 675 676 if(width<20 && height<20){ 677 $box.remove(); 678 return false; 679 } 680 681 var $buttons = $(buttons) 682 ,evt = parents.getEventObject(window.event || event) 683 ,$evtTarget = $(evt.target||evt.srcElement) 684 ,offsetGap = $evtTarget.position().left // ìëìì¹ê¸° ë문ì ê° left ê°ì ë¹¼ì¤ì¼ì§ ì§ì§ ë§µì´ ë¨ 685 ,pos = $box.css(["top","left"]) 686 ,x1 = parents.castIntFromCss(pos.left) 687 ,y1 = parents.castIntFromCss(pos.top) 688 ,id = $box.attr("id") 689 ,bId = "btn_"+id 690 ,inputId = "input_"+id 691 ,info = { x1 : x1, y1 : y1, x2 : x1 + width, y2 : y1 + height } 692 ,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)}; 693 694 // ìì ìì ì´ë²¤í¸ 695 $buttons.css({"top":info.y1, "left":info.x2}).attr({"id":bId}) 696 .find(".adcmb_button").click(function(){ 697 var $this = $(this) 698 ,isModify = $this.is(".adcmb_modify"); 699 700 if(isModify===true){ 701 parents.modifyForm(id); 702 }else{ 703 parents.mapDelete(id); 704 } 705 }); 706 707 $box.after($buttons); 708 parents.mapHidden($form, id, real, "", "", ""); 709 parents.initInsertForm({type:"link", url:"", target:"self"}); // í¼ ì´ê¸°í 710 parents.vars.editId = id; 711 712 // ì´ë¯¸ì§ë§µì¼ë¡ ì²´í¬ 713 $imgmapRadio.not(":checked").click().prop("checked", true); 714 $imgmapBtnRegist.show(); 715 716 parents.mapBlinkArea(); // ê¸ì°ê¸° í¼ ì´íí¸ 717 718 //util.toast(lang.adcRequireLink); 719 } 720 },"#adc_crt_edit_canvas"); 721 722 return this; 723 } 724 725 }.exe(); 726 } 727 728 // jquery ì´ë²¤í¸ ë±ë¡ ì¬ì©ì, ì´ë²¤í¸ ììë´ê¸° 729 ,getEventObject:function(e) 730 { 731 var evt = window.event||e; 732 evt = evt.targetTouches?evt.targetTouches[0]:evt; // jquery touch event 733 return evt; 734 } 735 736 // css pxì ê±°í ì«ìíì¼ë¡ 737 ,castIntFromCss:function(v) 738 { 739 return Number(v.replace("px","")); 740 } 741 742 // listìì ë²í¼ ì´ë²¤í¸ 743 ,evtClickedButtons:function() 744 { 745 // edit 746 var edit_info = $('#admin-ad-list') 747 ,edit_section = edit_info.attr("data-edit-section") 748 ,edit_area = edit_info.attr("data-edit-area") 749 ,edit_step = edit_info.attr("data-edit-step") 750 ,edit_idxno = edit_info.attr("data-edit-idxno") 751 ,edit_mode = edit_info.attr("data-edit-mode") 752 ,org_banner_kind = edit_info.attr("data-edit-org-banner-kind") 753 ,banner_kind = edit_info.attr("data-edit-banner-kind") 754 ,page = edit_info.attr("data-page") 755 //,tmp_banner_idxno = edit_info.attr("data-edit-tmp-banner-idxno") 756 ,sc_area = edit_info.attr("data-search-scarea") 757 ,sc_word = encodeURIComponent(edit_info.attr("data-search-scword")) 758 759 $(".ad-tile-toolkit, .content-inert").on("click", "button" 760 , function(){ 761 var $this = $(this) 762 ,type = $this.attr("data-btn-type") 763 ,$parent = $this.closest(".adccfg_list_items") 764 ,bannerIdxno = $parent.attr("data-banner-idxno") 765 ,banner_type = $parent.attr("data-banner-type") 766 ,linkInfo = $parent.attr("data-link-info") 767 ,title = $.trim($parent.find(".acli_title").text()) 768 ,state = $.trim($parent.find(".ad-tile-state").text()) 769 ,Imgbp_Tag = $.trim($parent.find(".Imgbp_Tag").html()); 770 771 switch(type){ 772 case "add": 773 if(banner_type == 'popup') { 774 var data = {'mode':edit_mode,'section':edit_section,'popup_title':encodeURIComponent(title),'popup_idxno':bannerIdxno} 775 adWrite.addEditPopupContents(data); 776 }else{ 777 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':'ì íí ë°°ëë¡ êµì²´íìê² ìµëê¹?'}; 778 adWrite.addEditContents(data); 779 } 780 break; 781 case "down": 782 location.href = '/bannerpop/attach_down.php?idxno='+bannerId
782xno+'&mode=O'; 783 break; 784 case "linkInfo": // ì ë¡ëë íì¼ ë§í¬ ë³µì¬ 785 var source = '/bannerpop/uploads/image/'+linkInfo; 786 adWrite.copyExe(source); 787 break; 788 case "sourceCopy": // ìì¤ë³µì¬ 789 /*if(state == '무ì í') { 790 if(!Imgbp_Tag) return false; 791 var _html = '<!--'+title+'-->' 792 + Imgbp_Tag 793 + '<!--//'+title+'-->'; 794 }else{*/ 795 var _time = new Date().getTime() 796 ,_html = '<!--'+title+'-->' 797 + '<script type="text/javascript">var ___BANNER = "ban_'+_time+'";</script>' 798 + '<script type="text/javascript" charset="utf-8" src="/bannerpop/uploads/js/'+bannerIdxno+'.js?'+_time+'" id="ban_'+_time+'"></script>' 799 + '<!--//'+title+'-->'; 800 //} 801 802 adWrite.copyExe(_html); 803 break; 804 case "preview": 805 if(!window.___popup) return false; 806 807 var p = ___popup[bannerIdxno]; 808 809 if(!p) return false; 810 if(!window.___currentTime) window.___currentTime = Math.floor(new Date().getTime()/1000);// ìê°ì´ ì¤ì ëì§ ììë¤ë©´ js ìê°ì¼ë¡ ì¤ì í¨ 811 812 // ê´ë¦¬ìë§... 813 $(".layer_box").remove(); // ë¤ë¥¸ê² ì´ë ¤ìë¤ë©´ ìì 814 bannerpop.vars.popup.view = "manager"; 815 bannerpop.float(p); 816 break; 817 case "mdf": 818 var $ahref = '/bannerpop/'; 819 $ahref += edit_section ? 'edit.html' : 'write.html'; 820 $ahref += '?type='+banner_type+'&mode=modify&idxno='+bannerIdxno+'&page='+page; 821 if(edit_section) $ahref += '&edit_section=' + edit_section; 822 if(edit_area) $ahref += '&edit_area=' + edit_area; 823 if(edit_step) $ahref += '&edit_step=' + edit_step; 824 if(edit_idxno) $ahref += '&edit_idxno=' + edit_idxno; 825 if(edit_mode) $ahref += '&edit_mode=' + edit_mode; 826 //if(tmp_banner_idxno) $ahref += '&tmp_banner_idxno=' + tmp_banner_idxno; 827 if(org_banner_kind) $ahref += '&org_banner_kind=' + org_banner_kind; 828 if(banner_kind) $ahref += '&banner_kind=' + banner_kind; 829 if(sc_area) $ahref += '&sc_area=' + sc_area; 830 if(sc_word) $ahref += '&sc_word=' + sc_word; 831 location.href = $ahref; 832 break; 833 case "del": 834 if(window.confirm('ìì í ê¹ì?')) { 835 var $ahref = '/bannerpop/delete_act.php?type='+banner_type+'&idxno='+bannerIdxno+'&page='+page; 836 if(edit_section) $ahref += '&edit_section=' + edit_section; 837 if(edit_area) $ahref += '&edit_area=' + edit_area; 838 if(edit_step) $ahref += '&edit_step=' + edit_step; 839 if(edit_idxno) $ahref += '&edit_idxno=' + edit_idxno; 840 if(org_banner_kind) $ahref += '&org_banner_kind=' + org_banner_kind; 841 if(banner_kind) $ahref += '&banner_kind=' + banner_kind; 842 if(sc_area) $ahref += '&sc_area=' + sc_area; 843 if(sc_word) $ahref += '&sc_word=' + sc_word; 844 location.href = $ahref; 845 } 846 break; 847 case "mdf_activity": 848 var $ahref = '/bannerpop/'; 849 $ahref += edit_section ? 'edit.html' : 'write_activity.html'; 850 $ahref += '?type='+banner_type+'&mode=modify&activity_idxno='+bannerIdxno+'&page='+page; 851 if(edit_section) $ahref += '&edit_section=' + edit_section; 852 if(edit_area) $ahref += '&edit_area=' + edit_area; 853 if(edit_step) $ahref += '&edit_step=' + edit_step; 854 if(edit_idxno) $ahref += '&edit_idxno=' + edit_idxno; 855 if(edit_mode) $ahref += '&edit_mode=' + edit_mode; 856 if(org_banner_kind) $ahref += '&org_banner_kind=' + org_banner_kind; 857 if(banner_kind) $ahref += '&banner_kind=' + banner_kind; 858 //if(tmp_banner_idxno) $ahref += '&tmp_banner_idxno=' + tmp_banner_idxno; 859 if(sc_area) $ahref += '&sc_area=' + sc_area; 860 if(sc_word) $ahref += '&sc_word=' + sc_word; 861 location.href = $ahref; 862 break; 863 case "del_activity": 864 if(window.confirm('ìì í ê¹ì?')) { 865 var $ahref = '/bannerpop/delete_activity_act.php?type='+banner_type+'&activity_idxno='+bannerIdxno+'&page='+page; 866 if(edit_section) $ahref += '&edit_section=' + edit_section; 867 if(edit_area) $ahref += '&edit_area=' + edit_area; 868 if(edit_step) $ahref += '&edit_step=' + edit_step; 869 if(edit_idxno) $ahref += '&edit_idxno=' + edit_idxno; 870 if(org_banner_kind) $ahref += '&org_banner_kind=' + org_banner_kind; 871 if(banner_kind) $ahref += '&banner_kind=' + banner_kind; 872 if(sc_area) $ahref += '&sc_area=' + sc_area; 873 if(sc_word) $ahref += '&sc_word=' + sc_word; 874 location.href = $ahref; 875 } 876 break; 877 case "sourceCopy_activity": // ìì¤ë³µì¬ 878 var _time = new Date().getTime() 879 ,_html = '<!--'+title+'-->'
880 + '<script type="text/javascript">var ___BANNER = "ban_'+_time+'";</script>' 881 + '<script type="text/javascript" charset="utf-8" src="/bannerpop/uploads/js_activity/'+bannerIdxno+'.js?'+_time+'" id="ban_'+_time+'"></script>' 882 + '<!--//'+title+'-->'; 883 884 adWrite.copyExe(_html); 885 break; 886 } 887 888 return false; 889 }); 890 } 891 892 //ìì ì ì¹ì í 컨í ì¸ ì½ì 893 ,addEditContents:function(data) 894 { 895 //var flag = false; 896 var flag = true; 897 898 /*if(data.mode == 'modify') { 899 if(data.tmp_banner_idxno != data.banner_idxno) { 900 if(confirm(data.edit_msg)) flag = true; 901 else flag = false; 902 }else flag = true; 903 }else flag = true;*/ 904 905 if(flag) { 906 data = JSON.stringify(data); 907 $.ajax({ 908 url:"/edit/adminReservationBannerWrite.php" 909 ,type:'post' 910 ,dataType:'json' 911 ,contentType:'application/x-www-form-urlencoded; charset=utf-8' 912 ,data:{post_data:data} 913 ,success:function(json, result) { 914 if(result == 'success') { 915 if(json.response == 'ok') { 916 window.parent.location.reload(); 917 }else{ 918 alert(json.msg); 919 return false; 920 } 921 }else return false; 922 } 923 }); 924 }else{ 925 return false; 926 } 927 } 928 929 //ìì ì ì¹ì í 컨í ì¸ ì½ì 930 ,addEditPopupContents:function(data) 931 { 932 data = JSON.stringify(data); 933 $.ajax({ 934 url:"/edit/adminReservationPopupWrite.php" 935 ,type:'post' 936 ,dataType:'json' 937 ,contentType:'application/x-www-form-urlencoded; charset=utf-8' 938 ,data:{post_data:data} 939 ,success:function(json, result) { 940 if(result == 'success') { 941 if(json.response == 'ok') { 942 //window.parent.location.reload(); 943 parent.$('#edit-modal').find('.close-buttons').trigger('click'); 944 adWrite.addPopupContentsList(json); 945 }else{ 946 alert(json.msg); 947 return false; 948 } 949 }else return false; 950 } 951 }); 952 } 953 954 ,addPopupContentsList:function(json) { 955 var html = ''; 956 957 console.log(json); 958 959 if(json.rows.length>0) { 960 for(var i = 0; i < json.rows.length; i++) { 961 var index = i+1; 962 html += '<!-- íì //-->'; 963 html += '<div class="option-popup-item">'; 964 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 + '" />'; 965 html += ' <label for="editPopup' + index + '">'; 966 if(json.rows[i].popup_image && json.rows[i].extension != 'swf') { 967 html += '<img src="/bannerpop/uploads/image/' + json.rows[i].popup_image + '" alt="' + adWrite.rawurldecode(json.rows[i].popup_title) + '" />'; 968 }else{ 969 if(json.rows[i].extension == 'swf') html += 'SWF'; 970 else html += 'HTML'; 971 } 972 html += ' <div class="option-popup-item-title">' + adWrite.rawurldecode(json.rows[i].popup_title) + '</div>'; 973 html += ' </label>'; 974 html += '</div>'; 975 html += '<!--// íì -->'; 976 } 977 } 978 979 parent.$('.option-popup-group').html(html); 980 } 981 982 //ì ì²´ì íãí´ì 983 ,allChk:function() 984 { 985 var $allChk = $('#allCheck'); 986 $allChk.click(function(){ 987 if($(this).is(':checked') == true) { 988 $('.elembox').prop('checked',true); 989 }else{ 990 $('.elembox').prop('checked',false); 991 } 992 }); 993 } 994 995 /** 996 * í´ë¦½ë³´ë ë³µì¬ 997 * source : ë³µì¬í ì ë³´ 998 */ 999 ,copyExe:function(source) 1000 { 1001 if(window.clipboardData){ // ie 1002 window.clipboardData.setData('Text',source); 1003 alert("ë³µì¬ëììµëë¤. ìíë ê³³ì ë¶ì¬ë£ê¸°íì¬ ì£¼ì¸ì."); 1004 }else{ // etc 1005 1006 var $tmpDiv=$('<div class="blind">'+source.replace(/</g,"<").replace(/>/g,">")+'</div>').appendTo("body") 1007 ,range=document.createRange() 1008 ,selection=null; 1009 1010 range.selectNodeContents($tmpDiv.get(0)); 1011 selection=window.getSelection(); 1012 selection.removeAllRanges(); 1013 selection.addRange(range); 1014 1015 if(document.execCommand("copy", false, null)) alert("ë³µì¬ëììµëë¤. ìíë ê³³ì ë¶ì¬ë£ê¸°íì¬ ì£¼ì¸ì."); 1016 else window.prompt('í¤ë³´ëì ctrl+C ëë ë§ì°ì¤ ì¤ë¥¸ìª½ì ë³µì¬í기를 ì´ì©í´ì£¼ì¸ì.', source); 1017 1018 $tmpDiv.remove(); 1019 } 1020 } 1021
1022 /** 1023 * 기ë¥ì± ë°°ë ì¶ê°/ììë³ê²½/ìì / 1024 */ 1025 ,evtClickActivityAdd:function() { 1026 //sessionStorage.removeItem("last_idx"); 1027 var activity_idxno=window.parent.$('#all-banner-list').closest('div').attr('data-activity-idxno')||''; 1028 $('#activity-add-btn').click(function() { 1029 var $this=$(this); 1030 //,$viewHref=$('#activity-view-btn').attr('href') 1031 //,$last_idx=(activity_idxno)?activity_idxno:sessionStorage.getItem('last_idx'); 1032 1033 if($('.banner_element_ckecked').is(':checked') == false) { 1034 alert('ë°°ë를 ì íí´ì£¼ì¸ì.'); 1035 //if(!$last_idx) $('#activity-view-btn').addClass('is-hidden'); 1036 return false; 1037 }else{ 1038 var $checked=$(".banner_element_ckecked:checked") 1039 ,arr = new Array(); 1040 if($checked.length>0) { 1041 $.each($checked, function(idx, v) { 1042 arr.push(v.value); 1043 }); 1044 1045 var data = {mode:activity_idxno?'modify':'input', activity_idxno:activity_idxno, banner_idxno:arr}; 1046 data = JSON.stringify(data); 1047 console.log(data); 1048 $.ajax({ 1049 url:"/bannerpop/activity_act.php" 1050 ,type:'post' 1051 ,dataType:'json' 1052 ,contentType:'application/x-www-form-urlencoded; charset=utf-8' 1053 ,data:{post_data:data} 1054 ,success:function(json, result) { 1055 if(result == 'success') { 1056 if(json.response == 'ok') { 1057 //alert('ì¶ê°ëììµëë¤.\nì°ì¸¡ì ë²í¼ì í´ë¦íìë©´ ìì¸ íë©´ì¼ë¡ ì´ëí©ëë¤.'); 1058 /*if(!activity_idxno) { 1059 sessionStorage.setItem('last_idx', json.last_insert_id); 1060 $('#activity-view-btn').attr('href', $viewHref + '&activity_idxno='+json.last_insert_id); 1061 } 1062 $('#activity-view-btn').removeClass('is-hidden');*/ 1063 window.parent.location.reload(); 1064 }else{ 1065 //alert(json.msg); 1066 return false; 1067 } 1068 }else return false; 1069 }, 1070 error:function(request,status,error){ 1071 alert("code:"+request.status+"\n"+"message:"+request.responseText+"\n"+"error:"+error); 1072 } 1073 }); 1074 } 1075 } 1076 }); 1077 1078 $('#banner-activity-box').sortable({ 1079 axis: '', 1080 update: function() { 1081 //console.log($(this)); 1082 } 1083 }); 1084 1085 $('.trash').click(function() { 1086 if($('.banner-activity-list').length <= 1) { 1087 alert('ë§ì§ë§ ë°°ëë ìì í ì ììµëë¤.'); 1088 return false; 1089 } 1090 1091 var $this=$(this) 1092 ,$parent = $this.closest('.banner-activity-list'); 1093 1094 $parent.fadeOut('fast', function(){ 1095 $parent.remove(); 1096 }); 1097 }); 1098 1099 $('#all-banner-list').on('click', function(e) { 1100 1101 $this = $(this); 1102 href = $this.attr('href'); 1103 1104 $("#edit-modal-iframe").attr("src", href); 1105 $('#edit-modal').foundation('open'); 1106 1107 return false; 1108 }); 1109 1110 $('#edit-modal').on('open.zf.reveal', function(e){ 1111 $('#for-loading').show(); 1112 }); 1113 1114 $('#edit-modal').on('closed.zf.reveal', function(e){ 1115 $("#edit-modal-iframe").attr("src", "about:blank").height('0px').closest('#activity-modal').css('height', '0px'); 1116 }); 1117 } 1118 1119 ,valid_activity:function() { 1120 if($('#activity_title').val() == '') { 1121 alert('ì 목ì ì ë ¥íì¸ì.'); 1122 $('#activity_title').focus(); 1123 return false; 1124 } 1125 1126 if($('.banner-activity-list').length<=0) { 1127 alert('ë°°ë를 íë ì´ì ì¶ê°íì ì¼ í©ëë¤.'); 1128 return false; 1129 } 1130 1131 return true; 1132 } 1133 1134}; // end adWrite 1135 1136var bannerpop={ 1137 vars:{ 1138 popup:{ 1139 bodyWidth:0 1140 ,bodyLeft:0 1141 ,screenWidth:0 1142 ,popname:"popup_" 1143 ,width:{ window:[],layer:[] } 1144 ,height:{ window:[],layer:[] } 1145 ,top:{ window:[],layer:[] } 1146 ,left:{ window:[],layer:[] } 1147 ,order:0 // z-indexì© ìì°¨ì 1148 ,view:"normal" // ì¼ë° : normal or ê´ë¦¬ì : manager 1149 } 1150 } 1151 1152 /** 1153 * ë°°ë í¨ê³¼ 1154 * íê·¸ ìì± ì::: bannerpop.banner(".banner_event_box"); 1155 <div class="boder_box banner_event_box" data-type="slide" data-idxno="3" data-speed="0.3"> 1156 <div class="boder_box beb_box"> 1157 <ul class="no_type beb_ul"> 1158 <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> 1159 <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> 1160 <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> 1161 <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> 1162 <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> 1163 </ul> 1164 </div> 1165 <div class="beb_buttons"> 1166 <button type="button" class="beb_btns beb_btn_prev">ë¤ë¡</button> 1167 <button type="button" class="beb_btns beb_btn_stop">ë©ì¶¤</button> 1168 <button type="button" class="beb_btns beb_btn_next">ìì¼ë¡</button> 1169 </div> 1170 </div> 1171 */ 1172 ,effect:function() 1173 { 1174 var savePrefix = "banner_order_"; 1175 1176 // ë°°ë ëì´ 1177 function setSizeInfo($this){ 1178 var idxno = $this.attr("data-idxno") 1179 ,$ul = $this.find(".beb_ul") 1180 ,$li = $ul.find(".beb_li") 1181 ,boxWidth = $this.innerWidth()||$this.closest("#float_side_box").width() // ì ì¬ì´ëì ë°°ëì¼ê²½ì° ì¬ì¸¡ì 1182 ,liCount = $li.length||0; 1183 1184 // ê´ë¦¬ì íì´ì§ê° ìëë ì¤ì ë ¸ì¶ì¤ì¸ ê²ë§ ì°¾ì 1185 //if(ADM_DOMAIN.indexOf(location.host)<0){ 1186 $.each($li,function(){ 1187 var $this=$(this), len=$this.find(".banner_box").length; 1188 if(!len) $this.remove(); 1189 }); 1190 $li = $ul.find(".beb_li"); 1191 liCount = $li.length||0; 1192 //} 1193 1194 // ë¶ëª¨ë°ì¤ 기ì¤ì¼ë¡ ul ìµë ëì´ ì§ì 1195 $ul.width(boxWidth*liCount); 1196 1197 // ë°°ëë§ë¤ ëì´ê° ë¤ë¥¼ì ìì¼ë ë¶ëª¨ë°ì¤ ëì´ê¸°ì¤ì¼ë¡í¨ 1198 $li.width(boxWidth); 1199 1200 return { 1201 idxno : idxno 1202 ,$ul : $ul 1203 ,$li : $li 1204 ,boxWidth : boxWidth 1205 ,liCount : liCount 1206 }; 1207 } 1208 1209 return { 1210 // ììëë¡ íëì ë°°ëë§ ë³´ì 1211 order:function(){ 1212 var _this = this 1213 ,$this = $(_this) 1214 ,$info = setSizeInfo($this) 1215 ,idxno = $info.idxno 1216 ,$li =$info.$li 1217 ,liCount = $info.liCount-1 1218 ,saveKey = savePrefix+idxno 1219 ,order = Number(localStorage.getItem(saveKey))||0; 1220 1221 // ëë¤ ì íëê²ë§ ë³´ì, ë²í¼ ìì° 1222 $li.css("display","list-item").not(":eq("+order+")").css("display","none"); 1223 1224 localStorage.setItem(saveKey, (order>=liCount ? 0 : order+1)); 1225 } 1226 1227 // random banner 1228 ,random:function(){ 1229 var _this = this 1230 ,$this = $(_this) 1231 ,$info = setSizeInfo($this) 1232 ,$li =$info.$li 1233 ,liCount = $info.liCount 1234 ,random = Math.floor(Math.random()*liCount); 1235 1236 // ëë¤ ì íëê²ë§ ë³´ì, ë²í¼ ìì° 1237 $li.css("display","list-item").not(":eq("+random+")").css("display","none"); 1238 } 1239 1240 // random ë°°ë ì íí ì¬ë¼ì´ë 1241 ,randomSlide:function(){ 1242 bannerpop.effect()['slide'].call(this, true); 1243 } 1244 1245 // slide banner 1246 // rand true or false 1247 ,slide:function(rand){ 1248 var _this = this 1249 ,$this = $(_this) 1250 ,$info = setSizeInfo($this) 1251 ,$ul = $info.$ul 1252 ,$li =$info.$li.css("display","list-item") 1253 ,$btnBox = $this.find(".beb_buttons") 1254 ,$btnStop = $btnBox.find(".beb_btn_stop") 1255 ,$btnCurrent = null // íì¬ ì íë ë²í¼ prev,next,play,stop of buttons 1256 ,speed = Number(_this.getAttribute("data-speed"))||.3 1257 ,delayInfo = $li.map(function(){ return Number(this.getAttribute("data-delay"))||5; }).get() 1258 ,boxWidth =$info.boxWidth 1259 ,liCount = $info.liCount 1260 ,count = (rand===true?Math.floor(Math.random()*(liCount)):-1) // ì²ìë¶í° +1 íê³ ììí기ì -1ì´ê¸°ê°-randomì¼ëë ë°°ëìì¤ 1ê° 1261 ,delay = null // ë©ì¶°ìë ìê°(ì´) 1262 ,left = boxWidth // ìì§ì´ë ê°ê²© 1263 ,si = null // setInterval ë³ì : animate completeìì delayë¡ í´ê²°íë ¤ íëë° ëê° ì ìí림 1264 ,tmpDelay = null // next, prev ì delay ìì´ ëê¹ 1265 ,firstBtnClicked = 0; // prev,nextë¡ ì´ëíëê° - rotateìì ëíë² +,- í기ì ì²ìë§ ì¤íëì´ì¼ í¨ 1266 1267 /**** function //s ****/ 1268 /* 1269 ë¤ì ë°°ë 1270 @params 1271 loop : ë°ë³µë ê²ì¸ê° 1272 mode : + or - 1273 */ 1274 function rotate(loop, mode){ 1275 if(!mode) mode="+"; 1276 if(mode==="+") count++; 1277 else count--; 1278 1279 if(count>=liCount || count<=0) count = 0; // ì§ì°ìê° ë´ì ë°°ì´ì°¾ê¸° key 1280 var front = count+1; // ì§ì°í ìì§ì¬ì¼ íë 거리 미리 ë´ìë 1281 if(count>=(liCount-1)) front = 0; 1282 left = boxWidth*front*-1;
1283 delay = tmpDelay===null?delayInfo[count]:tmpDelay; 1284 1285 si = setTimeout(function(){ 1286 $ul.animate({ marginLeft:left } 1287 ,speed*1000, 1288 function(){ 1289 if(loop===false) $btnCurrent.prop("disabled", false); 1290 tmpDelay = null; 1291 });//.delay(delay*1000); 1292 if(loop!==false) rotate(); 1293 },delay*1000); 1294 } 1295 1296 // stop 1297 function stop(){ 1298 firstBtnClicked++; 1299 1300 //$ul.stop(true, false); 1301 clearTimeout(si); 1302 tmpDelay=null; 1303 $btnStop.addClass("beb_btn_start").text("play"); 1304 } 1305 1306 // restart 1307 function start(){ 1308 firstBtnClicked = 0; 1309 1310 count--; 1311 if(count<=0) count=0; 1312 1313 tmpDelay=null; 1314 rotate(); 1315 1316 $btnStop.removeClass("beb_btn_start").text("ë©ì¶¤"); 1317 } 1318 1319 // ì´ì 1320 function prev(){ 1321 stop(); 1322 1323 if(firstBtnClicked===1) count--; // ì²ìë§ ì´ë¯¸ ì¦ê°ëê°ì ê°ììí´ 1324 if(count<=0) count=liCount; 1325 1326 tmpDelay=0; 1327 rotate(false,"-"); 1328 1329 $btnCurrent.prop("disabled", true); 1330 } 1331 1332 // ì´í 1333 function next(){ 1334 stop(); 1335 1336 if(firstBtnClicked===1) count--; 1337 if(count>=liCount) count=0; 1338 1339 tmpDelay=0; 1340 rotate(false); 1341 1342 $btnCurrent.prop("disabled", true); 1343 } 1344 /**** function //e ****/ 1345 1346 // ì²ì ë°°ë를 ë³´ì´ì§ ìëë¤ë ê²ì ëë¤ ë°°ëì ì¬ë¼ì´ëë¼ë ê²-ì²ìë³´ì¼ë°°ë ì¤ì 1347 if(count>=0 && rand===true){ 1348 var _boxWidth = boxWidth*(count>=liCount?liCount-1:count)*-1; 1349 count--; 1350 $ul.css("margin-left",_boxWidth+"px"); 1351 } 1352 1353 // ì¤í 1354 rotate(); 1355 1356 // ë²í¼ë³´ì 1357 $btnBox/*.css("display","block")*/.find(".beb_btns").unbind("click") 1358 .click(function(){ 1359 var $this = $(this); 1360 1361 $btnCurrent = $this; 1362 if($this.is(".beb_btn_prev")) prev(); 1363 else if($this.is(".beb_btn_next")) next(); 1364 else if($this.is(".beb_btn_stop")){ 1365 if($this.is(".beb_btn_start")) start(); 1366 else stop(); 1367 } 1368 }); 1369 1370 // mouseover event 1371 $ul.on({ 1372 mouseenter:stop 1373 ,mouseleave:start 1374 }); 1375 } 1376 }; 1377 } 1378 1379 // ë°°ëí¸ì¶ 1380 ,banner:function(target) 1381 { 1382 var parents = this 1383 ,$target = !!target.jquery?target:$(target); 1384 1385 //console.log($target); 1386 $.each($target, function(i, ele){ 1387 var type = ele.getAttribute("data-type")||"random"; 1388 parents.effect()[type].call(this); 1389 }); 1390 } 1391 1392 ,getCookie:function(name) 1393 { /* 1394 var cookie = document.cookie; 1395 if(cookie.indexOf(name)<0) return ""; 1396 1397 var regexp = new RegExp("^(.*)"+name+"=(.*?);(.*)$","g"); 1398 return cookie.replace(regexp,"$2").replace(/^\s+|\s+$/g,""); 1399 */ 1400 name+="="; 1401 var ca = document.cookie.split(';'); 1402 for(var i=0; i<ca.length; i++) { 1403 var c = ca[i]; 1404 while (c.charAt(0)==' ') c = c.substring(1); 1405 if (c.indexOf(name) == 0) return c.substring(name.length,c.length); 1406 } 1407 return ""; 1408 } 1409 1410 ,setCookie:function(name, value, days, domain) 1411 { 1412 var expires = ""; 1413 if(days){ 1414 var date = new Date(); 1415 date.setTime(date.getTime()+(days*24*60*60*1000)); 1416 expires = "; expires="+date.toGMTString(); 1417 } 1418 1419 var dm=SITE_DOMAIN.replace('http://',''); 1420 if(!domain) domain="." + dm; 1421 1422 document.cookie = name+"="+value+expires+"; path=/; " + (domain?"domain="+domain+";":""); 1423 } 1424 1425 // urlì arrayë¡ 1426 ,linkToJson:function(link) 1427 { 1428 if(!link) return false; 1429 1430 var json = {} 1431 ,tmp = link.replace(/^\/\?/,"").split("&"); 1432 1433 if(tmp.length<=0 || !tmp) return false; 1434 for(var i in tmp){ 1435 var param = tmp[i].split("=") 1436 ,key = param[0] 1437 ,value = param[1]; 1438 1439 json[key] = value; 1440 } 1441 return json; 1442 } 1443 1444 // ë°°ë append 1445 ,append:function() 1446 { 1447 var id = ___BANNER 1448 ,status = bannerStatus 1449 ,time = ___currentTime 1450 ,sTime = startTime 1451 ,eTime = endTime 1452 ,content = decodeURIComponent(bannerContent) 1453 ,title = typeof bannerTitle == "undefined" ? "":decodeURIComponent(bannerTitle) 1454 ,$target = $("#"+id) 1455 ,explain = ''; 1456 //,explain = "\n<br />"+util.timestampToDatetime(sTime).strDateTime.substring(0,16)+"~"+util.timestampToDatetime(eTime).strDateTime.substring(0,16); 1457 1458 1459 if(!id || $target.length<=0 || $target.attr("data-append")=="true") return false; // ê°ì²´ê° ìê±°ë ììì ,ì´ë¯¸ ì¶ê°ëìë¤ë©´ ì¤ë¨ 1460 1461 // ìì ,ì¢ ë£ ë°°ë 1462 else if(sTime > time || time > eTime || status=="0"){ 1463 if(location.href.indexOf('/edit/adminSection.html')<0) return false; // ê´ë¦¬ìê° ìëë¼ë©´ ì¢ ë£ ë©ìì§ ìëì°ê¸° 1464 var adcMsg="" 1465 ,adcClass=""; 1466 if(sTime > time && status!="0"){ 1467 adcMsg = 'ë ¸ì¶ìì ë°°ë'; 1468 adcClass = "banner-later"; 1469 }else if(time > eTime || status=="0"){ 1470 adcMsg = 'ì¢ ë£ë ë°°ë'; 1471 adcClass = "banner-finish"; 1472 } 1473 1474 $target.attr("data-append","true").after('<div class="ad-finished"><span class="'+adcClass+'"><i class="fa fa-clock-o"></i> '+adcMsg+' "'+title+'"</span>'+explain+'</div>');
1474 // ì¢ ë£ ë©ìì§ ëì°ê³ ì¢ ë£ 1475 bannerTitle="";//ì´ê¸°í 1476 1477 return false; 1478 } 1479 1480 $target.attr("data-append","true").after(content); // ì¶ê° ëìì¼ë©´ data-append íê·¸ ëê¹ 1481 } 1482 1483 /****** íì ëì°ê¸° 1484 var ___popup = [{},...]; 1485 1486 * json ë´ì© * 1487 idxno - íì idxno ê³ ì ë²í¸ 1488 title - íì ì ì 목 1489 start - íì ììì¼ì 1490 end - íì ì¢ ë£ì¼ì 1491 status - ì§íìí (1=ì§í, 0=ì¢ ë£) 1492 popup_type - íì íí (layer=ë ì´ì´, window=ìëì°) 1493 popup_size - auto (ì¬ì©ìí¨) 1494 popup_width - íì ì°½í¬ê¸°(ê°ë¡) 1495 popup_height - íì ì°½í¬ê¸°(ì¸ë¡) 1496 position - auto (ì¬ì©ìí¨) 1497 x_position - ì°½ì x ìì¹ 1498 y_position - ì°½ì y ìì¹ 1499 apply_page - ì ì©íì´ì§ (main, section, list, view ê°ì´ ì ë ¥ ëì´ìì , phpìì íì´ì§ 구ë¶í´ì jsonì¼ë¡ ë§ë¤ì´ ì¤ëë¤.) 1500 bottom_close - íë¨íì ì°½ë«ê¸° ì¶ë ¥ì¬ë¶ (Y=ì¶ë ¥, N=ì¶ë ¥ìí¨) 1501 bottom_close_expire_ck - **ëì ì´ì§ì기 (none=ì¬ì©ìí¨, day=í루ëì ì´ì§ì기, days=ëªì¼ëì ì´ì§ì기) 1502 bottom_close_expire - ëªì¼ì¸ì§ 1503 layer_border - ë ì´ì´ íì ì¸ ê²½ì° ì¸ê³½ì (Y=ì¬ì©í¨, N=ì¬ì©ìí¨) 1504 layer_move - ë ì´ì´ íì ì¸ ê²½ì° ëëê·¸ ê°ë¥ (Y=ì¬ì©í¨, N=ì¬ì©ìí¨) 1505 layer_scroll - ë ì´ì´ íì ì¸ ê²½ì° ì¤í¬ë¡¤ ë°ë¼ë¤ë기 (Y=ì¬ì©í¨, N=ì¬ì©ìí¨) 1506 layer_close - ë ì´ì´ íì ì¸ ê²½ì° ë«ê¸° ìì´ì½ (Y=ì¬ì©í¨, N=ì¬ì©ìí¨) 1507 layer_close_icon - ë ì´ì´ íì ì¸ ê²½ì° ë«ê¸° ìì´ì½ ì í 1508 layer_close_position - ë ì´ì´ íì ì¸ ê²½ì° ë«ê¸° ìì´ì½ ì¶ë ¥ ìì¹ (TL-ì/ì¢, TR-ì/ì°, BL-í/ì¢, BR-í/ì°) 1509 window_scroll - ìëì° íì ì¸ ê²½ì° ì¤í¬ë¡¤ íì±í (Y=ì¬ì©í¨, N=ì¬ì©ìí¨) 1510 content - ì¶ë ¥ HTML ë´ì© 1511 *****/ 1512 ,float:function(j) 1513 { 1514 // json ê° 1515 var current = ___currentTime 1516 ,start = Number(j.start)||0 1517 ,end = Number(j.end)||(new Date().getTime()+100) // ì¢ ë£ì¼ì´ 기ì ëì§ ììë¤ë©´, íì¬ë³´ë¤ 100ì©ëí´ì ê³ì ë림 1518 ,status = j.status||"0"; 1519 1520 if(this.vars.popup.view!="manager" && (status=="0" || current < start || (current > end && end!==0))) return false; // ì¢ ë£ or 기ê°ì´ ìëë¼ë©´ íµê³¼ 1521 1522 var parents = this 1523 ,idxno = j.idxno||"0" 1524 ,oriTitle = j.title||"" 1525 ,title = decodeURIComponent(j.title)||"" 1526 ,popupType = j.popup_type||"window" 1527 ,popupSize = j.popup_size||"auto" 1528 ,popupWidth = Number(j.popup_width)||0 1529 ,popupHeight = (Number(j.popup_height)||0) + 32 1530 ,position = j.position||"auto" 1531 ,xPosition = Number(j.x_position)||0 1532 ,yPosition = Number(j.y_position)||0 1533 ,applyPage = j.apply_page||"main" 1534 ,bottomClose = j.bottom_close||"N" 1535 ,bottomCloseExpireCk = j.bottom_close_expire_ck||"none" 1536 ,bottomCloseExpire = j.bottom_close_expire||1 1537 ,layerBorder = j.layer_border||"N" 1538 ,layerMove = j.layer_move||"N" 1539 ,layerScroll = j.layer_scroll||"N" 1540 ,layerClose = j.layer_close||"N" 1541 ,layerCloseIcon = j.layer_close_icon||"" 1542 ,layerClosePosition = j.layer_close_position||"BR" 1543 ,windowScroll = j.window_scroll||"Y" 1544 ,content = decodeURIComponent(j.content)||"" 1545 ,popupUrl = j.popup_url||""// + (parents.vars.popup.view=="manager"?"?edit_mode=preview":"")||"" 1546 ,top = 0 1547 ,left = 0 1548 ,popname = parents.vars.popup.popname+idxno 1549 ,_type = popupType; // default: ê°ìëì - íì ê³¼ ë ì´ì´ê° ìì¹ê°ì ê³µì íì¬ ì°¨ë¡ë¡ ëì¸ë ¤ë©´ "window" or ê³µì íì§ ìê³ ê°ì ëì¸ë ¤ë©´ popupType; 1550 1551 var type = { 1552 calcPosition:function(){ 1553 // x,y ê° 0ì¼ëë autoë¡ ê°ì£¼ 1554 if((xPosition===0 && yPosition===0)/* || position=="auto"*/){ 1555 var maxHeight = parents.arrayMaxMin(parents.vars.popup.height[_type],"max") 1556 ,maxTop = parents.arrayMaxMin(parents.vars.popup.top[_type],"max") 1557 ,initLeft = popupType=="window"?0:parents.vars.popup.bodyLeft 1558 ,prevWidth = parents.vars.popup.width[_type][parents.vars.popup.width[_type].length-1]||0 1559 ,prevLeft = parents.vars.popup.left[_type][parents.vars.popup.left[_type].length-1]||initLeft; // ë°ë¡ ì´ì íì ëì´ë¥¼ leftê°ì¼ë¡ ì í¨-window:0, layer:contentì left 1560 1561 //console.log(popupWidth); 1562 left = prevLeft+prevWidth; 1563 1564 // íì´ì§ ëì´ë³´ë¤ ì리ì¡ì leftê°ì´ í¬ë¤ë©´ íë©´ì íë¨ê³ ë´ë¦¼ 1565 if(left>parents.vars.popup[popupType=="window"?"screenWidth":"bodyWidth"]){ 1566 top += maxHeight; 1567 left = initLeft; 1568 1569 // ë¤ì ë¨ê³ì´ëê¹ ì´ê¸°í í¨ 1570 parents.vars.popup.width[_type] = []; 1571 parents.vars.popup.height[_type] = []; 1572 parents.vars.popup.top[_type] = []; 1573 parents.vars.popup.left[_type] = []; 1574 }else{ 1575 top = (maxTop||0); 1576 } 1577 1578 // ë³íëê° ë°°ì´ì ë£ê¸° ìí´ ì¡°ì 1579 xPosition = left; 1580 yPosition = top; 1581 1582 // ë³ìì ë´ì 1583 parents.vars.popup.width[_type].push(popupWidth||0); 1584 parents.vars.popup.height[_type].push(popupHeight||0); 1585 parents.vars.popup.top[_type].push(yPosition||0); 1586 parents.vars.popup.left[_type].push(xPosition||0); 1587 1588 }else{ 1589 top = yPosition; 1590 left = xPosition; 1591 } 1592 } 1593 1594 // ê´ë¦¬ì 미리보기ì ì¤ìì 1595 ,setPositionCenter:function(){ 1596 var _width = (document.body.clientWidth/2)-(popupWidth/2) 1597 ,_scrollTop = document.body.scrollTop; 1598 1599 top = _scrollTop + 50; 1600 left = _width; 1601 } 1602 1603 // ëì¸ íì´ì§ applyPage 1604 ,isApplyPage:function() 1605 { 1606 // ê´ë¦¬ì íµê³¼ 1607 if(parents.vars.popup.view=="manager") return true; 1608 /* 1609 var params = bannerpop.linkToJson(location.search.replace("?","")) 1610 ,mod = params.mod||"" 1611 ,act = params.act||"" 1612 ,section = params.section||""; 1613 1614 // ë©ì¸ 1615 if(((mod=="main" && act=="index" && !section) || (!mod && !act && !section)) && applyPage.indexOf("main")>=0) return true; 1616 // ì¹ì 1617 else if(mod=="main" && act=="index" && section && applyPage.indexOf("section")>=0) return true; 1618 // ê¸°ì¬ ë¦¬ì¤í¸ 1619 else if(mod=="news" && act=="articleList" && applyPage.indexOf("list")>=0) return true; 1620 // 기ì¬ë·° 1621 else if(mod=="news" && act=="articleView" && applyPage.indexOf("view")>=0) return true; 1622 */ 1623 } 1624 1625 ,window:function(){ 1626 //if(this.isApplyPage()!==true) return false;
1627 1628 this.calcPosition(); // ìì¹ ê³ì° 1629 var winpopupUrl = '/bannerpop/popup.html?win_popup_idxno=' + idxno; 1630 window.open(winpopupUrl, popname, "width="+popupWidth+",height="+popupHeight+",scrollbars="+(windowScroll=="Y"?"yes":"no")+",resizable=yes,top="+top+",left="+left); 1631 } 1632 1633 ,layer:function(){ 1634 //if(this.isApplyPage()!==true) return false; 1635 1636 this.calcPosition(); // ìì¹ ê³ì° 1637 1638 var $content = $(content); 1639 1640 $content.attr({"id":popname}) 1641 .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":"")) 1642 .find(".popup_close_box").addClass("layer_close_box"); 1643 1644 // ëëê·¸ ê°ë¥ 1645 if(layerMove=="Y") $content.addClass("layer_box_cursor_move").draggable(); 1646 1647 // ì°½ë«ê¸°-icon ë«ê¸° ë²í¼ì ë³ê°ë¤ 1648 //if(bottomClose=="Y"){ 1649 var $btnClose = $content.find(".popup_close, .popup_close_map, .popup_icon_close"); 1650 $btnClose.each(function(){ 1651 var _$this = $(this); 1652 //if(_$this.is(".popup_close") && bottomClose=="Y") _$this.text('ì°½ë«ê¸°'); 1653 1654 if(_$this.is(".popup_icon_close")) { 1655 if(layerClosePosition == 'BL' || layerClosePosition == 'BR') { 1656 1657 if($content.find(".popup_close, .popup_close_map").length>0) { 1658 _$this.css('top',Number(j.popup_height)-40+'px'); 1659 } 1660 } 1661 1662 _$this.addClass("layer_position_"+layerClosePosition); 1663 } 1664 }); 1665 1666 $btnClose.click(function(){ 1667 parents.evtClose(popupType, idxno); 1668 return false; 1669 }); 1670 //} 1671 1672 // ì´ë¯¸ì§ë´ ë§í¬ê° ì°½ë«ê¸° ë¼ë©´ 1673 //$content.find("a[href*='javascript:window.close()']").click(function(){ 1674 $content.find("[href*='javascript:window.close()']").click(function(){ 1675 parents.evtClose(popupType, idxno); 1676 return false; 1677 }); 1678 1679 // í루, ëªì¼ëì ì´ì§ ì기 1680 parents.daysNotOpen(bottomCloseExpireCk, bottomCloseExpire, $content.find(".popup-days, .popup_day_close_map"), j); 1681 1682 // ê´ë¦¬ì 미리보기ì ì¤ìì 1683 if(parents.vars.popup.view=="manager"){ 1684 $content.appendTo(document.body); 1685 this.setPositionCenter(); 1686 $content.removeClass("layer_box_fixed").css({"top":top+"px", "left":left+"px"}); 1687 }else{ 1688 $content.appendTo($("#layer-popups")); 1689 } 1690 } 1691 }; 1692 1693 type[popupType](); 1694 } 1695 1696 // íì ëì°ê¸° 1697 ,popup:function() 1698 { 1699 //try{ 1700 var parents = this; 1701 $(window).on("load", function(){ 1702 if(!window.___popup) return ; 1703 if($.isArray(___popup)===false && ___popup.length>0) return ; 1704 if(!window.___currentTime) ___currentTime = Math.floor(new Date().getTime()/1000);// ìê°ì´ ì¤ì ëì§ ììë¤ë©´ js ìê°ì¼ë¡ ì¤ì í¨ 1705 1706 var $content = $("#layer-popups"); 1707 1708 if($content.length<=0) return false; 1709 parents.vars.popup.bodyWidth = $content.innerWidth(); 1710 parents.vars.popup.bodyLeft = $content.position().left; 1711 parents.vars.popup.screenWidth = window.screen.width; 1712 for(var i=0,cnt=___popup.length; i<cnt; i++){ 1713 // ì¿ í¤ì¸ì§ íë¨í ì´ê¸° 1714 var coo = ""; 1715 coo = bannerpop.getCookie(parents.vars.popup.popname+___popup[i].idxno) 1716 1717 if(!coo){ 1718 parents.vars.popup.order++; 1719 parents.float(___popup[i]); 1720 } 1721 } 1722 }); 1723 //}catch(e){} 1724 } 1725 1726 1727 // ì°½ë«ê¸° 1728 ,evtClose:function(mode, idxno) 1729 { 1730 if(mode=="layer"){ 1731 var layerId = bannerpop.vars.popup.popname+idxno; 1732 1733 $("#"+layerId).fadeOut("fast", function(){ 1734 $(this).remove(); 1735 }); 1736 }else window.close(); 1737 } 1738 1739 // cookie 1740 ,evtCookieClose:function(name, days) 1741 { 1742 bannerpop.setCookie(name, "popup", days); 1743 } 1744 1745 // í루,ëªì¼ëì ì´ì§ ì기 1746 ,daysNotOpen:function(expire, period, $btn, p) 1747 { 1748 var parents = this 1749 ,idxno = p.idxno 1750 ,isClickedMap = false; 1751 1752 if(expire!="none"){ 1753 $btn.each(function(i,v) { 1754 var $thisBtn = $(this); 1755 if($thisBtn.is(".popup-days")){ 1756 // í루ëì 1757 if(expire=="day"){ 1758 $thisBtn.click(function(){ 1759 parents.evtCookieClose(parents.vars.popup.popname+idxno, "1"); 1760 parents.evtClose(p.popup_type, p.idxno); 1761 return false;
1762 }) 1763 // ë«ê¸° íê·¸ ìì ìê²ë ìë ê±° ì°¾ì ë«ê¸° í ì¤í¸ ë£ì´ì£¼ê¸° 1764 .not(":has(*)").html('<a href="#close-to-layer">í루ëì ë³´ì§ ì기</a>'); 1765 } 1766 // ëªì¼ëì daySubfix 1767 else if(expire=="days"){ 1768 var select = '<a href="#link">' 1769 +'<label class="sr-only" for="popDays"></label>' 1770 +'<select name="popDays" id="popDays" class="tiny" title="기ê°">' 1771 +' <option value="1">í루</option>' 1772 +' <option value="2">2ì¼</option>' 1773 +' <option value="3">3ì¼</option>' 1774 +' <option value="4">4ì¼</option>' 1775 +' <option value="5">5ì¼</option>' 1776 +' <option value="6">6ì¼</option>' 1777 +' <option value="7">7ì¼</option>' 1778 +'</select> ëì ì´ì§ì기' 1779 +'</a>'; 1780 var html = '<a href="#link">' 1781 + (period>1 ? 'ëªì¼ëì ë³´ì§ ì기' : 'í루ëì ë³´ì§ ì기') 1782 +'</a>'; 1783 //$btn.not(":has(*)").append(select).click(function(){ 1784 $thisBtn.append(html).click(function(){ 1785 var $this = $(this) 1786 //,days = $this.prev("select").val(); 1787 ,days = period; 1788 1789 parents.evtCookieClose(parents.vars.popup.popname+idxno, days); 1790 parents.evtClose(p.popup_type, p.idxno); 1791 return false; 1792 }); 1793 } 1794 }else{ 1795 // ì´ë¯¸ì§ë§µì¼ë, í루ëì ì´ì§ì기 1796 $thisBtn.click(function(){ 1797 parents.evtCookieClose(parents.vars.popup.popname+idxno, "1"); 1798 parents.evtClose(p.popup_type, p.idxno); 1799 return false; 1800 }); 1801 1802 isClickedMap = true; 1803 } 1804 }); 1805 } 1806 1807 // expire ê°ì´ë ê´ê³ìì´ ì´ë¯¸ì§ë§µì ì°¾ì ì²ë¦¬ 1808 if(isClickedMap===false && $btn.is(".popup_day_close_map")){ 1809 // ì´ë¯¸ì§ë§µì¼ë, í루ëì ì´ì§ì기 1810 $btn.click(function(){ 1811 parents.evtCookieClose(parents.vars.popup.popname+idxno, "1"); 1812 parents.evtClose(p.popup_type, p.idxno); 1813 return false; 1814 }); 1815 } 1816 } 1817 1818 // window popup control 1819 ,popupControl:function() 1820 { 1821 if(!___popup) return ; 1822 if((typeof ___popup)!=="object") return ; 1823 1824 var parents = this 1825 ,p = ___popup 1826 ,title = decodeURIComponent(p.title)||"" 1827 ,popupType = p.popup_type||"window" 1828 ,bottomClose = p.bottom_close||"Y" 1829 ,bottomCloseExpireCk = p.bottom_close_expire_ck||"day" // : day,days,none 1830 ,bottomCloseExpire = p.bottom_close_expire||1 // : ëªì¼ 1831 ,$btnClose = $(".popup_close, .popup_close_map, .popup_icon_close") 1832 ,$btnDayClose = $(".popup-days, .popup_day_close_map"); 1833 1834 if(popupType!="window") return ; 1835 1836 // ìëì° ë° íì´í êµì²´ 1837 document.title = title; 1838 1839 // ì°½ë«ê¸° 1840 if(bottomClose=="Y"){ 1841 $btnClose.each(function(){ 1842 var _$this = $(this); 1843 //if(_$this.is(".popup_close")) _$this.text('ì°½ë«ê¸°'); 1844 }); 1845 1846 $btnClose.click(function(){ 1847 parents.evtClose(p.popup_type, p.idxno); 1848 return false; 1849 }); 1850 } 1851 1852 // í루, ëªì¼ëì ì´ì§ ì기 1853 this.daysNotOpen(bottomCloseExpireCk, bottomCloseExpire, $btnDayClose, p); 1854 1855 } 1856 1857 // array ìµê³ ê° 1858 ,arrayMaxMin:function(arr, mode) 1859 { 1860 if($.isArray(arr)===false) return false; 1861 1862 if(!mode) mode = "max"; 1863 arr.sort(function(a, b){ 1864 return b-a; 1865 }); 1866 return (mode=="max"?arr[0]:arr[arr.length-1])||0; 1867 } 1868};
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.