1var fileUpdateCnt = 0; 2var loadFile = 0; 3var closeProductNumber = 0; 4var $thisUploadCheck = '', taxUse = '', CANCEL = false, ABORT = false; 5var uadmin = ''; 6(function (jQuery) { 7 8 jQuery.modalON = function (text,bgcolor) { 9 var checkSetBgcolor = (typeof bgcolor != 'undefined' && bgcolor) ? true : false; 10 11 bgcolor = (checkSetBgcolor) ? bgcolor : '#fff'; 12 var msg = (text) ? text : ''; 13 14 if ($('.ModalPlugin').length < 1) { 15 $('body').prepend('<div class="ModalPlugin"><svg version="1.1" xmlns="http://www.w3.org/svg/2000" viewBox="0 0 30 30" width="60"><circle cy="15" cx="15" r="14" /></svg><p>' + msg + '</p></div>'); 16 } 17 18 $('.ModalPlugin').css({ 19 "display": "inherit", 20 "position": "fixed", 21 "z-index": "99999999", 22 "top": "0", 23 "left": "0", 24 "right": "0", 25 "bottom": "0", 26 "background": bgcolor, 27 "width": "100%", 28 "text-align": "center", 29 "height": "100%" 30 }); 31 if(!checkSetBgcolor) $('.ModalPlugin p').css('color','#3f3f3f'); 32 $('.ModalPlugin').show(); 33 $(document) 34 .off('click','.ModalPlugin') 35 .on ('click','.ModalPlugin', function(e) { 36 e.preventDefault(); 37 }); 38 } 39 40 jQuery.modalOFF = function () { 41 $('.ModalPlugin').remove(); 42 } 43 44 jQuery.uploadON = function (text) { 45 UPLOAD = 0; 46 UPLOADED = 0; 47 PROGRESS = 0; 48 var msg = (text) ? text : 'Uploading images...'; 49 if ($('.uploadModal').length < 1) { 50 $('body').prepend('<div class="uploadModal"></div>'); 51 $('.uploadModal').append('<button class="cl-mobile-btn upload-close close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><polygon points="16 1 15 0 8 7 1 0 0 1 7 8 0 15 1 16 8 9 15 16 16 15 9 8 "></polygon></svg></span></button>'); 52 $('.uploadModal').append('<div class="upload-wrap"></div>'); 53 $('.uploadModal .upload-wrap').append('<div class="upload-header"></div>'); 54 $('.uploadModal .upload-wrap').append('<div class="upload-content"></div>'); 55 56 $('.uploadModal .upload-header').append('<h1>' + $.lang[LANG]['editor.upload.title.1'] + '</h1>'); 57 $('.uploadModal .upload-header').append('<button type="" class="upload-close close"><span><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path d="M8.71 8l7.15-7.15c0.2-0.2 0.2-0.51 0-0.71s-0.51-0.2-0.71 0L8 7.29 0.85 0.15c-0.2-0.2-0.51-0.2-0.71 0s-0.2 0.51 0 0.71L7.29 8l-7.15 7.15c-0.2 0.2-0.2 0.51 0 0.71C0.24 15.95 0.37 16 0.5 16s0.26-0.05 0.35-0.15L8 8.71l7.15 7.15c0.1 0.1 0.23 0.15 0.35 0.15s0.26-0.05 0.35-0.15c0.2-0.2 0.2-0.51 0-0.71L8.71 8z"></path></svg></span></button>'); 58 $('.uploadModal .upload-content').append('<div class="upload-cancel"><div class="btn btn-default">' + $.lang[LANG]['config.close'] + '</div></div>'); 59 } 60 $('.uploadModal .upload-content').find('.file').remove(); 61 62 $progress = $('<div id="file-upload-progress" class="file-upload-progress"></div>'); 63 $bar = $('<div class="progress-bar"></div>'); 64 $progress.css({ 65 'height': '2px', 66 'background-color':'#d1d3d5', 67 'overflow' : 'hidden', 68 }); 69 $progress.append($bar); 70 if($('.uploadModal #file-upload-progress').length==0) { 71 $('.uploadModal .upload-header').append($progress); 72 $('.uploadModal .upload-header').append('<div class="info1"></div>'); 73 $('.uploadModal .upload-header').append('<div class="info2"></div>'); 74 } 75 // $('.uploadModal').show(); 76 } 77 78 jQuery.uploadOFF = function () { 79 $('.uploadModal').fadeOut(500, function(){ 80 $(this).remove(); 81 }); 82 } 83 84 jQuery.upload_add = function(e,data,upload_type) { 85 $('.uploadModal').show(); 86 var submit = true, err = ''; 87 88 var checkPlan = false, 89 checkPlanType = '', 90 filesize = data.files[0].size, 91 maxsize = 10485760; //10MB == 10485760Byte 92 93 if(typeof PAGE_MODE != 'undefined') { 94 if (PAGE_MODE == 'c') { 95 checkPlan = VALIDPLAN; 96 checkPlanType = VALIDTYPE; 97 } else if(typeof property != 'undefined' && property) { 98 checkPlan = property.VALIDPLAN; 99 checkPlanType = property.VALIDTYPE; 100 } 101 } 102 if(upload_type == 'flink' && checkPlan && $.inArray(checkPlanType,['BN','SM']) > -1) maxsize = 104857600; //100MB == 104857600Byte 103 if(upload_type == 'forum_file' && VALIDPLAN && $.inArray(VALIDTYPE,['BN','SM']) > -1) maxsize = 104857600; //100MB == 104857600Byte 104 if(upload_type == 'register_flink' && typeof property != 'undefined' && property && property.VALIDPLAN && $.inArray(property.VALIDTYPE,['BN','SM']) > -1 || 105 upload_type == 'register_flink' && typeof VALIDTYPE != 'undefined' && VALIDTYPE && $.inArray(VALIDTYPE,['BUSNESS','SHOPPING']) > -1 106 ) maxsize = 104857600; //100MB == 104857600Byte 107 108 console.log(maxsize); 109 if( filesize > maxsize) { 110 filesize = (filesize/1024/1024).toFixed(1); 111 if(maxsize == 104857600) err = $.lang[LANG]['editor.upload.max.100'] + $.lang[LANG]['editor.upload.max.2']; 112 else err = $.lang[LANG]['editor.upload.max.1'] + $.lang[LANG]['editor.upload.max.2']; 113 submit = false;
114 } 115 116 var image_types = 'jpg|jpeg|png|bmp|ico|gif|psd|ai|icns|webp', 117 text_types = 'txt|hwp|hwpx|hwt|doc|docx|docm|pdf|xls|xlsx|ppt|pps|ppsm|ppsx|pptx|pptm|potx|rtf|csv', 118 audio_types = 'mp3|wma|wav|ogg', 119 video_types = 'mp4|avi|wmv|mpg|mpeg', 120 etc_types = 'zip|7z|rar|ttf|otf', 121 allowed_types = ''; 122 123 var filename = data.files[0].name; 124 var search = /%/g, 125 match = filename.match(search); 126 127 if(match===null) { 128 var uploadErrors = []; 129 if(upload_type == 'flink' || upload_type == 'forum_file' || upload_type == 'register_flink') { 130 allowed_types = image_types + '|' + text_types + '|' + audio_types + '|' + video_types + '|' + etc_types; 131 var validFileAllTypes = allowed_types.split('|'), 132 alltypeAry = data.files[0]['name'].toLowerCase().split('.'); 133 if (validFileAllTypes.indexOf(alltypeAry[alltypeAry.length - 1]) == -1) { 134 console.log(data.files[0]['name'] + ' => ' + data.files[0]['type']); 135 136 err = $.lang[LANG]['editor.upload.error.flink']; 137 submit = false; 138 } 139 } else { 140 var validImageTypes = ['jpg', 'jpeg', 'png', 'gif', 'webp']; 141 var imgtypeAry = data.files[0]['name'].toLowerCase().split('.'); 142 if (validImageTypes.indexOf(imgtypeAry[imgtypeAry.length - 1]) == -1) { 143 err = $.lang[LANG]['editor.upload.error.ext']; 144 submit = false; 145 } 146 } 147 148 } else { 149 err = $.lang[LANG]['editor.upload.filename']; 150 submit = false; 151 } 152 153 var fileSize = (data.files[0].size/1024/1024).toFixed(1) + 'MB'; 154 var tpl = '<div class="file">\ 155 <div class="progress"><div class="progress-bar"></div></div>\ 156 <div class="progress-info"><span class="file-name">' + data.files[0].name + '</span><span class="file-size">' + fileSize + '</span><span class="ing">' + $.lang[LANG]['editor.upload.response'] + '</span></div>\ 157 <div class="preview"></div>\ 158 </div>'; 159 data.context = $(tpl).insertBefore($('.uploadModal .upload-content .upload-cancel')); 160 161 if(upload_type == 'all') { 162 data.context.find('.preview').addClass('not_image'); 163 } else { 164 if(data.files[0].type.match('image.*')) { 165 if (data.files && data.files[0]) { 166 var reader = new FileReader(); 167 reader.onload = function(e) { 168 // data.context.find('.preview').append('<img src="' + e.target.result + '">'); 169 if(e.target.result != '') { 170 data.context.find('.preview').css('background-image', 'url(' + e.target.result + ')'); 171 } 172 else { 173 data.context.find('.preview').addClass('no_preview'); 174 } 175 } 176 reader.readAsDataURL(data.files[0]); 177 } 178 } else data.context.find('.preview').addClass('not_image'); 179 } 180 181 return { 182 submit : submit, 183 err : err 184 } 185 } 186 187 jQuery.upload_progress = function(e,data) { 188 var rate = (data.bitrate/1024).toFixed(1) + 'kbps'; 189 var progress = parseInt((data.loaded / data.total) * 100, 10); 190 if(typeof data.context != 'undefined') { 191 data.context.find('.res').text(data.bitrate); 192 data.context.find('.progress-bar').css('width',progress + '%'); 193 data.context.find('.ing').text(progress + '%'); 194 data.context.find('.rate').text(rate); 195 if(progress == 100) { 196 data.context.find('.ing').text($.lang[LANG]['editor.upload.response']); 197 } 198 } 199 } 200 201 jQuery.upload_done = function(e,data) { 202 data.context.addClass('done'); 203 data.context.find('i').removeClass("fa-circle-o-notch fa-spin fa-3x fa-fw").addClass("fa-check"); 204 data.context.find('.ing').text($.lang[LANG]['editor.upload.done']); 205 data.context.find('.rate').fadeOut(); 206 207 if(typeof data.result.error != 'undefined') { 208 data.context.find('.loading').html('<i class="fa fa-times error"></i>'); 209 data.context.find('.ing').addClass('error').text(data.result.error); 210 } 211 } 212 213 jQuery.upload_progressall = function(e,data) { 214 var total = (data.total/1024/1024).toFixed(1) + 'MB'; 215 $('.uploadModal .info1').text($.lang[LANG]['editor.upload.size.total'] + total); 216 $('.uploadModal .info2').html('<span>' + (UPLOADED+1) + '</span>/' + UPLOAD.toString()); 217 var progress = parseInt((data.loaded / data.total) * 100, 10);
218 $('.file-upload-progress .progress-bar').css('width',progress + '%'); 219 } 220 221 jQuery.upload_start = function(e,data) { 222 $('.uploadModal .upload-header h1').text($.lang[LANG]['editor.upload.title.2']); 223 $('.uploadModal .upload-content .upload-cancel .btn-default').text($.lang[LANG]['config.cancel']); 224 } 225 226 jQuery.progressON = function(text,sub,delay,cancel_off) { 227 CANCEL = false; 228 var msg = (typeof text !='undefined') ? text : $.lang[LANG]['editor.delete.title.2']; 229 if ($('.progressModal').length < 1) { 230 $('body').prepend('<div class="progressModal"></div>'); 231 if( (typeof text !='undefined' && text == 'ì´ë¯¸ì§ë¥¼ ì ë¡ë ì¤ì ëë¤.') || (typeof text != 'undefined' && text == 'Uploading...')) { 232 $('.progressModal').append("<div class='progress-wrap btn-bottom-wrap-bgcolor'></div>"); 233 } else { 234 $('.progressModal').append("<div class='progress-wrap'></div>"); 235 } 236 $('.progressModal .progress-wrap').append("<div class='progress-header'></div>"); 237 $('.progressModal .progress-wrap').append("<div class='progress-content'></div>"); 238 239 $('.progressModal .progress-header').append('<h1>' + msg + '</h1>'); 240 // $('.progressModal .progress-header').append('<div class="close"></div>'); 241 242 if(typeof cancel_off != 'undefined' && cancel_off === true) { 243 } else { 244 if(typeof delay == 'undefined') { 245 $('.progressModal .progress-content').append('<div class="progress-cancel"><div class="btn btn-default">' + $.lang[LANG]['config.cancel'] + '</div></div>'); 246 } else { 247 setTimeout(function() { 248 $('.progressModal .progress-content').append('<div class="progress-cancel"><div class="btn btn-default">' + $.lang[LANG]['config.cancel'] + '</div></div>'); 249 },delay); 250 } 251 } 252 $progress = $('<div id="file-upload-progress" class="file-upload-progress"></div>'); 253 $bar = $('<div class="progress-bar progress-bar-success"></div>'); 254 $progress.css({ 255 'height': '5px', 256 'background-color':'#f5f5f5', 257 'overflow' : 'hidden', 258 }); 259 $progress.append($bar); 260 $progress = $('<div id="file-upload-progress" class="file-upload-progress"></div>'); 261 $bar = $('<div class="progress-bar"></div>'); 262 $progress.css({ 263 'height': '2px', 264 'background-color':'#f5f5f5', 265 'overflow' : 'hidden', 266 }); 267 $progress.append($bar); 268 if($('.progressModal #file-upload-progress').length==0) { 269 $('.progressModal .progress-header').append($progress); 270 $('.progressModal .progress-header').append('<div class="info1"></div>'); 271 $('.progressModal .progress-header').append('<div class="info2"></div>'); 272 $('.progressModal .progress-header').append('<p> </p>'); 273 } 274 } 275 if(typeof sub != 'undefined') { 276 $('.progressModal .progress-header .info1').html('<i class="fa fa-circle-o-notch fa-spin fa-3x fa-fw"></i> ' + sub); 277 } 278 279 $('body').addClass('overflow-hidden'); 280 281 $(document).on('click','.progress-cancel',function(e) { 282 CANCEL = true; ABORT = true; 283 $.progressOFF(); 284 }); 285 $('.progressModal').show(); 286 } 287 288 jQuery.progressOFF = function() { 289 $('body').removeClass('overflow-hidden'); 290 $('.progressModal').fadeOut().remove(); 291 } 292 293 jQuery.processON = function(text,bg) { 294 var msg = (text) ? text : ''; 295 bg = (bg) ? bg : 'rgba(0,0,0,0.75)'; 296 if ($('.processModal').length < 1) { 297 if($('.reorderModal').length) { 298 $('.reorderModal').after('<div class="processModal"><svg version="1.1" xmlns="http://www.w3.org/svg/2000" viewBox="0 0 30 30" width="60"><circle cy="15" cx="15" r="14" /></svg><p>' + msg + '</p></div>'); 299 } else { 300 $('body').prepend('<div class="processModal">
300<svg version="1.1" xmlns="http://www.w3.org/svg/2000" viewBox="0 0 30 30" width="60"><circle cy="15" cx="15" r="14" /></svg><p>' + msg + '</p></div>'); 301 } 302 } else { 303 $('.processModal').find('p').html(text); 304 } 305 306 $('.processModal').css({ 307 'display': 'inherit', 308 'position': 'fixed', 309 'z-index': '9999999999', 310 'top': '0', 311 'left': '0', 312 'width': '100%', 313 'text-align': 'center', 314 'height': '100%', 315 'background-color' : bg 316 }); 317 $('.processModal').fadeIn(); 318 } 319 320 jQuery.processOFF = function() { 321 $('.processModal').fadeOut().remove(); 322 } 323 324 jQuery.loadingOn = function(selector,txt) { 325 if(typeof txt == 'undefined') txt = ''; 326 selector.prepend('<div class="loadingModal"><svg class="spin_svg" version="1.1" xmlns="http://www.w3.org/svg/2000" viewBox="0 0 30 30" width="60"><circle cy="15" cx="15" r="14" /></svg><p>' + txt + '</p></div>'); $('.loadingModal').css({ 327 'display': 'inherit', 328 'position': 'absolute', 329 'z-index': '9999999999', 330 'top': '0', 331 'left': '0', 332 'width': '100%', 333 'text-align': 'center', 334 'height': '100%', 335 'background-color' : '' 336 }); 337 $('.loadingModal').fadeIn(); 338 } 339 340 jQuery.loadingOFF = function() { 341 $('.loadingModal').fadeOut().remove(); 342 } 343 344 jQuery.guideON = function(step) { 345 hideElementListPanel(); 346 var $guide = $('<div class="guideModal"></div>'); 347 348 if ($('.guideModal').length < 1) { 349 $('body').prepend($guide); 350 $('.guideModal').append('<div class="content"></div>') 351 $('.guideModal').css({ 352 'display': 'inherit', 353 'position': 'fixed', 354 'z-index': '99999999', 355 'top': '0', 356 'left': '0', 357 'width': '100%', 358 'text-align': 'center', 359 'background-color' : 'transparent', 360 'height': '100%', 361 }); 362 $('.guideModal .content').css({ 363 'width' : '100%', 364 'height' : '100%', 365 'background-color' : 'rgba(0,0,0,0.6)', 366 'margin-top' : '35px' 367 }); 368 $('.guideModal').fadeIn(); 369 } 370 371 $('.guideModal').find('.popover').fadeOut().remove(); 372 $('.cleditor-btn.edit-menu').removeClass('active'); 373 $('.cleditor-btn.edit-site').removeClass('active'); 374 $('.el_0_ctrl .config-element').css('z-index','4'); 375 $('.addElementButton').css('z-index','1'); 376 $('.config-image-edit').hide(); 377 $('.config-element').removeClass('disabled'); 378 $('.add-block').removeClass('disabled'); 379 380 switch(step) { 381 case 1 : 382 $('.cleditor-btn.edit-menu').addClass('active'); 383 var str = '\ 384 <div class="popover bottom">\ 385 <div class="arrow"></div>\ 386 <div class="popover-content" style="padding:15px 15px 10px;font-weight:600;">\ 387 <p>' + $.lang[LANG]["editor.guide.steps.1"] + '</p>\ 388 </div>\ 389 <h3 style="padding:5px;overflow:auto;" class="popover-title" id="popover-bottom">\ 390 <div class="pull-left"><span class="btn btn-default btn-sm" onclick="$.guideON();">' + $.lang[LANG]['config.close'] + '</span></div>\ 391 <div class="pull-right"><span style="padding-right:5px;"> <b>1</b> / 7 </span><span class="btn btn-primary btn-sm" onclick="$.guideON(2);">' + $.lang[LANG]['editor.guide.next'] + '</span></div>\ 392 </h3>\ 393 </div>\ 394 '; 395 $step1 = $(str); 396 $('.guideModal').find('.content').append($step1); 397 $step1.css({ 398 'top' : $('.editor-navbar').outerHeight()+2, 399 'left' : '0px' 400 }); 401 402 $('.dsgn-body').scrollTop(0); 403 $step1.fadeIn(); 404 break; 405 406 case 2 : 407 $('.cleditor-btn.edit-site').addClass('active'); 408 var str = '\ 409 <div class="popover bottom">\ 410 <div class="arrow"></div>\ 411 <div class="popover-content" style="padding:15px 15px 10px;font-weight:600;">\ 412 <p>' + $.lang[LANG]["editor.guide.steps.2"] + '</p>\ 413 </div>\ 414 <h3 style="padding:5px;overflow:auto;" class="popover-title" id="popover-bottom">\ 415 <div class="pull-left"><button class="btn btn-default btn-sm" onclick="$.guideON()">' + $.lang[LANG]['config.close'] + '</button></div>\ 416 <div class="pull-right"><span style="padding-right:5px;"> <b>2</b> / 7 </span><span class="btn btn-primary btn-sm" onclick="$.guideON(3);">' + $.lang[LANG]['editor.guide.next'] + '</span></div>\ 417 </h3>\ 418 </div>\ 419 '; 420 $step2 = $(str); 421 $('.guideModal').find('.content').append($step2); 422 $step2.css({ 423 'top' : $('.editor-navbar').outerHeight()+2, 424 'left' : '332px' 425 }); 426 $step2.fadeIn(); 427 break; 428 429 case 3: 430 $('.cleditor-btn.edit-site').removeClass('active'); 431 $('.element').removeClass('active'); 432 if($('.el_0').length<1) { 433 $.guideON(13); 434 return false;
435 } 436 $('.el_0_ctrl').hide(); 437 $('.el_0').addClass('active'); 438 $('.config-element-section').first().show().addClass('active'); 439 //$('.el_0_ctrl').show(); 440 441 var popover_direction = ($('header').hasClass('sidebar') || $('header').is('[data-layout="sidenav"]')) ? 'right' : 'left', 442 arrow_style = (popover_direction == 'right') ? 'style="left:-5px; margin-top: -8px; border-right: none;"' : ''; 443 var str = '\ 444 <div class="popover '+popover_direction+'">\ 445 <div class="arrow" '+arrow_style+'></div>\ 446 <div class="popover-content" style="padding:15px 15px 10px;font-weight:600;">\ 447 <p>' + $.lang[LANG]["editor.guide.steps.3"] + '</p>\ 448 </div>\ 449 <h3 style="padding:5px;overflow:auto;" class="popover-title" id="popover-bottom">\ 450 <div class="pull-left"><button class="btn btn-default btn-sm" onclick="$.guideON()">' + $.lang[LANG]['config.close'] + '</button></div>\ 451 <div class="pull-right"><span style="padding-right:5px;"> <b>3</b> / 7 </span><span class="btn btn-primary btn-sm" onclick="$.guideON(4);">' + $.lang[LANG]['editor.guide.next'] + '</span></div>\ 452 </h3>\ 453 </div>\ 454 '; 455 $step3 = $(str); 456 $('.guideModal').find('.content').append($step3); 457 var right = ($('header').hasClass('sidebar') || $('header').is('[data-layout="sidenav"]')) ? 'inherit' : '80px', 458 left = ($('header').hasClass('sidebar') || $('header').is('[data-layout="sidenav"]')) ? '270px' : 'inherit'; 459 $step3.css({ 460 'left' : left, 461 'top' : 0, 462 'right' : right 463 }); 464 $step3.fadeIn(); 465 $('.el-menu_ctrl').show().css('z-index','99999999'); 466 addElementButtonDisplay('el_0'); 467 break; 468 469 case 4: 470 $('.el-menu_ctrl').hide(); 471 var winHeight = $('.dsgn-body').height(), 472 elOffsetTop = $('.addel_0').offset().top; 473 474 var arrow = (winHeight>elOffsetTop) ? 'bottom' : 'top'; 475 $('.addElementButton').css('z-index','99999999'); 476 $('.add-block').removeClass('disabled').css('z-index','99999999'); 477 $('.addel_0 li .add-block').show().css('z-index','99999999'); 478 479 var str = '\ 480 <div class="popover ' + arrow + '">\ 481 <div class="arrow"></div>\ 482 <div class="popover-content" style="padding:15px 15px 10px;font-weight:600;">\ 483 <p>' + $.lang[LANG]["editor.guide.steps.4"] + '</p>\ 484 </div>\ 485 <h3 style="padding:5px;overflow:auto;" class="popover-title" id="popover-bottom">\ 486 <div class="pull-left"><button class="btn btn-default btn-sm" onclick="$.guideON()">' + $.lang[LANG]['config.close'] + '</button></div>\ 487 <div class="pull-right"><span style="padding-right:5px;"> <b>4</b> / 7 </span><span class="btn btn-primary btn-sm" onclick="$.guideON(5);">' + $.lang[LANG]['editor.guide.next'] + '</span></div>\ 488 </h3>\ 489 </div>\ 490 '; 491 $step4 = $(str); 492 $('.guideModal').find('.content').append($step4); 493 494 var left = ($('.dsgn-body').width()/2) - ($step4.width()/2) - 10; 495 if($('header').hasClass('sidebar') || $('header').is('[data-layout="sidenav"]')) left = left + 260; 496 497 if(elOffsetTop>winHeight) { 498 $('.dsgn-body').animate({scrollTop:elOffsetTop-($('.dsgn-body').height()/2)},'500','swing', function() { 499 var top = $('.addel_0').offset().top - 150; 500 $step4.css({ 501 'top' : top + 'px', 502 'left' : left + 'px' 503 }); 504 $step4.fadeIn(); 505 }); 506 } else { 507 if(winHeight/2 > elOffsetTop) { 508 $step4.removeClass(arrow).addClass('bottom'); 509 var top = elOffsetTop + 40; 510 $step4.css({ 511 'top' : top + 'px', 512 'left' : left + 'px' 513 }); 514 $step4.fadeIn(); 515 } else { 516 $step4.removeClass(arrow).addClass('top'); 517 var top = elOffsetTop -150; 518 $step4.css({ 519 'top' : top + 'px', 520 'left' : left + 'px' 521 }); 522 $step4.fadeIn(); 523 } 524 } 525 break; 526 527 case 5: 528 showElList(); 529 530 var str = '\ 531 <div class="popover right">\ 532 <div class="arrow" style="left:-5px; margin-top: -8px;
532 border-right: none;"></div>\ 533 <div class="popover-content" style="padding:15px 15px 10px;font-weight:600;">\ 534 <p>' + $.lang[LANG]["editor.guide.steps.5"] + '</p>\ 535 </div>\ 536 <h3 style="padding:5px;overflow:auto;" class="popover-title" id="popover-bottom">\ 537 <div class="pull-left"><button class="btn btn-default btn-sm" onclick="$.guideON()">' + $.lang[LANG]['config.close'] + '</button></div>\ 538 <div class="pull-right"><span style="padding-right:5px;"> <b>5</b> / 7 </span><span class="btn btn-primary btn-sm" onclick="$.guideON(6);">' + $.lang[LANG]['editor.guide.next'] + '</span></div>\ 539 </h3>\ 540 </div>\ 541 '; 542 $step5 = $(str); 543 $('.guideModal').find('.content').append($step5); 544 var top = ($('.guideModal').height()/2) - ($step5.height()/2); 545 $step5.css({ 546 'top' : top + 'px', 547 'left' : '175px' 548 }); 549 $step5.fadeIn(function() { 550 $('.guideModal .content').css('margin-top','0px'); 551 $('.guideModal .content').css('margin-left','170px'); 552 }); 553 break; 554 555 case 6: 556 $('.guideModal .content').css('margin-top','35px'); 557 $('.guideModal .content').css('margin-left','0px'); 558 hideElementListPanel(); 559 var str = '\ 560 <div class="popover bottom">\ 561 <div class="arrow"></div>\ 562 <div class="popover-content" style="padding:15px 15px 10px;font-weight:600;">\ 563 <p>' + $.lang[LANG]["editor.guide.steps.6"] + '</p>\ 564 </div>\ 565 <h3 style="padding:5px;overflow:auto;" class="popover-title" id="popover-bottom">\ 566 <div class="pull-left"><button class="btn btn-default btn-sm" onclick="$.guideON();">' + $.lang[LANG]['config.close'] + '</button></div>\ 567 <div class="pull-right"><span style="padding-right:5px;"> <b>6</b> / 7 </span><span class="btn btn-primary btn-sm" onclick="$.guideON(7);">' + $.lang[LANG]['editor.guide.next'] + '</span></div>\ 568 </h3>\ 569 </div>\ 570 '; 571 $step6 = $(str); 572 $('.guideModal').find('.content').append($step6); 573 var left = $('#change-mode').offset().left - ($step6.width()/2) + ($('#change-mode').width()/2); 574 $step6.css({ 575 'top' : $('.editor-navbar').outerHeight()+2, 576 'left' : left + 'px' 577 }); 578 $step6.fadeIn(); 579 580 break; 581 582 case 7: 583 $('.guideModal .content').css('margin-left','0px'); 584 hideElementListPanel(); 585 var str = '\ 586 <div class="popover bottom">\ 587 <div class="arrow"></div>\ 588 <div class="popover-content" style="padding:15px 15px 10px;font-weight:600;">\ 589 <p>' + $.lang[LANG]["editor.guide.steps.7"] + '</p>\ 590 </div>\ 591 <h3 style="padding:5px;text-align:right;" class="popover-title" id="popover-bottom"><span style="padding-right:5px;"> <b>7</b> / 7 </span><span class="btn btn-primary btn-sm" onclick="$.guideON();">' + $.lang[LANG]['editor.guide.start'] + '</span></h3>\ 592 </div>\ 593 '; 594 $step7 = $(str); 595 $('.guideModal').find('.content').append($step7); 596 var left = $('#config-publishing').offset().left - ($step7.width()/2) + ($('#config-publishing').width()/2); 597 $step7.css({ 598 'top' : $('.editor-navbar').outerHeight()+2, 599 'left' : left + 'px' 600 }); 601 $step7.fadeIn(); 602 603 break; 604 case 13: 605 $('.el-menu').addClass('active'); 606 $('.config-element-section').hide(); 607 $('.el-menu_ctrl').show(); 608 609 var str = '\ 610 <div class="popover left">\ 611 <div class="arrow"></div>\ 612 <div class="popover-content" style="padding:15px 15px 10px;font-weight:600;">\ 613 <p>ë©ë´ë³ê²½, ì´ë¯¸ì§ ì ë¡ë, ë°°ê²½ì, ì¬ë°± ì¡°ì ë± ë¸ëì ì¸ë¶ì¬íì ì¤ì í ì ììµëë¤.</p>\ 614 </div>\ 615 <h3 style="padding:5px;overflow:auto;" class="popover-title" id="popover-bottom">\ 616 <div class="pull-left"><button class="btn btn-default btn-sm" onclick="$.guideON()">' + $.lang[LANG]['config.close'] + '</button></div>\ 617 <div class="pull-right"><span style="padding-right:5px;"> <b>3</b> / 7 </span><span class="btn btn-primary btn-sm" onclick="$.guideON(14);">' + $.lang[LANG]['editor.guide.next'] + '</span></div>\ 618 </h3>\ 619 </div>\ 620 '; 621 $step3 = $(str); 622 $('.guideModal').find('.content').append($step3); 623 var top = $('.el-menu_ctrl').offset().top - ($step3.height()/2)+27; 624 $step3.css({ 625 'top' : top + 'px', 626 'left' : 'inherit',
627 'right' : '80px' 628 }); 629 $step3.fadeIn(); 630 $('.config-element').addClass('disabled'); 631 $('.el-menu_ctrl .config-element').css('z-index','99999999'); 632 //addElementButtonDisplay('el_0'); 633 634 break; 635 636 case 14: 637 $('.el-menu_ctrl .config-element').hide(); 638 var str = '\ 639 <div class="popover right">\ 640 <div class="arrow"></div>\ 641 <div class="popover-content" style="padding:15px 15px 10px;font-weight:600;">\ 642 <p>íì¬ ì íë ìì¹ì ë¸ëì ì¶ê°íì¬ ì¬ì´í¸ë¥¼ ë§ë¤ ì ììµëë¤.</p>\ 643 </div>\ 644 <h3 style="padding:5px;overflow:auto;" class="popover-title" id="popover-bottom">\ 645 <div class="pull-left"><button class="btn btn-default btn-sm" onclick="$.guideON()">' + $.lang[LANG]['config.close'] + '</button></div>\ 646 <div class="pull-right"><span style="padding-right:5px;"> <b>4</b> / 7 </span><span class="btn btn-primary btn-sm" onclick="$.guideON(5);">' + $.lang[LANG]['editor.guide.next'] + '</span></div>\ 647 </h3>\ 648 </div>\ 649 '; 650 $step4 = $(str); 651 var top = $('.addEL-wrap').offset().top + ($('.addEL-wrap').height()/2) - 90; 652 $step4.css({ 653 'top' : top + 'px', 654 'left': '50%', 655 'margin-left' : '100px' 656 }); 657 $('.guideModal').find('.content').append($step4); 658 $step4.fadeIn(); 659 break; 660 default : 661 var settings = { 662 'showGuide' : 'none' 663 }; 664 $.post('/template/settings',{ sid : SID, settings : JSON.stringify(settings), el : 'site_settings' }, function(data) { 665 checkError(data); 666 },'json'); 667 668 $('.guideModal').find('.popover').fadeOut().remove(); 669 $('.cleditor-btn.edit-menu').removeClass('active'); 670 $('.cleditor-btn.edit-site').removeClass('active'); 671 $('.el_0_ctrl .config-element').css('z-index','4'); 672 $('.addElementButton').css('z-index','1').hide(); 673 $('.config-image-edit').hide(); 674 $('.config-element').removeClass('disabled'); 675 $('.add-block').removeClass('disabled'); 676 $('.config-element-section.active').removeClass('active').fadeOut(); 677 $('.guideModal').fadeOut().remove(); 678 //$.quickON(0); 679 $.guideVideoON(); 680 break; 681 } 682 } 683 684 jQuery.quickON = function(menu) { 685 hideElementListPanel(); 686 var $quick = $('<div class="quickModal"></div>'), 687 $content = $('<div class="content"></div>'); 688 689 if ($('.quickModal').length < 1) { 690 $('body').prepend($quick); 691 /*$content.on('click',function() { 692 $.quickOFF(); 693 });*/ 694 $content.css({ 695 'width' : '100%', 696 'height' : '100%', 697 'background-color' : 'rgba(0,0,0,0.6)', 698 'display' : 'none' 699 }); 700 701 $quick.append($content); 702 $quick.css({ 703 'display': 'inherit', 704 'position': 'fixed', 705 'z-index': '99999999', 706 'top': '0', 707 'left': '0', 708 'width': '100%', 709 'height': '100%', 710 'text-align': 'center', 711 'background-color' : 'transparent' 712 }); 713 $quick.fadeIn(); 714 715 var hostAry = HOST.split('.'); 716 717 if (hostAry.length >= 3) { 718 HOST = hostAry[1]+'.'+hostAry[2]; 719 } 720 var supportUrl = (LANG == 'ko') ? 'https://supportcenter.creatorlink.net/creatorlink/' : 'https://supportcenter.creatorlink.net/creatorlink-support-center/'; 721 var chkgcp = window.location.hostname; 722 if(typeof chkgcp !== 'undefined' && chkgcp.indexOf('creatorlink.co.kr') > -1) { 723 supportUrl = 'https://supportcenter.creatorlink.net/migration/'; 724 } 725
726 var $guide = $('<div class="guide">'), 727 $close = $('<div class="close"><img src="https://storage.googleapis.com/i.addblock.net/fa-close-modal.png" alt="close" /></div>'), 728 $header = $('<div class="header"><h2>' + $.lang[LANG]["editor.guide-title"] + '</h2></div>'), 729 $linksWrap = $('<div class="links-wrap"></div>'), 730 $mainguide = $('<span class="mainguide"><i class="fa fa-plus-circle"></i>' + $.lang[LANG]["editor.guide.walkthrough"] + '</sort-page-linen>'), 731 $supportLink = $('</div><span class="support-link-wrap"><a class="support-link" href="' + supportUrl + '" target="_blank"><i class="fa fa-plus-circle"></i>' + $.lang[LANG]["editor.guide.support-center"] + '</a></span>'), 732 $body = $('<div class="body"></div>'), 733 $sidebar = $('<div class="sidebar"></div>'), 734 nav = new Array( $.lang[LANG]["editor.guide.tutorial-video"], $.lang[LANG]["editor.menu-config"], $.lang[LANG]["editor.site-config"], $.lang[LANG]["config.element-config"], $.lang[LANG]["editor.guide.add-blocks"], $.lang[LANG]["editor.image.add-change"], $.lang[LANG]["editor.guide.edit-text"], $.lang[LANG]["editor.guide.gallery"], $.lang[LANG]["editor.guide.preview-publish"]), 735 $nav = $('<ul class="nav"></ul>'), 736 $bottom = $('<div class="bottom"></div>'); 737 738 $mainguide.on('click', function() { 739 $.quickOFF(); 740 $.guideON(1); 741 }); 742 743 $close.on('click',function() { $.quickOFF(); }); 744 745 // ìì - íêµì´ ëììì´ ìë£ë ëê¹ì§ ë§ 746 if (LANG != 'en') { 747 nav.shift(); 748 } 749 750 $.each(nav, function(i,v){ 751 $li = $('<li class="'+i+'">'+v+'<img src="https://storage.googleapis.com/i.addblock.net/config/fa_thin_right_w.png" alt="" /></li>'); 752 $nav.append($li); 753 }); 754 $navli = $nav.children(); 755 $navli.on('click',function() { 756 var classtext = $(this).attr('class'); 757 $.quickON(Number(classtext.substring(0,1))); 758 }); 759 $sidebar.append($nav).append($bottom); 760 761 var $contentbox = $('<div class="contentbox"></div>'); 762 763 $body.append($sidebar).append($contentbox); 764 $linksWrap.append($mainguide, $supportLink); 765 $header.append($linksWrap); 766 $guide.append($header).append($close).append($body); 767 $content.append($guide); 768 $content.fadeIn(); 769 770 } 771 772 var $thisContent = $('.quickModal .contentbox'), 773 $thisMenu = $('.quickModal .sidebar .nav li'); 774 $thisMenu.removeClass('active'); 775 $thisMenu.eq(menu).addClass('active'); 776 777 var lang; 778 779 if (LANG == 'en') { 780 lang = '_' + LANG; 781 782 // ì ìì¤: ììë¡ ì¬ê¸°ë¡ ì®ê²¼ì (ëì¤ì í switchì¼ë¡ í ìì ) 783 switch(menu) { 784 case 0 : /* ê°ì´ë ëìì */ 785 786 var str = '\ 787 <ul>\ 788 <li><h4>' + $.lang[LANG]["editor.guide.tutorial-video"] + '</h4></li>\ 789 <li><p>' + $.lang[LANG]["editor.guide.tutorial-video.text"] + '</p></li>\ 790 </ul>\ 791 '; 792 793 var $quickVideoWrap = $('<li></li>'), 794 $tutorialVideo = $('<div class="tutorial-video"></div>'), 795 $videoWrap = $('<div class="video-wrap guideVideo-stopPlay"><div id="quick-guide-video-overlay"></div></div>'); 796 797 $menu0 = $(str); 798 $tutorialVideo.append( $videoWrap ); 799 $quickVideoWrap.append( $tutorialVideo ); 800 $menu0.append( $quickVideoWrap ); 801 802 $thisContent.empty(); 803 $thisContent.append($menu0); 804 $menu0.fadeIn(); 805 806 $videoWrap.on('click', function() { 807 808 $(this).toggleClass('guideVideo-stopPlay'); 809 810 if(!$(this).hasClass('guideVideo-stopPlay')) { 811 if ( LANG == 'en' ) 812 var link = 'https://www.youtube.com/embed/p6fyIMl2BcI'; 813 814 var html = '<iframe class="video embed-responsive-item" width="765" height="380" src="' + link + '?enablejsapi=1&rel=0&vq=large&wmode=
814opaque&showinfo=0&controls=1&autoplay=0&loop=0;playlist=Fn0Mpyh3xto;" frameborder="0" allowfullscreen></iframe>'; 815 $(this).html(html); 816 } 817 }); 818 819 break; 820 case 1 : /*ë©ë´ ì¤ì */ 821 var str = '\ 822 <ul>\ 823 <li><h4>' + $.lang[LANG]["editor.menu-config"] + '</h4></li>\ 824 <li><p>' + $.lang[LANG]["editor.guide.menu-config.text.1"] + '</p></li>\ 825 <li><img src="https://storage.googleapis.com/i.addblock.net/config/quickguid_0_1' + lang + '.png " alt="" /></li>\ 826 </ul>\ 827 '; 828 $menu1 = $(str); 829 830 $thisContent.empty(); 831 $thisContent.append($menu1); 832 $menu1.fadeIn(); 833 break; 834 case 2 : /*ì¬ì´í¸ ì¤ì */ 835 var str = '\ 836 <ul>\ 837 <li><h4>' + $.lang[LANG]["editor.site-config"] + '</h4></li>\ 838 <li><p>' + $.lang[LANG]["editor.guide.site-config.text.1"] + '</p></li>\ 839 <li><img src="https://storage.googleapis.com/i.addblock.net/config/quickguid_1_1' + lang + '.png" alt="" /></li>\ 840 </ul>\ 841 '; 842 $menu2 = $(str); 843 $thisContent.empty(); 844 $thisContent.append($menu2); 845 $menu2.fadeIn(); 846 break; 847 case 3 : /*ë¸ë ì¤ì */ 848 var str = '\ 849 <ul>\ 850 <li><h4>' + $.lang[LANG]["config.element-config"] + '</h4></li>\ 851 <li><p>' + $.lang[LANG]["editor.guide.element-config.text.1"] + '</p></li>\ 852 <li><h6><img src="https://storage.googleapis.com/i.addblock.net/config/fa_exclamation.png" alt="" class="fa"/> ' + $.lang[LANG]["editor.guide.element-config.text.note"] + '</h6></li>\ 853 <li><img src="https://storage.googleapis.com/i.addblock.net/config/quickguid_2_1' + lang + '.png" alt="" /></li>\ 854 </ul>\ 855 '; 856 $menu3 = $(str); 857 $thisContent.empty(); 858 $thisContent.append($menu3); 859 $menu3.fadeIn(); 860 break; 861 case 4 : /*ë¸ë ì¶ê°*/ 862 var str = '\ 863 <ul>\ 864 <li><h4>' + $.lang[LANG]["editor.guide.add-blocks"] + '</h4></li>\ 865 <li><p>' + $.lang[LANG]["editor.guide.add-block.text.1"] + '</p></li>\ 866 <li><img src="https://storage.googleapis.com/i.addblock.net/config/quickguid_3_1' + lang + '.png" alt="" /></li>\ 867 </ul>\ 868 '; 869 $menu4 = $(str); 870 $thisContent.empty(); 871 $thisContent.append($menu4); 872 $menu4.fadeIn(); 873 break; 874 case 5 : /*ì´ë¯¸ì§ ì¶ê°/ë³ê²½*/ 875 var str = '\ 876 <ul>\ 877 <li><h4>' + $.lang[LANG]["editor.image.add-change"] + '</h4></li>\ 878 <li><p>' + $.lang[LANG]["editor.guide.add-change-images.text.1"] + '</p></li>\ 879 <li><h6><img src="https://storage.googleapis.com/i.addblock.net/config/fa_exclamation.png" alt="" class="fa"/>' + $.lang[LANG]["editor.guide.add-change-images.text.note"] + '</h6></li>\ 880 <li><img src="https://storage.googleapis.com/i.addblock.net/config/quickguid_4_1.png" alt="" /></li>\ 881 </ul>\ 882 '; 883 $menu5 = $(str); 884 $thisContent.empty(); 885 $thisContent.append($menu5); 886 $menu5.fadeIn(); 887 break; 888 case 6 : /*í ì¤í¸*/ 889 var str = '\ 890 <ul>\ 891 <li><h4>' + $.lang[LANG]["config.text"] + '</h4></li>\ 892 <li><p>' + $.lang[LANG]["editor.guide.edit-text.text.1"] + '</p></li>\ 893 <li><img src="https://storage.googleapis.com/i.addblock.net/config/quickguid_5_1' + lang + '.png" alt="" /></li>\ 894 </ul>\ 895 '; 896 $menu6 = $(str); 897 $thisContent.empty(); 898 $thisContent.append($menu6); 899 $menu6.fadeIn(); 900 break; 901 case 7 : /*ê°¤ë¬ë¦¬*/ 902 var str = '\ 903 <ul>\ 904 <li><h4>' + $.lang[LANG]["editor.block.gallery"] + '</h4></li>\ 905 <li><p>' + $.lang[LANG]["editor.guide.gallery.text.1"] + '</p></li>\ 906 <li><img src="https://storage.googleapis.com/i.addblock.net/config/quickguid_6_1.png" alt="" /></li>\ 907 <li><hr /></li>\ 908 <li><p>' + $.lang[LANG]["editor.guide.gallery.text.2"] + '</p></li>\ 909 <li><img src="https://storage.googleapis.com/i.addblock.net/config/quickguid_6_2' + lang + '.png" alt="" /></li>\ 910 <li><h6><img src="https://storage.googleapis.com/i.addblock.net/config/fa_exclamation.png" alt="" class="fa"/> ' + $.lang[LANG]["editor.guide.gallery.text.note"] + '</h6></li>\ 911 </ul>\ 912 '; 913 $menu7 = $(str); 914 $thisContent.empty(); 915 $thisContent.append($menu7); 916 $menu7.fadeIn(); 917 break; 918 case 8 : /*ì ì¥/ê²ì*/ 919 var str = '\ 920 <ul>\ 921 <li><h4>' + $.lang[LANG]["editor.guide.preview-publish"] + '</h4></li>\ 922 <li><img src="https://storage.googleapis.com/i.addblock.net/config/quickguid_7_1' + lang + '.png" alt="" style="margin-top: 0"/></li>\ 923 <li><p>' + $.lang[LANG]["editor.guide.preview-publish.text.1"] + '</p></li>\ 924 <li><h6><img src="https://storage.googleapis.com/i.addblock.net/config/fa_exclamation.png" alt="" class="fa"/> ' + $.lang[LANG]["editor.guide.preview-publish.text.note"] + '</h6></li>\ 925 </ul>\ 926 '; 927 $menu8 = $(str); 928 $thisContent.empty(); 929 $thisContent.append($menu8); 930 $menu8.fadeIn(); 931 break; 932 default : 933 $.quickOFF(); 934 break; 935 } 936 } 937 else { 938 lang = ''; 939 940 // ì ìì¤: ììë¡ ì¬ê¸°ë¡ ì®ê²¼ì (ëì¤ì í switchì¼ë¡ í ìì ) 941 switch(menu) { 942 case 0 : /*ë©ë´ ì¤ì */ 943 var str = '\ 944 <ul>\ 945 <li><h4>' + $.lang[LANG]["editor.menu-config"] + '</h4></li>\ 946 <li><p>' + $.lang[LANG]["editor.guide.menu-config.text.1"] + '</p></li>\ 947 <li><img src="https://storage.googleapis.com/i.addblock.net/config/quickguid_0_1' + lang + '.png " alt="" /></li>\ 948 </ul>\ 949 '; 950 $menu0 = $(str); 951 952 $thisContent.empty(); 953 $thisContent.append($menu0); 954 $menu0.fadeIn(); 955 break; 956 case 1 : /*ì¬ì´í¸ ì¤ì */ 957 var str = '\ 958 <ul>\ 959 <li><h4>' + $.lang[LANG]["editor.site-config"] + '</h4></li>\ 960 <li><p>' + $.lang[LANG]["editor.guide.site-config.text.1"] + '</p></li>\ 961 <li><img src="https://storage.googleapis.com/i.addblock.net/config/quickguid_1_1' + lang + '.png" alt="" /></li>\ 962 </ul>\ 963 '; 964 $menu1 = $(str); 965 $thisContent.empty(); 966 $thisContent.append($menu1); 967 $menu1.fadeIn(); 968 break; 969 case 2 : /*ë¸ë ì¤ì */ 970 var str = '\ 971 <ul>\ 972 <li><h4>' + $.lang[LANG]["config.element-config"] + '</h4></li>\ 973 <li><p>' + $.lang[LANG]["editor.guide.element-config.text.1"] + '</p></li>\ 974 <li><h6><img src="https://storage.googleapis.com/i.addblock.net/config/fa_exclamation.png" alt="" class="fa"/> ' + $.lang[LANG]["editor.guide.element-config.text.note"] + '</h6></li>\ 975 <li><img src="https://storage.googleapis.com/i.addblock.net/config/quickguid_2_1' + lang + '.png" alt="" /></li>\ 976 </ul>\ 977 '; 978 $menu2 = $(str); 979 $thisContent.empty(); 980 $thisContent.append($menu2); 981 $menu2.fadeIn(); 982 break; 983 case 3 : /*ë¸ë ì¶ê°*/ 984 var str = '\ 985 <ul>\ 986 <li><h4>' + $.lang[LANG]["editor.guide.add-blocks"] + '</h4></li>\ 987 <li><p>' + $.lang[LANG]["editor.guide.add-block.text.1"] + '</p></li>\ 988 <li><img src="https://storage.googleapis.com/i.addblock.net/config/quickguid_3_1' + lang + '.png" alt="" /></li>\ 989 </ul>\ 990 '; 991 $menu3 = $(str); 992 $thisContent.empty(); 993 $thisContent.append($menu3); 994 $menu3.fadeIn(); 995 break; 996 case 4 : /*ì´ë¯¸ì§ ì¶ê°/ë³ê²½*/ 997 var str = '\ 998 <ul>\ 999 <li><h4>' + $.lang[LANG]["editor.image.add-change"] + '</h4></li>\ 1000 <li><p>' + $.lang[LANG]["editor.guide.add-change-images.text.1"] + '</p></li>\ 1001 <li><h6><img src="https://storage.googleapis.com/i.addblock.net/config/fa_exclamation.png" alt="" class="fa"/>' + $.lang[LANG]["editor.guide.add-change-images.text.note"] + '</h6></li>\ 1002 <li><img src="https://storage.googleapis.com/i.addblock.net/config/quickguid_4_1.png" alt="" /></li>\ 1003 </ul>\ 1004 '; 1005 $menu4 = $(str); 1006 $thisContent.empty(); 1007 $thisContent.append($menu4); 1008 $menu4.fadeIn(); 1009 break; 1010 case 5 : /*í ì¤í¸*/ 1011 var str = '\ 1012 <ul>\ 1013 <li><h4>' + $.lang[LANG]["config.text"] + '</h4></li>\ 1014 <li><p>' + $.lang[LANG]["editor.guide.edit-text.text.1"] + '</p></li>\ 1015 <li><img src="https://storage.googleapis.com/i.addblock.net/config/quickguid_5_1' + lang + '.png" alt="" /></li>\ 1016 </ul>\ 1017 '; 1018 $menu5 = $(str); 1019 $thisContent.empty(); 1020 $thisContent.append($menu5); 1021 $menu5.fadeIn(); 1022 break; 1023 case 6 : /*ê°¤ë¬ë¦¬*/ 1024 var str = '\ 1025 <ul>\ 1026 <li><h4>' + $.lang[LANG]["editor.block.gallery"] + '</h4></li>\ 1027 <li><p>' + $.lang[LANG]["editor.guide.gallery.text.1"] + '</p></li>\ 1028 <li><img src="https://storage.googleapis.com/i.addblock.net/config/quickguid_6_1.png" alt="" /></li>\ 1029 <li><hr /></li>\ 1030 <li><p>' + $.lang[LANG]["editor.guide.gallery.text.2"] + '</p></li>\ 1031 <li><img src="https://storage.googleapis.com/i.addblock.net/config/quickguid_6_2' + lang + '.png" alt="" /></li>\ 1032 <li><h6><img src="https://storage.googleapis.com/i.addblock.net/config/fa_exclamation.png" alt="" class="fa"/> ' + $.lang[LANG]["editor.guide.gallery.text.note"] + '</h6></li>\ 1033 </ul>\ 1034 '; 1035 $menu6 = $(str); 1036 $thisContent.empty(); 1037 $thisContent.append($menu6); 1038 $menu6.fadeIn(); 1039 break; 1040 case 7 : /*ì ì¥/ê²ì*/ 1041 var str = '\ 1042 <ul>\ 1043 <li><h4>' + $.lang[LANG]["editor.guide.preview-publish"] + '</h4></li>\ 1044 <li><img src="https://storage.googleapis.com/i.addblock.net/config/quickguid_7_1' + lang + '.png" alt="" style="margin-top: 0"/></li>\ 1045 <li><p>' + $.lang[LANG]["editor.guide.preview-publish.text.1"] + '</p></li>\ 1046 <li><h6><img src="https://storage.googleapis.com/i.addblock.net/config/fa_exclamation.png" alt="" class="fa"/> ' + $.lang[LANG]["editor.guide.preview-publish.text.note"] + '</h6></li>\ 1047 </ul>\ 1048 '; 1049 $menu7 = $(str); 1050 $thisContent.empty(); 1051 $thisContent.append($menu7); 1052 $menu7.fadeIn(); 1053 break; 1054 default : 1055 $.quickOFF(); 1056 break; 1057 } 1058 } 1059 1060 } 1061 1062 jQuery.quickOFF = function() { 1063 $('.quickModal').fadeOut(function() { 1064 $(this).remove(); 1065 }); 1066 } 1067 1068 $('.quickModal').live({ 1069 click: function(e) { 1070 if($(e.target).parents('.guide').length < 1) $.quickOFF(); 1071 } 1072 }); 1073 1074 $.fn.addSvgClass = function(cls) { 1075 return this.each(function() { 1076 var $t = $(this); 1077 1078 if ($t[0] instanceof SVGElement) { 1079 if (!$t[0].classList.contains(cls)) { 1080 $t[0].classList.add(cls); 1081 } 1082 } else { 1083 $t.addClass(cls); 1084 } 1085 }); 1086 }; 1087 1088 $.fn.removeSvgClass = function(cls) { 1089 return this.each(function() { 1090 var $t = $(this); 1091 1092 if ($t[0] instanceof SVGElement) { 1093 if ($t[0].classList.contains(cls)) { 1094 $t[0].classList.remove(cls); 1095 } 1096 } else { 1097 $t.removeClass(cls); 1098 } 1099 }); 1100 }; 1101 1102 jQuery.setAloneBlockError = function(centerArea,return_v) { 1103 if(typeof return_v != 'boolean') return_v = false;
1104 1105 var onoff = false; 1106 if(typeof centerArea == 'undefined' || $(centerArea).length === 0) { 1107 if(return_v) return onoff; 1108 } else { 1109 var center_b = $(centerArea).find('.reorderBlock').length, 1110 center_lb = $(centerArea).find('.reorderBlock[data-mode="shopping"]').length, 1111 center_fb = $(centerArea).find('.reorderBlock[data-feature*="fixedscroll"]').length, 1112 check_lux = (LUX && (center_lb > 1)) ? true : false, 1113 check_fixedscroll = (center_fb > 1 || (center_fb == 1 && center_b > 1)) ? true : false; 1114 onoff = (check_lux || check_fixedscroll) ? true : false; 1115 1116 if(onoff) { 1117 var error_str = (check_lux) ? $.lang[LANG]['config.lux.shopping.not-supported.reorder'] : $.lang[LANG]['config.premium.gallery.fixedscroll.not-supported.reorder']; 1118 $('.reorderModal').addClass('aloneBlockError'); 1119 if($('.reorderModal .alone_b_error').length === 0) $('.reorderModal').append('<div class="alone_b_error">' + error_str + '</div>'); 1120 $('.reorderModal .alone_b_error').slideDown(200); 1121 } else { 1122 $('.reorderModal .alone_b_error').slideUp(200, function() { 1123 $('.reorderModal').removeClass('aloneBlockError'); 1124 }); 1125 } 1126 1127 if(return_v) return onoff; 1128 } 1129 } 1130 1131 jQuery.reorderON = function(pageMenuStr) { 1132 $.processON('Loading blocks ...'); 1133 if(pageMenuStr == 'index') pageMenuStr = ''; 1134 if(prevPAGE == 'index') prevPAGE = ''; 1135 if(prevONE) prevPAGE = ORG_PAGES[selectID]; 1136 window.currentPageMenu = pageMenuStr ? pageMenuStr.toString() : prevPAGE; 1137 window.currentPageMenuIdx = -1; 1138 window.copy_menu_list = MENULIST; 1139 // if(copy_menu_list[0] == 'INTRO') copy_menu_list.splice(0, 1); 1140 1141 var enable = true; 1142 if(!window.basketBlockHtml) 1143 window.basketBlockHtml = ''; 1144 1145 if(!window.pageListChangeFlag) window.pageListChangeFlag = []; 1146 1147 if($('.ctrl-reorder').hasClass('disabled')) return; 1148 1149 // var el = [], idx = 0; 1150 // var toolbar = ($('.editor-navbar').css('display')=='none') ? 0 : 35; 1151 // var sidebar = ($('header').hasClass('sidebar')) ? true : false; 1152 var el_fixed = (reorderFIXED) ? reorderFIXED.split(':') : []; 1153 1154 // $.each($('.element'),function(i,v) { 1155 // if( $(v).data('el') == 'el-menu' || 1156 // $(v).data('el') == 'el-footer' || 1157 // $(v).hasClass('add-footer-information') || 1158 // $(v).hasClass('cl-s-product-review') || 1159 // $(v).hasClass('cl-s-product-qna') 1160 // ) return true; 1161 1162 // if(reorderFIXED) { 1163 // if($(v).hasClass('el-fixedblock')) { 1164 // if($(v).attr('data-posby') != el_fixed[2]) return true; 1165 // } else return true; 1166 // } else { 1167 // if($(v).hasClass('el-fixedblock')) return true; 1168 // } 1169 1170 // el[idx] = $(v).attr('data-el') + '|' + ($(v).offset().top - toolbar) + '-' + $(v).outerHeight(); 1171 // idx++; 1172 // }); 1173 // eloffSet = el.toString(); 1174 1175 var $reorder = $('<div class="reorderModal"></div>'); 1176 if($('.reorderModal').length < 1) { 1177 $('body').prepend($reorder); 1178 $reorder.css({ 1179 'position' : 'fixed', 1180 'width' : '100%', 1181 'height' : '100%', 1182 'background' : '#eef0f4', 1183 'z-index' : '1049', 1184 'display' : 'none', 1185 'overflow' : 'auto' 1186 }); 1187 } else { 1188 // $('.reorderModal').empty(); 1189 $reorder = $(".reorderModal"); 1190 } 1191 //<div class="scale" style="margin-top: 0; height: 100%; width: calc(388px * 5); margin-left: calc((-388px * 5) /2 + 50%); ">\ 1192 var reorder_title = (reorderFIXED) ? $.lang[LANG]['editor.reorder-blocks.title.'+el_fixed[2]] : $.lang[LANG]['editor.reorder-blocks.title'], 1193 $content = $('<div class="content" style="display: flex;"></div>'), 1194 $left_area = $('<div class="left-area ' + (VIEW ? ' view-exist ' : '') + '" style="flex: 1 1 40%; max-width: calc(48% - 155px);">\ 1195 <div style="display: flex; -webkit-box-pack: end; -ms-flex-pack: end; justify-content: flex-end;">\ 1196 <div class="" style="max-width: 385px; height: 100%; background-color: #fff; position: fixed; width: calc(48% - 155px);">\ 1197 <div class="" style="text-align: center; padding-top: 30px; padding-bottom: 53px;"><h4 style="margin-top: 10px;">' + $.lang[LANG]['config.blockmove.moveblock'] + '</h4></div>\ 1198 <div class="scale" style="margin-top: 0; width: calc(100% / 0.166); height: calc(100% / 0.166 - (124px / 0.166)) !important; overflow-y: auto; overflow-x: hidden; transform: scale(.166);">\ 1199 <div class="el-sortable">\ 1200 <div class="sort-empty guide-text">' + $.lang[LANG]['config.blockmove.movehere'] + '</div>\ 1201 </div>\ 1202 </div>\ 1203 </div>\ 1204 </div>\ 1205 </div>'), 1206 $center_area = $('<div class="center-area ' + (VIEW ? ' view-exist ' : '') + ' " style="flex: 1 1 40%; max-width: calc(47% - 155px);"><div class="block-area" style="max-width: 400px; margin: 0 auto;"><div class="page-list-area"><div class="btn-group"></div></div></div></div>'), 1207 $right_area = $('<div class="right-area" style="flex: 1 1 30%; padding: 30px 40px 0 0; position: fixed; right: 0; z-index: 4;"></div>'), 1208 // $scale = $('<div class="scale" style="width: calc(388px * 5); margin-left: calc((-388px * 5) /2 + 50%);"></div>'); 1209 $scale = $('<div class="scale" style="width: 500%;"></div>'), 1210 $save = $('<span class="btn btn-primary btn-flat btn-sm pull-right">' + $.lang[LANG]['config.save'] + '</span>'), 1211 $close = $('<span class="btn btn-default btn-flat btn-sm pull-right">' + $.lang[LANG]['config.cancel'] + '</span>').css('margin-right','10px'); 1212 1213 $close.on('click',function() { 1214 $.processON('','#fff'); 1215 $.reorderOFF(); 1216 1217 setConfigLogs('block.reorder','cancel',{'seq':selectID},PAGE); 1218 1219 if(!VIEW && (prevPAGE || PAGE)) { 1220 var refer = prevPAGE ? prevPAGE.replace(',','/view/') : PAGE.replace(',','/view/'); 1221 location.replace('/'+CONFIG_URL+'config/page/' + refer); 1222 } else { 1223 location.reload(); 1224 $.processOFF(); 1225 } 1226 }); 1227 1228 $save.on('click',function() { 1229 if(basketBlockHtml != '') { 1230 alert($.lang[LANG]['config.blockmove.blockleft']); 1231 return false;
1232 } 1233 1234 var checkAloneBlock = $.setAloneBlockError($center_area,true); 1235 if(checkAloneBlock) { 1236 console.log('error'); 1237 return false; 1238 } 1239 1240 1241 $.processON($.lang[LANG]['config.reorder.loading']); 1242 1243 // var rPage = ''; 1244 // $.each($('.el-sortable').children(), function(i,v) { 1245 // var page_name = $(v).attr('data-result-page'); 1246 // if(typeof page_name !='undefined' && page_name && $(v).hasClass('sort-empty')) { 1247 // rPage = $(v).attr('data-result-page'); 1248 // return true; 1249 // } 1250 1251 // $(v).attr('data-reorder-page',rPage); 1252 // }); 1253 var r = []; 1254 // $.each($('.center-area .reorderBlock'), function(i,v) { 1255 // tmp = $(this).attr('data-reorder-page') + ':' + $(this).attr('data-id'); 1256 // if(reorderFIXED) tmp += ':' + el_fixed[2]; 1257 // r.push(tmp); 1258 // }); 1259 1260 var clog_more_obj = {}; 1261 $(pageList).each(function(idx) { 1262 var loopPage = this; 1263 if(!ONE && typeof pageListChangeFlag[idx] == 'undefined') return true; 1264 if(typeof pageList[idx] == 'undefined') return true; 1265 1266 var loop_pagename = (!VIEW) ? window.copy_menu_list[idx] : currentPageMenu; 1267 clog_more_obj[loop_pagename] = { 1268 'before': clogPageList[idx], 1269 'after' : loopPage, 1270 }; 1271 1272 $(loopPage).each(function() { 1273 var tmp = loop_pagename + ':' + this; 1274 if(reorderFIXED) tmp += ':' + el_fixed[2]; 1275 r.push(tmp); 1276 }); 1277 }); 1278 1279 setConfigLogs('block.reorder','save.click',{'seq':selectID, 'more_obj':clog_more_obj},PAGE); 1280 var view_page = (reorderFIXED) ? el_fixed[1] : currentPageMenu; 1281 $.ajax({ 1282 type: 'POST', 1283 url: '/template/update/type/block-reorder', 1284 data: { s: JSON.stringify(r), id: SID, page: view_page, onepage : ONE}, 1285 async:true, 1286 cache: false, 1287 success: function (data) { 1288 var type = getElementType(); 1289 setLogs(type,'block.reorder','block-sort','','product-manager','el'); 1290 $('.element').removeClass('active').removeClass('el-active'); 1291 $('#el-property').hide(); 1292 1293 1294 setConfigLogs('block.reorder','save.end',{'seq':selectID},PAGE); 1295 if(!VIEW && (prevPAGE || PAGE)) { 1296 var refer = prevPAGE ? prevPAGE.replace(',','/view/') : PAGE.replace(',','/view/'); 1297 location.replace('/'+CONFIG_URL+'config/page/' + refer); 1298 } else { 1299 location.reload(); 1300 } 1301 $.processOFF(); 1302 $.reorderOFF(); 1303 checkError(data); 1304 } 1305 }); 1306 /* 1307 var ids = []; 1308 $.each($('.render'), function(i,v) { 1309 if(typeof $(v).attr('data-id') != 'undefined') ids.push($(v).attr('data-id').trim()); 1310 }); 1311 1312 $.post('/template/update/type/block-reorder',{ id : SID, page : PAGE, s:ids.join(',')}, function(data) { 1313 checkError(data); 1314 },'json'); 1315 return false; 1316 */ 1317 }); 1318 1319 $content.append($left_area); 1320 1321 if(window.basketBlockHtml && window.basketBlockHtml != '') { 1322 $left_area.find(".el-sortable").append(window.basketBlockHtml); 1323 $left_area.find(".sort-empty").hide(); 1324 $left_area.find(".reorderBlock").removeClass("active"); 1325 } 1326 1327 $right_area.append($save); 1328 $right_area.append($close); 1329 $content.append($center_area); 1330 $content.append($right_area); 1331 $center_area.find(".block-area").append($scale); 1332 $reorder.html($content); 1333
1334 var $sort = $('<div class="el-sortable"></div>'); 1335 $sort.css('color',$('.dsgn-body').css('color')); 1336 1337 if(!$(".new-dsgn-body").length) { 1338 var temp_dsgn_body = $('<div class="new-dsgn-body"><div class="elements"></div></div>'); 1339 $("body").append(temp_dsgn_body); 1340 } else { 1341 var temp_dsgn_body = $(".reorderModal .new-dsgn-body"); 1342 // temp_dsgn_body.empty(); 1343 } 1344 1345 $reorder.fadeIn(); 1346 1347 //var $scale = $('<div class="scale"></div>'); 1348 //$scale.css('color',$('.dsgn-body').css('color')); 1349 var elIndex = 0; 1350 1351 window.pageMenu = []; 1352 // if(PAGE == 'index') { 1353 // $.each(MENULINK,function(i,v) { 1354 // //$.each(SMENU,function(i,v) { 1355 // pageMenu.push(v.replace(/ /g,'-')); 1356 // //if(v.display == 'on') pageMenu.push(v.name); 1357 // }); 1358 // } else { 1359 var view_page = (reorderFIXED) ? el_fixed[1] : PAGE; 1360 pageMenu.push(view_page); 1361 // } 1362 1363 var pageMenuSelect = ''; 1364 1365 if(!VIEW) { 1366 if(!window.currentPageMenu || window.currentPageMenu == '') window.currentPageMenu = copy_menu_list[0]; 1367 1368 pageMenuSelect += '\ 1369 <button type="button" class="btn btn-sm fsm dropdown-toggle" data-toggle="dropdown">\ 1370 <span>' + currentPageMenu + '</span> ' + ($("#nestable").find("[data-id='" + currentPageMenu + "']").children(".menu-ctrl").find(".menu-visible").hasClass('invisible') ? ' <svg viewBox="0 0 14 12" width="14" height="14"><path d="M12.29 0l-1.88 1.88C9.39 1.32 8.23 1 7 1 3.83 1 1.12 3.07 0 6c0.56 1.46 1.53 2.68 2.73 3.56L1 11.29 1.71 12 13 0.71 12.29 0zM1.09 6C2.15 3.64 4.4 2 7 2c0.95 0 1.86 0.23 2.67 0.62L8.73 3.56C8.24 3.21 7.65 3 7 3 5.34 3 4 4.34 4 6c0 0.65 0.21 1.24 0.56 1.73L3.44 8.85C2.44 8.15 1.62 7.17 1.09 6zM5 6c0-1.1 0.9-2 2-2 0.37 0 0.71 0.11 1.01 0.28L5.28 7.01C5.11 6.71 5 6.37 5 6z"></path><path d="M12.05 3.06l-0.71 0.71C11.99 4.4 12.53 5.15 12.91 6c-1.05 2.36-3.3 4-5.91 4 -0.57 0-1.12-0.09-1.65-0.24l-0.8 0.8C5.32 10.84 6.14 11 7 11c3.17 0 5.88-2.07 7-5C13.57 4.87 12.89 3.87 12.05 3.06z"></path></svg> ' : '') + ' <span class="caret"></span>\ 1371 </button>\ 1372 <ul class="dropdown-menu" role="menu">\ 1373 '; 1374 $(copy_menu_list).each(function(idx) { 1375 var active_cls = ''; 1376 var depth_cls = ''; 1377 var visible_cls = ''; 1378 var visible_svg = ''; 1379 1380 var menu_str = this; 1381 if(menu_str == 'ì ì²´ìí') return true; 1382 if(currentPageMenu == this) { 1383 currentPageMenuIdx = idx; 1384 active_cls = ' active '; 1385 } 1386 1387 $("#nestable").find(".dd-first, .dd-item:not(.dd-dummy)").each(function () { 1388 var dd_item_id = $(this).attr("data-id"); 1389 if(!dd_item_id) return true; 1390 1391 dd_item_id = dd_item_id.replace(/ /g, '-'); 1392 if(dd_item_id == menu_str) { 1393 if($(this).parents(".dd-item").length) { 1394 depth_cls = ' indent '; 1395 } 1396 1397 if($(this).children(".menu-ctrl").find(".menu-visible").hasClass("invisible")) { 1398 visible_cls = ' visibleoff '; 1399 visible_svg = ' <svg viewBox="0 0 14 12" width="14" height="14"><path d="M12.29 0l-1.88 1.88C9.39 1.32 8.23 1 7 1 3.83 1 1.12 3.07 0 6c0.56 1.46 1.53 2.68 2.73 3.56L1 11.29 1.71 12 13 0.71 12.29 0zM1.09 6C2.15 3.64 4.4 2 7 2c0.95 0 1.86 0.23 2.67 0.62L8.73 3.56C8.24 3.21 7.65 3 7 3 5.34 3 4 4.34 4 6c0 0.65 0.21 1.24 0.56 1.73L3.44 8.85C2.44 8.15 1.62 7.17 1.09 6zM5 6c0-1.1 0.9-2 2-2 0.37 0 0.71 0.11 1.01 0.28L5.28 7.01C5.11 6.71 5 6.37 5 6z"></path><path d="M12.05 3.06l-0.71 0.71C11.99 4.4 12.53 5.15 12.91 6c-1.05 2.36-3.3 4-5.91 4 -0.57 0-1.12-0.09-1.65-0.24l-0.8 0.8C5.32 10.84 6.14 11 7 11c3.17 0 5.88-2.07 7-5C13.57 4.87 12.89 3.87 12.05 3.06z"></path></svg> '; 1400 } 1401 } 1402 }); 1403 1404 1405 1406 // pageMenuSelect += '<option value="' + this + '" ' + (currentPageMenu == this ? ' selected ' : '') + '>
1406' + this + '</option>'; 1407 pageMenuSelect += '<li class="gallery-name ' + active_cls + depth_cls + visible_cls +' " data-page="' + menu_str + '">' + '<span>' + menu_str + '</span>' + visible_svg + '</li>'; 1408 }); 1409 pageMenuSelect += '</ul>'; 1410 $center_area.find(".page-list-area .btn-group").append(pageMenuSelect); 1411 } else { 1412 currentPageMenuIdx = 0; 1413 } 1414 1415 if(reorderFIXED) { 1416 if(el_fixed[2] == 't') { 1417 $center_area.find(".page-list-area .btn-group").html('<h4>' + $.lang[LANG]['config.blockmove.fixedtopblock'] + '</h4><span class="sub">' + $.lang[LANG]['config.blockmove.dragblock'] + '</span>'); 1418 } else if(el_fixed[2] == 'b') { 1419 $center_area.find(".page-list-area .btn-group").html('<h4>' + $.lang[LANG]['config.blockmove.fixedbottomblock'] + '</h4><span class="sub">' + $.lang[LANG]['config.blockmove.dragblock'] + '</span>'); 1420 } 1421 } else if(VIEW) { 1422 $center_area.find(".page-list-area .btn-group").html('<h4>' + $.lang[LANG]['config.blockmove.title'] + '</h4><span class="sub">' + $.lang[LANG]['config.blockmove.dragblock'] + '</span>'); 1423 } 1424 1425 setTimeout(function() { 1426 1427 if(typeof pageList[currentPageMenuIdx] == 'undefined' || typeof pageListChangeFlag[currentPageMenuIdx] == 'undefined') { 1428 1429 $('.new-dsgn-body .contents[data-page="' + currentPageMenu + '"]').remove(); 1430 var pageIndex = 0; 1431 PAGE = currentPageMenu.toString(); 1432 var dsgn_body_clone = $('.dsgn-body').clone().empty().addClass('contents'); 1433 $('.dsgn-body').removeClass('dsgn-body').addClass('prev-dsgn-body'); 1434 $('.new-dsgn-body .elements').append(dsgn_body_clone); 1435 1436 showPageCallback(showPage); 1437 1438 $('.new-dsgn-body .contents.dsgn-body').removeClass('dsgn-body').attr('data-page', currentPageMenu); 1439 $('.prev-dsgn-body').removeClass('prev-dsgn-body').addClass('dsgn-body'); 1440 PAGE = prevPAGE ? prevPAGE.toString() : ''; 1441 1442 pageList[currentPageMenuIdx] = []; 1443 $.each($('.new-dsgn-body .contents[data-page="' + currentPageMenu + '"] .element'),function(i,v) { 1444 if( $(v).hasClass('el-menu') || 1445 $(v).hasClass('el-footer') || 1446 $(v).hasClass('add-footer-information') || 1447 $(v).hasClass('cl-s-product-detail') || 1448 $(v).hasClass('cl-s-product-review') || 1449 $(v).hasClass('cl-s-product-qna') || 1450 $(v).hasClass('cl-s-product-info-notice') || 1451 $(v).hasClass('el-fixedcontact') 1452 ) { 1453 return true; 1454 } 1455 1456 if(reorderFIXED) { 1457 if($(v).hasClass('el-fixedblock')) { 1458 if($(v).attr('data-posby') != el_fixed[2]) return true; 1459 } else return true; 1460 } else { 1461 if($(v).hasClass('el-fixedblock')) return true; 1462 } 1463 1464 if ($(v).hasClass('addEL-wrap')) { 1465 return true; 1466 } 1467 1468 pageList[currentPageMenuIdx][pageIndex] = (LUX && $(v).is('.lux-product-block')) ? 'lux-product-block' : $(v).data('id'); 1469 1470 $(v).find('.hideBlockWrap .blockOn').hide(); 1471 if($(v).find('.hideBlockWrap').length > 0) $(v).addClass('block_checkOnOff'); 1472 pageIndex++; 1473 }); 1474 pageListChangeFlag[currentPageMenuIdx] = true; 1475 } 1476 1477 PAGE = prevPAGE ? prevPAGE.toString() : ''; 1478 1479 var $empty = $('<div class="render sort-empty" data-result-page="' + currentPageMenu + '"> </div>'), 1480 $pageLine = $('<div class="sort-page-line"></div>'), 1481 pageName = currentPageMenu.replace(/,/,'/'), 1482 menulist_index = $.inArray(pageName,MENULIST), 1483 pageNameOrg = pageName=='INTRO' ? pageName : $('#nestable').find('.dd-item').eq(menulist_index-1).attr('data-id'), 1484 $pageInfo = $('<div class="sort-page-info">' + pageNameOrg + '</div>'), 1485 isLink = pageName=='INTRO' || menulist_index == -1 ? false : $('#nestable').find('.dd-item').eq(menulist_index-1).find('.menu-link').first().hasClass('active'); 1486 1487 if(pageName.indexOf('/')>-1 || reorderFIXED) $pageInfo.addClass('hide'); 1488 1489 // $empty.append($pageLine); 1490 // $empty.append($pageInfo); 1491 1492 $empty = (isLink) ? $empty.addClass('use-link') : $empty; 1493 // if(!isLink) $sort.append($empty); 1494 1495 $(pageList[currentPageMenuIdx]).each(function(i,v) { 1496 if(v == 'lux-product-block') { 1497 var element_selector = ($('.new-dsgn-body .lux-product-block').hasClass('reorderBlock')) ? 'reorderBlock' : 'element', 1498 $ndb_el = $('.new-dsgn-body .lux-product-block.' + element_selector); 1499 } else { 1500 var element_selector = ($('.new-dsgn-body [data-id="'+v + '"][data-type]').hasClass('reorderBlock')) ? 'reorderBlock' : 'element', 1501 $ndb_el = $('.new-dsgn-body .' + element_selector + '[data-id="'+v + '"]'); 1502 } 1503 1504 $ndb_el.removeClass('element') 1505 .removeClass('el-active') 1506 .removeClass('active') 1507 .removeClass('emptyGallery') 1508 .removeClass('el-fixedblock') 1509 .removeAttr('data-parallax') 1510 .addClass('render') 1511 .addClass('reorderBlock') 1512 .attr('data-reorder-page',currentPageMenu); 1513 1514 var $el = $ndb_el.clone(); 1515 var isLink = $('#nestable .dd-item[data-id="'+pageNameOrg+'"] > span > .menu-link').hasClass('active'); 1516 if($el.is('[data-parallax="true"]')) { 1517 $el.css('background-attachment','inherit'); 1518 } 1519 1520 if(elIndex==0) { 1521 $el.css('margin','0px'); 1522 if(VIEW && ($el.attr('data-type')=='project' || $el.attr('data-type')=='product')) return true;//$el.addClass('unsort').hide(); 1523 } 1524 if($el.attr('data-msny')=='true' && $el.find('.container').hasClass('full-width')) { 1525 $el.css('padding-left',$('header.sidebar').width()+'px'); 1526 } 1527 1528 if($ndb_el.css('background-color')=='rgba(0, 0, 0, 0)' || $ndb_el.css('background-color')=='transparent') { 1529 $el.css('background-color', '#fff'); 1530 } 1531 1532 $el.find('[data-edit="true"]').removeAttr('data-edit'); 1533 $el.css('position','relative'); 1534 $el.css('min-height','0px'); 1535 $el.css('margin-bottom','120px'); 1536 1537 if($el.attr('data-layout')=="true") $el.css('overflow',''); 1538 1539 if(v == 'lux-product-block') { 1540 $el.html('<div class="lux-product-sample"><h1>ë³¸ì¬ ìí ìì¸ ì ë³´ ë¸ë</h1></div>'); 1541 } 1542 if(!isLink) $sort.append($el); 1543 elIndex++; 1544 1545 }); 1546 var $last = $('<div class="sort-empty guide-text" style="display: none;">' + $.lang[LANG]['config.blockmove.movehere'] + '</div>'); 1547 if(pageList[currentPageMenuIdx].length == 0 || typeof pageList[currentPageMenuIdx] == 'undefined') $last.show(); 1548 $sort.append($last); 1549 $scale.append($sort); 1550 1551 $scale.css('height', 'auto'); 1552 1553 var target_contents = $('.new-dsgn-body .elements .contents[data-page="' + currentPageMenu + '"]'); 1554 var setting_height = target_contents.height() / 5 + $(".page-list-area").outerHeight() + 120; 1555 1556 $scale.height(setting_height); 1557 $center_area.height(setting_height); 1558 1559 $center_area.find('.reorderBlock[data-msny="true"]').each(function() { 1560 var cnt = 0; 1561 var total = $(this).find(".row").data("view"); 1562 var target = this; 1563 $(target).imagesLoaded().progress(function(imgload, image) { 1564 cnt ++; 1565 if(total == cnt || cnt == $(target).find(".row .gallery-item").length) { 1566 setTimeout(function() { 1567 $(target).find(".row").masonry(); 1568 }, 1) 1569 } 1570 }); 1571 }); 1572 1573 if($center_area.find('[data-map_kind="kakao"]').length && (typeof kakao == 'undefined' || typeof kakao.maps == 'undefined' ||
1573kakao.maps == null || VALIDPLAN == '')) { 1574 $center_area.find('[data-map_kind="kakao"]').html('ì§ëì°ê²°í´ì ë¨. Javascriptí¤ íì¸'); 1575 $center_area.find('[data-map_kind="kakao"]').html('<iframe class="google-map" src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3165.5659473821083!2d127.0282496015659!3d37.494568!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x357ca1598c361b2b%3A0xdbf9af292beff3c!2z6rCV64Ko!5e0!3m2!1sko!2skr!4v1637303748377!5m2!1sko!2skr" width="600" height="450" style="border:0;" allowfullscreen="" loading="lazy"></iframe>'); 1576 } else { 1577 $center_area.find('[data-map_kind="kakao"]').each(function() { 1578 var container = this; 1579 var lat = $(this).data("lat"); 1580 var lng = $(this).data("lng"); 1581 var options = { center: new kakao.maps.LatLng(lat, lng), level: 3}; 1582 var c_map = new kakao.maps.Map(container, options); 1583 var marker = new kakao.maps.Marker({ position: new kakao.maps.LatLng(lat, lng), map: c_map}); 1584 var zoomInOut = $(this).data("zoominout"); 1585 var mapTitle = $(this).data("maptitle"); 1586 var mapContent = $(this).data("mapcontent"); 1587 var useTitle = $(this).data("usetitle"); 1588 var useContent = $(this).data("usecontent"); 1589 if(typeof zoomInOut == 'undefined' || !zoomInOut) zoomInOut = false; 1590 if(typeof mapTitle == 'undefined' || !mapTitle) mapTitle = ''; 1591 if(typeof mapContent == 'undefined' || !mapContent) mapContent = ''; 1592 if(typeof useTitle == 'undefined' || !useTitle) useTitle = false; 1593 if(typeof useContent == 'undefined' || !useContent) useContent = false; 1594 1595 if(zoomInOut == true) { 1596 // var mapTypeControl = new kakao.maps.MapTypeControl(); 1597 // c_map.addControl(mapTypeControl, kakao.maps.ControlPosition.TOPRIGHT); 1598 // var zoomControl = new kakao.maps.ZoomControl(); 1599 // c_map.addControl(zoomControl, kakao.maps.ControlPosition.RIGHT); 1600 var zoomControlHtml = ''; 1601 zoomControlHtml += '\ 1602 <div class="zoom-control" style="margin-top: 8px; margin-right: 8px; right: 0; width: 30px; position: absolute; background-color: #fff; z-index: 1; border-radius: 3px; box-shadow: 0 2px 3px 0 rgba(0, 0, 0, 0.16);">\ 1603 <div class="btn-zoom-control" data-inout="I" style="cursor: pointer; width: 30px; height: 30px;">\ 1604 <svg style="fill: #6b6b6b; margin: 3px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path d="M17 11h-4V7c0-.55-.45-1-1-1s-1 .45-1 1v4H7c-.55 0-1 .45-1 1s.45 1 1 1h4v4c0 .55.45 1 1 1s1-.45 1-1v-4h4c.55 0 1-.45 1-1s-.45-1-1-1z"/></svg>\ 1605 </div>\ 1606 <div class="slider-wrap-container" style="height: 130px;">\ 1607 <div class="slider-wrap small" style="text-align: center; height: 100%;">\ 1608 <div style="max-height: 100%;" class="zoom-control-slider"></div>\ 1609 </div>\ 1610 </div>\ 1611 <div class="btn-zoom-control" data-inout="O" style="cursor: pointer; width: 30px; height: 30px;">\ 1612 <svg style="fill: #6b6b6b; margin: 3px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path d="M17 13H7c-.55 0-1-.45-1-1s.45-1 1-1h10c.55 0 1 .45 1 1s-.45 1-1 1z"/></svg>\ 1613 </div>\ 1614 </div>\ 1615 '; 1616 var $zoomController = $(zoomControlHtml); 1617 $(container).append($zoomController); 1618 var zoom_slider = $zoomController.find('.zoom-control-slider').slider({ 1619 'orientation': 'vertical', 1620 'min' : 1, 1621 'max' : 14, 1622 'step' : 1, 1623 'value' : 3, 1624 'handle' : 'square', 1625 // 'reversed' : true, 1626 'tooltip' : 'hide', 1627 }).on('slide', function(data) { 1628 c_map.setLevel(data.value); 1629 c_map.setCenter(marker.getPosition()); 1630 }).on('slideStop', function(data) { 1631 c_map.setLevel(data.value); 1632 c_map.setCenter(marker.getPosition()); 1633 }); 1634 1635 $zoomController.find('.btn-zoom-control').on('click', function() { 1636 if($(this).data('inout') == 'I') { 1637 c_map.setLevel(c_map.getLevel() - 1); 1638 zoom_slider.slider('setValue', c_map.getLevel()); 1639 } else if($(this).data('inout' == 'O')) { 1640 c_map.setLevel(c_map.getLevel() + 1); 1641 zoom_slider.slider('setValue', c_map.getLevel()); 1642 } 1643 }); 1644 1645 kakao.maps.event.addListener(c_map, 'zoom_changed', function() { 1646 zoom_slider.slider('setValue', c_map.getLevel()); 1647 }); 1648 } 1649 1650 if((useTitle == true || useContent == true) && (mapTitle || mapContent)) { 1651 var iwContent = ''; 1652 if(useTitle == true && mapTitle) { 1653 iwContent = '<div class="title">' + mapTitle + '</div>'; 1654 } 1655 if(useContent == true && mapContent) { 1656 iwContent += '<div class="content">' + mapContent + '</div>'; 1657 } 1658 1659 if(iwContent) { 1660 iwContent = '<div class="contact-map-info-window"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path d="M8 0C4.69 0 2 2.69 2 6s1 4 6 10c5-6 6-6.69 6-10s-2.69-6-6-6zm0 8.3a2.3 2.3 0 1 1 0-4.6 2.3 2.3 0 0 1 0 4.6z"/></svg>
1660' + iwContent + '</div>'; 1661 var infoWindow = $(iwContent); 1662 $(container).append(infoWindow); 1663 // infoWindow.css('bottom', 'calc(-100% + ' + (infoWindow.outerHeight() + 36) + 'px)'); 1664 } 1665 } 1666 1667 $(window).on("resize", function() { 1668 c_map.setCenter(marker.getPosition()); 1669 }); 1670 }); 1671 } 1672 1673 if($center_area.find('[data-map_kind="naver"]').length && (typeof naver == 'undefined' || typeof naver.maps == 'undefined' || naver.maps == null || VALIDPLAN == '')) { 1674 $center_area.find('[data-map_kind="naver"]').html('ì§ëì°ê²°í´ì ë¨. Client ID íì¸'); 1675 $center_area.find('[data-map_kind="naver"]').html('<iframe class="google-map" src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3165.5659473821083!2d127.0282496015659!3d37.494568!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x357ca1598c361b2b%3A0xdbf9af292beff3c!2z6rCV64Ko!5e0!3m2!1sko!2skr!4v1637303748377!5m2!1sko!2skr" width="600" height="450" style="border:0;" allowfullscreen="" loading="lazy"></iframe>'); 1676 } else { 1677 $center_area.find('[data-map_kind="naver"]').each(function() { 1678 var container = this; 1679 var lat = $(this).data("lat"); 1680 var lng = $(this).data("lng"); 1681 var options = { center: new naver.maps.LatLng(lat, lng), zoom: 17}; 1682 var zoomInOut = $(this).data("zoominout"); 1683 var mapTitle = $(this).data("maptitle"); 1684 var mapContent = $(this).data("mapcontent"); 1685 var useTitle = $(this).data("usetitle"); 1686 var useContent = $(this).data("usecontent"); 1687 if(typeof zoomInOut == 'undefined' || !zoomInOut) zoomInOut = false; 1688 if(typeof mapTitle == 'undefined' || !mapTitle) mapTitle = ''; 1689 if(typeof mapContent == 'undefined' || !mapContent) mapContent = ''; 1690 if(typeof useTitle == 'undefined' || !useTitle) useTitle = false; 1691 if(typeof useContent == 'undefined' || !useContent) useContent = false; 1692 1693 var c_map = new naver.maps.Map(container, options); 1694 var marker = new naver.maps.Marker({ position: new naver.maps.LatLng(lat, lng), map: c_map}); 1695 1696 if(zoomInOut == true) { 1697 // options.zoomControl = true; 1698 // options.zoomControlOptions = { 1699 // position: naver.maps.Position.RIGHT_CENTER 1700 // }; 1701 1702 var zoomControlHtml = ''; 1703 zoomControlHtml += '\ 1704 <div class="zoom-control" style="margin-top: 8px; margin-right: 8px; right: 0; width: 30px; position: absolute; background-color: #fff; z-index: 1; border-radius: 3px; box-shadow: 0 2px 3px 0 rgba(0, 0, 0, 0.16);">\ 1705 <div class="btn-zoom-control" data-inout="I" style="cursor: pointer; width: 30px; height: 30px;">\ 1706 <svg style="fill: #6b6b6b; margin: 3px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path d="M17 11h-4V7c0-.55-.45-1-1-1s-1 .45-1 1v4H7c-.55 0-1 .45-1 1s.45 1 1 1h4v4c0 .55.45 1 1 1s1-.45 1-1v-4h4c.55 0 1-.45 1-1s-.45-1-1-1z"/></svg>\ 1707 </div>\ 1708 <div class="slider-wrap-container" style="height: 130px;">\ 1709 <div class="slider-wrap small" style="text-align: center; height: 100%;">\ 1710 <div style="max-height: 100%;" class="zoom-control-slider"></div>\ 1711 </div>\ 1712 </div>\ 1713 <div class="btn-zoom-control" data-inout="O" style="cursor: pointer; width: 30px; height: 30px;">\ 1714 <svg style="fill: #6b6b6b; margin: 3px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">
1714<path d="M17 13H7c-.55 0-1-.45-1-1s.45-1 1-1h10c.55 0 1 .45 1 1s-.45 1-1 1z"/></svg>\ 1715 </div>\ 1716 </div>\ 1717 '; 1718 var $zoomController = $(zoomControlHtml); 1719 $(container).append($zoomController); 1720 var zoom_slider = $zoomController.find('.zoom-control-slider').slider({ 1721 'orientation': 'vertical', 1722 'min' : 6, 1723 'max' : 21, 1724 'step' : 1, 1725 'value' : 17, 1726 'handle' : 'square', 1727 'reversed' : true, 1728 'tooltip' : 'hide', 1729 }).on('slide', function(data) { 1730 c_map.setZoom(data.value); 1731 c_map.setCenter(marker.getPosition()); 1732 }).on('slideStop', function(data) { 1733 c_map.setZoom(data.value); 1734 c_map.setCenter(marker.getPosition()); 1735 }); 1736 $zoomController.find('.btn-zoom-control').on('click', function() { 1737 if($(this).data('inout') == 'I') { 1738 c_map.setZoom(c_map.getZoom() + 1); 1739 zoom_slider.slider('setValue', c_map.getZoom()); 1740 } else if($(this).data('inout' == 'O')) { 1741 c_map.setZoom(c_map.getZoom() - 1); 1742 zoom_slider.slider('setValue', c_map.getZoom()); 1743 } 1744 }); 1745 1746 naver.maps.Event.addListener(c_map, 'zoom_changed', function(zoom) { 1747 zoom_slider.slider('setValue', c_map.getZoom()); 1748 }); 1749 } 1750 1751 if((useTitle == true || useContent == true) && (mapTitle || mapContent)) { 1752 var iwContent = ''; 1753 if(useTitle == true && mapTitle) { 1754 iwContent = '<div class="title">' + mapTitle + '</div>'; 1755 } 1756 if(useContent == true && mapContent) { 1757 iwContent += '<div class="content">' + mapContent + '</div>'; 1758 } 1759 1760 if(iwContent) { 1761 iwContent = '<div class="contact-map-info-window"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path d="M8 0C4.69 0 2 2.69 2 6s1 4 6 10c5-6 6-6.69 6-10s-2.69-6-6-6zm0 8.3a2.3 2.3 0 1 1 0-4.6 2.3 2.3 0 0 1 0 4.6z"/></svg>' + iwContent + '</div>'; 1762 var infoWindow = $(iwContent); 1763 $(container).append(infoWindow); 1764 // infoWindow.css('bottom', 'calc(-100% + ' + (infoWindow.outerHeight() + 36) + 'px)'); 1765 } 1766 } 1767 $(window).on("resize", function() { 1768 c_map.setCenter(marker.getPosition()); 1769 }); 1770 1771 c_map.setSize(new naver.maps.Size($(container).outerWidth(), $(container).outerHeight())); 1772 }); 1773 } 1774 1775 // $.each($('.sort-empty'),function(i,v) { 1776 // if($(this).next().hasClass('sort-empty') && !$(this).next().hasClass('page')) { 1777 // var $empty = $('<div class="sort-empty page">PAGE EMPTY</div>'); 1778 // //var $empty = ($(this).hasClass('use-link')) ? $('<div class="sort-empty page">PAGE LINKED</div>') : $('<div class="sort-empty page">PAGE EMPTY</div>'); 1779 // if(!$(this).hasClass('page')) $(this).after($empty); 1780 // } 1781 // }); 1782 1783 // $('.reorderModal').scrollTo('.reorderBlock[data-id="' + selectID + '"]',{offset:-200}); 1784 // $('.reorderBlock[data-id="' + selectID + '"]').addClass('active'); 1785 1786 // reorder page click 1787 $center_area.find(".page-list-area .gallery-name").on("click", function() { 1788 $.reorderON($(this).data('page')); 1789 }); 1790 $center_area.find('.video-gallery-url').attr('data-gallery',''); 1791 1792 // reorder gallery gjs setting 1793 $('.reorderModal .center-area .reorderBlock[data-type="gallery"] input.gjs').parents('.element[data-type="gallery"]').each(function() { 1794 setGalleryJS('reorder-block',$(this)); 1795 }); 1796 1797 blockSortable(); 1798 $.processOFF(); 1799 }); 1800 } 1801 1802 jQuery.reorderOFF = function() { 1803 window.basketBlockHtml = ''; 1804 window.pageList = []; 1805 window.pageListChangeFlag = []; 1806 $(".new-dsgn-body").remove(); 1807 $('.reorderModal').fadeOut(function() { 1808 $(this).remove(); 1809 reorderFIXED = ''; 1810 }); 1811 } 1812 1813 jQuery.viewON = function() { 1814 var $view = $('<div class="viewModal"></div>'); 1815 1816 if ($('.viewModal').length < 1) { 1817 $view.css({ 1818 'position' : 'fixed', 1819 'width' : '100%', 1820 'height' : '100%', 1821 'background' : '#FFF url(https://storage.googleapis.com/i.addblock.net/preloader2.gif) center center no-repeat', 1822 'z-index' : '10000000000', 1823 'display' : 'none', 1824 'overflow' : 'auto' 1825 }); 1826 $('body').prepend($view); 1827 var $content = $('<div class="content"></div>'), 1828 $h1 = $('<h1></h1>').css({ 1829 'position' : 'absolute', 1830 'z-index' : '100001', 1831 'right' : '0px' 1832 }),
1833 $close = $('<div class="pull-right"><i class="fa fa-times"></i></div>').css({ 1834 'margin-right' : '18px', 1835 'margin-top' : '-16px', 1836 'background-color': '#556273', 1837 'color': '#fff', 1838 'font-size': '18px', 1839 'padding': '6px 9px', 1840 'cursor': 'pointer', 1841 'border-radius' : '20px' 1842 }), 1843 $iframe = $('<iframe src="http://' + SID + '.' + HOST + '/render/' + PAGE + '"></iframe>'); 1844 1845 $iframe.css({ 1846 'position' : 'absolute', 1847 'top' : '0', 1848 'left' : '0', 1849 'width' : '100%', 1850 'height' : '100%', 1851 'z-index' : '100000', 1852 'border' : 'none' 1853 }); 1854 1855 1856 $close.on('click',function() { 1857 $.viewOFF(); 1858 }); 1859 $content.append($h1).append($iframe); 1860 $h1.append($close); 1861 $view.append($content); 1862 $view.fadeIn(); 1863 } 1864 } 1865 1866 jQuery.viewOFF = function() { 1867 $('.viewModal').fadeOut(function() { 1868 $(this).remove(); 1869 }); 1870 } 1871 1872 jQuery.historyON = function() { 1873 viewmode('view'); 1874 } 1875 1876 $.fn.showUpgradePlanModal = function(sid, plan, upgrade_plan, fn) { 1877 if($('.site-upgrade-wrap').length > 0 || typeof checkUpgradeModal != "undefined" && checkUpgradeModal) return false; 1878 var checkUpgradeModal = true; 1879 1880 var check_plan = (!plan || plan == 'FR' || plan == 'FREE') ? false : true, 1881 log_fn = (!fn) ? '' : '.' + fn, 1882 log_plan = (!upgrade_plan) ? '' : '.' + upgrade_plan, 1883 upgrade_plan = (!upgrade_plan) ? '' : '/plan/' + upgrade_plan, 1884 upgrade_url = (!upgrade_plan) ? '/upgrade' : ((check_plan) ? '/upgrade/change/site/' + sid + upgrade_plan : '/upgrade/buy/site/' + sid + upgrade_plan), 1885 modal_title = $.lang[LANG]['config.upgrade-plan' + log_plan + log_fn + '.title'], 1886 modal_description = $.lang[LANG]['config.upgrade-plan' + log_plan + log_fn + '.description'], 1887 str = '\ 1888 <div class="site-upgrade-wrap">\ 1889 <p class="description">' + modal_description + '</p>\ 1890 <div class="btn-box">\ 1891 <a href="' + upgrade_url + '"><i class="fa fa-level-up"></i>'+$.lang[LANG]['config.upgrade-plan.btn']+'</a>\ 1892 </div>\ 1893 </div>\ 1894 '; 1895 1896 var modal = $(this).showModalFlat(modal_title, str, false, false, '', '', '', '', '', '', '', function() { 1897 checkUpgradeModal = false; 1898 }); 1899 } 1900 1901 $.fn.showModal = function (header, content, footer, cancel, confirm, callback, backdrop) { 1902 $('.editor-navbar').css('z-index','1030'); 1903 var HTML = '<div class="modal modal-default fade" id="generic-modal">' + 1904 ' <div class="modal-dialog" style="padding-top:5%;">' + 1905 ' <div class="modal-content">' + 1906 ' <button type="" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true"><img src="https://storage.googleapis.com/i.addblock.net/fa-close-modal.png" alt="close"></span></button>' + 1907 ' <div class="modal-body">' + 1908 ' <h3 class="modal-title">' + header + 1909 ' </h3>' + content + 1910 ' </div>'; 1911 if(footer==true) { 1912 HTML = HTML + '<div class="modal-footer">'; 1913 if(cancel == true) { 1914 HTML = HTML + '<button type="button" class="btn btn-default btn-sm" data-dismiss="modal">ì·¨ì</button>'; 1915 } else if(confirm == true) { 1916 HTML = HTML + '<button type="button" class="btn btn-primary btn-sm ok-button-dialog">íì¸1</button>'; 1917 } 1918 HTML = HTML + 1919 ' </div>'; 1920 } 1921 HTML = HTML + 1922 ' </div>' + 1923 ' </div>' + 1924 '</div>'; 1925
1926 var container = $('<div class="generic-modal"></div>').html(HTML); 1927 $('body').append(container); 1928 var newInstance = jQuery.extend(true, {}, container); 1929 newInstance.find('.ok-button-dialog').bind('click', function () { 1930 callback(); 1931 }); 1932 var modalElement = newInstance.find('#generic-modal'); 1933 if(backdrop) modalElement.modal({ backdrop : 'static', keboard : false}); 1934 else modalElement.modal(); 1935 1936 modalElement.on('hidden.bs.modal', function(e) { 1937 // $('.editor-navbar').css('z-index','1040'); 1938 $('.generic-modal').remove(); 1939 $('.modal-backdrop').remove(); 1940 }); 1941 1942 return modalElement; 1943 } 1944 1945 1946 $.fn.showModalFlat = function (header, content, footer, confirm, callback, closetext, oktext, size, backdrop, closecallback, showcallback, hidecallback, buttontop) { 1947 /** 1948 * @param header 1949 * @param content 1950 * @param footer 1951 * @param confirm 1952 * @param callback 1953 * @param closetext 1954 * @param oktext 1955 * @param size 1956 * @param backdrop 1957 * @param closecallback 1958 * @param showcallback 1959 * @param hidecallback 1960 * */ 1961 // if($('#flat-modal.event').length) return; 1962 1963 size = (typeof size == 'undefined') ? '' : size; 1964 1965 var buttontop = (typeof buttontop != 'undefined' && buttontop) ? buttontop : false; 1966 var reg_zindex = /\bzindex(\d+)\b/; 1967 var matches = size.match(reg_zindex); 1968 var zindex = (matches) ? matches[1] * 1 : -1; 1969 1970 if(!matches && $('.bc-modal.open').length > 0) zindex = 1043; 1971 1972 if(size.indexOf(',') > -1) { 1973 var modal_name = size.split(','); 1974 var modal_class = ''; 1975 1976 size = modal_name[0]; 1977 modal_class = modal_name[1]; 1978 } 1979 1980 var noBackdrop = (typeof backdrop != 'undefined' && backdrop === 'none') ? true : false; 1981 backdrop = (typeof backdrop != 'undefined' && backdrop === true) ? true : false; 1982 1983 // $('.editor-navbar').css('z-index','1030'); 1984 1985 var checkCLBtnMode = (size.indexOf('cl-s-btn') > -1) ? true : false, 1986 close_btn = $.lang[LANG]['config.close'], 1987 close_btn_class = 'btn-default', 1988 ok_btn = $.lang[LANG]['config.ok'], 1989 ok_btn_class = 'btn-primary', 1990 btn_html = ''; 1991 1992 if( closetext == 'cancel') { 1993 close_btn = $.lang[LANG]['config.cancel']; 1994 } else if( closetext == 'close' ) { 1995 close_btn = $.lang[LANG]['config.close']; 1996 } else if( closetext == 'ok' || closetext == 'notice.ok' ) { 1997 close_btn = $.lang[LANG]['config.'+closetext]; 1998 close_btn_class = 'btn-primary ok-button-dialog'; 1999 } else if( closetext == 'move.cancel' ) { 2000 close_btn = $.lang[LANG]['config.'+closetext]; 2001 close_btn_class = 'closemodal'; 2002 } else if ( typeof closetext != 'undefined') { 2003 if( closetext.match(/\./g) !== null ) close_btn = $.lang[LANG][closetext]; 2004 else if(closetext.length > 0) close_btn = closetext; 2005 } 2006 2007 if( oktext == 'save' ) { 2008 ok_btn = $.lang[LANG]['config.save']; 2009 } else if( oktext == 'send' ) { 2010 ok_btn = $.lang[LANG]['config.send']; 2011 } else if( oktext == 'ok' ) { 2012 ok_btn = $.lang[LANG]['config.ok']; 2013 } else if( oktext == 'move.ok' ) { 2014 ok_btn = $.lang[LANG]['config.'+oktext]; 2015 ok_btn_class = 'btn-primary ok-button-dialog movetocreatorlink'; 2016 } else if( oktext == 'move.ok2' ) { 2017 ok_btn = $.lang[LANG]['config.'+oktext]; 2018 ok_btn_class = 'btn-primary ok-button-dialog movetocreatorlink'; 2019 } else if( oktext == 'move.domain' ) { 2020 ok_btn = $.lang[LANG]['config.'+oktext]; 2021 ok_btn_class = 'btn-primary ok-button-dialog movedomain'; 2022 } else if ( typeof oktext != 'undefined') { 2023 if( oktext.match(/\./g) !== null ) ok_btn = $.lang[LANG][oktext]; 2024 else if(oktext.length > 0) ok_btn = oktext; 2025 } 2026 var flat_modal_cnt = $('.modal-default').length, 2027 flat_modal_id = (flat_modal_cnt == 0) ? 'flat-modal': 'flat-modal'+flat_modal_cnt, 2028 btn_html_close = '<button type="button" class="btn '+ close_btn_class +' btn-sm close-button-dialog" data-dismiss="modal">' + close_btn + '</button>'; 2029 2030 if(confirm == true) { 2031 if(checkCLBtnMode) { 2032 var btn_html_ok = '<button type="button" class="btn '+ ok_btn_class +' btn-sm ok-button-dialog">' + ok_btn + '</button>'; 2033 btn_html_ok = (buttontop && (oktext == '')) ? '' : btn_html_ok; 2034 btn_html = btn_html_ok + btn_html_close; 2035 } else { 2036 btn_html = btn_html_close + '<button type="button" class="btn '+ ok_btn_class +' btn-sm ok-button-dialog">' + ok_btn + '</button>'; 2037 } 2038 } else btn_html = btn_html_close; 2039 2040 var HTML = '<div class="modal modal-default fade" id="'+flat_modal_id+'">' + 2041 ' <div class="modal-dialog '+size+'">' + 2042 ' <div class="modal-content" data-buttontop="'+buttontop+'">' + 2043 ' <button type="" class="close close-button-dialog" data-dismiss="modal" aria-label="Close"><span aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path d="M8.71 8l7.15-7.15c0.2-0.2 0.2-0.51 0-0.71s-0.51-0.2-0.71 0L8 7.29 0.85 0.15c-0.2-0.2-0.51-0.2-0.71 0s-0.2 0.51 0 0.71L7.29 8l-7.15 7.15c-0.2 0.2
2043-0.2 0.51 0 0.71C0.24 15.95 0.37 16 0.5 16s0.26-0.05 0.35-0.15L8 8.71l7.15 7.15c0.1 0.1 0.23 0.15 0.35 0.15s0.26-0.05 0.35-0.15c0.2-0.2 0.2-0.51 0-0.71L8.71 8z"/></svg></span></button>' + 2044 ' <div class="modal-body">'; 2045 HTML += (buttontop) ? '\ 2046 <div class="modal-top">\ 2047 <div class="modal-title-wrap">\ 2048 <h3 class="modal-title">' + header + '</h3>\ 2049 </div>\ 2050 <div class="modal-title-button">' + btn_html_close + btn_html_ok + '</div>\ 2051 </div>' : '<h3 class="modal-title">' + header + '</h3>'; 2052 HTML += content +'\ 2053 </div>'; 2054 if(footer==true) { 2055 HTML = HTML + 2056 ' <div class="modal-footer">'; 2057 HTML = HTML + btn_html + 2058 ' </div>'; 2059 } 2060 HTML = HTML + 2061 ' </div>' + 2062 ' </div>' + 2063 '</div>'; 2064 2065 var time = new Date().getTime();
2066 var container = $('<div class="flat-modal"></div>').html(HTML); 2067 2068 if(typeof modal_class != "undefined" && modal_class) container.addClass(modal_class); 2069 if(size && size.indexOf('cl-modal') > 0 || (size && size.indexOf('cl-cmmodal') > -1)) { 2070 var mobile_close_btn = '\ 2071 <button class="cl-mobile-btn close" data-dismiss="modal" aria-label="Close">\ 2072 <span aria-hidden="true">\ 2073 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\ 2074 <polygon points="16 1 15 0 8 7 1 0 0 1 7 8 0 15 1 16 8 9 15 16 16 15 9 8 "/>\ 2075 </svg>\ 2076 </span>\ 2077 </button>\ 2078 '; 2079 2080 container.find('.modal').prepend(mobile_close_btn); 2081 2082 if(confirm==false && (closetext=='close' || closetext=='cancel')) container.find('.close-button-dialog').addClass('clostbtnfalse'); //ë«ê¸° ë²í¼ íëì¼ ê²½ì° ê³µíµ class 2083 if(footer==true && container.find('.cl-cmmodal').hasClass('fullcover-modal-scroll') && container.find('.modal-footer').find('button').length==1) container.find('.cl-cmmodal').addClass('single-btn'); // fullcover ë²í¼ íëì¼ê²½ì° 2084 2085 if(size.indexOf('cl-modal') > -1) container.addClass('cl-flat-modal'); 2086 else if(size.indexOf('cl-cmmodal') > -1) container.addClass('cl-common-modal'); 2087 if(size.indexOf('cl-alert') > -1) container.addClass('cl-alert-modal'); 2088 2089 if(size.indexOf('confirm-resource-folder-delete') && size.indexOf('modal-over-1') > -1) container.addClass('modal-over-1'); 2090 2091 if(size.indexOf('pg-modal') > -1) container.addClass('pg-modal-wrap'); 2092 else if(size.indexOf('cl-common-notice') > -1) { //ê³µíµ notice icon ì¶ê° 2093 var svg = '\ 2094 <svg xmlns="http://www.w3.org/2000/svg" class="cl-notice-icon" viewBox="0 0 90 90" width="90" height="90"><path d="M45 4c22.61 0 41 18.39 41 41S67.61 86 45 86 4 67.61 4 45 22.39 4 45 4M45 0C20.15 0 0 20.15 0 45s20.15 45 45 45 45-20.15 45-45S69.85 0 45 0L45 0z"/>\ 2095 <path d="M45 20L45 20c1.1 0 2 0.9 2 2v32c0 1.1-0.9 2-2 2h0c-1.1 0-2-0.9-2-2V22C43 20.9 43.9 20 45 20z"/><circle cx="45" cy="67" r="3"/>\ 2096 </svg>\ 2097 '; 2098 container.find('.modal-title').before(svg); 2099 if(size.indexOf('modal-over-1') > -1) container.addClass('modal-over-1'); 2100 } else if(size.indexOf('guidePopup') > -1) { 2101 container.find('.modal-title').not('.guidetitle').remove(); 2102 container.addClass('guidePopup-wrap'); 2103 } else if(size.indexOf('modal-product-badge') > -1) { 2104 container.addClass('modal-product-badge-wrap'); 2105 if(size.indexOf('cl-change-badge-design') > -1) { 2106 container.addClass('modal-change-badge-design-wrap'); 2107 } 2108 } else if(size.indexOf('cl-delete-badge-image') > -1) { 2109 container.addClass('modal-delete-badge-image'); 2110 } else if(size.indexOf('modal-addFranchiseBar') > -1) { 2111 container.addClass('modal-addFranchiseBar-wrap'); 2112 } 2113 } 2114 2115 $('body').append(container); 2116 var newInstance = jQuery.extend(true, {}, container); 2117 var modalElement = newInstance.find('#'+flat_modal_id); 2118 if(noBackdrop) modalElement.modal({ backdrop : false}); 2119 else if(backdrop) modalElement.modal({ backdrop : 'static'}); 2120 else modalElement.modal(); 2121 2122 if(zindex > -1) { 2123 modalElement.css('z-index', zindex); 2124 modalElement.closest('.flat-modal').next('.modal-backdrop').attr('style','z-index: '+(zindex-1)+'!important;'); 2125 } 2126 2127 newInstance.find('.ok-button-dialog').bind('click', function () { 2128 if(typeof callback == 'function') 2129 callback(); 2130 }); 2131 2132 newInstance.find('.close-button-dialog').bind('click', function () { 2133 if(typeof closecallback == 'function') { 2134 closecallback(); 2135 } 2136 }); 2137 2138 modalElement.on('shown.bs.modal', function(e) { 2139 if($('#ch-plugin').length > 0) $('#ch-plugin').attr('style','z-index: 1 !important; pointer-events: none !important;'); 2140 var modal = document.querySelector('.modal'); 2141 // modal.style.position = 'absolute'; 2142 // setTimeout(function() { 2143 modal.style.position = 'fixed'; 2144 // },0); 2145 if(typeof showcallback == 'function') showcallback(); 2146 }); 2147 2148 modalElement.on('hide.bs.modal', function(e) {
2149 if($(this).find('input:focus').length > 0) { 2150 e.preventDefault(); 2151 return false; 2152 } 2153 }); 2154 2155 modalElement.on('hidden.bs.modal', function(e) { 2156 if(typeof isEDIT != 'undefined' && isEDIT === false) editEL = ''; 2157 if(typeof hidecallback == 'function') hidecallback(); 2158 var flat_modal_id = $(this).attr('id'); 2159 // $('.editor-navbar').css('z-index','1040'); 2160 var this_modal = $('#'+flat_modal_id).closest('.flat-modal'); 2161 this_modal.next('.modal-backdrop').remove(); 2162 this_modal.remove(); 2163 2164 if($('.modal-backdrop').length) { 2165 setTimeout(function() { 2166 $('body').addClass('modal-open'); 2167 },10); 2168 } 2169 $('body').removeClass('no-fixed'); 2170 if($('#ch-plugin').length > 0) $('#ch-plugin').attr('style','z-index: 10000000 !important; pointer-events: auto !important;'); 2171 }); 2172 2173 return modalElement; 2174 } 2175 2176 $.fn.showPopupModal = function (data,sid) { 2177 // console.log('showPopupModal'); 2178 2179 var img_count = data.length, 2180 img_w = new Array(), 2181 img_h = new Array(), 2182 counter = 0, 2183 sid = (typeof sid != 'undefined') ? sid : SID, 2184 popup_data = new Array(); 2185 2186 $('#el-empty').html(''); 2187 $.each(data,function(i,v) { 2188 var check_img = v.popupimg + '?' + new Date().getTime(); 2189 var $img = $('<img/>').attr('src',check_img); 2190 $img.error(function() { 2191 data[i]['popupimg'] = '//storage.googleapis.com/i.addblock.net/img_broken_fill_500.png'; 2192 $(this).attr('src', '//storage.googleapis.com/i.addblock.net/img_broken_fill_500.png'); 2193 }); 2194 $('#el-empty').append($img); 2195 }); 2196 2197 var $imgs = $('#el-empty img'); 2198 $.each($imgs,function(i,v) { 2199 $(this).one('load',function() { 2200 counter++; 2201 img_w[i] = this.width; 2202 img_h[i] = this.height;
2203 if(counter == img_count) getPopupFunction(); 2204 }); 2205 if(this.complete) $(this).load(); 2206 }); 2207 2208 function getPopupFunction() { 2209 $('#el-empty').html(''); 2210 var html = '', 2211 display = new Array(); 2212 2213 $.each(data, function(i,o) { 2214 var isCookie = ($.cookie(sid + 'Popup' + i)) ? 'style= display:none;' : ''; 2215 display.push(isCookie); 2216 2217 var plink = (typeof o.popuplink != 'undefined' && o.popuplink != 'javascript:;' && o.popuplink.length > 0) ? o.popuplink : 'javascript:;', 2218 plink_target = (typeof o.popuplink_target != 'undefined' && o.popuplink_target === true) ? 'target="_blank"' : '', 2219 link_option = ''; 2220 2221 if(typeof o.popuplink == 'undefined') o.popuplink = ''; 2222 if(typeof o.popuplink_target == 'undefined') o.popuplink_target = ''; 2223 if(typeof o.popuptime == 'undefined') o.popuptime = ''; 2224 2225 if(plink != '' && plink != 'javascript:;') { 2226 if(checkBase64Encode(plink)) plink = Base64.decode(plink); 2227 var _menuList = (PAGE_MODE == 'c') ? MENULIST : property.MENULIST; 2228 2229 if(plink.match(/^\@/g) !== null) { // link-type: link-bookmark ==> a[attr-bookmark] 2230 var _settings = (PAGE_MODE == 'c') ? SETTINGS : property.SETTINGS, 2231 bookmark_seq = plink.replace(/^\@/g,''); 2232 2233 if(typeof _settings == 'undefined' || typeof _settings.blockBookmarkList == 'undefined' || _settings.blockBookmarkList['bookmark' + bookmark_seq] == 'undefined') { 2234 plink = ''; 2235 link_option = ''; 2236 } else { 2237 link_option = 'attr-bookmark="' + bookmark_seq + '"'; 2238 } 2239 } else if(plink.match(/^flink\@[0-9]/gi) !== null) { // link-type: link-file ==> a[attr-flink] 2240 link_option = 'attr-flink="' + plink.replace(/^flink\@/gi,'') + '"'; 2241 plink_target = ''; 2242 } else if(_menuList.indexOf(plink.replace(/^\//g,"").replace(/ /g,"-")) > -1) { // link-type: link-menu ==> a[data-user-link] 2243 link_option = 'data-user-link="' + plink + '"'; 2244 } else { // link-type: link-out ==> a[attr-link] 2245 link_option = 'attr-link="' + plink + '"'; 2246 } 2247 2248 plink = (PAGE_MODE == 'c') ? makeLinkUrl(plink, ONE, VIEW) : makeLinkUrl(plink, property.ONE, property.VIEW); 2249 } 2250 2251 html = html + '<div class="modal-popup" id="' + sid + 'Popup' + i + '" data-link="' + plink + '" data-target="' + o.popuplink_target + '" data-time="' + o.popuptime + '" data-idx="' + i + '" ' + display[i] + '>' + 2252 ' <div class="popup-content">' + 2253 ' <div class="popup-header">' + 2254 ' <button type="button" class="close popup-close"><span aria-hidden="true"><svg viewBox="0 0 12 12" width="12" height="12"><path d="M6.71 6l5.15-5.15c0.2-0.2 0.2-0.51 0-0.71s-0.51-0.2-0.71 0L6 5.29 0.85 0.15c-0.2-0.2-0.51-0.2-0.71 0s-0.2 0.51 0 0.71L5.29 6l-5.15 5.15c-0.2 0.2-0.2 0.51 0 0.71C0.24 11.95 0.37 12 0.5 12s0.26-0.05 0.35-0.15L6 6.71l5.15 5.15c0.1 0.1 0.23 0.15 0.35 0.15s0.26-0.05 0.35-0.15c0.2-0.2 0.2-0.51 0-0.71L6.71 6z"/></svg></span></button>' + 2255 ' </div>' + 2256 ' <div class="popup-body">' + 2257 ' <a href="' + plink + '" ' + plink_target + ' ' + link_option + '>' + 2258 ' <div class="img-wrap">' + 2259 ' <img src="' + o.popupimg + '" alt="" class="img-responsive img-popup" />' + 2260 ' </div>' + 2261 ' </a>' + 2262 ' </div>' + 2263 ' <div class="popup-footer clearfix">' + 2264 ' <ul class="text-center">' + 2265 ' <li class="sitePopupTodayHide">' + 2266 ' <input type="checkbox" value="" class="hide">' + 2267 ' ' + $.lang[LANG]['editor.popup.close-24hours'] + 2268 ' </li>' + 2269 ' <li class="sitePopupClose">' + $.lang[LANG]['config.close'] + '</li>' + 2270 ' </ul>' + 2271 ' </div>' + 2272 ' </div>' + 2273 '</div>'; 2274 if(data.length == (i+1) ) setPopupFunction(html,display); 2275 }); 2276 2277 } 2278 2279 function setPopupFunction(html, display) { 2280
2281 var container = $('<div class="popup"></div>').html('<div class="popup-modal">' + html + '</div>'); 2282 if($('.dsgn-body').find('.popup').length > 0 ) { 2283 $('.dsgn-body').find('.popup').replaceWith(container); 2284 } else { 2285 $('.dsgn-body').append(container); 2286 } 2287 2288 var newInstance = jQuery.extend(true, {}, container); 2289 var sitePopupElement = newInstance.find('.popup-modal'); 2290 2291 var total_w = 0, 2292 add_w = 0, 2293 d_top = $('.header.el-menu > header').outerHeight() + 15, 2294 d_left = 0, 2295 x = 0, y = 0, y_r = 0; 2296 2297 var checkDsgnDodyW = $('.dsgn-body').width() + $('.dsgn-body').css('padding-left').replace('px','') * 1; 2298 if($('.header.el-menu').hasClass('sidebar') && checkDsgnDodyW > 752 ) d_top = 15; 2299 2300 for(i=0; i<img_w.length; i++) { 2301 if(parseInt(img_w[i]) > $('.dsgn-body').width()-30 ) { 2302 img_w[i] = $('.dsgn-body').width()-30; 2303 } 2304 if(display[i]) { 2305 continue; 2306 } else { 2307 total_w = total_w + parseInt(img_w[i]) + 30; 2308 } 2309 } 2310 2311 var isOverflow = ($('.dsgn-body').width() < total_w) ? true : false, 2312 display_i = -1; 2313 2314 if(isOverflow) { sitePopupElement.addClass('popupimg-overflow-y'); 2315 } else { sitePopupElement.removeClass('popupimg-overflow-y'); } 2316 2317 $.each(img_w, function(i,v) { 2318 if(display[i]) { 2319 return true; 2320 } else { 2321 display_i++; 2322 } 2323 2324 if(isOverflow) { 2325 x = (display_i==0) ? d_top : d_top + (display_i*30); 2326 y = d_left + ((display_i+1)*30); 2327 y_r = 120 - y; 2328 2329 img_w[i] = 'auto'; 2330 } else { 2331 d_left = ($('.dsgn-body').width() - total_w)/2; 2332 2333 x = d_top; 2334 y = d_left + add_w + (i*15); 2335 } 2336 add_w = add_w + v; 2337 2338 var css_val = (isOverflow) ? {'top': x +'px', 'left': y+'px', 'right': y_r+'px', 'margin-left': '0px', 'width': img_w[i], 'max-width': v} : {'top': x +'px', 'left': y+'px' , 'width': img_w[i]}; 2339 sitePopupElement.find('#'+sid +'Popup'+ i).css(css_val); 2340 }); 2341 return sitePopupElement; 2342 } 2343 } 2344 2345 jQuery.guideVideoON = function() { 2346 // í¸ì§ 모ë를 ì²ìì¼ë¡ ë³´ë ê²½ì°ê° ìëë©´ ( 주ì기ë¥ì ì´ë¯¸ ëë ¤ë´¤ì¼ë©´ ) 2347 if( LANG == 'ko' || typeof SETTINGS.showGuide != 'undefined') 2348 return false; 2349 2350 hideElementListPanel(); 2351 var $guideVideoModal = $('<div class="guideVideoModal config-modal"></div>'), 2352 $content = $('<div class="content"></div>'); 2353 2354 if ($('.guideVideoModal').length < 1) { 2355 $('body').prepend($guideVideoModal); 2356 $content.css({ 2357 "width" : "100%", 2358 "height" : "100%", 2359 "background-color" : "rgba(0,0,0,0.6)", 2360 "display" : "none" 2361 }); 2362 2363 $guideVideoModal.append($content); 2364 $guideVideoModal.css({ 2365 "display": "inherit", 2366 "position": "fixed", 2367 "z-index": "99999999", 2368 "top": "0", 2369 "left": "0", 2370 "width": "100%", 2371 "height": "100%", 2372 "text-align": "center", 2373 "background-color" : "transparent" 2374 }); 2375 $guideVideoModal.fadeIn(); 2376 2377 var $guideVideo = $('<div class="guideVideo">'), 2378 $close = $('<div class="close"><img src="https://storage.googleapis.com/i.addblock.net/fa-close-modal.png" alt="close" /></div>'), 2379 $close2 = $('<button type="button" class="btn btn-primary btn-sm ok-button-dialog">' + $.lang[LANG]['config.ok'] + '</button>');
2380 $header = $('<div class="header"><h2>' + $.lang[LANG]["editor.guide.tutorial-video"] + '</h2></div>'), 2381 $body = $('<div class="body"></div>'), 2382 $contentbox = $('<div class="contentbox"></div>'), 2383 $tutorialVideo = $('<div class="tutorial-video"></div>'), 2384 $videoWrap = $('<div class="video-wrap guideVideo-stopPlay"><div id="guide-video-modal-video-overlay"></div></div>'), 2385 $watchAgainNote = $('<span class="watch-again-note">' + $.lang[LANG]['tutorial-video.watch-again-note'] + '</span>'), 2386 $bottom = $('<div class="bottom"></div>'); 2387 2388 $close.on('click',function() { $.guideVideoOFF(); }); 2389 $close2.on('click',function() { $.guideVideoOFF(); }); 2390 2391 $videoWrap.on('click', function() { 2392 2393 $(this).toggleClass('guideVideo-stopPlay'); 2394 2395 if(!$(this).hasClass('guideVideo-stopPlay')) { 2396 if ( LANG == 'en' ) 2397 var link = "https://www.youtube.com/embed/p6fyIMl2BcI"; 2398 2399 var html = '<iframe class="video embed-responsive-item" width="765" height="380" src="' + link + '?enablejsapi=1&rel=0&vq=large&wmode=opaque&showinfo=0&controls=1&autoplay=0&loop=0;playlist=Fn0Mpyh3xto;" frameborder="0" allowfullscreen></iframe>'; 2400 2401 $(this).html(html); 2402 2403 } 2404 }); 2405 2406 $tutorialVideo.append( $videoWrap ); 2407 $contentbox.append( $tutorialVideo ); 2408 2409 $bottom.append($close2).append($watchAgainNote); 2410 $body.append($contentbox).append($bottom); 2411 $guideVideo.append($header).append($close).append($body); 2412 $content.append($guideVideo); 2413 $content.fadeIn(); 2414 2415 } 2416 2417 var $thisContent = $('.guideVideoModal .contentbox'); 2418 2419 } 2420 2421 jQuery.guideVideoOFF = function() { 2422 $('.guideVideoModal').fadeOut(function() { 2423 $(this).remove(); 2424 }); 2425 } 2426 2427 2428 2429 2430 $.fn.siteDelete = function(sid, code, options) { 2431 // isDelLangSite : í¹ì ë¤êµì´ ìì ì ( ì¬ì´í¸ ìì ììì ë¤êµì´ ìì ë false ì ) 2432 var isDelLangSite = (code) ? true : false; 2433 options = options || {}; 2434 2435 var sdOrgSid = sid, 2436 sdSid = (isDelLangSite) ? sid + '__' + code : sid, 2437 sdMore = [''], 2438 sdResource = [], 2439 sdResourceIdx = -1, 2440 sdResourceTotal = 0, 2441 sdIdx = -1, 2442 p_w = 0, p_max = 100, p_unit = 1, 2443 p_step_max = 100, p_step_unit = 1, p_step_plus = 1, 2444 block_view = { 'gallery':1, 'forum':2, 'form':2 }; 2445 2446 $.sd = { 2447 initVal: function() { 2448 p_step_max = 100; 2449 p_step_unit = 1; 2450 p_step_plus = 1; 2451 2452 sdIdx++; 2453 2454 if(!isDelLangSite) { 2455 code = sdMore[sdIdx]; 2456 sdSid = (code) ? sid + '__' + code : sid; 2457 } 2458 }, 2459 strProcess: function(step) { 2460 // console.log('step: ' + step + ''); 2461 // console.log('p_w: '+ p_w + ', p_unit: ' + p_unit); 2462 var str = '', cnt = ''; 2463 2464 switch(step) { 2465 case 'init': 2466 p_max = (isDelLangSite) ? 100 : 100/sdMore.length; 2467 p_unit = p_max / 100; 2468 2469 str = $.lang[LANG]['site.delete.process.init']; 2470 break; 2471 2472 case '1': 2473 p_w += p_unit * 5; 2474 2475 str = $.lang[LANG]['site.delete.process.step1']; 2476 break; 2477 2478 case 'end': 2479 p_w = p_max * (sdIdx+1); 2480 2481 var checkEnd = (sdMore.length > sdIdx+1) ? false : true; 2482 2483 str = $.lang[LANG]['site.delete.process.step14']; 2484 cnt = (checkEnd) ? '' : '<br>' + $.lang[LANG]['site.delete.process.more']; 2485 2486 if(checkEnd) { 2487 2488 if(isDelLangSite) { 2489 var slog_lang = $('.language-contents .settings-language .selected-languages li[data-code="' + code + '"] .language-name').text(); 2490 setSiteLogs('settings.language','delete',{'lang':slog_lang,'code':code},'settings.language'); 2491 } 2492 2493 setTimeout(function() { 2494 $.progressOFF(); 2495 }, 500); 2496 } 2497 break; 2498 2499 default: 2500 if(step == '2') { 2501 p_step_max = p_unit * 90; 2502 p_step_unit = p_step_max / 13; 2503 } 2504 2505 if($.inArray(step,['3','4'])>-1) str = $.lang[LANG]['site.delete.process.step3']; 2506 else if($.inArray(step,['5','6','7','8','8-more','9'])>-1) str = $.lang[LANG]['site.delete.process.step5']; 2507 else str = $.lang[LANG]['site.delete.process.step'+step]; 2508 2509 if(step == '13-more') { 2510 if(sdResource.length == 0) return false;
2511 str += '( ' + (sdResourceIdx+1) + ' / ' + sdResource.length + ' )'; 2512 } 2513 2514 if(p_step_plus > 0) p_w += p_step_unit; 2515 break; 2516 } 2517 2518 2519 if(step == 'init' && sdIdx == 0) { 2520 $.progressON(str,'','',true); 2521 } else { 2522 $('.progressModal .progress-header h1').html(str); 2523 $('.progressModal .progress-bar').css('width',p_w+'%'); 2524 } 2525 2526 // console.log('p_w: '+ p_w + ', p_unit: ' + p_unit); 2527 }, 2528 step0: function() { 2529 if(sdIdx == 0) $('#loading').addClass('hide'); 2530 2531 var sdStep1 = $.sd.step1(); 2532 sdStep1.done(function() { 2533 $.sd.stepMultiCall('2'); 2534 }).fail(function(sdStep1_msg){ 2535 console.log(sdStep1_msg); 2536 2537 $.sd.stepEnd(); 2538 if(sdStep1_msg) $(this).showModalFlat('ERROR', sdStep1_msg, false, false,'', 'ok','','cl-cmmodal cl-s-btn w560 cl-p130 cl-p0'); 2539 }); 2540 }, 2541 step1: function() { // [del] ln_select 2542 var step1_deferred = $.Deferred(); 2543 2544 $.post('/template/siteDelete', { step:'1', sid:sdOrgSid, code:code, isDelLangSite:isDelLangSite }, function(r1) { 2545 if(typeof r1.error != 'undefiend' && r1.error) { 2546 console.log('step1 reject'); 2547 step1_deferred.reject(r1.error); 2548 } 2549 $.sd.strProcess('1'); 2550 2551 setTimeout(function() { 2552 step1_deferred.resolve(); 2553 }, 200); 2554 }, 'json'); 2555 2556 return step1_deferred.promise(); 2557 }, 2558 stepMultiCall: function(call_step) { 2559 if(call_step == '2') $.sd.strProcess('2'); 2560 2561 if(call_step == '13-more') { 2562 var sdStep3 = $.sd.step3(); 2563 sdStep3.done(function(next_step) { 2564 if(next_step) $.sd.stepMultiCall(next_step); 2565 else $.sd.stepEnd(); 2566 }).fail(function(sdStep3_msg) { 2567 console.log(sdStep3_msg); 2568 2569 $.sd.stepMultiCall('14'); 2570 if(sdStep3_msg) $(this).showModalFlat('ERROR', sdStep3_msg, false, false,'', 'ok','','cl-cmmodal cl-s-btn w560 cl-p130 cl-p0'); 2571 }); 2572 } else { 2573 var sdStepMulti = $.sd.stepMulti(call_step); 2574 sdStepMulti.done(function(next_step) { 2575 if(next_step) $.sd.stepMultiCall(next_step); 2576 else $.sd.stepEnd(); 2577 }).fail(function(sdStepMulti_msg){ 2578 console.log(sdStepMulti_msg); 2579 2580 var jump_step = (call_step.indexOf('-more') > -1) ? Number(call_step.replace('-more', ''))+1 : Number(call_step)+1; 2581 if(jump_step >= 15) $.sd.stepEnd(); 2582 else $.sd.stepMultiCall(jump_step.toString()); 2583 2584 console.log(call_step); 2585 console.log('->'); 2586 console.log(jump_step.toString()); 2587 2588 if(sdStepMulti_msg) $(this).showModalFlat('ERROR', sdStepMulti_msg, false, false,'', 'ok','','cl-cmmodal cl-s-btn w560 cl-p130 cl-p0'); 2589 }); 2590 } 2591 }, 2592 stepMulti: function(sd_step) { 2593 var stepMulti_deferred = $.Deferred(); 2594 2595 $.post('/template/siteDelete', { step:sd_step, sid:sdOrgSid, code:code }, function(r) { 2596 if(typeof r.error != 'undefiend' && r.error) { 2597 console.log('stepMulti reject'); 2598 stepMulti_deferred.reject(r.error); 2599 } 2600 if(sd_step == '13') { 2601 sdResource = (typeof r.r_list != 'undefiend') ? r.r_list : [];
2602 sdResourceTotal = (typeof r.r_total != 'undefiend') ? r.r_total : 0; 2603 } 2604 2605 p_step_plus = (r.next_step=='' || r.next_step.indexOf('-more') > -1) ? 0 : 1; 2606 if(r.next_step) $.sd.strProcess(r.next_step); 2607 2608 setTimeout(function() { 2609 stepMulti_deferred.resolve(r.next_step); 2610 }, 100); 2611 }, 'json'); 2612 2613 return stepMulti_deferred.promise(); 2614 }, 2615 step3: function() { 2616 var step3_deferred = $.Deferred(); 2617 2618 sdResourceIdx++; 2619 var r_seq = sdResource[sdResourceIdx]; 2620 if(typeof r_seq != 'undefiend' && r_seq) { 2621 $.post('/template/siteDelete', { step:'13-more', sid:sdOrgSid, code:code, r_seq:r_seq }, function(r3) { 2622 if(typeof r3.error != 'undefiend' && r3.error) { 2623 console.log('step3 reject'); 2624 step3_deferred.reject(r3.error); 2625 } 2626 p_step_plus = 0; 2627 if(r3.next_step) $.sd.strProcess(r3.next_step); 2628 2629 setTimeout(function() { 2630 step3_deferred.resolve(r3.next_step); 2631 }, 50); 2632 }, 'json'); 2633 } else { 2634 step3_deferred.resolve('14'); 2635 } 2636 2637 return step3_deferred.promise(); 2638 }, 2639 stepEnd: function() { 2640 $.sd.strProcess('end'); 2641 2642 var checkEnd = (sdMore.length > sdIdx+1) ? false : true; 2643 if(checkEnd) { 2644 $('#loading').removeClass('hide'); 2645 2646 var completed = false, 2647 completeDelete = function() { 2648 if (completed) return; 2649 completed = true; 2650 $('.modal.modal-default.fade.in').css('zIndex',''); 2651 if (typeof options.onComplete == 'function') options.onComplete(); 2652 if (options.noRedirect) return; 2653 2654 location.href='/'; 2655 }; 2656 2657 var deleted_modal = $(this).showModalFlat($.lang[LANG]['site.delete.process.end.title'], $.lang[LANG]['site.delete.process.end.description'], true, false, function() { 2658 completeDelete(); 2659 }, 'ok','','cl-cmmodal cl-s-btn w560 cl-p130 cl-p0','','','',function() { 2660 completeDelete(); 2661 }); 2662 } else { 2663 $.sd.initVal(); 2664 setTimeout(function() { 2665 $.sd.step0(); 2666 }, 300); 2667 } 2668 } 2669 } 2670 2671 2672 2673 if(isDelLangSite) { 2674 $.sd.initVal(); 2675 $.sd.strProcess('init'); 2676 setTimeout(function() { 2677 $.sd.step0(); 2678 }, 300); 2679 } else { 2680 $.post('/template/siteDelete', { step:'check', sid:sdOrgSid, code:code }, function(r1) { 2681 if(typeof r1.error != 'undefiend' && r1.error) { 2682 alert(r1.error); 2683 location.reload(); 2684 return false; 2685 } 2686 sdMore = r1.more_code; 2687 2688 $.sd.initVal(); 2689 $.sd.strProcess('init'); 2690 2691 setTimeout(function() { 2692 $.sd.step0(); 2693 }, 300); 2694 }, 'json'); 2695 } 2696 } 2697 2698 2699 $.fn.siteClone = function(sid, dest_sid, isAddLangSite) { 2700 var scIdx = -1, 2701 scSid = [sid], 2702 scDest = [dest_sid], 2703 scCheck = { 'popup':false, 'music':false, 'gallery':false, 'forum':false }, 2704 scOrgData = [], 2705 scDestData = [], 2706 scTempData = []; 2707 2708 var p_w = 0, p_max = 100, p_unit = 1, 2709 p_step_max = 100, p_step_unit = 1, p_step_plus = 1, 2710 block_view = { 'gallery':1, 'forum':2, 'form':2, 'contact':2 }; 2711 2712 $.sc = { 2713 initVal: function() { 2714 p_step_max = 100; 2715 p_step_unit = 1; 2716 p_step_plus = 1; 2717 2718 scIdx++; 2719 if(scIdx == 0) { 2720 if(isAddLangSite) scCheck = { 'popup':true, 'music':true, 'gallery':true, 'forum':true }; 2721 else scCheck = { 'popup':false, 'music':false, 'gallery':false, 'forum':false }; 2722 } else if(scIdx > 0) { 2723 scDest.push(scSid[scIdx].replace(scSid[0],scDest[0])
2723); 2724 } 2725 2726 scOrgData.push({ 'total':0, 'normal_total':0, 'gallery' : { 'total':0 }, 'forum' : { 'total':0 }, 'form' : { 'total':0 }, 'contact' : { 'total':0 } }); 2727 scDestData.push({ 'total':0, 'normal_total':0, 'gallery' : { 'total':0 }, 'forum' : { 'total':0 }, 'form' : { 'total':0 }, 'contact' : { 'total':0 } }); 2728 scTempData.push({ 'gallery':false, 'forum':false, 'form':false, 'contact':false }); 2729 }, 2730 strCheck: function() { 2731 var checkbox = clSVG('checkbox',16,16,false,''); 2732 2733 return '\ 2734 <div class="check-wrap">\ 2735 <div class="box">\ 2736 <div class="newcheckbox hand checkbox">\ 2737 <label>\ 2738 <input type="checkbox" class="check-popup" name="check-popup">\ 2739 ' + checkbox + '\ 2740 </label>\ 2741 <span>' + $.lang[LANG]['site.clone.check.popup'] + '</span>\ 2742 </div>\ 2743 <div class="newcheckbox hand checkbox">\ 2744 <label>\ 2745 <input type="checkbox" class="check-music" name="check-music">\ 2746 ' + checkbox + '\ 2747 </label>\ 2748 <span>' + $.lang[LANG]['site.clone.check.music'] + '</span>\ 2749 </div>\ 2750 <div class="newcheckbox hand checkbox">\ 2751 <label>\ 2752 <input type="checkbox" class="check-gallery" name="check-gallery">\ 2753 ' + checkbox + '\ 2754 </label>\ 2755 <span>' + $.lang[LANG]['site.clone.check.gallery'] + '</span>\ 2756 </div>\ 2757 <div class="newcheckbox hand checkbox">\ 2758 <label>\ 2759 <input type="checkbox" class="check-forum" name="check-forum">\ 2760 ' + checkbox + '\ 2761 </label>\ 2762 <span>' + $.lang[LANG]['site.clone.check.forum'] + '</span>\ 2763 </div>\ 2764 </div>\ 2765 <p><span class="error">' + $.lang[LANG]['site.clone.check.info.1'] + '\ 2766 <svg class="cm-popover-info" viewBox="0 0 13 13" width="13" height="13" tabindex="0" data-toggle="popover" data-trigger="hover" data-html="true" data-placement="top" data-content="' + $.lang[LANG]['site.clone.check.info.3'] + '">\ 2767 <path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM7 10H6V9h1V10zM7.67 6.75C7.04 7.37 7 7.66 6.99 8H6c0.02-0.63 0.21-1.03 0.88-1.69 0.46-0.47 0.75-0.86 0.76-1.34 0-0.58-0.39-0.95-1.02-0.95 -0.56 0-1 0.14-1.08 0.76C5.53 4.85 5.52 4.93 5.52 5H4.5c-0.01-0.08 0-0.14 0-0.2 0.08-1.3 1.11-1.79 2.17-1.79 1.22 0 2.04 0.84 2.04 1.87C8.7 5.68 8.17 6.27 7.67 6.75z"/>\ 2768 </svg>' + $.lang[LANG]['site.clone.check.info.2'] + '</span></p>\ 2769 </div>\ 2770 '; 2771 }, 2772 strProcess: function(step) { 2773 // console.log('step: ' + step + ''); 2774 // console.log('p_w: '+ p_w + ', p_unit: ' + p_unit); 2775 2776 var str = '', 2777 cnt = ''; 2778 2779 switch(step) { 2780 case 'init': // 0% 2781 str = $.lang[LANG]['site.clone.process.init']; 2782 break; 2783 2784 case '1': // 5% 2785 if(scIdx == 0) { 2786 p_max = 100 / scSid.length; 2787 p_unit = p_max / 100; 2788 } 2789 2790 p_w += p_unit * 5; 2791 2792 str = $.lang[LANG]['site.clone.process.step1']; 2793 if(!isAddLangSite) { 2794 if(!scCheck['popup'] && !scCheck['music']) str = $.lang[LANG]['site.clone.process.step1.1']; 2795 else if (scCheck['popup'] && !scCheck['music']) str = $.lang[LANG]['site.clone.process.step1.2']; 2796 else if (!scCheck['popup'] && scCheck['music']) str = $.lang[LANG]['site.clone.process.step1.3']; 2797 } 2798 break; 2799 2800 case '2': // 0% 2801 str = $.lang[LANG]['site.clone.process.step2']; 2802 break; 2803 2804 case '2-ok': 2805 str = $.lang[LANG]['site.clone.process.step2']; 2806 cnt = '(0/' + scOrgData[scIdx]['total'] + ')'; 2807 2808 // step3,4 init 2809 p_step_max = p_unit * 60; 2810 p_step_unit = p_step_max / scOrgData[scIdx]['total']; 2811 break; 2812 2813 case '3': // 30% 2814 str = $.lang[LANG]['site.clone.process.step3']; 2815 cnt = '(' + scDestData[scIdx]['total'] + '/' + scOrgData[scIdx]['total'] + ')'; 2816 break; 2817 2818 case '3-ok': 2819 p_w += p_step_unit * p_step_plus; 2820 2821 str = $.lang[LANG]['site.clone.process.step3']; 2822 cnt = '(' + scDestData[scIdx]['total'] + '/' + scOrgData[scIdx]['total'] + ')'; 2823 break; 2824 2825 case '4': // 5% 2826 p_w += p_unit * 5; 2827 2828 str = $.lang[LANG]['site.clone.process.step4']; 2829 cnt = '(' + scDestData[scIdx]['total'] + '/' + scOrgData[scIdx]['total'] + ')'; 2830 break; 2831 2832 case '5': // 30% 2833 p_w += p_step_unit * p_step_plus; 2834 2835 str = $.lang[LANG]['site.clone.process.step5']; 2836 cnt = '(' + scDestData[scIdx]['total'] + '/' + scOrgData[scIdx]['total'] + ')'; 2837 break; 2838 2839 case '6': // 5% 2840 p_w += p_unit * 5; 2841 2842 str = $.lang[LANG]['site.clone.process.step6']; 2843 cnt = '(' + scDestData[scIdx]['resource']['total'] + '/' + scOrgData[scIdx]['resource']['total'] + ')'; 2844 2845 // step7 init 2846 p_step_max = p_unit * 20; 2847 p_step_unit = p_step_max / scOrgData[scIdx]['resource']['total']; 2848 break; 2849 2850 case '7': // 20% 2851 p_w += p_step_unit; 2852 2853 str = $.lang[LANG]['site.clone.process.step7']; 2854 cnt = '(' + scDestData[scIdx]['resource']['total'] + '/' + scOrgData[scIdx]['resource']['total'] + ')'; 2855 break; 2856 2857 case '8': // 5% 2858 p_w = p_max * (scIdx+1); 2859 2860 var checkEnd = (scSid.length > 1 && scSid.length > scIdx+1) ? false : true; 2861 2862 str = $.lang[LANG]['site.clone.process.step8']; 2863 cnt = (checkEnd) ? '' : '<br>' + $.lang[LANG]['site.clone.process.step8.more']; 2864 2865 if(checkEnd) { 2866 setTimeout(function() { 2867 $.progressOFF(); 2868 }, 500); 2869 } 2870 break; 2871 2872 default: 2873 break; 2874 } 2875 2876 2877 if(step == 'init' && scIdx == 0) { 2878 $.progressON(str,'','',true); 2879 } else { 2880 $('.progressModal .progress-header h1').html(str + cnt);
2881 $('.progressModal .progress-bar').css('width',p_w+'%'); 2882 } 2883 2884 // console.log('p_w: '+ p_w + ', p_unit: ' + p_unit); 2885 }, 2886 step0: function() { 2887 2888 var scStep1 = $.sc.step1(); 2889 scStep1.done(function() { 2890 var scStep2 = $.sc.step2(); 2891 scStep2.done(function() { 2892 $.sc.step3Call(1); 2893 }).fail(function(scStep2_msg) { 2894 console.log('scStep2 fail'); 2895 console.log(scStep2_msg); 2896 2897 $.sc.step8(); 2898 if(scStep2_msg) $(this).showModalFlat('<?=$this->lang->line("lang.delete.modal.title")?>', scStep2_msg, false, false,'', 'ok','','cl-cmmodal cl-s-btn w560 cl-p130 cl-p0'); 2899 }); 2900 }).fail(function(scStep1_msg){ 2901 console.log(scStep1_msg); 2902 2903 $.sc.step8(); 2904 if(scStep1_msg) $(this).showModalFlat('<?=$this->lang->line("lang.delete.modal.title")?>', scStep1_msg, false, false,'', 'ok','','cl-cmmodal cl-s-btn w560 cl-p130 cl-p0'); 2905 }); 2906 }, 2907 step1: function() { // [clone] pf_site | [get] org pf_site 2908 var step1_deferred = $.Deferred(); 2909 2910 $.post('/template/siteClone', { step:'1', sid:scSid[scIdx], dest_sid:scDest[scIdx], check:scCheck, isAddLangSite:isAddLangSite }, function(r1) { 2911 if(typeof r1.error != 'undefiend' && r1.error) { 2912 console.log('step1 error: ' + r1.error); 2913 2914 var error_msg = (r1.error == 'already_dest') ? 'ë³µì ê° ì ìì ì¼ë¡ ìëìì¼ë ìì í ë¤ì ìëí´ì£¼ì¸ì.' : 'Site Clone Step1 Error'; 2915 step1_deferred.reject(error_msg); 2916 } 2917 2918 scOrgData[scIdx]['pfsite'] = r1.org_site; 2919 if(scIdx == 0 && r1.site_langs !== null) scSid = r1.site_langs; 2920 $.sc.strProcess('1'); 2921 2922 setTimeout(function() { 2923 step1_deferred.resolve(); 2924 }, 300); 2925 }, 'json'); 2926 2927 return step1_deferred.promise(); 2928 }, 2929 step2: function() { // [get] block total 2930 var step2_deferred = $.Deferred(); 2931 $.sc.strProcess('2'); 2932 2933 $.post('/template/siteClone', { step:'2', sid:scSid[scIdx], check:scCheck }, function(r2) { 2934 if(typeof r2.error != 'undefiend' && r2.error) { 2935 console.log('step2 reject'); 2936 step2_deferred.reject(r2.error); 2937 } 2938 2939 scOrgData[scIdx]['total'] = r2.data.total; 2940 scOrgData[scIdx]['normal_total'] = r2.data.normal_total; 2941 $.sc.strProcess('2-ok'); 2942 2943 setTimeout(function() { 2944 step2_deferred.resolve(); 2945 }, 300); 2946 }, 'json'); 2947 2948 return step2_deferred.promise(); 2949 }, 2950 step3Call: function(page) { 2951 2952 var view = 100, 2953 checkNextStep = (Math.ceil(scOrgData[scIdx]['normal_total']/view) < page) ? true : false; 2954 2955 if(checkNextStep) { 2956 var scStep4 = $.sc.step4(); 2957 scStep4.done(function(data4) { 2958 $('.progress-content').append('\ 2959 <div class="clone-section" data-sid="' + scSid[scIdx] + '" data-sid="' + scDest[scIdx] + '">\ 2960 <ul class="clone-block-list"></ul>\ 2961 <ul class="clone-resource-list"></ul>\ 2962 </div>\ 2963 '); 2964 $.each(data4, function(key,total) { 2965 // if(key == 'gallery_items') return true; 2966 if(key == 'total') return true; 2967 if(total > 0) { 2968 var view = block_view[key], 2969 total_page = (total > view) ? Math.ceil(total/view) : 1, 2970 view_start = 1, 2971 view_end = (total > view) ? view : total; 2972 2973 for(var idx=1; idx<=total_page; idx++) { 2974 if(idx > 1) { 2975 view_start = view_end + 1; 2976 view_end = (total > (view*idx)) ? view*idx : total; 2977 } 2978 2979 var btn_target = (view === 1 || view_end == 1) ? '' : '(' + view_start + '~' + view_end + ')', 2980 btn_str = key + ' ' + idx + btn_target, 2981 btn_html = '<button type="button" class="btn btn-primary site-clone-step5" data-start="'+view_start+'" data-end="'+view_end+'">'+btn_str+'</button>'; 2982 $('.progress-content .clone-section[data-sid="' + scSid[scIdx] + '"] .clone-block-list').append('<li class="'+ key +'">' + btn_html + '</li>'); 2983 } 2984 } 2985 }); 2986 2987 $.sc.step5Call(0); 2988 2989 }).fail(function(scStep4_msg){ 2990 console.log(scStep4_msg); 2991 2992 $.sc.step8();
2993 if(scStep4_msg) $(this).showModalFlat('<?=$this->lang->line("lang.delete.modal.title")?>', scStep4_msg, false, false,'', 'ok','','cl-cmmodal cl-s-btn w560 cl-p130 cl-p0'); 2994 }); 2995 2996 return false; 2997 } 2998 2999 var scStep3 = $.sc.step3(page); 3000 scStep3.done(function() { 3001 $.sc.step3Call(page+1); 3002 }).fail(function(scStep3_msg){ 3003 console.log(scStep3_msg); 3004 3005 $.sc.step8(); 3006 if(scStep3_msg) $(this).showModalFlat('<?=$this->lang->line("lang.delete.modal.title")?>', scStep3_msg, false, false,'', 'ok','','cl-cmmodal cl-s-btn w560 cl-p130 cl-p0'); 3007 }); 3008 3009 }, 3010 step3: function(page) { // [clone] pf_page > normal block 3011 var step3_deferred = $.Deferred(); 3012 3013 $.sc.strProcess('3'); 3014 $.post('/template/siteClone', { step:'3', sid:scSid[scIdx], dest_sid:scDest[scIdx], check:scCheck, page:page, isAddLangSite:isAddLangSite }, function(r3) { 3015 if(typeof r3.error != 'undefiend' && r3.error) { 3016 console.log('step3 reject'); 3017 step3_deferred.reject(r3.error); 3018 } 3019 3020 p_step_plus = r3.data.insert_total; 3021 scDestData[scIdx]['total'] += r3.data.insert_total; 3022 $.sc.strProcess('3-ok'); 3023 3024 setTimeout(function() { 3025 step3_deferred.resolve(); 3026 }, 200); 3027 }, 'json'); 3028 3029 return step3_deferred.promise(); 3030 }, 3031 step4: function() { // [get] (gallery / form / forum) block total 3032 var step4_deferred = $.Deferred(); 3033 3034 $.post('/template/siteClone', { step:'4', sid:scSid[scIdx], check:scCheck }, function(r4) { 3035 if(typeof r4.error != 'undefiend' && r4.error) { 3036 console.log('step4 reject'); 3037 step4_deferred.reject(r4.error); 3038 } 3039 3040 scOrgData[scIdx]['gallery']['total'] = r4.data.gallery; 3041 scOrgData[scIdx]['forum']['total'] = r4.data.forum; 3042 scOrgData[scIdx]['form']['total'] = r4.data.form; 3043 scOrgData[scIdx]['contact']['total'] = r4.data.contact; 3044 $.sc.strProcess('4'); 3045 3046 setTimeout(function() { 3047 step4_deferred.resolve(r4.data); 3048 }, 300); 3049 }, 'json'); 3050 3051 return step4_deferred.promise(); 3052 }, 3053 step5Call: function(cnt) { 3054 var cloneBlock = $('.progress-content .clone-section[data-sid="' + scSid[scIdx] + '"] .clone-block-list li').eq(cnt); 3055 if(cloneBlock.length == 0) { 3056 $.sc.step6(); 3057 return false; 3058 } 3059 3060 var cloneBlockBtn = cloneBlock.find('button'), 3061 key = cloneBlock.attr('class'), 3062 start = cloneBlockBtn.attr('data-start'), 3063 end = cloneBlockBtn.attr('data-end'), 3064 more = (typeof cloneBlockBtn.attr('data-more') != 'undefined' && cloneBlockBtn.attr('data-more')) ? cloneBlockBtn.attr('data-more') : ''; 3065 3066 var scStep5 = $.sc.step5(key,cnt,start,end,more); 3067 scStep5.done(function(checkMore) { 3068 if(checkMore) $.sc.step5Call(cnt); 3069 else $.sc.step5Call(cnt+1); 3070 }).fail(function() { 3071 console.log('scStep5 fail'); 3072 }); 3073 }, 3074 step5: function(key,cnt,start,end,more) { // [clone] pf_page > (gallery / form / forum) block 3075 var step5_deferred = $.Deferred(); 3076 3077 var cloneBlock = $('.progress-content .clone-section[data-sid="' + scSid[scIdx] + '"] .clone-block-list li').eq(cnt), 3078 cloneBlockBtn = cloneBlock.find('button'), 3079 block_insert_data = scTempData[scIdx][key]; 3080 3081 $.post('/template/siteClone', { step:'5', sid:scSid[scIdx], dest_sid:scDest[scIdx], check:scCheck, insert_data:block_insert_data, btype:key, bstart:start, bend:end, more:more }, function(r5) { 3082 3083 if(typeof r5.error != 'undefined' && r5.error) { 3084 console.log('step5 reject'); 3085 console.log('Gallery / form / forum Clone error::' + scSid[scIdx] + ', ' + r5.error); 3086 $('.progress-content .clone-section[data-sid="' + scSid[scIdx] + '"] .clone-block-list li').eq(cnt).append('<span class="error">
3086'+r5.error+'</span>'); 3087 step5_deferred.reject(); 3088 3089 } else $('.progress-content .clone-section[data-sid="' + scSid[scIdx] + '"] .clone-block-list .error').remove(); 3090 3091 scDestData[scIdx]['total'] = scDestData[scIdx]['total'] + r5.data.total; 3092 scTempData[scIdx][key] = Object.assign(block_insert_data, r5.data.insert_data); 3093 3094 var check_more = false; 3095 if(typeof r5.data.more != 'undefiend' && r5.data.more) { 3096 check_more = true; 3097 3098 var more_str = r5.data.more, 3099 more_arr = more_str.split(','), 3100 more_btn_str = more_arr[2]+'/'+more_arr[3]; 3101 cloneBlockBtn.attr('data-more',r5.data.more); 3102 if(cloneBlockBtn.find('.next').length > 0) cloneBlockBtn.find('.next').text(more_btn_str); 3103 else cloneBlockBtn.append('<span class="next">('+more_btn_str+')</span>'); 3104 } else { 3105 p_step_plus = r5.data.total; 3106 $.sc.strProcess('5'); 3107 cloneBlockBtn.attr('disabled',true); 3108 } 3109 3110 setTimeout(function() { 3111 step5_deferred.resolve(check_more); 3112 }, 200); 3113 }, 'json'); 3114 3115 3116 return step5_deferred.promise(); 3117 }, 3118 step6: function() { // [get] pf_resource seq & total 3119 console.log(scSid[scIdx]); 3120 3121 $.post('/template/siteClone', { step:'6', sid:scSid[scIdx], dest_sid:scDest[scIdx] }, function(r6) { 3122 3123 var cloneSection = $('.progress-content .clone-section[data-sid="' + scSid[scIdx] + '"] .clone-resource-list'); 3124 if(typeof r6.error != 'undefined' && r6.error) { 3125 console.log('step6 reject'); 3126 console.log('Resorce Clone error::' + scSid[scIdx] + ', ' + r6.error); 3127 cloneSection.before('<span class="error">'+r6.error+'</span>'); 3128 return false; 3129 } else $('.error').remove(); 3130 3131 var r_view = 30, 3132 r_total = r6.count, 3133 r_add = 0; 3134 3135 scOrgData[scIdx]['resource'] = { 3136 'total' : r_total, 3137 'list' : r6.list 3138 }; 3139 scDestData[scIdx]['resource'] = { 3140 'total' : 0, 3141 'list' : new Array() 3142 }; 3143 $.sc.strProcess('6'); 3144 3145 if(r_total == 0) { 3146 $.sc.step8(); 3147 return false; 3148 } 3149 3150 $.each(r6.list, function(rs_i,rs_v) { 3151 r_add++; 3152 var mod = r_add%r_view; 3153 if(mod === 1) cloneSection.append('<li></li>'); 3154 cloneSection.find('li:last-child').append('<span>' + rs_v.seq + '</span>'); 3155 3156 if(r_add == r_total) { 3157 $.sc.step7Call(0,0); 3158 } 3159 }); 3160 }, 'json'); 3161 }, 3162 step7Call: function(rs_eq1,rs_eq2) { 3163 var cloneResource = $('.progress-content .clone-section[data-sid="' + scSid[scIdx] + '"] .clone-resource-list'); 3164 rs_li_total = cloneResource.find('li').length; 3165 if(rs_eq1 >= rs_li_total) { 3166 $.sc.step8(); 3167 return false; 3168 } 3169 3170 var cloneResourceli = cloneResource.find('li').eq(rs_eq1), 3171 rs_span_total = cloneResourceli.find('span').length; 3172 if(rs_eq2 >= rs_span_total) { 3173 $.sc.step7Call(rs_eq1+1,0); 3174 return false; 3175 } 3176 3177 var cloneResourceSpan = cloneResourceli.find('span').eq(rs_eq2), 3178 rs_seq = cloneResourceSpan.text(); 3179 if(rs_seq == '') { 3180 $.sc.step8(); 3181 return false;
3182 } 3183 3184 var scStep7 = $.sc.step7(rs_seq); 3185 scStep7.done(function() { 3186 if(rs_eq2+1 < rs_span_total) $.sc.step7Call(rs_eq1,rs_eq2+1); 3187 else $.sc.step7Call(rs_eq1+1,0); 3188 }).fail(function() { 3189 console.log('scStep7 fail'); 3190 }); 3191 }, 3192 step7: function(rs_seq) { // [clone] pf_resource 3193 var step7_deferred = $.Deferred(); 3194 3195 $.post('/template/siteClone', { step:'7', sid:scSid[scIdx], dest_sid:scDest[scIdx], r_seq:rs_seq }, function(r7) { 3196 3197 if(typeof r7.error != 'undefined' && r7.error) { 3198 console.log('step7 reject'); 3199 console.log('Resorce Clone error::' + rs_seq + ', ' + r7.error); 3200 $('.progress-content .clone-section[data-sid="' + scSid[scIdx] + '"] .clone-resource-list li span[data-seq="' + rs_seq + '"]').addClass('error'); 3201 step7_deferred.reject(); 3202 3203 } else $('.progress-content .clone-section[data-sid="' + scSid[scIdx] + '"] .clone-resource-list li .error').remove(); 3204 3205 scDestData[scIdx]['resource']['total'] = scDestData[scIdx]['resource']['total'] + 1; 3206 scDestData[scIdx]['resource']['list'].push(rs_seq); 3207 $.sc.strProcess('7'); 3208 3209 setTimeout(function() { 3210 step7_deferred.resolve(); 3211 }, 100); 3212 }, 'json'); 3213 3214 return step7_deferred.promise(); 3215 }, 3216 step8: function() { // check other site(language site) 3217 $.sc.strProcess('8'); 3218 3219 if(isAddLangSite || scIdx+1 == scSid.length) { 3220 location.reload(); 3221 } else { 3222 $.sc.initVal(); 3223 setTimeout(function() { 3224 $.sc.step0(); 3225 }, 500); 3226 } 3227 } 3228 } 3229 3230 3231 $.sc.initVal(); 3232 if(isAddLangSite) { 3233 $.sc.strProcess('init'); 3234 setTimeout(function() { 3235 $.sc.step0(); 3236 }, 600); 3237 } else { 3238 var scCheckModal = $(this).showModalFlat($.lang[LANG]['site.clone.check.title'], $.sc.strCheck(), true, true, function() { 3239 $.sc.strProcess('init'); 3240 3241 scCheck.popup = $('.check-popup').prop('checked'); 3242 scCheck.music = $('.check-music').prop('checked'); 3243 scCheck.gallery = $('.check-gallery').prop('checked'); 3244 scCheck.forum = $('.check-forum').prop('checked'); 3245 3246 setTimeout(function() { 3247 $.sc.step0(); 3248 scCheckModal.modal('hide'); 3249 }, 600); 3250 },'cancel','','cl-siteclone cl-cmmodal cl-s-btn w560 cl-p70 cl-p0','','',function() { $('[data-toggle="popover"]').popover(); }); 3251 } 3252 } 3253 3254 $.fn.sitePublishVer01 = function(sid,onoff,endCallback) { 3255 3256 var strTitle = (onoff==1) ? $.lang[LANG]['loading.publishing'] : $.lang[LANG]['loading.publishing.off']; 3257 $.progressON(strTitle,'',0,true); 3258 3259 var pbSiteCall = function(slist,sidx) { 3260 if(typeof slist == 'undefined' || typeof slist[sidx] == 'undefined') { 3261 pbEndCall(false); 3262 return false; 3263 } 3264 3265 var s_obj = slist[sidx], 3266 s_orgsid = s_obj['sid'], 3267 s_code = (typeof s_obj['code'] != 'undefined' && s_obj['code']) ? s_obj['code'] : '', 3268 s_sid = (s_code) ? s_orgsid+'__'+s_code : s_orgsid; 3269 3270 $.progressON('', s_orgsid + ((s_code) ? $.lang[LANG]['editor.publish.step2.1'] + ' (' + s_code + ')' : '') + $.lang[LANG]['editor.publish.step2.2'],0,true); 3271 var pbSite_r = pbSite(s_sid,onoff); 3272 pbSite_r.done(function(r2) { 3273 $.progressON('', s_orgsid + ((s_code) ? $.lang[LANG]['editor.publish.step3.1'] + ' (' + s_code + ')' : '') + $.lang[LANG]['editor.publish.step3.2'],0,true); 3274 var w = getProgressWidth() + (20/slist.length) * (sidx+1);
3275 $('.progress-bar').css('width',w+'%'); 3276 3277 pbGalleryCall(slist,sidx,s_orgsid,s_code,r2.count,0); 3278 }).fail(function(r2_error) { 3279 console.log(r2_error); 3280 pbEndCall(false); 3281 }); 3282 } 3283 3284 var pbGalleryCall = function(sitelist,siteidx,sidorg,sidcode,gcount,gpidx) { 3285 var sitesid = (sidcode) ? sidorg+'__'+sidcode : sidorg; 3286 3287 var pbGallery_r = pbGallery(sitesid,onoff,gcount,gpidx,sitelist.length,siteidx); 3288 pbGallery_r.done(function(r3) { 3289 $.progressON('',sidorg + ((sidcode) ? $.lang[LANG]['editor.publish.step4.1'] + ' (' + sidcode + ')' : '') + $.lang[LANG]['editor.publish.step4.2'],0,true); 3290 $('.progress-bar').css('width',r3.w+'%'); 3291 3292 if(r3.done == true) pbPagesCall(sitelist,siteidx,sidorg,sidcode,r3.count,0); 3293 else pbGalleryCall(sitelist,siteidx,sidorg,sidcode,gcount,gpidx+1); 3294 3295 }).fail(function(r3_error) { 3296 console.log(r3_error); 3297 pbEndCall(false); 3298 }); 3299 } 3300 3301 var pbPagesCall = function(sitelist,siteidx,sidorg,sidcode,bcount,bpidx) { 3302 var sitesid = (sidcode) ? sidorg+'__'+sidcode : sidorg; 3303 3304 var pbPages_r = pbPages(sitesid,onoff,bcount,bpidx,sitelist.length,siteidx); 3305 pbPages_r.done(function(r4) { 3306 $('.progress-bar').css('width',r4.w+'%'); 3307 3308 if(r4.done == true) { 3309 if(sitelist.length == (siteidx+1)) pbEndCall(true); 3310 else pbSiteCall(sitelist,siteidx+1); 3311 } else { 3312 pbPagesCall(sitelist,siteidx,sidorg,sidcode,bcount,bpidx+1); 3313 } 3314 3315 }).fail(function(r4_error) { 3316 console.log(r4_error); 3317 pbEndCall(false); 3318 }); 3319 } 3320 3321 var pbEndCall = function(isCompleted) { 3322 $('.progress-bar').css('width','100%'); 3323 3324 if(!isCompleted) { 3325 $.progressOFF(); 3326 return false; 3327 } 3328 3329 if(typeof endCallback == 'function') { 3330 endCallback(sid,onoff); 3331 } 3332 } 3333 3334 var sites_r = sites(sid); 3335 sites_r.done(function(r1) { 3336 $.progressON('',$.lang[LANG]['editor.publish.step1'],0,true); 3337 pbSiteCall(r1.lists,0); 3338 }).fail(function(r1_error) { 3339 console.log(r1_error); 3340 pbEndCall(false); 3341 }); 3342 } 3343 3344 $.fn.sitePublishByConfig = function(sid) { 3345 var $publishTarget = $(this); 3346 var isConfigPbs = (typeof CONFIG_PBS != 'undefined' && CONFIG_PBS) ? true : false; 3347 var publishDomain = (typeof PUBDOMAIN != 'undefined' && PUBDOMAIN) ? PUBDOMAIN : ((typeof DOMAIN != 'undefined' && DOMAIN) ? DOMAIN : $('#pubhost a').attr('href')); 3348 3349 if (isConfigPbs) { 3350 $publishTarget.sitePublishVer02(sid); 3351 } else { 3352 $publishTarget.sitePublishVer01(sid, 1, function() { 3353 setTimeout(function() { 3354 if (typeof SLANG != 'undefined' && typeof SLANG.select_code != 'undefined' && SLANG.select_code) { 3355 changeLanguage(SLANG.select_code, 'sync_publish'); 3356 } 3357 3358 $.progressOFF(); 3359 $.processON(); 3360 $('.processModal p').text(''); 3361 $('.processModal p').css({ 3362 'width': '385px', 3363 'height': '215px', 3364 'top': '0', 3365 'margin': 'auto', 3366 'background': 'none', 3367 }); 3368 3369 if ($('.processModal').length == 1) { 3370 if (typeof CONFIG_PBS != 'undefined') CONFIG_PBS = true; 3371 3372 $.processOFF(); 3373 var modal = $publishTarget.showModalFlat($.lang[LANG]['editor.publish.priview.title'], $.lang[LANG]['editor.publish.priview'], true, false, function() { 3374 if (publishDomain) window.open(publishDomain, '_blank'); 3375 modal.modal('hide'); 3376 }, 'ok', '', 'cl-p130 cl-cmmodal cl-s-btn w560 cl-p0 cl-okbtn-pbt70 cl-publish-complete', '', '', function() { 3377 $('.cl-publish-complete .ok-button-dialog, .cl-publish-complete .close').on('click', function() { 3378 $.processOFF(); 3379 }); 3380 }); 3381 } 3382 }, 1000); 3383 }); 3384 } 3385 } 3386 3387 $.fn.sitePublishVer02 = function(sid) { 3388 3389 $.progressON($.lang[LANG]['editor.publish.step.start'],'',0,true); 3390 3391 $.sp = { 3392 step: 0, 3393 3394 site_list: {}, 3395 site_total: 0, 3396 site_idx: 0, 3397 site_per: 100, 3398 3399 sid: sid, 3400 sid_code: '', 3401 org_sid: sid, 3402 3403 step_k: {'d':3, 'i':2, 'u':1}, 3404 step_total: [0,0,0,0], 3405 step_success: [0,0,0,0], 3406 3407 change_total: 0, 3408 change_success: 0, 3409 change_list: {}, 3410 3411 per: 0, 3412 error_msg: $.lang[LANG]['editor.publish.step.error'], 3413 end: function(isError) { 3414 if(typeof isError == 'undefined') isError = false;
3415 3416 if(isError) { 3417 $.progressOFF(); 3418 $(this).showModalFlat('ERROR',$.sp.error_msg, true, false, '', 'ok', '', 'cl-p130 cl-cmmodal cl-s-btn w560 cl-p0 cl-okbtn-pbt70'); 3419 } else { 3420 3421 var isNext = (typeof $.sp.site_list[$.sp.site_idx+1] != 'undefined' && $.sp.site_idx+1 <= $.sp.site_total) ? true : false; 3422 if(isNext) { 3423 setTimeout(function() { 3424 $.progressON('',$.lang[LANG]['editor.publish.step.restart']); 3425 $('.progress-bar').css('width','0%'); 3426 $.sp.site_idx++; 3427 setTimeout(function() { 3428 $.sp.step1(); 3429 },1500); 3430 },1500); 3431 } else { 3432 3433 $('.progress-bar').css('width','70%'); 3434 setTimeout(function() { 3435 $('.progress-bar').css('width','100%'); 3436 3437 if(typeof SLANG != 'undefined' && typeof SLANG.select_code != 'undefined' && SLANG.select_code) { 3438 changeLanguage(SLANG.select_code,'sync_publish'); 3439 } 3440 3441 $.progressOFF(); 3442 $.processON(); 3443 3444 var time = $.now(); 3445 $('.processModal p').text(''); 3446 $('.processModal p').css({ 3447 'width' : '385px', 3448 'height' : '215px', 3449 'top' : '0', 3450 'margin' : 'auto', 3451 'background' : 'none', 3452 }); 3453 3454 if($('.processModal').length ==1) { 3455 $.processOFF(); 3456 var modal = $(this).showModalFlat($.lang[LANG]['editor.publish.priview.title'],$.lang[LANG]['editor.publish.priview'], true, false ,function(){ 3457 window.open(DOMAIN, '_blank'); 3458 modal.modal('hide'); 3459 },'ok', '', 'cl-p130 cl-cmmodal cl-s-btn w560 cl-p0 cl-okbtn-pbt70 cl-publish-complete','','',function(){ 3460 $('.cl-publish-complete .ok-button-dialog, .cl-publish-complete .close').on('click',function(){ 3461 $.processOFF(); 3462 }); 3463 }); 3464 } 3465 }, 500); 3466 3467 } 3468 3469 } 3470 3471 }, 3472 step0: function(sid) { 3473 $.sp.step = 0; 3474 3475 var sp0_deferred = $.Deferred(); 3476 if(typeof sid == 'undefined') sp0_deferred.reject('sid Undefined :('); 3477 else { 3478 $.ajax({ 3479 url : '/template/publishSites', 3480 data : { sid : sid }, 3481 type : 'POST', 3482 dataType : 'json', 3483 async : true, 3484 cashe : false, 3485 success : function(data) { 3486 if(typeof data.error != 'undefined' && data.error) { 3487 sp0_deferred.reject(data.error); 3488 return false; 3489 } 3490 3491 $.sp.site_list = data.lists; 3492 $.sp.site_total = data.lists.length; 3493 $.sp.site_idx = 0; 3494 $.sp.site_per = Math.ceil(100 / $.sp.site_total); 3495 3496 $.progressON('',$.lang[LANG]['editor.publish.step.0'],0,true); 3497 $('.progress-bar').css('width','5%'); 3498 3499 sp0_deferred.resolve(); 3500 } 3501 }); 3502 } 3503 return sp0_deferred.promise(); 3504 }, 3505 step1: function() { 3506 $.sp.step = 1; 3507 3508 $.sp.org_sid = $.sp.site_list[$.sp.site_idx]['sid']; 3509 $.sp.sid_code = $.sp.site_list[$.sp.site_idx]['code']; 3510 $.sp.sid = ($.sp.sid_code) ? $.sp.org_sid+'__'+$.sp.sid_code : $.sp.org_sid; 3511 3512 if($.sp.site_idx > 0) { 3513 $.progressON('', $.sp.org_sid + (($.sp.sid_code) ? $.lang[LANG]['editor.publish.step.0.p'] + ' (' + $.sp.sid_code + ')' : '') + $.lang[LANG]['editor.publish.step.0.n'],0,true);
3514 $('.progress-bar').css('width','5%'); 3515 } 3516 var sp1_1 = $.sp.step1_1(); 3517 sp1_1.done(function(r1_1) { 3518 if(r1_1 > 0) $.sp.step2('d',0); 3519 else $.sp.end(); 3520 }).fail(function(r1_1_error) { 3521 console.log('r1_1_error: '+r1_1_error); 3522 $.sp.end(true); 3523 }); 3524 }, 3525 step1_1: function() { 3526 // sites[idx] - pf_site â pb_site (UPDATE or INSERT) 3527 // sites[idx] - pf_site.activate, pb_site.activate = 1 or 9 (UPDATE) 3528 // return pf_publish total list 3529 var sp1_1_deferred = $.Deferred(); 3530 $.progressON('', $.sp.org_sid + (($.sp.sid_code) ? $.lang[LANG]['editor.publish.step.1.p'] + ' (' + $.sp.sid_code + ')' : '') + $.lang[LANG]['editor.publish.step.1.n'],0,true); 3531 3532 $.ajax({ 3533 url : '/template/sitepublish1', 3534 data : { sid : $.sp.sid, onoff : 1 }, 3535 type : 'POST', 3536 dataType : 'json', 3537 async : true, 3538 cashe : false, 3539 success : function(data1) { 3540 $('.progress-bar').css('width','20%'); 3541 3542 $.sp.step_total = [0,0,0,0]; 3543 $.sp.step_success = [0,0,0,0]; 3544 3545 $.sp.change_total = data1.total; 3546 $.sp.change_success = 0; 3547 $.sp.change_list = {}; 3548 $.sp.per = Math.ceil(70 / data1.total); 3549 3550 sp1_1_deferred.resolve(data1.total); 3551 } 3552 }); 3553 3554 return sp1_1_deferred.promise(); 3555 }, 3556 step2: function(step,start) { 3557 // d->i->u 3558 3559 var sp2_1 = $.sp.step2_1(step,start); 3560 sp2_1.done(function(r2_1) { 3561 if(r2_1 > 0) $.sp.step2(step,r2_1); 3562 else { 3563 if(step == 'd') $.sp.step2('i',0); 3564 else if(step == 'i') $.sp.step2('u',0); 3565 else if(step == 'u') $.sp.step3(); 3566 else $.sp.end(); 3567 } 3568 }).fail(function(r2_1_error) { 3569 console.log('r2_1_error: '+r2_1_error); 3570 $.sp.end(true); 3571 }); 3572 }, 3573 step2_1: function(this_step,this_start) { 3574 // sites[idx] - pf_publish.pbs_val == pb_page.seq (DELETE | INSERT | UPDATE) 3575 // sites[idx] - pf_publish.pbs_val == pb_gallery.seq (DELETE | INSERT | UPDATE) 3576 // return pb_page.seq, pb_gallery.seq list + (200ê°ì© ì²ë¦¬) more? 3577 // $list = array('b'=>array(), 'g'=>array(), 'next_start'=>$start+$limit); 3578 // json_result(array('result' => 'done pf_publish delete', 'list' => $list, 'total' => $total)); 3579 var sp2_1_deferred = $.Deferred(); 3580 $.progressON('', $.sp.org_sid + (($.sp.site_code) ? $.lang[LANG]['editor.publish.step.2.p'] + ' (' + $.sp.site_code + ')' : '') + $.lang[LANG]['editor.publish.step.2.n'],0,true); 3581 3582 $.ajax({ 3583 url : '/template/sitepublish2/'+this_step, 3584 data : { sid : $.sp.sid, start: this_start }, 3585 type : 'POST', 3586 dataType : 'json', 3587 async : true, 3588 cashe : false, 3589 success : function(data2) { 3590 var this_step_k = $.sp.step_k[this_step]; 3591 if(this_start > 0) { 3592 $.sp.change_list[this_step].b = $.sp.change_list[this_step].b.concat(data2.list.b); 3593 $.sp.change_list[this_step].g = $.sp.change_list[this_step].g.concat(data2.list.g); 3594 } else { 3595 $.sp.step_total[this_step_k] = data2.total; 3596 $.sp.change_list[this_step] = data2.list; 3597 } 3598 3599 var this_success = data2.list.b.length + data2.list.g.length; 3600 $.sp.step_success[this_step_k] = $.sp.step_success[this_step_k] + this_success; 3601 $.sp.change_success = $.sp.change_success + this_success; 3602
3603 var next_start = ($.sp.step_success[this_step_k] < data2.total) ? data2.list.next_start : 0, 3604 bar_w = 20 + ($.sp.per * $.sp.change_success); 3605 $('.progress-bar').css('width',bar_w+'%'); 3606 3607 sp2_1_deferred.resolve(next_start); 3608 } 3609 }); 3610 return sp2_1_deferred.promise(); 3611 }, 3612 step3: function() { 3613 $('.progress-bar').css('width','95%'); 3614 3615 var sp3_1 = $.sp.step3_1(); 3616 sp3_1.done(function() { 3617 $.sp.end(); 3618 }).fail(function(r3_1_error) { 3619 console.log('r3_1_error: '+r3_1_error); 3620 $.sp.end(true); 3621 }); 3622 }, 3623 step3_1: function() { 3624 // sites[idx] - pf_publish.sid == SID (DELETE) 3625 var sp3_1_deferred = $.Deferred(); 3626 $.progressON('', $.sp.org_sid + (($.sp.site_code) ? $.lang[LANG]['editor.publish.step.3.p'] + ' (' + $.sp.site_code + ')' : '') + $.lang[LANG]['editor.publish.step.3.n'],0,true); 3627 3628 $.ajax({ 3629 url : '/template/sitepublish3/', 3630 data : { sid : $.sp.sid }, 3631 type : 'POST', 3632 dataType : 'json', 3633 async : true, 3634 cashe : false, 3635 success : function(data3) { 3636 $('.progress-bar').css('width','100%'); 3637 sp3_1_deferred.resolve(); 3638 } 3639 }); 3640 return sp3_1_deferred.promise(); 3641 3642 } 3643 } 3644 3645 var sp0 = $.sp.step0(sid); 3646 sp0.done(function() { 3647 $.sp.step1(); 3648 }).fail(function(r0_error) { 3649 console.log('r0_error: '+r0_error); 3650 $.sp.end(); 3651 }); 3652 } 3653 3654 $.fn.publishGallery = function(sid) { 3655 $.progressON($.lang[LANG]['editor.publish.step.start'],'',0,true); 3656 $.sp = { 3657 domain: (typeof MODE != 'undefined' && MODE == 'config')? DOMAIN : $('#pubhost a').attr('href'), 3658 step1: function() { 3659 var deferred = $.Deferred(); 3660 3661 $.ajax({ 3662 url : '/template/publishGallery/step1', 3663 data : { sid : sid }, 3664 type : 'POST', 3665 dataType : 'json', 3666 async : true, 3667 cashe : false, 3668 success : function(data1) { 3669 console.log('data', data1); 3670 $('.progress-bar').css('width','25%'); 3671 deferred.resolve(data1); 3672 } 3673 }); 3674 3675 return deferred.promise(); 3676 }, 3677 step2: function() { 3678 var deferred = $.Deferred(); 3679 3680 $.ajax({ 3681 url : '/template/publishGallery/step2', 3682 data : { sid : sid }, 3683 type : 'POST', 3684 dataType : 'json', 3685 async : true, 3686 cashe : false, 3687 success : function(data2) { 3688 console.log('data', data2); 3689 $('.progress-bar').css('width','50%'); 3690 3691 deferred.resolve(data2); 3692 } 3693 }); 3694 3695 return deferred.promise(); 3696 }, 3697 clear: function() { 3698 var deferred = $.Deferred(); 3699 3700 $.ajax({ 3701 url : '/template/publishGallery/clear', 3702 data : { sid : sid }, 3703 type : 'POST', 3704 dataType : 'json', 3705 async : true, 3706 cashe : false, 3707 success : function(data3) { 3708 console.log('data', data3); 3709 $('.progress-bar').css('width','75%'); 3710 deferred.resolve(data3); 3711 } 3712 }); 3713 3714 return deferred.promise(); 3715 }, 3716 end: function(isError) { 3717 if(typeof isError == 'undefined') isError = false;
3718 if(isError) { 3719 $.progressOFF(); 3720 $(this).showModalFlat('ERROR','error', true, false, '', 'ok', '', 'cl-p130 cl-cmmodal cl-s-btn w560 cl-p0 cl-okbtn-pbt70'); 3721 } else { 3722 $('.progress-bar').css('width','100%'); 3723 setTimeout(function() { 3724 $.progressOFF(); 3725 $.processON(); 3726 if($('.processModal').length ==1) { 3727 $.processOFF(); 3728 var modal = $(this).showModalFlat($.lang[LANG]['editor.publish.priview.title'],$.lang[LANG]['editor.publish.priview'], true, false ,function(){ 3729 window.open($.sp.domain, '_blank'); 3730 modal.modal('hide'); 3731 },'ok', '', 'cl-p130 cl-cmmodal cl-s-btn w560 cl-p0 cl-okbtn-pbt70 cl-publish-complete','','',function(){ 3732 $('.cl-publish-complete .ok-button-dialog, .cl-publish-complete .close').on('click',function(){ 3733 $.processOFF(); 3734 }); 3735 }); 3736 } 3737 }, 500); 3738 } 3739 } 3740 } 3741 3742 $.sp.step1().then(function (res1) { 3743 return $.sp.step2(res1); 3744 }) 3745 .then(function (res2) { 3746 return $.sp.clear(res2); 3747 }) 3748 .done(function () { 3749 return $.sp.end(); 3750 }) 3751 .fail(function (err) { 3752 return $.sp.end(err); 3753 }); 3754 } 3755 3756 $.musicON = function(play) { 3757 play = (typeof play == 'undefined') ? true : play; 3758 var tpl = '\ 3759 <div id="cl-music-player" class="cl-mplayer"></div>\ 3760 <div id="cl-music-container" class="jp-audio" role="application" aria-label="media player">\ 3761 <div class="jp-type-playlist">\ 3762 <div class="jp-gui jp-interface">\ 3763 <div class="jp-controls-holder">\ 3764 <div class="jp-controls">\ 3765 <div class="music-player-controls">\ 3766 <span class="jp-backward" role="button" tabindex="0"><i class="fa fa-backward" aria-hidden="true"></i></span>\ 3767 <span class="jp-play" role="button" tabindex="0"><i class="fa fa-pause" aria-hidden="true"></i></span>\ 3768 <span class="jp-forward" role="button" tabindex="0"><i class="fa fa-forward" aria-hidden="true"></i></span>\ 3769 </div>\ 3770 <div class="music-player-progress">\ 3771 <div class="jp-progress">\ 3772 <div class="jp-seek-bar">\ 3773 <div class="jp-play-bar"></div>\ 3774 </div>\ 3775 </div>\ 3776 </div>\ 3777 <div class="jp-lists">\ 3778 <span class="music-lists" role="button" tabindex="0">LIST</span>\ 3779 </div>\ 3780 <div class="music-playlist-wrap">\ 3781 <div class="jp-playlist"><ul class="music-playlist"><li></li></li></div>\ 3782 </div>\ 3783 </div>\ 3784 </div>\ 3785 </div>\ 3786 <div class="jp-no-solution">\ 3787 <span>Update Required</span>\ 3788 To play the media you will need to either update your browser to a recent version or update your <a href="http://get.adobe.com/flashplayer/" target="_blank">Flash plugin</a>.\ 3789 </div>\ 3790 </div>\ 3791 </div>\ 3792 ', 3793 equalizer_img = ($('body').width() < 769) ? 'https://storage.googleapis.com/i.addblock.net/equal_stop.gif' : 'https://storage.googleapis.com/i.addblock.net/equal.gif', 3794 checkFree = (!property.VALIDPLAN || property.VALIDTYPE == 'PK') ? true : false, 3795 move_position = (checkFree) ? 'class="moved"' : '', 3796 vpModeOnoff = (property.SETTINGS.vpMode_onoff === true) ? true : false, 3797 vpOption = (property.SETTINGS.viewportMode) ? property.SETTINGS.viewportMode : '', 3798 WebType = $.mpcWeb.mpcCheckWebType(), 3799 checkFnav = ($('.fnav').length > 0 && vpOption=='mobile_web') ? true : false,
3800 $music_icon = $('<div id="cl-music-player-icon" '+move_position+'><img src="' + equalizer_img + '" class="hand"></div>'); 3801 3802 $('#goto-top').after($music_icon); 3803 $('#cl-music-player-icon').after(tpl); 3804 if($('.fnav').length > 0) { 3805 if(window.innerWidth <= 480) { 3806 $('#goto-top').addClass('movedOne'); 3807 $music_icon.addClass('movedOne'); 3808 } 3809 } else if($(`.quickmenu.non_config`).length > 0) { 3810 quickMenuMusicPosition(property); 3811 } 3812 3813 if(vpModeOnoff && WebType == 'MOBILE') $.mpcWeb.mpcMusicandGoTop(checkFnav,vpOption); 3814 3815 ($('body').width() < 769) ? $('.jp-play i').removeClass('fa-pause').addClass('fa-play').parent().addClass('pause') : ''; 3816 var music = (typeof property == 'undefined') ? [] : property.MUSIC; 3817 3818 if(music.length==0) { 3819 $music_icon.addClass('hide'); 3820 $music_icon.removeClass('movedOne'); 3821 $('#goto-top').removeClass('movedOne'); 3822 } 3823 var myPlaylist = new jPlayerPlaylist({ 3824 jPlayer: '#cl-music-player', 3825 cssSelectorAncestor: '#cl-music-container' 3826 }, music, { 3827 playlistOptions: { 3828 loop: true, 3829 autoPlay: play, 3830 loopOnPrevious: true, 3831 enableRemoveControls: false 3832 }, 3833 ready: function() { 3834 if (!window._musicUserInteracted) { 3835 $(this).jPlayer('option', 'muted', true); 3836 $(document).one('click scroll touchstart keydown', function() { 3837 $('#cl-music-player').jPlayer('option', 'muted', false); 3838 }); 3839 } 3840 }, 3841 ended: function() { 3842 // var $item = $('.music-playlist li'), 3843 // idx = $item.parent().find('.active').index(), 3844 // active = (idx+1 > $item.length) ? 0 : idx+1; 3845 3846 // $item.removeClass('active'); 3847 // $item.eq(active).addClass('active'); 3848 }, 3849 swfPath: '/js', 3850 solution: 'html, flash', 3851 supplied: 'mp3', 3852 preload: 'metadata', 3853 volume: 1, 3854 loop: true, 3855 muted: false, 3856 backgroundColor: '#000000', 3857 3858 smoothPlayBar: true, 3859 keyEnabled: false, 3860 audioFullScreen: false // Allows the audio poster to go full screen via keyboard 3861 }); 3862 3863 $music_icon.click(function() { 3864 $(this).toggleClass('show'); 3865 if($(this).hasClass('show')) { 3866 $('#cl-music-container').css('display','block'); 3867 } else { 3868 $('#cl-music-container').css('display','none'); 3869 } 3870 }); 3871 3872 var $play = $('.jp-play'), 3873 $next = $('.jp-forward'), 3874 $prev = $('.jp-backward'), 3875 $list = $('.music-lists'), 3876 $playlist_wrap = $('.music-playlist-wrap'), 3877 $playlist = $('.music-playlist'), 3878 $item = $('.music-playlist li'); 3879 3880 $playlist.empty(); 3881 if(myPlaylist.playlist.length) { 3882 var index = myPlaylist.current; 3883 $.each(myPlaylist.playlist, function(i,v) { 3884 var active = (i == index) ? 'jp-playlist-current' : '', 3885 item = '<li class="' + active + '" data-music-index="' + i + '"><span class="hand">' + v.title + '</span></li>'; 3886 $playlist.append(item); 3887 }); 3888 } 3889 3890 $list.click(function() { 3891 $playlist_wrap.toggle(); 3892 if($playlist_wrap.css('display') == 'block') { 3893 $list.text('CLOSE'); 3894 } else { 3895 $list.text('LIST'); 3896 } 3897 }); 3898 3899 $('body').on( 'click', '.music-playlist li a', function(e) { 3900 var $pause_icon = '<i class="fa fa-pause"></i>'; 3901 $equalizer = $("#cl-music-player-icon"),
3902 src = 'https://storage.googleapis.com/i.addblock.net/equalizer.gif', 3903 $equalizer.find('img').attr('src',src); 3904 $('.jp-play').removeClass('pause'); 3905 $('.jp-play').html($pause_icon); 3906 }); 3907 3908 $('.music-playlist li span').click(function() { 3909 var idx = $(this).parent().attr('data-music-index'); 3910 if(typeof idx == 'undefined') return; 3911 myPlaylist.play(idx); 3912 myPlaylist.current = idx; 3913 $('.music-playlist li').removeClass('jp-playlist-current'); 3914 $('.music-playlist li').eq(idx).addClass('jp-playlist-current'); 3915 // $.musicPlay(); 3916 }); 3917 3918 $play.click(function() { 3919 if($(this).hasClass('pause')) { 3920 $.musicPlay(); 3921 } else { 3922 $.musicPause(); 3923 } 3924 }); 3925 $next.click(function() { 3926 $.musicNext(myPlaylist); 3927 3928 }); 3929 $prev.click(function() { 3930 $.musicPrev(myPlaylist); 3931 }) 3932 3933 document.onkeydown = function(evt) { 3934 evt = evt || window.event; 3935 if (evt.keyCode == 27) { 3936 $.musicPause(); 3937 } 3938 }; 3939 // myPlaylist.play(); 3940 // $('#cl-music-player').jPlayer('play'); 3941 } 3942 $.musicPause = function() { 3943 var $play_icon = '<i class="fa fa-play"></i>', 3944 $equalizer = $('#cl-music-player-icon'), 3945 src = 'https://storage.googleapis.com/i.addblock.net/equal_stop.gif'; 3946 $equalizer.find('img').attr('src',src); 3947 $('.jp-play').addClass('pause'); 3948 $('.jp-play').html($play_icon); 3949 $('#cl-music-player').jPlayer('pause'); 3950 } 3951 $.musicPlay = function() { 3952 var $pause_icon = "<i class='fa fa-pause'></i>"; 3953 $equalizer = $('#cl-music-player-icon'), 3954 src = 'https://storage.googleapis.com/i.addblock.net/equalizer.gif', 3955 $equalizer.find('img').attr('src',src); 3956 $('.jp-play').removeClass('pause'); 3957 $('.jp-play').html($pause_icon); 3958 $('#cl-music-player').jPlayer('play'); 3959 } 3960 $.musicStop = function() { 3961 $('#cl-music-player').jPlayer('stop'); 3962 } 3963 $.musicRepeat = function() { 3964 } 3965 $.musicOFF = function() { 3966 } 3967 $.musicNext = function(player) { 3968 player.next(); 3969 var index = player.current; 3970 $.musicPlay(); 3971 } 3972 $.musicPrev = function(player) { 3973 player.previous(); 3974 var index = player.current; 3975 $.musicPlay(); 3976 } 3977 3978 3979 $.fnav = { 3980 getFnav: function() { 3981 var data = (PAGE_MODE == 'c') ? SETTINGS.fnav : property.SETTINGS.fnav; 3982 if(typeof data == 'undefined' || $.isEmptyObject(data)) data = new Array(); 3983 3984 return data; 3985 }, 3986 getFnavColor: function(target) { 3987 var color = ''; 3988 if(target == 'font') { 3989 color = (PAGE_MODE == 'c') ? SETTINGS.fnavFcolor : property.SETTINGS.fnavFcolor; 3990 } else if(target == 'bg') { 3991 color = (PAGE_MODE == 'c') ? SETTINGS.fnavBg : property.SETTINGS.fnavBg; 3992 var hexRegex = /^([0-9a-fA-F]{3}|[0-9a-fA-F]{4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/; 3993 if(hexRegex.test(color)) color = '#'+color; 3994 } 3995 3996 if(typeof color == 'undefined' || !color) return (target == 'font') ? '#ffffff' : '#000000'; 3997 else return color; 3998 }, 3999 checkFnavON: function(data) { 4000 var result = false, 4001 fnav_data = (typeof data != 'undefined') ? data : $.fnav.getFnav(); 4002 4003 $.each(fnav_data, function(i,obj) { 4004 if(obj['display'] == 'on') result = true; 4005 }); 4006 4007 return result; 4008 }, 4009 draw: function(data) { 4010 var fnav_data = (typeof data != 'undefined') ? data : $.fnav.getFnav(), 4011 hasON = $.fnav.checkFnavON(fnav_data); 4012 4013 if (window.location.href.indexOf('_checkout') != -1) hasON = false; 4014 4015 if(!hasON) { 4016 $('.fnav.fnav-mobile-fnav').remove(); 4017 } else { 4018 var fnav_html = $.fnav.listHTML(fnav_data,hasON); 4019 if(fnav_html.length > 0) { 4020 if($('.dsgn-body').find('.fnav.fnav-mobile-fnav').length > 0) $('.dsgn-body .fnav.fnav-mobile-fnav').replaceWith(fnav_html); 4021 else $('.dsgn-body').find('.el-footer').before(fnav_html); 4022 } else { 4023 $('.dsgn-body').find('.fnav.fnav-mobile-fnav').remove(); 4024 } 4025 } 4026 }, 4027 listHTML: function(fnav_data,hasON) { 4028 if(typeof fnav_data == 'undefined') fnav_data = $.fnav.getFnav(); 4029 if(typeof hasON == 'undefined') hasON = $.fnav.checkFnavON(fnav_data); 4030 4031 var fnav_fcolor = $.fnav.getFnavColor('font'), 4032 fnav_bg = $.fnav.getFnavColor('bg'), 4033 str = ''; 4034 4035 if(hasON) { 4036 $.each(fnav_data, function(i,v) { 4037 str += $.fnav.itemHTML(v.idx, v.name, v.type, v.value, v.target, v.icon, v.display); 4038 }); 4039 } 4040 4041 return '\ 4042 <div class="fnav fnav-mobile-fnav" style="--fnav-bgcolor: '+fnav_bg+'; --fnav-color: '+fnav_fcolor+'; ">\ 4043 ' + str + '\ 4044 </div>\ 4045 '; 4046 }, 4047 itemHTML: function(idx,name,type,value,target,icon,display) { 4048 var href = '#', 4049 attr_target = (type == "tel") ? ' target=""' : ' target="' + target + '"', 4050 attr_link = ''; 4051 4052 if(icon == 'empty') icon = ''; 4053 4054 if(value) { 4055 if(type == "tel") { 4056 href = (value.match(/^tel:/)) ? value : 'tel:' + value; 4057 } else { //link 4058 if(checkBase64Encode(decodeURIComponent(value))) value = Base64.decode(decodeURIComponent(value)); 4059 else value = (checkBase64Encode(value)) ? Base64.decode(value) : value; 4060 4061 var menulist = (PAGE_MODE == 'c') ? MENULIST : property.MENULIST, 4062 one = (PAGE_MODE == 'c') ? ONE : property.ONE, 4063 view = (PAGE_MODE == 'c') ? VIEW : property.VIEW; 4064 4065 href = makeLinkUrl(value,one,view); 4066 if(menulist.indexOf(value.replace(/ /g,'-'))>-1) { 4067 attr_link = 'data-user-link="' + href + '"'; 4068 } else if(value.match(/^\@/g)) { 4069 attr_link = 'attr-bookmark="' + value.replace(/^\@/g,'') + '"'; 4070 } else { 4071 var link = encodeURIComponent(Base64.encode(value)); 4072 attr_link = 'attr-link="' + link + '"'; 4073 } 4074 } 4075 4076 } 4077 4078 if(display != 'on') return ''; 4079 else return '\ 4080 <div class="fnav-item" data-idx="' + idx + '" data-type="' + type + '">\ 4081 <a href="' + href + '" ' + attr_target + ' ' + attr_link + '>\ 4082 <i class="' + icon + '" aria-hidden="true"></i>\
4083 <span class="fnav-name">' + name + '</span>\ 4084 </a>\ 4085 </div>\ 4086 '; 4087 }, 4088 4089 } 4090 4091 $.mpcWeb = { 4092 init: function(vpOption,contents,WebType,zoom,pagemove) { 4093 var device_w = (vpOption=='mobile_pc') ? 1440 : 'device-width', 4094 scale = (vpOption=='mobile_pc') ? (window.screen.width / 1440) : 1.0, 4095 zoom = (zoom) ? '' : ', maximum-scale=1, user-scalable=no', 4096 mpc_icon = (vpOption == 'mobile_pc') ? '<i class="fa fa-mobile mpc_icon" aria-hidden="true"></i>' : '<i class="fa fa-desktop mpc_icon" aria-hidden="true"></i>', 4097 checkFnav = ($('.fnav').length > 0 && vpOption=="mobile_web") ? true : false; 4098 4099 //$.mpcWeb.mpcWebShowcase(vpOption,contents,pagemove); 4100 4101 $('.dsgn-body .mobilepc_ch .mpc_icon').remove(); 4102 $('.dsgn-body .mobilepc_ch').prepend(mpc_icon); 4103 document.documentElement.setAttribute('data-mpc-vpmode',vpOption); 4104 4105 var viewport = document.querySelector('meta[name="viewport"]'); 4106 if(viewport) viewport.setAttribute('content','width='+device_w+', initial-scale='+scale+''+zoom+''); 4107 setTimeout(function() { 4108 if(typeof Event == 'function') window.dispatchEvent(new Event('resize')); 4109 else { 4110 var resizeEvent = document.createEvent('Event'); 4111 resizeEvent.initEvent('resize',true,true); 4112 window.dispatchEvent(resizeEvent); 4113 } 4114 4115 if(typeof $.clnav != 'undefined' 4116 && typeof $.clnav.check == 'function' 4117 && $.clnav.check() 4118 ) { 4119 if(typeof $.clnav.refreshMobileStyle == 'function') $.clnav.refreshMobileStyle(); 4120 else if(typeof $.clnav.setMobileStyle == 'function') { 4121 var $header = $('.cl-nav').first(); 4122 if($header.length) $.clnav.setMobileStyle($header); 4123 if(typeof $.clnav.setRootcss == 'function') $.clnav.setRootcss(); 4124 } 4125 } 4126 }, 80); 4127 4128 /*if($('.dsgn-body').hasClass('sidebar')) { 4129 $('.dsgn-body').removeClass('sidebar').addClass('removed-sidebar'); 4130 } else if ($('.dsgn-body').hasClass('removed-sidebar')) { 4131 $('.dsgn-body').removeClass('removed-sidebar').addClass('sidebar'); 4132 }*/ 4133 4134 $.mpcWeb.mpcMusicandGoTop(checkFnav,vpOption); 4135 4136 if(checkFnav && WebType == 'MOBILE') { 4137 $('.fnav.fnav-mobile-fnav').css('margin-bottom','53px'); 4138 $('.element.el-footer').css('margin-bottom','100px'); 4139 } else { 4140 $('.mobilepc_ch').css('margin-bottom','0px'); 4141 $('.element.el-footer').css('margin-bottom','0px'); 4142 } 4143 }, 4144 4145 4146 mpcWebhtml: function(vpOption,contents,zoom,pagemove,sid) { 4147 //if (window.location.href.indexOf('_checkout') != -1) return false; 4148 sid = (sid) ? sid : (typeof property != 'undefined' ? property.SID : SID); 4149 pagemove = ((typeof pagemove == 'undefined') || !pagemove) ? '' : pagemove; 4150 4151 $.mpcWeb.mpcCookie(vpOption,sid); 4152 4153 if($.cookie('vpmode')) { 4154 vpOption = $.cookie('vpmode'); 4155 } 4156 4157 var vpChangeText = (vpOption=="mobile_pc") ? $.lang[LANG]['editor.mobile.changePc.mobileWeb'] : $.lang[LANG]['editor.mobile.changePc.mobilePc'], 4158 mpc_html = "\ 4159 <div class='mobilepc_ch' data-desktop-option='"+vpOption+"'>\ 4160 <p class='hand'>\ 4161 <span class='mpc-name'>" + vpChangeText + "</span>\ 4162 </p>\ 4163 </div>\ 4164 ", 4165 WebType = $.mpcWeb.mpcCheckWebType(); 4166 4167 if(WebType == 'MOBILE') { 4168 if(window.location.href.indexOf('_checkout') == -1) { 4169 $('.dsgn-body').find('.mobilepc_ch').remove(); 4170 $('.dsgn-body').append(mpc_html); 4171 } 4172 $.mpcWeb.init(vpOption,contents,WebType,zoom,pagemove); 4173 $.mpcWeb.mpcChangeVal(vpOption,contents,WebType,zoom,pagemove,sid); 4174 } 4175 }, 4176 4177 mpcWebShowcase : function(vpOption,contents,pagemove) { 4178 $.each(contents,function(i,v) { 4179 var v_el = (pagemove=='pagemove') ? v : v.element; 4180 if((vpOption == "mobile_pc") && (v_el.type == 'showcase')) $("."+v_el.elname).addClass('mobilePc_he
4180ight'); 4181 else $("."+v_el.elname).removeClass('mobilePc_height'); 4182 }); 4183 4184 }, 4185 4186 mpcChangeVal : function(vpOption,contents,WebType,zoom,pagemove,sid) { 4187 //if (window.location.href.indexOf('_checkout') != -1) return false; 4188 sid = (sid) ? sid : (typeof property != 'undefined' ? property.SID : SID); 4189 $('.mobilepc_ch').off('click.mpcWeb').on('click.mpcWeb', function() { 4190 vpOption = (vpOption=="mobile_pc") ? 'mobile_web' : 'mobile_pc'; 4191 var vpChangeText = (vpOption=="mobile_pc") ? $.lang[LANG]['editor.mobile.changePc.mobileWeb'] : $.lang[LANG]['editor.mobile.changePc.mobilePc']; 4192 4193 $(this).find('.mpc-name').text(vpChangeText); 4194 $(this).attr('data-desktop-option',vpOption); 4195 document.documentElement.setAttribute('data-mpc-vpmode',vpOption); 4196 4197 $.mpcWeb.init(vpOption,contents,WebType,zoom,pagemove); 4198 4199 if(typeof property != 'undefined') { 4200 if(property.ONE && !property.VIEW || property.PAGE == property.MENULINK[0] && !property.VIEW) setSitePopup(); 4201 4202 setTimeout(() => { 4203 if(typeof property.SETTINGS.qm_onoff != 'undefined' && property.SETTINGS.qm_onoff==true) { 4204 var device_type = (vpOption=='mobile_pc') ? 'pc' : 'mobile', 4205 mpc_height = $('.mobilepc_ch').innerHeight(); 4206 4207 $.quickmenu.setHTML($.quickmenu['quickmenu'], device_type); 4208 mobileWebQuickmenuPosition(property,device_type); 4209 if($('#cl-music-player-icon').length > 0) quickMenuMusicPosition(property); 4210 } 4211 }, 500); 4212 } 4213 if($('.element[data-type="forum"]').length > 0) { 4214 var icon_notice = '<i class="tpl-forum-list-notice-icon cl-icon notice01" aria-hidden="true"></i>'; 4215 4216 $('.element[data-type="forum"] .tpl-forum-list-title .tpl-forum-list-notice-icon').remove(); 4217 4218 $('.element[data-type="forum"]').each(function(idx, v) { 4219 var $forum = $(v); 4220 var type = $(v).attr('data-type2'); 4221 4222 if($forum.find('.tpl-forum-list-title[data-option="N"]').length > 0) { //forum notice 4223 if(vpOption == 'mobile_web' && type == 'thumb') { 4224 $forum.find('.tpl-forum-list-num.n').each(function(idx, n){ 4225 var num = $(n).attr('data-fm-num'); 4226 $(n).html(num); 4227 }); 4228 } else { 4229 $forum.find('.tpl-forum-list-num.n').html(icon_notice); 4230 } 4231 4232 if($forum.find('.tpl-forum-list-num').hasClass('hidden')) { // field_disabled = num 4233 $forum.find('.tpl-forum-list-title[data-option="N"]').prepend(icon_notice); 4234 } else { 4235 if(vpOption == 'mobile_web') { 4236 $forum.find('.tpl-forum-list-title[data-option="N"]').prepend(icon_notice); 4237 if(type == 'normal' && $forum.find('.tpl-forum-list-num').css('display') != 'none') { 4238 $forum.find('.tpl-forum-list-title .tpl-forum-list-notice-icon').addClass('hide'); 4239 } 4240 } else { 4241 $forum.find('.tpl-forum-list-num.n').html(icon_notice); 4242 } 4243 } 4244 } 4245 }); 4246 } 4247 $('.element[data-msny="true"]').each(function() { 4248 reloadBlockMasonry('refresh',$(this)); 4249 }); 4250 4251 $.mpcWeb.mpcCookie(vpOption,sid); 4252 4253 if (window.location.href.indexOf('_checkout') != -1) { 4254 $('.dsgn-body').find('.mobilepc_ch').remove(); 4255 } 4256 4257 if($('body').hasClass('openBandBanner')) $.siteBanner.call('band',false,false,true,true) 4258 if($('body').hasClass('openPopupBanner')) $.siteBanner.call('popup',false,false,true,true) 4259 4260 setTimeout(function(){ 4261 $.fheader.position(); 4262 setFixedMenuCss(false); 4263 },50); 4264 4265 }); 4266 }, 4267 4268 mpcCheckWebType : function(){ 4269 var filter = "win16|win32|win64|mac|macintel", 4270 WebType = ""; 4271 4272 if (navigator.platform) { 4273 if (filter.indexOf(navigator.platform.toLowerCase()) < 0) WebType = "MOBILE"; 4274 else WebType = "PC"; 4275 } 4276 4277 return WebType; 4278 }, 4279 4280 mpcMusicandGoTop : function(checkFnav,vpOption) { 4281 var checkmpc = ($('.mobilepc_ch').length > 0) ? true : false;
4282 4283 if(checkmpc && vpOption == 'mobile_pc') { 4284 if($('#cl-music-player-icon').length > 0) $('#goto-top,#cl-music-player-icon').removeClass('moveMpc movepc movedOne').addClass('moved'); 4285 else $('#goto-top,#cl-music-player-icon').removeClass('movedOne moveMpc movepc').addClass('moved'); 4286 } else { 4287 if(checkFnav) { 4288 if($('#cl-music-player-icon').length > 0) { 4289 $('#goto-top').css('bottom',''); 4290 $('#goto-top,#cl-music-player-icon').removeClass('movedOne movepc moved').addClass('moveMpc'); 4291 } else $('#goto-top').removeClass('movedOne movepc moved moveMpc').css('bottom','120px'); 4292 } else { 4293 if($('#cl-music-player-icon').length > 0) $('#goto-top,#cl-music-player-icon').removeClass('moveMpc movepc moved').addClass('movedOne'); 4294 else $('#goto-top,#cl-music-player-icon').removeClass('movedOne movepc moveMpc moved'); 4295 } 4296 } 4297 }, 4298 mpcCookie : function(vpOption,sid) { 4299 sid = (sid) ? sid : (typeof property != 'undefined' ? property.SID : SID); 4300 var date = new Date(); 4301 date.setTime(date.getTime() + 6*60*60*1000); // 6h 4302 4303 $.cookie('vpmode-'+sid, vpOption, { expires: date, path : '/' }); 4304 }, 4305 mpcGetVpmode : function(vpmode,settings,sid) { 4306 sid = (sid) ? sid : (typeof property != 'undefined' ? property.SID : SID); 4307 if($.cookie('vpmode-'+sid)) vpmode = $.cookie('vpmode-'+sid); 4308 else vpmode = (typeof $('.mobilepc_ch').attr('data-desktop-option') != 'undefined') ? $('.mobilepc_ch').attr('data-desktop-option') : settings.viewportMode; 4309 4310 return vpmode; 4311 } 4312 } 4313 4314 /* menu ì¶ê° ë²í¼ ì¤ì **************************************************************/ 4315 $.menuFixBtn = { 4316 topSet : function(num,checkmodal,validArray,slang){ 4317 var str = '', 4318 searchOn = '', 4319 cartOn = '', 4320 umOn = '', 4321 ssid = (PAGE_MODE == 'c') ? SID : property.SID, 4322 is_templates = checkTemplateSite(ssid), 4323 s_service = (PAGE_MODE == 'c') ? SERVICE : property.SERVICE, 4324 checkGabia = (s_service.indexOf('gabia') > -1) ? true : false, 4325 checkBS = (validArray['validplan'] && (validArray['validtype'] == 'BS' || (checkGabia && (validArray['validtype'] == 'FR')))) ? true : false, 4326 checkBN = (validArray['validplan'] && validArray['validtype'] == 'BN') ? true : false, 4327 checkSM = (validArray['validplan'] && validArray['validtype'] == 'SM') ? true : false, 4328 checkFREE = (!validArray['validplan'] || validArray['validplan'] == 'FR' || validArray['validplan'] == 'PK') ? true : false, 4329 checkElView = ($('.elviewhtml').length>0) ? true : false, 4330 fixBtnSITEUM = (checkElView) ? '' : ((PAGE_MODE=='c') ? SITEUM : property.SITEUM), 4331 checkSITEUM = (!checkElView && ((checkBN && typeof fixBtnSITEUM!='undefined' && Number(fixBtnSITEUM) > 0) || checkSM)) ? true : (checkElView ? true : false), 4332 checkmodal = (typeof checkmodal != 'undefined' && checkmodal) ? true : false, 4333 fixon = (typeof $('.el-menu header.navbar').attr('data-fixon') != 'undefined' && $('.el-menu header.navbar').attr('data-fixon')) ? $('.el-menu header.navbar').attr('data-fixon') : '', 4334 dropdownClass = (PAGE_MODE=='c') ? '' : 'dropdown ', 4335 slang = (typeof langObj != 'undefined' && langObj) ? langObj : ((PAGE_MODE == 'c') ? SLANG : property.SLANG); 4336 // lang_str = LANG; 4337 4338 if(!checkElView) { 4339 if(checkBN && !checkSITEUM) return ''; 4340 searchOn = (!checkSM) ? 'style="display:none;"' : ''; 4341 umOn = (checkBS || checkFREE || (checkBN && !checkSITEUM)) ? 'style="display:none;"' : ''; 4342 cartOn = (checkFREE) ? 'style="display:none;"' : ((checkSM) ? '' : 'style="display:none;"'); 4343 if(fixon && (checkBN || checkSM) && checkSITEUM) { 4344 searchOn = ((checkSM) && fixon.indexOf('search')>-1) ? '' : 'style="display:none;"'; 4345 cartOn = ((checkSM) && fixon.indexOf('cart')>-1) ? '' : 'style="display:none;"'; 4346 umOn = ((checkBN || checkSM) && fixon.indexOf('um')>-1) ? '' : 'style="display:none;"'; 4347 } 4348 if(fixon == 'all') { 4349 searchOn = 'style="display:none;"'; 4350 cartOn = 'style="display:none;"'; 4351 umOn = 'style="display:none;"'; 4352 } 4353 } 4354
4355 if(checkElView || checkmodal || is_templates) { 4356 umOn = (checkBS || checkFREE) ? 'style="display:none;"' : ''; 4357 searchOn = cartOn = (checkSM) ? '' : 'style="display:none;"'; 4358 } 4359 4360 /* ë¤êµì´ / ì¬ì´í¸ ì¸ì´ë³ lang ì²´í¬ ***/ 4361 // if((typeof slang != 'undefined' && typeof slang.select_code != 'undefined' && slang.select_code) 4362 // || (!$.isEmptyObject(slang) && slang.select_code)) { 4363 // //searchOn = (slang['select_code']=='ko' && checkSM) ? '' : 'style="display:none;"'; 4364 // lang_str = (slang['select_code'].toLowerCase()=='ko') ? 'ko' : lang_str; 4365 // } 4366 4367 switch(num) { 4368 case "01" : 4369 str = '\ 4370 <li class="siteSEARCH cl-fixbtn '+((!searchOn) ? 'cl-visible' : '')+'" '+searchOn+'><a href="#">SEARCH</a></li>\ 4371 <li class="siteUM cl-fixbtn '+dropdownClass+''+((!umOn) ? 'cl-visible' : '')+'" '+umOn+'>\ 4372 <a href="javascript:;" class="cl-login">LOGIN</a>\ 4373 <a href="javascript:;" class="cl-logout dropdown-toggle" style="display:none;">MY PAGE</a>\ 4374 </li>\ 4375 <li class="siteCART cl-fixbtn '+((!cartOn) ? 'cl-visible' : '')+'" '+cartOn+'><a href="#"><span class=\"cart-text\">CART</span><div class=\"cart-active\">5</div></a></li>\ 4376 '; 4377 break; 4378 4379 case "02" : 4380 str = '\ 4381 <li class="siteSEARCH cl-fixbtn '+((!searchOn) ? 'cl-visible' : '')+'" '+searchOn+'><a href="#">Search</a></li>\ 4382 <li class="siteUM cl-fixbtn '+dropdownClass+''+((!umOn) ? 'cl-visible' : '')+'" '+umOn+'>\ 4383 <a href="javascript:;" class="cl-login">Login</a>\ 4384 <a href="javascript:;" class="cl-logout dropdown-toggle" style="display:none;">My page</a>\ 4385 </li>\ 4386 <li class="siteCART cl-fixbtn '+((!cartOn) ? 'cl-visible' : '')+'" '+cartOn+'>\ 4387 <a href="#"><span class=\"cart-text\">Basket</span><div class=\"cart-active\">5</div></a>\ 4388 </li>\ 4389 '; 4390 break; 4391 4392 case "03" : 4393 str = '\ 4394 <li class="siteSEARCH cl-fixbtn '+((!searchOn) ? 'cl-visible' : '')+'" '+searchOn+'><a href="#">ê²ì</a></li>\ 4395 <li class="siteUM cl-fixbtn '+dropdownClass+''+((!umOn) ? 'cl-visible' : '')+'" '+umOn+'>\ 4396 <a href="javascript:;" class="cl-login">ë¡ê·¸ì¸</a>\ 4397 <a href="javascript:;" class="cl-logout dropdown-toggle" style="display:none;">ë§ì´íì´ì§</a>\ 4398 </li>\ 4399 <li class="siteCART cl-fixbtn '+((!cartOn) ? 'cl-visible' : '')+'" '+cartOn+'>\ 4400 <a href="#"><span class=\"cart-text\">ì¥ë°êµ¬ë</span>\ 4401 <div class=\"cart-active\"><span class=\"cart-active-txt\">5</span></div>\ 4402 </a>\ 4403 </li>\ 4404 '; 4405 break; 4406 4407 case "04" : 4408 str = '\ 4409 <li class="siteSEARCH cl-fixbtn '+((!searchOn) ? 'cl-visible' : '')+'" '+searchOn+'><a href="#">'+clSVG('fixbtn_search4',28,28,true)+'</a></li>\ 4410 <li class="siteUM cl-fixbtn '+dropdownClass+''+((!umOn) ? 'cl-visible' : '')+'" '+umOn+'>\ 4411 <a href="javascript:;" class="cl-login">'+clSVG('fixbtn_um_login4',28,28,true)+'</a>\ 4412 <a href="javascript:;" class="cl-logout dropdown-toggle" style="display:none;">'+clSVG('fixbtn_um_mypage4',28,28,true)+'</a>\ 4413 </li>\ 4414 <li class="siteCART cl-fixbtn '+((!cartOn) ? 'cl-visible' : '')+'" '+cartOn+'>\ 4415 <a href="#">'+clSVG('fixbtn_cart4',28,28,true)+'\ 4416 <div class=\"cart-active\"><span class=\"cart-active-txt\">5</span></div>\ 4417 </a>\ 4418 </li>\ 4419 '; 4420 break; 4421 4422 case "05" : 4423 str = '\ 4424 <li class="siteSEARCH cl-fixbtn '+((!searchOn) ? 'cl-visible' : '')+'" '+searchOn+'><a href="#">'+clSVG('fixbtn_search5',28,28,true)+'</a></li>\ 4425 <li class="siteUM cl-fixbtn '+dropdownClass+''+((!umOn) ? 'cl-visible' : '')+'" '+umOn+'>\ 4426 <a href="javascript:;" class="cl-login">'+clSVG('fixbtn_um_login5',28,28,true)+'</a>\ 4427 <a href="javascript:;" class="cl-logout dropdown-toggle" style="display:none;">'+clSVG('fixbtn_um_mypage5',28,28,true)+'</a>\ 4428 </li>\ 4429 <li class="siteCART cl-fixbtn '+((!cartOn) ? 'cl-visible' : '')+'" '+cartOn+'>\ 4430 <a href="#">'+clSVG('fixbtn_cart5',28,28,true)+'\ 4431 <div class=\"cart-active\"><span class=\"cart-active-txt\">5</span></div>\ 4432 </a>\ 4433 </li>\ 4434 '; 4435 break; 4436 4437 case "06" : 4438 str = '\ 4439 <li class="siteSEARCH cl-fixbtn '+((!searchOn) ? 'cl-visible' : '')+'" '+searchOn+'><a href="#">'+clSVG('fixbtn_search6',28,28,true)+'</a></li>\ 4440 <li class="siteUM cl-fixbtn '+dropdownClass+''+((!umOn) ? 'cl-visible' : '')+'" '+umOn+'>\ 4441 <a href="javascript:;" class="cl-login">'+clSVG('fixbtn_um_login6',28,28,true)+'</a>\ 4442 <a href="javascript:;" class="cl-logout dropdown-toggle" style="display:none;">'+clSVG('fixbtn_um_mypage6',28,28,true)+'</a>\ 4443 </li>\ 4444 <li class="siteCART cl-fixbtn '+((!cartOn) ? 'cl-visible' : '')+'" '+cartOn+'>\ 4445 <a href="#">'+clSVG('fixbtn_cart6',28,28,true)+'\ 4446 <div class=\"cart-active\"><span class=\"cart-active-txt\">5</span></div>\ 4447 </a>\ 4448 </li>\ 4449 '; 4450 break; 4451 4452 case "07" : 4453 str = '\ 4454 <li class="siteSEARCH cl-fixbtn '+((!searchOn) ? 'cl-visible' : '')+'" '+searchOn+'><a href="#">'+clSVG('fixbtn_search7',28,28,true)+'</a></li>\ 4455 <li class="siteUM cl-fixbtn '+dropdownClass+''+((!umOn) ? 'cl-visible' : '')+'" '+umOn+'>\ 4456 <a href="javascript:;" class="cl-login">'+clSVG('fixbtn_um_login7',28,28,true)+'</a>\ 4457 <a href="javascript:;" class="cl-logout dropdown-toggle" style="display:none;">'+clSVG('fixbtn_um_mypage7',28,28,true)+'</a>\ 4458 </li>\ 4459 <li class="siteCART cl-fixbtn '+((!cartOn) ? 'cl-visible' : '')+'" '+cartOn+'>\ 4460 <a href="#">'+clSVG('fixbtn_cart7',28,28,true)+'\ 4461 <div class=\"cart-active\">5</div>\ 4462 </a>\ 4463 </li>\ 4464 '; 4465 break; 4466 4467 case "08" : 4468 str = '\ 4469 <li class="siteSEARCH cl-fixbtn '+((!searchOn) ? 'cl-visible' : '')+'" '+searchOn+'><a href="#">'+clSVG('fixbtn_search8',28,28,true)+'<span class=\"btn_text\">SEARCH</span></a></li>\ 4470 <li class="siteUM cl-fixbtn '+dropdownClass+''+((!umOn) ? 'cl-visible' : '')+'" '+umOn+'>\ 4471 <a href="javascript:;" class="cl-login">'+clSVG('fixbtn_um_login8',28,28,true)+'<span class=\"btn_text\">LOGIN</span></a>\ 4472 <a href="javascript:;" class="cl-logout dropdown-toggle" style="display:none;">'+clSVG('fixbtn_um_mypage8',28,28,true)+'<span class=\"btn_text\">MY PAGE</span></a>\ 4473 </li>\ 4474 <li class="siteCART cl-fixbtn '+((!cartOn) ? 'cl-visible' : '')+'" '+cartOn+'>\ 4475 <a href="#">'+clSVG('fixbtn_cart8',28,28,true)+'\
4476 <span class=\"btn_text\">CART</span><div class=\"cart-active\">5</div>\ 4477 </a>\ 4478 </li>\ 4479 '; 4480 break; 4481 4482 case "09" : 4483 str = '\ 4484 <li class="siteSEARCH cl-fixbtn '+((!searchOn) ? 'cl-visible' : '')+'" '+searchOn+'><a href="#">ê²ì</a></li>\ 4485 <li class="siteUM cl-fixbtn '+dropdownClass+''+((!umOn) ? 'cl-visible' : '')+'" '+umOn+'>\ 4486 <a href="javascript:;" class="cl-login">ë¡ê·¸ì¸</a>\ 4487 <a href="javascript:;" class="cl-logout dropdown-toggle" style="display:none;">ë§ì´íì´ì§</a>\ 4488 </li>\ 4489 <li class="siteCART cl-fixbtn '+((!cartOn) ? 'cl-visible' : '')+'" '+cartOn+'>\ 4490 <a href="#">'+clSVG('fixbtn_cart9',28,28,true)+'\ 4491 <div class=\"cart-active\">5</div>\ 4492 </a>\ 4493 </li>\ 4494 '; 4495 break; 4496 4497 case "10" : 4498 str = '\ 4499 <li class="siteUM cl-fixbtn '+dropdownClass+''+((!umOn) ? 'cl-visible' : '')+'" '+umOn+'>\ 4500 <a href="javascript:;" class="cl-login">LOGIN</a>\ 4501 <a href="javascript:;" class="cl-logout dropdown-toggle" style="display:none;">MY PAGE</a>\ 4502 </li>\ 4503 <li class="siteSEARCH cl-fixbtn '+((!searchOn) ? 'cl-visible' : '')+'" '+searchOn+'><a href="#">'+clSVG('fixbtn_search10',28,28,true)+'</a></li>\ 4504 <li class="siteCART cl-fixbtn '+((!cartOn) ? 'cl-visible' : '')+'" '+cartOn+'>\ 4505 <a href="#">'+clSVG('fixbtn_cart9',28,28,true)+'\ 4506 <div class=\"cart-active\"><span class=\"cart-active-txt\">5</span></div>\ 4507 </a>\ 4508 </li>\ 4509 '; 4510 break; 4511 4512 default : 4513 break; 4514 } 4515 4516 return str; 4517 }, 4518 sidebarSet : function(num,checkmodal,validArray,slang) { 4519 var str = '', 4520 searchOn = '', 4521 cartOn = '', 4522 umOn = '', 4523 ssid = (PAGE_MODE == 'c') ? SID : property.SID, 4524 is_templates = checkTemplateSite(ssid), 4525 s_service = (PAGE_MODE == 'c') ? SERVICE : property.SERVICE, 4526 checkGabia = (s_service.indexOf('gabia') > -1) ? true : false, 4527 checkBS = (validArray['validplan'] && (validArray['validtype'] == 'BS' || (checkGabia && (validArray['validtype'] == 'FR')))) ? true : false, 4528 checkBN = (validArray['validplan'] && validArray['validtype'] == 'BN') ? true : false, 4529 checkSM = (validArray['validplan'] && validArray['validtype'] == 'SM') ? true : false, 4530 checkFREE = (!validArray['validplan'] || validArray['validplan'] == 'FR' || validArray['validplan'] == 'PK') ? true : false, 4531 checkElView = ($('.elviewhtml').length>0) ? true : false, 4532 fixBtnSITEUM = (checkElView) ? '' : ((PAGE_MODE=='c') ? SITEUM : property.SITEUM), 4533 checkSITEUM = (!checkElView && ((checkBN && typeof fixBtnSITEUM!='undefined' && Number(fixBtnSITEUM) > 0) || checkSM)) ? true : (checkElView ? true : false), 4534 checkmodal = (typeof checkmodal != 'undefined' && checkmodal) ? true : false, 4535 fixon = (typeof $('.el-menu header.navbar').attr('data-fixon') != 'undefined' && $('.el-menu header.navbar').attr('data-fixon')) ? $('.el-menu header.navbar').attr('data-fixon') : '', 4536 dropdownClass = (PAGE_MODE=='c') ? '' : 'dropdown ', 4537 slang = (typeof langObj != 'undefined' && langObj) ? langObj : ((PAGE_MODE == 'c') ? SLANG : property.SLANG); 4538 // lang_str = LANG; 4539
4540 if(!checkElView) { 4541 searchOn = (!checkSM) ? 'style="display:none;"' : ''; 4542 umOn = (checkBS || checkFREE || (checkBN && !checkSITEUM)) ? 'style="display:none;"' : ''; 4543 cartOn = (checkFREE) ? 'style="display:none;"' : ((checkSM) ? '' : 'style="display:none;"'); 4544 if(fixon && (checkBN || checkSM) && checkSITEUM) { 4545 searchOn = ((checkSM) && fixon.indexOf('search')>-1) ? '' : 'style="display:none;"'; 4546 cartOn = ((checkSM) && fixon.indexOf('cart')>-1) ? '' : 'style="display:none;"'; 4547 umOn = ((checkBN || checkSM) && fixon.indexOf('um')>-1) ? '' : 'style="display:none;"'; 4548 } 4549 if(fixon == 'all') { 4550 searchOn = 'style="display:none;"'; 4551 cartOn = 'style="display:none;"'; 4552 umOn = 'style="display:none;"'; 4553 } 4554 } 4555 4556 if(checkElView || checkmodal || is_templates) { 4557 umOn = (checkBS || checkFREE) ? 'style="display:none;"' : ''; 4558 searchOn = cartOn = (checkSM) ? '' : 'style="display:none;"'; 4559 } 4560 4561 /* ë¤êµì´ / ì¬ì´í¸ ì¸ì´ë³ lang ì²´í¬ ***/ 4562 // if((typeof slang != 'undefined' && typeof slang.select_code != 'undefined' && slang.select_code) 4563 // || (!$.isEmptyObject(slang) && slang.select_code)) { 4564 // //searchOn = (slang['select_code']=='ko' && checkSM) ? '' : 'style="display:none;"'; 4565 // lang_str = (slang['select_code'].toLowerCase()!='ko') ? 'en' : 'ko'; 4566 // } 4567 4568 switch(num) { 4569 case "01" : 4570 str = '\ 4571 <li class="siteSEARCH cl-fixbtn '+((!searchOn) ? 'cl-visible' : '')+'" '+searchOn+'><a href="#">SEARCH</a></li>\ 4572 <li class="siteUM cl-fixbtn '+dropdownClass+''+((!umOn) ? 'cl-visible' : '')+'" '+umOn+'>\ 4573 <a href="javascript:;" class="cl-login">LOGIN</a>\ 4574 <a href="javascript:;" class="cl-logout dropdown-toggle" style="display:none;">MY PAGE</a>\ 4575 </li>\ 4576 <li class="siteCART cl-fixbtn '+((!cartOn) ? 'cl-visible' : '')+'" '+cartOn+'><a href="#"><span class=\"cart-text\">CART</span><div class=\"cart-active\">5</div></a></li>\ 4577 '; 4578 break; 4579 4580 case "02" : 4581 str = '\ 4582 <li class="siteSEARCH cl-fixbtn '+((!searchOn) ? 'cl-visible' : '')+'" '+searchOn+'><a href="#">Search</a></li>\ 4583 <li class="siteUM cl-fixbtn '+dropdownClass+''+((!umOn) ? 'cl-visible' : '')+'" '+umOn+'>\ 4584 <a href="javascript:;" class="cl-login">Login</a>\ 4585 <a href="javascript:;" class="cl-logout dropdown-toggle" style="display:none;">My page</a>\ 4586 </li>\ 4587 <li class="siteCART cl-fixbtn '+((!cartOn) ? 'cl-visible' : '')+'" '+cartOn+'>\ 4588 <a href="#"><span class=\"cart-text\">Basket</span><div class=\"cart-active\">5</div></a>\ 4589 </li>\ 4590 '; 4591 break; 4592 4593 case "03" : 4594 str = '\ 4595 <li class="siteSEARCH cl-fixbtn '+((!searchOn) ? 'cl-visible' : '')+'" '+searchOn+'><a href="#">ê²ì</a></li>\ 4596 <li class="siteUM cl-fixbtn '+dropdownClass+''+((!umOn) ? 'cl-visible' : '')+'" '+umOn+'>\ 4597 <a href="javascript:;" class="cl-login">ë¡ê·¸ì¸</a>\ 4598 <a href="javascript:;" class="cl-logout dropdown-toggle" style="display:none;">ë§ì´íì´ì§</a>\ 4599 </li>\ 4600 <li class="siteCART cl-fixbtn '+((!cartOn) ? 'cl-visible' : '')+'" '+cartOn+'>\ 4601 <a href="#"><span class=\"cart-text\">ì¥ë°êµ¬ë</span>\ 4602 <div class=\"cart-active\"><span class=\"cart-active-txt\">5</span></div>\ 4603 </a>\ 4604 </li>\ 4605 '; 4606 break; 4607 4608 case "04" : 4609 str = '\ 4610 <li class="siteSEARCH cl-fixbtn '+((!searchOn) ? 'cl-visible' : '')+'" '+searchOn+'><a href="#">'+clSVG('fixbtn_search4',28,28,true)+'</a></li>\ 4611 <li class="siteUM cl-fixbtn '+dropdownClass+''+((!umOn) ? 'cl-visible' : '')+'" '+umOn+'>\ 4612 <a href="javascript:;" class="cl-login">'+clSVG('fixbtn_um_login4',28,28,true)+'</a>\ 4613 <a href="javascript:;" class="cl-logout dropdown-toggle" style="display:none;">'+clSVG('fixbtn_um_mypage4',28,28,true)+'</a>\ 4614 </li>\ 4615 <li class="siteCART cl-fixbtn '+((!cartOn) ? 'cl-visible' : '')+'" '+cartOn+'>\ 4616 <a href="#">'+clSVG('fixbtn_cart4',28,28,true)+'\ 4617 <div class=\"cart-active\"><span class=\"cart-active-txt\">5</span></div>\ 4618 </a>\ 4619 </li>\ 4620 '; 4621 break; 4622 4623 case "05" : 4624 str = '\ 4625 <li class="siteSEARCH cl-fixbtn '+((!searchOn) ? 'cl-visible' : '')+'" '+searchOn+'><a href="#">'+clSVG('fixbtn_search5',28,28,true)+'</a></li>\ 4626 <li class="siteUM cl-fixbtn '+dropdownClass+''+((!umOn) ? 'cl-visible' : '')+'" '+umOn+'>\ 4627 <a href="javascript:;" class="cl-login">'+clSVG('fixbtn_um_login5',28,28,true)+'</a>\ 4628 <a href="javascript:;" class="cl-logout dropdown-toggle" style="display:none;">'+clSVG('fixbtn_um_mypage5',28,28,true)+'</a>\ 4629 </li>\ 4630 <li class="siteCART cl-fixbtn '+((!cartOn) ? 'cl-visible' : '')+'" '+cartOn+'>\ 4631 <a href="#">'+clSVG('fixbtn_cart5',28,28,true)+'\ 4632 <div class=\"cart-active\"><span class=\"cart-active-txt\">5</span></div>\ 4633 </a>\ 4634 </li>\ 4635 '; 4636 break; 4637 4638 case "06" : 4639 str = '\ 4640 <li class="siteSEARCH cl-fixbtn '+((!searchOn) ? 'cl-visible' : '')+'" '+searchOn+'><a href="#">'+clSVG('fixbtn_search6',28,28,true)+'</a></li>\ 4641 <li class="siteUM cl-fixbtn '+dropdownClass+''+((!umOn) ? 'cl-visible' : '')+'" '+umOn+'>\ 4642 <a href="javascript:;" class="cl-login">'+clSVG('fixbtn_um_login6',28,28,true)+'</a>\ 4643 <a href="javascript:;" class="cl-logout dropdown-toggle" style="display:none;">'+clSVG('fixbtn_um_mypage6',28,28,true)+'</a>\ 4644 </li>\ 4645 <li class="siteCART cl-fixbtn '+((!cartOn) ? 'cl-visible' : '')+'" '+cartOn+'>\ 4646 <a href="#">'+clSVG('fixbtn_cart6',28,28,true)+'\ 4647 <div class=\"cart-active\"><span class=\"cart-active-txt\">5</span></div>\ 4648 </a>\ 4649 </li>\ 4650 '; 4651 break; 4652 4653 case "07" : 4654 str = '\ 4655 <li class="siteSEARCH cl-fixbtn '+((!searchOn) ? 'cl-visible' : '')+'" '+searchOn+'><a href="#">'+clSVG('fixbtn_search7',28,28,true)+'</a></li>\ 4656 <li class="siteUM cl-fixbtn '+dropdownClass+''+((!umOn) ? 'cl-visible' : '')+'" '+umOn+'>\ 4657 <a href="javascript:;" class="cl-login">'+clSVG('fixbtn_um_login7',28,28,true)+'</a>\ 4658 <a href="javascript:;" class="cl-logout dropdown-toggle" style="display:none;">'+clSVG('fixbtn_um_mypage7',28,28,true)+'</a>\ 4659 </li>\ 4660 <li class="siteCART cl-fixbtn '+((!cartOn) ? 'cl-visible' : '')+'" '+cartOn+'>\ 4661 <a href="#">'+clSVG('fixbtn_cart7',28,28,true)+'\ 4662 <div class=\"cart-active\">5</div>\ 4663 </a>\ 4664 </li>\ 4665 '; 4666 break; 4667 4668 case "08" : 4669 str = '\ 4670 <li class="siteSEARCH cl-fixbtn '+((!searchOn) ? 'cl-visible' : '')+'" '+searchOn+'><a href="#">'+clSVG('fixbtn_search8',28,28,true)+'<span class=\"btn_text\">SEARCH</span></a></li>\ 4671 <li class="siteUM cl-fixbtn '+dropdownClass+''+((!umOn) ? 'cl-visible' : '')+'" '+umOn+'>\ 4672 <a href="javascript:;javascript:;" class="cl-login">'+clSVG('fixbtn_um_login8',28,28,true)+'<span class=\"btn_text\">LOGIN</span></a>\ 4673 <a href="javascript:;" class="cl-logout dropdown-toggle" style="display:none;">'+clSVG('fixbtn_um_mypage8',28,28,true)+'<span class=\"btn_text\">MY PAGE</span></a>\ 4674 </li>\ 4675 <li class="siteCART cl-fixbtn '+((!cartOn) ? 'cl-visible' : '')+'" '+cartOn+'>\ 4676 <a href="#">'+clSVG('fixbtn_cart8',28,28,true)+'\
4677 <span class=\"btn_text\">CART</span><div class=\"cart-active\">5</div>\ 4678 </a>\ 4679 </li>\ 4680 '; 4681 break; 4682 4683 case "09" : 4684 str = '\ 4685 <li class="siteSEARCH cl-fixbtn '+((!searchOn) ? 'cl-visible' : '')+'" '+searchOn+'><a href="#">ê²ì</a></li>\ 4686 <li class="siteUM cl-fixbtn '+dropdownClass+''+((!umOn) ? 'cl-visible' : '')+'" '+umOn+'>\ 4687 <a href="javascript:;" class="cl-login">ë¡ê·¸ì¸</a>\ 4688 <a href="javascript:;" class="cl-logout dropdown-toggle" style="display:none;">ë§ì´íì´ì§</a>\ 4689 </li>\ 4690 <li class="siteCART cl-fixbtn '+((!cartOn) ? 'cl-visible' : '')+'" '+cartOn+'>\ 4691 <a href="#">'+clSVG('fixbtn_cart9',28,28,true)+'\ 4692 <div class=\"cart-active\">5</div>\ 4693 </a>\ 4694 </li>\ 4695 '; 4696 break; 4697 4698 case "10" : 4699 str = '\ 4700 <li class="siteUM cl-fixbtn '+dropdownClass+''+((!umOn) ? 'cl-visible' : '')+'" '+umOn+'>\ 4701 <a href="javascript:;" class="cl-login">LOGIN</a>\ 4702 <a href="javascript:;" class="cl-logout dropdown-toggle" style="display:none;">My page</a>\ 4703 </li>\ 4704 <li class="siteSEARCH cl-fixbtn '+((!searchOn) ? 'cl-visible' : '')+'" '+searchOn+'><a href="#">'+clSVG('fixbtn_search10',28,28,true)+'</a></li>\ 4705 <li class="siteCART cl-fixbtn '+((!cartOn) ? 'cl-visible' : '')+'" '+cartOn+'>\ 4706 <a href="#">'+clSVG('fixbtn_cart9',28,28,true)+'\ 4707 <div class=\"cart-active\"><span class=\"cart-active-txt\">5</span></div>\ 4708 </a>\ 4709 </li>\ 4710 '; 4711 break; 4712 4713 default : 4714 break; 4715 } 4716 4717 return str; 4718 }, 4719 fixFhTypeSet : function(pos) { 4720 var str = ''; 4721 4722 switch(pos) { 4723 4724 case "right" : 4725 4726 str += '\ 4727 <ul class="menuList">\ 4728 <li class="cl-menulist"><a href="#">Home</a></li>\ 4729 <li class="cl-menulist"><a href="#">Portfolio</a></li>\ 4730 <li class="cl-menulist"><a href="#">Contact</a></li>\ 4731 </ul>\ 4732 <ul class="menufixArea">\ 4733 <li class="siteSEARCH cl-fixbtn"><a href="#">'+clSVG('fixbtn_search4',28,28,true)+'</a></li>\ 4734 <li class="siteUM cl-fixbtn"><a href="#">'+clSVG('fixbtn_um4',28,28,true)+'</a></li>\ 4735 <li class="siteCART cl-fixbtn"><a href="#">'+clSVG('fixbtn_cart4',28,28,true)+'</a></li>\ 4736 </ul>\ 4737 '; 4738 4739 break; 4740 4741 case "top" : 4742 4743 str += '\ 4744 <ul class="menufixArea">\ 4745 <li class="siteSEARCH cl-fixbtn"><a href="#">'+clSVG('fixbtn_search4',28,28,true)+'</a></li>\ 4746 <li class="siteUM cl-fixbtn"><a href="#">'+clSVG('fixbtn_um4',28,28,true)+'</a></li>\ 4747 <li class="siteCART cl-fixbtn"><a href="#">'+clSVG('fixbtn_cart4',28,28,true)+'</a></li>\ 4748 </ul>\ 4749 <ul class="menuList">\ 4750 <li class="cl-menulist"><a href="#">Home</a></li>\ 4751 <li class="cl-menulist"><a href="#">Portfolio</a></li>\ 4752 <li class="cl-menulist"><a href="#">Contact</a></li>\ 4753 </ul>\ 4754 '; 4755 4756 break; 4757 4758 default : 4759 break; 4760 } 4761 4762 return str; 4763 },
4764 fixLangSet : function(num,def,langObj,checkMobile,validArray){ 4765 var checkElView = ($('.elviewhtml').length>0) ? true : false, 4766 s_service = (PAGE_MODE == 'c') ? SERVICE : property.SERVICE, 4767 checkGabia = (s_service.indexOf('gabia') > -1) ? true : false, 4768 checkVALIDPLAN = (PAGE_MODE=='c') ? VALIDPLAN : property.VALIDPLAN, 4769 checkVALIDTYPE = (PAGE_MODE=='c') ? VALIDTYPE : property.VALIDTYPE, 4770 checkBS = (checkVALIDPLAN && (checkVALIDTYPE == 'BS' || (checkGabia && (checkVALIDTYPE == 'FR')))) ? true : false, 4771 slang = (typeof langObj != 'undefined' && langObj) ? langObj : ((PAGE_MODE == 'c') ? SLANG : property.SLANG), 4772 def = (typeof def!='undefined') ? def : true, 4773 checkMobile = (typeof checkMobile!='undefined') ? checkMobile : false; 4774 4775 slang = (slang && typeof slang == 'object') ? slang : {}; 4776 var slangLists = $.isArray(slang.lists) ? slang.lists : []; 4777 if(slangLists.length === 0) return false; 4778 4779 if(typeof validArray != 'undefined') var checkFREE = (!validArray['validplan'] || validArray['validplan'] == 'FR' || validArray['validplan'] == 'PK') ? true : false; 4780 if(!checkElView && ((typeof slang == 'undefined' && typeof slang.select_code == 'undefined' && !slang.select_code) 4781 || ($.isEmptyObject(slang) && checkBS) || slang.select_code=='') || (checkElView && checkFREE) 4782 || (typeof slang=='undefined' || !slang.select)) { 4783 return false; 4784 } 4785 4786 var str = '', 4787 lang_txt = (typeof slang.select != 'undefined' && slang.select) ? slang.select.trim() : '', 4788 lang_code = (typeof slang.select_code != 'undefined' && slang.select_code) ? slang.select_code.toUpperCase() : '', 4789 checkDropTopClass = ($('.el-menu > header.navbar').hasClass('sidebar') || checkMobile) ? 'dropup' : 'dropdown', 4790 dropdownClass = (PAGE_MODE=='c') ? '' : 'dropdown', 4791 dropdownStr = ''; 4792 4793 if(checkMobile) { 4794 dropdownStr += '\ 4795 <div class="dropdown-menu-wrap" id="m-dropdown-wrap-lang">\ 4796 <span class="dropdown-close"><img src="//storage.googleapis.com/i.addblock.net/fa-close-modal-white.png" alt="Close Change Multilingual Site"></span></span>\ 4797 '; 4798 } 4799 dropdownStr += '\ 4800 <ul class="dropdown-menu">'; 4801 $.each(slang.lists, function(i,v){ 4802 var active = (v.name == slang.select) ? 'active' : ''; 4803 dropdownStr += '\ 4804 <li class="'+active+'"><a class="cl-langlist " href="javascript:;" data-code="'+v.code+'">'+v.name+'</a></li>'; 4805 }); 4806 dropdownStr += '\ 4807 </ul>'; 4808 if(checkMobile) { 4809 dropdownStr += '\ 4810 </div>\ 4811 '; 4812 } 4813 4814 var attrMobile = (checkMobile) ? 'data-toggle="dropdown" data-target="#m-dropdown-wrap-lang"' : ''; 4815 4816 switch(num) { 4817 case "01" : 4818 str = (!def) ? '\ 4819 <div class="siteLANG cl-fixbtn '+checkDropTopClass+' cl-visible" data-fixlang="'+lang_txt+'" data-fixlangcode="'+lang_code+'">\ 4820 <a href="#" class="cl-lang dropdown-toggle" '+attrMobile+'>\ 4821 <span class="slang-active">'+lang_code+'</span>\ 4822 ' + clSVG('fixbtn_arrow1',16,16,true) + '\ 4823 </a>' + dropdownStr + '\ 4824 </div>' : '\ 4825 <li class="siteLANG cl-fixbtn dropdown cl-visible" data-fixlang="'+lang_txt+'" data-fixlangcode="'+lang_code+'">\ 4826 <a href="#" class="cl-lang dropdown-toggle">\ 4827 <span class="slang-active">'+lang_code+'</span>\ 4828 ' + clSVG('fixbtn_arrow1',16,16,true) + '\ 4829 </a>' + dropdownStr + '\ 4830 </li>\ 4831 '; 4832 break; 4833 4834 case "02" : 4835 str = (!def) ? '\ 4836 <div class="siteLANG cl-fixbtn '+checkDropTopClass+' cl-visible" data-fixlang="'+lang_txt+'" data-fixlangcode="'+lang_code+'">\ 4837 <a href="#" class="cl-lang dropdown-toggle" '+attrMobile+'>\
4838 <span class="slang-active">'+lang_txt+'</span>\ 4839 ' + clSVG('fixbtn_arrow1',16,16,true) + '\ 4840 </a>' + dropdownStr + '\ 4841 </div>' : '\ 4842 <li class="siteLANG cl-fixbtn dropdown cl-visible" data-fixlang="'+lang_txt+'" data-fixlangcode="'+lang_code+'">\ 4843 <a href="#" class="cl-lang dropdown-toggle">\ 4844 <span class="slang-active">'+lang_txt+'</span>\ 4845 ' + clSVG('fixbtn_arrow1',16,16,true) + '\ 4846 </a>' + dropdownStr + '\ 4847 </li>\ 4848 '; 4849 break; 4850 4851 case "03" : 4852 str = (!def) ? '\ 4853 <div class="siteLANG cl-fixbtn '+checkDropTopClass+' cl-visible" data-fixlang="'+lang_txt+'" data-fixlangcode="'+lang_code+'">\ 4854 <a href="#" class="cl-lang dropdown-toggle" '+attrMobile+'>\ 4855 <span class="slang-active">'+lang_code+'</span>\ 4856 ' + clSVG('fixbtn_arrow1',16,16,true) + '\ 4857 </a>' + dropdownStr + '\ 4858 </div>' : '\ 4859 <li class="siteLANG cl-fixbtn dropdown cl-visible" data-fixlang="'+lang_txt+'" data-fixlangcode="'+lang_code+'">\ 4860 <a href="#" class="cl-lang dropdown-toggle">\ 4861 <span class="slang-active">'+lang_code+'</span>\ 4862 ' + clSVG('fixbtn_arrow1',16,16,true) + '\ 4863 </a>' + dropdownStr + '\ 4864 </li>\ 4865 '; 4866 break; 4867 4868 case "04" : 4869 str = (!def) ? '\ 4870 <div class="siteLANG cl-fixbtn '+checkDropTopClass+' cl-visible" data-fixlang="'+lang_txt+'" data-fixlangcode="'+lang_code+'">\ 4871 <a href="#" class="cl-lang dropdown-toggle" '+attrMobile+'>\ 4872 <span class="slang-active">'+lang_code+'</span>\ 4873 ' + clSVG('fixbtn_arrow1',16,16,true) + '\ 4874 </a>' + dropdownStr + '\ 4875 </div>\ 4876 ' : '\ 4877 <li class="siteLANG cl-fixbtn dropdown cl-visible" data-fixlang="'+lang_txt+'" data-fixlangcode="'+lang_code+'">\ 4878 <a href="#" class="cl-lang dropdown-toggle" '+attrMobile+'>\ 4879 <span class="slang-active">'+lang_code+'</span>\ 4880 ' + clSVG('fixbtn_arrow1',16,16,true) + '\ 4881 </a>' + dropdownStr + '\ 4882 </li>\ 4883 '; 4884 break; 4885 4886 case "05" : 4887 str = (!def) ? '\ 4888 <div class="siteLANG cl-fixbtn '+checkDropTopClass+' cl-visible" data-fixlang="'+lang_txt+'" data-fixlangcode="'+lang_code+'">\ 4889 <a href="#" class="cl-lang dropdown-toggle" '+attrMobile+'>\ 4890 <span class="slang-active" style="display:none;">'+lang_code+'</span>\ 4891 ' + clSVG('fixbtn_lang5',18,18,true) + '\ 4892 </a>' + dropdownStr + '\ 4893 </div>\ 4894 ' : '\ 4895 <li class="siteLANG cl-fixbtn dropdown cl-visible" data-fixlang="'+lang_txt+'" data-fixlangcode="'+lang_code+'">\ 4896 <a href="#" class="cl-lang dropdown-toggle">\ 4897 <span class="slang-active" style="display:none;">'+lang_code+'</span>\ 4898 ' + clSVG('fixbtn_lang5',18,18,true) + '\ 4899 </a>' + dropdownStr + '\ 4900 </li>\ 4901 '; 4902 break; 4903 4904 case "06" : 4905 str = (!def) ? '\ 4906 <div class="siteLANG cl-fixbtn '+checkDropTopClass+' cl-visible" data-fixlang="'+lang_txt+'" data-fixlangcode="'+lang_code+'">\ 4907 <a href="#" class="cl-lang dropdown-toggle" '+attrMobile+'>\ 4908 ' + clSVG('fixbtn_lang5',18,18,true) + '\
4909 <span class="slang-active">'+lang_code+'</span>\ 4910 </a>' + dropdownStr + '\ 4911 </div>\ 4912 ' : '\ 4913 <li class="siteLANG cl-fixbtn dropdown cl-visible" data-fixlang="'+lang_txt+'" data-fixlangcode="'+lang_code+'">\ 4914 <a href="#" class="cl-lang dropdown-toggle">\ 4915 ' + clSVG('fixbtn_lang5',18,18,true) + '\ 4916 <span class="slang-active">'+lang_code+'</span>\ 4917 </a>' + dropdownStr + '\ 4918 </li>\ 4919 '; 4920 break; 4921 4922 case "07" : 4923 str = (!def) ? '\ 4924 <div class="siteLANG cl-fixbtn '+checkDropTopClass+' cl-visible" data-fixlang="'+lang_txt+'" data-fixlangcode="'+lang_code+'">\ 4925 <a href="#" class="cl-lang dropdown-toggle" '+attrMobile+'>\ 4926 <img src="//storage.googleapis.com/i.addblock.net/flag/flag_'+lang_code.toLowerCase()+'_cir.png" class="cl-lang-img img-responsive"/>\ 4927 <span class="slang-active">'+lang_txt+'</span>\ 4928 ' + clSVG('fixbtn_arrow1',16,16,true) + '\ 4929 </a>' + dropdownStr + '\ 4930 </div>\ 4931 ' : '\ 4932 <li class="siteLANG cl-fixbtn dropdown cl-visible" data-fixlang="'+lang_txt+'" data-fixlangcode="'+lang_code+'">\ 4933 <a href="#" class="cl-lang dropdown-toggle">\ 4934 <img src="//storage.googleapis.com/i.addblock.net/flag/flag_'+lang_code.toLowerCase()+'_cir.png" class="cl-lang-img img-responsive"/>\ 4935 <span class="slang-active">'+lang_txt+'</span>\ 4936 ' + clSVG('fixbtn_arrow1',16,16,true) + '\ 4937 </a>' + dropdownStr + '\ 4938 </li>\ 4939 '; 4940 break; 4941 4942 case "08" : 4943 str = (!def) ? '\ 4944 <div class="siteLANG cl-fixbtn '+checkDropTopClass+' cl-visible" data-fixlang="'+lang_txt+'" data-fixlangcode="'+lang_code+'">\ 4945 <a href="#" class="cl-lang dropdown-toggle" '+attrMobile+'>\ 4946 <img src="//storage.googleapis.com/i.addblock.net/flag/flag_'+lang_code.toLowerCase()+'_rec.png" class="cl-lang-img img-responsive"/>\ 4947 <span class="slang-active">'+lang_txt+'</span>\ 4948 ' + clSVG('fixbtn_arrow1',16,16,true) + '\ 4949 </a>' + dropdownStr + '\ 4950 </div>\ 4951 ' : '\ 4952 <li class="siteLANG cl-fixbtn dropdown cl-visible" data-fixlang="'+lang_txt+'" data-fixlangcode="'+lang_code+'">\ 4953 <a href="#" class="cl-lang dropdown-toggle">\ 4954 <img src="//storage.googleapis.com/i.addblock.net/flag/flag_'+lang_code.toLowerCase()+'_rec.png" class="cl-lang-img img-responsive"/>\ 4955 <span class="slang-active">'+lang_txt+'</span>\ 4956 ' + clSVG('fixbtn_arrow1',16,16,true) + '\ 4957 </a>' + dropdownStr + '\ 4958 </li>\ 4959 '; 4960 break; 4961 4962 case "09" : 4963 str = (!def) ? '\ 4964 <div class="siteLANG cl-fixbtn '+checkDropTopClass+' cl-visible" data-fixlang="'+lang_txt+'" data-fixlangcode="'+lang_code+'">\ 4965 <a href="#" class="cl-lang dropdown-toggle" '+attrMobile+'>\ 4966 <img src="//storage.googleapis.com/i.addblock.net/flag/flag_'+lang_code.toLowerCase()+'_cir.png" class="cl-lang-img img-responsive"/>\ 4967 </a>' + dropdownStr + '\ 4968 </div>\ 4969 ' : '\ 4970 <li class="siteLANG cl-fixbtn dropdown cl-visible" data-fixlang="'+lang_txt+'" data-fixlangcode="'+lang_code+'">\ 4971 <a href="#" class="cl-lang dropdown-toggle">\
4972 <img src="//storage.googleapis.com/i.addblock.net/flag/flag_'+lang_code.toLowerCase()+'_cir.png" class="cl-lang-img img-responsive"/>\ 4973 </a>' + dropdownStr + '\ 4974 </li>\ 4975 '; 4976 break; 4977 4978 case "10" : 4979 str = (!def) ? '\ 4980 <div class="siteLANG cl-fixbtn '+checkDropTopClass+' cl-visible" data-fixlang="'+lang_txt+'" data-fixlangcode="'+lang_code+'">\ 4981 <a href="#" class="cl-lang dropdown-toggle" '+attrMobile+'>\ 4982 <span class="slang-active">'+lang_code+'</span>\ 4983 </a>' + dropdownStr + '\ 4984 </div>' : '\ 4985 <li class="siteLANG cl-fixbtn dropdown cl-visible" data-fixlang="'+lang_txt+'" data-fixlangcode="'+lang_code+'">\ 4986 <a href="#" class="cl-lang dropdown-toggle">\ 4987 <span class="slang-active">'+lang_code+'</span>\ 4988 </a>' + dropdownStr + '\ 4989 </li>\ 4990 '; 4991 break; 4992 4993 case "11" : 4994 str = (!def) ? '\ 4995 <div class="siteLANG cl-fixbtn '+checkDropTopClass+' cl-visible" data-fixlang="'+lang_txt+'" data-fixlangcode="'+lang_code+'">\ 4996 <a href="#" class="cl-lang dropdown-toggle" '+attrMobile+'>\ 4997 <img src="//storage.googleapis.com/i.addblock.net/flag/flag_'+lang_code.toLowerCase()+'_rec.png" class="cl-lang-img img-responsive"/>\ 4998 </a>' + dropdownStr + '\ 4999 </div>\ 5000 ' : '\ 5001 <li class="siteLANG cl-fixbtn dropdown cl-visible" data-fixlang="'+lang_txt+'" data-fixlangcode="'+lang_code+'">\ 5002 <a href="#" class="cl-lang dropdown-toggle">\ 5003 <img src="//storage.googleapis.com/i.addblock.net/flag/flag_'+lang_code.toLowerCase()+'_rec.png" class="cl-lang-img img-responsive"/>\ 5004 </a>' + dropdownStr + '\ 5005 </li>\ 5006 '; 5007 break; 5008 5009 default : 5010 break; 5011 } 5012 5013 return str; 5014 }, 5015 getData : function($h) { 5016 var data = [], 5017 dataFix = ['fixtype','fixlangtype','fh-type','fixsize','fixlangsize','fixtypeText','fixtypeNum','fixlangtypeNum']; 5018 5019 $.each(dataFix, function(i,v){ 5020 var dataV = 'data-'+v; 5021 data[v] = (typeof $h.attr(dataV)!='undefined' && $h.attr(dataV)) ? $h.attr(dataV) : ''; 5022 if(data['fixtype']!='undefined' && data['fixtype']) { 5023 if(v=='fixtypeText') data[v] = data['fixtype'].replace(/\_\d+/gi,''); 5024 else if(v=='fixtypeNum') data[v] = data['fixtype'].replace(/(top|sidebar)\_/gi,''); 5025 else if(v=='fixlangtypeNum') data[v] = data['fixlangtype'].replace(/lang\_/gi,''); 5026 } 5027 5028 }) 5029 5030 return data; 5031 } 5032 } 5033 5034 /*** shopping Guide Popup ***/ 5035 $.guidePopup = { 5036 set: function() { 5037 var str = '\ 5038 <div class="guide-top">\ 5039 <h3 class="modal-title guidetitle">'+$.lang[LANG]['editor.meta.shoppingmall.guide.title']+'</h3>\ 5040 <div class="guide-menu">\ 5041 <ul>\ 5042 <li class="active hand">\ 5043 <p>'+$.lang[LANG]['editor.meta.shoppingmall.guide.step.1']+'</p>\ 5044 <div class="line right"></div>\ 5045 </li>\ 5046 <li class="hand">\ 5047 <div class="line left"></div>\ 5048 <div class="line right"></div>\ 5049 <p>'+$.lang[LANG]['editor.meta.shoppingmall.guide.step.2']+'</p>\ 5050 </li>\ 5051 <li class="hand">\ 5052 <div class="line left"></div>\ 5053 <div class="line right"></div>\ 5054 <p>'+$.lang[LANG]['editor.meta.shoppingmall.guide.step.3']+'</p>\ 5055 </li>\ 5056 <li class="hand">\ 5057 <div class="line left"></div>\ 5058 <p>'+$.lang[LANG]['editor.meta.shoppingmall.guide.step.4']+'</p>\ 5059 </li>\ 5060 </ul>\ 5061 </div>\ 5062 </div>\
5063 <div class="guide-wrap">\ 5064 <div class="step">\ 5065 <div id="step1">\ 5066 <h3>'+$.lang[LANG]['editor.meta.shoppingmall.guide.step.1.title']+'</h3>\ 5067 <p>'+$.lang[LANG]['editor.meta.shoppingmall.guide.step.1.1.contents']+'</p>\ 5068 <img class="img-responsive" src="//storage.googleapis.com/i.addblock.net/guide_img01_1.jpg">\ 5069 <p>'+$.lang[LANG]['editor.meta.shoppingmall.guide.step.1.2.contents']+'</p>\ 5070 <img class="img-responsive" src="//storage.googleapis.com/i.addblock.net/guide_img01_2.jpg">\ 5071 <p>'+$.lang[LANG]['editor.meta.shoppingmall.guide.step.1.3.contents']+'</p>\ 5072 <img class="img-responsive" src="//storage.googleapis.com/i.addblock.net/guide_img01_3.jpg">\ 5073 </div>\ 5074 <div id="step2">\ 5075 <h3>'+$.lang[LANG]['editor.meta.shoppingmall.guide.step.2.title']+'</h3>\ 5076 <p>'+$.lang[LANG]['editor.meta.shoppingmall.guide.step.2.1.contents']+'</p>\ 5077 <img class="img-responsive" src="//storage.googleapis.com/i.addblock.net/guide_img02_1.jpg">\ 5078 <p>'+$.lang[LANG]['editor.meta.shoppingmall.guide.step.2.2.contents']+'</p>\ 5079 <img src="//storage.googleapis.com/i.addblock.net/guide_img02_2.jpg">\ 5080 <p>'+$.lang[LANG]['editor.meta.shoppingmall.guide.step.2.3.contents']+'</p>\ 5081 <img class="img-responsive" src="//storage.googleapis.com/i.addblock.net/guide_img02_3.jpg">\ 5082 <p>'+$.lang[LANG]['editor.meta.shoppingmall.guide.step.2.4.contents']+'</p>\ 5083 <img class="img-responsive" src="//storage.googleapis.com/i.addblock.net/guide_img02_4.jpg">\ 5084 </div>\ 5085 <div id="step3">\ 5086 <h3>'+$.lang[LANG]['editor.meta.shoppingmall.guide.step.3.title']+'</h3>\ 5087 <p>'+$.lang[LANG]['editor.meta.shoppingmall.guide.step.3.1.contents']+'</p>\ 5088 <img class="img-responsive" src="//storage.googleapis.com/i.addblock.net/guide_img03_1.jpg">\ 5089 <p>'+$.lang[LANG]['editor.meta.shoppingmall.guide.step.3.2.contents']+'</p>\ 5090 <img class="img-responsive" src="//storage.googleapis.com/i.addblock.net/guide_img03_2.jpg">\ 5091 </div>\ 5092 <div id="step4">\ 5093 <h3>'+$.lang[LANG]['editor.meta.shoppingmall.guide.step.4.title']+'</h3>\ 5094 <p>'+$.lang[LANG]['editor.meta.shoppingmall.guide.step.4.1.contents']+'</p>\ 5095 <img class="img-responsive" src="//storage.googleapis.com/i.addblock.net/guide_img04_1.jpg">\ 5096 <p>'+$.lang[LANG]['editor.meta.shoppingmall.guide.step.4.2.contents']+'</p>\ 5097 <img class="img-responsive" src="//storage.googleapis.com/i.addblock.net/guide_img04_2.jpg">\ 5098 </div>\ 5099 </div>\ 5100 <div class="modal-footer guideClose">\ 5101 <button type="button" class="btn btn-default btn-sm close-button-dialog clostbtnfalse" data-dismiss="modal">ë«ê¸°</button>\ 5102 </div>\ 5103 </div>\ 5104 '; 5105 5106 var shopguideModal = $(this).showModalFlat('',str,true,false,'','close','','guidePopup cl-cmmodal cl-s-btn cover w700', false ,'',function() { 5107 $.guidePopup.scrollevent(); 5108 }); 5109 }, 5110 scrollevent : function() { 5111 $('.guidePopup-wrap').on('shown.bs.modal', function(e) { 5112 $('.guidePopup .guide-wrap').scroll(function() { 5113 if($(this).hasClass('moving')) return false;
5114 var scrollValue = $('.guidePopup .guide-wrap').scrollTop(), 5115 issclogin = ($('.guidePopup').attr('class').indexOf('sclogin') > 0 || $('.guidePopup').attr('class').indexOf('naverpay-guide') > 0) ? true : false, 5116 isCert = ($('.guidePopup').attr('class').indexOf('cert-guide-modal') > 0)? true : false; 5117 5118 if(issclogin || isCert) { 5119 if( scrollValue >= $("#step2").position().top && scrollValue < $("#step3").position().top) { 5120 $('.guidePopup ul li:visible').eq(1).addClass('active').siblings().removeClass('active'); 5121 $('.guidePopup ul li:visible').eq(1).css('zIndex', '2').siblings().css('zIndex', '1'); 5122 } else if( scrollValue >= $("#step3").position().top) { 5123 $('.guidePopup ul li:visible').eq(2).addClass('active').siblings().removeClass('active'); 5124 $('.guidePopup ul li:visible').eq(2).css('zIndex', '2').siblings().css('zIndex', '1'); 5125 } else { 5126 $('.guidePopup ul li:visible').eq(0).addClass('active').siblings().removeClass('active'); 5127 $('.guidePopup ul li:visible').eq(0).css('zIndex', '2').siblings().css('zIndex', '1'); 5128 } 5129 } else { 5130 var hasStep4 = $("#step4").length > 0, 5131 step4Top = hasStep4 ? $("#step4").position().top : null; 5132 5133 if( scrollValue >= $("#step2").position().top && scrollValue < $("#step3").position().top) { 5134 $('.guidePopup ul li').eq(1).addClass('active').siblings().removeClass('active'); 5135 $('.guidePopup ul li').eq(1).css('zIndex', '2').siblings().css('zIndex', '1'); 5136 } else if( scrollValue >= $("#step3").position().top && (!hasStep4 || scrollValue < step4Top)) { 5137 $('.guidePopup ul li').eq(2).addClass('active').siblings().removeClass('active'); 5138 $('.guidePopup ul li').eq(2).css('zIndex', '2').siblings().css('zIndex', '1'); 5139 } else if(hasStep4 && scrollValue >= step4Top) { 5140 $('.guidePopup ul li').eq(3).addClass('active').siblings().removeClass('active'); 5141 $('.guidePopup ul li').eq(3).css('zIndex', '2').siblings().css('zIndex', '1'); 5142 } else { 5143 $('.guidePopup ul li').eq(0).addClass('active').siblings().removeClass('active'); 5144 $('.guidePopup ul li').eq(0).css('zIndex', '2').siblings().css('zIndex', '1'); 5145 } 5146 } 5147 5148 }); 5149 5150 $('.guidePopup .guide-menu li').click(function() { 5151 if($('.guidePopup .guide-wrap').hasClass('moving')) return false; 5152 var top = ($(this).index())+1, 5153 $targetStep = $('#step'+top); 5154 5155 if($targetStep.length === 0) return false; 5156 5157 $('.guidePopup .guide-wrap').addClass('moving'); 5158 5159 var top_position = (top==1) ? $targetStep.position().top : ($targetStep.position().top)+60; 5160 5161 $('.guidePopup .guide-wrap').animate({scrollTop : top_position}, 1000, 'easeInOutExpo'); 5162 5163 setTimeout(function() { 5164 $('.guidePopup .guide-wrap').removeClass('moving'); 5165 },1000); 5166 5167 $(this).addClass('active').siblings().removeClass('active'); 5168 $(this).css('zIndex', '2').siblings().css('zIndex', '1'); 5169 }); 5170 }); 5171 } 5172 } 5173 5174 /* Site config - quickmenu ***/ 5175 $.quickmenu = { 5176 init: function(sid,publish,device) { 5177 var result_data = {}; 5178 if(PAGE_MODE == 'c' || (PAGE_MODE != 'c' && typeof property != 'undefined')) { 5179 if (PAGE_MODE != 'c' && typeof property != 'undefined' && property && property.QUICKMENU) { 5180 result_data = property.QUICKMENU; 5181 } else if (typeof QUICKMENU !== 'undefined' && QUICKMENU) { 5182 result_data = QUICKMENU; 5183 } else { 5184 result_data = {}; 5185 } 5186 } 5187 5188 $.quickmenu['quickmenu'] = result_data || {}; 5189 if (Array.isArray($.quickmenu['quickmenu']['visible']) && $.quickmenu['quickmenu']['visible'].length > 0) { 5190 $.quickmenu['quickmenu']['visible'] = $.quickmenu['quickmenu']['visible'].slice(); 5191 } else { 5192 $.quickmenu['quickmenu']['visible'] = []; 5193 } 5194 5195 var quickmenu_total_count = parseInt(result_data['total_count'], 10) || 0; 5196 5197 if(quickmenu_total_count!=0) $.quickmenu.setHTML(result_data,device); 5198 else { 5199 result_data = $.quickmenu.add(sid, false) || $.quickmenu['quickmenu'] || result_data; 5200 $.quickmenu.setHTML(result_data,device); 5201 } 5202 }, 5203 get: function(sid,publish) { 5204 var return_data = {}; 5205 $.ajax({ 5206 type: 'POST', 5207 data: { sid:sid, publish:publish }, 5208 dataType: 'json', 5209 url: (CONFIG_URL) ? '/_config/siteConfig/btype/quickmenu/type/get' : '/config/siteConfig/btype/quickmenu/type/get', 5210 async:false, 5211 success : function(data) { 5212 checkError(data); 5213 return_data = data; 5214 $.quickmenu['quickmenu'] = return_data; 5215 if(!Array.isArray($.quickmenu['quickmenu']['visible'])) $.quickmenu['quickmenu']['visible'] = []; 5216 }, 5217 error: function(request, status, error){ 5218 console.log("data error"); 5219 5220 } 5221 }); 5222 5223 return return_data; 5224 }, 5225 setHTML: function(data,device,checkConfig) { 5226 data = data || {}; 5227 if(typeof data['sid'] == 'undefined' || !data['sid']) data['sid'] = (typeof SID != 'undefined') ? SID : ''; 5228 if(typeof data['list'] == 'undefined' || !data['list']) data['list'] = {}; 5229 if(typeof data['img_type'] == 'undefined' || !data['img_type']) data['img_type'] = {}; 5230 if(typeof data['img_type_mode'] == 'undefined' || !data['img_type_mode']) data['img_type_mode'] = {}; 5231 if(typeof data['img_type'][device] == 'undefined' || !data['img_type'][device]) data['img_type'][device] = (device=='pc') ? 'default' : 'bottom_default'; 5232 if(typeof data['total'] == 'undefined' || !data['total']) data['total'] = {}; 5233 5234 var site_settings = (typeof property != 'undefined') ? property.SETTINGS : SETTINGS, 5235 quick_hide = (typeof site_settings.qm_onoff != 'undefined' && site_settings.qm_onoff==true) ? '' : 'hide', 5236 quick_str = '', 5237 quick_style = `<style id="quick-menu-${data['sid']}${device}"></style>`, 5238 quick_css = '', 5239 qm_list = {}; 5240 5241 qm_list = data['list']; 5242 var img_type = data['img_type'][device], 5243 img_type_mode = (data['img_type_mode'][device] == 'mixed') ? 'mixed' : 'single', 5244 is_mixed_img_type = (img_type_mode=='mixed' && ((device=='pc' && (img_type=='default' || img_type=='image')) || (device=='mobile' && typeof img_type == 'string' && img_type.indexOf('right_') === 0))), 5245 render_img_types = [], 5246 img_type_total = ($.isEmptyObject(data['total']) || typeof data['total'][device] == 'undefined' || typeof data['total'][device][img_type] == 'undefined') ? {} : data['total'][device][img_type], 5247 m_icon_settings = [], 5248 link = {}, 5249 page_mode = (PAGE_MODE=='c') ? 'c' : ''; 5250 5251 var parseQuickmenuSetting = function(setting, fallback) { 5252 var base = $.extend({}, fallback); 5253 5254 if(typeof setting == 'object' && setting) return $.extend(base, setting); 5255 if(typeof setting == 'string' && setting) { 5256 try { 5257 return $.extend(base, JSON.parse(setting)); 5258 } catch(e) { 5259 return base; 5260 } 5261 } 5262 5263 return base; 5264 }; 5265 5266 var getQuickmenuImageValue = function(item, key, current_img_type) { 5267 if(typeof item[key] == 'object' && item[key]) return item[key][current_img_type] || ''; 5268 if(typeof item[key] == 'string') return item[key]; 5269 5270 return ''; 5271 }; 5272 5273 var default_icon_settings = { 5274 'onoff': 'true',
5275 '--icon-size': '24px', 5276 '--icon-color': '#000000', 5277 '--icon-bgcolor': '', 5278 '--icon-bgblur': '3px' 5279 }; 5280 var default_text_settings = { 5281 'onoff': 'true', 5282 '--text-fname': 'Noto Sans', 5283 '--text-fsize': '12px', 5284 '--text-fweight': '400', 5285 '--text-fcolor': '#000000' 5286 }; 5287 var getQuickmenuEffectiveVisible = function(render_img_type, visible) { 5288 if(!is_mixed_img_type && device=='pc' && (img_type=='default' || img_type=='image') && render_img_type!=img_type) return 0; 5289 if(!is_mixed_img_type && device=='mobile' && typeof img_type == 'string' && img_type.indexOf('right_') === 0 && render_img_type!=img_type) return 0; 5290 5291 return visible; 5292 }; 5293 5294 var getQuickmenuImageSizeMode = function(render_img_type, icon_settings) { 5295 if(render_img_type.indexOf('image') < 0) return 'common'; 5296 if(icon_settings && (icon_settings['quick_img_size_mode']=='common' || icon_settings['quick_img_size_mode']=='origin')) return icon_settings['quick_img_size_mode']; 5297 5298 return 'origin'; 5299 }; 5300 5301 var getQuickmenuSharedQuickSettings = function(render_img_type) { 5302 var shared_key = '', 5303 shared_settings = {}, 5304 has_shared_settings = false; 5305 5306 if(device=='pc' && (render_img_type=='default' || render_img_type=='image')) shared_key = 'common'; 5307 else if(device=='mobile' && (render_img_type=='right_default' || render_img_type=='right_image')) shared_key = 'right_common'; 5308 5309 if(shared_key && qm_list[device] && qm_list[device][shared_key] && qm_list[device][shared_key]['quick_settings']) { 5310 shared_settings = $.extend({}, qm_list[device][shared_key]['quick_settings']); 5311 has_shared_settings = true; 5312 } else if(qm_list[device] && qm_list[device][img_type] && qm_list[device][img_type]['quick_settings']) { 5313 shared_settings = $.extend({}, qm_list[device][img_type]['quick_settings']); 5314 } 5315 5316 if(device=='mobile' && (render_img_type=='right_default' || render_img_type=='right_image') && (!has_shared_settings || typeof shared_settings['--quick-align'] == 'undefined')) { 5317 shared_settings['--quick-align'] = 'center'; 5318 } 5319 5320 return shared_settings; 5321 }; 5322 5323 var getQuickmenuRenderTypeOrder = function(render_img_type) { 5324 if(!is_mixed_img_type) return 0; 5325 if(render_img_type==img_type) return 0; 5326 5327 if(device=='pc' && (render_img_type=='default' || render_img_type=='image')) return 1; 5328 if(device=='mobile' && (render_img_type=='right_default' || render_img_type=='right_image')) return 1; 5329 5330 return 2; 5331 }; 5332 5333 if(device=='pc') { 5334 $.each(['default', 'image'], function(i, pc_img_type) { 5335 if(typeof qm_list[device] != 'undefined' && typeof qm_list[device][pc_img_type] != 'undefined') render_img_types.push(pc_img_type); 5336 }); 5337 } else if(device=='mobile' && typeof img_type == 'string' && img_type.indexOf('right_') === 0) { 5338 $.each(['right_default', 'right_image'], function(i, right_img_type) { 5339 if(typeof qm_list[device] != 'undefined' && typeof qm_list[device][right_img_type] != 'undefined') render_img_types.push(right_img_type); 5340 }); 5341 } 5342 if(render_img_types.length < 1) render_img_types.push(img_type); 5343 var has_render_image_type = false;
5344 $.each(render_img_types, function(render_i, render_img_type) { 5345 if(render_img_type.indexOf('image') > -1) { 5346 has_render_image_type = true; 5347 return false; 5348 } 5349 }); 5350 if(has_render_image_type) { 5351 quick_css += ` 5352 .quick-menu-${data['sid']}.quickmenu[data-device='${device}'][data-imgtype='${img_type}'] ul {align-items: center;} 5353 .quick-menu-${data['sid']}.quickmenu[data-device='${device}'][data-imgtype='${img_type}'] ul > li {align-self: var(--quick-align, center);} 5354 `; 5355 } 5356 var render_items = []; 5357 5358 $.each(render_img_types, function(render_i, render_img_type) { 5359 if(typeof qm_list[device] == 'undefined' || typeof qm_list[device][render_img_type] == 'undefined') return true; 5360 5361 if(typeof qm_list[device][render_img_type]['quick_settings'] == 'undefined' || !qm_list[device][render_img_type]['quick_settings']) { 5362 qm_list[device][render_img_type]['quick_settings'] = {}; 5363 } 5364 qm_list[device][render_img_type]['quick_settings'] = $.extend({}, qm_list[device][render_img_type]['quick_settings']); 5365 5366 $.each(qm_list[device][render_img_type], function(i,v){ 5367 if(i=='quick_settings') { 5368 var quick_settings_css = $.extend({}, v, getQuickmenuSharedQuickSettings(render_img_type)), 5369 quick_size = parseFloat(String(quick_settings_css['--quick-size'] || '').replace(/[^0-9.]/g, '')), 5370 quick_roundedge_per = parseFloat(quick_settings_css['--quick-roundedge-per']); 5371 5372 if(!isNaN(quick_size) && !isNaN(quick_roundedge_per)) { 5373 quick_settings_css['--quick-roundedge-radius'] = Math.round(quick_size * quick_roundedge_per) + 'px'; 5374 } 5375 5376 v_quick_settings = JSON.stringify(quick_settings_css).replace(/\"/gi,'').replace(/px/gi,'px;').replace(/,|;;/gi,';'); 5377 quick_css += `.quick-menu-${data['sid']}[data-device='${device}'] li[data-imgtype='${render_img_type}'] ${v_quick_settings}`; 5378 5379 return true; 5380 } 5381 5382 render_items.push({ 5383 'img_type': render_img_type, 5384 'index': i, 5385 'val': v 5386 }); 5387 }); 5388 }); 5389 5390 var has_duplicate_pos = false, 5391 seen_pos = {}; 5392 $.each(render_items, function(i, render_item) { 5393 var item_pos = parseInt(render_item.val.pos, 10); 5394 if(isNaN(item_pos)) return true; 5395 if(seen_pos[item_pos]) { 5396 has_duplicate_pos = true; 5397 return false; 5398 } 5399 seen_pos[item_pos] = true; 5400 }); 5401 5402 render_items.sort(function(a, b) { 5403 var a_type_order = getQuickmenuRenderTypeOrder(a.img_type), 5404 b_type_order = getQuickmenuRenderTypeOrder(b.img_type), 5405 a_seq = parseInt(a.val.seq, 10), 5406 b_seq = parseInt(b.val.seq, 10); 5407 var a_pos = parseInt(a.val.pos, 10), 5408 b_pos = parseInt(b.val.pos, 10); 5409 5410 if(has_duplicate_pos && a_type_order != b_type_order) return a_type_order - b_type_order; 5411 if(!isNaN(a_pos) && !isNaN(b_pos) && a_pos != b_pos) return a_pos - b_pos; 5412 if(!has_duplicate_pos && a_type_order != b_type_order) return a_type_order - b_type_order; 5413 if(!isNaN(a_seq) && !isNaN(b_seq) && a_seq != b_seq) return a_seq - b_seq; 5414 5415 return 0; 5416 }); 5417 5418 quick_str = ` 5419 <div class="quick-menu-${data['sid']} quickmenu ${quick_hide}" data-pagemode="${page_mode}" data-imgtype="${img_type}" data-device="${device}" data-sitepermit="${site_settings.sitePermit}"> 5420 <ul>` 5421 $.each(render_items, function(render_i, render_item) { 5422 var render_img_type = render_item.img_type, 5423 i = render_item.index, 5424 v = render_item.val, 5425 link_option_str = ''; 5426 link = $.quickmenu.setLink(v['link'],v['link_target']); 5427 5428 if(!$.isEmptyObject(link['option'])) link_option_str = `${link['option']['type']}="${link['option']['val']}"`; 5429 5430 v['icon_settings'] = parseQuickmenuSetting(v['icon_settings'], default_icon_settings); 5431 v['text_settings'] = parseQuickmenuSetting(v['text_settings'], default_text_settings); 5432 5433 if(render_img_type.indexOf('default') > -1 && device=='mobile') m_icon_settings.push(String(v['icon_settings']['--icon-size'] || '24px').replace(/px/gi,'')); 5434 5435 var v_img_key = (device=='pc') ? 'img' : 'img2', 5436 v_img_width_key = (device=='pc') ? 'img_width' : 'img2_width', 5437 v_img_height_key = (device=='pc') ? 'img_height' : 'img2_height';
5438 5439 var quick_settings = JSON.stringify(qm_list[device][render_img_type]['quick_settings']), 5440 v_img = htmlspecialchars_decode(getQuickmenuImageValue(v, v_img_key, render_img_type), 'ENT_QUOTES'), 5441 v_noimage = (v_img.indexOf('quickmenu-noimage') > -1) ? 'quickmenu-noimage' : '', 5442 val_br_text = v['text'], 5443 v_img_width = (v_noimage) ? ((device=='mobile' && render_img_type=='right_image') ? 64 : 72) : parseFloat(v[v_img_width_key]), 5444 v_img_height = (v_noimage) ? ((device=='mobile' && render_img_type=='right_image') ? 64 : 72) : parseFloat(v[v_img_height_key]), 5445 v_img_ratio = (render_img_type.indexOf('image') > -1 && v_img_width > 0 && v_img_height > 0) ? `${v_img_width} / ${v_img_height}` : '1 / 1', 5446 v_img_size_mode = getQuickmenuImageSizeMode(render_img_type, v['icon_settings']), 5447 v_origin_size_css = (render_img_type.indexOf('image') > -1 && v_img_size_mode=='origin' && v_img_width > 0) ? `--quick-size: ${v_img_width}px; --quick-roundedge-per: 0; --quick-roundedge-radius: 0px;` : '', 5448 v_bgblur = v['icon_settings']['--icon-bgblur'] || '3px', 5449 render_visible = getQuickmenuEffectiveVisible(render_img_type, v['visible']); 5450 5451 if(render_img_type.indexOf('default') > -1 && typeof isQuickmenuMaterialIconHtml == 'function' && isQuickmenuMaterialIconHtml(v_img)) { 5452 var v_material_settings = (typeof getQuickmenuMaterialSettings == 'function') ? getQuickmenuMaterialSettings(v['icon_settings'], v_img) : {}; 5453 v['icon_settings'] = $.extend(v['icon_settings'], { 5454 'material_style': v_material_settings.style || 'outlined', 5455 '--material-icon-fill': v_material_settings.fill || '0', 5456 '--material-icon-weight': v_material_settings.weight || '400', 5457 '--material-icon-grade': v_material_settings.grade || '0', 5458 '--material-icon-optical-size': v_material_settings.opticalSize || '24' 5459 }); 5460 if(typeof updateQuickmenuMaterialIconHtml == 'function') v_img = updateQuickmenuMaterialIconHtml(v_img, v['icon_settings']); 5461 } 5462 5463 // if(v['text'].indexOf('br') > -1) { 5464 // var brRegex = /<br\s*\/?>/gi; 5465 // val_text_array = v['text'].split(brRegex); 5466 // val_br_text = `${val_text_array[0]}<br />${val_text_array[1]}<br />${val_text_array[2]}`; 5467 // } 5468 5469 5470 5471 quick_str += ` 5472 <li class="quickmenu-box${(String(render_visible)=="0") ? ' hide' : ''} ${v_noimage}" data-id="${v['seq']}" data-pos="${v['pos']}" data-imgtype="${render_img_type}"> 5473 <a class="quickmenu-alink" href="${link['link']}" target="${link['target']}" ${link_option_str}> 5474 `; 5475 quick_str += (render_img_type.indexOf('default') > -1) ? ((device=='mobile' && render_img_type=='right_default') ? ` 5476 <span class="quickmenu-default-content"> 5477 <span class="quickmenu-icon ${(v['icon_settings']['onoff']=="false") ? 'hide ' : ''}">${v_img}</span> 5478 <span class="quickmenu-text ${(v['text_settings']['onoff']=="false") ? 'hide ' : ''}">${val_br_text}</span> 5479 </span>` : ` 5480 <span class="quickmenu-icon ${(v['icon_settings']['onoff']=="false") ? 'hide ' : ''}">${v_img}</span> 5481 <span class="quickmenu-text ${(v['text_settings']['onoff']=="false") ? 'hide ' : ''}">${val_br_text}</span>`) 5482 : ((v_img.indexOf('quickmenu-noimage') >
5482 -1) ? `<span class="quickmenu-noimage">${v_img}</span>` : `<img class="quickmenu-img" src="${v_img}"/>`) 5483 quick_str += `</a> 5484 </li> 5485 `; 5486 5487 quick_css += (render_img_type.indexOf('default') > -1) ? ` 5488 .quick-menu-${data['sid']}[data-device='${device}'] li[data-id='${v['seq']}'] .quickmenu-icon {--icon-size: ${v['icon_settings']['--icon-size']}; --icon-color: ${v['icon_settings']['--icon-color']}; --material-icon-fill: ${v['icon_settings']['--material-icon-fill'] || '0'}; --material-icon-weight: ${v['icon_settings']['--material-icon-weight'] || '400'}; --material-icon-grade: ${v['icon_settings']['--material-icon-grade'] || '0'}; --material-icon-optical-size: ${v['icon_settings']['--material-icon-optical-size'] || '24'};} 5489 .quick-menu-${data['sid']}[data-device='${device}'] li[data-id='${v['seq']}'] a {--icon-size: ${v['icon_settings']['--icon-size']};} 5490 .quick-menu-${data['sid']}[data-device='${device}'] li[data-id='${v['seq']}'] .quickmenu-text {--text-fname:${v['text_settings']['--text-fname']}; --text-fsize:${v['text_settings']['--text-fsize']}; --text-fweight:${v['text_settings']['--text-fweight']}; --text-fcolor: ${v['text_settings']['--text-fcolor']};} 5491 .quick-menu-${data['sid']}[data-device='${device}'] li.quickmenu-box[data-id='${v['seq']}'] {--icon-bgcolor: ${v['icon_settings']['--icon-bgcolor']}; --icon-bgblur: ${v_bgblur};} 5492 .quick-menu-${data['sid']}[data-device='${device}'] li[data-id='${v['seq']}'] svg {--icon-color: ${v['icon_settings']['--icon-color']}; --icon-size: ${v['icon_settings']['--icon-size']};} 5493 .quick-menu-${data['sid']}.quickmenu[data-device='mobile'] li[data-id='${v['seq']}'][data-imgtype='right_default'] > a.quickmenu-alink {display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; height: 100%; gap: 3px; text-align: center;} 5494 .quick-menu-${data['sid']}.quickmenu[data-device='mobile'] li[data-id='${v['seq']}'][data-imgtype='right_default'] > a.quickmenu-alink > .quickmenu-default-content {display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; height: auto; min-height: 0; gap: 3px; flex: 0 0 auto; margin: 0; text-align: center;} 5495 .quick-menu-${data['sid']}.quickmenu[data-device='mobile'] li[data-id='${v['seq']}'][data-imgtype='right_default'] > a.quickmenu-alink > .quickmenu-icon {display: flex; align-items: center; justify-content: center; width: var(--icon-size); height: var(--icon-size); flex: 0 0 auto; margin: 0;} 5496 .quick-menu-${data['sid']}.quickmenu[data-device='mobile'] li[data-id='${v['seq']}'][data-imgtype='right_default'] > a.quickmenu-alink > .quickmenu-text {display: block; width: calc(var(--quick-size) - 20px); height: auto; line-height: 1.4; flex: 0 0 auto; margin: 0;} 5497 .quick-menu-${data['sid']}.quickmenu[data-device='mobile'] li[data-id='${v['seq']}'][data-imgtype='right_default'] .quickmenu-default-content > .quickmenu-icon {display: flex; align-items: center; justify-content: center; width: var(--icon-size); height: var(--icon-size); flex: 0 0 auto; margin: 0;} 5498 .quick-menu-${data['sid']}.quickmenu[data-device='mobile'] li[data-id='${v['seq']}'][data-imgtype='right_default'] .quickmenu-default-content > .quickmenu-text {display: block; width: calc(var(--quick-size) - 20px); height: auto; line-height: 1.4; flex: 0 0 auto; margin: 0;} 5499 ` : ` 5500 .quick-menu-${data['sid']}[data-device='${device}'] li[data-id='${v['seq']}'][data-imgtype='${render_img_type}'] {--quick-img-ratio: ${v_img_ratio}; ${v_origin_size_css}} 5501 .quick-menu-${data['sid']}[data-device='${device}'] li[data-id='${v['seq']}'][data-imgtype='${render_img_type}'] img.quickmenu-img {width: 100%; height: 100%; object-fit: cover;} 5502 `; 5503 }); 5504 5505 // quick_css += (img_type.indexOf('default') > -1 && device=='mobile') ? ` 5506 // .quick-menu-${data['sid']}.quickmenu[data-imgtype="bottom_default"][data-device='mobile'] {--order-nav: ${Object.keys(img_type_total).length};}` : ''; 5507 quick_str += `</ul>`; 5508 5509 //quick_str += (device == 'pc') ? '' : `<div class="bg-nowrap-btn next"></div>`; 5510 quick_str += `</div>`; 5511 5512 5513 var selector = (device=='pc') ? '' : ' .quickmenu_viewer', 5514 screen_device = ($('body').width() > 768) ? 'pc' : 'mobile'; 5515 5516 $(`style#quick-menu-${data['sid']}${device}`).remove(); 5517 5518 5519 $('body').prepend($(quick_style).prop('outerHTML')); 5520 $(`#quick-menu-${data['sid']}${device}`).append(quick_css); 5521 $(`.sc-quickmenu${selector} .quick-menu-${data['sid']}`).remove(); 5522 5523 $(`.sc-quickmenu${selector}`).append(quick_str); 5524 5525 if(checkConfig !='c' || device == screen_device) { 5526 $(`.el-footer`).siblings(`.quick-menu-${data['sid']}`).remove(); 5527 $('.el-footer').after(quick_str); 5528 $(`.el-footer`).siblings(`.quick-menu-${data['sid']}`).removeClass('non_config').addClass('non_config'); 5529 5530 5531 if(PAGE_MODE=='c') { 5532 $('.quickmenu-hover-buffer').remove(); 5533 $('.el_quickmenu_ctrl').remove(); 5534 $(`.quick-menu-${data['sid']}`).before('<div class="quickmenu-hover-buffer"></div>'); 5535 $('.quickmenu-hover-buffer').before(`<div class="el_quickmenu_ctrl config-element-section" style="display:none;"><div class="config-element" data-toggle="tooltip" data-original-title="${$.lang[LANG]['config.label.qm_settings']}"><svg viewBox="0 0 19 19" width="23" height="23"><path d="M17.16 8.16l1.41-1.51c-0.2-0.65-0.48-1.28-0.84-1.9 -0.35-0.61-0.77-1.17-1.23-1.67l-2.02 0.46c-0.7-0.58-1.48-1.03-2.32-1.34l-0.61-1.97C10.9 0.08 10.21 0 9.5 0 8.79 0 8.1 0.08 7.44 0.22L6.83 2.2h0C5.98 2.51 5.19 2.97 4.51 3.54L2.5 3.08c-0.46 0.5-0.87 1.06-1.23 1.67S0.64 6 0.44 6.65l1.4 1.52c-0.16 0.89-0.15 1.8 0 2.68l-1.41 1.51c0.2 0.65 0.48 1.28 0.84 1.9s0.77 1.17 1.23 1.67l2.02-0.46c0.7 0.58 1.48 1.03 2.32 1.34l0.61 1.97v0C8.1 18.92 8.79 19 9.5 19c0.71 0 1.4-0.08 2.06-0.22l0.61-1.97c0.85-0.31 1.63-0.77 2.32-1.34l2.01 0.46c0.46-0.5 0.87-1.06 1.23-1.67 0.35-0.61 0.63-1.25 0.84-1.9l-1.4-1.52C17.31 9.94 17.31 9.04 17.16 8.16zM9.5 15.5c-3.31 0-6-2.69-6-6s2.69-6 6-6 6 2.69 6 6S12.81 15.5 9.5 15.5z"/></svg></div></div>`); 5536
5537 updateQuickmenuHoverBuffer(); 5538 } 5539 } 5540 5541 setTimeout(() => { 5542 if(device=='mobile' && img_type=='bottom_default') { 5543 var mobile_bottom_height = $(`.quick-menu-${data['sid']}.quickmenu[data-device="mobile"] ul`).height(), 5544 body_width = (checkConfig !='c' || device == screen_device) ? $('body').width() : 279, 5545 quick_li_width = 0; 5546 5547 $.each($(`.quick-menu-${data['sid']}.quickmenu[data-device="mobile"] ul li`), function(s,q) { 5548 quick_li_width += $(this).innerWidth(); 5549 }) 5550 5551 if(quick_li_width <= body_width) { 5552 $('.bg-nowrap-btn').remove(); 5553 $(`.quick-menu-${data['sid']}.quickmenu[data-device="mobile"]`).removeClass('width100').addClass('width100'); 5554 } else { 5555 $(`.quick-menu-${data['sid']}.quickmenu[data-device="mobile"]`).append('<div class="bg-nowrap-btn"></div>'); 5556 $(`.quick-menu-${data['sid']}.quickmenu[data-device="mobile"]`).find('.bg-nowrap-btn').css('height',mobile_bottom_height); 5557 } 5558 } 5559 }, 500); 5560 5561 5562 }, 5563 setLink: function(org_link,org_ltarget) { 5564 var link = (typeof org_link == 'string' && org_link != 'javascript:;' && org_link.length > 0) ? org_link : 'javascript:;', 5565 link_target = (typeof org_ltarget != 'undefined' && (org_ltarget == '1' || org_ltarget == 'ON')) ? '_blank' : '', 5566 link_option = {}; 5567 5568 // Keep previously saved phone links usable even when an empty last 5569 // input caused the old editor to append a trailing hyphen. 5570 if(/^tel:/i.test(link)) link = link.replace(/-+$/g, ''); 5571 5572 if(link != '' && link != 'javascript:;') { 5573 var _menuList = (PAGE_MODE == 'c') ? MENULIST : property.MENULIST; 5574 5575 if(link.match(/^\@/g) !== null) { // link-type: link-bookmark ==> a[attr-bookmark] 5576 var _settings = (PAGE_MODE == 'c') ? SETTINGS : property.SETTINGS, 5577 bookmark_seq = link.replace(/^\@/g,''); 5578 5579 if(typeof _settings == 'undefined' || typeof _settings.blockBookmarkList == 'undefined' || _settings.blockBookmarkList['bookmark' + bookmark_seq] == 'undefined') { 5580 link = ''; 5581 link_option = {}; 5582 } else { 5583 link_option = { 5584 'type' : 'attr-bookmark', 5585 'val' : bookmark_seq 5586 } 5587 } 5588 } else if(link.match(/^flink\@[0-9]/gi) !== null) { 5589 link_option = { 5590 'type' : 'attr-flink', 5591 'val' : link.replace(/^flink\@/gi,'') 5592 } // link-type: link-file ==> a[attr-flink] 5593 link_target = ''; 5594 } else if(_menuList.indexOf(link.replace(/^\//g,"").replace(/ /g,"-")) > -1) { // link-type: link-menu ==> a[data-user-link] 5595 link_option = { 5596 'type' : 'data-user-link', 5597 'val' : link 5598 } 5599 } else { 5600 link_option = { 5601 'type' : 'attr-link', 5602 'val' : link 5603 } // link-type: link-out ==> a[attr-link] 5604 } 5605 5606 link = (PAGE_MODE == 'c') ? makeLinkUrl(link, ONE, VIEW) : makeLinkUrl(link, property.ONE, property.VIEW); 5607 } 5608 5609 return {'link':link, 'target':link_target, 'option':link_option}; 5610 }, 5611 getCss: function(sid, device) { 5612 let quickmenuCss; 5613 5614 var quick_css = ($(`#quick-menu-${sid}${device}`).text()) ? $(`#quick-menu-${sid}${device}`).text().trim() : ''; 5615 quickmenuCss = CSSJSON.toJSON(quick_css); 5616 5617 return quickmenuCss; 5618 }, 5619 add: function(sid, publish) { 5620 var return_data = {}; 5621 5622 $.ajax({ 5623 type: 'POST', 5624 data: { sid:sid, publish:publish, data: $.quickmenu['quickmenu'], sample: true}, 5625 dataType: 'json', 5626 url: (CONFIG_URL) ? '/_config/siteConfig/btype/quickmenu/type/add' : '/config/siteConfig/btype/quickmenu/type/add', 5627 async:false, 5628 success : function(data) { 5629 checkError(data); 5630 return_data = data; 5631 $.quickmenu['quickmenu'] = return_data; 5632 }, 5633 error: function(request, status, error){ 5634 console.log(error); 5635 console.log("data error"); 5636 } 5637 }); 5638 5639 return return_data; 5640 }, 5641 getSetting: function(tag) { 5642 var data_obj = $(tag).data(), 5643 obj_etc = ['link','target','visible','name','imgtype'], 5644 settings_obj = {}; 5645 5646 $.each(data_obj, function(i,v){ 5647 var key_icon = (obj_etc.includes(i)) ? i : `--icon-${i}`; 5648 settings_obj[key_icon] = v; 5649 }); 5650 5651 return settings_obj; 5652 }, 5653 setCss: function(sid, device, seq, target, css_val, img_type) { 5654 var quick_imgtype = (typeof img_type != 'undefined' && img_type) ? img_type : $.quickmenu['quickmenu']['img_type'][device]; 5655 5656 if(target=='quick_settings') $.quickmenu['quickmenu']['list'][device][quick_imgtype]['quick_settings'] = css_val; 5657 else $.quickmenu['quickmenu']['list'][device][quick_imgtype][seq][target] = css_val; 5658 } 5659 } 5660 5661 $.siteBanner = { 5662 checkOffer: function(type) { 5663 // console.log(`$.siteBanner.checkOffer(type ${type})`); 5664 var checkPlan = (typeof VALIDPLAN == 'undefined') ? property.VALIDPLAN : VALIDPLAN, 5665 checkPlanType = (typeof VALIDTYPE == 'undefined') ? property.VALIDTYPE : VALIDTYPE; 5666 if(!checkPlan || checkPlanType == 'PK') { 5667 return false;
5668 } 5669 5670 var site_settings = (typeof property != 'undefined') ? property.SETTINGS : SETTINGS 5671 $.siteBanner.sid = (typeof property != 'undefined') ? property.SID : SID; 5672 if(typeof $.siteBanner.sid == 'undefined' || !$.siteBanner.sid || typeof site_settings == 'undefined' || !site_settings) { 5673 return false; 5674 } 5675 5676 if(type == 'popup') { 5677 if(site_settings.SITELOCK) return false; 5678 5679 var tmp_view = (PAGE_MODE == 'c') ? VIEW : ((typeof property != 'undefined') ? property.VIEW : ''), 5680 tmp_one = (PAGE_MODE == 'c') ? ONE : ((typeof property != 'undefined') ? property.ONE : ''), 5681 tmp_page = (PAGE_MODE == 'c') ? PAGE : ((typeof property != 'undefined') ? property.PAGE : ''), 5682 tmp_menu = (PAGE_MODE == 'c') ? MENULINK[0] : ((typeof property != 'undefined') ? property.MENULINK[0] : ''), 5683 tmp_clpage = ($('div:is(.element.cl-s-page, .psearch-view)').length > 0) ? true : false, 5684 checkFirstPage = (!tmp_view && !tmp_clpage && (tmp_one || !tmp_one && tmp_page == tmp_menu)) ? true : false; 5685 5686 if(!checkFirstPage) return false; 5687 } 5688 5689 return true; 5690 }, 5691 getBannerCookieName: function(type, id, viewType) { 5692 var bannerName = $.siteBanner.sid + (type.charAt(0).toUpperCase() + type.slice(1)) + 'Banner'; 5693 if(type == 'band' || (type == 'popup' && viewType == 'slide')) return bannerName; 5694 return bannerName + id; 5695 }, 5696 clearCloseCookie: function(type) { 5697 // console.log(`$.siteBanner.clearCloseCookie(type ${type})`); 5698 var isBoth = (typeof type == 'undefined') ? true : false, 5699 isBand = (isBoth || !isBoth && type == 'band') ? true : false, 5700 isPopup = (isBoth || !isBoth && type == 'popup') ? true : false; 5701 5702 if(isBand) { 5703 var band_id = $.siteBanner.sid + 'BandBanner'; 5704 $.removeCookie(band_id, { path : '/' }); 5705 } 5706 if(isPopup) { 5707 var popup_name = $.siteBanner.sid + 'PopupBanner'; 5708 $.removeCookie(popup_name, { path : '/' }); 5709 if(typeof $.siteBanner.popup != 'undefined' && typeof $.siteBanner.popup.list != 'undefined') { 5710 $.each($.siteBanner.popup.list, function(id,o) { 5711 var popup_id = $.siteBanner.sid + 'PopupBanner' + id; 5712 $.removeCookie(popup_id, { path : '/' }); 5713 }); 5714 } 5715 } 5716 }, 5717 getCssColorValue: function(color, fallback) { 5718 color = color || fallback || '#000000'; 5719 if(typeof Coloris != 'undefined' && typeof Coloris.getColorRegex == 'function' && Coloris.getColorRegex().test(color)) { 5720 return Coloris.getColorInfo(color, 'rgba'); 5721 } 5722 5723 return color; 5724 }, 5725 doNotOffer: function(type,isSC) { 5726 // console.log(`[siteBanner_step_END (off) /5] $.siteBanner.doNotOffer(type ${type},isSC ${isSC})`); 5727 if(isSC) $.siteBanner.clearCloseCookie(type); 5728 5729 var isBoth = (typeof type == 'undefined') ? true : false, 5730 isBand = (isBoth || !isBoth && type == 'band') ? true : false, 5731 isPopup = (isBoth || !isBoth && type == 'popup') ? true : false; 5732 5733 if(isBand) { 5734 $.siteBanner.stopBandRolling(); 5735 5736 $('body, .cl-bandBanner').removeClass('openBandBanner'); 5737 $('.cl-bandBanner, .el-menu_ctrl, .header.el-menu > header').removeInlineCss('margin-top'); 5738 document.querySelector('body').style.setProperty('--bandBanner-height-pc', null, null); 5739 document.querySelector('body').style.setProperty('--bandBanner-height-mobile', null, null); 5740 if($('.dsgn-body').hasClass('sidebar')) $('.dsgn-body').removeInlineCss('padding-top'); 5741 $('.cl-bandBanner').remove(); 5742 $('.element[data-type="gallery"][data-type2="premium"]').refreshRootCss(); 5743 5744 $.fheader.position(); 5745 $.clnav.setRootcss(); 5746 } 5747 if(isPopup) { 5748 $.siteBanner.stopPopupSlideRolling(); 5749 $('body, .cl-popupBanner').removeClass('openPopupBanner'); 5750 $('.cl-popupBanner').remove(); 5751 } 5752 }, 5753 init: function(checkBand,checkPopup) { 5754 // console.log(`[siteBanner_step_1 /5] $.siteBanner.init(checkBand ${checkBand},checkPopup ${checkPopup})`); 5755 5756 if(checkBand) $.siteBanner.call('band',false,true,true,true); 5757 if(checkPopup) $.siteBanner.call('popup',false,true,true,true); 5758 5759 if(typeof property == 'undefined') { 5760 $(document).on('mouseenter', '.cl-bandBanner, .cl-popupBanner', function() { 5761 if(isEDIT) return; 5762 else outElementButtonDisplay(); 5763 }); 5764 } 5765 5766 $(document).on('mouseenter', '.cl-bandBanner', function() { 5767 $.siteBanner.band.paused = true; 5768 }).on('mouseleave', '.cl-bandBanner', function() { 5769 $.siteBanner.band.paused = false;
5770 }); 5771 5772 $(document).off('click', '.cl-bandBanner .banner-body > a, .cl-popupBanner .banner-body > a') 5773 .on('click', '.cl-bandBanner .banner-body > a, .cl-popupBanner .banner-body > a', function() { 5774 if($(this).is('[href="javascript:;"]') || $(this).hasClass('clicked')) return false; 5775 var $clicked = $(this); 5776 $clicked.addClass('clicked'); 5777 5778 setTimeout(function() { 5779 $clicked.removeClass('clicked'); 5780 }, 3000); 5781 }); 5782 5783 $(document).on('click','.cl-bandBanner .banner-closetoday,\ 5784 .cl-bandBanner .banner-close,\ 5785 .cl-popupBanner .banner-closetoday,\ 5786 .cl-popupBanner .banner-close', function() { 5787 var bannerEL = $(this).closest('.banner-box'), 5788 banner_id = bannerEL.attr('id'), 5789 banner_type = bannerEL.attr('data-type'), 5790 banner_closetime = bannerEL.attr('data-closetime'), 5791 clickBtn = $(this), 5792 isCloseToday = $(this).is('.banner-closetoday'), 5793 banner_render_view_type = (banner_type == 'popup' && typeof $.siteBanner.popup != 'undefined') ? ($.siteBanner.popup.render_view_type || $.siteBanner.popup.view_type || 'individual') : '', 5794 date = new Date(); 5795 if(banner_type == 'band' && !clickBtn.closest('.banner-header').find('.banner-closetoday').hasClass('hide')) isCloseToday = true; 5796 5797 var time_val = { 5798 'always' : 0, 5799 'onlyone' : 365 * 24 * 60 * 60 * 1000, 5800 'week' : 7 * 24 * 60 * 60 * 1000, 5801 'day' : 24 * 60 * 60 * 1000, 5802 '12hours' : 12 * 60 * 60 * 1000, 5803 '6hours' : 6 * 60 * 60 * 1000, 5804 '2hours' : 2 * 60 * 60 * 1000, 5805 '1hours' : 60 * 60 * 1000, 5806 '30min' : 30 * 60 * 1000, 5807 '10min' : 10 * 60 * 1000, 5808 '3min' : 3 * 60 * 1000, 5809 }; 5810 5811 if(isCloseToday) date.setTime(date.getTime() + time_val['day']); 5812 else date.setTime(date.getTime() + time_val[banner_closetime]); 5813 5814 if(banner_type == 'band') { 5815 $.siteBanner.stopBandRolling(); 5816 banner_id = banner_id.replace(/BandBanner[0-9]+$/,'BandBanner'); 5817 } 5818 5819 if(banner_type == 'popup' && banner_render_view_type == 'slide') { 5820 var $popupModal = clickBtn.closest('.banner-modal'), 5821 $popupBanner = clickBtn.closest('.cl-popupBanner'), 5822 $popupItems = $popupModal.find('> ul > li.banner-box:not(.hide)'), 5823 popupTotal = $popupItems.length; 5824 5825 $.siteBanner.stopPopupSlideRolling('.cl-popupBanner'); 5826 $popupItems.addClass('hide'); 5827 $popupModal.find('.banner-slide-arrow').addClass('hide'); 5828 $popupModal.find('.banner-slide-pagination').addClass('hide').empty(); 5829 $popupBanner.removeClass('openPopupBanner').addClass('hide'); 5830 $('body').removeClass('openPopupBanner'); 5831 5832 if(isCloseToday || (typeof banner_closetime != 'undefined' && banner_closetime != 'always' && banner_closetime != '')) { 5833 $.cookie($.siteBanner.getBannerCookieName('popup', '', 'slide'), true, { path: '/', expires: date}); 5834 } 5835 5836 $.siteBanner.popup.total = Math.max(Number($.siteBanner.popup.total || popupTotal) - popupTotal, 0); 5837 return; 5838 } 5839 5840 $('#'+banner_id).addClass('hide'); 5841 if(isCloseToday || (typeof banner_closetime != 'undefined' && banner_closetime != 'always' && banner_closetime != '')) { 5842 $.cookie(banner_id, true, { path: '/', expires: date}); 5843 } 5844 $.siteBanner[banner_type].total--; 5845 if(banner_type == 'popup') { 5846 var $popupBanner = clickBtn.closest('.cl-popupBanner'), 5847 popupRemain = $popupBanner.find('> .banner-modal > ul > li.banner-box:not(.hide)').length; 5848 5849 if(popupRemain < 1 || $.siteBanner.popup.total < 1) { 5850 $popupBanner.removeClass('openPopupBanner').addClass('hide'); 5851 $('body').removeClass('openPopupBanner'); 5852 } 5853 } 5854 if(banner_type == 'band') { 5855 $.siteBanner.band.used = false;
5856 $.siteBanner.call('band',false,false,true,true); 5857 } 5858 }); 5859 }, 5860 5861 isPopupSlidePublishableItem: function(item) { 5862 var period = null, 5863 periodChk = false, 5864 periodLabel = ''; 5865 5866 if(!item || item.visible != 'ON') return false; 5867 5868 period = item.period || {}; 5869 periodChk = (period.chk === true || period.chk == 1 || period.chk == '1'); 5870 periodLabel = String(period.label || ''); 5871 if(!periodChk && (period.visible === false || period.visible == 'false' || periodLabel !== '')) return false; 5872 5873 return true; 5874 }, 5875 5876 getPopupRenderableViewType: function(type) { 5877 var viewType = (type == 'popup' && typeof $.siteBanner[type] != 'undefined') ? ($.siteBanner[type].view_type || 'individual') : 'individual', 5878 count = 0, 5879 list = (type == 'popup' && $.siteBanner[type]) ? $.siteBanner[type].list : null, 5880 sort = (type == 'popup' && $.siteBanner[type]) ? $.siteBanner[type].sort : null; 5881 5882 if(type != 'popup' || viewType != 'slide' || !list || !sort || typeof sort.length == 'undefined') return viewType; 5883 5884 $.each(sort, function(idx, id) { 5885 var item = list[id]; 5886 5887 if(!$.siteBanner.isPopupSlidePublishableItem(item)) return true; 5888 count++; 5889 }); 5890 5891 return (count > 1) ? viewType : 'individual'; 5892 }, 5893 5894 call: function(type,isSC,isGet,isSet,isPosition) { 5895 // console.log(`[siteBanner_step_2 /5] $.siteBanner.call(type ${type}, isSC ${isSC}, isGet ${isGet}, isSet ${isSet}, isPosition ${isPosition})`); 5896 var parentDocument = $(window.parent.document), 5897 $detail_modal = parentDocument.find('.product-detail-modal'); 5898 if($detail_modal.length) return false; 5899 var isOffer = $.siteBanner.checkOffer(type); 5900 if(!isSC && !isOffer) { 5901 $.siteBanner.doNotOffer(type,isSC); 5902 return false; 5903 } 5904 5905 var isBand = (type == 'band') ? true : false, 5906 isPopup = (type == 'popup') ? true : false, 5907 banner_fn_obj = {'call':false, 'get':false, 'set':false, 'position':false}, 5908 deferredCall = $.Deferred(); 5909 5910 if(isBand) { 5911 if(typeof $.siteBanner.band == 'undefined') $.siteBanner.band = {'seqs':[], 'paused':false}; 5912 else $.siteBanner.stopBandRolling(); 5913 5914 $.siteBanner.band.body = ($.inArray(PAGE_MODE, ['s','r']) > -1) ? window : '.dsgn-body'; 5915 if($('html').is('._scroll')) $.siteBanner.band.body = window; 5916 if(isSC) { 5917 var band_fn = banner_fn_obj; 5918 if( typeof $.siteBanner.band != 'undefined' && 5919 typeof $.siteBanner.band.fn != 'undefined' && 5920 typeof $.siteBanner.band.fn_keep != 'undefined' 5921 ) { 5922 band_fn = $.siteBanner.band.fn; 5923 delete $.siteBanner.band.fn_keep; 5924 } 5925 $.siteBanner.band.fn = band_fn; 5926 } 5927 } 5928 if(isPopup) { 5929 if(typeof $.siteBanner.popup == 'undefined') $.siteBanner.popup = {}; 5930 if(isSC) { 5931 var popup_fn = banner_fn_obj; 5932 if( typeof $.siteBanner.popup != 'undefined' && 5933 typeof $.siteBanner.popup.fn != 'undefined' && 5934 typeof $.siteBanner.popup.fn_keep != 'undefined' 5935 ) { 5936 popup_fn = $.siteBanner.popup.fn; 5937 delete $.siteBanner.popup.fn_keep; 5938 } 5939 $.siteBanner.popup.fn = popup_fn; 5940 } 5941 } 5942 5943 var step1 = $.siteBanner.get(type,isSC,isGet); 5944 step1.done(function() { 5945 var step2 = $.siteBanner.set(type,isSC,isSet); 5946 step2.done(function() { 5947 if($.siteBanner[type].used) { 5948 var step3 = $.siteBanner.position(type,isSC,isPosition); 5949 step3.done(function(step3_r) { 5950 fixedConfigBtn(); 5951 5952 setTimeout(function() { 5953 $.clnav.setRootcss(); 5954 }, 500); 5955 deferredCall.resolve(); 5956 }).fail(function(step3_error) { 5957 deferredCall.reject(step3_error); 5958 }); 5959 } else { 5960 deferredCall.resolve(); 5961 } 5962 }).fail(function(step2_error) { 5963 deferredCall.reject(step2_error); 5964 }); 5965 }).fail(function(step1_error) { 5966 deferredCall.reject(step1_error); 5967 }); 5968 5969 return deferredCall.promise(); 5970 }, 5971 5972 get: function(type,isSC,isGet) { 5973 // console.log(`[siteBanner_step_3 /5] $.siteBanner.get(type ${type}, isSC ${isSC}, isGet ${isGet})`); 5974 var deferred01 = $.Deferred(), 5975 isBand = (type == 'band') ? true : false, 5976 isPopup = (type == 'popup') ? true : false, 5977 publish = (typeof property != 'undefined') ? property.PUBLISH : false;
5978 5979 if(!isGet) deferred01.resolve(); 5980 else { 5981 if(PAGE_MODE == 'c'){ // config(ì¬ì´í¸í¸ì§) 5982 $.post('/template/siteBanner/type/get',{ publish:publish, sid:$.siteBanner.sid, v:type }, function(data) { 5983 checkError(data); 5984 if(typeof data == 'object') { 5985 $.siteBanner[type]['sort'] = data.sort; 5986 $.siteBanner[type]['list'] = data.list; 5987 $.siteBanner[type]['used'] = data.used; 5988 $.siteBanner[type]['total'] = data.sort.length; 5989 $.siteBanner[type]['close_time'] = data.close_time; 5990 $.siteBanner[type]['close_today'] = data.close_today; 5991 5992 if(isBand) { 5993 $.siteBanner[type]['close_onoff'] = data.close_onoff; 5994 $.siteBanner[type]['interval'] = data.interval; 5995 } 5996 if(isPopup) { 5997 $.siteBanner[type]['position'] = data.position; 5998 $.siteBanner[type]['radius'] = data.radius; 5999 $.siteBanner[type]['close_btn'] = data.close_btn; 6000 $.siteBanner[type]['btn_style'] = data.btn_style; 6001 $.siteBanner[type]['btn_color'] = data.btn_color; 6002 $.siteBanner[type]['bg_layer'] = data.bg_layer; 6003 $.siteBanner[type]['bg_color'] = data.bg_color; 6004 $.siteBanner[type]['view_type'] = data.view_type; 6005 $.siteBanner[type]['slide_auto'] = data.slide_auto; 6006 $.siteBanner[type]['slide_speed'] = data.slide_speed; 6007 $.siteBanner[type]['slide_move_time'] = data.slide_move_time; 6008 $.siteBanner[type]['slide_stop_time'] = data.slide_stop_time; 6009 $.siteBanner[type]['slide_size_origin'] = data.slide_size_origin; 6010 $.siteBanner[type]['slide_size_width'] = data.slide_size_width; 6011 $.siteBanner[type]['slide_arrow'] = data.slide_arrow; 6012 $.siteBanner[type]['slide_arrow_style'] = data.slide_arrow_style || '1'; 6013 $.siteBanner[type]['slide_arrow_size'] = data.slide_arrow_size || '64'; 6014 $.siteBanner[type]['slide_arrow_color'] = data.slide_arrow_color; 6015 $.siteBanner[type]['slide_arrow_bg_color'] = data.slide_arrow_bg_color; 6016 $.siteBanner[type]['slide_pagination_display'] = data.slide_pagination_display; 6017 $.siteBanner[type]['slide_pagination'] = data.slide_pagination; 6018 $.siteBanner[type]['slide_pagination_style'] = data.slide_pagination_style || ((data.slide_pagination == 'dot') ? '1' : '11'); 6019 $.siteBanner[type]['slide_pagination_align'] = data.slide_pagination_align; 6020 $.siteBanner[type]['slide_pagination_size'] = data.slide_pagination_size || '52'; 6021 $.siteBanner[type]['slide_pagination_color'] = data.slide_pagination_color; 6022 $.siteBanner[type]['slide_pagination_active_color'] = data.slide_pagination_active_color; 6023 } 6024 deferred01.resolve(); 6025 } else { 6026 deferred01.reject('get error'); 6027 } 6028 }, 'json'); 6029 6030 }else{ // render / site 6031 // console.log(RENDER.b); 6032 if(isBand && RENDER.b.BAND != '') { 6033 $.siteBanner['band']['close_onoff'] = RENDER.b.BAND.close_onoff; 6034 $.siteBanner['band']['interval'] = RENDER.b.BAND.interval; 6035 $.siteBanner['band']['sort'] = RENDER.b.BAND.sort; 6036 $.siteBanner['band']['list'] = RENDER.b.BAND.list; 6037 $.siteBanner['band']['used'] = RENDER.b.BAND.used; 6038 $.siteBanner['band']['total'] = RENDER.b.BAND.sort.length; 6039 $.siteBanner['band']['close_time'] = RENDER.b.BAND.close_time; 6040 $.siteBanner['band']['close_today'] = RENDER.b.BAND.close_today; 6041 } 6042 if(isPopup && RENDER.b.POPUP != '') { 6043 $.siteBanner['popup']['position'] = RENDER.b.POPUP.position; 6044 $.siteBanner['popup']['sort'] = RENDER.b.POPUP.sort; 6045 $.siteBanner['popup']['list'] = RENDER.b.POPUP.list; 6046 $.siteBanner['popup']['used'] = RENDER.b.POPUP.used; 6047 $.siteBanner['popup']['total'] = RENDER.b.POPUP.sort.length; 6048 $.siteBanner['popup']['close_time'] = RENDER.b.POPUP.close_time; 6049 $.siteBanner['popup']['close_today'] = RENDER.b.POPUP.close_today;
6050 $.siteBanner['popup']['radius'] = RENDER.b.POPUP.radius; 6051 $.siteBanner['popup']['close_btn'] = RENDER.b.POPUP.close_btn; 6052 $.siteBanner['popup']['btn_style'] = RENDER.b.POPUP.btn_style; 6053 $.siteBanner['popup']['btn_color'] = RENDER.b.POPUP.btn_color; 6054 $.siteBanner['popup']['bg_layer'] = RENDER.b.POPUP.bg_layer; 6055 $.siteBanner['popup']['bg_color'] = RENDER.b.POPUP.bg_color; 6056 $.siteBanner['popup']['view_type'] = RENDER.b.POPUP.view_type; 6057 $.siteBanner['popup']['slide_auto'] = RENDER.b.POPUP.slide_auto; 6058 $.siteBanner['popup']['slide_speed'] = RENDER.b.POPUP.slide_speed; 6059 $.siteBanner['popup']['slide_move_time'] = RENDER.b.POPUP.slide_move_time; 6060 $.siteBanner['popup']['slide_stop_time'] = RENDER.b.POPUP.slide_stop_time; 6061 $.siteBanner['popup']['slide_size_origin'] = RENDER.b.POPUP.slide_size_origin; 6062 $.siteBanner['popup']['slide_size_width'] = RENDER.b.POPUP.slide_size_width; 6063 $.siteBanner['popup']['slide_arrow'] = RENDER.b.POPUP.slide_arrow; 6064 $.siteBanner['popup']['slide_arrow_style'] = RENDER.b.POPUP.slide_arrow_style || '1'; 6065 $.siteBanner['popup']['slide_arrow_size'] = RENDER.b.POPUP.slide_arrow_size || '64'; 6066 $.siteBanner['popup']['slide_arrow_color'] = RENDER.b.POPUP.slide_arrow_color; 6067 $.siteBanner['popup']['slide_arrow_bg_color'] = RENDER.b.POPUP.slide_arrow_bg_color; 6068 $.siteBanner['popup']['slide_pagination_display'] = RENDER.b.POPUP.slide_pagination_display; 6069 $.siteBanner['popup']['slide_pagination'] = RENDER.b.POPUP.slide_pagination; 6070 $.siteBanner['popup']['slide_pagination_style'] = RENDER.b.POPUP.slide_pagination_style || ((RENDER.b.POPUP.slide_pagination == 'dot') ? '1' : '11'); 6071 $.siteBanner['popup']['slide_pagination_align'] = RENDER.b.POPUP.slide_pagination_align; 6072 $.siteBanner['popup']['slide_pagination_size'] = RENDER.b.POPUP.slide_pagination_size || '52'; 6073 $.siteBanner['popup']['slide_pagination_color'] = RENDER.b.POPUP.slide_pagination_color; 6074 $.siteBanner['popup']['slide_pagination_active_color'] = RENDER.b.POPUP.slide_pagination_active_color; 6075 } 6076 deferred01.resolve(); 6077 } 6078 6079 } 6080 6081 return deferred01.promise(); 6082 }, 6083 set: function(type,isSC,isSet) { 6084 // console.log(`[siteBanner_step_4 /5] $.siteBanner.set(type ${type}, isSC ${isSC}, isSet ${isSet})`); 6085 var deferred02 = $.Deferred(), 6086 isBand = (type == 'band') ? true : false, 6087 isPopup = (type == 'popup') ? true : false, 6088 onoff = $.siteBanner[type].used; 6089 6090 if(isSet && onoff) { 6091 6092 var CHK_LANG = LANG; 6093 if (typeof PAGE_MODE != 'undefined' && PAGE_MODE=='c' ) { 6094 if(typeof SLANG != 'undefined' && typeof SLANG.select_code != 'undefined' && SLANG.select_code && SLANG.use_language == 'on') { 6095 CHK_LANG = (SLANG.select_code == 'ko') ? 'ko' : 'en'; 6096 } 6097 } 6098 6099 var banner_name = $.siteBanner.sid + (type.charAt(0).toUpperCase() + type.slice(1)) + 'Banner', 6100 b_list = '', 6101 b_idx = 0, b_show = 0, 6102 min = [120, 150], 6103 max = [0, 0], 6104 sum = [0, 0], 6105 popupViewType = (isPopup && typeof $.siteBanner.getPopupRenderableViewType == 'function') ? $.siteBanner.getPopupRenderableViewType(type) : ((isPopup) ? ($.siteBanner[type].view_type || 'individual') : 'individual'), 6106 popupSlideSizeOrigin = (isPopup && $.siteBanner[type].slide_size_origin == 'OFF') ? 'OFF' : 'ON', 6107 popupSlideSizeWidth = (isPopup) ? Number($.siteBanner[type].slide_size_width || 500) : 0, 6108 popupSlideSizeInfo = null, 6109 scPreviewDevice = (isSC) ? ($('#el-siteConfig .sc-device-wrap > li.active').attr('data-device') || 'p') : '', 6110 isPopupMobileRender = (isPopup && ((isSC && scPreviewDevice == 'm') || (!isSC && $(window).width() <= 767))), 6111 popupMobileMaxWidth = 0; 6112 if(isPopup) $.siteBanner[type].render_view_type = popupViewType; 6113 if(isPopup && (!popupSlideSizeWidth || popupSlideSizeWidth < 1)) popupSlideSizeWidth = 500; 6114 if(isPopup && popupViewType == 'slide') popupSlideSizeInfo = $.siteBanner.getPopupSli
6114deSizeInfo(type, popupSlideSizeOrigin, popupSlideSizeWidth, isSC); 6115 if(isPopup && popupViewType != 'slide' && isPopupMobileRender && typeof $.siteBanner.getPopupMobileIndividualMaxWidth == 'function') popupMobileMaxWidth = $.siteBanner.getPopupMobileIndividualMaxWidth(isSC); 6116 6117 $.each($.siteBanner[type].sort, function(idx,id) { 6118 var o = $.siteBanner[type].list[id], 6119 isVisible = (o.visible == 'ON') ? true : false; 6120 // console.log(o); 6121 if(!isSC && o.period.set && o.period.visible === false) isVisible = false; 6122 if(!isSC && isVisible || isSC) { 6123 var banner_id = banner_name + id, 6124 banner_cookie = $.siteBanner.getBannerCookieName(type, id, popupViewType), 6125 isCookie = (typeof $.cookie(banner_cookie) != 'undefined' && $.cookie(banner_cookie)) ? true : false, 6126 popupSize = (type == 'popup' && typeof o.size != 'undefined') ? o.size : {}, 6127 popupSizeOrigin = (popupSize.origin == 'OFF') ? 'OFF' : 'ON', 6128 popupSizeWidth = Number(popupSize.width || o.img.pc.width || 0), 6129 popupMobileAutoImage = (type == 'popup' && o.img.mobile && o.img.mobile.chk == '1') ? true : false, 6130 popupMobileSourceWidth = Number(((popupMobileAutoImage) ? o.img.pc.width : o.img.mobile.width) || o.img.pc.width || 0), 6131 popupMobileSourceHeight = Number(((popupMobileAutoImage) ? o.img.pc.height : o.img.mobile.height) || o.img.pc.height || 0), 6132 popupPcDisplayWidth = (popupViewType == 'slide' && popupSlideSizeInfo) ? popupSlideSizeInfo.pc.width : ((popupSizeOrigin == 'OFF' && popupSizeWidth > 0) ? popupSizeWidth : Number(o.img.pc.width)), 6133 popupMobileDisplayWidth = (popupViewType == 'slide' && popupSlideSizeInfo) ? popupSlideSizeInfo.mobile.width : ((popupSizeOrigin == 'OFF' && popupSizeWidth > 0) ? popupSizeWidth : popupMobileSourceWidth), 6134 popupPcDisplayHeight = (popupViewType == 'slide' && popupSlideSizeInfo) ? popupSlideSizeInfo.pc.height : Number(o.img.pc.height), 6135 popupMobileDisplayHeight = (popupViewType == 'slide' && popupSlideSizeInfo) ? popupSlideSizeInfo.mobile.height : popupMobileSourceHeight; 6136 6137 if(type == 'popup' && popupViewType != 'slide') { 6138 if(isPopupMobileRender && popupMobileMaxWidth > 0) { 6139 popupMobileDisplayWidth = popupMobileMaxWidth; 6140 if(popupMobileSourceWidth > 0 && popupMobileSourceHeight > 0) { 6141 popupMobileDisplayHeight = Math.round(popupMobileDisplayWidth * popupMobileSourceHeight / popupMobileSourceWidth); 6142 } 6143 } else if(popupSizeOrigin == 'OFF' && popupSizeWidth > 0 && popupMobileSourceWidth > 0 && popupMobileSourceHeight > 0) { 6144 popupMobileDisplayHeight = Math.round(popupMobileDisplayWidth * popupMobileSourceHeight / popupMobileSourceWidth); 6145 } 6146 } 6147 6148 b_idx++; 6149 if(!isCookie || isSC) { 6150 b_show++; 6151 6152 if(isVisible) { 6153 if(min[0] > popupPcDisplayHeight) min[0] = popupPcDisplayHeight; 6154 if(max[0] < popupPcDisplayHeight) max[0] = popupPcDisplayHeight; 6155 if(max[1] < popupMobileDisplayHeight) max[1] = popupMobileDisplayHeight; 6156 if(type == 'popup') { 6157 sum[0] += popupPcDisplayWidth; 6158 sum[1] += popupMobileDisplayWidth; 6159 } else { 6160 sum[0] += Number(o.img.pc.width); 6161 sum[1] += Number(o.img.mobile.width); 6162 } 6163 } 6164 } 6165 6166 var period_label = (o.period.chk == 1) ? '' : o.period.label; 6167 var banner_label = (isSC) ? '\ 6168 <ul class="banner-label" data-period-label="'+period_label+'">\ 6169 <li class="period-start">' + $.lang[LANG]['sc.banner.period.label.start'] + '</li>\ 6170 <li class="period-end">' + $.lang[LANG]['sc.banner.period.label.end'] + '</li>\ 6171 </ul>\ 6172 ' : '', 6173 banner_str = ''; 6174 if(type == 'band') { 6175 var band_img_arr = [o.img.pc.path, o.img.mobile.path], 6176 band_img_mobile = (o.img.mobile.chk == '0') ? true : false, 6177 band_img_root = (isSC) ? ['--scbandBanner-img-pc','--scbandBanner-img-mobile'] : ['--bandBanner-img-pc','--bandBanner-img-mobile']; 6178 $.each(band_img_arr, function(img_i,img_v) { 6179 var check_img = $('<img data-id="' + id + '" data-root="' + band_img_root[img_i] + '" data-sc="' + isSC + '"/>').attr('src',img_v); 6180 check_img.error(function() { 6181 var img_id = $(this).attr('data-id'), 6182 img_root = $(this).attr('data-root'), 6183 checkSC = $(this).attr('data-sc'), 6184 img_s = (checkSC == 'true') ? 'sc-bandBanner' : 'cl-bandBanner'; 6185 document.querySelector('.'+img_s+' .banner-box[data-id="'+img_id+'"] .banner-img').style.setProperty(img_root, 'url(//storage.googleapis.com/i.addblock.net/img_broken_fill_500.png)', null); 6186 }); 6187 }); 6188 6189 var banner_img_style = `${band_img_root[0]}: url(${band_img_arr[0]}); ${band_img_root[1]}: url(${(band_img_mobile) ? band_img_arr[1] : band_img_arr[0]});`; 6190 6191 banner_str = '\ 6192 <li class="banner-box" id="' + banner_id + '">\ 6193 <div class="banner-content">\ 6194 <div class="banner-body">\ 6195 <a href="javascript:;">\ 6196 <div class="banner-img" style="' + banner_img_style + '">\ 6197 <div class="img-banner"></div>\ 6198 </div>\ 6199 </a>\ 6200 ' + banner_label + '\ 6201 </div>\ 6202 <div class="banner-header">\
6203 <span class="banner-closetoday">' + $.lang[CHK_LANG]['editor.banner.close.today'] + '</span>\ 6204 ' + clSVG('close',12,12,true,'banner-close') + '\ 6205 </div>\ 6206 </div>\ 6207 </li>\ 6208 '; 6209 } else if(type == 'popup') { 6210 6211 var popup_img_style = `<img src="${o.img.pc.path}" alt="" class="img-responsive img-banner pc" onerror="this.src=\'//storage.googleapis.com/i.addblock.net/img_broken_fill_500.png\'"/><img src="${(o.img.mobile.chk == '1') ? o.img.pc.path : o.img.mobile.path}" alt="" class="img-responsive img-banner mobile" onerror="this.src=\'//storage.googleapis.com/i.addblock.net/img_broken_fill_500.png\'"/>`; 6212 banner_str = '\ 6213 <li class="banner-box" id="' + banner_id + '">\ 6214 <div class="banner-content">\ 6215 <div class="banner-header">' + clSVG('close',17,17,true,'banner-close') + '</div>\ 6216 <div class="banner-body">\ 6217 <a href="javascript:;">\ 6218 <div class="banner-img">\ 6219 '+ popup_img_style +'\ 6220 </div>\ 6221 </a>\ 6222 ' + banner_label + '\ 6223 </div>\ 6224 <div class="banner-footer clearfix">\ 6225 <div class="banner-btn-wrap">\ 6226 <span class="banner-btn banner-closetoday">' + $.lang[CHK_LANG]['editor.banner.close.today'] + '</span>\ 6227 <span class="banner-btn banner-close">' + $.lang[CHK_LANG]['config.close'] + '</span>\ 6228 </div>\ 6229 </div>\ 6230 </div>\ 6231 </li>\ 6232 '; 6233 } 6234 6235 var bannerItem = $(banner_str), 6236 closeColor = $.siteBanner.getCssColorValue(o.close.color, '#000000'); 6237 bannerItem.attr('data-id', id); 6238 bannerItem.attr('data-type', type); 6239 if(isSC) { 6240 if(!isVisible) bannerItem.addClass('hide'); 6241 if(o.link.val) { 6242 var blink_o = $.siteBanner.getLINK(o.link.val, o.link.target); 6243 if(blink_o.link) { 6244 bannerItem.find('a').addClass('active'); 6245 } 6246 } 6247 } else { 6248 if(isCookie) bannerItem.addClass('hide'); 6249 bannerItem.attr('data-closetime', $.siteBanner[type].close_time); 6250 if(o.link.val) { 6251 var blink_o = $.siteBanner.getLINK(o.link.val, o.link.target); 6252 if(blink_o.link) { 6253 bannerItem.find('a').attr('href', blink_o.link); 6254 if(blink_o.target) bannerItem.find('a').attr('target', blink_o.target); 6255 $.each(blink_o.option, function(o_k, o_v) { 6256 bannerItem.find('a').attr(o_k, o_v); 6257 }); 6258 } 6259 } 6260 } 6261 bannerItem.find('.banner-content').css('background-color',o.img.bgcolor); 6262 bannerItem.find('.banner-header .banner-closetoday').css('color',closeColor); 6263 bannerItem.find('.banner-header .banner-close.cl-icon > svg').css('fill',closeColor); 6264 if(type == 'popup' && popupViewType == 'slide' && popupSlideSizeInfo) { 6265 $.siteBanner.applyPopupSlideBoxSize(bannerItem, popupSlideSizeInfo); 6266 } else if(type == 'popup' && popupViewType != 'slide' && isPopupMobileRender && popupMobileDisplayWidth > 0) { 6267 bannerItem.css('width', popupMobileDisplayWidth + 'px'); 6268 bannerItem.find('.banner-content, .banner-body, .banner-img, .banner-img > img').css('width', '100%'); 6269 } else if(type == 'popup' && popupSizeOrigin == 'OFF' && popupSizeWidth > 0) { 6270 bannerItem.css('width', popupSizeWidth + 'px'); 6271 bannerItem.find('.banner-content, .banner-body, .banner-img, .banner-img > img').css('width', '100%'); 6272 } 6273 6274 if($.siteBanner[type].close_today == 'OFF') bannerItem.find('.banner-closetoday').addClass('hide'); 6275 if(type == 'band' && $.siteBanner[type].close_onoff == 'OFF') bannerItem.find('.banner-header').addClass('hide'); 6276 6277 if(type == 'popup' && $.siteBanner[type].close_btn == '1') { 6278 bannerItem.find('.banner-content').css('background-color',''); 6279 bannerItem.find('.banner-body').css('background-color',o.img.bgcolor); 6280 } 6281 6282 b_list += bannerItem.outerHTML(); 6283 } 6284 }); 6285 6286 if(b_show > 0) { 6287 $.siteBanner[type].total = b_show; 6288 if(isBand) { 6289 $.siteBanner[type].min_h = min; 6290 } else if(isPopup) { 6291 $.siteBanner[type].total_w = sum; 6292 $.siteBanner[type].max_h = max; 6293 } 6294 6295 var popup_slide_arrow_style_for_html = $.siteBanner[type].slide_arrow_style || '1', 6296 popup_slide_arrow_color_for_html = $.siteBanner[type].slide_arrow_color || '#ffffff', 6297 popup_slide_arrow_size_for_html = $.siteBanner.getPopupSli
6297deControlSizeValue($.siteBanner[type].slide_arrow_size, '64'), 6298 popup_slide_arrow_mobile_size_for_html = (!isSC && typeof $.siteBanner.getPopupSlideMobileArrowSize == 'function') ? $.siteBanner.getPopupSlideMobileArrowSize() : 0, 6299 popup_slide_arrow_icon_size_for_html = (isSC && scPreviewDevice == 'm') ? '36' : ((popup_slide_arrow_mobile_size_for_html > 0) ? String(popup_slide_arrow_mobile_size_for_html) : popup_slide_arrow_size_for_html), 6300 popup_slide_arrow_prev_svg = $.siteBanner.getPopupSlideArrowStyleSvg(popup_slide_arrow_style_for_html, popup_slide_arrow_color_for_html, popup_slide_arrow_icon_size_for_html), 6301 popup_slide_arrow_next_svg = $.siteBanner.getPopupSlideArrowStyleSvg(popup_slide_arrow_style_for_html, popup_slide_arrow_color_for_html, popup_slide_arrow_icon_size_for_html); 6302 6303 if(isSC) { 6304 var popup_slide_control = (isPopup) ? '<div class="banner-slide-arrow"><button type="button" class="banner-slide-prev">' + popup_slide_arrow_prev_svg + '</button><button type="button" class="banner-slide-next">' + popup_slide_arrow_next_svg + '</button></div><div class="banner-slide-pagination el_popup_slide_pagination"><div class="slider-pagination-popup"></div></div>' : ''; 6305 var popup_mobile_mockup = (isPopup) ? '<img class="sc-popup-mobile-mockup" src="https://storage.googleapis.com/i.addblock.net/sample/popup_mockup.png" alt="">' : ''; 6306 $('#el-siteConfig .sc-siteBanner').replaceWith(` 6307 <div class="sc-siteBanner sc-${type}Banner ${scPreviewDevice}"> 6308 ${popup_mobile_mockup} 6309 <div class="banner-modal"> 6310 <ul>${b_list}</ul> 6311 ${popup_slide_control} 6312 <div class="banner-description" data-closetoday="m"><span>${clSVG('info',18,18,true,'')}${$.lang[LANG]['sc.banner.band.close.today.m']}</span></div> 6313 <div class="banner-description" data-overflow="x"><span>${clSVG('info',18,18,true,'')}${$.lang[LANG]['sc.banner.popup.position.overflow']}</span></div> 6314 </div> 6315 </div> 6316 `); 6317 } else { 6318 var popup_slide_control = (isPopup) ? '<div class="banner-slide-arrow"><button type="button" class="banner-slide-prev">' + popup_slide_arrow_prev_svg + '</button><button type="button" class="banner-slide-next">' + popup_slide_arrow_next_svg + '</button></div><div class="banner-slide-pagination el_popup_slide_pagination"><div class="slider-pagination-popup"></div></div>' : ''; 6319 var bannerEL = $(` 6320 <div class="cl-${type}Banner"> 6321 <div class="banner-modal"> 6322 <ul>${b_list}</ul> 6323 ${popup_slide_control} 6324 </div> 6325 </div> 6326 `); 6327 6328 if($(`.cl-${type}Banner`).length > 0) $(`.cl-${type}Banner`).remove(); 6329 if($('html').is('._scroll')) { 6330 if($('.editor-navbar').length > 0) $('.editor-navbar').after(bannerEL); 6331 else $('body').prepend(bannerEL); 6332 } else { 6333 $('.dsgn-body').prepend(bannerEL); 6334 } 6335 } 6336 6337 if(Number($.siteBanner[type].radius) > 0) { 6338 $.siteBanner.setPopupRadiusCss('.banner-modal', $.siteBanner[type].radius); 6339 } 6340 if(isPopup) { 6341 var popupBtnStyle = $.siteBanner[type].btn_style || '1', 6342 popupBtnColor = $.siteBanner[type].btn_color || '#696c71', 6343 popupBgLayer = $.siteBanner[type].bg_layer || 'OFF', 6344 popupBgColor = $.siteBanner[type].bg_color || 'rgba(0, 0, 0, 0.6)', 6345 popupViewType = $.siteBanner[type].render_view_type || $.siteBanner[type].view_type || 'individual', 6346 popupSlideAuto = $.siteBanner[type].slide_auto || 'OFF', 6347 popupSlideSpeed = $.siteBanner[type].slide_speed || '3', 6348 popupSlideMoveTime = $.siteBanner[type].slide_move_time || '1', 6349 popupSlideStopTime = $.siteBanner[type].slide_stop_time || '3', 6350 popupSlideArrow = $.siteBanner[type].slide_arrow || 'OFF', 6351 popupSlideArrowStyle = $.siteBanner[type].slide_arrow_style || '1', 6352 popupSlideArrowSize = $.siteBanner.getPopupSli
6352deControlSizeValue($.siteBanner[type].slide_arrow_size, '64'), 6353 popupSlideArrowColor = $.siteBanner[type].slide_arrow_color || '#ffffff', 6354 popupSlideArrowBgColor = $.siteBanner[type].slide_arrow_bg_color || '#000000', 6355 popupSlidePaginationDisplay = $.siteBanner[type].slide_pagination_display || 'ON', 6356 popupSlidePagination = $.siteBanner[type].slide_pagination || 'number', 6357 popupSlidePaginationStyle = $.siteBanner[type].slide_pagination_style || ((popupSlidePagination == 'dot') ? '1' : '11'), 6358 popupSlidePaginationAlign = $.siteBanner[type].slide_pagination_align || 'right', 6359 popupSlidePaginationSize = $.siteBanner.getPopupSlideControlSizeValue($.siteBanner[type].slide_pagination_size, '52'), 6360 popupSlidePaginationColor = $.siteBanner[type].slide_pagination_color || '#ffffff', 6361 popupSlidePaginationActiveColor = $.siteBanner[type].slide_pagination_active_color || '#000000'; 6362 6363 if($.inArray(popupSlidePaginationAlign, ['left','center','right']) < 0) popupSlidePaginationAlign = 'right'; 6364 if(!$.siteBanner.isPopupSlideArrowStyleValue(popupSlideArrowStyle)) popupSlideArrowStyle = '1'; 6365 if(!$.siteBanner.isPopupSlidePaginationStyleValue(popupSlidePaginationStyle)) popupSlidePaginationStyle = (popupSlidePagination == 'dot') ? '1' : '11'; 6366 popupSlidePagination = $.siteBanner.getPopupSlidePaginationTypeByStyle(popupSlidePaginationStyle); 6367 $('.sc-popupBanner .banner-modal, .cl-popupBanner .banner-modal').each(function() { 6368 $(this).attr('data-btnstyle', popupBtnStyle) 6369 .attr('data-bglayer', popupBgLayer) 6370 .attr('data-viewtype', popupViewType) 6371 .attr('data-slidesizeorigin', popupSlideSizeOrigin) 6372 .attr('data-slideauto', popupSlideAuto) 6373 .attr('data-slidespeed', popupSlideSpeed) 6374 .attr('data-slidemovetime', popupSlideMoveTime) 6375 .attr('data-slidestoptime', popupSlideStopTime) 6376 .attr('data-slidearrow', popupSlideArrow) 6377 .attr('data-slidearrowstyle', popupSlideArrowStyle) 6378 .attr('data-slidearrowsize', popupSlideArrowSize) 6379 .attr('data-slidepaginationdisplay', popupSlidePaginationDisplay) 6380 .attr('data-slidepagination', popupSlidePagination) 6381 .attr('data-slidepaginationstyle', popupSlidePaginationStyle) 6382 .attr('data-slidepaginationalign', popupSlidePaginationAlign) 6383 .attr('data-slidepaginationsize', popupSlidePaginationSize); 6384 this.style.setProperty('--popup-btn-color', popupBtnColor); 6385 this.style.setProperty('--popup-bg-color', popupBgColor); 6386 this.style.setProperty('--popup-slide-arrow-color', popupSlideArrowColor); 6387 this.style.setProperty('--slider-nav-color', popupSlideArrowColor); 6388 this.style.setProperty('--popup-slide-arrow-bg-color', popupSlideArrowBgColor); 6389 this.style.setProperty('--popup-slide-pagination-color', popupSlidePaginationColor); 6390 this.style.setProperty('--slider-page-color', popupSlidePaginationColor); 6391 this.style.setProperty('--popup-slide-pagination-active-color', popupSlidePaginationActiveColor); 6392 this.style.setProperty('--slider-page-align', popupSlidePaginationAlign); 6393 $.siteBanner.applyPopupSlideControlSize(this, popupSlideArrowSize, popupSlidePaginationSize);
6394 $.siteBanner.updatePopupSlideArrowIcons(this, popupSlideArrowStyle, popupSlideArrowColor); 6395 }); 6396 $.siteBanner.setPopupSlide(isSC); 6397 } 6398 if(Number($.siteBanner[type].close_btn) > 0) { 6399 $('.banner-modal').each(function() { 6400 $(this).attr('data-closebtn',$.siteBanner[type].close_btn) 6401 }); 6402 } 6403 } else { 6404 delete $.siteBanner[type].min_h; 6405 delete $.siteBanner[type].total_w; 6406 6407 $.siteBanner[type].total = 0; 6408 $.siteBanner[type].used = false; 6409 $.siteBanner.doNotOffer(type,isSC); 6410 } 6411 6412 deferred02.resolve(); 6413 } else { 6414 if(isSet && !onoff) $.siteBanner.doNotOffer(type,isSC); 6415 deferred02.resolve(); 6416 } 6417 6418 return deferred02.promise(); 6419 }, 6420 position: function(type,isSC,isPosition) { 6421 // console.log(`[siteBanner_step_END (on) /5] $.siteBanner.position(type ${type}, isSC ${isSC}, isPosition ${isPosition})`); 6422 var deferred03 = $.Deferred(), 6423 isClnav = $('header').is('.cl-nav'), 6424 isBand = (type == 'band') ? true : false, 6425 isPopup = (type == 'popup') ? true : false; 6426 6427 if(!isPosition) { 6428 deferred03.resolve(); 6429 } else { 6430 6431 if(isBand) { 6432 $.siteBanner.stopBandRolling(); 6433 6434 var m_h = $.siteBanner[type].min_h[0], 6435 m_h2 = $.siteBanner[type].min_h[1]; 6436 if(m_h > 120) m_h = 120; 6437 if(m_h2 != 50) m_h2 = 50; 6438 6439 if(isSC) { 6440 $('#el-siteConfig .sc-siteBanner').attr('data-min-p',m_h).attr('data-min-m',m_h2); 6441 document.querySelector('#el-siteConfig .sc-siteBanner').style.setProperty('--scbandBanner-height-pc', m_h+'px', null); 6442 document.querySelector('#el-siteConfig .sc-siteBanner').style.setProperty('--scbandBanner-height-mobile', m_h2+'px', null); 6443 6444 var sc_device = $('#el-siteConfig .sc-device-wrap > li.active').attr('data-device'); 6445 if(sc_device == 'm') $('#el-siteConfig .sc-siteBanner .banner-description[data-closetoday="m"]').addClass('active'); 6446 else $('#el-siteConfig .sc-siteBanner .banner-description[data-closetoday="m"]').removeClass('active'); 6447 } else { 6448 document.querySelector('body').style.setProperty('--bandBanner-height-pc', m_h+'px', null); 6449 document.querySelector('body').style.setProperty('--bandBanner-height-mobile', m_h2+'px', null); 6450 6451 $('body, .cl-bandBanner').addClass('openBandBanner'); 6452 $('.element[data-type="gallery"][data-type2="premium"]').refreshRootCss(); 6453 6454 var parentDocument = $(window.parent.document), 6455 $detail_modal = parentDocument.find('.product-detail-modal'); 6456 if($detail_modal.length) $('.cl-bandBanner').addClass('detail'); 6457 6458 if(!isClnav) { 6459 var isHeader = ($('.el-menu header.navbar').hasClass('transparent')) ? true : false, 6460 isSidebar = ($('.el-menu header.navbar').hasClass('sidebar')) ? true : false, 6461 header_h = (isHeader || (isSidebar && $('body').width() > 767)) ? 0 : $('.el-menu header.navbar').outerHeight(), 6462 band_h = ($('body').width() > 767) ? m_h : m_h2; 6463 $('.dsgn-body').css('padding-top', (band_h+header_h)+'px'); 6464 } 6465 6466 if($.siteBanner.band.total > 1) { 6467 var rolling_id = setInterval($.siteBanner.setBandRolling, $.siteBanner.band.interval); 6468 $.siteBanner.band.seqs.push(rolling_id); 6469 $('.cl-bandBanner').attr('data-seq',rolling_id); 6470 } 6471 6472 if(!isClnav) { 6473 $($.siteBanner.band.body).scroll(function(event) { 6474 if($('.cl-bandBanner').hasClass('openBandBanner') && $('.element[data-type="gallery"][data-type2="premium"][data-feature*="fixedscroll"]').length == 0) { 6475 if($(this).scrollTop() < $('.cl-bandBanner').outerHeight()) { 6476 if($('.header.el-menu > header').hasClass('transparent')) $('.dsgn-body').css('padding-top',$.siteBanner.getBandHeight()+'px'); 6477 $('.cl-bandBanner, .el-menu_ctrl, .header.el-menu > header').css('margin-top',-$(this).scrollTop()+'px'); 6478 } else { 6479 if($('.header.el-menu > header').hasClass('transparent')) $('.dsgn-body').css('padding-top',$.siteBanner.getBandHeight()+'px'); 6480 $('.cl-bandBanner, .el-menu_ctrl, .header.el-menu > header').css('margin-top',-$('.cl-bandBanner').outerHeight()+'px'); 6481 } 6482 } 6483 }); 6484 } 6485 } 6486 6487 deferred03.resolve(); 6488 } else if(isPopup) { 6489 var sc_device = (isSC) ? ($('#el-siteConfig .sc-device-wrap > li.active').attr('data-device') || 'p') : '', 6490 p_selector = (isSC) ? '.sc-popupBanner' : '.cl-popupBanner', 6491 $popupPositionContainer = (isSC && sc_device == 'm') ? $(p_selector+' > .banner-modal') : $(p_selector), 6492 body_w = (isSC) ? $popupPositionContainer.width() : $('.dsgn-body').width(), 6493 device_idx = (isSC) ? ((sc_device == 'm') ? 1 : 0) : ((body_w <= 767) ? 1 : 0), 6494 isScMobileStack = (isSC && sc_device == 'm'), 6495 isMobileStack = isScMobileStack || (!isSC && device_idx == 1), 6496 device_offset = (isMobileStack) ? 0 : 30 + (($.siteBanner.popup.total - 1) * 30), 6497 popupViewType = $.siteBanner.popup.render_view_type || $.siteBanner.popup.view_type || 'individual', 6498 p_overflow = (popupViewType == 'slide') ? false : (((body_w - device_offset) < $.siteBanner.popup.total_w[device_idx]) ? true : false), 6499 p_position = $.siteBanner.popup.position || 'center center', 6500 p_arr = p_position.split(' '), 6501 p_justify = (p_arr[0]) ? p_arr[0] : 'center', 6502 p_align = (p_arr[1]) ? p_arr[1] : 'center', 6503 preview_justify = (isMobileStack) ? 'center' : p_justify, 6504 preview_align = (isMobileStack) ? 'center' : p_align, 6505 setPopupOverflowPosition = function() { 6506 var step = (isMobileStack) ? 35 : 30, 6507 mobileStackGutter = (isMobileStack) ? ((isScMobileStack) ? 0 : 30) : 0, 6508 alignGap = (isSC) ? 0 : (step * 2), 6509 topStart = (isSC && sc_device == 'p') || isMobileStack ? 0 : step, 6510 $banner = $popupPositionContainer, 6511 $items = $(p_selector+' .banner-box:not(.hide)'), 6512 bannerOffset = $banner.offset() || {top:0}, 6513 containerWidth = $banner.innerWidth() || body_w, 6514 containerHeight = $banner.innerHe
6514ight(), 6515 visualWidth = 0, 6516 visualHeight = 0, 6517 baseLeft = (isMobileStack) ? mobileStackGutter : ((isSC) ? 0 : step), 6518 baseTop = topStart, 6519 pi_i = $items.length; 6520 6521 if(!containerHeight || containerHeight < 1) { 6522 containerHeight = (!isSC) ? ($(window).height() - bannerOffset.top) : $banner.height(); 6523 } 6524 if(!containerHeight || containerHeight < 1) containerHeight = 0; 6525 6526 $items.each(function(i) { 6527 var $item = $(this), 6528 itemWidth = $item.outerWidth() || parseInt($item.css('width'), 10) || 0, 6529 itemHeight = $item.outerHeight() || parseInt($item.css('height'), 10) || 0; 6530 6531 visualWidth = Math.max(visualWidth, ((isMobileStack) ? 0 : (i * step)) + itemWidth); 6532 visualHeight = Math.max(visualHeight, (i * step) + itemHeight); 6533 }); 6534 6535 if((!isMobileStack || isScMobileStack) && containerWidth > visualWidth + alignGap) { 6536 if(preview_justify == 'center') baseLeft = Math.round((containerWidth - visualWidth) / 2); 6537 else if(preview_justify == 'right') baseLeft = containerWidth - visualWidth - ((isSC) ? 0 : step); 6538 } 6539 if(containerHeight > visualHeight + alignGap) { 6540 if(preview_align == 'center') baseTop = Math.round((containerHeight - visualHeight) / 2); 6541 else if(preview_align == 'bottom') baseTop = containerHeight - visualHeight - ((isSC) ? 0 : step); 6542 } 6543 6544 baseLeft = (isMobileStack) ? mobileStackGutter : ((isSC) ? Math.max(0, baseLeft) : Math.max(step, baseLeft)); 6545 baseTop = Math.max(topStart, baseTop); 6546 6547 $items.each(function(i) { 6548 var $item = $(this), 6549 itemWidth = $item.outerWidth() || parseInt($item.css('width'), 10) || 0,
6550 itemLeft = baseLeft + (i * step); 6551 6552 if(isScMobileStack) { 6553 if(preview_justify == 'center') itemLeft = Math.round((containerWidth - itemWidth) / 2); 6554 else if(preview_justify == 'right') itemLeft = containerWidth - itemWidth - mobileStackGutter; 6555 else itemLeft = mobileStackGutter; 6556 itemLeft = Math.max(mobileStackGutter, itemLeft); 6557 } else if(isMobileStack) { 6558 itemLeft = Math.max(mobileStackGutter, Math.round((containerWidth - itemWidth) / 2)); 6559 } 6560 6561 $item.css({'top':(baseTop + (i * step))+'px', 'left':itemLeft+'px', 'margin-right':((isMobileStack) ? 0 : pi_i * step)+'px'}); 6562 pi_i--; 6563 }); 6564 }; 6565 6566 $(p_selector+' > .banner-modal').attr('data-justify', preview_justify) 6567 .attr('data-align', preview_align) 6568 .attr('data-overflow', p_overflow); 6569 6570 if(p_overflow) { 6571 // ê³ë¨ì 6572 if(isSC) setPopupOverflowPosition(); 6573 } else { 6574 // ëì´ 6575 $(p_selector+' .banner-box:not(.hide)').each(function(i) { 6576 $(this).removeInlineCss('top left margin-right'); 6577 }); 6578 } 6579 if(popupViewType == 'slide') $.siteBanner.setPopupSlide(isSC); 6580 6581 if(!isSC) { 6582 $(window).resize(function() { 6583 if(this.resizeTO) { 6584 clearTimeout(this.resizeTO); 6585 } 6586 this.resizeTO = setTimeout(function() { 6587 $(this).trigger('resizeEnd'); 6588 }, 500); 6589 }); 6590 $(window).on('resizeEnd', function() { 6591 if($('.cl-popupBanner').hasClass('openPopupBanner')) { 6592 var reposition = $.siteBanner.position('popup',isSC,true); 6593 reposition.done(function(rp_r) { 6594 }).fail(function(rp_error) { 6595 }); 6596 } 6597 }); 6598 6599 setTimeout(function() { 6600 if(typeof $.siteBanner.popup != 'undefined' && $.siteBanner.popup.site_config_hidden === true) { 6601 $.siteBanner.stopPopupSlideRolling('.cl-popupBanner'); 6602 $('body, .cl-popupBanner').removeClass('openPopupBanner'); 6603 return; 6604 } 6605 6606 var isPB = (typeof property != 'undefined') ? true : false, 6607 band_h = $.siteBanner.getBandHeight(), 6608 header_h = ($('.el-menu header.navbar').hasClass('transparent')) ? 0 : $('.el-menu header.navbar').outerHeight(), 6609 editor_navbar_t = (typeof PAGE_MODE != 'undefined' && PAGE_MODE == 'c' && (preview_align == 'top' || preview_align == 'center' || preview_align == 'bottom') && $('.editor-navbar').css('display') != 'none') ? Math.max(0, ($('.editor-navbar').outerHeight() || 35) - 30 + ((preview_align == 'top') ? 30 : 0)) : 0, 6610 popup_t = band_h + header_h, 6611 popup_l = 0; 6612 if($('.el-menu header.navbar').hasClass('sidebar')) { 6613 if($('body').width() > 767) { 6614 popup_t = band_h; 6615 if(isPB) popup_l = 260; 6616 if($('.dsgn-body').hasClass('mode-render')) document.querySelector('.cl-popupBanner').style.setProperty('width', 'calc(100% - 260px)', null); 6617 } 6618 } 6619 if(editor_navbar_t > 0) popup_t = Math.max(popup_t, editor_navbar_t); 6620 6621 $('.cl-popupBanner').css({'top':parseInt(popup_t)+'px','left':popup_l+'px'}); 6622 if(!p_overflow) $(p_selector).css('bottom',0); 6623 $('body, .cl-popupBanner').addClass('openPopupBanner'); 6624 if(p_overflow) setPopupOverflowPosition(); 6625 if(popupViewType == 'slide') $.siteBanner.setPopupSli
6625de(isSC); 6626 }, 300); 6627 } 6628 deferred03.resolve(); 6629 } 6630 } 6631 return deferred03.promise(); 6632 }, 6633 6634 getLINK: function(org_link,org_ltarget) { 6635 var link = (typeof org_link == 'string' && org_link != 'javascript:;' && org_link.length > 0) ? org_link : 'javascript:;', 6636 link_target = (typeof org_ltarget != 'undefined' && (org_ltarget == '1' || org_ltarget == 'ON')) ? '_blank' : '', 6637 link_option = {}; 6638 6639 if(link != '' && link != 'javascript:;') { 6640 var _menuList = (PAGE_MODE == 'c') ? MENULIST : property.MENULIST; 6641 6642 if(link.match(/^\@/g) !== null) { // link-type: link-bookmark ==> a[attr-bookmark] 6643 var _settings = (PAGE_MODE == 'c') ? SETTINGS : property.SETTINGS, 6644 bookmark_seq = link.replace(/^\@/g,''); 6645 6646 if(typeof _settings == 'undefined' || typeof _settings.blockBookmarkList == 'undefined' || _settings.blockBookmarkList['bookmark' + bookmark_seq] == 'undefined') { 6647 link = ''; 6648 link_option = {}; 6649 } else { 6650 link_option['attr-bookmark'] = bookmark_seq; 6651 } 6652 } else if(link.match(/^flink\@[0-9]/gi) !== null) { // link-type: link-file ==> a[attr-flink] 6653 link_option['attr-flink'] = link.replace(/^flink\@/gi,''); 6654 link_target = ''; 6655 } else if(_menuList.indexOf(link.replace(/^\//g,"").replace(/ /g,"-")) > -1) { // link-type: link-menu ==> a[data-user-link] 6656 link_option['data-user-link'] = link; 6657 } else { // link-type: link-out ==> a[attr-link] 6658 link_option['attr-link'] = link; 6659 } 6660 6661 link = (PAGE_MODE == 'c') ? makeLinkUrl(link, ONE, VIEW) : makeLinkUrl(link, property.ONE, property.VIEW); 6662 } 6663 6664 return {'link':link, 'target':link_target, 'option':link_option}; 6665 }, 6666 getBandHeight: function() { 6667 if($('body').hasClass('openBandBanner')) { 6668 var bandbanner_p = getComputedStyle(document.querySelector('body')).getPropertyValue('--bandBanner-height-pc'), 6669 bandbanner_m = getComputedStyle(document.querySelector('body')).getPropertyValue('--bandBanner-height-mobile'); 6670 6671 if($('body').width()>767) return parseInt(bandbanner_p); 6672 else return parseInt(bandbanner_m); 6673 } else { 6674 return 0; 6675 } 6676 }, 6677 getPopupMobileIndividualMaxWidth: function(isSC) { 6678 var maxWidth = 0, 6679 $modal = null, 6680 windowWidth = 0, 6681 bodyWidth = 0; 6682 6683 if(isSC) { 6684 $modal = $('#el-siteConfig .sc-popupBanner.m > .banner-modal'); 6685 maxWidth = (($modal.innerWidth() || 294) - 34); 6686 } else { 6687 windowWidth = $(window).width() || 0; 6688 bodyWidth = $('.dsgn-body').width() || 0; 6689 maxWidth = ((windowWidth > 0) ? windowWidth : bodyWidth) - 60; 6690 } 6691 6692 return (maxWidth > 0) ? maxWidth : 0; 6693 }, 6694 bindPopupSlideEvents: function() { 6695 var arrowSelector = '.cl-popupBanner .banner-modal[data-viewtype="slide"] .banner-slide-prev, .cl-popupBanner .banner-modal[data-viewtype="slide"] .banner-slide-next, #el-siteConfig .sc-popupBanner .banner-modal[data-viewtype="slide"] .banner-slide-prev, #el-siteConfig .sc-popupBanner .banner-modal[data-viewtype="slide"] .banner-slide-next', 6696 dotSelector = '.cl-popupBanner .banner-modal[data-viewtype="slide"] .banner-slide-dot, #el-siteConfig .sc-popupBanner .banner-modal[data-viewtype="slide"] .banner-slide-dot', 6697 swipeSelector = '.cl-popupBanner .banner-modal[data-viewtype="slide"] .banner-body'; 6698
6699 $(document).off('click.sitePopupSlide', arrowSelector) 6700 .on('click.sitePopupSlide', arrowSelector, function(e) { 6701 e.preventDefault(); 6702 e.stopPropagation(); 6703 6704 var direction = ($(this).hasClass('banner-slide-prev')) ? -1 : 1, 6705 $modal = $(this).closest('.banner-modal'); 6706 6707 if($.siteBanner.isPopupSlideManualMoving($modal)) return; 6708 $.siteBanner.stopPopupSlideRollingModal($modal); 6709 $.siteBanner.finishPopupSlide($modal); 6710 $.siteBanner.nextPopupSlide($modal, direction, true); 6711 $.siteBanner.startPopupSlideRollingModal($modal); 6712 }); 6713 6714 $(document).off('click.sitePopupSlideDot', dotSelector) 6715 .on('click.sitePopupSlideDot', dotSelector, function(e) { 6716 e.preventDefault(); 6717 e.stopPropagation(); 6718 6719 var $modal = $(this).closest('.banner-modal'), 6720 index = Number($(this).attr('data-index') || 0), 6721 currentIndex = Number($modal.attr('data-slide-index') || 0), 6722 direction = (index > currentIndex) ? 1 : -1; 6723 6724 if(index == currentIndex) return; 6725 if($.siteBanner.isPopupSlideManualMoving($modal)) return; 6726 $.siteBanner.stopPopupSlideRollingModal($modal); 6727 $.siteBanner.finishPopupSlide($modal); 6728 $.siteBanner.showPopupSlide($modal, index, direction, true);
6729 $.siteBanner.startPopupSlideRollingModal($modal); 6730 }); 6731 6732 $(document).off('touchstart.sitePopupSlideSwipe touchmove.sitePopupSlideSwipe touchend.sitePopupSlideSwipe touchcancel.sitePopupSlideSwipe', swipeSelector) 6733 .on('touchstart.sitePopupSlideSwipe', swipeSelector, function(e) { 6734 var event = e.originalEvent, 6735 touch = (event && event.touches && event.touches.length) ? event.touches[0] : null, 6736 $modal = $(this).closest('.banner-modal'); 6737 6738 if(!touch || ($(window).width() || window.innerWidth) > 767) return; 6739 $modal.data('popupSlideTouch', { 6740 x: touch.clientX, 6741 y: touch.clientY 6742 }); 6743 }).on('touchmove.sitePopupSlideSwipe', swipeSelector, function(e) { 6744 var event = e.originalEvent, 6745 touch = (event && event.touches && event.touches.length) ? event.touches[0] : null, 6746 $modal = $(this).closest('.banner-modal'), 6747 touchData = $modal.data('popupSlideTouch'); 6748 6749 if(!touch || !touchData) return; 6750 6751 var moveX = touch.clientX - touchData.x, 6752 moveY = touch.clientY - touchData.y, 6753 absX = Math.abs(moveX), 6754 absY = Math.abs(moveY); 6755 6756 if(absX > 10 && absX > absY) { 6757 e.preventDefault(); 6758 } 6759 }).on('touchend.sitePopupSlideSwipe', swipeSelector, function(e) { 6760 var event = e.originalEvent, 6761 touch = (event && event.changedTouches && event.changedTouches.length) ? event.changedTouches[0] : null, 6762 $modal = $(this).closest('.banner-modal'), 6763 touchData = $modal.data('popupSlideTouch'); 6764 6765 $modal.removeData('popupSlideTouch'); 6766 if(!touch || !touchData) return; 6767 6768 var moveX = touch.clientX - touchData.x, 6769 moveY = touch.clientY - touchData.y, 6770 absX = Math.abs(moveX), 6771 absY = Math.abs(moveY); 6772 6773 if(absX < 40 || absX <= absY || $modal.find('> ul > li.banner-box:not(.hide)').length < 2) return; 6774 6775 e.preventDefault(); 6776 e.stopPropagation(); 6777 if($.siteBanner.isPopupSlideManualMoving($modal)) return; 6778 $.siteBanner.stopPopupSlideRollingModal($modal); 6779 $.siteBanner.finishPopupSlide($modal); 6780 $.siteBanner.nextPopupSlide($modal, (moveX < 0) ? 1 : -1, true);
6781 $.siteBanner.startPopupSlideRollingModal($modal); 6782 }).on('touchcancel.sitePopupSlideSwipe', swipeSelector, function(e) { 6783 $(this).closest('.banner-modal').removeData('popupSlideTouch'); 6784 }); 6785 }, 6786 getPopupCloseButtonHeight: function(type, isSC, device, width) { 6787 type = type || 'popup'; 6788 if(typeof $.siteBanner[type] != 'undefined' && $.siteBanner[type].close_btn == '1') return 0; 6789 if(device != 'mobile') return 44; 6790 if(isSC) return 36; 6791 6792 var minWidth = 360, 6793 maxWidth = 768, 6794 minHeight = 44, 6795 maxHeight = 56, 6796 viewportWidth = Number(width || 0); 6797 6798 if(!viewportWidth || viewportWidth < 1) viewportWidth = minWidth; 6799 if(viewportWidth < minWidth) viewportWidth = minWidth; 6800 if(viewportWidth > maxWidth) viewportWidth = maxWidth; 6801 6802 return Math.round(minHeight + ((viewportWidth - minWidth) * (maxHeight - minHeight) / (maxWidth - minWidth))); 6803 },
6804 getPopupSlideSizeInfo: function(type, origin, width, isSC) { 6805 type = type || 'popup'; 6806 6807 6808 var list = (typeof $.siteBanner[type] != 'undefined' && typeof $.siteBanner[type].list != 'undefined') ? $.siteBanner[type].list : {}, 6809 sort = (typeof $.siteBanner[type] != 'undefined' && typeof $.siteBanner[type].sort != 'undefined') ? $.siteBanner[type].sort : [], 6810 targetWidth = Number(width || 0), 6811 sizeInfo = { 6812 pc: {width: 0, height: 0}, 6813 mobile: {width: 0, height: 0} 6814 }, 6815 baseSize = { 6816 pc: {width: 0, height: 0}, 6817 mobile: {width: 0, height: 0} 6818 }; 6819 6820 if(!targetWidth || targetWidth < 1) targetWidth = 500; 6821 6822 $.each(sort, function(idx, id) { 6823 var o = list[id], 6824 isVisible = (type == 'popup') ? $.siteBanner.isPopupSlidePublishableItem(o) : ((o && o.visible == 'ON') ? true : false), 6825 isCookie = false, 6826 pcImg = null, 6827 mobileImg = null, 6828 pcWidth = 0, 6829 pcHeight = 0, 6830 mobileWidth = 0, 6831 mobileHeight = 0; 6832 6833 if(!o || !o.img) return true; 6834 if(!isVisible) return true; 6835 6836 if(!isSC) { 6837 var cookieName = $.siteBanner.getBannerCookieName(type, id, 'slide'); 6838 isCookie = (typeof $.cookie(cookieName) != 'undefined' && $.cookie(cookieName)) ? true : false; 6839 if(isCookie) return true; 6840 } 6841 6842 pcImg = o.img.pc || {}; 6843 mobileImg = (o.img.mobile && o.img.mobile.chk == '1') ? pcImg : (o.img.mobile || {}); 6844 6845 pcWidth = Number(pcImg.width || 0); 6846 pcHeight = Number(pcImg.height || 0); 6847 mobileWidth = Number(mobileImg.width || pcWidth || 0); 6848 mobileHeight = Number(mobileImg.height || pcHeight || 0); 6849 6850 if(pcWidth > 0 && pcHeight > 0) { 6851 if(baseSize.pc.width < pcWidth || (baseSize.pc.width == pcWidth && baseSize.pc.height < pcHeight)) { 6852 baseSize.pc.width = pcWidth; 6853 baseSize.pc.height = pcHeight; 6854 } 6855 } 6856 if(mobileWidth > 0 && mobileHeight > 0) { 6857 if(baseSize.mobile.width < mobileWidth || (baseSize.mobile.width == mobileWidth && baseSize.mobile.height < mobileHeight)) { 6858 baseSize.mobile.width = mobileWidth; 6859 baseSize.mobile.height = mobileHeight; 6860 } 6861 } 6862 }); 6863 6864 sizeInfo.pc.width = baseSize.pc.width; 6865 sizeInfo.pc.height = baseSize.pc.height; 6866 sizeInfo.mobile.width = baseSize.mobile.width; 6867 sizeInfo.mobile.height = baseSize.mobile.height; 6868 6869 if(sizeInfo.pc.width < 1) sizeInfo.pc.width = targetWidth; 6870 if(sizeInfo.pc.height < 1) sizeInfo.pc.height = targetWidth; 6871 if(sizeInfo.mobile.width < 1) sizeInfo.mobile.width = sizeInfo.pc.width; 6872 if(sizeInfo.mobile.height < 1) sizeInfo.mobile.height = sizeInfo.pc.height; 6873 6874 if(origin == 'OFF') { 6875 var pcHeight = (baseSize.pc.width > 0) ? Math.round(targetWidth * baseSize.pc.height / baseSize.pc.width) : 0, 6876 mobileHeight = (baseSize.mobile.width > 0) ? Math.round(targetWidth * baseSize.mobile.height / baseSize.mobile.width) : 0; 6877 6878 sizeInfo.pc.width = targetWidth; 6879 sizeInfo.mobile.width = targetWidth; 6880 if(pcHeight > 0) sizeInfo.pc.height = pcHeight; 6881 if(mobileHeight > 0) sizeInfo.mobile.height = mobileHeight; 6882 } 6883 6884 if(sizeInfo.pc.height < 1) sizeInfo.pc.height = sizeInfo.mobile.height; 6885 if(sizeInfo.mobile.height < 1) sizeInfo.mobile.height = sizeInfo.pc.height; 6886 6887 var maxPcWidth = 0, 6888 maxPcHeight = 0, 6889 maxMobileWidth = 0, 6890 maxMobileHeight = 0, 6891 previewPcWidth = 0, 6892 previewPcHeight = 0, 6893 previewMobileWidth = 0, 6894 previewMobileHeight = 0, 6895 bodyWidth = 0, 6896 windowWidth = 0, 6897 windowHeight = 0, 6898 pcCloseBtnHeight = 0, 6899 mobileCloseBtnHeight = 0, 6900 renderCloseBtnHeight = 0,
6901 fitPopupSlideSize = function(size, maxWidth, maxHeight) { 6902 var nextWidth = Number(size.width || 0), 6903 nextHeight = Number(size.height || 0), 6904 ratio = 1; 6905 6906 if(nextWidth < 1 || nextHeight < 1) return; 6907 if(maxWidth > 0 && nextWidth > maxWidth) { 6908 ratio = maxWidth / nextWidth; 6909 nextWidth = maxWidth; 6910 nextHeight = Math.round(nextHeight * ratio); 6911 } 6912 if(maxHeight > 0 && nextHeight > maxHeight) { 6913 ratio = maxHeight / nextHeight; 6914 nextHeight = maxHeight; 6915 nextWidth = Math.round(nextWidth * ratio); 6916 } 6917 size.width = nextWidth; 6918 size.height = nextHeight; 6919 }, 6920 fillPopupSlideWidth = function(size, maxWidth) { 6921 var nextWidth = Number(size.width || 0), 6922 nextHeight = Number(size.height || 0), 6923 ratio = 1; 6924 6925 if(maxWidth < 1 || nextWidth < 1 || nextHeight < 1) return; 6926 ratio = maxWidth / nextWidth; 6927 size.width = maxWidth; 6928 size.height = Math.round(nextHeight * ratio); 6929 }; 6930 6931 if(isSC) { 6932 previewPcWidth = $('#el-siteConfig .sc-body').innerWidth(); 6933 if(!previewPcWidth || previewPcWidth < 1) previewPcWidth = $('#el-siteConfig .sc-popupBanner.p').innerWidth(); 6934 if(!previewPcWidth || previewPcWidth < 1) previewPcWidth = $('#el-siteConfig .sc-popupBanner').innerWidth(); 6935 if(previewPcWidth > 0) maxPcWidth = previewPcWidth - 60; 6936 previewPcHeight = $('#el-siteConfig .sc-popupBanner.p').innerHeight(); 6937 if(!previewPcHeight || previewPcHeight < 1) previewPcHeight = $('#el-siteConfig .sc-popupBanner').innerHeight(); 6938 if(!previewPcHeight || previewPcHeight < 1) { 6939 previewPcHeight = $('#el-siteConfig .sc-body').height(); 6940 if(previewPcHeight > 216) previewPcHeight = previewPcHeight - 216; 6941 } 6942 pcCloseBtnHeight = $.siteBanner.getPopupCloseButtonHeight(type, isSC, 'pc', previewPcWidth); 6943 if(previewPcHeight > 0) maxPcHeight = previewPcHeight - 30 - pcCloseBtnHeight; 6944 previewMobileWidth = $('#el-siteConfig .sc-popupBanner.m').innerWidth(); 6945 if(!previewMobileWidth || previewMobileWidth < 1) previewMobileWidth = 480; 6946 maxMobileWidth = previewMobileWidth - 60; 6947 previewMobileHeight = $('#el-siteConfig .sc-popupBanner.m > .banner-modal').innerHeight(); 6948 if(!previewMobileHeight || previewMobileHeight < 1) previewMobileHeight = 526; 6949 mobileCloseBtnHeight = $.siteBanner.getPopupCloseButtonHeight(type, isSC, 'mobile', previewMobileWidth); 6950 if(previewMobileHeight > 0) maxMobileHeight = previewMobileHeight - 30 - mobileCloseBtnHeight; 6951 } else { 6952 bodyWidth = $('.dsgn-body').width(); 6953 windowWidth = $(window).width(); 6954 windowHeight = $(window).height(); 6955 renderCloseBtnHeight = $.siteBanner.getPopupCloseButtonHeight(type, isSC, (windowWidth > 0 && windowWidth <= 768) ? 'mobile' : 'pc', windowWidth || bodyWidth); 6956 if(windowWidth > 0 && windowWidth <= 767) maxMobileWidth = windowWidth - 60; 6957 else if(bodyWidth > 0) maxPcWidth = bodyWidth - 60; 6958 else if(windowWidth > 0) maxPcWidth = windowWidth - 60; 6959 if(windowHeight > 0) { 6960 maxPcHeight = windowHeight - 60 - renderCloseBtnHeight; 6961 maxMobileHeight = windowHeight - 60 - renderCloseBtnHeight; 6962 } 6963 } 6964
6965 fitPopupSlideSize(sizeInfo.pc, maxPcWidth, 0); 6966 fitPopupSlideSize(sizeInfo.mobile, maxMobileWidth, maxMobileHeight); 6967 fillPopupSlideWidth(sizeInfo.mobile, maxMobileWidth); 6968 6969 return sizeInfo; 6970 }, 6971 applyPopupSlideBoxSize: function(target, sizeInfo) { 6972 var $items = $(target), 6973 pcWidth = Number(sizeInfo && sizeInfo.pc ? sizeInfo.pc.width : 0), 6974 pcHeight = Number(sizeInfo && sizeInfo.pc ? sizeInfo.pc.height : 0), 6975 mobileWidth = Number(sizeInfo && sizeInfo.mobile ? sizeInfo.mobile.width : 0), 6976 mobileHeight = Number(sizeInfo && sizeInfo.mobile ? sizeInfo.mobile.height : 0); 6977 6978 if(!$items.length) return; 6979 if(pcWidth < 1) pcWidth = mobileWidth || 500; 6980 if(pcHeight < 1) pcHeight = mobileHeight || pcWidth; 6981 if(mobileWidth < 1) mobileWidth = pcWidth; 6982 if(mobileHeight < 1) mobileHeight = pcHeight; 6983 6984 $items.each(function() { 6985 this.style.setProperty('--popup-slide-box-width-pc', pcWidth + 'px'); 6986 this.style.setProperty('--popup-slide-box-height-pc', pcHeight + 'px'); 6987 this.style.setProperty('--popup-slide-box-width-mobile', mobileWidth + 'px'); 6988 this.style.setProperty('--popup-slide-box-height-mobile', mobileHeight + 'px'); 6989 }); 6990 $items.css({'width': '', 'height': ''}); 6991 $items.find('.banner-content, .banner-body, .banner-body > a, .banner-img').css({'width': '', 'height': ''}); 6992 $items.find('.banner-img > img').css({'width': '', 'height': '', 'max-width': '', 'max-height': ''}); 6993 }, 6994 setPopupRadiusCss: function(target, radius) { 6995 var popupRadius = Number(radius || 0), 6996 popupMobileRadius = popupRadius * 0.75; 6997 6998 $(target).each(function() { 6999 this.style.setProperty('--popup-radius', popupRadius + 'px'); 7000 this.style.setProperty('--popup-radius-mobile', popupMobileRadius + 'px'); 7001 }); 7002 },
7003 getPopupSlideControlSizeValue: function(val, fallback) { 7004 var sizes = [28, 40, 52, 64, 76], 7005 n = parseInt(String(val || fallback || 52).replace(/[^0-9]/g, ''), 10), 7006 closest = parseInt(fallback || 52, 10), 7007 minDiff = 9999; 7008 7009 if(isNaN(n)) n = parseInt(fallback || 52, 10); 7010 $.each(sizes, function(i, size) { 7011 var diff = Math.abs(size - n); 7012 if(diff < minDiff) { 7013 minDiff = diff; 7014 closest = size; 7015 } 7016 }); 7017 7018 return String(closest); 7019 }, 7020 getPopupSlideStyleValues: function(max) { 7021 var values = []; 7022 7023 for(var i = 1; i <= max; i++) values.push(String(i)); 7024 7025 return values; 7026 }, 7027 isPopupSlideArrowStyleValue: function(val) { 7028 return ($.inArray(String(val), $.siteBanner.getPopupSlideStyleValues(27)) > -1); 7029 }, 7030 isPopupSlidePaginationStyleValue: function(val) { 7031 return ($.inArray(String(val), $.siteBanner.getPopupSlideStyleValues(18)) > -1); 7032 },
7033 getPopupSlidePaginationTypeByStyle: function(style) { 7034 style = String(style || '11'); 7035 7036 return ($.inArray(style, ['11','12','13']) > -1) ? 'number' : 'dot'; 7037 }, 7038 setPopupSvgColor: function(svg, color) { 7039 var $svg = $(svg), 7040 fillTargets = 'path, circle, rect, polygon, line, polyline, ellipse, text'; 7041 7042 color = $.siteBanner.getCssColorValue(color, '#222428'); 7043 $svg.attr('data-color', color); 7044 $svg.find(fillTargets).each(function() { 7045 var $el = $(this), 7046 fill = $el.attr('fill'), 7047 stroke = $el.attr('stroke'), 7048 styleAttr = $el.attr('style') || ''; 7049 7050 if(fill != 'none' && styleAttr.indexOf('fill:none') < 0) { 7051 $el.attr('fill', color).css('fill', color); 7052 } 7053 if(stroke && stroke != 'none') { 7054 $el.attr('stroke', color).css('stroke', color); 7055 } 7056 }); 7057 7058 return $svg; 7059 },
7060 getPopupSlideArrowStylePreviewMap: function() { 7061 return { 7062 1: '<svg data-color="#222428" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="48" height="48"><path d="m19.06 12-1.41 1.41L28.23 24 17.65 34.59 19.06 36l12-12-12-12z"/></svg>', 7063 2: '<svg data-color="#d0d0d0" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="48" height="48"><path d="M24 4C12.95 4 4 12.95 4 24s8.95 20 20 20 20-8.95 20-20S35.05 4 24 4Zm-2.86 27-.85-.85L26.44 24l-6.15-6.15.85-.85 7 7-7 7Z"/></svg>', 7064 3: '<svg data-color="#d0d0d0" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="48" height="48"><path d="M4 4v40h40V4H4Zm17.14 27-.85-.85L26.44 24l-6.15-6.15.85-.85 7 7-7 7Z"/></svg>', 7065 4: '<svg data-color="#222428" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="48" height="48"><path d="M41 24 31 14l-1.41 1.41L37.17 23H7v2h30.17l-7.58 7.59L31 34l8.58-8.59h.01L41 24z"/></svg>', 7066 5: '<svg data-color="#222428" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="48" height="48"><path d="M24 4C12.95 4 4 12.95 4 24s8.95 20 20 20 20-8.95 20-20S35.05 4 24 4Zm0 39C13.52 43 5 34.48 5 24S13.52 5 24 5s19 8.52 19 19-8.52 19-19 19Z"/><path d="M20.29 17.85 26.44 24l-6.15 6.15.85.85 7-7-7-7-.85.85z"/></svg>', 7067 6: '<svg data-color="#222428" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="48" height="48"><path d="m21.14 31 7-7-7-7-.85.85L26.44 24l-6.15 6.15.85.85z"/><path d="M4 4v40h40V4H4Zm38.8 38.8H5.2V5.2h37.6v37.6Z"/></svg>', 7068 7: '<svg data-color="#222428" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="48" height="48"><path d="M41 24c0-.05 0-.1-.02-.15 0-.03 0-.06-.01-.09 0-.02-.02-.03-.03-.05a.746.746 0 0 0-.07-.12c-.03-.04-.05-.08-.09-.11a.55.55 0 0 0-.09-.07c-.04-.03-.08-.06-.13-.08 0 0-.02 0-.03-.01-.01 0-.02-.01-.03-.02-7.13-2.38-7.81-8.12-7.83-8.36a.745.745 0 0 0-.82-.67.75.75 0 0 0-.67.82c.02.24.58 5.07 5.69 8.18H7.75c-.41 0-.75.34-.75.75s.34.75.75.75h29.11c-5.11 3.1-5.66 7.94-5.69 8.18-.04.41.26.78.67.82h.07c.38 0 .71-.29.75-.68 0-.06.66-5.97 7.83-8.36 0 0 .01 0 .02-.01h.01c.01 0 .03-.01.04-.02.06-.03.11-.06.16-.09.02-.02.04-.03.05-.05 0 0 0-.01.01-.02.04-.04.08-.09.11-.14.02-.03.03-.06.04-.09 0-.02.02-.04.03-.06 0-.03 0-.06.01-.09.01-.05.02-.1.02-.15Z"/></svg>', 7069 8: '<svg data-color="#222428" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="48" height="48"><path d="M5.04 30.38c.22.64.47 1.29.75 1.91l.91-.42c-.27-.59-.51-1.2-.71-1.81l-.95.32ZM5.09 25.88l-1 .1c.07.68.17 1.36.3 2.03l.98-.2c-.13-.64-.23-1.28-.29-1.92ZM5.15 21.6l-.99-.13c-.08.67-.14 1.36-.15 2.04l1 .02c.01-.65.06-1.3.14-1.94ZM13.69 6.86c-.58.35-1.16.74-1.7 1.15l.6.8c.52-.39 1.06-.76 1.61-1.09l-.52-.86ZM9.72 38c.48.49.99.96 1.51 1.39l.64-.77c-.49-.41-.98-.86-1.43-1.32l-.71.7ZM10.12 9.6c-.49.47-.96.98-1.4 1.5l.76.65c.42-.5.87-.97 1.33-1.42l-.7-.72ZM6.16 17.44l-.94-.34c-.24.64-.44 1.3-.61 1.96l.97.25c.16-.62.35-1.25.58-1.86ZM6.95 34.45c.36.58.75 1.15 1.16 1.69l.79-.61c-.39-.51-.76-1.05-1.1-1.6l-.85.52ZM30.45 5.06c-.65-.22-1.31-.41-1.97-.56l-.22.97c.63.14 1.26.32
70691.87.53l.32-.95ZM42.86 17.32c-.23-.64-.49-1.28-.78-1.89l-.9.43c.28.58.53 1.19.74 1.8l.94-.33ZM42.88 21.82l.99-.11c-.08-.67-.19-1.35-.34-2.02l-.98.21c.14.63.25 1.28.32 1.92ZM22.28 5.08l-.09-1c-.68.06-1.36.16-2.03.29l.19.98c.64-.12 1.28-.22 1.93-.27ZM26.05 4.1C25.38 4.03 24.69 4 24 4v1c.65 0 1.3.03 1.94.1l.1-1ZM8.08 13.62l-.84-.55c-.37.57-.72 1.17-1.03 1.77l.89.46c.3-.57.63-1.14.98-1.68ZM37.41 37.46l.71.71c.48-.48.95-.99 1.38-1.52l-.78-.63c-.41.5-.85.99-1.31 1.44ZM36.53 8.41l-.63.78c.5.4.99.84 1.45 1.3l.7-.71c-.49-.48-1-.94-1.53-1.36ZM39.7 11.6l-.78.62c.4.51.78 1.04 1.13 1.59l.84-.54c-.37-.57-.76-1.14-1.19-1.67ZM13.21 40.84c.57.37 1.17.71 1.78 1.02l.45-.89c-.58-.29-1.15-.62-1.69-.97l-.54.84ZM34.06 40.12l.53.85c.58-.36 1.14-.76 1.68-1.17l-.61-.79c-.51.4-1.05.77-1.6 1.12ZM43 24.15c0 .65-.04 1.3-.11 1.94l.99.11c.07-.67.11-1.36.12-2.05h-1ZM41.94 30.27l.94.33c.23-.64.42-1.31.58-1.97l-.97-.23c-.15.63-.33 1.26-.55 1.87ZM40.08 34.12l.85.53c.36-.58.7-1.18 1-1.79l-.9-.44c-.29.58-.61 1.15-.95 1.7ZM32.72 6l-.44.9c.58.28 1.16.6 1.71.94l.53-.85c-.58-.36-1.18-.69-1.8-.99ZM17.25 42.83c.63.23 1.29.43 1.96.59l.24-.97c-.63-.16-1.26-.35-1.86-.56l-.34.94ZM21.63 43.86c.68.08 1.36.13 2.04.14l.02-1c-.65-.01-1.3-.05-1.94-.13l-.12.99ZM17.78 4.99c-.65.21-1.29.46-1.91.74l.41.91c.59-.26 1.2-.5 1.82-.7l-.31-.95ZM30.2 41.96l.33.95c.64-.22 1.28-.48 1.9-.77l-.42-.91c-.59.27-1.19.52-1.8.73ZM26.03 42.89l.11.99c.68-.07 1.36-.18 2.02-.32l-.21-.98c-.63.13-1.28.24-1.92.3ZM26.26 28.6l4.59-4.6-4.59-4.6-.71.71 3.39 3.39H17.85v1h11.09l-3.39 3.39.71.71z"/></svg>', 7070 9: '<svg data-color="#222428" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="48" height="48"><path d="m19.74 4-.9.43L28.16 24l-9.32 19.57.9.43 9.52-20-9.52-20z"/></svg>', 7071 10: '<svg data-color="#222428" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="48" height="48"><path d="M41.89 24.57v-.02c.07-.17.11-.35.11-.55 0-.19-.04-.38-.11-.55v-.02c-.08-.18-.19-.35-.33-.49l-9.19-9.19c-.59-.59-1.54-.59-2.12 0s-.59 1.54 0 2.12l6.63 6.63H7.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5h29.38l-6.63 6.63a1.49 1.49 0 0 0 0 2.12c.59.59 1.54.59 2.12 0l9.19-9.19c.14-.14.25-.31.33-.49Z"/></svg>', 7072 11: '<svg data-color="#222428" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="48" height="48"><path d="m19.06 12-1.41 1.41L28.23 24 17.65 34.59 19.06 36l12-12-12-12z"/></svg>', 7073 12: '<svg data-color="#222428" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="48" height="48"><path d="M31.55 23.12a2.74 2.74 0 0 0-.65-1.06l-9.9-9.9c-1.04-1.04-2.85-1.04-3.89 0a2.758 2.758 0 0 0 0 3.89l7.96 7.96-7.96 7.96a2.758 2.758 0 0 0 0 3.89 2.732 2.732 0 0 0 3.88 0l9.9-9.9c.74-.74.99-1.83.65-2.83Zm-1.71 1.76-9.9 9.9c-.47.47-1.29.47-1.77 0s-.49-1.28 0-1.77l8.49-8.49c.29-.29.29-.77 0-1.06l-8.49-8.49a1.25 1.25 0 0 1 0-1.77 1.234 1.234 0 0 1 1.76 0l9.9 9.9c.13.13.23.29.29.48.16.46.04.95-.29 1.29Z"/></svg>', 7074 13: '<svg data-color="#222428" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="48" height="48"><path d="m40 24-.01-.01-2.49-2.49L28 12h-7.07l9.5 9.5H8v5h22.43l-9.5 9.5H28l8.46-8.47h.01l1.03-1.03L40 24z"/></svg>', 7075 14: '<svg data-color="#222428" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="48" height="48"><path d="M34.25 24v-.01L22.25 12h-7.07l12 12-12 12h7.07l8.47-8.47L34.25 24z"/></svg>', 7076 15: '<svg data-color="#222428" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="48" height="48"><path d="M39.56 23.99 27.57 12H20.5l12 12-12 12h7.07l8.47-8.47L39.57 24l-.01-.01z"/><path d="m27.5 24-.01-.01L15.5 12H8.43l12 12-12 12h7.07l8.47-8.47L27.5 24z"/></svg>', 7077 16: '<svg data-color="#222428" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="48" height="48"><path d="M35.96 24.19c.08-.19.05-.41-.11-.56-.01-.01-.03-.01-.04-.02L25.24 13.04c-.2-.2-.51-.2-.71 0-.2.2-.2.51 0 .71l9.75 9.75H12.5c-.28 0-.5.22-.5.5s.22.5.5.5h21.79l-9.75 9.75c-.19.19-.19.5 0 .69.19.2.51.2.71.01l10.61-10.61.01-.01c.03-.04.06-.08.08-.12 0 0 .01-.02.02-.03Z"/></svg>', 7078 17: '<svg data-color="#222428" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="48" height="48"><path d="m31.87 19.4-.71.71 7.63 7.63H8v1h33.21l-9.34-9.34z"/></svg>', 7079 18: '<svg data-color="#222428" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="48" height="48"><path d="M30.74 22.69 19.68 12.48c-1.14-1.06-3-.24-3 1.31v20.42c0 1.56 1.85 2.37 3 1.31l11.06-10.21c.77-.71.77-1.92 0-2.63Z"/></svg>', 7080 19: '<svg data-color="#222428" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="48" height="48"><path d="M17.5 12v24l13-12-13-12z"/></svg>', 7081 20: '<svg data-color="#d0d0d0" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="48" height="48"><path d="M24 4C12.95 4 4 12.95 4 24s8.95 20 20 20 20-8.95 20-20S35.05 4 24 4Zm-3.33 28V16l8.67 8-8.67 8Z"/></svg>', 7082 21: '<svg data-color="#d0d0d0" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="48" height="48"><path d="M4 4v40h40V4H4Zm16.67 28V16l8.67 8-8.67 8Z"/></svg>', 7083 22: '<svg data-color="#222428" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="48" height="48"><path d="M41 24 28 12v11H7v2h21v11l13-12z"/></svg>', 7084 23: '<svg data-color="#222428" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="48" height="48"><path d="M24 4C12.95 4 4 12.95 4 24s8.95 20 20 20 20-8.95 20-20S35.05 4 24 4Zm0 39C13.52 43 5 34.48 5 24S13.52 5 24 5s19 8.52 19 19-8.52 19-19 19Z"/><path d="m20.67 32 8.66-8-8.66-8v16z"/></svg>', 7085 24: '<svg data-color="#222428" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="48" height="48"><path d="M3.5 3.5v41h41v-41h-41Zm40 40h-39v-39h39v39Z"/><path d="M20.67 16v16l8.66-8-8.66-8z"/></svg>', 7086 25: '<svg data-color="#222428" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="48" height="48"><path d="M39 22.15 35.58 19 28 12v7H7v10h21v7l7.58-7L39 25.85 41 24l-2-1.85z"/></svg>', 7087 26: '<svg data-color="#222428" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="48" height="48"><path d="M6.95 34.45c.36.58.75 1.15 1.16 1.69l.79-.61c-.39-.51-.76-1.05-1.1-1.6l-.85.52ZM5.04 30.38c.22.64.47 1.29.75 1.91l.91-.42c-.27-.59-.51-1.2-.71-1.81l-.95.32ZM10.12 9.6c-.49.47-.96.98-1.4 1.5l.76.65c.42-.5.87-.97 1.33-1.42l-.7-.72ZM9.72 38c.48.49.99.96 1.51 1.39l.64-.77c-.49-.41-.98-.86-1.43-1.32l-.71.7ZM13.21 40.84c.57.37 1.17.71 1.78 1.02l.45-.89c-.58-.29-1.15-.62-1.69-.97l-.54.84ZM5.09 25.88l-1 .1c.07.68.17 1.36.3 2.03l.98-.2c-.13-.64-.23-1.28-.29-1.92ZM13.69 6.86c-.58.35-1.16.74-1.7 1.15l.6.8c.52-.39 1.06-.76 1.61-1.09l-.52-.86ZM26.05 4.1C25.38 4.03 24.69 4 24 4v1c.65 0 1.3.03 1.94.1l.1-1ZM5.15 21.6l-.99-.13c-.08.67-.14 1.36-.15 2.04l1 .02c.01-.65.06-1.3.14-1.94ZM42.86 17.32c-.23-.64-.49-1.28-.78-1.89l-.9.43c.28.58.53 1.19.74 1.8l.94-.33ZM42.88 21.82l.99-.11c-.08-.67-.19-1.35-.34-2.02l-.98.21c.14.63.25 1.28.32 1.92ZM17.78 4.99c-.65.21-1.29.46-1.91.74l.41.91c.59-.26 1.2-.5 1.82-.7l-.31-.95
7087ZM6.16 17.44l-.94-.34c-.24.64-.44 1.3-.61 1.96l.97.25c.16-.62.35-1.25.58-1.86ZM8.08 13.62l-.84-.55c-.37.57-.72 1.17-1.03 1.77l.89.46c.3-.57.63-1.14.98-1.68ZM40.08 34.12l.85.53c.36-.58.7-1.18 1-1.79l-.9-.44c-.29.58-.61 1.15-.95 1.7ZM17.25 42.83c.63.23 1.29.43 1.96.59l.24-.97c-.63-.16-1.26-.35-1.86-.56l-.34.94ZM34.06 40.12l.53.85c.58-.36 1.14-.76 1.68-1.17l-.61-.79c-.51.4-1.05.77-1.6 1.12ZM37.41 37.46l.71.71c.48-.48.95-.99 1.38-1.52l-.78-.63c-.41.5-.85.99-1.31 1.44ZM32.72 6l-.44.9c.58.28 1.16.6 1.71.94l.53-.85c-.58-.36-1.18-.69-1.8-.99ZM39.7 11.6l-.78.62c.4.51.78 1.04 1.13 1.59l.84-.54c-.37-.57-.76-1.14-1.19-1.67ZM43 24.15c0 .65-.04 1.3-.11 1.94l.99.11c.07-.67.11-1.36.12-2.05h-1ZM41.94 30.27l.94.33c.23-.64.42-1.31.58-1.97l-.97-.23c-.15.63-.33 1.26-.55 1.87ZM36.53 8.41l-.63.78c.5.4.99.84 1.45 1.3l.7-.71c-.49-.48-1-.94-1.53-1.36ZM21.63 43.86c.68.08 1.36.13 2.04.14l.02-1c-.65-.01-1.3-.05-1.94-.13l-.12.99ZM26.03 42.89l.11.99c.68-.07 1.36-.18 2.02-.32l-.21-.98c-.63.13-1.28.24-1.92.3ZM22.19 4.08c-.68.06-1.36.16-2.03.29l.19.98c.64-.12 1.28-.22 1.93-.27l-.09-1ZM30.2 41.96l.33.95c.64-.22 1.28-.48 1.9-.77l-.42-.91c-.59.27-1.19.52-1.8.73ZM28.47 4.5l-.22.97c.63.14 1.26.32
70871.87.53l.32-.95c-.65-.22-1.31-.41-1.97-.56ZM20.67 32l8.66-8-8.66-8v16z"/></svg>', 7088 27: '<svg data-color="#222428" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="48" height="48"><path d="m14.71 12-1.42 1.41L23.88 24 13.29 34.59 14.71 36l12-12-12-12z"/><path d="m22.71 12-1.42 1.41L31.88 24 21.29 34.59 22.71 36l12-12-12-12z"/></svg>' 7089 }; 7090 }, 7091 getPopupSlideArrowStylePreviewSvg: function(style) { 7092 var navObj = $.siteBanner.getPopupSlideArrowStylePreviewMap(); 7093 7094 style = String(style || '1'); 7095 if(typeof navObj[style] == 'undefined') style = '1'; 7096 7097 return navObj[style] || ''; 7098 }, 7099 getPopupSlideArrowStyleSvg: function(style, color, size) { 7100 var svgHtml = '', 7101 svgSize = parseInt(String(size || '52').replace(/[^0-9]/g, ''), 10), 7102 $wrap = null, 7103 $svg = null; 7104 7105 if(isNaN(svgSize) || svgSize < 1) svgSize = 52; 7106 style = String(style || '1'); 7107 if(!$.siteBanner.isPopupSlideArrowStyleValue(style)) style = '1'; 7108 color = color || '#222428'; 7109 7110 if(typeof contentsSliderNav == 'function') { 7111 $wrap = $('<div></div>').append(contentsSliderNav(Number(svgSize), Number(style))); 7112 $svg = $wrap.find('.slider-nav-btn.next svg').eq(0).clone(); 7113 if(!$svg.length) $svg = $wrap.find('svg').eq(0).clone(); 7114 if($svg.length) { 7115 $svg.addClass('banner-slide-arrow-icon').attr({'width':svgSize,'height':svgSize}); 7116 if(!$svg.attr('viewBox')) $svg.attr('viewBox', '0 0 ' + svgSize + ' ' + svgSize); 7117 $.siteBanner.setPopupSvgColor($svg, color); 7118 svgHtml = $('<div></div>').append($svg).html(); 7119 } 7120 } 7121 if(!svgHtml) { 7122 $svg = $('<svg class="banner-slide-arrow-icon" data-color="' + color + '" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 52 52" width="' + svgSize + '" height="' + svgSize + '"><path fill="' + color + '" d="m15.06 2-1.41 1.41L36.23 26 13.65 48.59 15.06 50l24-24-24-24z"/></svg>'); 7123 svgHtml = $('<div></div>').append($svg).html(); 7124 } 7125 7126 return svgHtml; 7127 },
7128 getPopupSlideArrowStyleListHtml: function() { 7129 var html = '', 7130 navObj = $.siteBanner.getPopupSlideArrowStylePreviewMap(); 7131 7132 $.each(navObj, function(n, v) { 7133 html += '<li role="presentation"><a data-value="' + n + '">' + v + '</a></li>'; 7134 }); 7135 7136 return html; 7137 }, 7138 getPopupSlidePaginationStyleMap: function() { 7139 return { 7140 1: '<svg data-color="#000000" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 98 42" width="98" height="42"><circle cx="36" cy="21" r="6"/><circle cx="52" cy="21" r="2.5" style="stroke:#000; fill:none;"/><circle cx="65" cy="21" r="2.5" style="stroke:#000; fill:none;"/></svg>', 7141 5: '<svg data-color="#000000" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 98 42" width="98" height="42"><path d="M11 19h16c1.1 0 2 .9 2 2s-.9 2-2 2H11c-1.1 0-2-.9-2-2s.9-2 2-2Z"/><rect width="20" height="4" x="39" y="19" rx="2" ry="2" style="opacity:.5;"/><rect width="20" height="4" x="69" y="19" class="st0" rx="2" ry="2" style="opacity:.5;"/></svg>', 7142 3: '<svg data-color="#000000" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 98 42" width="98" height="42"><path d="M27.5 15.5h11v11h-11z"/><path d="M48.5 18h6v6h-6z" style="fill:none;"/><path d="M49 18.5h5v5h-5z" style="fill:none; stroke:#000;"/><path d="M64.5 18h6v6h-6z" style="fill:none;"/><path d="M65 18.5h5v5h-5z" style="fill:none; stroke:#000;"/></svg>', 7143 2: '<svg data-color="#000000" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 98 42" width="98" height="42"><circle cx="34" cy="21" r="5.5"/><circle cx="52.5" cy="21" r="3" style="opacity:.2;"/><circle id="Ellipse_185" cx="67.5" cy="21" r="2" style="opacity:.2;"/></svg>', 7144 7: '<svg data-color="#000000" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 98 42" width="98" height="42"><g><path d="M7 20.5h20v1H7z"/><path d="M39 20.5h20v1H39z" style="opacity:0.5;"/><path d="M71 20.5h20v1H71z" style="opacity:0.5;"/><path d="M7 16h20v10H7z" style="fill:none;"/><path d="M39 16h20v10H39z" style="fill:none;"/><path d="M71 16h20v10H71z" style="fill:none;"/></g></svg>', 7145 9: '<svg data-color="#000000" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 98 42" width="98" height="42"><path d="M35.5 9h27v24h-27z" style="fill:none;"/><path d="M62.5 9h27v24h-27z" style="fill:none;"/><g><path d="M17.07 20.15c0-2.45 1.29-3.92 3.07-3.92s3.08 1.46 3.08 3.92-1.3 3.92-3.08 3.92-3.07-1.46-3.07-3.92Zm5.34 0c0-2.06-.92-3.19-2.27-3.19s-2.27 1.13-2.27 3.19.92 3.19 2.27 3.19 2.27-1.13 2.27-3.19ZM26.47 16.3V24h-.79v-7h-1.81v-.7h2.61Z" style="fill:#222428;"/></g><g><path d="M43.07 20.15c0-2.45 1.29-3.92 3.07-3.92s3.08 1.46 3.08 3.92-1.3 3.92-3.08 3.92-3.07-1.46-3.07-3.92Zm5.34 0c0-2.06-.92-3.19-2.27-3.19s-2.27 1.13-2.27 3.19.92 3.19 2.27 3.19 2.27-1.13 2.27-3.19ZM55.59 23.3v.7h-5.4v-.56l3.2-3.13c.87-.86 1.03-1.38 1.03-1.9 0-.89-.63-1.44-1.8-1.44-.9 0-1.59.28-2.1.86l-.56-.48c.59-.7 1.55-1.1 2.73-1.1 1.56 0 2.55.79 2.55 2.08 0 .74-.23 1.4-1.27 2.41l-2.62 2.57h4.24Z" style="fill:#222428; opacity:0.5;"/></g><g><path d="M70.07 20.15c0-2.45 1.29-3.92 3.07-3.92s3.08 1.46 3.08 3.92-1.3 3.92-3.08 3.92-3.07-1.46-3.07-3.92Zm5.34 0c0-2.06-.92-3.19-2.27-3.19s-2.27 1.13-2.27 3.19.92 3.19 2.27 3.19 2.27-1.13 2.27-3.19ZM82.34 21.79c0 1.29-.94 2.28-2.79 2.28-1.11 0-2.18-.39-2.77-.99l.38-.63c.49.52 1.39.89 2.39.89 1.28 0 1.98-.59 1.98-1.55s-.65-1.53-2.08-1.53h-.55v-.58l2.13-2.67h-3.94v-.7h4.95v.56l-2.18 2.74c1.65.09 2.48.96 2.48 2.19Z" style="fill:#222428; opacity:0.5;"/></g><path d="M8.5 9h27v24h-27z" style="fill:none;"/></svg>', 7146 6: '<svg data-color="#000000" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 98 42" width="98" height="42"><path d="M60 25c-2.21 0-4-1.79-4-4s1.79-4 4-4 4 1.79 4 4-1.79 4-4 4Zm0-7c-1.65 0-3 1.35-3 3s1.35 3 3 3 3-1.35 3-3-1.35-3-3-3ZM72 25c-2.21 0-4-1.79-4-4s1.79-4 4-4 4 1.79 4 4-1.79 4-4 4Zm0-7c-1.65 0-3 1.35-3 3s1.35 3 3 3 3-1.35 3-3-1.35-3-3-3ZM26 17h22c2.21 0 4 1.79 4 4s-1.79 4-4 4H26c-2.21 0-4-1.79-4-4s1.79-4 4-4Z"/></svg>', 7147 10: '<svg data-color="#000000" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 98 42" width="98" height="42"><path d="M62.5 9h-53v24h79V9h-26Zm-27 23h-25V10h25v22Zm26 0h-25V10h25v22Zm26 0h-25V10h25v22Z" style="fill:#797979"/><g><path d="M17.99 20.98c0-2.55.89-3.78 2.29-3.78s2.28 1.24 2.28 3.78-.89 3.82-2.28 3.82-2.29-1.27-2.29-3.82Zm3.68 0c0-2.14-.56-3.04-1.39-3.04s-1.4.9-1.4 3.04.56 3.09 1.4 3.09 1.39-.93 1.39-3.09ZM23.93 23.91h1.63v-5.47h-1.3v-.58c.65-.12 1.12-.29 1.52-.52h.7v6.57h1.47v.76h-4.02v-.76Z" style="fill:#222428;"/></g><g><path d="M43.99 20.98c0-2.55.89-3.78 2.29-3.78s2.28 1.24 2.28 3.78-.89 3.82-2.28 3.82-2.29-1.27-2.29-3.82Zm3.68 0c0-2.14-.56-3.04-1.39-3.04s-1.4.9-1.4 3.04.56 3.09 1.4 3.09 1.39-.93 1.39-3.09ZM49.49 24.13c2.3-2.01 3.36-3.47 3.36-4.73 0-.84-.44-1.45-1.35-1.45-.6 0-1.12.37-1.52.85l-.53-.52c.6-.65 1.23-1.08 2.16-1.08 1.31 0 2.13.86 2.13 2.17 0 1.46-1.15 2.95-2.87 4.58.38-.03.83-.07 1.2-.07h2.03v.79h-4.61v-.54Z" style="fill:#222428;"/></g><g><path d="M69.99 20.98c0-2.55.89-3.78 2.29-3.78s2.28 1.24 2.28 3.78-.89 3.82-2.28 3.82-2.29-1.27-2.29-3.82Zm3.68 0c0-2.14-.56-3.04-1.39-3.04s-1.4.9-1.4 3.04.56 3.09 1.4 3.09 1.39-.93 1.39-3.09ZM75.34 23.8l.46-.6c.43.45.99.84 1.82.84.87 0 1.49-.52 1.49-1.36s-.59-1.47-2.28-1.47v-.7c1.51 0 2.03-.61 2.03-1.4 0-.71-.48-1.16-1.24-1.18-.59.02-1.11.32-1.52.73l-.49-.58c.55-.51 1.2-.88 2.05-.88 1.23 0 2.13.66 2.13 1.84 0 .89-.53 1.48-1.31 1.77v.04c.87.2 1.56.86 1.56 1.86 0 1.31-1.05 2.09-2.35 2.09-1.15 0-1.87-.48-2.35-1Z" style="fill:#222428;"/></g><g><path d="M9.5 31h27v2h-27z" style="fill:#fff"/><path d="M9.5 31h27v2h-27z"/></g></svg>', 7148 11: '<svg data-color="#000000" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 98 42" width="98" height="42"><path d="M41 11h16c5.52 0 10 4.48 10 10s-4.48 10-10 10H41c-5.52 0-10-4.48-10-10s4.48-10 10-10Z" style="opacity:.3; isolation:isolate"/><path d="M43.92 17.14V25h-.99v-6.62l-2 .73v-.9l2.84-1.07h.16Z" style="isolation:isolate; fill:#fff;"/><g style="opacity:.5; isolation:isolate"><path d="m51.22 17.18-3.26 8.49h-.85l3.27-8.49h.85ZM53.45 21.28l-.79-.2.39-3.89h4.01v.92h-3.17l-.24 2.13c.14-.08.32-.16.55-.23.22-.07.47-.11.76-.11.36 0 .69.06.97.19.29.12.53.3.73.53.2.23.36.5.46.83s.16.68.16 1.08c0 .38-.05.72-.15 1.04-.1.31-.25.59-.46.82s-.46.42-.77.54c-.31.13-.67.19-1.09.19-.31 0-.61-.04-.89-.13s-.53-.22-.75-.4c-.22-.18-.4-.41-.54-.68a2.51 2.51 0 0 1-.26-.95h.95c.04.29.13.54.26.74.13.2.3.35.51.45.21.1.45.15.73.15.24 0 .45-.04.63-.12.18-.08.34-.2.46-.36.13-.15.22-.34.29-.56.07-.22.1-.46.1-.74 0-.25-.03-.48-.1-.69s-.17-.4-.3-.55c-.13-.16-.3-.28-.49-.37s-.42-.13
7148-.67-.13c-.33 0-.58.04-.75.13-.17.09-.34.21-.52.37Z" style="fill:#fff;"/></g></svg>', 7149 12: '<svg data-color="#000000" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 98 42" width="98" height="42"><rect width="84" height="30" x="7" y="6" rx="15" ry="15" style="opacity:.3"/><path d="M23.92 17.07v7.86h-.99v-6.62l-2 .73v-.9l2.84-1.07h.16Z" style="isolation:isolate; fill:#fff;"/><g style="isolation:isolate;opacity:.5"><path d="m31.22 16.81-3.26 8.49h-.85l3.27-8.49h.85ZM37.31 23.81v.82h-5.12v-.71l2.56-2.85c.31-.35.56-.65.73-.89.17-.25.3-.46.37-.66s.11-.39.11-.6c0-.26-.05-.49-.16-.7s-.26-.38-.46-.5-.45-.19-.74-.19c-.35 0-.64.07-.87.2s-.4.32-.52.56-.17.52-.17.83h-.99c0-.44.1-.84.29-1.21s.48-.66.86-.87c.38-.22.85-.33 1.4-.33.49 0 .92.09 1.27.26s.62.42.81.73.28.68.28 1.1c0 .23-.04.46-.12.7-.08.23-.18.47-.32.7-.13.23-.29.46-.47.69-.18.22-.37.45-.57.67l-2.09 2.27h3.92Z" style="fill:#fff;"/></g><path id="Path_4" d="m53.1 15.59-.49-.49-5.41 5.41-.49.49.49.49 5.42 5.41.49-.49L47.69 21l5.41-5.42Z" style="fill:#fff;"/><path id="Path_5" d="m71.06 26.42.49.49 5.42-5.41.49-.49-.49-.49-5.42-5.42-.49.49 5.42 5.42-5.42 5.42Z" style="fill:#fff;"/><g style="opacity:.3"><path d="M61 16h1v10h-1z" style="fill:#fff;"/><path d="M61 16.5h1v9h-1z" style="fill:#fff;"/></g></svg>', 7150 8: '<svg data-color="#000000" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 98 42" width="98" height="42"><path d="M30 14.5h38a6.5 6.5 0 1 1 0 13H30a6.5 6.5 0 1 1 0-13" style="isolation:isolate;opacity:.17"/><circle cx="36.5" cy="21" r="4" style="fill:#fff"/><circle id="Ellipse_208" cx="49.5" cy="21" r="2" style="opacity:.35;fill:#fff;isolation:isolate;"/><circle cx="61.5" cy="21" r="2" style="opacity:.35;fill:#fff;isolation:isolate;"/></svg>', 7151 17: '<svg data-color="#000000" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 98 42" width="98" height="42"><path d="M50.12 16h-2v4h-4v2h4v4h2v-4h4v-2h-4v-4zM74.12 20h-4v-4h-2v4h-4v2h4v4h2v-4h4v-2zM32.21 16l-3.33 3.33L25.55 16l-1.67 1.67L27.21 21l-3.33 3.33L25.55 26l3.33-3.33L32.21 26l1.67-1.67L30.55 21l3.33-3.33L32.21 16z"/></svg>', 7152 13: '<svg data-color="#000000" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 98 42" width="98" height="42"><path d="M31 11h36v20H31z" style="isolation:isolate;fill:#fff;opacity:.3"/><path d="M43.92 17.14V25h-.99v-6.62l-2 .73v-.9l2.84-1.07h.16Z" style="isolation:isolate"/><g style="opacity:.3;isolation:isolate"><path d="m51.22 17.18-3.26 8.49h-.85l3.27-8.49h.85ZM53.45 21.28l-.79-.2.39-3.89h4.01v.92h-3.17l-.24 2.13c.14-.08.32-.16.55-.23.22-.07.47-.11.76-.11.36 0 .69.06.97.19.29.12.53.3.73.53.2.23.36.5.46.83s.16.68.16 1.08c0 .38-.05.72-.15 1.04-.1.31-.25.59-.46.82s-.46.42-.77.54c-.31.13-.67.19-1.09.19-.31 0-.61-.04-.89-.13s-.53-.22-.75-.4c-.22-.18-.4-.41-.54-.68a2.51 2.51 0 0 1-.26-.95h.95c.04.29.13.54.26.74.13.2.3.35.51.45.21.1.45.15.73.15.24 0 .45-.04.63-.12.18-.08.34-.2.46-.36.13-.15.22-.34.29-.56.07-.22.1-.46.1-.74 0-.25-.03-.48-.1-.69s-.17-.4-.3-.55c-.13-.16-.3-.28-.49-.37s-.42-.13-.67-.13c-.33 0-.58.04-.75.13-.17.09-.34.21-.52.37Z"/></g></svg>', 7153 14: '<svg data-color="#000000" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 98 42" width="98" height="42"><path d="M24 11c5.52 0 10 4.48 10 10s-4.48 10-10 10-10-4.48-10-10 4.48-10 10-10Z" style="fill:#444"/><path id="Path_521" d="M49 11c5.52 0 10 4.48 10 10s-4.48 10-10 10-10-4.48-10-10 4.48-10 10-10Z" style="opacity:.15; fill:#444;"/><path d="M74 11c5.52 0 10 4.48 10 10s-4.48 10-10 10-10-4.48-10-10 4.48-10 10-10Z" style="opacity:.15; fill:#444;"/><path d="M24.92 17.14V25h-.99v-6.62l-2 .73v-.9l2.84-1.07h.16Z" style="fill:#fff;"/><g><path d="M51.77 24.18V25h-5.12v-.71l2.56-2.85c.32-.35.56-.65.73-.89.17-.25.3-.46.37-.66s.1-.39.1-.6c0-.26-.05-.49-.16-.7-.11-.21-.26-.38-.46-.5s-.45-.19-.74-.19c-.35 0-.64.07-.87.2-.23.13-.4.32-.52.56-.11.24-.17.52-.17.83h-.99c0-.44.1-.84.29-1.21s.48-.66.86-.87.85-.33 1.4-.33c.49 0 .92.09 1.27.26s.62.42.81.73c.19.31.28.68.28 1.1 0 .23-.04.46-.12.7-.08.23-.18.47-.32.7-.13.23-.29.46-.47.69-.18.22-.37.45-.57.67l-2.09 2.27h3.92Z" style="fill:#777;"/></g><g><path d="M73.1 21.42v-.6h.85c.5 0 .91.06 1.23.18.33.12.58.28.77.47.19.2.32.41.4.65s.12.47.12.7c0 .37-.06.69-.19.97-.12.28-.3.52-.52.72-.22.2-.49.34-.79.45s-.63.15-.98.15-.66-.05-.96-.14c-.3-.1-.56-.24-.79-.42-.23-.18-.41-.41-.54-.68s-.19-.58-.19-.93h.99c0 .27.06.51.18.71.12.2.29.36.52.48.22.11.49.17.79.17s.57-.05.79-.16c.22-.11.39-.27.51-.48.12-.21.18-.49.18-.81s-.07-.59-.2-.8a1.23 1.23 0 0 0-.58-.47c-.25-.1-.54-.15-.88-.15h-.71Zm0-.82h.71c.35 0 .63-.06.86-.17s.4-.28.51-.48c.11-.2.17-.43.17-.68 0-.3-.05-.55-.15-.76-.1-.2-.25-.36-.45-.46-.2-.1-.45-.16-.76-.16-.28 0-.53.05-.74.16s-.38.26-.5.46-.18.44-.18.71h-.99c0-.4.1-.76.3-1.09.2-.33.48-.58.85-.78.36-.19.78-.29 1.26-.29s.89.08 1.24.25c.36.17.63.41.83.74.2.33.29.73.29 1.22 0 .2-.05.41-.14.63-.09.22-.23.43-.42.63-.19.19-.44.35-.74.48-.3.12-.67.19-1.1.19h-.85v-.6Z" style="fill:#777;"/></g></svg>', 7154 15: '<svg data-color="#000000" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 98 42" width="98" height="42"><path d="M38.38 21a2.5 2.5 0 0 1-2.5 2.5h-10a2.5 2.5 0 0 1 0-5h10a2.5 2.5 0 0 1 2.5 2.5"/><path d="M55.76 15.7c.98.98.98 2.56 0 3.54l-7.07 7.07c-.98.98-2.56.98-3.54 0s-.98-2.56 0-3.54l7.07-7.07c.98-.98 2.56-.98 3.54 0" style="isolation:isolate;opacity:.16;"/><path d="M73.89 15.7c.98.98.98 2.56 0 3.54l-7.07 7.07c-.98.98-2.56.98-3.54 0s-.98-2.56 0-3.54l7.07-7.07c.98-.98 2.56-.98 3.54 0" style="isolation:isolate;opacity:.16;"/></svg>', 7155 16: '<svg data-color="#000000" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 98 42" width="98" height="42"><path d="M39.97 21c0 .55-.45 1-1 1h-14c-.55 0-1-.45-1-1s.45-1 1-1h14c.55 0 1 .45 1 1"/><path d="M57.03 15.34c.39.39.39 1.02 0 1.41l-9.9 9.9a.996.996 0 1 1-1.41-1.41l9.9-9.9a.996.996 0 0 1 1.41 0" style="isolation:isolate;opacity:.2;"/><path d="M73.73 15.34c.39.39.39 1.02 0 1.41l-9.9 9.9a.996.996 0 1 1-1.41-1.41l9.9-9.9a.996.996 0 0 1 1.41 0" style="isolation:isolate;opacity:.2;"/></svg>', 7156 4: '<svg data-color="#000000" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 98 42" width="98" height="42"><path d="M30 16h10v10H30z"/><path d="M48 18h6v6h-6z" style="opacity:.2;"/><path id="Rectangle_1823" d="M62 18h6v6h-6z" style="opacity:.2;"/></svg>', 7157 18: '<svg data-color="#000000" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 98 42" width="98" height="42"><path id="Rectangle_1720" d="M33.5 20.5h31v1h-31z" style="opacity:.25;" />
7157<path id="Rectangle_1719" d="M64.5 20.5h31v1h-31z" style="opacity:.25;"/><path id="Rectangle_1718" d="M2.5 20.5h31v1h-31z" /></svg>' 7158 }; 7159 }, 7160 getPopupSlidePaginationStyleOrder: function() { 7161 return $.siteBanner.getPopupSlideStyleValues(18); 7162 }, 7163 getPopupSlidePaginationStylePreviewSvg: function(style) { 7164 var pageObj = $.siteBanner.getPopupSlidePaginationStyleMap(); 7165 7166 style = String(style || '11'); 7167 if(typeof pageObj[style] == 'undefined') style = '11'; 7168 7169 return pageObj[style] || ''; 7170 }, 7171 getPopupSlidePaginationStyleSvg: function(style, color) { 7172 var pageObj = $.siteBanner.getPopupSlidePaginationStyleMap(), 7173 $svg = null; 7174 7175 style = String(style || '11'); 7176 if(!$.siteBanner.isPopupSlidePaginationStyleValue(style)) style = '11'; 7177 color = color || '#222428'; 7178 $svg = $(pageObj[style] || pageObj['11']).clone(); 7179 $svg.attr('data-color', color); 7180 7181 return $('<div></div>').append($svg).html(); 7182 },
7183 getPopupSlidePaginationStyleListHtml: function() { 7184 var html = '', 7185 pageObj = $.siteBanner.getPopupSlidePaginationStyleMap(); 7186 7187 $.each($.siteBanner.getPopupSlidePaginationStyleOrder(), function(i, n) { 7188 html += '<li role="presentation"><a data-value="' + n + '">' + (pageObj[n] || '') + '</a></li>'; 7189 }); 7190 7191 return html; 7192 }, 7193 isPopupSlideMobilePreviewModal: function(modal) { 7194 var $modal = $(modal); 7195 7196 return ($modal.closest('#el-siteConfig .sc-popupBanner.m').length > 0 || ($modal.closest('#el-siteConfig .sc-popupBanner').length > 0 && $('#el-siteConfig[data-fn="banner"] .sc-device-wrap > li[data-device="m"]').hasClass('active'))); 7197 }, 7198 isPopupSlideMobileRenderModal: function(modal) { 7199 var $modal = $(modal); 7200 7201 return ($.siteBanner.isPopupSlideMobilePreviewModal($modal) || ($modal.closest('.cl-popupBanner').length > 0 && $.siteBanner.getPopupSli
7201deMobileArrowSize() > 0)); 7202 }, 7203 getPopupSlideMobileArrowSize: function(width) { 7204 var w = Number(width || $(window).width() || $('body').width() || 0); 7205 7206 if(w > 768 || w < 1) return 0; 7207 if(w >= 721) return 52; 7208 if(w >= 621) return 51; 7209 if(w >= 521) return 50; 7210 if(w >= 421) return 49; 7211 return 48; 7212 }, 7213 getPopupSlideArrowIconRenderSize: function(modal, fallback) { 7214 var $modal = $(modal), 7215 size = Number($.siteBanner.getPopupSlideControlSizeValue(fallback, '64')), 7216 mobileSize = 0; 7217 7218 if($.siteBanner.isPopupSlideMobilePreviewModal($modal)) return 36; 7219 if($modal.closest('.cl-popupBanner').length) { 7220 mobileSize = $.siteBanner.getPopupSlideMobileArrowSize(); 7221 if(mobileSize > 0) return mobileSize; 7222 } 7223 7224 return size; 7225 }, 7226 getPopupSlidePaginationRenderSize: function(modal, fallback, style) { 7227 var $modal = $(modal), 7228 styleString = String(style || $modal.attr('data-slidepaginationstyle') || (($modal.attr('data-slidepagination') == 'dot') ? '1' : '11')), 7229 compactMobileStyles = ['9','10','11','12','13','14'], 7230 isCompactMobileStyle = ($.inArray(styleString, compactMobileStyles) > -1); 7231 7232 if($.siteBanner.isPopupSlideMobilePreviewModal($modal)) return (isCompactMobileStyle) ? '28' : '40'; 7233 if($.siteBanner.isPopupSlideMobileRenderModal($modal)) return (isCompactMobileStyle) ? '40' : '52'; 7234 7235 return $.siteBanner.getPopupSlideControlSizeValue(fallback, '52'); 7236 }, 7237 updatePopupSlideArrowIcons: function(modal, style, color) { 7238 var $modal = $(modal), 7239 arrowSize = $.siteBanner.getPopupSlideControlSizeValue($modal.attr('data-slidearrowsize') || $.siteBanner.getPopupSlideCssValue($modal, '--popup-slide-arrow-icon-size', '64'), '64'), 7240 arrowIconSize = $.siteBanner.getPopupSlideArrowIconRenderSize($modal, arrowSize), 7241 prevSvgHtml = $.siteBanner.getPopupSlideArrowStyleSvg(style, color, arrowIconSize), 7242 nextSvgHtml = $.siteBanner.getPopupSlideArrowStyleSvg(style, color, arrowIconSize); 7243 7244 $modal.find('.banner-slide-arrow > .banner-slide-prev').html(prevSvgHtml) 7245 .find('.banner-slide-arrow-icon').attr({'width':arrowIconSize,'height':arrowIconSize}).css({ 7246 'width': arrowIconSize + 'px', 7247 'height': arrowIconSize + 'px', 7248 'transform': '', 7249 'transform-origin': '' 7250 }); 7251 $modal.find('.banner-slide-arrow > .banner-slide-next').html(nextSvgHtml) 7252 .find('.banner-slide-arrow-icon').attr({'width':arrowIconSize,'height':arrowIconSize}).css({ 7253 'width': arrowIconSize + 'px', 7254 'height': arrowIconSize + 'px', 7255 'transform': '', 7256 'transform-origin': '' 7257 }); 7258 }, 7259 applyPopupSlideControlSize: function(modal, arrowSize, paginationSize) { 7260 var $modal = $(modal), 7261 modalEl = $modal.get(0), 7262 aSize = Number($.siteBanner.getPopupSlideControlSizeValue(arrowSize, '64')), 7263 arrowIconSize = $.siteBanner.getPopupSlideArrowIconRenderSize($modal, aSize), 7264 mobileArrowBoxSize = ($.siteBanner.isPopupSlideMobilePreviewModal($modal)) ? 36 : (($modal.closest('.cl-popupBanner').length) ? $.siteBanner.getPopupSlideMobileArrowSize() : 0), 7265 pSize = Number($.siteBanner.getPopupSlideControlSizeValue(paginationSize, '52')), 7266 paginationStyleValue = $modal.attr('data-slidepaginationstyle') || (($modal.attr('data-slidepagination') == 'dot') ? '1' : '11'), 7267 pRenderSize = Number($.siteBanner.getPopupSli
7267dePaginationRenderSize($modal, pSize, paginationStyleValue)), 7268 isMobilePaginationRender = $.siteBanner.isPopupSlideMobileRenderModal($modal), 7269 arrowBoxSize = 76, 7270 pRatio = pSize / 52, 7271 pRenderRatio = pRenderSize / 52, 7272 paginationSizeMap = { 7273 '28': { width: 32, height: 18, fontSize: 12 }, 7274 '40': { width: 38, height: 23, fontSize: 14 }, 7275 '52': { width: 50, height: 28, fontSize: 15 }, 7276 '64': { width: 52, height: 30, fontSize: 16 }, 7277 '76': { width: 56, height: 32, fontSize: 18 } 7278 }, 7279 paginationStyle = paginationSizeMap[String(pSize)] || paginationSizeMap['52'], 7280 paginationMobileStyle = paginationSizeMap[String(pRenderSize)] || paginationSizeMap['52'], 7281 paginationWidth = paginationStyle.width, 7282 paginationHeight = paginationStyle.height, 7283 paginationPaddingY = 0, 7284 paginationPaddingX = 0, 7285 paginationFontSize = paginationStyle.fontSize, 7286 paginationDotSize = Math.max(Math.round(7 * pRatio), 4), 7287 paginationGap = Math.max(Math.round(6 * pRatio), 4); 7288 7289 if(!modalEl) return; 7290 $(modal).attr({'data-slidearrowsize':String(aSize), 'data-slidepaginationsize':String(pSize)}); 7291 modalEl.style.setProperty('--popup-slide-arrow-size', arrowBoxSize + 'px'); 7292 modalEl.style.setProperty('--popup-slide-arrow-margin-top', '-' + Math.round(arrowBoxSize / 2) + 'px'); 7293 modalEl.style.setProperty('--popup-slide-arrow-icon-size', aSize + 'px'); 7294 modalEl.style.setProperty('--popup-slide-arrow-tablet-size', arrowBoxSize + 'px'); 7295 modalEl.style.setProperty('--popup-slide-arrow-tablet-margin-top', '-' + Math.round(arrowBoxSize / 2) + 'px'); 7296 modalEl.style.setProperty('--popup-slide-arrow-tablet-icon-size', aSize + 'px'); 7297 if(mobileArrowBoxSize > 0) { 7298 modalEl.style.setProperty('--popup-slide-arrow-mobile-size', mobileArrowBoxSize + 'px'); 7299 modalEl.style.setProperty('--popup-slide-arrow-mobile-margin-top', '-' + (mobileArrowBoxSize / 2) + 'px'); 7300 modalEl.style.setProperty('--popup-slide-arrow-mobile-icon-size', mobileArrowBoxSize + 'px'); 7301 } else { 7302 modalEl.style.removeProperty('--popup-slide-arrow-mobile-size'); 7303 modalEl.style.removeProperty('--popup-slide-arrow-mobile-margin-top'); 7304 modalEl.style.removeProperty('--popup-slide-arrow-mobile-icon-size'); 7305 } 7306 $modal.find('.banner-slide-arrow-icon').attr({'width':String(arrowIconSize),'height':String(arrowIconSize)}).css({'width':arrowIconSize + 'px','height':arrowIconSize + 'px'}); 7307 modalEl.style.setProperty('--popup-slide-pagination-width', paginationWidth + 'px'); 7308 modalEl.style.setProperty('--popup-slide-pagination-height', paginationHeight + 'px'); 7309 modalEl.style.setProperty('--popup-slide-pagination-padding', paginationPaddingY + 'px ' + paginationPaddingX + 'px'); 7310 modalEl.style.setProperty('--popup-slide-pagination-font-size', paginationFontSize + 'px'); 7311 modalEl.style.setProperty('--popup-slide-pagination-dot-size', paginationDotSize + 'px'); 7312 modalEl.style.setProperty('--popup-slide-pagination-gap', paginationGap + 'px'); 7313 modalEl.style.setProperty('--slider-page-size', pRenderSize + 'px'); 7314 modalEl.style.setProperty('--slider-nav-size', arrowIconSize + 'px'); 7315 if(isMobilePaginationRender) { 7316 modalEl.style.setProperty('--popup-slide-pagination-mobile-width', paginationMobileStyle.width + 'px'); 7317 modalEl.style.setProperty('--popup-slide-pagination-mobile-height', paginationMobileStyle.height + 'px'); 7318 modalEl.style.setProperty('--popup-slide-pagination-mobile-padding', '0'); 7319 modalEl.style.setProperty('--popup-slide-pagination-mobile-font-size', paginationMobileStyle.fontSize + 'px'); 7320 modalEl.style.setProperty('--popup-slide-pagination-mobile-dot-size', Math.max(Math.round(7 * pRenderRatio), 4) + 'px'); 7321 modalEl.style.setProperty('--popup-slide-pagination-mobile-gap', Math.max(Math.round(6 * pRenderRatio), 4) + 'px'); 7322 } else { 7323 modalEl.style.removeProperty('--popup-slide-pagination-mobile-width'); 7324 modalEl.style.removeProperty('--popup-slide-pagination-mobile-height'); 7325 modalEl.style.removeProperty('--popup-slide-pagination-mobile-padding'); 7326 modalEl.style.removeProperty('--popup-slide-pagination-mobile-font-size'); 7327 modalEl.style.removeProperty('--popup-slide-pagination-mobile-dot-size'); 7328 modalEl.style.removeProperty('--popup-slide-pagination-mobile-gap'); 7329 } 7330 },
7331 setPopupSlide: function(isSC) { 7332 var selector = (isSC) ? '#el-siteConfig .sc-popupBanner' : '.cl-popupBanner', 7333 $banner = $(selector); 7334 7335 $.siteBanner.bindPopupSlideEvents(); 7336 $.siteBanner.stopPopupSlideRolling(selector); 7337 7338 $banner.find('> .banner-modal').each(function() { 7339 var $modal = $(this), 7340 isSlide = ($modal.attr('data-viewtype') == 'slide'), 7341 isAuto = (($modal.attr('data-slideauto') || ((typeof $.siteBanner.popup != 'undefined') ? $.siteBanner.popup.slide_auto : 'OFF')) != 'OFF'), 7342 isScPopupPanelOpen = (isSC && $('#el-siteConfig[data-fn="banner"] #popup-banner-accordion .panel-banner-item.open').length > 0) ? true : false, 7343 $items = $modal.find('> ul > li.banner-box:not(.hide)'), 7344 total = $items.length; 7345 7346 if(!isSlide) { 7347 $modal.find('> ul > li.banner-box').removeClass('active').css('display', ''); 7348 $modal.find('.banner-slide-pagination').empty(); 7349 return; 7350 } 7351 if(total < 1) { 7352 $modal.find('.banner-slide-arrow').addClass('hide'); 7353 $modal.find('.banner-slide-pagination').addClass('hide').empty(); 7354 return; 7355 } 7356 7357 $.siteBanner.applyPopupSlideControlSize($modal, $modal.attr('data-slidearrowsize'), $modal.attr('data-slidepaginationsize')); 7358 $.siteBanner.updatePopupSlideArrowIcons($modal, $modal.attr('data-slidearrowstyle') || '1', $.siteBanner.getPopupSlideCssValue($modal, '--popup-slide-arrow-color', '#ffffff')); 7359 if($modal.attr('data-slide-moving')) $.siteBanner.finishPopupSlide($modal); 7360 $.siteBanner.showPopupSlide($modal, Number($modal.attr('data-slide-index') || 0), 0); 7361 7362 if(total >
7362 1 && isAuto && !isScPopupPanelOpen) $.siteBanner.startPopupSlideRollingModal($modal); 7363 }); 7364 }, 7365 getPopupSlideCssValue: function(modal, key, fallback) { 7366 var $modal = $(modal), 7367 modalEl = $modal.get(0), 7368 val = ''; 7369 7370 if(modalEl && window.getComputedStyle) val = window.getComputedStyle(modalEl).getPropertyValue(key); 7371 if(!val) val = $modal.css(key); 7372 val = $.trim(val || ''); 7373 7374 return val || fallback; 7375 }, 7376 applyPopupSlideControlColors: function(modal) { 7377 var $modal = $(modal), 7378 arrowColor = $.siteBanner.getPopupSlideCssValue($modal, '--popup-slide-arrow-color', '#ffffff'), 7379 paginationColor = $.siteBanner.getPopupSlideCssValue($modal, '--popup-slide-pagination-color', '#ffffff'), 7380 paginationActiveColor = $.siteBanner.getPopupSlideCssValue($modal, '--popup-slide-pagination-active-color', '#000000'); 7381 7382 $modal.find('.banner-slide-arrow > button').css('background-color', ''); 7383 $modal.find('.banner-slide-arrow-icon').each(function() { 7384 $.siteBanner.setPopupSvgColor(this, arrowColor); 7385 }); 7386 7387 $modal.find('.banner-slide-pagination').css({'color': '', 'background-color': ''}); 7388 $modal.find('.banner-slide-pagination .active').css('color', ''); 7389 $modal.find('.banner-slide-dot').css('background-color', ''); 7390 $modal.find('.banner-slide-dot.active').css('background-color', ''); 7391 }, 7392 placePopupSlideControls: function(modal, item) { 7393 var $modal = $(modal), 7394 $item = $(item), 7395 $body = $item.find('.banner-body').eq(0), 7396 $content = $item.find('> .banner-content').eq(0), 7397 $imageArea = $body.find('.banner-img').eq(0), 7398 $arrow = $modal.find('.banner-slide-arrow').eq(0), 7399 $pagination = $modal.find('.banner-slide-pagination').eq(0), 7400 imageHeight = ($imageArea.length) ? $imageArea.outerHeight() : 0, 7401 imageTop = ($imageArea.length) ? $imageArea.position().top : 0, 7402 bodyHeight = ($body.length) ? $body.outerHeight() : 0, 7403 contentHeight = ($content.length) ? $content.outerHeight() : 0, 7404 arrowTop = (imageHeight > 0) ? (imageTop + (imageHeight / 2)) : ((bodyHeight || contentHeight) / 2); 7405 7406 if(!$body.length) return; 7407 if(arrowTop > 0) $body.get(0).style.setProperty('--popup-slide-arrow-top', arrowTop + 'px'); 7408 if($arrow.length) $body.append($arrow); 7409 if($pagination.length) $body.append($pagination); 7410 },
7411 getPopupSlideSpeedValue: function(modal) { 7412 var $modal = $(modal), 7413 speed = $modal.attr('data-slidespeed') || ((typeof $.siteBanner.popup != 'undefined') ? $.siteBanner.popup.slide_speed : '3'); 7414 7415 speed = String(speed || '3'); 7416 if($.inArray(speed, ['1','2','3','4','5']) < 0) speed = '3'; 7417 7418 return speed; 7419 }, 7420 getPopupSlideDelay: function(modal) { 7421 var stopTime = $.siteBanner.getPopupSlideTimeValue(modal, 'data-slidestoptime', 'slide_stop_time', ''), 7422 fallbackStopTime = '3'; 7423 7424 if(!stopTime) { 7425 var speed = $.siteBanner.getPopupSlideSpeedValue(modal), 7426 delayMap = { 7427 '1': 7000, 7428 '2': 5000, 7429 '3': 3000, 7430 '4': 2000, 7431 '5': 1200 7432 }; 7433 fallbackStopTime = String(Math.max(Math.round((delayMap[speed] || delayMap['3']) / 1000), 1)); 7434 stopTime = $.siteBanner.getPopupSlideTimeValue(modal, 'data-slidestoptime', 'slide_stop_time', fallbackStopTime); 7435 } 7436 7437 return $.siteBanner.getPopupSlideDuration(modal) + (Number(stopTime) * 1000); 7438 }, 7439 updatePopupSlidePaginationState: function(pagination, style, index, total) { 7440 var $pagination = $(pagination), 7441 styleString = String(style || '11'), 7442 bulletStyles = ['1','2','3','4','5','6','7','8','9','10','14','15','16','17','18'], 7443 pageNumberStyles = ['9','10','14'],
7444 dynamicBulletStyles = ['2','4'], 7445 isDynamicBulletStyle = ($.inArray(styleString, dynamicBulletStyles) > -1), 7446 $widthWrap = $pagination.find('> .swiper-pagination-width').eq(0), 7447 $dots = (styleString == '18') ? $pagination.find('> span.banner-slide-dot') : $widthWrap.find('> span.banner-slide-dot'), 7448 $indicator = $pagination.find('> .nav-indicator').eq(0), 7449 dynamicMainBullets = 1, 7450 dynamicWindowLength = dynamicMainBullets + 4, 7451 dynamicBulletsLength = Math.min(total, dynamicWindowLength), 7452 firstIndex = index, 7453 lastIndex = index, 7454 midIndex = index, 7455 bulletSize = 0, 7456 bulletsOffset = 0, 7457 indicatorWidth = 100, 7458 animateState = ($pagination.attr('data-popup-slide-pagination-ready') == '1'), 7459 stateToken = Number($pagination.data('popupSlidePaginationFrame') || 0) + 1, 7460 updates = [], 7461 applyState, 7462 i = 0, 7463 dotClass = '', 7464 num = ''; 7465 7466 if(!$pagination.length || $.inArray(styleString, bulletStyles) < 0 || $dots.length != total) return false; 7467 if(styleString == '18' && !$indicator.length) return false; 7468 7469 if(isDynamicBulletStyle && total > 0) { 7470 bulletSize = $dots.eq(0).outerWidth(true) || parseInt($dots.eq(0).css('width'), 10) || 0; 7471 if(bulletSize > 0 && $widthWrap.length) { 7472 bulletsOffset = (((bulletSize * dynamicBulletsLength) - bulletSize) / 2) - (midIndex * bulletSize); 7473 $pagination.css('width', (bulletSize * dynamicWindowLength) + 'px'); 7474 $widthWrap.css('width', (bulletSize * dynamicWindowLength) + 'px'); 7475 } 7476 } else { 7477 $pagination.css('width', ''); 7478 if($widthWrap.length) $widthWrap.css('width', ''); 7479 $dots.css('left', ''); 7480 } 7481 7482 for(i = 0; i < total; i++) { 7483 dotClass = 'banner-slide-dot swiper-pagination-bullet'; 7484 if(i == index) dotClass += ' swiper-pagination-bullet-active active'; 7485 if(isDynamicBulletStyle) { 7486 if(i >= firstIndex && i <= lastIndex) dotClass += ' swiper-pagination-bullet-active-main'; 7487 if(i == firstIndex - 1) dotClass += ' swiper-pagination-bullet-active-prev'; 7488 if(i == firstIndex - 2) dotClass += ' swiper-pagination-bullet-active-prev-prev'; 7489 if(i == lastIndex + 1) dotClass += ' swiper-pagination-bullet-active-next'; 7490 if(i == lastIndex + 2) dotClass += ' swiper-pagination-bullet-active-next-next'; 7491 } 7492 num = (i + 1); 7493 if($.inArray(styleString, pageNumberStyles) > -1 && num < 10 && styleString != '14') num = '0' + num; 7494 $dots.eq(i).attr('data-index', i).text(($.inArray(styleString, pageNumberStyles) > -1) ? num : ''); 7495 updates.push({el:$dots.get(i), className:dotClass}); 7496 } 7497 7498 $pagination.attr('data-popup-slide-pagination-ready', '1'); 7499 $pagination.data('popupSlidePaginationFrame', stateToken); 7500 applyState = function() { 7501 var j = 0; 7502 if(Number($pagination.data('popupSlidePaginationFrame')) !== stateToken) return; 7503 for(j = 0; j < updates.length; j++) { 7504 if(!updates[j].el) continue; 7505 updates[j].el.className = updates[j].className; 7506 if(isDynamicBulletStyle && bulletSize > 0) updates[j].el.style.left = bulletsOffset + 'px'; 7507 else updates[j].el.style.left = ''; 7508 } 7509 if(styleString == '18') { 7510 indicatorWidth = (total > 0) ? (100 / total) : 100; 7511 $indicator.css({'width':indicatorWidth + '%','height':'2px','transform':'translateX(' + (index * 100) + '%)'}); 7512 } 7513 }; 7514 7515 if(animateState && typeof window != 'undefined' && window.requestAnimationFrame) window.requestAnimationFrame(applyState); 7516 else applyState(); 7517 7518 return true; 7519 },
7520 getPopupSlideDuration: function(modal, isManual) { 7521 return 1000; 7522 }, 7523 getPopupSlideTimeValue: function(modal, attr, stateKey, fallback) { 7524 var $modal = $(modal), 7525 val = $modal.attr(attr) || ((typeof $.siteBanner.popup != 'undefined') ? $.siteBanner.popup[stateKey] : '') || fallback || ''; 7526 7527 val = String(val || '').replace(/[^0-9]/g, ''); 7528 if(val == '') return ''; 7529 if(Number(val) < 1) val = '1'; 7530 if(Number(val) > 10) val = '10'; 7531 7532 return val; 7533 }, 7534 getPopupSlidePaginationHtml: function(style, index, total) { 7535 var html = '', 7536 i = 0, 7537 num = '', 7538 bulletClass = '', 7539 pageNumberStyles = ['9','10','14'], 7540 fractionStyle = ($.inArray(String(style), ['11','12','13']) > -1), 7541 dynamicBulletStyles = ['2','4'], 7542 isDynamicBulletStyle = false, 7543 prevIndex = -1, 7544 nextIndex = -1, 7545 indicatorWidth = 100, 7546 arrowSvg = '<svg viewBox="0 0 20 20" width="20" height="20"><path d="M13.76 18a.47.47 0 0 1-.33-.14L5.9 10.33a.483.483 0 0 1 0-.67l7.53-7.53c.18-.18.48-.18.67 0s.18.48 0 .67L6.9 10l7.2 7.2c.18.18.18.48 0 .67-.09.08-.21.13-.34.13z" /></svg>'; 7547 7548 style = String(style || '11'); 7549 if(!$.siteBanner.isPopupSlidePaginationStyleValue(style)) style = '11'; 7550 isDynamicBulletStyle = ($.inArray(style, dynamicBulletStyles) > -1); 7551 if(isDynamicBulletStyle && total > 1) { 7552 prevIndex = index - 1; 7553 nextIndex = index + 1; 7554 } 7555 7556 if(fractionStyle) { 7557 html = '<div class="fraction-capsule">'; 7558 if(style == '12') { 7559 html += '<div class="fraction-numbers"><span class="swiper-pagination-current">' + (index + 1) + '</span><span class="separator">/</span><span class="swiper-pagination-total">' + total + '</span></div>'; 7560 html += '<div class="fraction-nav"><div class="custom-nav-btn prev banner-slide-prev">' + arrowSvg + '</div><div class="nav-divider"></div><div class="custom-nav-btn next banner-slide-next">' + arrowSvg + '</div></div>'; 7561 } else { 7562 html += '<span class="swiper-pagination-current">' + (index + 1) + '</span><span class="separator">/</span><span class="swiper-pagination-total">' + total + '</span>'; 7563 } 7564 html += '</div>'; 7565 return html; 7566 } 7567 7568 if(style != '18') html += '<div class="swiper-pagination-width">'; 7569 for(i = 0; i < total; i++) { 7570 bulletClass = 'banner-slide-dot swiper-pagination-bullet'; 7571 if(i == index) { 7572 bulletClass += ' swiper-pagination-bullet-active active'; 7573 if(isDynamicBulletStyle) bulletClass += ' swiper-pagination-bullet-active-main'; 7574 } else if(isDynamicBulletStyle && i == prevIndex) { 7575 bulletClass += ' swiper-pagination-bullet-active-prev'; 7576 } else if(isDynamicBulletStyle && i == nextIndex) { 7577 bulletClass += ' swiper-pagination-bullet-active-next'; 7578 } else if(isDynamicBulletStyle && i == prevIndex - 1) { 7579 bulletClass += ' swiper-pagination-bullet-active-prev-prev'; 7580 } else if(isDynamicBulletStyle && i == nextIndex + 1) { 7581 bulletClass += ' swiper-pagination-bullet-active-next-next'; 7582 } 7583 num = (i + 1); 7584 if($.inArray(style, pageNumberStyles) > -1 && num < 10 && style != '14') num = '0' + num; 7585 html += '<span class="' + bulletClass + '" data-index="' + i + '">' + (($.inArray(style, pageNumberStyles) > -1) ? num : '') + '</span>'; 7586 } 7587 if(style != '18') html += '</div>'; 7588 if(style == '18') { 7589 indicatorWidth = (total > 0) ? (100 / total) : 100; 7590 html += '<div class="nav-indicator" style="width:' + indicatorWidth + '%;height:2px;transform:translateX(' + (index * 100) + '%);"></div>'; 7591 } 7592 7593 return html; 7594 }, 7595 showPopupSlide: function(modal, index, direction, isManual) { 7596 var $modal = $(modal), 7597 $ul = $modal.find('> ul'), 7598 $items = $modal.find('> ul > li.banner-box:not(.hide)'), 7599 total = $items.length; 7600
7601 if(!isManual && $modal.attr('data-slide-moving')) return; 7602 if(total < 1) { 7603 $modal.removeAttr('data-slide-moving'); 7604 return; 7605 } 7606 if(index < 0) index = total - 1; 7607 if(index >= total) index = 0; 7608 7609 var $activeItem = $items.eq(index), 7610 $currentItem = $items.filter('.active').eq(0), 7611 hasCurrent = ($currentItem.length > 0 && $currentItem.get(0) !== $activeItem.get(0)), 7612 activeItemWidth = 0, 7613 basePosition = {top:0, left:0}; 7614 7615 if(typeof direction == 'undefined') direction = 1; 7616 if(!hasCurrent) direction = 0; 7617 7618 if(!hasCurrent) { 7619 $items.removeClass('active sliding').css({'display':'', 'position':'', 'top':'', 'left':'', 'z-index':''}); 7620 $items.find('> .banner-content, .banner-body > a').css('left', ''); 7621 $activeItem.addClass('active').css('display', 'block'); 7622 $modal.removeAttr('data-slide-moving'); 7623 } 7624 7625 var $controlItem = (hasCurrent) ? $currentItem : $activeItem, 7626 $controlBody = $controlItem.find('.banner-body').eq(0), 7627 modalOffset = $modal.offset() || {top:0, left:0}, 7628 bodyOffset = ($controlBody.length) ? $controlBody.offset() : $controlItem.offset(), 7629 bodyPosition = { 7630 top: ((bodyOffset && typeof bodyOffset.top != 'undefined') ? bodyOffset.top : modalOffset.top) - modalOffset.top, 7631 left: ((bodyOffset && typeof bodyOffset.left != 'undefined') ? bodyOffset.left : modalOffset.left) - modalOffset.left 7632 }, 7633 bodyWidth = (($controlBody.length) ? $controlBody.outerWidth() : 0) || $controlItem.outerWidth() || parseInt($controlItem.css('width')), 7634 bodyHeight = (($controlBody.length) ? $controlBody.outerHeight() : 0) || $controlItem.outerHeight(); 7635 7636 activeItemWidth = bodyWidth; 7637 $.siteBanner.placePopupSlideControls($modal, $controlItem); 7638 if(activeItemWidth > 0 && $modal.get(0)) { 7639 $modal.get(0).style.setProperty('--popup-slide-control-width', activeItemWidth + 'px'); 7640 $modal.get(0).style.setProperty('--popup-slide-control-left', bodyPosition.left + 'px'); 7641 $modal.get(0).style.setProperty('--popup-slide-control-top', (bodyPosition.top + (bodyHeight / 2)) + 'px'); 7642 } 7643 7644 var paginationStyle = $modal.attr('data-slidepaginationstyle') || (($modal.attr('data-slidepagination') == 'dot') ? '1' : '11'), 7645 paginationType = $.siteBanner.getPopupSlidePaginationTypeByStyle(paginationStyle), 7646 paginationSize = $.siteBanner.getPopupSlideControlSizeValue($modal.attr('data-slidepaginationsize'), '52'), 7647 paginationRenderSize = $.siteBanner.getPopupSlidePaginationRenderSize($modal, paginationSize, paginationStyle), 7648 paginationHtml = $.siteBanner.getPopupSlidePaginationHtml(paginationStyle, index, total), 7649 $paginationWrap = $modal.find('.banner-slide-pagination').eq(0), 7650 $pagination = $paginationWrap.find('> .slider-pagination-popup').eq(0); 7651 7652 $modal.attr('data-slidepagination', paginationType); 7653 if($paginationWrap.length && !$pagination.length) { 7654 $paginationWrap.addClass('el_popup_slide_pagination').empty().append('<div class="slider-pagination-popup"></div>'); 7655 $pagination = $paginationWrap.find('> .slider-pagination-popup').eq(0); 7656 } 7657 $paginationWrap.toggleClass('hide', total < 2 || $modal.attr('data-slidepaginationdisplay') == 'OFF'); 7658 $pagination.attr({'data-style': paginationStyle, 'data-size': paginationRenderSize + 'px'}); 7659 $pagination.toggleClass('swiper-pagination-bullets-dynamic', $.inArray(String(paginationStyle), ['2','4']) > -1);
7660 if(!$.siteBanner.updatePopupSlidePaginationState($pagination, paginationStyle, index, total)) { 7661 $pagination.html(paginationHtml).removeAttr('data-popup-slide-pagination-ready'); 7662 if(!$.siteBanner.updatePopupSlidePaginationState($pagination, paginationStyle, index, total)) $pagination.attr('data-popup-slide-pagination-ready', '1'); 7663 } 7664 $modal.find('.banner-slide-arrow').toggleClass('hide', total < 2 || $modal.attr('data-slidearrow') != 'ON' || paginationStyle == '12'); 7665 $.siteBanner.applyPopupSlideControlColors($modal); 7666 7667 basePosition = (hasCurrent) ? $currentItem.position() : $activeItem.position(); 7668 var paginationHeight = $paginationWrap.outerHeight() || 0, 7669 paginationWidth = $paginationWrap.outerWidth() || 0, 7670 paginationTop = bodyPosition.top + bodyHeight - paginationHeight - 15, 7671 paginationLeft = bodyPosition.left + ((bodyWidth - paginationWidth) / 2), 7672 paginationRight = ($modal.innerWidth() || 0) - (bodyPosition.left + bodyWidth) + 15; 7673 7674 if($modal.get(0)) { 7675 $modal.get(0).style.setProperty('--popup-slide-pagination-top', paginationTop + 'px'); 7676 $modal.get(0).style.setProperty('--popup-slide-pagination-left', paginationLeft + 'px'); 7677 $modal.get(0).style.setProperty('--popup-slide-pagination-right', paginationRight + 'px'); 7678 } 7679 if(hasCurrent && total > 1) { 7680 var moveWidth = activeItemWidth * ((direction < 0) ? -1 : 1), 7681 slideDuration = $.siteBanner.getPopupSlideDuration($modal, isManual), 7682 slideEasing = (typeof $.easing != 'undefined' && typeof $.easing.easeInOutQuart == 'function') ? 'easeInOutQuart' : 'swing', 7683 $currentBody = $currentItem.find('.banner-body').eq(0), 7684 $currentSlide = $currentBody.find('> a').eq(0), 7685 $activeSlide = $activeItem.find('.banner-body > a').eq(0), 7686 $slideClone = null, 7687 finishPopupSlide = function() { 7688 $currentItem.removeClass('active sliding').css({'display':'', 'position':'', 'top':'', 'left':'', 'z-index':''}); 7689 $currentItem.find('> .banner-content, .banner-body > a').css({'left':'', 'position':'', 'z-index':''}); 7690 $activeItem.removeClass('sliding').addClass('active').css({'display':'block', 'position':'', 'top':'', 'left':'', 'z-index':''}); 7691 $activeItem.find('> .banner-content, .banner-body > a').css({'left':'', 'position':'', 'z-index':''}); 7692 $.siteBanner.placePopupSlideControls($modal, $activeItem); 7693 $modal.removeAttr('data-slide-moving'); 7694 }; 7695 if(!$currentSlide.length) $currentSlide = $currentItem.find('> .banner-content'); 7696 if(!$activeSlide.length) $activeSlide = $activeItem.find('> .banner-content'); 7697 7698 $modal.attr('data-slide-moving', isManual ? 'manual' : 'auto'); 7699 $ul.stop(true, true); 7700 $items.not($currentItem).not($activeItem).removeClass('active sliding').css({'display':'', 'position':'', 'top':'', 'left':'', 'z-index':''}); 7701 $items.not($currentItem).not($activeItem).find('> .banner-content, .banner-body > a').css({'left':'', 'position':'', 'z-index':''}); 7702 $items.find('.banner-body > .banner-slide-clone').remove(); 7703 $activeItem.stop(true, true).removeClass('active sliding').css({'display':'', 'position':'', 'top':'', 'left':'', 'z-index':''}); 7704 $activeItem.find('> .banner-content, .banner-body > a').css({'left':'', 'position':'', 'z-index':''}); 7705 $currentItem.stop(true, true).addClass('active').css({'display':'block', 'position':'relative', 'top':'auto', 'left':0, 'z-index':2}); 7706 if(!$currentBody.length || !$currentSlide.length || !$activeSlide.length) { 7707 finishPopupSlide(); 7708 } else { 7709 $slideClone = $activeSlide.clone(false, false).addClass('banner-slide-clone'); 7710 $slideClone.removeAttr('id').find('[id]').removeAttr('id'); 7711 $slideClone.css({'position':'absolute', 'top':0, 'left':moveWidth + 'px', 'width':bodyWidth + 'px', 'height':bodyHeight + 'px', 'margin':0, 'z-index':1, 'pointer-events':'none'}); 7712 $currentBody.append($slideClone); 7713 $currentSlide.stop(true, true).css({'position':'relative', 'left':0, 'z-index':1}).animate({'left':(-moveWidth) + 'px'}, slideDuration, slideEasing); 7714 $slideClone.stop(true, true).animate({'left':'0px'}, slideDuration, slideEasing, function() { 7715 $currentSlide.css({'left':'', 'position':'', 'z-index':''}); 7716 $slideClone.remove(); 7717 finishPopupSlide(); 7718 }); 7719 } 7720 } 7721
7722 $modal.attr('data-slide-index', index).attr('data-slide-total', total); 7723 }, 7724 finishPopupSlide: function(modal) { 7725 var $modal = $(modal), 7726 $items = $modal.find('> ul > li.banner-box:not(.hide)'), 7727 total = $items.length, 7728 index = Number($modal.attr('data-slide-index') || 0), 7729 $activeItem = null; 7730 7731 if(total < 1) return; 7732 if(index < 0) index = total - 1; 7733 if(index >= total) index = 0; 7734 7735 $items.stop(true, true); 7736 $items.find('.banner-body > .banner-slide-clone').remove(); 7737 $items.find('> .banner-content, .banner-body > a').stop(true, true).css({'left':'', 'position':'', 'z-index':''}); 7738 $items.removeClass('active sliding').css({'display':'', 'position':'', 'top':'', 'left':'', 'z-index':''}); 7739 7740 $activeItem = $items.eq(index); 7741 $activeItem.addClass('active').css('display', 'block'); 7742 $.siteBanner.placePopupSlideControls($modal, $activeItem); 7743 $modal.attr('data-slide-index', index).attr('data-slide-total', total).removeAttr('data-slide-moving'); 7744 }, 7745 isPopupSlideManualMoving: function(modal) { 7746 return ($(modal).attr('data-slide-moving') == 'manual'); 7747 }, 7748 nextPopupSlide: function(modal, direction, isManual) { 7749 var $modal = $(modal), 7750 index = Number($modal.attr('data-slide-index') || 0); 7751 7752 $.siteBanner.showPopupSlide($modal, index + direction, direction, isManual); 7753 },
7754 startPopupSlideRollingModal: function(modal) { 7755 var $modal = $(modal), 7756 isSlide = ($modal.attr('data-viewtype') == 'slide'), 7757 isAuto = (($modal.attr('data-slideauto') || ((typeof $.siteBanner.popup != 'undefined') ? $.siteBanner.popup.slide_auto : 'OFF')) != 'OFF'), 7758 isScPopupPanelOpen = ($modal.closest('#el-siteConfig[data-fn="banner"] .sc-popupBanner').length > 0 && $('#el-siteConfig[data-fn="banner"] #popup-banner-accordion .panel-banner-item.open').length > 0) ? true : false, 7759 total = $modal.find('> ul > li.banner-box:not(.hide)').length, 7760 seq = null, 7761 slideDelay = 0; 7762 7763 if(!isSlide || !isAuto || total < 2 || $modal.attr('data-slide-seq') || isScPopupPanelOpen) return; 7764 7765 slideDelay = $.siteBanner.getPopupSlideDelay($modal); 7766 seq = setInterval(function() { 7767 $.siteBanner.nextPopupSlide($modal, 1, false); 7768 }, slideDelay); 7769 7770 $modal.attr('data-slide-seq', seq); 7771 if(typeof $.siteBanner.popup != 'undefined') { 7772 if(typeof $.siteBanner.popup.slide_seqs == 'undefined') $.siteBanner.popup.slide_seqs = []; 7773 $.siteBanner.popup.slide_seqs.push(seq); 7774 } 7775 }, 7776 stopPopupSlideRollingModal: function(modal) { 7777 var $modal = $(modal), 7778 seq = $modal.attr('data-slide-seq'), 7779 seqArr = (typeof $.siteBanner.popup != 'undefined' && typeof $.siteBanner.popup.slide_seqs != 'undefined') ? $.siteBanner.popup.slide_seqs : [], 7780 nextSeqArr = []; 7781 7782 if(seq) { 7783 clearInterval(Number(seq)); 7784 $modal.removeAttr('data-slide-seq'); 7785 } 7786 $.each(seqArr, function(i, rollingSeq) { 7787 if(seq && String(rollingSeq) == String(seq)) { 7788 clearInterval(rollingSeq); 7789 } else { 7790 nextSeqArr.push(rollingSeq); 7791 } 7792 }); 7793 if(typeof $.siteBanner.popup != 'undefined') $.siteBanner.popup.slide_seqs = nextSeqArr; 7794 }, 7795 stopPopupSlideRolling: function(selector) { 7796 var $modal = (selector) ? $(selector).find('.banner-modal') : $('.sc-popupBanner .banner-modal, .cl-popupBanner .banner-modal'), 7797 seqArr = (typeof $.siteBanner.popup != 'undefined' && typeof $.siteBanner.popup.slide_seqs != 'undefined') ? $.siteBanner.popup.slide_seqs : []; 7798 7799 $modal.each(function() { 7800 var seq = $(this).attr('data-slide-seq'); 7801 if(seq) clearInterval(seq); 7802 $(this).removeAttr('data-slide-seq'); 7803 }); 7804 7805 $.each(seqArr, function(i, seq) { 7806 clearInterval(seq); 7807 }); 7808 7809 if(typeof $.siteBanner.popup != 'undefined') $.siteBanner.popup.slide_seqs = []; 7810 }, 7811 setBandRolling: function() { 7812 if($.siteBanner.band.paused) return false; 7813 7814 var bannerEL = $('.cl-bandBanner[data-seq="'+$.siteBanner.band.seqs[$.siteBanner.band.seqs.length - 1]+'"]'); 7815 if(bannerEL.length == 0) return false; 7816 var bannerUL = bannerEL.find('.banner-modal > ul'), 7817 banner_h = $.siteBanner.getBandHeight(), 7818 banner_l = bannerUL.children('.banner-box:not(.hide)').length; 7819 7820 bannerUL.animate({ top: -banner_h+'px' }, 1000, 'easeInOutQuart', function() { 7821 $(this).append($(this).find('li.banner-box:not(.hide)').eq(0).clone().wrapAll('<li />').parent().html()); 7822 7823 $(this).find('li.banner-box:not(.hide)').eq(0).remove(); 7824 $(this).css('top', 0); 7825 }); 7826 }, 7827 stopBandRolling: function() { 7828 var seq = ($('.cl-bandBanner').length > 0) ? $('.cl-bandBanner').attr('data-seq') : 0, 7829 seq_arr = (typeof $.siteBanner.band != 'undefined' && typeof $.siteBanner.band.seqs != 'undefined') ? $.siteBanner.band.seqs : []; 7830 7831 if(seq) clearInterval(seq); 7832 $.each(seq_arr, function(i,v) { 7833 clearInterval(v); 7834 }); 7835 7836 if(seq_arr.length > 0) { 7837 $.siteBanner.band.seqs = []; 7838 $.siteBanner.band.paused = false;
7839 } 7840 }, 7841 } 7842 7843 $.fixedContact = { 7844 init: function($el) { 7845 // console.log('fixedContact init'); 7846 let sid = (typeof property != 'undefined')? property.SID : SID; 7847 let settings = (typeof property != 'undefined')? property.SETTINGS : SETTINGS; 7848 let onoff = (typeof $.cookie('fixedcontact-' + sid) != 'undefined')? $.cookie('fixedcontact-' + sid) : 'on'; 7849 let device = ($('body').width() > 768) ? 'pc' : 'mobile'; 7850 7851 $el.addClass('el-fixedcontact'); 7852 if(onoff == 'off') $el.addClass('down'); 7853 7854 if($.fnav.checkFnavON()) { 7855 if(typeof settings.qm_onoff == 'undefined') $el.addClass('has-fnav'); 7856 } 7857 7858 if(typeof settings.viewportMode != 'undefined' && settings.vpMode_onoff===true && $('.mobilepc_ch').length > 0) { 7859 $el.addClass('has-vpmode'); 7860 } 7861 7862 setTimeout(function(){ 7863 $.fixedContact.addBtn($el); 7864 }, 100); 7865 }, 7866 addBtn: function($el) { 7867 let bgcolor = $el.css('background-color'); 7868 let bgimg = $el.css('background-image'); 7869 let bgPos = $el.css('background-position'); 7870 let btnBackground = 'background-color:'+bgcolor+';'; 7871 let btnHTML = '<div class="fixedcontact-onoff hand" style="' + btnBackground + '"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" width="20" height="20"><path d="M10 13.7 3.6 7.4l.8-.8 5.6 5.7 5.6-5.7.8.8-6.4 6.3z"/></svg></div>'; 7872 $el.append(btnHTML); 7873 7874 if(PAGE_MODE != 'c') { 7875 $(document).off('click', '.fixedcontact-onoff'); 7876 $(document).on('click', '.fixedcontact-onoff', function(){ 7877 let sid = property.SID; 7878 let date = new Date(); 7879 7880 date.setTime(date.getTime() + 6*60*60*1000); // 6h 7881 $('.el-fixedcontact').toggleClass('down'); 7882 7883 if($('.el-fixedcontact').hasClass('down')) { 7884 $.cookie('fixedcontact-' + sid, 'off', { expires: date, path : '/' }); 7885 } else { 7886 $.cookie('fixedcontact-' + sid, 'on', { expires: date, path : '/' }); 7887 } 7888 7889 let scrollTop = $(window).scrollTop(), 7890 device_type = ($('body').width() > 768) ? 'pc' : 'mobile', 7891 gotoTop_position = $(window).height() - $('#goto-top').outerHeight() - $('#goto-top').position().top, 7892 el_fixedheight = $('.element.el-fixedcontact').innerHeight(), 7893 el_fixedonoff = 22, 7894 el_fixedblocktotalHeight = el_fixedheight + el_fixedonoff, 7895 music_position = (($('#cl-music-player-icon').length > 0)) ? Number($('#cl-music-player-icon').css('bottom').replace(/px/gi,'')) : 0, 7896 quickmenu_position = (($(`.quick-menu-${sid}.quickmenu`).length > 0)) ? Number($(`.quick-menu-${sid}.quickmenu`).css('bottom').replace(/px/gi,'')) : 0; 7897 7898 if($('.el-fixedcontact').hasClass('down')) { 7899 if(device_type=='pc') $('#goto-top').css('bottom',gotoTop_position - el_fixedheight); 7900 if(typeof $.quickmenu['quickmenu'] != 'undefined' && $.quickmenu['quickmenu']['img_type'][device_type]!='bottom_default') $(`.quick-menu-${sid}.quickmenu`).css('bottom',quickmenu_position - el_fixedheight); 7901 if($('#cl-music-player-icon').length > 0) $('#cl-music-player-icon, #cl-music-container').css('bottom',music_position - el_fixedheight); 7902 } else { 7903 if(device_type=='pc') $('#goto-top').css('bottom',gotoTop_position + el_fixedheight); 7904 if(typeof $.quickmenu['quickmenu'] != 'undefined' && $.quickmenu['quickmenu']['img_type'][device_type]!='bottom_default') $(`.quick-menu-${sid}.quickmenu`).css('bottom',quickmenu_position + el_fixedheight); 7905 if($('#cl-music-player-icon').length > 0) $('#cl-music-player-icon, #cl-music-container').css('bottom',music_position + el_fixedheight); 7906 } 7907 }); 7908 7909 $.fixedContact.checkPosition($('.el-fixedcontact')); 7910 7911 $(window).on('scroll', function() { 7912 $.fixedContact.checkPosition($('.el-fixedcontact')); 7913 }); 7914 } 7915 }, 7916 checkPosition: function($el) { 7917 if(PAGE_MODE != 'c' && $el.length > 0) { 7918 let isNotFixed = $el.hasClass('notfixed'); 7919 let scrollTop = $(window).scrollTop(); 7920 let windowHeight = $(window).height(); 7921 let documentHeight = $(document).height(); 7922 let footerTop = ($('.el-footer').length > 0 && $('.el-footer').hasClass('hide') == false)? $('.el-footer').offset().top : documentHeight - $el.outerHeight(); 7923 if($el.hasClass('has-fnav')) footerTop -= 53; 7924 let distanceScrolled = (isNotFixed)? Math.max(0, scrollTop + windowHeight - footerTop + $el.outerHeight()) : Math.max(0, scrollTop + windowHeight - footerTop); 7925 // console.log('windowHeight', windowHeight); 7926 // console.log('scrollTop', scrollTop); 7927 // console.log('footerTop', footerTop); 7928 // console.log('documentHeight', documentHeight); 7929 // console.log('distanceScrolled', distanceScrolled); 7930 7931 if (distanceScrolled > 0 && !isNotFixed) { 7932 $el.addClass('notfixed'); 7933 } else if (distanceScrolled <= 0 && isNotFixed) { 7934 $el.removeClass('notfixed'); 7935 } 7936 } 7937 } 7938 } 7939 7940 // $(".element").removeInlineCss("color font-size font-weight"); 7941 jQuery.fn.removeInlineCss = function (properties) { 7942 if (properties == null) return this.removeAttr('style'); 7943 properties = properties.split(/\s+/); 7944 return this.each(function () { 7945 for (var i = 0; i < properties.length; i++) 7946 this.style.removeProperty(properties[i]) 7947 }); 7948 } 7949 7950 jQuery.fn.refreshRootCss = function(property_key) { 7951 var isAll = (typeof property_key == 'undefined' || property_key == '') ? true : false;
7952 7953 // property_key == '--menu-height' 7954 var mh = getMenuHeight(), 7955 bh = $.siteBanner.getBandHeight(); 7956 this.each(function() { 7957 if(!$(this).is('[data-el^="el_"]') || !$(this).is('[data-type="gallery"][data-type2="premium"]')) return true; 7958 7959 if(isAll || property_key == '--menu-height') { 7960 var __target = $(this).attr('data-el'), 7961 __menu_height = getComputedStyle(document.querySelector('.'+__target)).getPropertyValue('--menu-height'); 7962 if(typeof __menu_height != 'undefined' && __menu_height) document.querySelector('.'+__target).style.setProperty('--menu-height', (mh+bh)+'px', null); 7963 } 7964 }); 7965 } 7966 7967 //mobileì ë³´ ê°ì ¸ì¤ê¸° 7968 var mrequest_uri = location.pathname + location.search; 7969 function getMobileInfo(data) { 7970 var page = location.pathname.split('/')[1], 7971 mb = data.mb, 7972 paidUser = data.paidUser, 7973 settings_url = data.settings_url, 7974 sid = data.sid, 7975 valid_plan = data.valid_plan, 7976 site_nickname = (typeof $('.site-username').text() != 'undefined' && $('.site-username').text()) ? $('.site-username').text() : data.site_nickname, 7977 site_profile = (typeof $('#dashboard-image-top image').attr('xlink:href') != 'undefined' && $('#dashboard-image-top image').attr('xlink:href')) ? $('#dashboard-image-top image').attr('xlink:href') : data.site_profile, 7978 umprofile = data.umprofile, 7979 newCount = data.newCount, 7980 checkGabia = (data.service.indexOf('gabia') > -1) ? true : false; 7981 7982 mb.mb_id = (mb.mb_id) ? mb.mb_id : mb.um_id; 7983 7984 if(mb.mb_id){ 7985 var empty = (mb.mb_id) ? '' : 'empty', 7986 newMessage = (newCount == 0) ? false : true, 7987 badge = newMessage ? "<span class='badge'></span>" : ""; 7988 7989 var adminhtml = (mb.mb_level >= 10) ? '<li><a href="/adm" target="_blank">Admin</a></li>' : '', 7990 mypage = (checkGabia) ? '/dashboard' : '/mypage', 7991 uadminmypage = (data.is_uadmin == false) ? mypage : 'javascript:;', 7992 siteum = (data.is_uadmin == false) ? '' : 'siteUM', 7993 mypage = (data.is_uadmin == false) ? '' : 'mypage', 7994 dashboarduadmin = (data.is_uadmin == false) ? '/' : '/_admin/dashboard', 7995 marketinguadmin = (data.is_uadmin == false) ? '/marketing' : '/_admin/marketing'; 7996 7997 7998 7999 8000 var str = '<div class="nav navbar-nav navbar-right">\ 8001 <div class="mobile-menu">\ 8002 <div class="m-myinfo">\ 8003 <div class="profile_left">\ 8004 <label class="m-profile hand '+umprofile+'" data-user-img="'+site_profile+'" data-user-plan="'+paidUser+'" data-user-um="'+umprofile+'">\ 8005 <svg viewBox="0 0 40 40" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" >\ 8006 <pattern id="m-dashboard-image-top" patternUnits="userSpaceOnUse" width="60" height="60">\ 8007 <image xlink:href='+site_profile+' x="-10" width="60" height="40"></image>\ 8008 </pattern><circle cx="20" cy="20" r="20" fill="url(#m-dashboard-image-top)"></circle></svg>\ 8009 </label>\ 8010 <div class="inner-box hand">\ 8011 <span class="name-text m-profile m-text-size">'+site_nickname+'</span>\ 8012 </div>\ 8013 </div>\ 8014 <div class="profile_right">'; 8015 if(data.is_uadmin) { 8016 str += '<div class="mlogout siteUM"><a href="javascript:;" class="logout">'+$.lang[LANG]['header.logout']+'</a></div>'; 8017 } else { 8018 str += '<div class="mlogout"><a href="/member/login/out">'+$.lang[LANG]['header.logout']+'</a></div>'; 8019 } 8020 str += '</div>\ 8021 </div>\ 8022 <div class="mMymenu-wrap"><ul class="mMymenu">'; 8023 var newCountlink = (data.is_uadmin == false) ? '/' : '/_admin'; 8024 str += '<li class="newCount prorightmenu">\ 8025 <a href="'+newCountlink+'" class='+empty+'><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18" width="18px" height="18px"><path d="M16 16.5V9c0-3.6-2.75-6.58-6.25-6.96V0h-1.5v2.04C4.75 2.42 2 5.4 2 9v7.5H0V18h2 14 2v-1.5H16zM3.5 16.5V9c0-3.03 2.47-5.5 5.5-5.5s5.5 2.47 5.5 5.5v7.5H3.5z"/></svg>'+badge+'<span class="menu-title">'+$.lang[LANG]['header.bell']+'</span></a>\ 8026 </li>\ 8027 <li class="m-mypage prorightmenu '+siteum+'"><a href="'+uadminmypage+'" class="'+mypage+'"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 17 18" width="17px" height="18px"><path d="M11.55 10.08C13.03 9.09 14 7.41 14 5.5 14 2.46 11.54 0 8.5 0 5.46 0 3 2.46 3 5.5c0 1.91 0.97 3.59 2.45 4.58C2.27 11.31 0 14.4 0 18h1.5c0-3.86 3.14-7 7-7s7 3.14 7 7H17C17 14.4 14.73 11.31 11.55 10.08zM4.5 5.5c0-2.21 1.79-4 4-4s4 1.79 4 4c0 2.21-1.79 4-4 4S4.5 7.71 4.5 5.5z"/></svg>\
8028 <span class="menu-title">'+$.lang[LANG]['header.mypage']+'</span></a></li>'; 8029 8030 if(!checkGabia) str += '<li class="m-langselect prorightmenu"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18" width="18px" height="18px"><path d="M9 0C4.03 0 0 4.03 0 9c0 4.97 4.03 9 9 9s9-4.03 9-9C18 4.03 13.97 0 9 0zM15.33 5h-2.75c-0.27-1.2-0.65-2.25-1.11-3.07C13.08 2.49 14.43 3.58 15.33 5zM11.5 9c0 0.9-0.07 1.74-0.17 2.5H6.67C6.57 10.74 6.5 9.9 6.5 9s0.07-1.74 0.17-2.5h4.65C11.43 7.26 11.5 8.1 11.5 9zM9 16.5c-0.57 0-1.48-1.29-2.03-3.5h4.07C10.48 15.21 9.57 16.5 9 16.5zM6.97 5C7.52 2.79 8.43 1.5 9 1.5s1.48 1.29 2.03 3.5H6.97zM6.53 1.93C6.07 2.75 5.69 3.8 5.42 5H2.67C3.57 3.58 4.92 2.49 6.53 1.93zM1.94 6.5h3.22C5.06 7.29 5 8.13 5 9s0.06 1.71 0.16 2.5H1.94C1.66 10.72 1.5 9.88 1.5 9S1.66 7.28 1.94 6.5zM2.67 13h2.75c0.27 1.2 0.65 2.25 1.11 3.07C4.92 15.51 3.57 14.42 2.67 13zM11.47 16.07c0.47-0.82 0.85-1.87 1.11-3.07h2.75C14.43 14.42 13.08 15.51 11.47 16.07zM16.06 11.5h-3.22C12.94 10.71 13 9.87 13 9s-0.06-1.71-0.16-2.5h3.22C16.34 7.28 16.5 8.12 16.5 9S16.34 10.72 16.06 11.5z"/></svg>\ 8031 <span class="menu-title">'+$.lang[LANG]['header.changeLang']+'</span></li>'; 8032 str += '</ul></div>\ 8033 <ul class="dropdown-menu" role="menu">'+adminhtml+ 8034 '<li><a href="'+dashboarduadmin+'" class="myhome-icon"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 16" width="18px" height="16px"><path d="M9 0L0 7.03V16h6 6 6V7L9 0zM7.5 14.5v-4h3v4H7.5zM16.5 14.5H12V9H6v5.5H1.5V7.76L9 1.9l7.5 5.83V14.5z"/></svg>'+$.lang[LANG]['mobile.menu.title.mysite']+'</a></li>'; 8035 8036 var supportlink = (checkGabia) ? 'https://creatorlink-gabia.com/support' : ((LANG == 'ko') ? 'https://supportcenter.creatorlink.net/creatorlink/' : 'https://supportcenter.creatorlink.net/creatorlink-support-center'), 8037 helplink = (checkGabia) ? 'https://creatorlink.gabia.com/consult' : '#helpdeskopen', 8038 helptext = (checkGabia) ? $.lang[LANG]['mobile.menu.title.gabia.gotocts'] : $.lang[LANG]['mobile.menu.title.gotocts'], 8039 is_uadminMember = (data.is_uadmin) ? '_admin' : 'manager', 8040 memberlink = '/'+is_uadminMember+'/member/list', 8041 siteNotice = (valid_plan=='' || $.inArray(valid_plan['type'], ['BN','SM']) == -1) ? 'siteNotice("manager");' : '', 8042 kakaositeNotice = "", 8043 kakaotalkuadmin = (data.is_uadmin == false ) ? '/notificationtalkmail' : '/_admin/notificationtalkmail'; 8044 8045 if(data.is_uadmin) helplink = (checkGabia) ? 'https://creatorlink.gabia.com/consult' : '#helpdeskopen'; 8046 8047 str += '<li class="m_memberlist"><a href="'+memberlink+'">'+$.lang[LANG]['mobile.menu.title.memberlist']+'</a></li>'; 8048 8049 if(LANG == 'ko' && (!checkGabia || (checkGabia && valid_plan['type'] == 'SM'))) { 8050 var applySm = (valid_plan['type'] == 'SM') ? '' : 'siteNotice(\'shopping\')', 8051 collapsed = (valid_plan['type'] == 'SM') ? 'collapsed' : '', 8052 smHide = ((valid_plan['type'] == 'BN') && (data.is_uadmin==true)) ? 'hide' : ''; 8053 8054 str += '\ 8055 <li class="collapsed mshoppingtab '+smHide+'" data-toggle="collapse" data-target=".mshopping_menu" aria-expanded="true">\ 8056 <a type="button" class="collapsed hand">' + $.lang[LANG]['mobile.menu.title.shopping'] + '</a>\ 8057 '; 8058 8059 var admin_url = (data.is_uadmin == false) ? '' : '/_admin'; 8060 8061 str += '\ 8062 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 10" width="10px" height="10px"><polygon points="9 2 5 6 1 2 0 3 4 7 5 8 6 7 10 3 "></polygon></svg>\ 8063 </li>\ 8064 <ul class="mshopping_menu collapse">\ 8065 <li><a href="'+admin_url+'/shopping/product_search/order">'+$.lang[LANG]['mobile.menu.title.shopping.order']+'</a></li>\ 8066 <li><a href="'+admin_url+'/shopping/product_search/cancel">'+$.lang[LANG]['mobile.menu.title.shopping.cancel']+'</a></li>\ 8067 <li><a href="'+admin_url+'/shopping/product_search/return">'+$.lang[LANG]['mobile.menu.title.shopping.refund']+'</a></li>\ 8068 <li><a href="'+admin_url+'/shopping/product_search/exchange">'+$.lang[LANG]['mobile.menu.title.shopping.change']+'</a></li>\ 8069 <li><a href="'+admin_url+'/shopping/question_list/P">'+$.lang[LANG]['mobile.menu.title.shopping.qna']+'</a></li>\ 8070 <li><a href="'+admin_url+'/shopping/product_search/all">'+$.lang[LANG]['mobile.menu.title.shopping.all']+'</a></li>\ 8071 <li><a href="'+admin_url+'/shopping/statistics">'+$.lang[LANG]['mobile.menu.title.shopping.statistics']+'</a></li>\ 8072 <li>
8072<a href="'+admin_url+'/shopping/point">'+$.lang[LANG]['mobile.menu.title.shopping.point']+'</a></li>\ 8073 <li><a href="'+admin_url+'/shopping/coupon">'+$.lang[LANG]['mobile.menu.title.shopping.coupon']+'</a></li>\ 8074 <li><a href="'+admin_url+'/shopping/setting/W">'+$.lang[LANG]['mobile.menu.title.shopping.setting']+'</a></li>\ 8075 </ul>'; 8076 } 8077 8078 var slog_li = '\ 8079 <li><a href="'+admin_url+'/slog">'+$.lang[LANG]['mobile.menu.title.slog']+'</a></li>\ 8080 '; 8081 8082 if(valid_plan) { 8083 8084 var pageactive = (page == 'settings') ? 'active' : '', 8085 settingslink = (page == 'settings') ? '#' : settings_url, 8086 helpbox = (data.is_uadmin == false) ? '<li><a href="'+helplink+'">'+helptext+'</a></li>' : ((data.su_eadmin == false) ? '' : '<li><a href="'+helplink+'">'+helptext+'</a></li>'), 8087 settingHide = (data.is_uadmin == true && data.su_eadmin == false) ? 'hide' : ''; 8088 8089 str += '<li class="m_marketing '+settingHide+'"><a href="'+marketinguadmin+'">'+$.lang[LANG]['mobile.menu.title.marketing']+'</a></li>'; 8090 if(!checkGabia) str += '<li class=m_kakao " onClick="'+kakaositeNotice+'"><a href="'+kakaotalkuadmin+'">'+$.lang[LANG]['mobile.menu.title.kakao']+'</a></li>'; 8091 str += '<li class="'+settingHide+'"><a href="'+settings_url+'">'+$.lang[LANG]['mobile.menu.title.settings']+'</a></li>\ 8092 '; 8093 if(!checkGabia && data.is_uadmin == false) str += '<li class="m_plan '+settingHide+'"><a href="/plan">'+$.lang[LANG]['mobile.menu.title.plan.billing']+'</a></li>'; 8094 if(valid_plan['type'] == 'SM' && LANG == 'ko') str += slog_li; 8095 if(!checkGabia && LANG == 'ko' && data.is_uadmin == false) { 8096 str += ` 8097 <li><a href="/edu">${$.lang[LANG]['mobile.menu.logout.title.edu']}</a></li> 8098 `; 8099 // <li><a href="/production">${$.lang[LANG]['mobile.menu.logout.title.production']} <span class="newicon">New</span></a></li> 8100 } 8101 8102 if(data.is_uadmin == false) str +='<li><a href="'+supportlink+'">'+$.lang[LANG]['mobile.menu.title.supportcenter']+'</a></li>'; 8103 if(!checkGabia && data.is_uadmin == false)str += '<li><a href="/notice">'+$.lang[LANG]['mobile.menu.title.notice']+'</a></li>'; 8104 str += helpbox; 8105 } 8106 8107 str += '</ul>\ 8108 </div>\ 8109 </div>'; 8110 $('.m-header_user').empty().prepend(str); 8111 } 8112 return data; 8113 } 8114 8115 $.mobileToggleMenu = { 8116 set : function() { 8117 var request_uri = location.pathname + location.search; 8118 var returnData = ''; 8119 8120 $.ajax({ 8121 type: 'POST', 8122 data: { type:'get', sid:(typeof SID!='undefined' && SID? SID : '') }, 8123 dataType: 'json', 8124 url: '/template/getMobileMenu', 8125 async:false, 8126 success : function(data) { 8127 returnData = getMobileInfo(data); 8128 } 8129 }); 8130 8131 $.mobileToggleMenu.clickEvnt(); 8132 8133 return returnData; 8134 8135 }, 8136 setSignIn : function() { 8137 var langkor = (LANG=='ko') ? '':'hide', 8138 langen = (LANG=='en') ? '' : 'hide', 8139 str = '<div class="nav navbar-nav navbar-right signinwrap">\ 8140 <div class="mobile-menu">\ 8141 <div class="m-myinfo">\ 8142 <div class="profile_left signinwrap_logo">\ 8143 <div class="inner-box hand">\ 8144 <a href="/">\ 8145 <svg viewBox="0 0 168 38" role="img" class="logo-svg logo-b" data-attach="true" alt="Creatorlink logo"><path class="st11" d="M70.71 12.36c-3.48 0-5.9 2.19-5.9 5.34v4.11c0 3.34 2.17 5.25 5.96 5.25 2.06 0 3.98-0.58 5.41-1.64l0.14-0.11 -1.03-1.95 -0.2 0.1c-1.67 0.85-2.74 1.15-4.11 1.15 -2.23 0-3.23-0.87-3.23-2.83v-0.94h8.62v-3.08C76.37 14.13 74.52 12.36 70.71 12.36zM73.52 18.45h-5.77v-0.92c0-1.91 1.53-2.78 2.96-2.78 2.02 0 2.81 0.78 2.81 2.78V18.45z"/><path class="st11" d="M84.38 12.36c-1.52 0-3.34 0.55-4.87 1.47l-0.17 0.1 1.11 1.95 0.19-0.1c1.41-0.69 2.48-0.98 3.59-0.98 2.22 0 2.93 0.51 2.93 2.1v1.29h-3.64c-3.09 0-4.65 1.47-4.65 4.37 0 1.22 0.39 2.33 1.09 3.12 0.76 0.85 1.84 1.3 3.12 1.3 0.09 0 0.18 0 0.26-0.01 1.37-0.06 2.71-0.51 3.97-0.99l0.04 0.79h2.76v-9.76C90.11 13.76 88.39 12.36 84.38 12.36zM87.17 23.79l-0.01 0c-0.83 0.32-1.87 0.72-3.2 0.73h-0.06c-1.46 0-2.08-0.6-2.08-2.01 0-1.37 0.55-1.92 1.89-1.92h3.47V23.79z"/><path class="st11" d="M101.06 24.31c-0.95 0.23-1.63 0.33-2.26 0.33 -1.16 0-1.27-0.36-1.27-1.31v
8145-8.47h3.9l0-2.22h-3.9V9.26l-2.94 0.01v3.38h-2.56v2.22h2.56v8.86c0 2.31 1.18 3.34 3.82 3.34 1.04 0 2.14-0.18 3.11-0.52l0.17-0.06 -0.4-2.23L101.06 24.31z"/><path class="st11" d="M109.95 12.36c-3.88 0-6.11 1.96-6.11 5.36v3.97c0 3.41 2.23 5.36 6.11 5.36 3.88 0 6.11-1.96 6.11-5.36v-3.97C116.06 14.32 113.84 12.36 109.95 12.36zM113.12 21.78c0 1.89-1.04 2.8-3.17 2.8 -2.13 0-3.17-0.92-3.17-2.8v-4.14c0-1.89 1.04-2.8 3.17-2.8 2.13 0 3.17 0.92 3.17 2.8V21.78z"/><path class="st11" d="M59.07 14.72l0.01-2.07H56.3v14.13h2.94v-9.04c1.75-1.89 4.2-3.24 4.2-3.24l-1.4-1.84C62.04 12.65 60.26 13.76 59.07 14.72z"/><path class="st11" d="M121.93 14.72l0.01-2.07h-2.77v14.13h2.94v-9.04c1.75-1.89 4.2-3.24 4.2-3.24l-1.4-1.84C124.91 12.65 123.12 13.76 121.93 14.72z"/><path class="st11" d="M51.54 22.93c-0.96 1.11-2.12 1.66-3.56 1.66 -2.13 0-3.17-0.92-3.17-2.8v-4.14c0-1.89 1.04-2.8 3.17-2.8 1.73 0 2.83 0.77 3.68 1.52l0.13 0.12 1.99-1.39 -0.13-0.17c-0.76-0.95-2.5-2.55-5.67-2.55 -3.88 0-6.11 1.96-6.11 5.36v3.97c0 3.41 2.23 5.36 6.11 5.36 3.03 0 4.76-1.58 5.68-2.91l0.13-0.18 -2.13-1.18L51.54 22.93z"/><rect x="128.71" y="6.68" class="st11" width="1.2" height="20.07"/><rect x="134.41" y="12.69" class="st11" width="1.2" height="14.06"/><rect x="134.41" y="8.29" class="st11" width="1.2" height="2.18"/><path class="st11" d="M148.67 13.44c-1.68-0.98-5.06-0.52-7.21 0.71V12.5h-1.2v14.25h1.2V15.33c1.74-1.3 5.26-1.79 6.61-1 1.38 0.81 1.38 2.37 1.38 2.43v9.99h1.2v-9.99C150.65 16.67 150.63 14.59 148.67 13.44z"/><polygon class="st11" points="158.27 18.97 164.05 12.69 162.6 12.69 156 19.89 156 6.68 154.8 6.68 154.8 26.75 156 26.75 156 21.44 157.54 19.77 163.6 26.75 165 26.75 "/><path class="st11" d="M3 10.79L3 10.79l0 16.42 14.22 8.21 14.22-8.21V10.79L17.22 2.58 3 10.79zM26.7 13.53L26.7 13.53 26.7 13.53l-4.74 2.74h0l-4.74-2.74 -4.74 2.74v5.47l4.74 2.74 4.74-2.74 4.74 2.74 -9.48 5.47 -9.48-5.47V13.53l9.48-5.47L26.7 13.53 26.7 13.53z"/></svg>\ 8146 </a>\ 8147 </div>\ 8148 </div>\ 8149 <div class="profile_right msignin">\ 8150 <a href="/member/login" class="mlogin-text" id="m_login_btn_head">'+$.lang[LANG]['mobile.menu.signin']+'</button>\ 8151 </div>\ 8152 </div>\ 8153 <ul class="dropdown-menu" role="menu">'; 8154 str += '<li><a href="/upgrade/site" class="logoutmenu">'+$.lang[LANG]['mobile.menu.logout.title.plan']+'</a></li>\ 8155 <li><a href="/template" class="logoutmenu">'+$.lang[LANG]['mobile.menu.logout.title.template']+'</a></li>\ 8156 <li><a href="/bestlist" class="logoutmenu">'+$.lang[LANG]['mobile.menu.logout.title.bestsite']+'</a></li>'; 8157 if(LANG == 'ko') str += '<li><a href="/mainfunction" class="logoutmenu">'+$.lang[LANG]['mobile.menu.logout.title.mainfunc']+'</a></li>'; 8158 if(LANG == 'ko') str += '<li><a href="/edu" class="logoutmenu edu">'+$.lang[LANG]['mobile.menu.logout.title.edu']+'</a></li>'; 8159 if(LANG == 'ko') str += '<li><a href="/production" class="logoutmenu production">'+$.lang[LANG]['mobile.menu.logout.title.production']+'</a></li>'; 8160 8161 // str += '</ul>\ 8162 // <div class="mchange-lang">\ 8163 // //<img src="https://storage.googleapis.com/i.addblock.net/lang_kor.png" class="lang-ch '+langkor+'" data-attach="true" alt="Creatorlink logo">\ 8164 // //<img src="https://storage.googleapis.com/i.addblock.net/lang_eng.png" class="lang-ch '+langen+'" data-attach="true" alt="Creatorlink logo">\ 8165 // <div class="lang-ch '+langkor+'">KR</div>\ 8166 // <div class="lang-ch '+langen+'">EN</div>\ 8167 // </div>\ 8168 // </div>\ 8169 str += '</ul>\ 8170 <div class="mchange-lang">\ 8171 <div class="hand lang-ch '+langkor+'">KR</div>\ 8172 <div class="hand lang-ch '+langen+'">EN</div>\ 8173 </div>\ 8174 </div>\ 8175 </div>'; 8176 8177 $('.m-header_user').prepend(str); 8178 8179 $.mobileToggleMenu.clickEvnt(); 8180 }, 8181 mobileResize : function(data) { 8182 getMobileInfo(data); 8183 $.mobileToggleMenu.clickEvnt(); 8184 }, 8185 clickEvnt : function() { 8186 $('.navbar-toggle').click(function() { 8187 $.mobileToggleMenu.open(); 8188 $('.m-header_user').css('left','0'); 8189 $('html').css({'overflow': 'hidden'}); 8190 }); 8191 $('.m-langselect,.lang-ch').on('click',function(){ 8192 $.mobileToggleMenu.langSelect(mrequest_uri); 8193 }); 8194 /*$('.applySm').click(function(){ 8195 $(this).showModalFlat('INFORMATION', 'ì¼í 기ë¥ì ì¬íì¼í ìê¸ì ë¡ ì´ì©ì´ ê°ë¥í©ëë¤.<br>ì¬íì¼í ì ì² íì´ì§ë¡ ì´ëí ê¹ì?', true, true, function() { 8196 location.href = '/shoppingevent'; 8197 }, 'cancel', 'ì´ë','mUpgradeSmModal'); 8198 });*/ 8199 $('.mshopping_menu').on('show.bs.collapse',function(e){ 8200 $('.mshoppingtab,.mshoppingtab > a').css('background-color','#eeeff3'); 8201 $('.mshoppingtab svg').remove(); 8202 $('.mshoppingtab > a ').prepend('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 10" width="10px" height="10px"><polygon points="1 8 5 4 9 8 10 7 6 3 5 2 4 3 0 7 "/></svg>'); 8203 }); 8204 $('.mshopping_menu').on('hide.bs.collapse',function(e){ 8205 $('.mshoppingtab,.mshoppingtab > a').css('background-color','inherit'); 8206 $('.mshoppingtab svg').remove(); 8207 $('.mshoppingtab > a ').prepend('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 10" width="10px" height="10px"><polygon points="9 2 5 6 1 2 0 3 4 7 5 8 6 7 10 3 "/></svg>'); 8208 }); 8209 8210 $('#loginModal').on('show.bs.modal', function(e) { 8211 $.mobileToggleMenu.close(); 8212 }); 8213 $('#loginModal').on('shown.bs.modal', function(e) { 8214 $('html').css({'overflow': 'inherit'}); 8215 }); 8216 }, 8217 open : function (){ 8218 var height = window.outerHeight; 8219 8220 $('#nav.default-nav .header .navbar-header a.navbar-toggle,#nav.default-nav .header .navbar_right').css('zIndex','99'); 8221 $('.mobile-detail-popup.billhead,.mobile-detail-popup.helphead').css('height', '100%'); 8222 $('.m-headermenu').remove(); 8223 $('.m-headerClose').addClass('in'); 8224 $('.m-headerClose').removeClass('hide'); 8225 $.mobileToggleMenu.scrollheight(); 8226 8227 $(window).resize(function (){ 8228 $.mobileToggleMenu.scrollheight(); 8229 }); 8230 $('.m-headerClose').click(function(){ 8231 $.mobileToggleMenu.close(); 8232 $('html').css({'overflow': 'inherit'}); 8233 }); 8234 }, 8235 close : function() { 8236 $('.m-headermenu').remove(); 8237 $('.m-header_user').css('left','-100%'); 8238 $('.m-headerClose').removeClass('in'); 8239 $('.mobile-detail-popup.billhead,.mobile-detail-popup.helphead').css('height', 'auto'); 8240 $('#nav.default-nav .header .navbar_right').css('zIndex',''); 8241 $('#nav.default-nav .header .navbar-header a.navbar-toggle').css('zIndex','120'); 8242 }, 8243 langSelect : function(request_uri) { 8244 $('.m-headermenu').remove(); 8245 $('.m-header_user.menu').css('left','-100%'); 8246 $('.m-headerClose').addClass('hide'); 8247 $('#nav.default-nav .header .navbar-header a.navbar-toggle').css('zIndex','120'); 8248 8249 var dashlang = (LANG == 'ko') ? 'ko' : 'en', 8250 html = "<ul class='dashlang-wrap'>\ 8251 <li class='dashlang-select'>\ 8252 <a href='/lang/switchLanguage/korean"+request_uri+"'><p class='mdash-lang'>íêµì´ (KO)</p>\
8253 <span class='cl-icon cl-check-lang "+(dashlang == 'ko' ? 'cl_icon_checked04' : 'cl_icon_unchecked04')+"' data-lang='ko'></span></a>\ 8254 </li>\ 8255 <li class='dashlang-select'>\ 8256 <a href='/lang/switchLanguage/english"+request_uri+"'><p class='mdash-lang'>English (EN)</p>\ 8257 <span class='cl-icon cl-check-lang "+(dashlang == 'en' ? 'cl_icon_checked04' : 'cl_icon_unchecked04')+"' data-lang='en'></span></a>\ 8258 </li>\ 8259 </ul>"; 8260 8261 $('.m-dashboard').showModalFlat('',html,false,false,'','','','changelang'); 8262 $('.modal-dialog.changelang').parents('.modal-default').attr('id','changelangModal'); 8263 8264 $('#changelangModal').on('show.bs.modal', function(e) { 8265 $('.dashlang-select > a').click(function() { 8266 var datalang = $('.dashlang-select .cl-check-lang').attr('data-lang'); 8267 8268 $('.cl-check-lang').each(function () { 8269 $(this).addClass('cl_icon_checked04').removeClass('cl_icon_unchecked04'); 8270 }); 8271 $(this).addClass('cl_icon_unchecked04').removeClass('cl_icon_checked04'); 8272 }); 8273 }); 8274 8275 $('#changelangModal').on('hide.bs.modal', function(e) { 8276 $('#nav.default-nav .header .navbar_right').css('zIndex',''); 8277 $('#nav.default-nav .header .navbar-header a.navbar-toggle').css('zIndex','120'); 8278 }); 8279 }, 8280 upgradePopup : function(){ 8281 $(this).showModalFlat('INFORMATION', 'ì¼í 기ë¥ì ì¼í ìê¸ì ë¡ ì´ì©ì´ ê°ë¥í©ëë¤.<br>ì¼í ìê¸ì ì ì² íì´ì§ë¡ ì´ëí ê¹ì?', true, true, function() { 8282 location.href = '/shoppingevent'; 8283 }, 'cancel', 'ì´ë','mUpgradeSmModal'); 8284 }, 8285 scrollheight : function() { 8286 var menuheight = $(window).height()-146; 8287 $('.m-header_user .mobile-menu .dropdown-menu').css('height',menuheight); 8288 } 8289 } 8290 8291 $.notSupported = { 8292 isPremiumBlock: function(type,type2,feature) { 8293 if(typeof type == 'undefined') type = ''; 8294 if(typeof type2 == 'undefined') type2 = ''; 8295 if(typeof feature == 'undefined') feature = ''; 8296 8297 return ( type2 == 'premium' 8298 || feature == 'premium' 8299 || $.inArray(type, ['latest','form','sync','review']) > -1 8300 || (type == 'forum' && $.inArray(type2, ['faq','qna']) > -1) 8301 ) ? true : false; 8302 }, 8303 check: function(type,type2,feature) { 8304 if(typeof type == 'undefined') type = ''; 8305 if(typeof type2 == 'undefined') type2 = ''; 8306 if(typeof feature == 'undefined') feature = ''; 8307 if(typeof fn == 'undefined') fn = ''; 8308 8309 if(!type && !type2 && !feature) return false; 8310 8311 var tmp_plan = (typeof property != 'undefined') ? property.VALIDPLAN : VALIDPLAN, 8312 tmp_plantype = (typeof property != 'undefined') ? property.VALIDTYPE : VALIDTYPE, 8313 checkFree = (!tmp_plan || tmp_plantype == 'PK') ? true : false, 8314 checkSM = (tmp_plan && tmp_plantype == 'SM') ? true : false, 8315 checkBN = (tmp_plan && tmp_plantype == 'BN') ? true : false, 8316 checkPremium = $.notSupported.isPremiumBlock(type,type2,feature); 8317 8318 var ns_val = false; 8319 if(checkFree) { 8320 if(checkPremium) ns_val = true; 8321 } else { 8322 if(!checkSM && $.inArray(type, ['review']) > -1) ns_val = true; 8323 if(!checkBN && !checkSM && $.inArray(type2, ['franchise map', 'franchise bar', 'mwd']) > -1) ns_val = true; 8324 } 8325 8326 if(type == 'calendar') { 8327 if(!checkBN && !checkSM && $.inArray(type2, ['mwd']) > -1) ns_val = true; 8328 } 8329 8330 return ns_val; 8331 }, 8332 set: function(sid, id, mode, upgrade) { 8333 8334 if(typeof id == 'undefined' || !id || $('[data-id="' + id + '"]:is(.element, .reorderBlock)').length == 0) return false;
8335 8336 var nsEl = $('[data-id="' + id + '"]:is(.element, .reorderBlock)'), 8337 checkSlim = (nsEl.height() < 351) ? true : false, 8338 n_service = (typeof PAGE_MODE != 'undefined' && PAGE_MODE=='c') ? SERVICE : property.SERVICE, 8339 page_mode = (typeof PAGE_MODE != 'undefined' && PAGE_MODE=='c') ? 'config' : 'render', 8340 is_gabia = (n_service.indexOf('gabia') > -1) ? '.gabia' : '', 8341 title_str = (mode=='video' && !upgrade) ? $.lang[LANG]['config.premium.not-supported.block.video.'+page_mode+'.gfycat'] : $.lang[LANG]['config.premium.not-supported.block']; 8342 var nsTitle = title_str; 8343 switch(mode) { 8344 case 'calendar': 8345 case 'contact': 8346 nsTitle = $.lang[LANG]['config.premium.not-supported.block.BN' + is_gabia] 8347 break; 8348 case 'review': 8349 nsTitle = $.lang[LANG]['config.premium.not-supported.block.SM' + is_gabia] 8350 break; 8351 default: 8352 nsTitle = title_str 8353 break; 8354 } 8355 var ns_html = ` 8356 <div class="cl-ns-wrap" data-blockmode="${mode}"> 8357 <div class="cl-ns-title">${nsTitle}</div> 8358 <div class="cl-ns-bottom"> 8359 ${ (upgrade) ? `<a class="cl-ns-btn color-b" href="${ 8360 (n_service.indexOf('gabia') > -1) ? 'https://www.gabia.com/mygabia/service' : `/upgrade/site/${sid}` 8361 }" target="_blank">${ $.lang[LANG]['config.premium.not-supported.block.btn.upgrade'] }</a>` : '' 8362 } 8363 <span class="cl-ns-btn color-w" onclick="elDelete(${id})">${$.lang[LANG]['config.premium.not-supported.block.btn.delete']}</span></div> 8364 </div> 8365 </div> 8366 `; 8367 8368 if(checkSlim) nsEl.addClass('cl-ns-slim'); 8369 else nsEl.removeClass('cl-ns-slim'); 8370 8371 nsEl.addClass('cl-not-supported'); 8372 nsEl.each(function() { 8373 if($(this).find('.cl-ns-wrap').length > 0) $(this).find('.cl-ns-wrap').replaceWith(ns_html); 8374 else $(this).append(ns_html); 8375 }); 8376 }, 8377 unset: function(id) { 8378 if(typeof id == 'undefined' || !id || $('[data-id="' + id + '"]:is(.element, .reorderBlock)').length == 0) return false; 8379 8380 var nsEl = $('[data-id="' + id + '"]:is(.element, .reorderBlock)'); 8381 nsEl.removeClass('cl-not-supported cl-ns-slim'); 8382 nsEl.find('.cl-ns-wrap').remove(); 8383 } 8384 } 8385 8386 8387 $.resource = { 8388 init : function() { 8389 var freeSearch = {'type' : '', 'page' : 1, 'text' : '', 'total' : 0}, 8390 fileDrag = false, 8391 depfolderClick = false, 8392 isFEdit = false, 8393 mouseX, mouseY, 8394 dragTooltipModal = $(); 8395 8396 var getResourceTooltip = function() { 8397 var $tooltip = $('#resource-tooltip-runtime'); 8398 if($tooltip.length) return $tooltip; 8399 8400 var $sourceTooltip = $('.resource-tooltip').first(); 8401 var tooltipHtml = '<div id="resource-tooltip-runtime" class="resource-tooltip"><img src="" alt="image move to folder"><span class="count">1</span></div>'; 8402 8403 if($sourceTooltip.length) { 8404 tooltipHtml = $('<div>').append($sourceTooltip.clone().attr('id', 'resource-tooltip-runtime').show()).html(); 8405 } 8406 8407 $tooltip = $(tooltipHtml); 8408 $('body').append($tooltip); 8409 8410 return $tooltip; 8411 }; 8412 8413 var hideResourceTooltip = function() { 8414 getResourceTooltip().stop(true, true).hide().removeClass('multiple'); 8415 }; 8416 8417 var moveResourceTooltip = function() { 8418 if(!fileDrag) return; 8419 8420 var $tooltip = getResourceTooltip(); 8421 if(!$tooltip.length) return; 8422 8423 $tooltip.css({ 8424 'top': mouseY + 14, 8425 'left': mouseX + 14 8426 }); 8427 }; 8428 8429 var updateResourceTooltip = function($item, forceShow) { 8430 if(!$item || !$item.length) return; 8431 8432 var $modal = $item.closest('.modal.in'),
8433 $tab = $modal.find('.modal-resourcebox .tab-content > .tab-pane.active'), 8434 $tooltip = getResourceTooltip(), 8435 $selected = $tab.find('ul.files .fitem.ui-selected'), 8436 $selectedBox = $tab.find('.resource-selected-ul'), 8437 $sourceItem = ($selected.length > 0) ? $selected.first() : $item.closest('.fitem'), 8438 str_count = $selectedBox.children('li').length || $selected.length || 1, 8439 str_img = $sourceItem.find('.fitem-img').attr('src') || $item.find('.fitem-img').attr('src') || ''; 8440 8441 if(!$modal.length || !$tooltip.length || !$sourceItem.length || !str_img) return; 8442 8443 dragTooltipModal = $modal; 8444 8445 $tooltip.toggleClass('multiple', str_count > 1) 8446 .find('img').attr('src', str_img).end() 8447 .find('.count').text(str_count); 8448 8449 moveResourceTooltip(); 8450 8451 if(forceShow || !$tooltip.is(':visible')) { 8452 $tooltip.stop(true, true).fadeIn(80); 8453 } 8454 }; 8455 8456 $(document) 8457 .off('mousemove.resourceTooltip mouseup.resourceTooltip') 8458 .on('mousemove.resourceTooltip', function(e) { 8459 mouseX = (typeof e.clientX != 'undefined') ? e.clientX : e.pageX; 8460 mouseY = (typeof e.clientY != 'undefined') ? e.clientY : e.pageY; 8461 8462 if(fileDrag) moveResourceTooltip(); 8463 }) 8464 .on('mouseup.resourceTooltip', function() { 8465 if(!fileDrag) return; 8466 hideResourceTooltip(); 8467 fileDrag = false; 8468 dragTooltipModal = $(); 8469 $('#nestableFolder .fli').removeClass('drag-selected'); 8470 }); 8471 8472 $('.modal-resourcebox ul.files').on('scroll', function(e) { 8473 var thisResourceTab = $(this).parents('.modal').find('.modal-resourcebox .tab-content > .tab-pane.active'), 8474 thisResourceFiles = thisResourceTab.find('ul.files'), 8475 rmode = thisResourceTab.attr('id').replace(/storage$/gi,''), 8476 fsort = thisResourceTab.find('.resource-ctrl-sort select').val(), 8477 fsearch = thisResourceTab.find('.resource-search-stx').val(), 8478 is_icon_hybrid_scroll = (rmode == 'icon' && typeof isIconStorageHybridMode == 'function' && isIconStorageHybridMode()), 8479 scroll_load_offset = (is_icon_hybrid_scroll && typeof ICON_STORAGE_LOAD_TRIGGER_OFFSET != 'undefined') ? ICON_STORAGE_LOAD_TRIGGER_OFFSET : 100; 8480 8481 if((this.scrollTop + this.clientHeight) > (this.scrollHeight - scroll_load_offset)) { 8482 var fitem_cnt = thisResourceFiles.find('.fitem').length; 8483 if(rmode == 'my' || rmode == 'icon') { 8484 if(is_icon_hybrid_scroll) { 8485 if(typeof canLoadMoreIconStorageCategory != 'function' || !canLoadMoreIconStorageCategory()) return; 8486 if(typeof appendIconStorageListProgress == 'function') appendIconStorageListProgress(thisResourceFiles); 8487 else if(thisResourceFiles.find('.listprogress').length == 0) thisResourceFiles.append('<li class="listprogress"><svg version="1.1" xmlns="http://www.w3.org/svg/2000" viewBox="0 0 30 30" width="60" style="width:30px; height: 30px;"><circle cy="15" cx="15" r="14" style="stroke:#00baff;"></circle></svg></li>'); 8488 loadNextIconStorageCategoryPage(); 8489 return; 8490 } 8491 if (fitem_cnt == cTotal) return; 8492 } else if(rmode == 'free') { 8493 if($.inArray(freeSearch.type, ['search','favor','used']) > -1 && freeSearch.total != 0) { 8494 if(fitem_cnt == freeSearch.total) return false; 8495 } 8496 } 8497 8498 if(thisResourceFiles.find('.listprogress').length == 0) { 8499 thisResourceFiles.append('<li class="listprogress">
8499<svg version="1.1" xmlns="http://www.w3.org/svg/2000" viewBox="0 0 30 30" width="60" style="width:30px; height: 30px;"><circle cy="15" cx="15" r="14" style="stroke:#00baff;"></circle></svg></li>'); 8500 if(rmode == 'my' || rmode == 'icon') { 8501 cPage = cPage + 1; 8502 resourceGetPage(cPage,SFOLDER_ACTIVE,fsort,fsearch); 8503 } else if(rmode == 'free') { 8504 getFreeImage(freeSearch.page,freeSearch.type,freeSearch.text); 8505 } 8506 8507 } 8508 } 8509 8510 if($(this).parents('.modal').find('.modal-resourcebox ul.files').data('uiSelectableScroll') && $(this).parents('.modal').find('.modal-resourcebox ul.files').data('uiSelectableScroll').dragged) 8511 $(this).parents('.modal').find('.modal-resourcebox ul.files').data('uiSelectableScroll')._updateUi({ doUpdateHelper: true }); 8512 }) 8513 8514 $(document) 8515 .on('click', '.resourcebox-frame .view-original', function(e) { 8516 e.preventDefault(); 8517 e.stopPropagation(); 8518 // thisResourceZoomable.empty(); 8519 8520 var thisResourceFrame = $('.resourcebox-frame #rframe'), 8521 thisResourceSlide = thisResourceFrame.find('.slide').eq(0); 8522 thisResourceZoomable = thisResourceFrame.find('.zoomable'); 8523 thisResourceOrgBtn = $(this); 8524 8525 thisResourceOrgBtn.toggleClass('fullscreen'); 8526 var ww = $(window).width() - 8, 8527 cw = thisResourceSlide.find('.slide-content').width(), 8528 scale = (thisResourceOrgBtn.hasClass('fullscreen')) ? (ww / cw).toFixed(15) : 1; 8529 8530 setSlideIconTooltip('.resourcebox-frame #rframe'); 8531 if(thisResourceOrgBtn.hasClass('dblclick')) thisResourceOrgBtn.removeClass('dblclick'); 8532 else thisResourceOrgBtn.tooltip('show'); 8533 setSlideImgScale(thisResourceSlide, scale); 8534 }) 8535 .on('dblclick', '.resourcebox-frame .slide-content', function(e) { 8536 var thisResourceFrame = $('.resourcebox-frame #rframe'), 8537 thisResourceOrgBtn = thisResourceFrame.find('.view-original'); 8538 8539 thisResourceOrgBtn.addClass('dblclick'); 8540 thisResourceOrgBtn.click(); 8541 }) 8542 .on('click', '.resourcebox-frame [class*="zoom-"]', function(e) { 8543 var thisResourceFrame = $('.resourcebox-frame #rframe'), 8544 thisResourceSlide = thisResourceFrame.find('.slide').eq(0), 8545 thisResourceOrgBtn = thisResourceFrame.find('.view-original'), 8546 scale = thisResourceFrame.find('.zoomable img').attr('data-scale'); 8547 if(scale === undefined) scale = 1; 8548 8549 if($(this).hasClass('zoom-in')) { 8550 thisResourceOrgBtn.removeClass('disabled').addClass('fullscreen'); 8551 scale = Number(scale) + 0.5; 8552 } else { 8553 if(scale > 1) scale = Number(scale) - 0.5; 8554 if(scale < 1) scale = 1; 8555 if(scale == 1) { 8556 thisResourceOrgBtn.removeClass('fullscreen'); 8557 } 8558 } 8559 8560 setSlideIconTooltip('.resourcebox-frame #rframe'); 8561 setSlideImgScale(thisResourceSlide, scale); 8562 }); 8563 8564 $('#el-fileupload, #el-iconstorage') 8565 .on('show.bs.modal', function(e) { 8566 var parentDocument = $(window.parent.document), 8567 $detail_modal = parentDocument.find('.product-detail-modal'); 8568 if($detail_modal.length) $detail_modal.addClass('overlap'); 8569
8570 var thisResourceTab = $(this).find('.modal-resourcebox .tab-content > .tab-pane.active'), 8571 thisResourceFiles = thisResourceTab.find('ul.files'), 8572 rmode = thisResourceTab.attr('id').replace(/storage$/gi,''), 8573 fsort = thisResourceTab.find('.resource-ctrl-sort select').val(), 8574 fsearch = thisResourceTab.find('.resource-search-stx').val(), 8575 forceIconStorageInitialLoad = false; 8576 8577 if($(this).attr('id') == 'el-iconstorage') { 8578 if(typeof resetIconStorageDefaultState == 'function') resetIconStorageDefaultState(); 8579 thisResourceTab = $('#iconstorage'); 8580 thisResourceFiles = thisResourceTab.find('ul.files'); 8581 thisResourceFiles.empty().addClass('ready'); 8582 rmode = 'icon'; 8583 fsort = 'total'; 8584 fsearch = ''; 8585 forceIconStorageInitialLoad = true; 8586 } 8587 8588 ADD = false; 8589 UPLOAD = 0; 8590 UPLOADED = 0; 8591 PROGRESS = 0; 8592 8593 var checkProperty = $(this).find('.modal-resourcebox .resource-useit').eq(0).attr('data-property'); 8594 if(rmode == 'my' && checkProperty == 'flink-change') { 8595 rmode = 'file'; 8596 thisResourceTab = $('#filestorage'); 8597 thisResourceFiles = thisResourceTab.find('ul.files'); 8598 } 8599 8600 var checkReady = forceIconStorageInitialLoad || thisResourceFiles.hasClass('ready'); 8601 if(checkReady) { 8602 cPage = 1; 8603 fsort = (rmode == 'icon') ? 'total' : 'date_desc'; 8604 fsearch = ''; 8605 } 8606 $.resource.modalInit(); 8607 if(checkReady) resourceGetPage(1,SFOLDER_ACTIVE,fsort,fsearch); 8608 8609 if(rmode == 'my') { 8610 thisResourceTab.find('.selectpicker + .btn.dropdown-toggle').attr('title',''); 8611 if(thisResourceTab.find('.fli.active').length == 0) thisResourceTab.find('.fli[data-id="all"]').click(); 8612 } 8613 8614 $(this).find('.modal-resourcebox .resource-useit').removeClass('clicked'); 8615 }) 8616 .on('hide.bs.modal', function(e) { 8617 var parentDocument = $(window.parent.document), 8618 $detail_modal = parentDocument.find('.product-detail-modal'); 8619 if($detail_modal.length) $detail_modal.removeClass('overlap'); 8620 $.resource.setMystorageFolder('nodrag',false); 8621 if($('#nestableFolder .fli[data-id="clEmptyFolder"]').length > 0 ) {//new folder name_input open 8622 $('#nestableFolder .fli[data-id="clEmptyFolder"]').remove(); 8623 isFEdit = false; 8624 } 8625 if($('#nestableFolder .fli .dd-fln').find('input').length > 0 ) { //edit folder name_input open 8626 $('#nestableFolder .fli .dd-fln').find('input').val('').closest('li.fli').find('.fln-group').remove(); 8627 isFEdit = false; 8628 } 8629 if($('#nestableFolder .fli.active').length > 0) { 8630 if($('#nestableFolder').scrollTop() > $('#nestableFolder .fli.active').position().top) { 8631 $('#nestableFolder').scrollTop($('#nestableFolder .fli.active').position().top); 8632 } 8633 } 8634 8635 if($('#el-property [data-loop-type="matrix"] .attach-thumb[data-toggle="modal"]').length > 0 ) { //clear matrix loop item - modal toggle 8636 var idx = $('#el-property [data-loop-type="matrix"] .attach-thumb[data-toggle="modal"]').attr('idx'); 8637 $('#el-property [data-loop-type="matrix"] .attach-thumb[data-toggle="modal"]').removeAttr('data-toggle'); 8638 8639 if(!$('#el-property [data-loop-type="matrix"] .ui-sortable').children().first().hasClass('active')) 8640 $('#el-property [data-loop-type="matrix"] .ui-sortable').children().first().click(); 8641 } 8642 8643 if(typeof selectEL != 'undefined' && selectEL && typeof $('.'+selectEL).attr('data-parallax') != "undefined" && $('.'+selectEL).attr('data-parallax')) { 8644 $('#prop-method-background').attr('data-target',''); 8645 } 8646 8647 $('#mystorage .add-folder').attr('data-content','').popover('hide'); 8648 $(this).find('.resource-useit').show(); 8649 selectCount = 0; 8650 }) 8651 .on('hidden.bs.modal', function(e) { 8652 if(typeof isEDIT != 'undefined' && isEDIT === false) editEL = ''; 8653 $(this).find('.resource-useit').removeClass('clicked'); 8654 $.resource.modalOpenSET(false); 8655 }) 8656 .on('mousemove', function(e) { 8657 mouseX = (typeof e.clientX != 'undefined') ? e.clientX : e.pageX; 8658 mouseY = (typeof e.clientY != 'undefined') ? e.clientY : e.pageY; 8659 if(fileDrag && $(this).is(':not(.flink-fileupload)')) moveResourceTooltip(); 8660 }) 8661 .on('mouseup', '.resource-files-content', function(e) { 8662 hideResourceTooltip(); 8663 fileDrag = false;
8664 dragTooltipModal = $(); 8665 }); 8666 8667 8668 8669 /* modal-resourcebox 00__common */ 8670 $('.modal-resourcebox') 8671 .on('click', '#btn-resourcebox-fullwidth', function(e) { 8672 $(this).closest('#el-fileupload').toggleClass('full-width'); 8673 }) 8674 .on('change', '.resource-ctrl-layout select', function(e) { 8675 $(this).next('.btn.dropdown-toggle').attr('title',''); 8676 var thisResourceFiles = $(this).closest('.tab-pane.active').find('ul.files'), 8677 layout = $(this).val(); 8678 8679 thisResourceFiles.attr('data-layout', layout); 8680 }) 8681 .on('change', '.resource-ctrl-sort select', function(e) { 8682 $(this).next('.btn.dropdown-toggle').attr('title',''); 8683 var thisResourceTab = $(this).closest('.tab-pane.active'); 8684 if(thisResourceTab.find('ul.files').hasClass('empty') || thisResourceTab.find('ul.files .resource-empty-area').length > 0) return false; 8685 else thisResourceTab.find('.resource-search-btn').click(); 8686 }) 8687 .on('keyup', '.resource-search-stx', function(e) { 8688 var keyCode = e.keyCode; 8689 if(keyCode == 13) $(this).closest('.resource-search-group').find('.resource-search-btn').click(); 8690 }) 8691 .on('focusin', '.resource-search-stx', function() { 8692 var $input = $(this); 8693 if($input.closest('#iconstorage').length > 0 && typeof setIconStorageSearchState == 'function') { 8694 var hasSearch = $input.val().trim() !== ''; 8695 setIconStorageSearchState(hasSearch, hasSearch); 8696 } 8697 }) 8698 .on('focusout', '.resource-search-stx', function() { 8699 var $input = $(this); 8700 if($input.closest('#iconstorage').length > 0 && typeof setIconStorageSearchState == 'function') { 8701 setTimeout(function() { 8702 var hasSearch = $input.val().trim() !== ''; 8703 setIconStorageSearchState(hasSearch, hasSearch); 8704 }, 0); 8705 } 8706 }) 8707 .on('click', '.resource-search-btn', function(e) { 8708 var thisSearchBtn = $(this), 8709 thisSearchInput = thisSearchBtn.closest('.resource-search-group').find('.resource-search-stx'), 8710 rmode = thisSearchBtn.attr('id').replace(/\-resource\-search$/gi,''), 8711 fsearch = thisSearchInput.val().trim(), 8712 fsort = (rmode == 'my') ? thisSearchBtn.closest('.resource-row').find('.resource-ctrl-sort select').val() : ''; 8713 8714 if(thisSearchBtn.hasClass('clicked')) return false; 8715 thisSearchBtn.addClass('clicked'); 8716 thisSearchBtn.data('fsearch', fsearch); 8717 8718 if(rmode == 'my' || rmode == 'icon') { 8719 thisSearchInput.val(fsearch); 8720 UPLOAD = 0; 8721 UPLOADED = 0; 8722 PROGRESS = 0; 8723 cPage = 1; 8724 if(rmode == 'icon') { 8725 var icon_type = (typeof getIconStorageType == 'function') ? getIconStorageType() : ($('#iconstorage .icon_type.active').attr('data-icontype') || 'default'); 8726 if(typeof normalizeIconStorageType == 'function') icon_type = normalizeIconStorageType(icon_type); 8727 if(typeof setIconStorageSearchState == 'function') setIconStorageSearchState(fsearch !== '', fsearch !== ''); 8728 fsort = fsearch ? 'total' : $('#iconstorage .resource-category-group').find('.fitem-category.active').attr('data-category'); 8729 if(fsearch) { 8730 var iconResourceFiles = $('#iconstorage ul.files'); 8731 if(typeof appendIconStorageListProgress == 'function') { 8732 iconResourceFiles.empty(); 8733 appendIconStorageListProgress(iconResourceFiles); 8734 } else if(iconResourceFiles.find('.listprogress').length == 0) { 8735 iconResourceFiles.empty().append('<li class="listprogress">
8735<svg version="1.1" xmlns="http://www.w3.org/svg/2000" viewBox="0 0 30 30" width="60" style="width:30px; height: 30px;"><circle cy="15" cx="15" r="14" style="stroke:#00baff;"></circle></svg></li>'); 8736 } 8737 setTimeout(function() { 8738 if(thisSearchInput.val().trim() != fsearch) { 8739 thisSearchBtn.removeClass('clicked'); 8740 return; 8741 } 8742 resourceGetPage(1,SFOLDER_ACTIVE,fsort,fsearch); 8743 }, 30); 8744 return false; 8745 } 8746 } 8747 resourceGetPage(1,SFOLDER_ACTIVE,fsort,fsearch); 8748 } else if(rmode == 'free') { 8749 if(fsearch == '') { 8750 freeSearch.type = 'new'; 8751 freeSearch.page = 1; 8752 freeSearch.text = ''; 8753 freeSearch.total = -1; 8754 $.resource.modalContentInit('free'); 8755 $('#freestorage .resource-folderlist li[data-type="new"]').addClass('active').siblings().removeClass('active'); 8756 $('#freestorage ul.files').attr('data-type','new'); 8757 getFreeImage(freeSearch.page,freeSearch.type); 8758 return false; 8759 } 8760 $('#freestorage .resource-useit').removeClass('active'); 8761 $('#freestorage ul.files, #freestorage .resource-selected-ul').empty(); 8762 $('#freestorage .resource-search-total').text(''); 8763 $('#freestorage ul.files').append('<li class="listprogress"><svg version="1.1" xmlns="http://www.w3.org/svg/2000" viewBox="0 0 30 30" width="60" style="width:30px; height: 30px;"><circle cy="15" cx="15" r="14" style="stroke:#00baff;"></circle></svg></li>'); 8764 $('#freestorage .resource-folderlist li').removeClass('active'); 8765 8766 freeSearch.type = 'search'; 8767 freeSearch.page = 1; 8768 freeSearch.text = fsearch; 8769 freeSearch.total = 0; 8770 8771 $.getJSON('/template/translate/' + encodeURIComponent(fsearch), function(data) { 8772 if($('#freestorage .resource-search-stx').val().trim() != fsearch) { 8773 thisSearchBtn.removeClass('clicked'); 8774 if(freeSearch.text == fsearch) $('#freestorage ul.files .listprogress').remove(); 8775 return false; 8776 } 8777 var search = (data && data.data && data.data.translations && data.data.translations[0] && data.data.translations[0].translatedText) ? data.data.translations[0].translatedText : fsearch; 8778 freeSearch.text = fsearch; 8779 getFreeImage(freeSearch.page,freeSearch.type,search); 8780 }).fail(function() { 8781 if($('#freestorage .resource-search-stx').val().trim() != fsearch) { 8782 thisSearchBtn.removeClass('clicked'); 8783 if(freeSearch.text == fsearch) $('#freestorage ul.files .listprogress').remove(); 8784 return false; 8785 } 8786 freeSearch.text = fsearch; 8787 getFreeImage(freeSearch.page,freeSearch.type,fsearch); 8788 }); 8789 } 8790 }).on('input', '.resource-search-stx', function() { 8791 var $input = $(this); 8792 var $searchBtn = $input.closest('.resource-search-group').find('.resource-search-btn'); 8793 if($input.closest('#iconstorage').length > 0 && typeof setIconStorageSearchState == 'function') { 8794 var hasIconSearch = $input.val().trim() !== ''; 8795 setIconStorageSearchState(hasIconSearch, hasIconSearch); 8796 if(hasIconSearch && $searchBtn.data('fsearch') != $input.val().trim()) { 8797 var iconResourceFiles = $('#iconstorage ul.files'); 8798 if(typeof appendIconStorageListProgress == 'function') { 8799 iconResourceFiles.empty(); 8800 appendIconStorageListProgress(iconResourceFiles); 8801 } else if(iconResourceFiles.find('.listprogress').length == 0) { 8802 iconResourceFiles.empty().append('<li class="listprogress">
8802<svg version="1.1" xmlns="http://www.w3.org/svg/2000" viewBox="0 0 30 30" width="60" style="width:30px; height: 30px;"><circle cy="15" cx="15" r="14" style="stroke:#00baff;"></circle></svg></li>'); 8803 } 8804 } 8805 } 8806 clearTimeout($input.data('searchTimer')); 8807 if($searchBtn.data('fsearch') != $input.val().trim()) { 8808 $searchBtn.removeClass('clicked'); 8809 } 8810 8811 $input.data('searchTimer', setTimeout(function () { 8812 $searchBtn.trigger('click'); 8813 }, 400)); 8814 }) 8815 .on('scroll', 'ul.files', function(e) { 8816 }) 8817 .on('mousedown', 'ul.files', function(e) { 8818 var thisResourceTab = $(this).closest('.tab-pane.active'), 8819 thisResourceFiles = $(this), 8820 thisResourceSelected = thisResourceTab.find('.resource-selected-ul'), 8821 rmode = thisResourceTab.attr('id').replace(/storage$/gi,''); 8822 8823 if(rmode == 'my' && isFEdit) thisResourceTab.find('#nestableFolder .fln-group .btn-fln-cancel').click(); 8824 8825 if(e.shiftKey) { 8826 thisResourceSelected.children('li').each(function () { 8827 var set_key = (rmode == 'free') ? 'id' : 'seq', 8828 set_val = $(this).attr('data-'+set_key); 8829 if(thisResourceFiles.find('.ui-selected .fitem-ctrl > ul[data-' + set_key + '="' + set_val + '"]').length == 0) { 8830 thisResourceFiles.find('.fitem-ctrl > ul[data-' + set_key + '="' + set_val + '"]').closest('.fitem').addClass('ui-selected'); 8831 } 8832 }); 8833 } else { 8834 if(!e.ctrlKey && !$(e.target).hasClass('.ui-selected')) { 8835 $(e.target).removeClass('ui-selected'); 8836 } 8837 } 8838 }) 8839 .on('click', '.fitem', function(e) { 8840 var thisResourceTab = $(this).closest('.tab-pane.active'), 8841 thisResourceSelected = thisResourceTab.find('.resource-selected-ul'), 8842 rmode = thisResourceTab.attr('id').replace(/storage$/gi,''); 8843 8844 if(e.ctrlKey || e.shiftKey) { 8845 if($(this).hasClass('ui-selected')) { 8846 $(this).removeClass('ui-selected'); 8847 var unset_key = (rmode == 'free') ? 'id' : 'seq', 8848 unset_val = $(this).find('.fitem-ctrl > ul').attr('data-'+unset_key); 8849 thisResourceSelected.children('li[data-' + unset_key + '="' + unset_val + '"]').remove(); 8850 } 8851 8852 setResourceSelectedBox(rmode); 8853 } 8854 }) 8855 .on('click', '.fitem-ctrl-imgview', function(e) { 8856 var thisResourceTab = $(this).closest('.tab-pane.active'), 8857 thisResourceCtrlImgview = $(this); 8858 8859 $('.modal-resourcebox .fitem-ctrl-imgview').removeAttr('href').removeAttr('data-gallery'); 8860 $('.resourcebox-frame').html('\ 8861 <div id="rframe" class="blueimp-gallery blueimp-gallery-controls" data-start-slideshow="false" data-slideshow-interval="5000">\ 8862 <div class="slides"></div>\ 8863 <div class="zoomable hide"></div>\ 8864 <h3 class="title"></h3>\ 8865 <ul class="ctrls">\ 8866 <li>\ 8867 <a class="view-original" data-toggle="tooltip" data-placement="bottom" data-html="true" data-original-title="' + $.lang[LANG]['gallery.slide.tooltip.view-fullscreen'] + '">\ 8868 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 27 27" width="27" height="27"><g><path d="M1 4.12v18.75h25V4.12H1zm23.5 17.26h-22V5.62h22v15.76z"/><path d="M8.03 18.19h1.56V8.81H6.47v1.57h1.56zM12.72 10.38h1.56v1.56h-1.56zM12.72 15.06h1.56v1.56h-1.56zM18.19 18.19h1.56V8.81h-3.13v1.57h1.57z"/></g></svg>\ 8869 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 27 27" width="27" height="27"><path d="M24.03 4.03 24 4V3h-1l-.03-.03-.03.03H13.5v1.5h7.94L4.5 21.44V13.5H3v9.44l-.03.03L3 23v1h1l.03.03.03-.03h9.44v-1.5H5.56L22.5 5.56v7.94H24V4.06z"/></svg>\ 8870 </a>\ 8871 </li>\ 8872 <li><a class="zoom-out disabled" data-toggle="tooltip" data-placement="bottom" data-html="true" data-original-title="' + $.lang[LANG]['gallery.slide.tooltip.zoom-out'] + '"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 23 23" width="23" height="23"><g><path d="m23 21.98-6.16-6.16a9.566 9.566 0 0 0 2.32-6.24C19.17 4.29 14.88 0 9.58 0S0 4.29 0 9.58s4.29 9.58 9.58 9.58c2.39 0 4.57-.88 6.24-2.32L21.98 23 23 21.98zM1.44 9.58c0-4.49 3.65-8.15 8.15-8.15 4.49 0 8.15 3.65 8.15 8.15s-3.65 8.15-8.15 8.15-8.15-3.66-8.15-8.15z"></path><path d="M5.75 8.86h7.67v1.44H5.75z"></path></g></svg></a></li>\ 8873 <li><a class="zoom-in" data-toggle="tooltip" data-placement="bottom" data-html="true" data-original-title="' + $.lang[LANG]['gallery.slide.tooltip.zoom-in'] + '"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">
8873<path d="M24 22.94l-6.42-6.42C19.08 14.76 20 12.49 20 10c0-5.52-4.48-10-10-10S0 4.48 0 10s4.48 10 10 10c2.49 0 4.76-0.92 6.52-2.42L22.94 24 24 22.94zM1.5 10c0-4.69 3.81-8.5 8.5-8.5 4.69 0 8.5 3.81 8.5 8.5s-3.81 8.5-8.5 8.5C5.31 18.5 1.5 14.69 1.5 10z"/><polygon points="10.75 6 9.25 6 9.25 9.25 6 9.25 6 10.75 9.25 10.75 9.25 14 10.75 14 10.75 10.75 14 10.75 14 9.25 10.75 9.25 "/></svg></a></li>\ 8874 <li><a class="close"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 22" width="22" height="22"><polygon points="22 1.06 20.94 0 11 9.94 1.06 0 0 1.06 9.94 11 0 20.94 1.06 22 11 12.06 20.94 22 22 20.94 12.06 11 "/></svg></a><li>\ 8875 </ul>\ 8876 </div>\ 8877 '); 8878 thisResourceCtrlImgview.attr('href', $(this).attr('data-url')).attr('data-gallery','#rframe'); 8879 }) 8880 .on('mouseenter', '.resource-selected-ul > li', function(e) { 8881 $(this).find('.selected-hover').show(); 8882 }) 8883 .on('mouseleave', '.resource-selected-ul > li', function(e) { 8884 $(this).find('.selected-hover').hide(); 8885 }) 8886 .on('click', '.resource-selected-ul > li > .selected-hover', function(e) { 8887 $(this).popover('destroy'); 8888 8889 var thisResourceTab = $(this).closest('.tab-pane.active'), 8890 thisResourceFiles = thisResourceTab.find('ul.files'), 8891 thisResourceSelected = thisResourceTab.find('.resource-selected-ul'), 8892 rmode = thisResourceTab.attr('id').replace(/storage$/gi,''); 8893 8894 $(this).closest('li').fadeOut(300,function() { 8895 var del_key = (rmode == 'free') ? 'id' : 'seq', 8896 del_val = $(this).attr('data-'+del_key); 8897 $(this).remove(); 8898 8899 thisResourceFiles.find('.fitem.ui-selected .fitem-ctrl > ul[data-' + del_key + '="' + del_val + '"]').closest('.fitem').removeClass('ui-selected'); 8900 setResourceSelectedBox(rmode); 8901 }); 8902 8903 if(thisResourceSelected.children('li').length == 1) { 8904 thisResourceTab.find('.resource-useit').removeClass('active'); 8905 } 8906 }); 8907 8908 var folderSearchTimer = null; 8909 $('.modal-resourcebox') 8910 // Enterí¤ë¡ ì¦ì íí° 8911 .on('keyup', '.folder-search-stx', function(e){ 8912 var keyCode = e.keyCode; 8913 if(keyCode == 13) $(this).closest('.folder-search-group').find('.folder-search-btn').trigger('click'); 8914 }) 8915 8916 // íì´í ë©ì¶ë©´ ìë íí°(0.3~0.5ì´ ì¶ì²) 8917 .on('input', '.folder-search-stx', function(){ 8918 var $input = $(this); 8919 clearTimeout(folderSearchTimer); 8920 folderSearchTimer = setTimeout(function(){ 8921 $input.closest('.folder-search-group').find('.folder-search-btn').trigger('click'); 8922 }, 300); 8923 }) 8924 8925 .on('click', '.folder-search-stx', function(){ 8926 $('#nestableFolder .fli[data-id="clEmptyFolder"]').remove(); 8927 $('#nestableFolder .btn-fln-cancel').trigger('click'); 8928 isFEdit = false; 8929 }) 8930 8931 // ë²í¼ í´ë¦ ì íí°ë§ ì¤í 8932 .on('click', '.folder-search-btn', function(){ 8933 var $group = $(this).closest('.folder-search-group'); 8934 var q = $group.find('.folder-search-stx').val().trim().toLowerCase(); 8935 8936 var $items = $('#nestableFolder .dd-list.fll > .fli'); 8937 8938 // ë¹ì´ìì¼ë©´ ì ì²´ íì 8939 if(q === ''){ 8940 if(isFEdit) { 8941 var $cancelBtn = $('#nestableFolder .fln-group .btn-fln-cancel'); 8942 if($cancelBtn.length > 0) $cancelBtn.trigger('click'); 8943 } 8944 8945 $('#nestableFolder .fli[data-id="clEmptyFolder"]').remove(); 8946 isFEdit = false;
8947 $.resource.setMystorageFolder('nodrag',false); 8948 $items.show(); 8949 return; 8950 } 8951 8952 $items.each(function(){ 8953 var $li = $(this); 8954 8955 if($li.hasClass('fli-first')) { $li.show(); return; } 8956 // í´ëëª í ì¤í¸(ë²ì ë¤ì´ê°ë spanì´ë¼ë text()ë ëìµëë¤) 8957 var name = $li.find('.dd-fln').text().trim().toLowerCase(); 8958 8959 // "all" ê°ì í¹ì í목ì íì ë³´ì´ê² íê³ ì¶ì¼ë©´ ìëì²ë¼ ìì¸ì²ë¦¬ ê°ë¥ 8960 // if($li.hasClass('fli-first')) { $li.show(); return; } 8961 8962 $li.toggle(name.indexOf(q) !== -1); 8963 }); 8964 }); 8965 8966 /* modal-resourcebox 01__mystorage */ 8967 var mystorageFolderEdit = function(ddfl) { 8968 var myResourceFolderlist = $('#mystorage #nestableFolder'), 8969 edit_fli = ddfl.closest('li.fli'), 8970 fln_group_css = (myResourceFolderlist.find('.dd-list.fll').height() >= myResourceFolderlist.height() && $.browser.safari == undefined) ? 'style="max-width: 173px;"' : '', 8971 fln_input_css = (myResourceFolderlist.find('.dd-list.fll').height() >= myResourceFolderlist.height() && $.browser.safari == undefined) ? 'style="max-width: 136px;"' : '', 8972 checkAdd = (edit_fli.attr('data-id') == 'clEmptyFolder') ? true : false, 8973 beforeFln = (checkAdd) ? '' : edit_fli.attr('data-id'); 8974 8975 if(beforeFln.length > 0) beforeFln = beforeFln.replace(/-/g,' '); 8976 8977 var input_html = '\ 8978 <div class="fln-group input-group" ' + fln_group_css + '>\ 8979 <input class="fln-input form-control" type="text" value="' + beforeFln + '" ' + fln_input_css + '/>\ 8980 <span class="input-group-btn"><button class="btn-fln-save btn btn-default btn-primary" type="button"><i class="fa fa-check"></i></button></span>\ 8981 <div class="btn-fln-cancel"><i class="fa fa-times"></i></div>\ 8982 </div>\ 8983 '; 8984 8985 $(input_html).appendTo(edit_fli.find('.dd-fln')); 8986 if(edit_fli.find('.fln-input').is(':not(:focus)')) edit_fli.find('.fln-input').focus(); 8987 8988 $.resource.setMystorageFolder('nodrag',true); 8989 } 8990 8991 var mystorageFolderUpdate = function(prevText,newText) { 8992 $.ajax({ 8993 type: 'POST', 8994 url: '/template/resource/update-ffolder', 8995 data: { sid: SID, prevffolder: prevText, newffolder: newText }, 8996 async: true, 8997 success: function(data) { 8998 checkError(data); 8999 } 9000 }); 9001 } 9002 9003 var getNextMystorageFolderId = function() { 9004 var maxId = 0; 9005 9006 if (SFOLDER && Array.isArray(SFOLDER) && SFOLDER.length) { 9007 $.each(SFOLDER, function(_, folder) { 9008 var id = parseInt(folder && folder.id, 10); 9009 if (!isNaN(id) && id > maxId) maxId = id; 9010 }); 9011 } 9012 9013 $('#nestableFolder .fli').each(function() { 9014 var id = parseInt($(this).attr('data-fid'), 10); 9015 if (!isNaN(id) && id > maxId) maxId = id; 9016 }); 9017 9018 return maxId + 1; 9019 } 9020 9021 var mystorageFileDelete = function(file,seq,callback) { 9022 if(CANCEL) return true; 9023 $.ajax({ 9024 type: 'POST', 9025 url: '/template/resource/delete', 9026 data: { s: file, sid: SID, seq: seq }, 9027 async: true, 9028 success: function(data) { 9029 checkError(data); 9030 if(typeof callback == 'function') { 9031 callback(); 9032 } 9033 } 9034 }); 9035 } 9036 9037 $('.modal-resourcebox') 9038 .on('click', 'a[href="#mystorage"]', function(e) { 9039 setResourceSelectedBox('my'); 9040 if(isFEdit) $('#nestableFolder .fln-group .btn-fln-cancel').click(); 9041 }); 9042 9043 $('.modal-resourcebox #mystorage') 9044 .on('scroll touchmove mousewheel', '#nestableFolder', function(e) { 9045 if(isFEdit || $(this).find('.fln-group.input-group').length > 0) { 9046 e.preventDefault(); 9047 return false;
9048 } 9049 var myResourceTab = $(this).closest('.tab-pane.active'), 9050 myResourceFolderlist = $(this); 9051 9052 if(myResourceTab.find('.dd-header .popover.in').length > 0) { 9053 var inputEL = myResourceFolderlist.find('.fln-input'), 9054 checkScroll = (myResourceFolderlist.find('.dd-list.fll').height() >= myResourceFolderlist.height()) ? true : false, 9055 offset = myResourceTab.find('.dd-header').outerHeight() + 3, 9056 top = (checkScroll) ? inputEL.closest('li').position().top - myResourceFolderlist.scrollTop() : inputEL.offset().top - myResourceFolderlist.offset().top; 9057 myResourceTab.find('.dd-header .popover.in').css('top', offset + top); 9058 } 9059 }) 9060 .on('mouseup', '#nestableFolder .fli', function(e) { 9061 var fliFolder = $('#nestableFolder'), 9062 fliResourceTab = $(this).closest('.tab-pane.active'), 9063 fliResourceFiles = fliResourceTab.find('ul.files'), 9064 fliResourceSelected = fliResourceTab.find('.resource-selected-ul'), 9065 rmode = fliResourceTab.attr('id').replace(/storage$/gi,''), 9066 fsort = fliResourceTab.find('.resource-ctrl-sort select').val(), 9067 fsearch = fliResourceTab.find('.resource-search-stx').val(); 9068 9069 if(fileDrag) { 9070 fliResourceFiles.find('.fitem .fitem-visual').removeClass('ui-selected'); 9071 fliFolder.find('.fli').removeClass('drag-selected'); 9072 9073 // selected-files íì¼ì $.postë¡ ë³´ë´ê³ 리ì¤í¸ íì´ì§ ê°±ì 9074 var prevffolder = [], fsizes = [], fseqs = [], 9075 targetffolder = $(this).attr('data-id'); 9076 9077 fliResourceSelected.children('li').each(function() { 9078 prevffolder.push($(this).attr('data-ffolder')); 9079 fsizes.push(parseInt($(this).find('p.selected-file-size .size').text())); 9080 fseqs.push($(this).attr('data-seq')); 9081 }); 9082 9083 if(SID) { 9084 var activeffolder = fliFolder.find('.fli.active').attr('data-id'), 9085 r_pages = Number(fliResourceTab.find('.resource-paging .pagination').attr('data-pages')), 9086 r_page = Number(fliResourceTab.find('.resource-paging .pagination li.active').text()), 9087 r_file_cnt = fliResourceFiles.find('.fitem').length; 9088 9089 $.post('/template/resource/update-fmove', { sid: SID, fseqs: fseqs, targetffolder: targetffolder }, function (data) { 9090 checkError(data); 9091 $.each(fseqs, function(i,v) { 9092 if(prevffolder[i] != targetffolder) { 9093 if(prevffolder[i] != 'all') $.resource.setMystorageFolder('set_fli_state', {'count': -1, 'size': -fsizes[i], ffolder: prevffolder[i], state: 'move'}); 9094 if(targetffolder != 'all') $.resource.setMystorageFolder('set_fli_state', {'count': 1, 'size': fsizes[i], ffolder: targetffolder, state: 'move'}); 9095 } 9096 }); 9097 updateOutputFolder($('#nestableFolder').data('output', $('#nestableFolder-output'))); 9098 9099 r_page = ((r_file_cnt - fseqs.length) == 0 && r_pages<=r_page && SFOLDER_ACTIVE) ? r_page-1 : r_page; 9100 r_page = 1; 9101 cPage = 1; 9102 resourceGetPage(r_page,SFOLDER_ACTIVE,fsort,fsearch); 9103 9104 fliResourceFiles.find('.fitem .resource-image.ui-selected').removeClass('ui-selected'); 9105 fliResourceFiles.find('.fitem.ui-selected').removeClass('ui-selected'); 9106 fliResourceSelected.empty(); 9107 setResourceSelectedBox(rmode); 9108 }, 'json'); 9109 } 9110 } 9111 }) 9112 .on('mouseenter', '#nestableFolder .fli', function(e) { 9113 $('#nestableFolder .fli').removeClass('drag-selected'); 9114 if(fileDrag) { 9115 $(this).addClass('drag-selected'); 9116 } 9117 }) 9118 .on('mouseleave', '#nestableFolder .fli', function(e) { 9119 $(this).removeClass('drag-selected').siblings().removeClass('drag-selected'); 9120 }) 9121 .on('click', '#nestableFolder .fli:not(.active)', function(e) { 9122 if( isFEdit || 9123 $(e.target).is('.fln-input, .fli-hover, [class*="btn-fln-"]') 9124 ) { return; } 9125 9126 if($(this).parents('.fll').length == 2) depfolderClick = true; 9127 if($(this).parents('.fll').length == 1 && depfolderClick) { 9128 depfolderClick = false;
9129 return; 9130 } else { 9131 $(this).addClass('active').siblings('.fli').removeClass('active'); 9132 SFOLDER_ACTIVE = ($(this).attr('data-id')!='all') ? $(this).attr('data-id') : ''; 9133 cPage = 1; 9134 9135 var myResourceTab = $('#mystorage'), 9136 fsort = myResourceTab.find('.resource-ctrl-sort select').val(); 9137 myResourceTab.find('.resource-search-stx').val(''); 9138 resourceGetPage(1,SFOLDER_ACTIVE,fsort,''); 9139 } 9140 }) 9141 .on('click', '#nestableFolder .fli .dd-fle', function(e) { 9142 if(isFEdit) { return; } 9143 if($(this).parent().closest('.fli').index() > 0) { 9144 isFEdit = true; 9145 mystorageFolderEdit($(this)); 9146 } 9147 }) 9148 .on('click', '#nestableFolder .fli .dd-fln .btn-fln-cancel', function(e) { 9149 $('#mystorage .add-folder').attr('data-content','').popover('hide'); 9150 if($(this).closest('li.fli').attr('data-id') == 'clEmptyFolder') $(this).closest('li.fli').remove(); 9151 else { 9152 $(this).closest('.dd-fln').find('.fln-group').remove(); 9153 $(this).remove(); 9154 } 9155 isFEdit = false; 9156 $.resource.setMystorageFolder('nodrag',false); 9157 if($('#nestableFolder .fll .fli.active').length == 0) $('#nestableFolder .fli').eq(0).click(); 9158 }) 9159 .on('click', '#nestableFolder .fli .dd-flf', function (e) { 9160 e.preventDefault(); 9161 e.stopPropagation(); 9162 9163 var $item = $(this).closest('.dd-item'); 9164 var $fav = $(this); 9165 9166 var fid = String($item.attr('data-fid') || '').trim(); 9167 9168 var raw = $('#nestableFolder-output').val(); 9169 if (!raw || raw.trim().length === 0 || raw === '[]') { 9170 raw = (SFOLDER && Array.isArray(SFOLDER) && SFOLDER.length) ? JSON.stringify(SFOLDER) : '[]'; 9171 $('#nestableFolder-output').val(raw); 9172 } 9173 9174 var data = []; 9175 var next = null; 9176 if (SFOLDER && Array.isArray(SFOLDER) && SFOLDER.length) { 9177 data = $.extend(true, [], SFOLDER); 9178 } else { 9179 try { data = JSON.parse(raw); } catch (err) { data = []; } 9180 } 9181 9182 if (!data.length || !fid) return false; 9183 9184 $.each(data, function (i, folder) { 9185 if (String(folder.id) !== fid) return true; 9186 9187 var cur = String(folder.favorite || '0'); 9188 next = (cur === '1') ? '0' : '1'; 9189 folder.favorite = next; 9190 return false; 9191 }); 9192 9193 if (next === null) return false; 9194 9195 $item.attr('data-favorite', next); 9196 $fav.attr('data-fav', next).html((next === '1') ? clSVG('pin', 12, 12) : clSVG('pin_blank', 12, 12)); 9197 9198 // 3) output ê°±ì + SFOLDER ê°±ì 9199 SFOLDER = data; 9200 $('#nestableFolder-output').val(JSON.stringify(data)); 9201 var nextVal = sortFolderFavoritesTop(); 9202 if (!nextVal || nextVal === '[]') { 9203 nextVal = JSON.stringify(SFOLDER); 9204 $('#nestableFolder-output').val(nextVal); 9205 } 9206 9207 // 4) ìë² ì ì¥ 9208 if (SID) { 9209 $.ajaxSetup({ async: false }); 9210 $.post('/template/update/type/folder', { s: nextVal, id: SID }, function (res) { 9211 checkError(res); 9212 }, 'json'); 9213 } 9214 9215 return false;
9216 }) 9217 .on('click', '#nestableFolder .fli .dd-fln .btn-fln-save', function(e) { 9218 var myResourceTab = $(this).closest('.tab-pane.active'), 9219 myResourceFiles = myResourceTab.find('ul.files'), 9220 myResourceFolderlist = myResourceTab.find('#nestableFolder'), 9221 myResourceFolderItem = $(this).closest('li.fli'), 9222 checkPageReload = myResourceFolderItem.hasClass('active'), 9223 fsort = myResourceTab.find('.resource-ctrl-sort select').val(), 9224 fsearch = myResourceTab.find('.resource-search-stx').val(), 9225 inputEL = $(this).closest('.fln-group').find('.fln-input'), 9226 regExp = /[\{\}\[\]\/!?.,;:|\)*~`^\-_+<>@\#$%&\\\=\(\'\"]/gi, 9227 err_str = '', 9228 checkAdd = (myResourceFolderItem.attr('data-id') == 'clEmptyFolder') ? true : false, 9229 beforeFln = (checkAdd) ? '' : myResourceFolderItem.attr('data-id'), 9230 afterFln = inputEL.val().trim(); 9231 9232 if(afterFln.length == 0) { 9233 err_str = $.lang[LANG]['editor.resource.regExp.empty']; 9234 } else if(afterFln == 'clEmptyFolder') { 9235 err_str = $.lang[LANG]['editor.resource.regExp.clEmptyFolder']; 9236 } else if(checkEmojis(afterFln)) { 9237 err_str = $.lang[LANG]['config.unable.emoji']; 9238 } else if(regExp.test(afterFln)) { 9239 err_str = $.lang[LANG]['editor.resource.regExp.specialchar']; 9240 } else if($('#nestableFolder .fli[data-id="'+afterFln.replace(/ /g,'-')+'"]').length > 0 && beforeFln != afterFln.replace(/ /g,'-')) { 9241 err_str = $.lang[LANG]['editor.resource.regExp.overlap']; 9242 } else if(afterFln.length > 20) { 9243 err_str = $.lang[LANG]['editor.resource.regExp.maximum']; 9244 } else { 9245 err_str = ''; 9246 } 9247 9248 afterFln = afterFln.replace(/ /g,'-'); 9249 if(err_str!=''){ 9250 inputEL.focus(); 9251 myResourceTab.find('.add-folder').attr('data-content',err_str).popover('show'); 9252 9253 var checkScroll = (myResourceFolderlist.find('.dd-list.fll').height() >= myResourceFolderlist.height()) ? true : false, 9254 offset = myResourceTab.find('.dd-header').outerHeight() + 3, 9255 top = (checkScroll) ? inputEL.closest('li').position().top - myResourceFolderlist.scrollTop() : inputEL.offset().top - myResourceFolderlist.offset().top; 9256 myResourceTab.find('.dd-header .popover.in').css('top', offset + top); 9257 } else { 9258 myResourceTab.find('.add-folder').attr('data-content','').popover('hide'); 9259 9260 if(checkAdd) { 9261 var newFid = parseInt(myResourceFolderItem.attr('data-fid'), 10); 9262 if(isNaN(newFid) || newFid < 1) { 9263 myResourceFolderItem.attr('data-fid', getNextMystorageFolderId()); 9264 } 9265 } 9266 9267 inputEL.closest('.fli').attr('data-id',afterFln).find('[attr-id]').attr('attr-id',afterFln); 9268 inputEL.closest('.dd-fln').html(afterFln.replace(/-/g,' ')); 9269 updateOutputFolder($('#nestableFolder').data('output', $('#nestableFolder-output'))); 9270 mystorageFolderUpdate(beforeFln,afterFln); 9271 9272 if(checkPageReload) { 9273 SFOLDER_ACTIVE = afterFln; 9274 resourceGetPage(1,SFOLDER_ACTIVE,fsort,fsearch); 9275 } else { 9276 myResourceFiles.find('.fitem .data-ffolder ul[data-ffolder="'+beforeFln+'"]').each(function() { 9277 $(this).attr('data-ffolder',afterFln); 9278 }) 9279 } 9280 9281 isFEdit = false;
9282 $.resource.setMystorageFolder('nodrag',false); 9283 } 9284 }) 9285 .on('keyup', '#nestableFolder .fli .dd-fln .fln-input', function(e) { 9286 if(e.keyCode == 13) $(this).closest('.fln-group').find('.btn-fln-save').click(); 9287 }) 9288 .on('click', '#nestableFolder .fli .dd-fld', function(e) { 9289 if(isFEdit) { return; } 9290 if($('#nestableFolder .fll > .fli').length < 2) { return false; } 9291 9292 isFEdit = true; 9293 $.resource.setMystorageFolder('nodrag',true); 9294 var myResourceTab = $('#mystorage'), 9295 myResourceFiles = myResourceTab.find('ul.files'), 9296 myResourceSelected = myResourceTab.find('.resource-selected-ul'), 9297 myResourceFolderItem = $(this).closest('li.fli'), 9298 checkPageReload = (myResourceFolderItem.hasClass('active') || $('#nestableFolder .fli[data-id="all"]').hasClass('active')) ? true : false, 9299 fsort = myResourceTab.find('.resource-ctrl-sort select').val(), 9300 fsearch = myResourceTab.find('.resource-search-stx').val(); 9301 9302 var fli_count = myResourceFolderItem.find('.dd-flc').attr('attr-count'); 9303 fli_count = (typeof fli_count != 'undefined' && /^[0-9]*$/.test(fli_count)) ? fli_count * 1 : 0; 9304 if(fli_count > 0) { 9305 var prevffolder = myResourceFolderItem.attr('data-id'); 9306 var modal_str = '\ 9307 <div class="popup-info edit-link-info">'+$.lang[LANG]['editor.resource.folder.delete.confirm']+'</div>\ 9308 <ul class="duplicate-gallery-content delete-folder">\ 9309 <li class="link-type active">\ 9310 <div class="delete">\ 9311 ' + clSVG('checkbox_active',20,20,false) + '\ 9312 <h5>'+$.lang[LANG]['editor.resource.folder.delete.folderOnly']+'</h5>\ 9313 </div>\ 9314 </li>\ 9315 <li class="link-type">\ 9316 <div class="delete-with-resource">\ 9317 ' + clSVG('checkbox_active',20,20,false) + '\ 9318 <h5>'+$.lang[LANG]['editor.resource.folder.delete.all']+'</h5>\ 9319 </div>\ 9320 </li>\ 9321 </ul>\ 9322 '; 9323 9324 var modal = $(this).showModalFlat($.lang[LANG]['editor.resource.folder.delete'], modal_str, true, true, function() { 9325 var checked = $('.link-type.active').find('div').attr('class'); 9326 9327 $.ajaxSetup({ async : true }); 9328 if(checked == 'delete-with-resource') { 9329 checkPageReload = true; 9330 $.post('/template/resource/get-folder-resource', { sid: SID, prevffolder: prevffolder }, function (data) { 9331 checkError(data); 9332 9333 var files = data.files; 9334 var fileDeleteModal = $(this).showModalFlat($.lang[LANG]['config.common.resource.delete.title'],$.lang[LANG]['config.common.resource.delete'], true, true, function() { 9335 fileDeleteModal.modal('hide'); 9336 $.progressON(); 9337 var seqs = [], sizes = [], ffolders = []; 9338 $.each(files, function(idx, f){ 9339 seqs.push(f.seq); 9340 sizes.push(f.file_size); 9341 ffolders.push(f.file_folder); 9342 });
9343 var total = files.length, 9344 deleting = '', 9345 progress = 0; 9346 loading = '<i class="fa fa-circle-o-notch fa-spin fa-3x fa-fw"></i> '; 9347 done = 0; deleting = $('p.fitem-name[data-seq="' + seqs[0] + '"]').text(); 9348 $('.progressModal .info1').html(loading + deleting); 9349 9350 $.each(files,function(i,f) { 9351 var t = setTimeout(function() { 9352 if(CANCEL) { 9353 if(ABORT) { 9354 resourceGetPage(1,SFOLDER_ACTIVE,fsort,fsearch); 9355 updateOutputFolder($('#nestableFolder').data('output', $('#nestableFolder-output'))); 9356 ABORT = false; 9357 $.progressOFF(); 9358 } 9359 i=0; return false; 9360 } 9361 mystorageFileDelete(f.file_name, f.seq, function() { 9362 done++; 9363 progress = parseInt((done / total) * 100,10); 9364 $('.file-upload-progress .progress-bar').css('width',progress + "%"); 9365 $('.progressModal .info2').text(done.toString() + ' / ' + total.toString()); 9366 9367 $.resource.setMystorageFolder('set_fli_state', {'count': -1, 'size': -sizes[i], ffolder: 'all', state: 'delete'}); 9368 if(ffolders[i] != '' && ffolders[i] != 'all') { 9369 $.resource.setMystorageFolder('set_fli_state', {'count': -1, 'size': -sizes[i], ffolder: ffolders[i], state: 'delete'}); 9370 } 9371 9372 if(total == done) { 9373 myResourceFolderItem.addClass('deleted'); 9374 setTimeout(function() { 9375 modal.modal('hide'); 9376 },500); 9377 } else { 9378 deleting = $('p.fitem-name[data-seq="' + seqs[i+1] + '"]').text(); 9379 $('.progressModal .info1').html(loading + deleting); 9380 } 9381 }); 9382 },500*i); 9383 }); 9384 },'cancel','ok','modal-over-1 cl-cmmodal cl-s-btn cl-common-notice w560',false); 9385 9386 }, 'json'); 9387 } else { //í´ëë§ ìì 9388 $.processON('delete folder...'); 9389 var deferred = $.Deferred(); 9390 $.post('/template/resource/delete-folder-only', { sid: SID, prevffolder: prevffolder }, function (data) { 9391 checkError(data); 9392 myResourceFolderItem.addClass('deleted'); 9393 modal.modal('hide'); 9394 }); 9395 } 9396 9397 }, 'cancel', $.lang[LANG]['editor.resource.folder.delete.btn.delete'], 'modal-over-1 cl-cmmodal cl-s-btn w560 cl-p0 confirm-resource-folder-delete agreement-duplicate-contents', false, '', '', function() { 9398 isFEdit = false;
9399 $.resource.setMystorageFolder('nodrag',false); 9400 9401 if($('.progressModal').length > 0) $.progressOFF(); 9402 if($('.processModal').length > 0) $.processOFF(); 9403 if(myResourceTab.find('#nestableFolder .fli.deleted').length > 0) { 9404 myResourceTab.find('#nestableFolder .fli.deleted').remove(); 9405 updateOutputFolder($('#nestableFolder').data('output', $('#nestableFolder-output'))); 9406 9407 myResourceFiles.find('.fitem.ui-selected').removeClass('ui-selected'); 9408 myResourceSelected.children('li').remove(); 9409 if(checkPageReload) $('#nestableFolder .fll > .fli').first().removeClass('active').click(); 9410 } 9411 }); 9412 } else { 9413 var checkModal = $(this).showModalFlat($.lang[LANG]['editor.resource.folder.delete'], $.lang[LANG]['editor.resource.folder.delete.check'], true, true, function() { 9414 myResourceFolderItem.remove(); 9415 updateOutputFolder($('#nestableFolder').data('output', $('#nestableFolder-output'))); 9416 checkModal.modal('hide'); 9417 }, 'cancel', 'ok', 'cl-p130 cl-cmmodal cl-s-btn w560 cl-p0 zindex1042', false, '', '', function() { 9418 isFEdit = false; 9419 $.resource.setMystorageFolder('nodrag',false); 9420 9421 if(checkPageReload) $('#nestableFolder .fll > .fli').first().removeClass('active').click(); 9422 $.processOFF(); 9423 }); 9424 } 9425 }) 9426 .on('click', '.add-folder', function(e) { 9427 $('.add-folder').attr('data-content','').popover('hide'); 9428 var myResourceFolderlist = $('#mystorage #nestableFolder'), 9429 myResourceFolderAdd = $(this); 9430 9431 if(isFEdit || myResourceFolderlist.find('.fln-input').length > 0) { 9432 if(myResourceFolderlist.find('.fln-input').length > 0) myResourceFolderlist.find('.fln-input').focus(); 9433 isFEdit = true; 9434 $.resource.setMystorageFolder('nodrag',true); 9435 return; 9436 } 9437 var checkPlan = (typeof property == 'undefined') ? ((typeof VALIDPLAN == 'undefined') ? $.gallery.valid_plan : VALIDPLAN) : property.VALIDPLAN, 9438 checkPlanType = (typeof property == 'undefined') ? ((typeof VALIDTYPE == 'undefined') ? $.gallery.valid_type : VALIDTYPE) : property.VALIDTYPE, 9439 checkFREE = (!checkPlan || checkPlanType == 'PK') ? true : false; 9440 var checkMaximum = ( (!checkFREE && myResourceFolderlist.find('.fli').length > 500) || 9441 (checkFREE && myResourceFolderlist.find('.fli').length > 50) 9442 ) ? true : false; 9443 if(checkMaximum) { 9444 var max_msg = (!checkFREE) ? $.lang[LANG]['editor.resource.folder.maximum'] : $.lang[LANG]['editor.resource.folder.maximum.free']; 9445 var max_modal = $(this).showModalFlat($.lang[LANG]['config.information'], max_msg, true, false,'','close', 'ok', 'cl-cmmodal cl-s-btn w560 cl-p70 cl-p0', false, '', function() { 9446 max_modal.closest('.flat-modal').next('.modal-backdrop').attr('style','z-index: 1041!important;'); 9447 }); 9448 return; 9449 } else { 9450 isFEdit = true; 9451 9452 if(myResourceFolderlist.find('.fli[data-id="clEmptyFolder"]').length > 0) { 9453 myResourceFolderlist.find('.fli[data-id="clEmptyFolder"]').find('.dd-fln').val(''); 9454 } else { 9455 var add_folder = $.resource.getMystorageFolderHtml('clEmptyFolder', 0, 0, getNextMystorageFolderId()); 9456 myResourceFolderlist.find('.fll').append(add_folder); 9457 } 9458 9459 var input_html = '\ 9460 <div class="fln-group input-group">\ 9461 <input class="fln-input form-control" type="text"/>\
9462 <span class="input-group-btn"><button class="btn-fln-save btn btn-default btn-primary" type="button"><i class="fa fa-check"></i></button></span>\ 9463 <div class="btn-fln-cancel"><i class="fa fa-times"></i></div>\ 9464 </div>\ 9465 '; 9466 9467 $(input_html).appendTo(myResourceFolderlist.find('.fli[data-id="clEmptyFolder"] .dd-fln')).find('.fln-input').focus(); 9468 if(myResourceFolderlist.find('.dd-list.fll').height() >= myResourceFolderlist.height() && $.browser.safari == undefined) { 9469 myResourceFolderlist.find('.dd-fln').find('.fln-group').css('max-width','182px'); 9470 myResourceFolderlist.find('.dd-fln').find('.fln-input').css('max-width','155px'); 9471 myResourceFolderlist.scrollTop(2000); 9472 } 9473 $.resource.setMystorageFolder('nodrag',true); 9474 } 9475 }) 9476 .on('click', '#mystorageUploadBtn', function(e) { 9477 var myResourceTab = $('#mystorage'), 9478 fsort = myResourceTab.find('.resource-ctrl-sort select').val(), 9479 fsearch = myResourceTab.find('.resource-search-stx').val(), 9480 ffolder = (SFOLDER_ACTIVE) ? SFOLDER_ACTIVE : 'all'; 9481 9482 $.uploadON(); 9483 $(this).fileupload({ 9484 url: '/template/resource/upload/ffolder/'+ffolder, 9485 dataType: 'json', 9486 pasteZone: null, 9487 dropZone: null, 9488 async: true, 9489 prependFiles: true, 9490 sequentialUploads: true, 9491 add: function(e,data) { 9492 var r = $.upload_add(e,data,'image'); 9493 if(r.submit) { 9494 var jqXHR = data.submit(); 9495 UPLOAD++; 9496 } else { 9497 data.context.find('.loading').html('<i class="fa fa-times error"></i>'); 9498 data.context.find('.ing').addClass('error').text(r.err); 9499 } 9500 9501 $('.uploadModal .upload-cancel .btn, .uploadModal .upload-close').off('click').on('click', function(e) { 9502 if(jqXHR != undefined) jqXHR.abort(); 9503 data.context.fadeOut().remove(); 9504 $('.uploadModal #file-upload-progress').css('width','0%'); 9505 $.uploadOFF(); 9506 UPLOAD = 0; 9507 UPLOADED = 0; 9508 PROGRESS = 0; 9509 9510 updateOutputFolder($('#nestableFolder').data('output', $('#nestableFolder-output'))); 9511 resourceGetPage(1,SFOLDER_ACTIVE,fsort,fsearch); 9512 }); 9513 }, 9514 progress: function(e, data) { 9515 $.upload_progress(e,data); 9516 }, 9517 done: function (e, data) { 9518 $.upload_done(e,data); 9519 UPLOADED++; 9520 9521 var isSuccess = (typeof data._response.result != 'undefined' && typeof data._response.result.error != 'undefined') ? false : true; 9522 if(isSuccess) { 9523 var add_fls = parseFloat(data.files[0].size / 1024).toFixed(2); 9524 9525 $.resource.setMystorageFolder('set_fli_state', {'count': 1, 'size': add_fls, ffolder: 'all', state: 'upload'}); 9526 if(SFOLDER_ACTIVE != '') $.resource.setMystorageFolder('set_fli_state', {'count': 1, 'size': add_fls, ffolder: SFOLDER_ACTIVE, state: 'upload'}); 9527 } 9528 9529 if(UPLOADED && data.context.find('.error').length == 0) { 9530 //$.uploadON(UPLOADED + " / " + UPLOAD + "<br>images creating..."); 9531 if(UPLOAD==UPLOADED) { 9532 setTimeout(function() { 9533 $.uploadOFF(); 9534 UPLOAD = 0; 9535 UPLOADED = 0; 9536 PROGRESS = 0; 9537 9538 updateOutputFolder($('#nestableFolder').data('output', $('#nestableFolder-output'))); 9539 resourceGetPage(1,SFOLDER_ACTIVE,'date_desc',''); 9540 },1000); 9541 } 9542 } 9543 }, 9544 progressall: function (e, data) { 9545 $.upload_progressall(e,data); 9546 }, 9547 start : function(e, data) { 9548 $.upload_start(e,data); 9549 progress1 = 0; progress2 = 0; PROGRESS = 0; 9550 }, 9551 dragover : function(e, data) { 9552 e.preventDefault(); 9553 } 9554 }
9554).prop('disabled', !$.support.fileInput) 9555 .parent().addClass($.support.fileInput ? undefined : 'disabled'); 9556 }) 9557 .on('mousedown', '.fitem', function(e) { 9558 mouseX = (typeof e.clientX != 'undefined') ? e.clientX : e.pageX; 9559 mouseY = (typeof e.clientY != 'undefined') ? e.clientY : e.pageY; 9560 9561 if($(this).hasClass('ui-selected')) { 9562 fileDrag = true; 9563 updateResourceTooltip($(this), true); 9564 } else { 9565 fileDrag = false; 9566 dragTooltipModal = $(); 9567 hideResourceTooltip(); 9568 } 9569 }) 9570 .on('mouseup', '.fitem', function(e) { 9571 if($(this).closest('.tab-pane.active').find('#nestableFolder').length > 0) $(this).closest('.tab-pane.active').find('#nestableFolder .fli').removeClass('drag-selected'); 9572 hideResourceTooltip(); 9573 fileDrag = false; 9574 dragTooltipModal = $(); 9575 }) 9576 .on('mousemove', '.fitem', function(e) { 9577 mouseX = (typeof e.clientX != 'undefined') ? e.clientX : e.pageX; 9578 mouseY = (typeof e.clientY != 'undefined') ? e.clientY : e.pageY; 9579 if(fileDrag) updateResourceTooltip($(this), false); 9580 }) 9581 .on('click', '.fitem-ctrl-del', function(e) { 9582 var delResourceTab = $(this).closest('.tab-pane.active'), 9583 delResourceFiles = delResourceTab.find('ul.files'), 9584 delResourceSelected = delResourceTab.find('.resource-selected-ul'), 9585 fsort = delResourceTab.find('.resource-ctrl-sort select').val(), 9586 fsearch = delResourceTab.find('.resource-search-stx').val(), 9587 file = $(this).closest('ul').attr('data-source'), 9588 seq = $(this).closest('ul').attr('data-seq'), 9589 size = $(this).closest('ul').attr('data-fsize'), 9590 ffolder = $(this).closest('ul').attr('data-ffolder'); 9591 9592 var modal = $(this).showModalFlat($.lang[LANG]['config.common.resource.delete.title'],$.lang[LANG]['config.common.resource.delete'], true, true, function() { 9593 $.processON('Deleting the image(s)...'); 9594 modal.modal('hide'); 9595 delResourceFiles.find('.fitem p.fitem-name[data-seq="' + seq + '"]').remove(); 9596 delResourceSelected.children('li[data-seq="' + seq + '"]').remove(); 9597 if(delResourceSelected.length == 0) delResourceTab.find('.resource-useit').removeClass('active'); 9598 9599 mystorageFileDelete(file,seq,function() { 9600 $.resource.setMystorageFolder('set_fli_state', {'count': -1, 'size': -size, ffolder: 'all', state: 'delete'}); 9601 if(ffolder != '' && ffolder != 'all') { 9602 $.resource.setMystorageFolder('set_fli_state', {'count': -1, 'size': -size, ffolder: ffolder, state: 'delete'}); 9603 } 9604 updateOutputFolder($('#nestableFolder').data('output', $('#nestableFolder-output'))); 9605 9606 resourceGetPage(1,SFOLDER_ACTIVE,fsort,fsearch); 9607 $.processOFF(); 9608 }); 9609 9610 },'cancel','ok','modal-over-1 cl-cmmodal cl-s-btn cl-common-notice w560',false); 9611 }) 9612 .on('click', '.resource-ctrl-deletes', function(e) { 9613 var myResourceTab = $('#mystorage'), 9614 myResourceFiles = myResourceTab.find('ul.files'), 9615 myResourceSelected = myResourceTab.find('.resource-selected-ul'), 9616 fsort = myResourceTab.find('.resource-ctrl-sort select').val(), 9617 fsearch = myResourceTab.find('.resource-search-stx').val(); 9618 9619 if(myResourceSelected.children('li').length==0) return; 9620 9621 var r_pages = Number(myResourceTab.find('.resource-paging .pagination').attr('data-pages')), 9622 r_page = Number($('.resource-paging .pagination li.active').text()), 9623 r_file_cnt = myResourceFiles.find('.fitem').length; 9624 9625 var modal = $(this).showModalFlat($.lang[LANG]['config.common.resource.delete.title'],$.lang[LANG]['config.common.resource.delete'], true, true, function() { 9626 modal.modal('hide'); 9627 $.progressON(); 9628 var files = [], seqs = [], sizes = [], ffolders = []; 9629 myResourceSelected.children('li').each(function () { 9630 files.push($(this).attr('data-source')); 9631 seqs.push($(this).attr('data-seq')); 9632 sizes.push($(this).find('.selected-file-size .size').text()); 9633 ffolders.push($(this).attr('data-ffolder')); 9634 }); 9635 9636 myResourceSelected.empty(); 9637 myResourceTab.find('.resource-useit').removeClass('active'); 9638
9639 var total = files.length, deleting = '', progress = 0; loading = '<i class="fa fa-circle-o-notch fa-spin fa-3x fa-fw"></i> '; 9640 done = 0; deleting = myResourceFiles.find('p.fitem-name[data-seq="' + seqs[0] + '"]').text(); 9641 $('.progressModal .info1').html(loading + deleting); 9642 9643 $.each(files,function(i,v) { 9644 var t = setTimeout(function() { 9645 if(CANCEL) { 9646 if(ABORT) { 9647 updateOutputFolder($('#nestableFolder').data('output', $('#nestableFolder-output'))); 9648 resourceGetPage(1,SFOLDER_ACTIVE,fsort,fsearch); 9649 ABORT = false; 9650 $.progressOFF(); 9651 } 9652 i=0; return false; 9653 } 9654 9655 mystorageFileDelete(v,seqs[i],function() { 9656 done++; 9657 progress = parseInt((done / total) * 100,10); 9658 $('.file-upload-progress .progress-bar').css('width',progress + "%"); 9659 $('.progressModal .info2').text(done.toString() + ' / ' + total.toString()); 9660 9661 $.resource.setMystorageFolder('set_fli_state', {'count': -1, 'size': -sizes[i], ffolder: 'all', state: 'delete'}); 9662 if(ffolders[i] != '' && ffolders[i] != 'all') { 9663 $.resource.setMystorageFolder('set_fli_state', {'count': -1, 'size': -sizes[i], ffolder: ffolders[i], state: 'delete'}); 9664 } 9665 9666 if(total == done) { 9667 r_page = ((r_file_cnt-files.length) == 0 && r_pages<=r_page) ? r_page-1 : r_page; 9668 r_page = 1; 9669 setTimeout(function() { 9670 updateOutputFolder($('#nestableFolder').data('output', $('#nestableFolder-output'))); 9671 resourceGetPage(r_page,SFOLDER_ACTIVE,fsort,fsearch); 9672 $.progressOFF(); 9673 },1000); 9674 } else { 9675 deleting = myResourceFiles.find('p.fitem-name[data-seq="' + seqs[i+1] + '"]').text(); 9676 $('.progressModal .info1').html(loading + deleting); 9677 } 9678 }); 9679 },500*i); 9680 }); 9681 9682 },'cancel','ok','modal-over-1 cl-cmmodal cl-s-btn cl-common-notice w560',false); 9683 }) 9684 .on('click', '.resource-ctrl-downloads', function(e) { 9685 var myResourceTab = $('#mystorage'), 9686 myResourceFiles = myResourceTab.find('ul.files'), 9687 myResourceSelected = myResourceTab.find('.resource-selected-ul'); 9688 9689 var files = [], seqs = [], sizes = [], ffolders = [], file_path = [], org_name = []; 9690 9691 if(myResourceSelected.children('li').length == 0) { 9692 return false; 9693 } else if(myResourceSelected.children('li').length == 1) { 9694 var seq = $(myResourceSelected.children('li')[0]).data('seq'); 9695 $('ul[data-seq="' + seq + '"] .fitem-ctrl-down').get(0).click(); 9696 return false; 9697 } 9698 9699 myResourceSelected.children('li').each(function () { 9700 var src = getServeImage($(this).attr('data-source'), 0, 'https:' + RESOURCE + '/' + SID); 9701 var file_name = $(this).find('.selected-file-title').text(); 9702 file_path.push(src); 9703 org_name.push(file_name); 9704 }); 9705 $.processON($.lang[LANG]['editor.resource.batchdownload']); 9706 setTimeout(function() { 9707 $.ajax({ 9708 url:'/template/resource/batch-download', 9709 type:'post', 9710 async: true, 9711 data:{ 9712 'file_path': file_path, 9713 'org_name': org_name 9714 }, 9715 dataType:'json', 9716 success:function(data) { 9717 var filename = data.filename; 9718 var base64Data = data.filedata; 9719 if(!base64Data) return false;
9720 9721 var binaryString = atob(base64Data); 9722 var len = binaryString.length; 9723 var bytes = new Uint8Array(len); 9724 for (let i = 0; i < len; i++) { 9725 bytes[i] = binaryString.charCodeAt(i); 9726 } 9727 9728 // Blob ê°ì²´ ìì± 9729 var blob = new Blob([bytes], { type: 'application/zip' }); 9730 9731 // Blob URL ìì± 9732 var url = URL.createObjectURL(blob); 9733 9734 // ë¤ì´ë¡ë ë§í¬ ìì± ë° í´ë¦íì¬ íì¼ ë¤ì´ë¡ë 9735 var a = document.createElement('a'); 9736 a.href = url; 9737 a.download = filename; 9738 document.body.appendChild(a); 9739 a.click(); 9740 9741 // ë§í¬ ì ê±° 9742 document.body.removeChild(a); 9743 URL.revokeObjectURL(url); 9744 }, 9745 complete:function() { 9746 $.processOFF(); 9747 } 9748 }); 9749 }); 9750 }); 9751 9752 9753 $('#mystorage #nestableFolder').nestable({ 9754 maxDepth: 1, 9755 handleClass: 'dd-handle', 9756 noDragClass: 'fl-nodrag', 9757 }) 9758 .on('changing', function(e) { 9759 if(isFEdit || $(this).find('.fln-group.input-group').length > 0) { 9760 e.preventDefault(); 9761 return false; 9762 } 9763 9764 sortFolderFavoritesTop(); 9765 updateOutputFolder($('#nestableFolder').data('output', $('#nestableFolder-output'))); 9766 }); 9767 9768 $('#mystorage ul.files').selectableScroll({ 9769 options:{ 9770 scrollSnapX: 120, 9771 scrollSnapY: 120, 9772 scrollAmount: 5 9773 }, 9774 filter: '.fitem', 9775 cancel: 'i, .ui-selected, .fitem-ctrl', 9776 start: function(event, ui) { 9777 $('#mystorage ul.files').addClass('__file_selecting'); 9778 }, 9779 selecting: function(event, ui) { 9780 }, 9781 stop: function(event, ui) { 9782 $('#mystorage ul.files').removeClass('__file_selecting'); 9783 }, 9784 selected: function(event, ui) { 9785 if($(ui.selected).is('.fitem')) { 9786 var myResourceTab = $('#mystorage'), 9787 myResourceSelected = myResourceTab.find('.resource-selected-ul'), 9788 file_seq = $(ui.selected).find('.fitem-ctrl > ul').attr('data-seq'); 9789 9790 if(typeof file_seq != 'undefined' && myResourceSelected.find('li[data-seq="'+file_seq+'"]').length == 0) { 9791 var magic = $(ui.selected).find('p.fitem-name').attr('data-magic'), 9792 file = $(ui.selected).find('p.fitem-name').attr('data-source'), 9793 file_path = RPATH + '60/' + file, 9794 full_path = (magic == '') ? file_path : magic+'=s60-c', 9795 ffolder = $(ui.selected).find('.fitem-ctrl > ul').attr('data-ffolder'), 9796 file_title = $(ui.selected).find('p.fitem-name').attr('data-original-title'), 9797 file_size = $(ui.selected).find('p.fitem-size .size').attr('data-size'), 9798 file_width = $(ui.selected).find('p.fitem-size .width').text(), 9799 file_height = $(ui.selected).find('p.fitem-size .height').text(), 9800 selected_file_name = (magic) ? magic : file; 9801 9802 myResourceSelected.append('<li data-source="' + file + '" data-ffolder="' + ffolder + '" data-seq="'+file_seq+'" data-size="'+file_size+'"><img src="' + full_path + '"><div class="selected-hover">×<p class="selected-file-name">' + selected_file_name + '</p><p class="selected-file-title">' + file_title + '</p><p class="selected-file-size"><span class="size">' + file_size + '</span><span class="width">' + file_width + '</span><span class="height">' + file_height + '</span></p></div></li>'); 9803 } 9804 } 9805 setResourceSelectedBox('my'); 9806 }, 9807 unselected: function(event, ui) { 9808 if($(ui.unselected).is('.fitem')) { 9809 if(!event.ctrlKey && !event.shiftKey) { 9810 $('#mystorage .resource-selected-ul').empty(); 9811 } 9812 } 9813 setResourceSelectedBox('my'); 9814 } 9815 }); 9816 9817 9818 /* modal-resourcebox 02__freestorage */ 9819 var freestorageFitemHtml = function(src,profile,name,link,color,full,raw,down,width,height,id,type,i) { 9820 9821 var fitem_ctrl_star = (type != 'used') ? '<li><span class="fitem-ctrl-star '+((type=='favor') ? 'active' : '')+'"><svg class="active" viewBox="0 0 16 16" width="16" hegiht="16"><path d="m14.5 6.52-4.52-.88L8 1.5 6.02 5.64l-4.52.88 3.11 3.25-.57 4.73L8 12.43l3.96 2.07-.57-4.73z"/></svg><svg viewBox="0 0 16 16" width="16" hegiht="16"><path d="m8 3.82 1.08 2.25.22.45.49.1 2.73.53-1.85 1.93-.33.34.06.47.34 2.84-2.28-1.19L8 11.3l-.46.24-2.28 1.19.34-2.84.06-.47-.33-.34-1.84-1.93 2.73-.53.49-.1.22-.45L8 3.82M8 1.5 6.02 5.64l-4.52.88 3.11 3.25-.57 4.73L8 12.43l3.96 2.07-.57-4.73 3.11-3.25-4.52-.88L8 1.5z"/></svg></span></li>' : '', 9822 fitem_str = '\ 9823 <li class="fitem" data-idx="' + i + '">\ 9824 <div class="fitem-wrap">\ 9825 <div class="fitem-visual">\ 9826 <div class="fitem-thumb">\ 9827 <div class="fitem-mold"><img src="https://storage.googleapis.com/i.addblock.net/sample/sns_cm_1.png"/></div>\ 9828 <img class="fitem-img" src="' + src + '">\ 9829 </div>\ 9830 <div class="fitem-ctrl">\ 9831 <ul data-color="' + color + '" data-username="' + name + '" data-raw="' + raw + '" data-full="' + full + '" data-small="' + src + '" data-down="' + down + '" data-userlink="' + link + '" data-width="' + width + '" data-height="' + height + '" data-id="' + id + '">\ 9832 <li><a class="fitem-ctrl-imgview" data-url="' + full + '" data-img-original="ON"><svg viewBox="0 0 13 13" width="13" height="13">
9832<path d="M5.14 1c2.28 0 4.14 1.86 4.14 4.14 0 2.28-1.86 4.14-4.14 4.14S1 7.43 1 5.14C1 2.86 2.86 1 5.14 1m0-1C2.3 0 0 2.3 0 5.14s2.3 5.14 5.14 5.14 5.14-2.3 5.14-5.14S7.98 0 5.14 0z"/><path d="M12.5 13a.47.47 0 0 1-.35-.15L8.22 8.92c-.2-.2-.2-.51 0-.71s.51-.2.71 0l3.93 3.93c.2.2.2.51 0 .71-.1.1-.23.15-.36.15z"/></svg></a></li>\ 9833 ' + fitem_ctrl_star + '\ 9834 </ul>\ 9835 </div>\ 9836 </div>\ 9837 <div class="fitem-content visible-layout-grid">\ 9838 <p class="fitem-username">Photo by <a href="' + link + '?utm_source=creatorlink&utm_medium=referral&utm_campaign=api-credit" target="_blank">' + name + '</a></p>\ 9839 <p class="fitem-size"><span class="width">'+width+'</span><span class="height">'+height+'</span></p>\ 9840 </div>\ 9841 </div>\ 9842 </li>\ 9843 '; 9844 9845 return fitem_str; 9846 } 9847 9848 var rePaintFavor = function() { 9849 var $org = $('#freestorage .fitem'), 9850 $items = {}; 9851 9852 for(var i=0; i<$org.length; i++) { 9853 var $i = $('#freestorage .fitem[data-idx="' + i + '"]'); 9854 $items[i] = $i.clone(); 9855 $i.remove(); 9856 } 9857 9858 $.each($items, function(i,v) { 9859 $('#freestorage ul.files').append($(this)); 9860 }); 9861 } 9862 9863 var getFreeImage = function(page,type,stx,collection) { 9864 type = (typeof type == 'undefined') ? 'new' : type; 9865 stx = (typeof stx == 'undefined') ? '' : stx; 9866 page = (typeof page == 'undefined') ? 1 : page; 9867 collection = (typeof collection == 'undefined') ? '' : collection; 9868 if(type == 'new') { 9869 dest = '/template/free/new/photos'; 9870 } else if(type == 'favor') { 9871 dest = '/template/favorite/list/type/F'; 9872 } else if(type == 'search') { 9873 dest = '/template/free/search/' + encodeURIComponent(stx); 9874 } else if(type == 'used') { 9875 dest = '/template/favorite/list/type/U'; 9876 } 9877 9878 if(page>1) dest = dest + '/page/' + page; 9879 9880 var freeResourceTab = $('#freestorage'), 9881 freeResourceFiles = freeResourceTab.find('ul.files'), 9882 freeResourceSelected = freeResourceTab.find('.resource-selected-ul'); 9883 9884 $.ajax({ 9885 type: 'GET', 9886 url: dest, 9887 dataType: 'json', 9888 async:true, 9889 success : function(data) { 9890 var photos; 9891 if(freeSearch.type == 'new') { 9892 if(data.photos != null) { 9893 photos = data.photos; 9894 } else photos = []; 9895 } else { 9896 photos = (data.photos && data.photos.results) ? data.photos.results : []; 9897 } 9898 9899 if(photos) { 9900 if(photos.length==0 || photos == null) { 9901 $.resource.modalFilesEmpty(freeResourceFiles, 'No results found'); 9902 } else { 9903 freeResourceFiles.find('.listprogress').remove(); 9904 $.each(photos, function(i,v) { 9905 var tpl = freestorageFitemHtml(v.urls.small, v.user.profile_image.small, v.user.username, v.user.links.html, v.color, v.urls.full, v.urls.raw,v.links.download, v.width, v.height, v.id, freeSearch.type, i); 9906 freeResourceFiles.append(tpl); 9907 }); 9908 9909 freeResourceFiles.selectable({ 9910 filter: '.fitem', 9911 cancel: 'i, .ui-selected, .fitem-username, .fitem-ctrl', 9912 start: function(event, ui) { 9913 freeResourceFiles.addClass('__file_selecting'); 9914 }, 9915 selecting: function(event, ui) { 9916 }, 9917 stop: function(event, ui) { 9918 freeResourceFiles.removeClass('__file_selecting'); 9919 }, 9920 selected: function(event, ui) { 9921 if($(ui.selected).is('.fitem')) { 9922 var freeResourceTab = $('#freestorage'), 9923 freeResourceSelected = freeResourceTab.find('.resource-selected-ul'), 9924 file_id = $(ui.selected).find('.fitem-ctrl > ul').attr('data-id'); 9925 9926 if(typeof file_id != 'undefined' && freeResourceSelected.children('li[data-id="'+file_id+'"]').length == 0) { 9927 var file_small = $(ui.selected).find('.fitem-ctrl > ul').attr('data-small'), 9928 urls = new getLocation(file_small), 9929 file = (urls.pathname).replace('/',''), 9930 file_path = 'https://' + urls.host + urls.pathname + '?ixlib=rb-0.3.5&q=80&fm=jpg&crop=face&cs=tinysrgb&w=60&h=60&fit=crop', 9931 tmp_image = 'https://' + urls.host + urls.pathname + '?ixlib=rb-0.3.5&q=85&fm=jpg&crop=entropy&cs=srgb', 9932 file_width = $(ui.selected).find('.fitem-ctrl > ul').attr('data-width'), 9933 file_height = $(ui.selected).find('.fitem-ctrl > ul').attr('data-height'); 9934 9935 freeResourceSelected.append('<li data-source="' + file + '" data-id="' + file_id + '"><img src="' + file_path + '"><div class="selected-hover">×<p class="selected-file-name">' + file + '</p><p class="selected-file-title">' + file + '</p><p class="selected-file-size"><span class="size">0</span><span class="width">' + file_width + '</span><span class="height">' + file_height + '</span></p><p class="selected-file-tmp">' + tmp_image + '</p></div></li>'); 9936 } 9937 } 9938 setResourceSelectedBox('free'); 9939 }, 9940 unselected: function(event, ui) { 9941 if($(ui.unselected).is('.fitem')) { 9942 if(!event.ctrlKey && !event.shiftKey) { 9943 freeResourceSelected.empty(); 9944 } 9945 } 9946 setResourceSelectedBox('free'); 9947 } 9948 }); 9949 if((freeSearch.type == 'search' || freeSearch.type == 'favor' || freeSearch.type == 'used') && data.photos && typeof data.photos.total
9949!= 'undefined') freeSearch.total = data.photos.total; 9950 freeSearch.page = freeSearch.page + 1; 9951 9952 freeResourceTab.find('.resource-search-total').text(''); 9953 if(data.photos && typeof data.photos.total != 'undefined' && freeSearch.type == 'search') { 9954 if(data.photos.total > 0) freeResourceTab.find('.resource-search-total').text(Number(data.photos.total).format()); 9955 } 9956 9957 } 9958 } else { 9959 $.resource.modalFilesEmpty(freeResourceFiles, 'Error get photo list'); 9960 } 9961 }, 9962 error: function() { 9963 $.resource.modalFilesEmpty(freeResourceFiles, 'Error get photo list'); 9964 }, 9965 complete: function() { 9966 freeResourceTab.find('.resource-search-btn').removeClass('clicked'); 9967 freeResourceFiles.removeClass('ready'); 9968 freeResourceFiles.find('.listprogress').remove(); 9969 } 9970 }); 9971 9972 } 9973 9974 $('.modal-resourcebox') 9975 .on('click', 'a[href="#freestorage"]', function(e) { 9976 $('#freestorage ul.files .listprogress').remove(); 9977 setResourceSelectedBox('free'); 9978 9979 var freeResourceTab = $('#freestorage'), 9980 freeResourceFolderlist = freeResourceTab.find('.resource-folderlist'), 9981 freeResourceFiles = freeResourceTab.find('ul.files'), 9982 freeResourceSelected = freeResourceTab.find('.resource-selected-ul'); 9983 9984 if(freeResourceFiles.hasClass('ready')) { 9985 if(freeResourceFolderlist.children('li.active').length == 0) { 9986 freeResourceFolderlist.children('li').click(function(e) { 9987 var flTab = $(this), 9988 fl_type = (typeof flTab.attr('data-type') != 'undefined') ? flTab.attr('data-type') : '', 9989 fb_type = (typeof freeResourceFiles.attr('data-type') != 'undefined') ? freeResourceFiles.attr('data-type') : '', 9990 checkReload = (fl_type == '' || fl_type != fb_type) ? true : false; 9991 9992 flTab.addClass('active').siblings().removeClass('active'); 9993 if(checkReload) { 9994 freeSearch.type = fl_type; 9995 freeSearch.page = 1; 9996 freeSearch.total = -1; 9997 $.resource.modalContentInit('free'); 9998 getFreeImage(freeSearch.page,freeSearch.type); 9999 freeResourceFiles.attr('data-type',fl_type); 10000 } 10001 10002 if(fl_type == 'favor') { 10003 var items = freeResourceFiles.find('.fitem').length; 10004 if(freeSearch.total == items) return; 10005 } 10006 10007 freeResourceSelected.empty(); 10008 setResourceSelectedBox('free'); 10009 }); 10010 10011 freeSearch.type = 'new'; 10012 freeSearch.page = 1; 10013 freeSearch.total = -1; 10014 $.resource.modalContentInit('free'); 10015 freeResourceFolderlist.children('li[data-type="new"]').addClass('active').siblings().removeClass('active'); 10016 getFreeImage(freeSearch.page,freeSearch.type); 10017 } 10018 } 10019 }); 10020 10021 $('.modal-resourcebox #freestorage') 10022 .on('click', '.fitem-ctrl-star', function(e) { 10023 var $i = $(this).closest('ul'), 10024 $star = $(this), 10025 image = { 10026 'id' : $i.attr('data-id'), 10027 'width' : $i.attr('data-width'), 10028 'height' : $i.attr('data-height'), 10029 'username' : $i.attr('data-username'), 10030 'userlink' : $i.attr('data-userlink'), 10031 'raw' : $i.attr('data-raw'), 10032 'full' : $i.attr('data-full'), 10033 'small' : $i.attr('data-small'), 10034 'down' : $i.attr('data-down'), 10035 'color' : $i.attr('data-color'), 10036 'onoff': ($star.hasClass('active')) ? 'OFF' : 'ON', 10037 }, 10038 $item = $star.closest('.fitem'); 10039 10040 $.post('/template/favorite/image', { image : image }, function(data) { 10041 if(data.type == 'insert') { 10042 $star.addClass('active'); 10043 } else if(data.type == 'delete') { 10044 $star.removeClass('active'); 10045 if(freeSearch.type == 'favor') { 10046 var idx = $item.attr('data-idx'); 10047 $('#freestorage .fitem').each(function() { 10048 var cidx = $(this).attr('data-idx'); 10049 if(cidx == idx) $(this).remove(); 10050 if(idx < cidx) $(this).attr('data-idx',Number(cidx)-1); 10051 }); 10052 freeSearch.total = freeSearch.total -1; 10053 rePaintFavor(); 10054 } 10055 } 10056 },'json'); 10057 }); 10058 10059 10060 /* modal-resourcebox 03__filestorage */ 10061 $('.modal-resourcebox #filestorage') 10062 .on('click', '#filestorageUploadBtn', function(e) { 10063 if($('.flink-error-modal').length > 0) { 10064 e.preventDefault(); 10065 return false;
10066 } 10067 var checkPlan = (typeof property == 'undefined') ? ((typeof VALIDPLAN == 'undefined') ? $.gallery.valid_plan : VALIDPLAN) : property.VALIDPLAN, 10068 checkPType = (typeof property == 'undefined') ? ((typeof VALIDTYPE == 'undefined') ? $.gallery.valid_type : VALIDTYPE) : property.VALIDTYPE, 10069 flink_cnt = $('#filestorage .flink-capacity .flink-cnt').text(), 10070 flink_max = $('#filestorage .flink-capacity .flink-max').text(), 10071 reg_max = /^[0-9]+$/, 10072 error_str = ''; 10073 10074 if(!checkPlan || checkPType == 'PK') error_str = $.lang[LANG]['editor.link.file.upgrade']; 10075 else if(reg_max.test(flink_cnt) && Number(flink_cnt) >= Number(flink_max)) { 10076 error_str = $.lang[LANG]['editor.link.file.maximum']; 10077 error_str = error_str.replace('@maximum', flink_max); 10078 } 10079 if(error_str) { 10080 var errorModal = $(this).showModalFlat($.lang[LANG]['config.information'], error_str, true, false,'','ok', '', 'cl-p130 cl-cmmodal cl-s-btn w560 cl-p0 cl-okbtn-pbt70 flink-error-modal').css('z-index','1044'); 10081 errorModal.closest('.flat-modal').addClass('z-1044'); 10082 return false; 10083 } 10084 10085 $.uploadON(); 10086 $(this).fileupload({ 10087 url: '/down/flink/upload/sid/' + SID, 10088 dataType: 'json', 10089 pasteZone: null, 10090 async: true, 10091 cache: false, 10092 prependFiles: true, 10093 sequentialUploads: true, 10094 add: function(e,data) { 10095 var r = $.upload_add(e,data,'flink'); 10096 10097 if(r.submit) { 10098 var jqXHR = data.submit(); 10099 UPLOAD++; 10100 } else { 10101 data.context.find('.loading').html('<i class="fa fa-times error"></i>'); 10102 data.context.find('.ing').addClass('error').text(r.err); 10103 } 10104 10105 $('.uploadModal .upload-cancel .btn, .uploadModal .upload-close').off('click').on('click', function(e) { 10106 if(jqXHR != undefined) jqXHR.abort(); 10107 data.context.fadeOut().remove(); 10108 $('.uploadModal #file-upload-progress').css('width','0%'); 10109 $.uploadOFF(); 10110 UPLOAD = 0; 10111 UPLOADED = 0; 10112 PROGRESS = 0; 10113 10114 resourceGetPage(1,SFOLDER_ACTIVE,'date_desc',''); 10115 }); 10116 }, 10117 progress: function(e, data) { 10118 $.upload_progress(e,data); 10119 }, 10120 done: function (e, data) { 10121 if(typeof data.result.error != 'undefined' && data.result.error) { 10122 $('.uploadModal .upload-header h1').html($.lang[LANG]['editor.upload.title.1']); 10123 $('.uploadModal .upload-content .upload-cancel .btn-default').text($.lang[LANG]['config.close']); 10124 $('.file-upload-progress .progress-bar').css('width','0%'); 10125 $('.uploadModal .info1, .uploadModal .info2').addClass('hide'); 10126 10127 data.context.find('.progress-bar').css('width','0%'); 10128 data.context.find('.loading').html('<i class="fa fa-times error"></i>'); 10129 data.context.find('.ing').addClass('error').text(data.result.error); 10130 return false; 10131 } 10132 10133 $.upload_done(e,data); 10134 UPLOADED++; 10135 10136 if(UPLOADED) { 10137 if(UPLOAD==UPLOADED) { 10138 setTimeout(function() { 10139 $.uploadOFF(); 10140 UPLOAD = 0; 10141 UPLOADED = 0; 10142 PROGRESS = 0; 10143 10144 resourceGetPage(1,SFOLDER_ACTIVE,'date_desc',''); 10145 },1000); 10146 } 10147 } 10148 }, 10149 progressall: function (e, data) { 10150 $.upload_progressall(e,data); 10151 }, 10152 start : function(e, data) { 10153 $.upload_start(e,data); 10154 progress1 = 0; progress2 = 0; PROGRESS = 0; 10155 }, 10156 dragover : function(e) { 10157 e.preventDefault(); 10158 e.stopPropagation(); 10159 }, 10160 drop : function(e) { 10161 e.preventDefault(); 10162 e.stopPropagation(); 10163 }, 10164 }
10164).prop('disabled', !$.support.fileInput) 10165 .parent().addClass($.support.fileInput ? undefined : 'disabled'); 10166 10167 }) 10168 .on('click', '.fitem', function(e) { 10169 $(this).toggleClass('selected').siblings().removeClass('selected'); 10170 if($(this).hasClass('selected')) $('#filestorage .resource-useit').addClass('active'); 10171 else $('#filestorage .resource-useit').removeClass('active'); 10172 }) 10173 .on('click', '.fitem-ctrl-del', function(e) { 10174 $(this).closest('.fitem').addClass('selected'); 10175 var selectedFlink = $('#filestorage ul.files .fitem.selected'), 10176 file = selectedFlink.find('p.fitem-name').attr('data-source'), 10177 id = selectedFlink.find('p.fitem-name').attr('data-seq'); 10178 if(typeof file == 'undefined' || typeof id == 'undefined') return false; 10179 var modal = $(this).showModalFlat($.lang[LANG]['config.flink.resource.delete'],$.lang[LANG]['config.flink.resource.delete.str'], true, true, function() { 10180 10181 selectedFlink.remove(); 10182 $.processON('Deleting the file(s)...'); 10183 modal.modal('hide'); 10184 $('.resource-useit').removeClass('active'); 10185 10186 $.ajax({ 10187 type: 'POST', 10188 url: '/down/flink/delete', 10189 data: { s: file, id: id }, 10190 dataType: 'json', 10191 async: true, 10192 success: function(data) { 10193 if(typeof data.error != 'undefined' && data.error) { 10194 $(this).showModalFlat('ERROR',data.error,true,false,'','ok'); 10195 return false; 10196 } 10197 resourceGetPage(1,SFOLDER_ACTIVE,'date_desc',''); 10198 $.processOFF(); 10199 } 10200 }); 10201 10202 },'cancel','ok','modal-over-1 cl-cmmodal cl-s-btn cl-common-notice w560',false); 10203 modal.closest('.modal-over-1').addClass('z-1044'); 10204 }); 10205 10206 $('.modal-resourcebox a[href="#iconstorage"]') 10207 .click(function(e) { 10208 var thisResourceTab = $('#iconstorage'), 10209 icon_type = (typeof getIconStorageInitialType == 'function') ? getIconStorageInitialType() : 'google'; 10210 10211 if(typeof resetIconStorageDefaultState == 'function') { 10212 resetIconStorageDefaultState(); 10213 } else { 10214 thisResourceTab.find('.icon_type[data-icontype="' + icon_type + '"]').addClass('active').siblings('.icon_type').removeClass('active'); 10215 thisResourceTab.find('.resource-search-stx').val(''); 10216 } 10217 $.processON(); 10218 if(typeof setIconStorageMaterialState == 'function') setIconStorageMaterialState(icon_type); 10219 getIconImage('total', icon_type); 10220 }); 10221 }, 10222 modalOpenSET: function(open) { 10223 $('.modal-resourcebox .nav-tabs li').removeClass('disabled'); 10224 var property = (open) ? $('.modal-resourcebox .resource-useit').eq(0).attr('data-property') : ''; 10225 if(!open) $('.modal-resourcebox .resource-useit').removeAttr('data-property'); 10226 10227 if(open) { 10228 switch(property) { 10229 case 'flink-change': 10230 $('#mystorage,#freestorage').removeClass('active').removeClass('in'); 10231 $('.modal#el-fileupload').css('z-index','1043'); 10232 $('#el-fileupload').addClass('flink-fileupload'); 10233 $('#el-fileupload').find('.modal-header h4').html($.lang[LANG]['editor.resource.file']); 10234 $('#el-fileupload .nav-tabs li:nth-child(3) a').click(); 10235 $('#el-fileupload .nav-tabs li:not(:nth-child(3))').addClass('disabled'); 10236 break; 10237 10238 case 'popup-change': 10239 $('.modal#el-fileupload').css('z-index','1043'); 10240 $('#el-fileupload').addClass('popup-fileupload'); 10241 break; 10242 10243 case 'upload-badge-image': 10244 $('.modal#el-fileupload').css('z-index','1044'); 10245 break; 10246 10247 default: 10248 $('#filestorage').removeClass('active').removeClass('in'); 10249 $('.modal#el-fileupload').css('z-index','1041'); 10250 $('#el-fileupload').removeClass('flink-fileupload'); 10251 $('#el-fileupload').removeClass('popup-fileupload');
10252 $('#el-fileupload').find('.modal-header h4').html($.lang[LANG]['editor.resource.title']); 10253 10254 if($('#el-fileupload .nav-tabs li:nth-child(3)').hasClass('active')) $('#el-fileupload .nav-tabs li:nth-child(1) a').click(); 10255 $('#el-fileupload .nav-tabs li:nth-child(3)').addClass('disabled'); 10256 break; 10257 } 10258 } else { 10259 $('.modal#el-fileupload').css('z-index','1041'); 10260 $('#el-fileupload').removeClass('flink-fileupload'); 10261 $('#el-fileupload').removeClass('popup-fileupload'); 10262 $('#el-fileupload').find('.modal-header h4').html($.lang[LANG]['editor.resource.title']); 10263 10264 if($('#el-fileupload .nav-tabs li:nth-child(3)').hasClass('active')) $('#el-fileupload .nav-tabs li:nth-child(1) a').click(); 10265 $('#el-fileupload .nav-tabs li:nth-child(3)').addClass('disabled'); 10266 $('#filestorage').removeClass('active').removeClass('in'); 10267 } 10268 }, 10269 modalInit: function() { 10270 $('#progress .progress-bar').css({'width' : '0%', 'padding-right' : '0px'}).text(''); 10271 $('.modal-resourcebox .resource-useit').removeClass('active'); 10272 $('.modal-resourcebox .resource-selected-ul').empty(); 10273 $('.modal-resourcebox .resource-ctrl-selectedinfo .count').text(0).closest('label').hide(); 10274 $('.modal-resourcebox .resource-ctrl-btns').removeClass('active'); 10275 $('.modal-resourcebox .fitem').removeClass('ui-selected'); 10276 $.resource.modalOpenSET(true); 10277 }, 10278 modalContentInit: function(mode) { 10279 if(typeof mode == 'undefined' || !mode) mode = 'my'; 10280 10281 $('#'+mode+'storage .resource-useit').removeClass('active'); 10282 $('#'+mode+'storage .resource-search-stx').val(''); 10283 $('#'+mode+'storage ul.files, #'+mode+'storage .resource-selected-ul').empty(); 10284 10285 if(mode == 'free') { 10286 $('#freestorage .resource-search-total').text(''); 10287 if($('#freestorage ul.files .listprogress').length == 0) { 10288 $('#freestorage ul.files').append('<li class="listprogress"><svg version="1.1" xmlns="http://www.w3.org/svg/2000" viewBox="0 0 30 30" width="60" style="width:30px; height: 30px;"><circle cy="15" cx="15" r="14" style="stroke:#00baff;"></circle></svg></li>'); 10289 } 10290 } 10291 }, 10292 modalFilesEmpty: function(ulFiles,empty_str) { 10293 if(ulFiles.length > 0) { 10294 empty_str = (typeof empty_str != 'undefined' && empty_str) ? empty_str : 'No results'; 10295 ulFiles.addClass('empty').empty(); 10296 ulFiles.append('\ 10297 <li class="resource-empty-area">\ 10298 <div class="resource-empty">\ 10299 <div class="img-wrap"><img src="//storage.googleapis.com/i.addblock.net/config/fa_resource_img_icon.png" alt="image storage" /></div>\ 10300 <p>' + empty_str + '</p>\ 10301 </div>\ 10302 </li>\ 10303 '); 10304 10305 if(ulFiles.closest('.resource-container').find('.resource-search-btn').length > 0) ulFiles.closest('.resource-container').find('.resource-search-btn').removeClass('clicked'); 10306 ulFiles.closest('.tab-pane.active').find('ul.files').removeClass('ready'); 10307 ulFiles.closest('.tab-pane.active').find('.listprogress').remove(); 10308 } 10309 }, 10310 getMystorageFlc: function() { 10311 var check_ffolder = (SFOLDER_ACTIVE != '') ? SFOLDER_ACTIVE : 'all', 10312 ftotal = -1; 10313 10314 $.each(SFOLDER, function(i, o) { 10315 if(o.name == check_ffolder) { 10316 ftotal = o.fcount; 10317 return false; 10318 } 10319 }) 10320 10321 return ftotal; 10322 }, 10323 getMystorageFolderHtml: function(flname, flcount, flsize, fid, flfavorite) { 10324 if(!flname) return ''; 10325 10326 var checkAdd = (flname == 'clEmptyFolder') ? true : false, 10327 fln_val = flname.replace(/-/g,' '), 10328 fln_tooltip = (!checkAdd && flname.length > 6) ? ' data-toggle="tooltip" data-placement="top" data-original-title="' + flname + '"' : '', 10329 flc = (/^[0-9]*$/.test(flcount)) ? flcount * 1 : 0, 10330 fls = (/^[0-9.]*$/.test(flsize)) ? flsize * 1 : 0, 10331 fls_obj = formatFileSize(fls, 2, 'obj'), 10332 flf = (String(flfavorite) === '1') ? 1 : 0, 10333 favIcon = (flf === 1) ? clSVG('pin', 12, 12) : clSVG('pin_blank', 12, 12); 10334 10335 return '\ 10336 <li class="dd-item fli" data-id="' + flname + '" data-fid="'+ fid +'" data-favorite="'+ flf +'">\ 10337 <div class="fli-wrap dd-handle">\ 10338 ' + clSVG('move_handle', 20, 20, true, 'dd-icon cl-icon cl-handle') + '\ 10339 ' + clSVG('folder', 16, 12, true, 'dd-icon cl-icon cl-folder') + clSVG('folder_open', 16, 12, true, 'dd-icon cl-icon cl-folder-open') + '\
10340 <span class="dd-fln fl-nodrag" ' + fln_tooltip + '>' + fln_val + '</span>\ 10341 <span class="dd-flc" attr-count="' + flc + '">' + flc + '</span>\ 10342 <span class="dd-fls fli-hidden" attr-size="' + fls + '" attr-size-unit="' + fls_obj['unit'] + '">' + fls_obj['val'] + '</span>\ 10343 <span class="dd-fle fli-hover fl-nodrag" attr-id="' + flname + '">' + clSVG('pencil', 12, 12) + '</span>\ 10344 <span class="dd-fld fli-hover fl-nodrag" attr-id="' + flname + '">' + clSVG('delete', 12, 12) + '</span>\ 10345 <span class="dd-flf fli-hover fl-nodrag" attr-id="' + flname + '" data-fav="'+ flf +'">' + favIcon + '</span>\ 10346 </div>\ 10347 </li>\ 10348 '; 10349 }, 10350 setMystorageFolder: function(mode, val) { 10351 var myResourceTab = $('#mystorage'), 10352 myResourceFolderlist = myResourceTab.find('#nestableFolder'); 10353 10354 switch(mode) { 10355 case 'set_fll': 10356 myResourceFolderlist.removeClass('ready'); 10357 // myResourceFolderlist.nestable('init'); 10358 // if(typeof val != 'undefined' && val !== null && val.length > 0) SFOLDER = val; 10359 $.each(SFOLDER, function (i, o) { 10360 if(o['name'] == 'clEmptyFolder') return true; 10361 10362 if(i == 0) { 10363 var flc = (/^[0-9]*$/.test(o['fcount'])) ? o['fcount'] * 1 : 0, 10364 fls = (/^[0-9.]*$/.test(o['fsize'])) ? o['fsize'] * 1 : 0, 10365 fls_obj = formatFileSize(fls, 2, 'obj'); 10366 10367 myResourceFolderlist.find('.fli[data-id="all"] .dd-flc').attr('attr-count',flc).text(flc); 10368 myResourceFolderlist.find('.fli[data-id="all"] .dd-fls').attr({'attr-size':fls, 'attr-size-unit':fls_obj['unit']}).text(fls_obj['val']); 10369 return true; 10370 } 10371 10372 if(myResourceFolderlist.find('.fli[data-id="' + o['name'] + '"]').length > 0) return true; 10373 var add_folder = $.resource.getMystorageFolderHtml(o['name'], o['fcount'], o['fsize'], o['id'], o['favorite']); 10374 myResourceFolderlist.find('.fll').append(add_folder); 10375 }); 10376 10377 sortFolderFavoritesTop(); 10378 10379 // if(SFOLDER_ACTIVE != '' && SFOLDER_ACTIVE != myResourceFolderlist.find('.fll.active').attr('data-id')) myResourceFolderlist.find('.fli[data-id="' + SFOLDER_ACTIVE + '"]').addClass('active'); 10380 break; 10381 10382 case 'set_fli_state': 10383 var is_change = (val.ffolder == 'all' && val.state == 'move') ? false : true; 10384 10385 if(is_change) { 10386 var flc = $('#nestableFolder .fli[data-id="' + val.ffolder +'"]').find('.dd-flc').attr('attr-count'), 10387 fls = $('#nestableFolder .fli[data-id="'+ val.ffolder +'"]').find('.dd-fls').attr('attr-size'), 10388 new_flc = val.count * 1, 10389 new_fls = val.size * 1; 10390 10391 flc = (/^[0-9]*$/.test(flc)) ? flc * 1 : 0; 10392 new_flc += flc; 10393 10394 fls = (/^[0-9.]*$/.test(fls)) ? fls * 1 : 0; 10395 new_fls += fls; 10396 10397 var fls_obj = (new_flc < 1) ? {'val': 0, 'unit': 'Bytes'} : formatFileSize(new_fls, 2, 'obj'); 10398 $('#nestableFolder .fli[data-id="'+ val.ffolder +'"]').find('.dd-flc').attr('attr-count',new_flc).text(new_flc); 10399 $('#nestableFolder .fli[data-id="'+ val.ffolder +'"]').find('.dd-fls').attr({'attr-size':new_fls, 'attr-size-unit':fls_obj['unit']}).text(fls_obj['val']); 10400 } 10401 break; 10402 10403 case 'nodrag': 10404 if(val) { 10405 myResourceFolderlist.find('*').addClass('fl-nodrag'); 10406 myResourceFolderlist.find('.fli-wrap').removeClass('dd-handle'); 10407 } else { 10408 myResourceFolderlist.find('.fl-nodrag:not(:is(.dd-fln, .fli-hover))').removeClass('fl-nodrag'); 10409 myResourceFolderlist.find('.fli:not(.fli-first) .fli-wrap').addClass('dd-handle'); 10410 } 10411 break; 10412 10413 default: 10414 break; 10415 } 10416 }, 10417 open: function() { 10418 $('#el-fileupload').modal('show'); 10419 }, 10420 close: function() { 10421 $('#el-fileupload').modal('hide'); 10422 $('.uploadModal').remove(); 10423 }, 10424 selected: function() { 10425 var selected = new Array(), 10426 rmode = (myStorageActive()) ? 'my' : 'free', 10427 thisResourceSelected = $('#'+rmode+'storage .resource-selected-ul'); 10428 10429 thisResourceSelected.children('li').each(function() { 10430 selected.push($(this).find('p.selected-file-name').text()); 10431 }); 10432 10433 return selected; 10434 }, 10435 } 10436 10437 $.category = { 10438 delete : [], 10439 moveHandle : function() { 10440 return clSVG('move_handle', 20, 20, true, 'cl-sort-handle'); 10441 }, 10442 deleteHandle : function() { 10443 return '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" width="20" height="20"><g><g><path d="M13.12 5.88v-2H6.89v2H3.87v1.25h1v6.88c0 1.17.95 2.12 2.12 2.12h6c1.17 0 2.12-.95 2.12-2.12V7.13h1V5.88h-3Zm-1.24 0H8.15v-.75h3.73zm1.12 9H7c-.48 0-.87-.39-.88-.88V7.12h7.75V14c0 .48-.39.87-.88.88m-2.11-7h1.25v6.25h-1.25zm-3 0h1.25v6.25H7.88z"/></g></g></svg>'; 10444 }, 10445 init : function() { 10446 $(document).on('click', '#prod-category-text', function(e) { 10447 e.stopPropagation(); 10448 if($('.category-wrap').hasClass('open')) {
10449 $('.category-lists').slideUp(200, function() { 10450 $('.category-wrap').removeClass('open'); 10451 }); 10452 } else { 10453 $('.category-wrap').toggleClass('open'); 10454 $('.category-lists').slideDown(200); 10455 } 10456 }); 10457 $(document).on('click','.form-ctrl-button.category, .gallery-ctrl-category', function(e) { 10458 e.stopPropagation(); 10459 var s = $(this).attr('data-category'); 10460 $.category.open(s); 10461 }); 10462 $(document).on('click','.cl-category-modal-close',function(e) { $.category.close(); }); 10463 $(document).on('mousedown', '.prod-option-move', function(){ 10464 $(this).closest('.prod-option-list').css('overflow-y', 'auto'); 10465 }); 10466 $(document).on('mouseup', '.prod-option-move', function(){ 10467 $(this).closest('.prod-option-list').css('overflow-y', ''); 10468 }); 10469 $(document).on('blur','.edit-option-title input', function(e) { 10470 // ì¤ë³µê° ì²´í¬ 10471 checkDuplicateOptionName($(this)); 10472 }); 10473 10474 $(document).on('focus', '.edit-option-quantity .option-price-quantity', function() { 10475 $(this).attr('data-before_val', Number(removeCommas($(this).val()))); 10476 // var cnt = Number(removeCommas($(this).val())); 10477 // if(cnt == 0) 10478 // if($(this).closest('.prod-option-edit').find('.edit-option-select .option-price-status-str').attr('data-val') == 'O') { 10479 // $(this).closest('.prod-option-edit').find('.edit-option-select .option-price-status-select [data-val="S"]').click(); 10480 // } 10481 }).on('input', '.edit-option-quantity .option-price-quantity', function() { 10482 var before_val = Number(removeCommas($(this).attr('data-before_val'))); 10483 var cnt = Number(removeCommas($(this).val())); 10484 if(cnt > 9999) { 10485 alert('ìµë ì ë ¥ ìëì 9,999 ì ëë¤.'); 10486 cnt = 9999; 10487 $(this).val(addCommas('9999')); 10488 } 10489 if(before_val == 0 && cnt > 0 && $(this).closest('.prod-option-edit').find('.edit-option-select .option-price-status-str').attr('data-val') == 'O') { 10490 $(this).closest('.prod-option-edit').find('.edit-option-select .option-price-status-select [data-val="S"]').click(); 10491 } else if(cnt == 0 && $(this).closest('.prod-option-edit').find('.edit-option-select .option-price-status-str').attr('data-val') == 'S') { 10492 $(this).closest('.prod-option-edit').find('.edit-option-select .option-price-status-select [data-val="O"]').click(); 10493 } 10494 }).on('keydown', '.edit-option-quantity .option-price-quantity', function(e) { 10495 var is_number_key = (e.keyCode >= 48 && e.keyCode <= 57) || (e.keyCode >= 96 && e.keyCode <= 105); 10496 var value = String(removeCommas($(this).val())); 10497 var has_selection = this.selectionStart !== this.selectionEnd; 10498 10499 if(is_number_key && !e.ctrlKey && !e.metaKey && !e.altKey && !e.shiftKey && value.length >= 4 && !has_selection) { 10500 e.preventDefault(); 10501 alert('ìµë ì ë ¥ ìëì 9,999 ì ëë¤.'); 10502 $(this).val(addCommas('9999')).trigger('input'); 10503 } 10504 }).on('paste', '.edit-option-quantity .option-price-quantity', function(e) { 10505 var clipboard = e.originalEvent && e.originalEvent.clipboardData; 10506 var value = clipboard ? clipboard.getData('text').replace(/[^0-9]/g, '')
10506: ''; 10507 var current_value = String(removeCommas($(this).val())); 10508 var selected_value = $(this).val().substring(this.selectionStart, this.selectionEnd).replace(/[^0-9]/g, ''); 10509 var result_length = current_value.length - selected_value.length + value.length; 10510 10511 if(value !== '' && result_length > 4) { 10512 e.preventDefault(); 10513 alert('ìµë ì ë ¥ ìëì 9,999 ì ëë¤.'); 10514 $(this).val(addCommas('9999')).trigger('input'); 10515 } 10516 }); 10517 10518 $(document).on('click','.prod-option-title, .prod-option-price, .prod-option-quantity, .prod-option-status, .prod-option-desc, .prod-option-require', function(e) { 10519 e.stopPropagation(); 10520 var submit = true; 10521 var parent = $(this).closest('.prod-option'); 10522 $('.prod-option-item').each(function () { 10523 $(this).closest('li').removeClass('err'); 10524 }); 10525 10526 if($('.prod-option-edit').length <= 2) { 10527 $('.edit-option-delete').addClass('hide'); 10528 } else { 10529 $('.edit-option-delete').removeClass('hide'); 10530 } 10531 10532 if($('.prod-option-list .prod-option-item.hide').length) { 10533 $.each($('.prod-option-item.hide'), function(i,v) { 10534 var opt_title = $(v).parent().find('.prod-option-edit .edit-option-title input').val(), 10535 opt_desc = $(v).parent().find('.prod-option-edit .edit-option-desc input').val(), 10536 opt_price = $(v).parent().find('.prod-option-edit .edit-option-price input').val(), 10537 opt_quantity = $(v).parent().find('.prod-option-edit .edit-option-quantity input').val(), 10538 opt_status = $(v).parent().find('.prod-option-edit .option-price-status-str').attr('data-val'), 10539 opt_text_require = $(v).parent().find('.prod-option-edit .option-require-str').attr('data-val'); 10540 10541 $(v).closest('li').removeClass('err'); 10542 if(product_options.advanced == 'false') { 10543 if(opt_title.length == 0) { 10544 $(v).closest('li').addClass('err').find('.edit-option-title input'); 10545 submit = false; 10546 return true; 10547 } 10548 } 10549 switch(opt_status) { 10550 case "S" : str = 'í매'; break; 10551 case "O" : str = 'íì '; break; 10552 case "H" : str = 'ì¨ê¹'; break; 10553 default : str = 'í매'; break; 10554 } 10555 var check; 10556 // if(opt_text_require == 'TR') { 10557 // check = "\ 10558 // <span>íì</span>\ 10559 // <svg class='active' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' width='16' height='16'>\ 10560 // <path d='M13 0H3C1.34 0 0 1.34 0 3v10c0 1.66 1.34 3 3 3h10c1.66 0 3-1.34 3-3V3C16 1.34 14.66 0 13 0zM13.03 6.03l-5.5 5.5C7.38 11.68 7.19 11.75 7 11.75s-0.38-0.07-0.53-0.22l-3.5-3.5c-0.29-0.29-0.29-0.77 0-1.06s0.77-0.29 1.06 0L7 9.94l4.97-4.97c0.29-0.29 0.77-0.29 1.06 0S13.32 5.74 13.03 6.03z'/>\ 10561 // </svg>"; 10562 // } else { 10563 // check = "\ 10564 // <span>íì</span>\ 10565 // <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' width='16' height='16'>\ 10566 // <path d='M13 0H3C1.3 0 0 1.3 0 3v10c0 1.7 1.3 3 3 3h10c1.7 0 3-1.3 3-3V3C16 1.3 14.7 0 13 0zM15 13c0 1.1-0.9 2-2 2H3c-1.1 0-2-0.9-2-2V3c0-1.1 0.9-2 2-2h10c1.1 0 2 0.9 2 2V13z'/>\ 10567 // </svg>"; 10568 // } 10569 var soption = String(opt_price); 10570 if(soption.replace('+','') == '' || soption.replace('-','') == '') opt_price = 0; 10571 opt_price = removeCommas(opt_price); 10572 opt_quantity = removeCommas(opt_quantity); 10573 if (!opt_quantity) opt_quantity = 0; 10574 if (!opt_price || isNaN(opt_price) === true) o
10574pt_price = 0; 10575 10576 opt_quantity = (opt_quantity * 1); 10577 opt_price = (opt_price * 1); 10578 10579 var abs_price = Math.abs(opt_price), 10580 str_price = addCommas(abs_price.toString()), 10581 str_quantity = addCommas(opt_quantity.toString()); 10582 10583 $(v).find('.prod-option-title').text(opt_title); 10584 $(v).find('.prod-option-desc').text(opt_desc); 10585 $(v).find('.prod-option-price').text(str_price).attr('data-option-price',opt_price); 10586 $(v).find('.prod-option-quantity').text(opt_quantity); 10587 $(v).find('.prod-option-status').text(str).attr('data-val',opt_status); 10588 $(v).find('.prod-option-require').html(check).attr('data-val',opt_status); 10589 $(v).parent().find('.prod-option-edit').addClass('hide'); 10590 $(v).removeClass('hide'); 10591 10592 // ë¤ë¥¸ ìµì input ì íì 기존 ê° 0ë¨ 10593 // if(opt_price < 0) { 10594 // $(this).find('.prod-option-price').text(str_price); 10595 // $(this).find('.prod-option-price').find('.prod-option-price').addClass('minus'); 10596 // } else { 10597 // $(this).find('.prod-option-price').text(str_quantity); 10598 // $(this).find('.prod-option-price').find('.prod-option-price').removeClass('minus'); 10599 // } 10600 }); 10601 } 10602 10603 var title = $(this).parent().find('.prod-option-title').text(), 10604 title_html = $(this).parent().find('.prod-option-title').html(), 10605 desc = $(this).parent().find('.prod-option-desc').text(), 10606 price = $(this).parent().find('.prod-option-price').attr('data-option-price'), 10607 quantity = $(this).parent().find('.prod-option-quantity').text(), 10608 status = $(this).parent().find('.prod-option-status').attr('data-val'), 10609 text_require = $(this).parent().find('.prod-option-require').attr('data-val'), 10610 $title = $(this).parent().siblings('.prod-option-edit').find('.edit-option-title input'), 10611 $title_html = $(this).parent().siblings('.prod-option-edit').find('.edit-option-title'), 10612 $desc = $(this).parent().siblings('.prod-option-edit').find('.edit-option-desc input'), 10613 $price = $(this).parent().siblings('.prod-option-edit').find('.edit-option-price input'), 10614 $quantity = $(this).parent().siblings('.prod-option-edit').find('.edit-option-quantity input'), 10615 $status = $(this).parent().siblings('.prod-option-edit').find('.option-price-status-str'), 10616 $text_require = $(this).parent().siblings('.prod-option-edit').find('.option-require-str'); 10617 10618 if(price == 'NaN') price = 0; 10619 switch(status) { 10620 case "S" : str = 'í매'; break; 10621 case "O" : str = 'íì '; break; 10622 case "H" : str = 'ì¨ê¹'; break; 10623 default : str = 'í매'; break; 10624 } 10625 price = removeCommas(price); 10626 quantity = removeCommas(quantity); 10627 if (!quantity) quantity = 0; 10628 if (!price || isNaN(price)) price = 0; 10629 10630 price = (price * 1); 10631 quantity = (quantity * 1); 10632 10633 if(product_options.advanced == 'true') { 10634 $title_html.html(title_html); 10635 } else { 10636 $title.val(title); 10637 } 10638 $desc.val(desc); 10639 $price.val(addCommas(price.toString())); 10640 $quantity.val(addCommas(quantity.toString())); 10641 $status.text(str).attr('data-val', status); 10642 // $text_require.html(check).attr('data-val', text_require); 10643 10644 $(this).parent().addClass('hide'); 10645 $(this).parent().siblings('.prod-option-edit').removeClass('hide'); 10646 if($(this).hasClass('prod-option-title')) $title.focus(); 10647 if($(this).hasClass('prod-option-price')) $price.focus(); 10648 if($(this).hasClass('prod-option-quantity')) $quantity.focus(); 10649 }); 10650 10651 $(document).on('keydown', '.edit-option-title input, .options-input', function(e) { 10652 var keyCode = e.keyCode,
10653 shiftKey = e.shiftKey; 10654 10655 if(keyCode == 222) 10656 if(shiftKey) return false; 10657 10658 if(keyCode == 191 || keyCode == 111) { 10659 if(shiftKey) return; 10660 e.stopPropagation(); 10661 return false; 10662 } 10663 10664 if($(this).hasClass('options-input')) { 10665 var value = $(this).val(), 10666 last = value.split("").pop(); 10667 if(last == "," && keyCode == 188) { 10668 alert('ìµì ê°ì ìë§ê² ì ë ¥í´ì£¼ì¸ì'); 10669 return false; 10670 } 10671 } 10672 }); 10673 10674 $(document).on('keyup keydown click','.edit-option-title input, .edit-option-desc input, .edit-option-price input, .edit-option-quantity input',function(e) { 10675 e.stopPropagation(); 10676 var keyCode = e.keyCode || e.which, 10677 eType = e.type, 10678 target = e.target, 10679 $title = $(this).parents('.form-wrap').find('.edit-option-title input'), 10680 $desc = $(this).parents('.form-wrap').find('.edit-option-desc input'), 10681 $price = $(this).parents('.form-wrap').find('.edit-option-price input'), 10682 $quantity = $(this).parents('.form-wrap').find('.edit-option-quantity input'), 10683 $status = $(this).parents('.form-wrap').find('.option-price-status-str'), 10684 $text_require = $(this).parents('.form-wrap').find('.option-price-status-str'); 10685 10686 if(eType == 'keydown' && keyCode == 13) e.preventDefault(); //enter submit ë°©ì§ 10687 10688 var price = removeCommas($price.val())*1, 10689 quantity = removeCommas($quantity.val())*1; 10690 10691 var $li = $(this).parents('li'); 10692 10693 if(price < 0) { 10694 $li.find('.prod-option-price').text(Math.abs(price)); 10695 $li.find('.prod-option-price').addClass('minus'); 10696 } else { 10697 $li.find('.prod-option-price').text(price); 10698 $li.find('.prod-option-price').removeClass('minus'); 10699 } 10700 10701 var abs_price = Math.abs(price), 10702 str_price = addCommas(abs_price.toString()), 10703 str_quantity = addCommas(quantity.toString()); 10704 10705 $li.find('.prod-option-title').text($title.val()); 10706 $li.find('.prod-option-desc').text($desc.val()); 10707 $li.find('.prod-option-price').text(str_price); 10708 $li.find('.prod-option-price').attr('data-option-price', price); 10709 $li.find('.prod-option-quantity').text(str_quantity); 10710 $li.find('.prod-option-status').text($status.text()); 10711 10712 var submit = false; 10713 var isDuplicate = true; 10714 if(eType == 'click' && !$(target).is('.prod-option-list') && !$(target).is('input')) { //ë¤ë¥¸ ìµì í´ë¦ ì ì ë ¥ 10715 isDuplicate = checkDuplicateOptionName($title); 10716 submit = true; 10717 } 10718 10719 if(eType == 'keyup') { 10720 if(keyCode == 13) { 10721 isDuplicate = checkDuplicateOptionName($title); 10722 e.preventDefault(); 10723 submit = true; 10724 } 10725 10726 if($('.switch-quantity').prop('checked') == true) { //ì¬ê³ ê´ë¦¬ on 10727 if(keyCode == 9 && !$('.option-price-number').is(':focus') && !$('.option-price-quantity').is(':focus')) { //tab 10728 isDuplicate = checkDuplicateOptionName($title); 10729 submit = true; 10730 } 10731 } else { //ì¬ê³ ê´ë¦¬ off 10732 if(keyCode == 9 && !$('.option-price-number').is(':focus')) { //tab 10733 isDuplicate = checkDuplicateOptionName($title); 10734 submit = true; 10735 } 10736 } 10737 } 10738 10739 if(submit && isDuplicate == false) { 10740 shoppingSetOption($('.prod-option-item.hide')); 10741 } 10742 }); 10743 10744 $(document).on('click', function(e) { 10745 if(!$(e.target).is('.prod-discount-unit-select') && $(e.target).closest('.prod-discount-unit-select').length == 0) { 10746 $('.discount-unit-select').hide(); 10747 } 10748 if(!$(e.target).is('.prod-option-list')) { 10749 shoppingSetOption($('.prod-option-item.hide')); 10750 } 10751 10752 if($('.prod-modal').has(e.target).length) { 10753 if(!$('.delivery-template-list').has(e.target).length && $('.delivery-template-list').get(0) != e.target && !$('#delivery_template_seq').has(e.target).length && $('#delivery_template_seq').get(0) != e.target) { 10754 $('.delivery-template-list').slideUp(200); 10755 $('#delivery_template_seq.open').removeClass('open'); 10756 } 10757 10758 if(!$('#prod-category-lists').has(e.target).length && $('#prod-category-lists').get(0) != e.target && !$('#prod-category-text').has(e.target).length && $('#prod-category-text').get(0) != e.target) {
10759 $('#prod-category-lists').slideUp(200); 10760 $('.category-wrap.open').removeClass('open'); 10761 } 10762 } 10763 }); 10764 10765 $(document).on('click', '#delivery_template_seq:not(.limit-disabled)', function() { 10766 $(this).toggleClass('open'); 10767 if($(this).hasClass('open')) { 10768 $('.delivery-template-list').slideDown(200); 10769 } else { 10770 $('.delivery-template-list').slideUp(200); 10771 } 10772 }); 10773 10774 $(document).on('input', '#product_weight', function(e) { 10775 var val = $(this).val().replace(/,/g, ''); 10776 if(val.indexOf('.') > -1 && val.indexOf('.') < val.length-4) { 10777 val = Number((Math.floor(Number(val) * 1000) / 1000).toFixed(3)); 10778 } 10779 10780 if(Number(val) > 100) { 10781 val = number_format(100); 10782 } 10783 10784 $(this).val(val); 10785 }).on('blur', '#product_weight', function() { 10786 var val = $(this).val().replace(/,/g, ''); 10787 if(val.indexOf('.') > -1 && val.indexOf('.') == val.length-1) { 10788 $(this).val(number_format(val.replace(/\./g, ''))); 10789 } 10790 }); 10791 10792 $(document).on('click', '.btn-delivery-template-setting', function() { 10793 var shopping_url = $(this).data('shopping_url'); 10794 deliveryTemplateListModal(shopping_url, function() { 10795 $.processON(); 10796 var site = (typeof SID == 'undefined') ? property.SID : SID, 10797 // page = (typeof PAGE == 'undefined') ? ((typeof PROD_PAGE == 'undefined') ? property.PAGE : PROD_PAGE) : PAGE, 10798 pid = (typeof selectID == 'undefined') ? null : selectID, 10799 id = $('#prod-no').val(); 10800 setTimeout(function() { 10801 $.ajax({ 10802 url: '/template/products/', 10803 data: { type:'get', sid:site, id:id, pid:pid }, 10804 dataType: 'json', 10805 type: 'POST', 10806 async: false, 10807 cache: false, 10808 success: function (data) { 10809 if(data.error != 'undefined' && data.error) { 10810 alert(data.error); 10811 return false; 10812 } 10813 var i = data.item, 10814 url = (typeof RESOURCE == 'undefined') ? property.RESOURCE : RESOURCE, 10815 folder = '', f = ''; 10816 10817 var delivery_template_str = ''; 10818 if(i.delivery_template) { 10819 $.each(i.delivery_template, function(k, v) { 10820 var template_desc = ''; 10821 template_desc += '('; 10822 template_desc += $.lang[LANG]['shopping.delivery.template.mix_yn.' + v.mix_yn.toLowerCase()]; 10823 var delivery_type_arr = v.delivery_type.split(','); 10824 var delivery_type_str = ''; 10825 $.each(delivery_type_arr, function(idx, delivery_type) { 10826 if(delivery_type_str) delivery_type_str += ', '; 10827 delivery_type_str += $.lang[LANG]['shopping.delivery.template.delivery_type.' + delivery_type.toLowerCase()]; 10828 }); 10829 if(delivery_type_str) 10830 template_desc += ' / ' + delivery_type_str; 10831 10832 if(delivery_type_arr.indexOf('DELIVERY') > -1) { 10833 template_desc += ' / ' + $.lang[LANG]['shopping.delivery.' + v.delivery_company.toLowerCase()]; 10834 } 10835 10836 template_desc += ' / ' + $.lang[LANG]['shopping.delivery.template.price_type.' + v.price_type.toLowerCase()]; 10837 10838 if(v.price_type == 'FIX') { 10839 template_desc += '(' + number_format(v.delivery_fee) + 'ì)'; 10840 } else if(v.price_type == 'QUANTITY' || v.price_type == 'WEIGHT') { 10841 var price_type_detail = v.price_type_detail ? JSON.parse(v.price_type_detail) : {}; 10842 10843 if(price_type_detail.method == 'DIFFERENTIAL') { 10844 var detail = ''; 10845 if(price_type_detail.detail) { 10846 $.each(price_type_detail.detail, function(i, j) { 10847 var value = Object.keys(j); 10848 var price = Object.values(j); 10849 10850 if(v.price_type == 'QUANTITY') { 10851 if(i < 2) { 10852 if(detail) detail += ', '; 10853 detail += value + 'ê° ì´ì(' + number_format(price) + 'ì)'; 10854 } 10855 } else if(v.price_type == 'WEIGHT') { 10856 if(i < 2) { 10857 if(detail) detail += ', '; 10858 detail += value + 'Kg ì´ì(' + number_format(price) + 'ì)'; 10859 } 10860 } 10861 }); 10862 } 10863 if(template_desc) { 10864 detail = '(ì°¨ë± / ' + detail + ')'; 10865 template_desc += detail; 10866 } 10867 } else if(price_type_detail.method == 'REPEAT') { 10868 var detail = ''; 10869 var value = Object.keys(price_type_detail.detail); 10870 var price = Object.values(price_type_detail.detail); 10871 10872 if(v.price_type == 'QUANTITY') { 10873 detail += value + 'ê° êµ¬ë§¤ìë§ë¤ ' + number_format(price) + 'ì ë°ë³µ ë¶ê³¼'; 10874 } else if(v.price_type == 'WEIGHT') { 10875 detail += value + 'Kgë§ë¤ ' + number_format(price) + 'ì ë°ë³µ ë¶ê³¼'; 10876 } 10877 10878 if(detail) { 10879 detail = '(ë°ë³µ / ' + detail + ')'; 10880 template_desc += detail; 10881 } 10882 } 10883 } 10884 10885 if(v.additional_yn == 'Y') { 10886 template_desc += ' / ëìì°ê° ì§ì ì¶ê° ë°°ì¡ë¹ (ì 주 ' + number_format(v.additional_jeju_price) + 'ì, ì 주 ì¸ ëìì°ê° ' + number_format(v.additional_land_price) + 'ì)'; 10887 } 10888 10889 template_desc += ' / ' + $.lang[LANG]['shopping.delivery.template.pay_type.' + v.pay_type.toLowerCase()]; 10890 10891 if(v.free_condition_yn == 'Y') { 10892 template_desc += ' / ' + number_format(v.free_condition) + 'ì ì´ì ë¬´ë£ ë°°ì¡'; 10893 } 10894 10895 if(v.make_to_order_yn == 'Y') { 10896 template_desc += ' / 주문 íì¸ í ' + v.due_date + 'ì¼ í ë°°ì¡ ìì '; 10897 } 10898 if(v.install_fee_yn == 'Y') { 10899 template_desc += ' / ë³ë ì¤ì¹ë¹ ìì'; 10900 } 10901 template_desc += ')'; 10902 10903 delivery_template_str += '\ 10904 <li data-val="' + v.seq + '" data-weight="' + (v.price_type == 'WEIGHT' ? 'true' : 'false') + '">\ 10905 <input type="radio" id="delivery_template_seq_' + v.seq + '" name="delivery_template_seq" value="' + v.seq + '" />\ 10906 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18" width="18" height="18"><path d="M9 0a9 9 0 1 0 .001 18.001A9 9 0 0 0 9 0zm0 17c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18" width="18" height="18"><path d="M9 0a9 9 0 1 0 .001 18.001A9 9 0 0 0 9 0zm0 17c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"></path><circle cx="9" cy="9" r="6"></circle></svg>\ 10907 <label for="delivery_template_seq_' + v.seq + '">\
10908 <span class="template-name">' + v.name + '</span>\ 10909 <span class="template-desc">' + template_desc + '</span>\ 10910 </label>\ 10911 </li>'; 10912 }); 10913 } 10914 10915 $('.option-delivery-template-select').html(delivery_template_str); 10916 10917 if(typeof i.delivery_template_seq != 'undefined' && i.delivery_template_seq) { 10918 $('.option-delivery-template-select input[name="delivery_template_seq"][value="' + i.delivery_template_seq + '"]').prop('checked', true); 10919 10920 $('.option-delivery-template-str').html($('.option-delivery-template-select li[data-val="' + i.delivery_template_seq + '"] label').html()); 10921 10922 if($('.option-delivery-template-select li[data-val="' + i.delivery_template_seq + '"]').data('weight') == false) { 10923 $('.product-weight').hide(); 10924 $('#product_weight').val(''); 10925 } else { 10926 $('.product-weight').show(); 10927 $('#product_weight').val(number_format(i.p.product_weight) + 'kg'); 10928 } 10929 } else { 10930 $('.option-delivery-template-select input[name="delivery_template_seq"]:first').prop('checked', true).change(); 10931 } 10932 }, 10933 complete: function() { 10934 $.processOFF(); 10935 } 10936 }); 10937 }); 10938 }); 10939 }); 10940 10941 // $(document).off('click','.prod-option-add'); 10942 $(document).on('click','.prod-option-add', addProductOption); 10943 10944 $(document).on('click', '.cl_etc_state_check', function () { 10945 $('.cl_etc_state_check').each(function () { 10946 $(this).removeClass('active'); 10947 }); 10948 10949 $(this).addClass('active'); 10950 var val = $(this).attr('data-val'); 10951 $('#etc-date-state').val(val); 10952 10953 switch(val) { 10954 case 'Y': 10955 $('.etc-setting').removeClass('hide'); 10956 $('.time-setting').addClass('hide'); 10957 break; 10958 case 'T': 10959 $('.etc-setting').removeClass('hide'); 10960 $('.time-setting').removeClass('hide'); 10961 break; 10962 default: 10963 $('.etc-setting').addClass('hide'); 10964 break; 10965 } 10966 }); 10967 10968 $(document).on('click', '.cl_etc_status_check', function () { 10969 $('.cl_etc_status_check').each(function () { 10970 $(this).removeClass('active'); 10971 }); 10972 10973 $(this).addClass('active'); 10974 var val = $(this).attr('data-val'); 10975 10976 $('#etc-date-status').val(val); 10977 }); 10978 10979 // $(document).on('click', '.cl_etc_week_check', function () { 10980 // $('.cl_etc_week_check').each(function () { 10981 // $(this).removeClass('active'); 10982 // }); 10983 10984 // $(this).addClass('active'); 10985 // var val = $(this).attr('data-val'); 10986 // $('#etc-date-week').val(val); 10987 // exceptPicker.disabledDays = null; 10988 // if(val == 'W') { 10989 // exceptPicker.disabledDays = [0, 6]; 10990 // } else if(val == 'K') { 10991 // exceptPicker.disabledDays = [1, 2, 3, 4, 5]; 10992 // } else { 10993 // exceptPicker.disabledDays = null; 10994 // } 10995 // //exceptPicker.generateDates(true); 10996 // exceptPicker.setSelectedDates($('#etc-start-date-txt').val(), 'start'); 10997 // exceptPicker.setSelectedDates($('#etc-end-date-txt').val(), 'end'); 10998 // setExceptPicker(); 10999 // }); 11000 11001 // $(document).on('click', '.cl_etc_date_time', function () { 11002 // $('.cl_etc_date_time').each(function () { 11003 // $(this).removeClass('active'); 11004 // }); 11005 11006 // $(this).addClass('active'); 11007 // var startDate = $(this).attr('data-start_date'); 11008 // var endDate = $(this).attr('data-end_date'); 11009 // $('#etc-start-date-txt').val(startDate); 11010 // $('#etc-end-date-txt').val(endDate); 11011 // //exceptPicker.generateDates(true); 11012 // exceptPicker.setSelectedDates(startDate, 'start'); 11013 // exceptPicker.setSelectedDates(endDate, 'end'); 11014 // setExceptPicker(); 11015 // }); 11016 11017 $(document).on('click', '.cl_product_state_check', function (e) { 11018 var state = $(this).attr('for'); 11019 var cnt = $('.prod-option[data-option_mode="normal"] .prod-option-list > li').length; 11020 var tax = $('#tax').attr('data-total-tax'); 11021 var productNumber = $('#prod-no').val(); 11022 var status = true; 11023 11024 var current = $('input[name="product_state"]:checked').val(); 11025 if(current == "N" && product_options.advanced == 'true') { 11026 if(e.originalEvent != 'undefined' && (state == 'download-product' || state == 'etc-product')) { 11027 var str = (state == 'download-product') ? 'ë¤ì´ë¡ë' : '기í무í'; 11028 if(confirm(str + ' ìíì ê³ ê¸ì¤ì ì ì§ìíì§ ìì ë±ë¡ë ìµì ì ë³´ê° ì´ê¸°í ë©ëë¤. ìí ì íì ë³ê²½íìê² ìµëê¹?') == false) return false;
11029 else { 11030 $('.options-config').hide(); 11031 resetOptions(); 11032 } 11033 } 11034 } 11035 // console.log(state); 11036 if(state != 'normal-product') { 11037 $('.delivery-template, .product-weight, .brand, .unit-pricing').hide(); 11038 } 11039 11040 if (state == "download-product") { //ë¤ì´ë¡ëìí ì í 11041 //ì ë ¥ìµì ë¹íì±í 11042 $('.prod-option[data-option_mode="text"]').addClass('hide'); 11043 $('#text-option').prop('checked', false).closest('.newcheckbox').hide(); 11044 //ì¶ê°ìµì ë¹íì±í 11045 $('.prod-option[data-option_mode="additional"]').addClass('hide'); 11046 $('#additional-option').prop('checked', false).closest('.newcheckbox').hide(); 11047 11048 if($('.prod-option-tab .prod-option.hide').length == 3) { //í 모ë ë¹íì±íì¼ë 11049 $('.prod-option-tab').addClass('hide'); 11050 if($('.switch-quantity').is(":checked") == true) { 11051 $('.quantity-label').removeClass('on'); 11052 } 11053 } 11054 11055 $('#state-append').fadeIn(0); 11056 $('#etc-calendar').hide(); 11057 if ($('#normal-option').is(':checked') === false) { //ì¼ë°ìµì ìì 11058 if ($('.real-file-name').length < 1) { 11059 $('.switch-product[value="off"]').prop('checked', true); 11060 $('#status-append').fadeOut(0); 11061 $('#sale-calendar').hide(); 11062 } 11063 var html = '<div class="form-group" id="product-state">\ 11064 <input type="file" id="upload-file" name="files">\ 11065 <div class="product-state-box" id="add-upload-check">\ 11066 <div class="product-upload">\ 11067 <div class="title">íì¼ ì ë¡ë</div>\ 11068 <div class="download-contents">\ 11069 <span class="cl_icon_upload02" data-cnt="0">ì ë¡ë</span>\ 11070 <div id="none-option-file">\ 11071 </div>\ 11072 </div>\ 11073 </div>\ 11074 <div class="download-setting">\ 11075 <div class="title">ë¤ì´ë¡ë<br>íëì¤ì '; 11076 /*html += '<span class="cl-icon cl_icon_info01"></span>';*/ 11077 html += '</div>\ 11078 <div id="download-contents">\ 11079 <div class="input-box">\ 11080 <div class="title">ê¸°ê° ì í</div>\ 11081 <div class="textbox">\ 11082 <input type="text" numberOnly class="download-input" id="download-date" value="1" maxlength="90">\ 11083 <span>ì¼</span>\ 11084 </div>\ 11085 </div>\ 11086 <div class="input-box">\ 11087 <div class="title">íì ì í</div>\ 11088 <div class="textbox">\ 11089 <input type="text" numberOnly class="download-input" id="download-count" value="1" maxlength="10">\
11090 <span>í</span>\ 11091 </div>\ 11092 </div>\ 11093 </div>\ 11094 </div>\ 11095 </div>\ 11096 </div>'; 11097 // console.log(html); 11098 $('#product-state').remove(); 11099 $('#state-append').append(html); 11100 11101 $('.prod-option[data-option_mode="normal"] .prod-option-list > li').each(function () { 11102 var $checkTag = $(this).children('.product-status'); 11103 if ($checkTag.hasClass('product-status') === false) { 11104 var item = '<div class="form-group product-status">\ 11105 <div class="product-state-box">\ 11106 <div class="product-upload">\ 11107 <div class="title">íì¼ ì ë¡ë</div>\ 11108 <div class="download-contents">\ 11109 <span class="cl_icon_upload02" data-cnt="0">ì ë¡ë</span>\ 11110 <div class="file-box-list" id="file-box-0"></div>\ 11111 </div>\ 11112 </div>\ 11113 </div>\ 11114 </div>'; 11115 fileUpdateCnt++; 11116 11117 $(this).append(item); 11118 } else { 11119 var $loadTag = $('.prod-option[data-option_mode="normal"] .prod-option-list > li').eq(0).find('.download-contents div'); 11120 // console.log($loadTag.html()); 11121 $('#none-option-file').html($loadTag.html()); 11122 } 11123 }); 11124 } else { //ë¤ì´ë¡ë ì¸ ë¤ë¥¸ìí 11125 var html = '<div class="form-group" id="product-state">\ 11126 <input type="file" id="upload-file" name="files" data-cnt="'+fileUpdateCnt+'">\ 11127 <div class="product-state-box" id="add-upload-check">\ 11128 <div class="download-setting">\ 11129 <div class="title">ë¤ì´ë¡ë<br>íëì¤ì '; 11130 /*html += '<span class="cl-icon cl_icon_info01"></span>';*/ 11131 html += '</div>\ 11132 <div class="download-contents">\ 11133 <div class="input-box">\ 11134 <div class="title">ê¸°ê° ì í</div>\ 11135 <div class="textbox">\ 11136 <input type="text" numberOnly class="download-input" id="download-date" value="1" maxlength="90">\ 11137 <span>ì¼</span>\ 11138 </div>\ 11139 </div>\ 11140 <div class="input-box">\ 11141 <div class="title">íì ì í</div>\ 11142 <div class="textbox">\ 11143 <input type="text" numberOnly class="download-input" id="download-count" value="1" maxlength="10">\
11144 <span>í</span>\ 11145 </div>\ 11146 </div>\ 11147 </div>\ 11148 </div>\ 11149 </div>\ 11150 </div>'; 11151 11152 $('#product-state').remove(); 11153 $('#state-append').append(html); 11154 11155 $('.prod-option[data-option_mode="normal"] .prod-option-list > li').each(function () { 11156 var $checkTag = $(this).children('.product-status'); 11157 var option_mode = $(this).closest('.prod-option').attr('data-option_mode'); 11158 var name = $(this).find('.prod-option-title').text(); 11159 11160 if ($checkTag.hasClass('product-status') === false && option_mode == 'normal') { 11161 var item = '<div class="form-group product-status">\ 11162 <div class="product-state-box">\ 11163 <div class="product-upload">\ 11164 <div class="title">íì¼ ì ë¡ë</div>\ 11165 <div class="download-contents">\ 11166 <span class="cl_icon_upload02" data-cnt="'+fileUpdateCnt+'">ì ë¡ë</span>'; 11167 if (name == 'noneOption') item += '<div class="file-box-list" id="file-box-0">'; 11168 else item += '<div class="file-box-list" id="file-box-'+fileUpdateCnt+'">'; 11169 item += '</div>\ 11170 </div>\ 11171 </div>\ 11172 </div>\ 11173 </div>'; 11174 fileUpdateCnt++; 11175 11176 $(this).find('.prod-option-status').text('íì ').attr('data-val', 'O'); 11177 $(this).find('.option-price-status-str').text('íì ').attr('data-val', 'O'); 11178 11179 $(this).append(item); 11180 } 11181 }); 11182 } 11183 fileUpdateCnt++; 11184 } else { 11185 if($('#product-state').length == 0) { 11186 $('#text-option').closest('.newcheckbox').show(); 11187 $('#additional-option').closest('.newcheckbox').show(); 11188 } 11189 11190 if (productNumber) { 11191 var admin_url = (uadmin == 'um')? '/_admin':''; 11192 $.ajax({ 11193 url: admin_url + '/shopping/download_list_check', 11194 type: 'post', 11195 dataType: 'json', 11196 data: {'product_number': productNumber, 'option_seq': 0}, 11197 success: function (data) { 11198 if (data.code == 'fail') { 11199 alert(data.message); 11200 status = false; 11201 return false; 11202 } 11203 } 11204 }); 11205 } 11206 11207 if (status == false) return false; 11208 11209 if (cnt > 0) { 11210 var checkFile = $('.file-name').length; 11211 if (checkFile > 0) { 11212 if (confirm('ìí ì íì ë³ê²½í ê²½ì° ìµì ì ë±ë¡ë íì¼ì´ ìì ë©ëë¤.\nê³ìíìê² ìµëê¹?') === true) { 11213 $('#product-state').remove(); 11214 $('.product-status').remove(); 11215 } else return false;
11216 } else { 11217 $('#product-state').remove(); 11218 $('.product-status').remove(); 11219 } 11220 } else { 11221 $('#product-state').remove(); 11222 $('.product-status').remove(); 11223 } 11224 11225 if (state=='normal-product' && taxUse != 'TG03' && $('#product-state').length == 0) { 11226 $('.options-config').show(); 11227 $('#state-append').fadeOut(0); 11228 } 11229 else { 11230 $('#state-append').fadeIn(0); 11231 } 11232 11233 if (state == "etc-product") { 11234 $('#etc-calendar').show(); 11235 } else { 11236 $('#etc-calendar').hide(); 11237 } 11238 11239 if (state == 'normal-product') { 11240 if(!$('.delivery-template-list').find('[data-val]').find('input[name="delivery_template_seq"]:checked').length) { 11241 $('.delivery-template-list').find('[data-val]:first').find('input[name="delivery_template_seq"]').prop('checked', true).change(); 11242 } 11243 $('.delivery-template, .brand, .unit-pricing').show(); 11244 } 11245 } 11246 11247 if(state != 'normal-product') { 11248 $('.options-config').hide(); 11249 $('.culture-benefit').hide(); 11250 $('#pccc-yn').hide(); 11251 } else { 11252 $('.options-config').show(); 11253 $('.culture-benefit').show(); 11254 $('#pccc-yn').show(); 11255 } 11256 11257 if(state != 'download-product') { 11258 if($('#product-state').length == 0) { 11259 $('#text-option').closest('.newcheckbox').show(); 11260 $('#additional-option').closest('.newcheckbox').show(); 11261 } 11262 } 11263 11264 $('.cl_product_state_check').each(function () { 11265 $(this).children('.cl-icon').removeClass('cl_icon_check02_on').removeClass('cl_icon_check02_off').addClass('cl_icon_check02_off'); 11266 $(this).removeClass('active'); 11267 }); 11268 11269 $(this).children('.cl-icon').removeClass('cl_icon_check02_off').addClass('cl_icon_check02_on'); 11270 11271 $(this).addClass('active'); 11272 11273 if(typeof updateNpayButtonSettingState == 'function') updateNpayButtonSettingState(state); 11274 }); 11275 11276 /* product.add.html common tooltip ******/ 11277 $(document).on('mouseenter', '.cl-tooltip-info', function () { 11278 var info_type = ($(this).attr('data-infotype')) ? $(this).attr('data-infotype') : ''; 11279 $('.cl-prod-info.'+info_type+'-info').fadeIn(100); 11280 }).on('mouseleave', '.cl-tooltip-info', function () { 11281 var info_type = ($(this).attr('data-infotype')) ? $(this).attr('data-infotype') : ''; 11282 $('.cl-prod-info.'+info_type+'-info').fadeOut(100); 11283 }); 11284 11285 $(document).on('mouseenter', '.cl-pccc-info', function () { 11286 $('.cl-prod-info.pccc-info').fadeIn(100); 11287 }).on('mouseleave', '.cl-pccc-info', function () { 11288 $('.cl-prod-info.pccc-info').fadeOut(100); 11289 }); 11290 11291 $(document).on('mouseenter', '.cl-culture-benefit-info', function () { 11292 $('.cl-prod-info.culture-benefit-info').fadeIn(100); 11293 }).on('mouseleave', '.cl-culture-benefit-info', function () { 11294 $('.cl-prod-info.culture-benefit-info').fadeOut(100); 11295 }); 11296 11297 $(document).on('mouseenter', '.cl-discount-info', function () { 11298 $('.cl-prod-info.discount-info').fadeIn(100); 11299 }).on('mouseleave', '.cl-discount-info', function () { 11300 $('.cl-prod-info.discount-info').fadeOut(100); 11301 }); 11302 11303 $(document).on('mouseenter', '.cl-status-info', function () { 11304 $('.cl-prod-info.status-info').fadeIn(100); 11305 }).on('mouseleave', '.cl-status-info', function () { 11306 $('.cl-prod-info.status-info').fadeOut(100); 11307 }); 11308 11309 $(document).on('mouseenter', '.cl-open-info', function () { 11310 $('.cl-prod-info.open-info').fadeIn(100); 11311 }).on('mouseleave', '.cl-open-info', function () { 11312 $('.cl-prod-info.open-info').fadeOut(100); 11313 }); 11314 11315 $(document).on('mouseenter', '.cl-product-info', function () { 11316 $('.cl-prod-info.product-info').fadeIn(100); 11317 }).on('mouseleave', '.cl-product-info', function () { 11318 $('.cl-prod-info.product-info').fadeOut(100); 11319 }); 11320 11321 $(document).on('mouseenter', '.cl-option-info', function () { 11322 $('.cl-prod-info.option-info').fadeIn(100); 11323 }).on('mouseleave', '.cl-option-info', function () { 11324 $('.cl-prod-info.option-info').fadeOut(100); 11325 }); 11326 11327 $(document).on('mouseenter', '.cl-text-option-info', function () { 11328 $('.cl-prod-info.text-option-info').fadeIn(100); 11329 }).on('mouseleave', '.cl-text-option-info', function () { 11330 $('.cl-prod-info.text-option-info').fadeOut(100); 11331 }); 11332 11333 $(document).on('mouseenter', '.cl-prod-info-notice', function () { 11334 $('.cl-prod-info.cl-prod-info-notice').fadeIn(100); 11335 }).on('mouseleave', '.cl-prod-info-notice', function () { 11336 $('.cl-prod-info.cl-prod-info-notice').fadeOut(100); 11337 }); 11338 11339 $(document).on('click', '.cl_icon_close:not(.dashboard-visit-date)', function () { 11340 var checkCnt = $(this).attr('data-cnt'); 11341 var productNumber = $(this).attr('data-pn'); 11342 var seq = ($('#normal-option').is(':checked'))? $(this).attr('data-seq') : 0; 11343 var file = $(this).attr('data-file'); 11344 var $parentFile = $(this).parent().parent(); 11345 var $closeFile = $(this).parent(); 11346 var $this = $(this); 11347 var admin_url = (uadmin == 'um')? '/_admin' : ''; 11348 11349 if (productNumber!=='null' && productNumber!==undefined && seq!=='null' && seq!==undefined) { 11350 $.ajax({ 11351 url: admin_url + '/shopping/download_list_check', 11352 type: 'post', 11353 dataType: 'json', 11354 data: {'product_number': productNumber, 'option_seq': seq}, 11355 success: function (data) { 11356 if (data.code == 'fail') { 11357 alert(data.message); 11358 return false;
11359 } else { 11360 if (confirm(data.message) === true) { 11361 $.processON('Deleting File...'); 11362 $.ajax({ 11363 type: 'POST', 11364 url: admin_url + '/shopping/file_delete', 11365 data: { s: file, seq: seq}, 11366 async: true, 11367 success: function(data) { 11368 checkError(data); 11369 if (checkCnt || checkCnt == 0) { 11370 $closeFile.remove(); 11371 $('.file-name-'+checkCnt).remove(); 11372 $this.parent().parent().parent().parent().parent().parent().find('.prod-option-status').text('íì ').attr('data-val', 'O'); 11373 $this.parent().parent().parent().parent().parent().parent().find('.option-price-status-str').text('íì ').attr('data-val', 'O'); 11374 11375 } else $closeFile.remove(); 11376 11377 var $fileCnt = $parentFile.find('.file-name'); 11378 if ($fileCnt.length < 1) { 11379 if ($('#none-option-file').length > 0) { 11380 $('.switch-product[value="off"]').prop('checked', true); 11381 $('#status-append').fadeOut(0); 11382 $('#sale-calendar').hide(); 11383 } 11384 $.ajax({ 11385 url: admin_url + '/shopping/file_zero', 11386 type: 'post', 11387 data: {'product_number': productNumber} 11388 }); 11389 } 11390 11391 $.processOFF(); 11392 } 11393 }); 11394 } 11395 } 11396 } 11397 }); 11398 } else { 11399 $.processON('Deleting File...'); 11400 $.ajax({ 11401 type: 'POST', 11402 url: admin_url + '/shopping/file_delete', 11403 data: {s: file}, 11404 async: true, 11405 success: function(data) { 11406 checkError(data); 11407 if (checkCnt || checkCnt == 0) { 11408 $closeFile.remove(); 11409 $('.file-name-'+checkCnt).remove(); 11410 } else $closeFile.remove(); 11411 11412 var $fileCnt = $parentFile.find('.file-name'); 11413 if ($fileCnt.length < 1) { 11414 $('.switch-product[value="off"]').prop('checked', true); 11415 $('#status-append').fadeOut(0); 11416 $('#sale-calendar').hide(); 11417 } 11418 11419 $.processOFF(); 11420 } 11421 }); 11422 } 11423 }); 11424 11425 $(document).on('click', '.cl_icon_upload02', function () { 11426 var cnt = $(this).attr('data-cnt'), 11427 fileCnt = 0; 11428 $('#file-box-'+cnt).find('.real-file-name').each(function () {fileCnt++;}); 11429 if ($('#none-option-file').find('.real-file-name').length > 0 || $('#none-option-file').find('.none-real-file-name').length > 0) fileCnt++; 11430 11431 if (fileCnt >= 1) { 11432 // alert('íì¼ì 1ê°ë§ ì ë¡ë ê°ë¥í©ëë¤.\nì¬ë¬ íì¼ì
11432 ì ë¡ëí ê²½ì° ìì¶ íì¼ì ì´ì©í´ 주ì¸ì.'); 11433 var modal = $(this).showModalFlat('','íì¼ì 1ê°ë§ ì ë¡ë ê°ë¥í©ëë¤.\nì¬ë¬ íì¼ì ì ë¡ëí ê²½ì° ìì¶ íì¼ì ì´ì©í´ 주ì¸ì.',true,false,'','ok','','cl-cmmodal cl-s-btn w560 cl-p130 cl-t80 cl-modal cl-none-title cl-close-btn','','',function() { 11434 $(document).on('keydown', function(e) { 11435 if(e.keyCode == 27) modal.modal('hide'); 11436 }); 11437 }); 11438 return false; 11439 } 11440 11441 $thisUploadCheck = $(this); 11442 $('#product-state').find('input[type="file"]').attr('data-cnt', cnt).click(); 11443 }); 11444 11445 $(document).on('click', '#upload-file', function (data) { 11446 var sid = (typeof SID == 'undefined') ? property.SID : SID 11447 uid = '', 11448 cnt = $(this).attr('data-cnt'); 11449 $.uploadON(); 11450 var route = (CONFIG_URL) ? '/_admin' : ''; 11451 $(this).fileupload({ 11452 url: route + '/shopping/image_upload/type/file/sid/'+sid+'/uid/'+uid, 11453 dataType: 'json', 11454 pasteZone: null, 11455 async: true, 11456 change: function(e, data) { 11457 var ext = ['zip', 'txt', 'pdf', 'docx', 'xlsx', 'xls', 'csv', 'ppt', 'pptx', 'gif', 'jpg', 'jpeg', 'png', 'ico', 'webp', 'hwp', 'mp3', 'wav', 'wma', 'mp4']; 11458 var extAry = data.fileInput[0]['files'][0]['name'].split("."); 11459 if (ext.indexOf(extAry[extAry.length - 1]) == -1) { 11460 alert('ì§ìíì§ ìë íì¼ íìì´ê±°ë íì¼ì´ ììëì´ ì ë¡ëí ì ììµëë¤. íì¸ í ë¤ì ìëí´ ì£¼ì기 ë°ëëë¤.'); 11461 return false; 11462 } 11463 11464 var maxSize = 1024 * 1024 * 512; 11465 var fileSize = data.fileInput[0]['files'][0]['size']; 11466 if (fileSize > maxSize) { 11467 alert($.lang[LANG]['editor.upload.max.500'] + $.lang[LANG]['editor.upload.max.2']); 11468 return false; 11469 } 11470 }, 11471 add: function(e, data) { 11472 $('.uploadModal').show(); 11473 var submit = true, err = ''; 11474 var ext = ['zip', 'txt', 'pdf', 'docx', 'xlsx', 'xls', 'csv', 'ppt', 'pptx', 'gif', 'jpg', 'jpeg', 'png', 'ico', 'webp', 'hwp', 'mp3', 'wav', 'wma', 'mp4']; 11475 var extAry = data.fileInput[0]['files'][0]['name'].toLowerCase().split('.'); 11476 if (ext.indexOf(extAry[extAry.length - 1]) == -1) { 11477 err = $.lang[LANG]['editor.upload.error.ext']; 11478 submit = false; 11479 } 11480 11481 var maxSize = 1024 * 1024 * 512; 11482 var fileSize = data.fileInput[0]['files'][0]['size']; 11483 if (fileSize > maxSize) { 11484 err = $.lang[LANG]['editor.upload.max.500'] + $.lang[LANG]['editor.upload.max.2']; 11485 submit = false; 11486 } 11487 $('#loading').css('left','-100%'); 11488 11489 var fileSize = (data.files[0].size/1024/1024).toFixed(1) + 'MB'; 11490 var tpl = '<div class="file">\ 11491 <div class="progress"><div class="progress-bar"></div></div>\ 11492 <div class="progress-info"><span class="file-name">' + data.files[0].name + '</span><span class="file-size">' + fileSize + '</span><span class="ing">' + $.lang[LANG]['editor.upload.response'] + '</span></div>\ 11493 <div class="preview"></div>\ 11494 </div>'; 11495 data.context = $(tpl).insertBefore($('.uploadModal .upload-content .upload-cancel')); 11496 data.context.find('.preview').addClass('not_image'); 11497 if(submit) { 11498 var jqXHR = data.submit(); 11499 UPLOAD++; 11500 } else { 11501 data.context.find('.loading').html('<i class="fa fa-times error"></i>'); 11502 data.context.find('.ing').addClass('error').text(err); 11503 } 11504 11505 $('.uploadModal .upload-cancel .btn, .uploadModal .upload-close').off('click').on('click', function(e) { 11506 if(jqXHR != undefined) jqXHR.abort(); 11507 data.context.fadeOut().remove(); 11508 $('.uploadModal #file-upload-progress').css('width','0%'); 11509 $.uploadOFF(); 11510 UPLOAD = 0; 11511 UPLOADED = 0; 11512 PROGRESS = 0; 11513 }); 11514 11515 }, 11516 progress: function(e, data) { 11517 var rate = (data.bitrate/1024).toFixed(1) + ' kbps'; 11518 var progress = parseInt((data.loaded / data.total) * 100, 10); 11519 if(typeof data.context != 'undefined') { 11520 data.context.find('.res').text(data.bitrate);
11521 data.context.find('.progress-bar').css('width',progress + "%"); 11522 data.context.find('.ing').text(progress + "%"); 11523 data.context.find('.rate').text(rate); 11524 if(progress == 100) { 11525 data.context.find('.ing').text($.lang[LANG]['editor.upload.response']); 11526 } 11527 } 11528 }, 11529 done: function(e, data) { 11530 if(typeof data.result.error != 'undefined' && data.result.error) { 11531 alert(data.result.error); 11532 $.uploadOFF(); 11533 UPLOAD = 0; 11534 UPLOADED = 0; 11535 PROGRESS = 0; 11536 return; 11537 } 11538 var fileSize = data.result.file_size, unit = 'KB'; 11539 11540 if (fileSize >= 1000) { 11541 fileSize = fileSize / 1000; 11542 fileSize = fileSize.toFixed(2); 11543 unit = 'MB'; 11544 if (fileSize >= 1000) { 11545 fileSize = fileSize / 1000; 11546 fileSize = fileSize.toFixed(2); 11547 unit = 'GB'; 11548 } 11549 } 11550 11551 var fileName = data.result.client_name, totalByte = 0, strFileName = ''; 11552 if (!fileName) { 11553 alert('ì ë¡ë ëì¤ ì¤ë¥ê° ë°ìíìµëë¤. ë¤ì ìëí´ ì£¼ì¸ì.\nì§ìì ì¼ë¡ 문ì ê° ë°ìíë¤ë©´ ê´ë¦¬ììê² ë¬¸ìí´ ì£¼ì¸ì.'); 11554 $.uploadOFF(); 11555 UPLOAD = 0; 11556 UPLOADED = 0; 11557 PROGRESS = 0; 11558 return false; 11559 } 11560 11561 var fn_lastIndex = fileName.lastIndexOf('.'); 11562 var file = [fileName.slice(0, fn_lastIndex), fileName.slice(fn_lastIndex + 1)]; 11563 var fileLen = file[0].length; 11564 for (var i=0;i<fileLen;i++) { 11565 oneChar = file[0].charAt(i); 11566 if (escape(oneChar).length > 4) { 11567 totalByte += 2; 11568 } else { 11569 totalByte++; 11570 } 11571 11572 if (totalByte > 10) { 11573 strFileName += '..'; 11574 break; 11575 } 11576 11577 strFileName += oneChar; 11578 } 11579 strFileName = strFileName+"."+file[(file.length - 1)]; 11580 var splitUrl = data.result.full_path.split('/'); 11581 var fileCnt = $('.file-name').length; 11582 11583 var file = '<div class="file-name file-name-'+fileCnt+'">\ 11584 <span class="real-file-name">'+fileName+'</span>\ 11585 <span class="file-name-detail" title="'+fileName+'">'+strFileName+'</span>\ 11586 <span class="file-size">'+fileSize+unit+'</span>\ 11587 <span class="cl-icon cl_icon_close" data-cnt="'+fileCnt+'" data-file="'+splitUrl[8]+'" data-pn="'+closeProductNumber+'"></span>\ 11588 <span class="file-url">'+data.result.full_path+'</span>\ 11589 </div>'; 11590 11591 // console.log(file); 11592 var licnt = $('.prod-option-list > li').length; 11593 if ($thisUploadCheck.parent().parent().find('#none-option-file').length <= 0) { 11594 $thisUploadCheck.parent().parent().parent().parent().parent().find('.prod-option-status').text('í매').attr('data-val', 'S'); 11595 $thisUploadCheck.parent().parent().parent().parent().parent().find('.option-price-status-str').text('í매').attr('data-val', 'S'); 11596 } 11597 if ($('#normal-option').is(':checked') === false) { 11598 var noneFile = '<div class="none-file-name">\
11599 <span class="none-real-file-name">'+fileName+'</span>\ 11600 <span class="none-file-name-detail" title="'+fileName+'">'+strFileName+'</span>\ 11601 <span class="none-file-size">'+fileSize+unit+'</span>\ 11602 <span class="cl-icon cl_icon_close" data-cnt="'+fileCnt+'" data-file="'+splitUrl[8]+'" data-pn="'+closeProductNumber+'"></span>\ 11603 <span class="none-file-url">'+data.result.full_path+'</span>\ 11604 </div>'; 11605 // console.log('file-box-cnt: '+cnt); 11606 11607 $('[id^="file-box-"]:first').append(file); 11608 $('#none-option-file').append(noneFile); 11609 } else { 11610 $('#file-box-'+cnt).append(file); 11611 } 11612 // console.log(noneFile); 11613 progress1 = parseInt(UPLOADED / UPLOAD * 100,10); 11614 PROGRESS = progress1 + progress2; 11615 $('.file-upload-progress .progress-bar').css({ 11616 'width' : PROGRESS + '%', 11617 'text-align' : 'right', 11618 'padding-right' : '5px' 11619 }).text(PROGRESS + '% '); 11620 11621 UPLOADED++; 11622 if(UPLOADED) { 11623 //$.uploadON(UPLOADED + " / " + UPLOAD + "<br>images creating..."); 11624 if(UPLOAD==UPLOADED) { 11625 UPLOAD = 0; 11626 UPLOADED = 0; 11627 PROGRESS = 0; 11628 11629 $('.file-upload-progress .progress-bar').css({ 11630 'width' : PROGRESS + '%', 11631 'padding-right' : '0px' 11632 }).text(''); 11633 } 11634 } 11635 11636 $.uploadOFF(); 11637 }, 11638 progressall: function(e, data) { 11639 var total = (data.total/1024/1024).toFixed(1) + 'MB'; 11640 $('.uploadModal .info1').text($.lang[LANG]['editor.upload.size.total'] + total); 11641 $('.uploadModal .info2').text((UPLOADED+1) + ' / ' + UPLOAD.toString()); 11642 var progress = parseInt((data.loaded / data.total) * 100, 10); 11643 $('.file-upload-progress .progress-bar').css('width',progress + "%"); 11644 }, 11645 start : function(e, data) { 11646 $('.uploadModal .upload-header h1').text($.lang[LANG]['editor.upload.title.2']); 11647 $('.uploadModal .upload-content .upload-cancel .btn-default').text($.lang[LANG]['config.cancel']); 11648 progress1 = 0; progress2 = 0; PROGRESS = 0; 11649 }, 11650 dragover : function(e, data) { 11651 e.preventDefault(); 11652 } 11653 }).prop('disabled', !$.support.fileInput) 11654 .parent().addClass($.support.fileInput ? undefined : 'disabled'); 11655 }); 11656 11657 $(document).on('keyup', '#download-date', function () { 11658 var $this_val = strReplace($(this).val(), ',', ''); 11659 if ($this_val != '') { 11660 if ($this_val > 90) { 11661 // alert('ê¸°ê° ì íì ìµì 1ì¼ìì ìµë 90ì¼ì ëë¤.'); 11662 $(this).blur(); 11663 var modal = $(this).showModalFlat('','ê¸°ê° ì íì ìµì 1ì¼ìì ìµë 90ì¼ì ëë¤.',true,false,'','ok','','cl-cmmodal cl-s-btn w560 cl-p130 cl-t80 cl-modal cl-none-title cl-close-btn','','',function() { 11664 $(document).on('keydown', function(e) { 11665 if(e.keyCode == 27) modal.modal('hide'); 11666 }); 11667 }); 11668 $(this).val(90); 11669 return false;
11670 } 11671 11672 if ($this_val < 1) { 11673 // alert('ê¸°ê° ì íì ìµì 1ì¼ìì ìµë 90ì¼ì ëë¤.'); 11674 $(this).blur(); 11675 var modal = $(this).showModalFlat('','ê¸°ê° ì íì ìµì 1ì¼ìì ìµë 90ì¼ì ëë¤.',true,false,'','ok','','cl-cmmodal cl-s-btn w560 cl-p130 cl-t80 cl-modal cl-none-title cl-close-btn','','',function() { 11676 $(document).on('keydown', function(e) { 11677 if(e.keyCode == 27) modal.modal('hide'); 11678 }); 11679 }); 11680 $(this).val(1); 11681 return false; 11682 } 11683 } 11684 }); 11685 11686 $(document).on('focusout', '#download-date', function () { 11687 var $this_val = strReplace($(this).val(), ',', ''); 11688 if ($this_val == '') { 11689 // alert('ê¸°ê° ì íì ìµì 1ì¼ìì ìµë 90ì¼ì ëë¤.'); 11690 $(this).blur(); 11691 var modal = $(this).showModalFlat('','ê¸°ê° ì íì ìµì 1ì¼ìì ìµë 90ì¼ì ëë¤.',true,false,'','ok','','cl-cmmodal cl-s-btn w560 cl-p130 cl-t80 cl-modal cl-none-title cl-close-btn','','',function() { 11692 $(document).on('keydown', function(e) { 11693 if(e.keyCode == 27) modal.modal('hide'); 11694 }); 11695 }); 11696 $(this).val(1); 11697 return false; 11698 } 11699 }); 11700 11701 $(document).on('keyup', '#download-count', function () { 11702 var $this_val = strReplace($(this).val(), ',', ''); 11703 if ($this_val != '') { 11704 if ($this_val > 10) { 11705 // alert('ë¤ì´ë¡ë íìë ìµì 1íìì ìµë 10íì ëë¤.'); 11706 $(this).blur(); 11707 var modal = $(this).showModalFlat('','ë¤ì´ë¡ë íìë ìµì 1íìì ìµë 10íì ëë¤.',true,false,'','ok','','cl-cmmodal cl-s-btn w560 cl-p130 cl-t80 cl-modal cl-none-title cl-close-btn','','',function() { 11708 $(document).on('keydown', function(e) { 11709 if(e.keyCode == 27) modal.modal('hide'); 11710 }); 11711 }); 11712 $(this).val(10); 11713 return false; 11714 } 11715 11716 if ($this_val < 1) { 11717 // alert('ë¤ì´ë¡ë íìë ìµì 1íìì ìµë 10íì ëë¤.'); 11718 $(this).blur(); 11719 var modal = $(this).showModalFlat('','ë¤ì´ë¡ë íìë ìµì 1íìì ìµë 10íì ëë¤.',true,false,'','ok','','cl-cmmodal cl-s-btn w560 cl-p130 cl-t80 cl-modal cl-none-title cl-close-btn','','',function() { 11720 $(document).on('keydown', function(e) { 11721 if(e.keyCode == 27) modal.modal('hide'); 11722 }); 11723 }); 11724 $(this).val(1); 11725 return false; 11726 } 11727 } 11728 }); 11729 11730 $(document).on('focusout', '#download-count', function () { 11731 var $this_val = strReplace($(this).val(), ',', ''); 11732 if ($this_val == '') { 11733 // alert('ë¤ì´ë¡ë íìë ìµì 1íìì ìµë 10íì ëë¤.'); 11734 $(this).blur(); 11735 var modal = $(this).showModalFlat('','ë¤ì´ë¡ë íìë ìµì 1íìì ìµë 10íì ëë¤.',true,false,'','ok','','cl-cmmodal cl-s-btn w560 cl-p130 cl-t80 cl-modal cl-none-title cl-close-btn','','',function() { 11736 $(document).on('keydown', function(e) { 11737 if(e.keyCode == 27) modal.modal('hide'); 11738 }); 11739 }); 11740 $(this).val(1); 11741 return false; 11742 } 11743 }); 11744 11745 $(document).on('click','.option-price-status-str', function(e) { 11746 e.stopPropagation(); 11747 var check = $(this).attr('data-val'); 11748 if($(this).hasClass('open')) { 11749 $(this).next().slideUp(200, function() { 11750 $('.option-price-status-str').removeClass('open'); 11751 }); 11752 } else { 11753 $(this).addClass('open'); 11754 $(this).next().find('li').removeClass('active'); 11755 $(this).next().find('li[data-val="' + check + '"]').addClass('active'); 11756 $(this).next().slideDown(200); 11757 } 11758 11759 }); 11760 11761 // $(document).on('change', '.option-require-str input', function(){ 11762 // var $option_li = $(this).closest('li'); 11763 // if($(this).is(':checked')) { 11764 // $option_li.find('.option-require-str').attr('data-val', 'TR'); 11765 // $option_li.find('.prod-option-require').attr('data-val', 'TR'); 11766 // } else { 11767 // $option_li.find('.option-require-str').attr('data-val', 'T'); 11768 // $option_li.find('.prod-option-require').attr('data-val', 'T'); 11769 // } 11770 // }); 11771 11772 $(document).on('click', '.option-price-status-select li', function(e) { 11773 e.stopPropagation(); 11774 $('.option-price-status-select li').removeClass('active'); 11775 $(this).addClass('active'); 11776 var str = $(this).text(), 11777 val = $(this).attr('data-val'); 11778 11779 $(this).parents('.edit-option-select').find('.option-price-status-str').text(str).attr('data-val',val).removeClass('open'); 11780 $(this).parents('li').find('.prod-option-status').text(str).attr('data-val',val); 11781 11782 $(this).parent().slideUp(200); 11783 }); 11784 11785 $(document).on('change', '.option-delivery-template-select input[name="delivery_template_seq"]', function(e) { 11786 e.stopPropagation(); 11787 var str = $(this).parent('li').find('label').html(), 11788 val = $(this).val(); 11789 11790 $('#delivery_template_seq').html(str); 11791 11792 if($(this).parent('li').data('weight') == true) { 11793 $('.product-weight').show(); 11794 } else { 11795 $('.product-weight').hide(); 11796 $('#product_weight').val(''); 11797 } 11798 $('.delivery-template-list').slideUp(200); 11799 $('#delivery_template_seq').removeClass('open'); 11800 $('.prod-modal').scrollTop($('.prod-modal').scrollTop() + $('.form-wrap.delivery-template').offset().top - $('.prod-modal .prod-header').outerHeight()) 11801 }); 11802 11803 $(document).on('click','.edit-option-delete', function(e) { 11804 var $option = $(this), 11805 // seq = ($('#normal-option').is(':checked'))? $(this).attr('data-seq') : 0, 11806 seq = $(this).attr('data-seq'), 11807 sid = (typeof SID == 'undefined') ? property.SID : SID; 11808 option_mode = $option.closest('.prod-option').attr('data-option_mode'), 11809 fileName = $option.closest('li').find('.real-file-name').text(); 11810 var status = true; 11811 var productNumber = $('#prod-no').val(); 11812 var admin_url = (uadmin == 'um')? '/_admin' : ''; 11813 11814 if (option_mode == "normal" && seq!==undefined && productNumber && fileName) { 11815 $.ajax({ 11816 url: admin_url + '/shopping/download_list_check', 11817 type: 'post', 11818 dataType: 'json', 11819 data: {'product_number': productNumber, 'option_seq': seq}, 11820 success: function (data) { 11821 if (data.code == 'fail') { 11822 alert(data.message); 11823 status = false;
11824 return false; 11825 } 11826 } 11827 }); 11828 } 11829 11830 if (status == false) return false; 11831 var modal = $(this).showModalFlat($.lang[LANG]['config.information'], 'ì íí ìµì ì ìì íìê² ìµëê¹?', true, true, function() { 11832 if(typeof seq != "undefined" || seq) { 11833 var deleted = ($('#options-delete-list').val()) ? $('#options-delete-list').val().split(",") : []; 11834 deleted.push(seq); 11835 // var deleted_items = [...new Set(deleted)]; 11836 var deleted_items = deleted.filter(onlyUnique); 11837 $('#options-delete-list').val(deleted_items.join(",")); 11838 $option.parents('li').remove(); 11839 11840 var liTotal = 0; 11841 $('.prod-option-list > li').each(function () { liTotal++; }); 11842 if (liTotal < 2) $('.plus-price').addClass('hide'); 11843 } else { 11844 var optionMode = $option.closest('.prod-option').attr('data-option_mode'); 11845 $option.parents('li').remove(); 11846 11847 var liTotal = 0; 11848 $('.prod-option-list > li').each(function () { liTotal++; }); 11849 if (liTotal < 2) $('.prod-str-price').text(''); 11850 } 11851 11852 if($('.switch-quantity').is(":checked") == true) { 11853 if($('#normal-option').is(':checked') === true) { 11854 // $('#prod-quantity').attr('readonly','true').removeClass('hide').attr('placeholder','ìµì ìì ì¬ê³ ê´ë¦¬'); 11855 $('.quantity-label').addClass('on'); 11856 $('.plus-quantity').removeClass('hide'); 11857 } else if($('#normal-option').is(':checked') === false && $('#additional-option').is(':checked') === true) { 11858 $('.quantity-label').removeClass('on'); 11859 $('#prod-quantity').removeAttr('readonly').removeClass('hide'); 11860 $('.plus-quantity').removeClass('hide'); 11861 } else { 11862 $('.quantity-label').removeClass('on'); 11863 $('#prod-quantity').removeAttr('readonly').removeClass('hide'); 11864 $('.plus-quantity').addClass('hide'); 11865 } 11866 } else { 11867 $('.quantity-label').removeClass('on'); 11868 $('.switch-quantity').parents('.form-wrap').addClass('disabled'); 11869 $('#prod-quantity').addClass('hide'); 11870 $('.prod-option-quantity, .prod-plus-quantity, .edit-option-quantity').hide(); 11871 $('.plus-quantity').addClass('hide'); 11872 } 11873 11874 // var normalCnt = $('.prod-option[data-option_mode="normal"] .prod-option-list > li').length; 11875 if ($('#normal-option').is(':checked') === false) { 11876 var html = '\ 11877 <div class="product-upload">\ 11878 <div class="title">íì¼ ì ë¡ë</div>\ 11879 <div class="download-contents">\ 11880 <span class="cl_icon_upload02" data-cnt="'+fileUpdateCnt+'">ì ë¡ë</span>\ 11881 <div id="none-option-file"></div>\ 11882 </div>\ 11883 </div>\ 11884 '; 11885 11886 fileUpdateCnt++; 11887 11888 $('#add-upload-check').prepend(html); 11889 if ($('#none-option-file').length > 0) { 11890 $('.switch-product[value="off"]').prop('checked', true); 11891 $('#status-append').fadeOut(0); 11892 $('#sale-calendar').hide(); 11893 } 11894 } 11895 11896 if(LUX && (productNumber < 0 || !productNumber || productNumber >= 1000000000) && option_mode == 'normal' && $('.prod-option[data-option_mode="'+option_mode+'"] .prod-option-list > li').length == 1) { 11897 addProductOption('normal'); 11898 } 11899 11900 var cnt = $('.prod-option[data-option_mode="'+option_mode+'"] .prod-option-list > li').length; 11901 if(option_mode == 'normal') { 11902 if(cnt == 1) { 11903 $('.prod-option[data-option_mode="normal"]').addClass('hide'); 11904 $('#normal-option').prop('checked', false); 11905 } 11906 } else { 11907 if(cnt == 0) { 11908 $('.prod-option[data-option_mode="'+option_mode+'"]').addClass('hide'); 11909 $('#'+option_mode+'-option').prop('checked', false); 11910 } 11911 if(option_mode == 'text' && cnt < 7) { 11912 $('.prod-option[data-option_mode="text"] > .prod-option-add').removeClass('disabled'); 11913 } 11914 } 11915 11916 if($('.prod-option-tab .prod-option.hide').length == 3) { 11917 $('.prod-option-tab').addClass('hide'); 11918 } 11919 if($('.prod-option-edit').length <= 2) { 11920 $('.edit-option-delete').addClass('hide'); 11921 } else { 11922 $('.edit-option-delete').removeClass('hide'); 11923 } 11924 11925 modal.modal('hide'); 11926 },'cancel', 'ok', 'cl-p130 cl-cmmodal cl-s-btn w560 cl-p0'); 11927 }); 11928 $(document).on('click','.category-lists li', function(e) { 11929 e.stopPropagation(); 11930 $(this).toggleClass('active'); 11931 var selected = $('.category-lists li.active').map(function() { 11932 return $(this).text(); 11933 }).get().join(', '); 11934 selected = (selected.length==0) ? 'ì¹´í ê³ ë¦¬ë¥¼ ì ííì¸ì' : selected; 11935 $('#prod-category-text').text(selected); 11936 }); 11937 $(document).on('click','.category-wrap', function(e) { 11938 var txt = $(this).find('.category-text').text(), 11939 selected = $.map(txt.split(","), $.trim); 11940 11941 $.each($('.category-lists li'), function(i,v) { 11942 var s = $.trim($(this).text()); 11943 if(selected.indexOf(s) > -1) { 11944 $(this).addClass('active'); 11945 } 11946 }); 11947 // $('.category-lists').slideToggle(); 11948 }); 11949 /*--------- move -------------*/ 11950 $(document).on('click','.category-title', function() { 11951 var submit = true; 11952 if($('.category-move.delete').length) { 11953 $.each($('.category-move.delete'), function(i,v) { 11954 $(this).removeClass('delete').html($.category.moveHandle()); 11955 var txt = $(this).parents('li').find('.category-input').val(); 11956 if(txt.length == 0) { 11957 submit = false;
11958 return true; 11959 } 11960 $(this).parents('li').find('.category-title').text(txt).removeClass('hide'); 11961 }); 11962 } 11963 11964 if(submit) { 11965 var v = $(this).text(); 11966 if(!$(this).hasClass('hide')) { 11967 $(this).addClass('hide'); 11968 $(this).siblings('.form-wrap').find('.category-input').val(v).focus(); 11969 } 11970 $(this).parents('li').find('.category-move').addClass('delete').html($.category.deleteHandle()); 11971 } 11972 }); 11973 $(document).on('focus', '.category-input', function(e) { 11974 var submit = true; 11975 if($('.category-move.delete').length) { 11976 $.each($('.category-move.delete'), function(i,v) { 11977 $(this).removeClass('delete').html($.category.moveHandle()); 11978 var txt = $(this).parents('li').find('.category-input').val(); 11979 if(txt.length == 0) { 11980 submit = false; 11981 return true; 11982 } 11983 $(this).parents('li').find('.category-title').text(txt).removeClass('hide'); 11984 }); 11985 } 11986 11987 $(this).parents('li').find('.category-move').addClass('delete').html($.category.deleteHandle()); 11988 }); 11989 $(document).on('keyup', '.category-input', function(e) { 11990 var keyCode = e.keyCode, 11991 search = $(this).val().trim(), 11992 v = $(this).val().trim(); 11993 11994 $(this).parents('.form-wrap').siblings('.category-title').text(v); 11995 if(checkEmojis(v)) { 11996 e.preventDefault(); 11997 errorEmojisModal('10002'); 11998 return false; 11999 } 12000 if(v.length==0) return false; 12001 if(keyCode == 13) { 12002 if($.category.check()) { 12003 // alert('ì¹´í ê³ ë¦¬ëª ì¤ë³µì ëë¤'); 12004 var modal = $(this).showModalFlat('','ì¹´í ê³ ë¦¬ëª ì¤ë³µì ëë¤',true,false,'','ok','','cl-cmmodal cl-s-btn w560 cl-p130 cl-t80 cl-modal cl-none-title cl-close-btn','','',function() { 12005 $(document).on('keydown', function(e) { 12006 if(e.keyCode == 27) modal.modal('hide'); 12007 }); 12008 }); 12009 return false; 12010 } 12011 $(this).parents('.form-wrap').siblings('.category-title').removeClass('hide'); 12012 $(this).parents('.form-wrap').siblings('.category-move').removeClass('delete').html($.category.moveHandle()); 12013 } 12014 }); 12015 $(document).on('blur', '.category-input', function(e) { 12016 if(checkEmojis($(this).val().trim())) { 12017 e.preventDefault(); 12018 var focus_input = $(this); 12019 errorEmojisModal('10002'); 12020 } 12021 }); 12022 12023 $(document).on('click','.item-add', function() { 12024 if($(this).closest('.category-edit').find('li:not(.item-add) .category-title.hide').length > 0) { 12025 $(this).closest('.category-edit').find('li:not(.item-add) .category-title.hide').eq(0).closest('li').find('.form-wrap .form-group input.category-input').focus(); 12026 return false; 12027 } 12028 12029 $('.category-edit li:last-child').before($('<li><div class="form-wrap"><div class="form-group"><input type="text" class="category-input" required="required"/><label for="input" class="control-label">'+ $.lang[LANG]['editor.block.gallery.category.edit.name'] +'</label><i class="bar"></i></div></div><div class="category-move delete">' + $.category.deleteHandle() + '</div><div class="category-title hide"></div></li>')); 12030 $('.category-input:last-child').focus(); 12031 }); 12032 $(document).on('click','.category-move.delete', function(e) { 12033 if($(this).closest('.category-edit').children('li:not(.item-add)').length <= 1) { 12034 $(this).showModalFlat($.lang[LANG]['config.information'], $.lang[LANG]['editor.gallery.category.delete.last'], true, false, '', 'ok','', 'cl-cmmodal cl-s-btn w560 cl-p130 cl-p0 cl-okbtn-pbt70 category-error', false, '', function() { 12035 $('.modal-dialog.category-error').closest('.flat-modal').next('.modal-backdrop').attr('style','z-index: 10001!important;'); 12036 $('.modal-dialog.category-error').closest('.modal').attr('style','display: block; z-index: 10002;'); 12037 }); 12038 return false;
12039 } 12040 12041 ($.category.delete).push($(this).next().text()); 12042 $(this).parents('li').find('.category-input').val(''); 12043 $(this).parents('li').remove(); 12044 }); 12045 $(document).on('click','.prod-button .modal-close', function(e) { $.products.close(); }); 12046 $(document).on('click','.category-modal .cl-category-modal-ok', function(e) { 12047 var change = []; 12048 var del = $.category.delete; 12049 var categoryRegexp = /[\[\]|,'"<>{}\/\\:;%&@$!*?\^]/; 12050 var checkRegexp = false; 12051 var checkMin = false; 12052 var checkMax = false; 12053 12054 var category_lists = $('.category-edit .category-title').map(function(){ 12055 var org = $(this).attr('data-org'), 12056 val = $(this).text().trim(); 12057 12058 if(val.length < 1) checkMin = true; 12059 if(val.length > 20) checkMax = true; 12060 12061 if(org != val) change.push(org + '|' + val); 12062 if(val != '') { 12063 if(categoryRegexp.test(val)) checkRegexp = true; 12064 12065 return val; 12066 } 12067 }).get(); 12068 12069 var error_str = ''; 12070 if(checkMin) error_str = $.lang[LANG]['board.enter-min-chars.1']; 12071 else if(checkMax) error_str = $.lang[LANG]['board.enter-max-chars']; 12072 else if(checkRegexp) error_str = $.lang[LANG]['board.allowed-chars']; 12073 12074 if(error_str.length > 0) { 12075 $(this).showModalFlat($.lang[LANG]['config.information'], error_str, true, false, '', 'ok','', 'cl-cmmodal cl-s-btn w560 cl-p130 cl-p0 cl-okbtn-pbt70 category-error', false, '', function() { 12076 $('.modal-dialog.category-error').closest('.flat-modal').next('.modal-backdrop').attr('style','z-index: 10001!important;'); 12077 $('.modal-dialog.category-error').closest('.modal').attr('style','display: block; z-index: 10002;'); 12078 }); 12079 return false; 12080 } 12081 12082 if(checkEmojis(category_lists.toString())) { 12083 e.preventDefault(); 12084 errorEmojisModal('10002'); 12085 return false; 12086 } 12087 12088 if($.category.check()) { 12089 // alert('ì¹´í ê³ ë¦¬ëª ì¤ë³µì ëë¤'); 12090 var modal = $(this).showModalFlat('','ì¹´í ê³ ë¦¬ëª ì¤ë³µì ëë¤',true,false,'','ok','','cl-cmmodal cl-s-btn w560 cl-p130 cl-t80 cl-modal cl-none-title cl-close-btn','','',function() { 12091 $(document).on('keydown', function(e) { 12092 if(e.keyCode == 27) modal.modal('hide'); 12093 }); 12094 }); 12095 return false; 12096 } 12097 12098 var $category = $('#prod-category-text'); 12099 var cate = ($category.text().trim()) ? $category.text().trim().split(', ') : []; 12100 12101 if(cate.length && del.length) { 12102 $.each(del, function(i,v) { 12103 var idx = cate.indexOf(v); 12104 if(idx > -1) cate.splice(idx, 1) 12105 }); 12106 $category.text(cate.join(', ')); 12107 } 12108 12109 if(cate.length && change.length) { 12110 $.each(change, function(i,v) { 12111 var s = v.split('|'); 12112 var idx = cate.indexOf(s[0]); 12113 if(idx > -1) cate[idx] = s[1]; 12114 }); 12115 $category.text(cate.join(', ')); 12116 } 12117 if($category.text() == '') $category.text('ì¹´í ê³ ë¦¬ë¥¼ ì ííì¸ì'); 12118 12119 var pid = ($('.prod-modal').length) ? $('#prod-pid').val() : $('.gallery-ctrl-category').attr('data-pid'), 12120 gid = $('#prod-no').val(); 12121 12122 $.post('/template/gallery/category', { sid : SID, s : category_lists, mode : 'block', seq : pid, gid : gid, change : change, del : del }, function(r) { 12123 if(typeof r.error !='undefined' && r.error) { 12124 alert(r.error); 12125 return false;
12126 } 12127 12128 $('#prod-category-lists ul, .toolbar-category .item-submenu').empty(); 12129 $('.gallery-category li.category-text').remove(); 12130 var s = ''; 12131 $.each(category_lists, function(i,v) { 12132 var li_str = '<li>' + v + '</li>', 12133 li_str2 = '<li class="category-text">' + v + '</li>'; 12134 s = s + li_str; 12135 $('#prod-category-lists ul').append(li_str); 12136 $('.toolbar-category .item-submenu').append(li_str); 12137 $('.gallery-category .gallery-category-onoff').before(li_str2); 12138 }); 12139 $.gallery.cates = s; 12140 $('#prod-category, .gallery-ctrl-category, .gallery-modal').attr('data-category',category_lists.toString()); 12141 12142 12143 $category = $('#prod-category-text'); 12144 var cate = ($category.text().trim()) ? $category.text().trim().split(', ') : []; 12145 $.each($('.category-lists li'), function(i,v) { 12146 // IE ERROR_includes__H.20210603 12147 // if(cate.includes($(this).text())) $(this).addClass('active'); 12148 if($.inArray($(this).text(),cate) > -1) $(this).addClass('active'); 12149 }); 12150 $.category.close(); 12151 if($('.gallery-modal').hasClass('shopping') && $('.prod-modal.cl-p-modal').length == 0) $.gallery.show($.gallery.block_id,1,$.gallery.category); 12152 $.gallery.update = true; 12153 12154 }, 'json'); 12155 }); 12156 }, 12157 open : function(s) { 12158 if($('.cl-category-modal-backdrop').length >0) $('.cl-category-modal-backdrop').remove(); 12159 var text = (typeof s != 'string') ? [] : s.split(','); 12160 var $backdrop = $('<div class="cl-category-modal-backdrop"></div>'), 12161 $title = $('<h1 class="category-modal-title">' + $.lang[LANG]['editor.block.gallery.category.edit.title'] + '</h1>'), 12162 $modal = $('<div class="cl-category-modal cl-p-modal category-modal"></div>'), 12163 $lists = $('<ul class="category-edit"></ul>'), 12164 $item_add = $('<li class="item-add"></li>'); 12165 $modal_footer = $('<div class="cl-category-modal-footer"><div class="cl-category-modal-close">' + $.lang[LANG]['editor.cancel'] + '</div><div class="cl-category-modal-ok">' + $.lang[LANG]['config.save'] + '</div></div>'); 12166 12167 $.each(text, function(i,v) { 12168 var item = "\ 12169 <li>\ 12170 <div class='form-wrap'>\ 12171 <div class='form-group'>\ 12172 <input type='text' class='category-input' required='required' value='" + v + "'>\ 12173 <label for='input' class='control-label'>"+ $.lang[LANG]['editor.block.gallery.category.edit.name'] +"</label><i class='bar'></i>\ 12174 </div>\ 12175 </div>\ 12176 <div class='category-move'>" + $.category.moveHandle() + "</div>\ 12177 <div class='category-title' data-org='" + v + "'>" + v + "</div>\ 12178 </li>\ 12179 "; 12180 $lists.append($(item)); 12181 }); 12182 12183 // $('.category-edit').append($(item)); 12184 12185 $lists.append($item_add); 12186 $modal.append($title).append($lists).append($modal_footer); 12187 $backdrop.append($modal); 12188 $('body').append($backdrop); 12189 $backdrop.fadeIn(500); 12190 $('.category-edit').sortable({ 12191 handle : ".category-move .cl-sort-handle" 12192 }); 12193 }, 12194 close : function() { 12195 $('.cl-category-modal-backdrop').fadeOut(500, function() { $(this).remove(); }); 12196 }, 12197 check : function() { 12198 var category = $.category.list(), 12199 // set_category = new Set(category); 12200 set_category = category.filter(onlyUnique); 12201 12202 // IE ERROR (filter)
12203 // check = category.filter((s => v => s.has(v) || !s.add(v))(new Set)); 12204 12205 // ë³ê²½ ìì´ ì ì¥ì ì¤ë³µ ì²´í¬ ì´ì ìê¹ 12206 // return (category.length !== set_category.size) ? true : false; 12207 return (category.toString() !== set_category.toString()) ? true : false; 12208 }, 12209 list : function() { 12210 var category_lists = $('.category-edit .category-title').map(function(){ 12211 var org = $(this).attr('data-org'), 12212 val = $(this).text().trim(); 12213 if($(this).text().trim()) { 12214 return $(this).text().trim(); 12215 } 12216 }).get(); 12217 return category_lists; 12218 } 12219 } 12220 12221 12222 $.shoppingmall = { 12223 orderStatusDetailsModal: function(sid, pnum, onum, ognum, kind) { 12224 if(typeof sid == "undefined" || typeof pnum == "undefined" || typeof onum == "undefined" || typeof kind == "undefined") { 12225 alert('ì ë³´ê° ì¬ë°ë¥´ì§ ììµëë¤'); 12226 return false; 12227 } 12228 12229 $.post('/_check_order', { sid:sid, pnum:pnum, onum:onum, ognum:ognum,mode:'kind/'+kind }, function(data) { 12230 12231 if(typeof data.error != "undefined" && data.error) { 12232 $(this).showModalFlat('ERROR', data.error, true, false, '', 'close'); 12233 return false; 12234 } 12235 var c_data = data.r, 12236 status = c_data.odata.reason_d_status, 12237 kind_str = c_data.odata.kind_str, 12238 product_status_str = c_data.odata.product_status_str, 12239 payClass = c_data.odata.class; 12240 12241 option_name = (typeof c_data.pdata.option != "undefined" && c_data.pdata.option) ? c_data.pdata.option : '', 12242 etc_str = (typeof c_data.pdata.etc_date != "undefined" && c_data.pdata.etc_date) ? '<br><span class="osd-gray">ì íì¼ì: '+c_data.pdata.etc_date+'</span>' : '', 12243 12244 // option_str = (option_name) ? '<br><span class="osd-gray">ìµì : '+option_name+'</span>' : '', 12245 now_status_html = '', 12246 delivery_info = c_data.pay_info.delivery, 12247 option_title = (c_data.pdata.option_type == 'A') ? 'ì¶ê°ìµì : ' + (c_data.pdata.option_group ? c_data.pdata.option_group + ': ' : '') : 'ìµì : '; 12248 if(option_name) { 12249 option_str = (c_data.pdata.option_text_str)? '<br><span class="osd-gray">' + option_title + option_name+' / '+c_data.pdata.option_text_str+'</span>':'<br><span class="osd-gray">'+ option_title + option_name+'</span>'; 12250 } else { 12251 option_str = (c_data.pdata.option_text_str)? '<br><span class="osd-gray">' + option_title + c_data.pdata.option_text_str + '</span>' : ''; 12252 } 12253 if(etc_str) option_str += etc_str; 12254 12255 if(status.length > 1) { 12256 var now_title = c_data.odata.product_status_str.replace(/ /g,'').replace('ê±°ë¶ì¬ë°ì¡','ê±°ë¶'), 12257 now_msg = (status.indexOf('W') > -1) ? c_data.odata.h_msg : 12258 12259 c_data.odata.adm_msg, 12260 now_msg_html = (jQuery.inArray(status, ['CY','EY','RY']) > -1) ? '' : '\ 12261 <tr>\ 12262 <td class="label">' + now_title + 'ì¬ì </td>\ 12263 <td>' + now_msg + '</td>\ 12264 </tr>\ 12265 ', 12266 now_msg_date = (jQuery.inArray(status, ['EW','RW']) > -1) ? c_data.odata.h_date : c_data.odata.adm_date; 12267 12268 now_status_html = '\ 12269 <h6 class="osd-title">' + now_title + 'ì ë³´</h6>\ 12270 <table class="osd-table">\ 12271 <tbody>\ 12272 <tr>\ 12273 <td class="label">' + now_title + 'ì¼ì</td>\ 12274 <td>' + now_msg_date + '</td>\ 12275 </tr>\ 12276 '; 12277 if(status != 'CY' && status != 'RY') { 12278 $.each(delivery_info, function(i, v){ 12279 delivery_info[i] = (v===null)? '':v; 12280 }); 12281 if(status == 'RD' || status == 'ED' || status == 'EY'|| status == 'ES') { 12282 if(delivery_info.new_postcode !== '') { 12283 now_status_html+= '<tr>\ 12284 <td class="label">ë°°ì¡ì§1</td>\ 12285 <td>' + delivery_info.new_postcode + ' ' + delivery_info.new_addr + ' ' + delivery_info.new_addr2 + '</td>\ 12286 </tr>\ 12287 '; 12288 } 12289 12290 if(delivery_info.new_delivery_type) { 12291 now_status_html += '\ 12292 <tr>\ 12293 <td class="label">ë°°ì¡ìë¨</td>\ 12294 <td>' + $.lang[LANG]['shopping.delivery.template.delivery_type.' + delivery_info.new_delivery_type.toLowerCase()] + '</td>\ 12295 </tr>\ 12296 ' 12297 } 12298 12299 if(delivery_info.new_delivery_company) { 12300 now_status_html+= '\ 12301 <tr>\ 12302 <td class="label">ë°°ì¡íì¬</td>\ 12303 <td>' + delivery_info.new_delivery_str + '</td>\ 12304 </tr>'; 12305 } 12306 if(delivery_info.new_delivery_str != 'ìê°ë°°ì¡' && delivery_info.new_delivery_number != '') { 12307 now_status_html+= '<tr>\ 12308 <td class="label">ì¡ì¥ë²í¸</td>\ 12309 <td>' + delivery_info.new_delivery_number + '</td>\ 12310 </tr>'; 12311 } 12312 } 12313 12314 now_status_html += now_msg_html; 12315 } 12316 now_status_html+= '\ 12317 </tbody>\ 12318 </table>\ 12319 '; 12320 } 12321 12322 var r_requests = (c_data.odata.requests != '')? c_data.odata.requests : '-'; 12323 var modal_str = '\ 12324 <div class="osd-body">\ 12325 \ 12326 <h6 class="osd-title">기본ì ë³´</h6>\ 12327 <table class="osd-table">\ 12328 <tbody>\ 12329 <tr>\ 12330 <td class="label">
12330주문ë²í¸</td>\ 12331 <td>' + ognum + '</td>\ 12332 </tr>\ 12333 <tr>\ 12334 <td class="label">ìíëª </td>\ 12335 <td>' + c_data.pdata.name + option_str + '</td>\ 12336 </tr>\ 12337 <tr>\ 12338 <td class="label">주문ìë</td>\ 12339 <td>' + c_data.odata.quantity + 'ê°</td>\ 12340 </tr>'; 12341 modal_str += '<tr>\ 12342 <td class="label">'+kind_str+'ìí</td>\ 12343 <td>' + product_status_str + '</td>\ 12344 </tr>'; 12345 if ((status.indexOf('R') !== -1 || (c_data.odata.p_status != 'W' && status.indexOf('C') !== -1)) && (payClass == '무íµì¥ ì ê¸' || payClass == 'ê°ìê³ì¢')) { 12346 modal_str += '<tr>\ 12347 <td class="label">íë¶ê³ì¢</td>\ 12348 <td>' + c_data.odata.return_bank + ' ' + c_data.odata.return_bank_number + '<br>' + c_data.odata.return_bank_name + '</td>\ 12349 </tr>'; 12350 } 12351 modal_str += '</tbody>\ 12352 </table>\ 12353 \ 12354 ' + now_status_html +'\ 12355 \ 12356 <h6 class="osd-title">' + kind_str + 'ìì²ì ë³´</h6>\ 12357 <table class="osd-table">\ 12358 <tbody>\ 12359 <tr>\ 12360 <td class="label">' + kind_str + 'ìì²ì¼ì</td>\ 12361 <td>' + c_data.odata.date + '</td>\ 12362 </tr>\ 12363 <tr>\ 12364 <td class="label">' + kind_str + 'ìì²ì¬ì </td>\ 12365 <td>' + c_data.odata.reason + '</td>\ 12366 </tr>\ 12367 <tr>\ 12368 <td class="label">ìì¸ì¬ì </td>\ 12369 <td>' + r_requests + '</td>\ 12370 </tr>\ 12371 </tbody>\ 12372 </table>\ 12373 \ 12374 </div>\ 12375 \ 12376 '; 12377 12378 /* 12379 var c_data = data.r, 12380 status = c_data.odata.d_status, 12381 kind_str = c_data.odata.kind_str, 12382 product_status_str = c_data.odata.product_status_str, 12383 option_name = (typeof c_data.pdata.option != "undefined" && c_data.pdata.option) ? c_data.pdata.option : '', 12384 option_str = (option_name) ? '<br><span>ìµì : '+option_name+'</span>' : '', 12385 status_str = '', 12386 response_str = '', 12387 request_str = '\ 12388 <table class="osd-table">\ 12389 <tbody>\ 12390 <tr>\ 12391 <td class="label">' + kind_str + 'ìì²ì¬ì </td>\ 12392 <td>' + c_data.odata.reason + '</td>\ 12393 </tr>\ 12394 <tr>\ 12395 <td class="label">ìì¸ì¬ì </td>\ 12396 <td>' + c_data.odata.requests + '</td>\ 12397 </tr>\ 12398 </tbody>\ 12399 </table>\ 12400 '; 12401 12402 if(jQuery.inArray(status, ['CN','CY','EN','EW','RN','RW']) > -1) { 12403 var status_str = (status.indexOf('W') > -1) ? c_data.odata.h_msg : c_data.odata.adm_msg, 12404 status_msg = (jQuery.inArray(status, ['CY']) > -1) ? '' : '\ 12405 <tr>\ 12406 <td class="label">' + c_data.odata.product_status_str.replace(/ /g,'') + 'ì¬ì </td>\ 12407 <td>' + status_str + '</td>\ 12408 </tr>\ 12409 ', 12410 status_date = (jQuery.inArray(status, ['EW','RW']) > -1) ? c_data.odata.h_date : c_data.odata.adm_date; 12411 12412 status_str = '\ 12413 <h6 class="osd-title">' + c_data.odata.product_status_str.replace(/ /g,'') + 'ì ë³´</h6>\ 12414 <table class="osd-table">\ 12415 <tbody>\ 12416 <tr>\ 12417 <td class="label">' + c_data.odata.product_status_str.replace(/ /g,'') + 'ì¼ì</td>\ 12418 <td>' + status_date + '</td>\ 12419 </tr>\ 12420 ' + status_msg + '\ 12421 </tbody>\ 12422 </table>\ 12423 '; 12424 } 12425 12426 if(jQuery.inArray(status, ['EN', 'EW', 'RN', 'RW']) > -1) { 12427 response_str = '\ 12428 <tr>\ 12429 <td class="label">' + kind_str + ' ' + c_data.odata.h_kind_str + 'ì¬ì </td>\ 12430 <td>' + c_data.odata.h_reason + '</td>\ 12431 </tr>\ 12432 <tr>\ 12433 <td class="label">ìì¸ì¬ì </td>\ 12434 <td>' + c_data.odata.h_msg + '</td>\ 12435 </tr>\ 12436 '; 12437 } 12438 12439 var modal_str = '\ 12440 <div class="osd-body">\ 12441 \ 12442 <h6 class="osd-title">기본ì ë³´</h6>\ 12443 <table class="osd-table">\ 12444 <tbody>\ 12445 <tr>\ 12446 <td class="label">
12446주문ë²í¸</td>\ 12447 <td>' + onum + '</td>\ 12448 </tr>\ 12449 <tr>\ 12450 <td class="label">ìíëª </td>\ 12451 <td>' + c_data.pdata.name + option_str + '</td>\ 12452 </tr>\ 12453 <tr>\ 12454 <td class="label">주문ìë</td>\ 12455 <td>' + c_data.odata.quantity + 'ê°</td>\ 12456 </tr>\ 12457 <tr>\ 12458 <td class="label">' + kind_str + 'ìì²ì¼ì</td>\ 12459 <td>' + c_data.odata.date + '</td>\ 12460 </tr>\ 12461 <tr>\ 12462 <td class="label">ì§íìí</td>\ 12463 <td>' + product_status_str + '</td>\ 12464 </tr>\ 12465 ' + response_str + '\ 12466 </tbody>\ 12467 </table>\ 12468 \ 12469 ' + status_str +'\ 12470 \ 12471 <h6 class="osd-title">' + kind_str + 'ìì²ì ë³´</h6>\ 12472 ' + request_str +'\ 12473 \ 12474 </div>\ 12475 \ 12476 '; 12477 12478 */ 12479 var osdModal = $(this).showModalFlat(kind_str + ' ìì¸ì ë³´', modal_str, true, false, '', 'ok', '', 'cl-s-order-status-details cl-modal cl-s-btn cover', false); 12480 12481 },'json'); 12482 12483 }, 12484 orderCancelModal: function(sid, pnum, onum, ognum, status, dStatus, pclass) { 12485 if(typeof sid == "undefined" || typeof pnum == "undefined" || typeof onum == "undefined") { 12486 alert('ì ë³´ê° ì¬ë°ë¥´ì§ ììµëë¤'); 12487 return false; 12488 } 12489 var escrow = status; 12490 $.post('/_check_order', { sid:sid, pnum:pnum, onum:onum, mode:'cancel', ognum: ognum }, function(data) { 12491 var LUX = false; 12492 if(data.lux) LUX = data.lux; 12493 if(typeof data.error != "undefined" && data.error) { 12494 $(this).showModalFlat('ERROR', data.error, true, false, '', 'close'); 12495 return false; 12496 } 12497 12498 12499 var c_data = data.r, checkboxNone = '', noneAll = '', noneChecked = '', checkNoneAll = '', checkEscrowFooter = '', checkEscrowClass = '', checkDepositCancel = ''; 12500 var checkEscrow = ''; 12501 var dtl = c_data.delivery_template_list; 12502 var used_code_coupon = false; 12503 12504 if (escrow == 'Y') { 12505 checkboxNone = 'checked'; 12506 noneAll = ' noneAll'; 12507 checkNoneAll = 'fule'; 12508 checkEscrow = '<div class="escrow-warring top-escrow">\ 12509 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 13" width="15" height="15">\ 12510 <path fill="#4789e7" d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"/>\ 12511 <rect fill="#4789e7" x="6" y="3" width="1" height="5"/>\ 12512 <rect fill="#4789e7" x="6" y="9" width="1" height="1"/>\ 12513 </svg>\ 12514 ìì¤í¬ë¡ ê²°ì ìíì ì·¨ì/ë°í ìì² ì ì ì²´ì íë§ ê°ë¥í©ëë¤.\ 12515 </div>'; 12516 12517 checkEscrowFooter = '<div class="escrow-warring bottom-escrow">\ 12518 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 13" width="15" height="15">\ 12519 <path fill="#4789e7" d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"/>\ 12520 <rect fill="#4789e7" x="6" y="3" width="1" height="5"/>\ 12521 <rect fill="#4789e7" x="6" y="9" width="1" height="1"/>\ 12522 </svg>\ 12523 ìì¤í¬ë¡ íë¶ ìë´\ 12524 <div class="escrow-return-info">- ì·¨ìì²ë¦¬ ì 구매ìì íë¶ì ì°ì¡ìì ì·¨ì ììë£(330ì)ê° ì°¨ê°ë©ëë¤.</div>\ 12525 <div class="escrow-return-info">- íë¶ì ì°ì¡ì ì·¨ìì²ë¦¬ í 1~3ìì ì¼ íì ì§ê¸ë©ëë¤.</div>\ 12526 </div>'; 12527 checkEscrowClass = 'cl-s-escrow-info'; 12528 } else { 12529 if(c_data.order_status == 'W') { 12530 checkboxNone = 'checked'; 12531 noneAll = ' noneAll'; 12532 checkNoneAll = 'fule'; 12533 checkDepositCancel = '<div class="modal-comment deposit-cancel-desc">\ 12534 <div class="desc-box">\ 12535 <div class="desc-title">ì ê¸ë기 주문취ì ìë´</div>\ 12536 <div class="section">- ì ê¸ë기 주문 ê±´ì <span class="cl-red">ì ì²´ ì·¨ì</span>ë§ ê°ë¥íë©° <span class="cl-red">ì·¨ììë£</span>ë¡ ì²ë¦¬ë©ëë¤.</div>\ 12537 <div class="section">- ì ì²´ì·¨ì í 구매를 ìíë ìíì ë¤ì 주문í´ì£¼ì¸ì.</div>\ 12538 <div class="section">- í¹ìë ì ê¸ì íì ê²½ì° ë³ëë¡ ë¬¸ì 주ì기 ë°ëëë¤.</div>\ 12539 </div>\ 12540 </div>\ 12541 '; 12542 } 12543 } 12544 12545 if(c_data.pay_info.coupon_list && c_data.pay_info.coupon_list.length) { 12546 $.each(c_data.pay_info.coupon_list, function(k, v) { 12547 if(v.kind == 'C') { 12548 used_code_coupon = true; 12549 } 12550 }) 12551 } 12552 12553 if(c_data.order_status != 'W' && used_code_coupon) { 12554 checkboxNone = 'checked'; 12555 noneAll = ' noneAll'; 12556 checkNoneAll = 'fule'; 12557 checkDepositCancel = '<div class="modal-comment deposit-cancel-desc">\ 12558 <div class="desc-box">\ 12559 <div class="desc-title">ì½ëì¿ í° ì¬ì© 주문취ì ìë´</div>\ 12560 <div class="section">- ì½ëì¿ í° ì¬ì© 주문 ê±´ì <span class="cl-red">ì ì²´ ì·¨ì</span>ë§ ê°ë¥í©ëë¤.</div>\ 12561 <div class="section">- ì ì²´ì·¨ì í 구매를 ìíë ìíì ë¤ì 주문í´ì£¼ì¸ì.</div>\ 12562 </div>\ 12563 </div>\ 12564 '; 12565 } 12566 12567 var modal_str = '\ 12568 <form name="cancel_form" method="post" action="/_return">\ 12569 <input type="hidden" name="sid" value="' + sid + '">\ 12570 <input type="hidden" name="order_group" id="cancel-order-group" value="' + ognum + '">\ 12571 <input type="hidden" name="order_number" id="cancel-order-number" value="' + onum + '">\ 12572 <input type="hidden" name="extra_charge" id="extra_charge" value="' + data.r.pay_info.extra_charge + '">\ 12573 '+checkEscrow+'\ 12574 <div class="cancel-product-title">\ 12575 <div class="newcheckbox hand">\ 12576 <label>\ 12577 <input type="checkbox" class="'+noneAll+'" id="product-check" '+checkboxNone+'>\ 12578 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\ 12579 <path d="M13 0H3C1.3 0 0 1.3 0 3v10c0 1.7 1.3 3 3 3h10c1.7 0 3-1.3 3-3V3C16 1.3 14.7 0 13 0zM15 13c0 1.1-0.9 2-2 2H3c-1.1 0-2-0.9-2-2V3c0-1.1 0.9-2 2-2h10c1.1 0 2 0.9 2 2V13z"/>\ 12580 </svg>\ 12581 <svg class="active" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\ 12582 <path d="M13 0H3C1.34 0 0 1.34 0 3v10c0 1.66 1.34 3 3 3h10c1.66 0 3-1.34 3-3V3C16 1.34 14.66 0 13 0zM13.03 6.03l-5.5 5.5C7.38 11.68 7.19 11.75 7 11.75s-0.38-0.07-0.53-0.22l-3.5-3.5c-0.29-0.29-0.29-0.77 0-1.06s0.77-0.29 1.06 0L7 9.94l4.97-4.97c0.29-0.29 0.77-0.29 1.06 0S13.32 5.74 13.03 6.03z"/>\ 12583 </svg>\ 12584 </label>\ 12585 </div>\ 12586 ì·¨ììì² ìí\ 12587 </div>'; 12588 var my_point = Number(data.r.my_point); 12589 12590 var weight_template_product = {}; 12591 for (var i=0;i<data.r.odata.length;i++) { 12592 if(c_data.odata[i].state != 'normal') continue; 12593 var dts = c_data.odata[i].state == 'normal' ? c_data.odata[i].delivery_template_seq : ''; 12594 if(c_data.odata[i].state == 'normal' && c_data.odata[i].mix_yn != 'Y') dts += '-' + c_data.odata[i].product_number; 12595 var dt = c_data.odata[i].state == 'normal' ? c_data.odata[i].delivery_type : ''; 12596 12597 if(dtl[dts]['price_type'] == 'WEIGHT') { 12598 if(!weight_template_product.hasOwnProperty(dts)) weight_template_product[dts] = {}; 12599 if(!weight_template_product[dts].hasOwnProperty(dt)) weight_template_product[dts][dt] = {}; 12600 if(!weight_template_product[dts][dt].hasOwnProperty(c_data.odata[i].product_number)) weight_template_product[dts][dt][c_data.odata[i].product_number] = data.r.odata[i]; 12601 } 12602 var tooltip = ''; 12603 if(dtl[dts]['price_type'] == 'WEIGHT' || dtl[dts]['price_type'] == 'QUANTITY') { 12604 if(dtl[dts]['price_type_detail']['method'] == 'DIFFERENTIAL') { 12605 if(dtl[dts]['price_type'] == 'QUANTITY') { 12606 tooltip += '<li class=\'title\'>ìëë³ ë°°ì¡ë¹</li>'; 12607 $(dtl[dts]['price_type_detail']['detail']).each(function(k, detail) { 12608 var d_v = Object.keys(detail)[0]; 12609 var d_p = detail[d_v]; 12610 tooltip += '<li class=\'item\'>' + d_v + 'ê° ì´ì ' + number_format(d_p) + 'ì</li>'; 12611 }); 12612 } else if(dtl[dts]['price_type'] == 'WEIGHT') { 12613 tooltip += '<li class=\'title\'>무ê²ë³ ë°°ì¡ë¹</li>'; 12614 $(dtl[dts]['price_type_detail']['detail']).each(function(k, detail) { 12615 var d_v = Object.keys(detail)[0]; 12616 var d_p = detail[d_v]; 12617 tooltip += '<li class=\'item\'>' + d_v + 'Kg ì´ì ' + number_format(d_p) + 'ì</li>'; 12618 }); 12619 } 12620 } else if(dtl[dts]['price_type_detail']['method'] == 'REPEAT') { 12621 if(dtl[dts]['price_type'] == 'QUANTITY') { 12622 tooltip += '<li class=\'title\'>ìëë³ ë°°ì¡ë¹</li>'; 12623 tooltip += '<li class=\'item\'>' + number_format(dtl[dts]['repeat_value']) + 'ê° êµ¬ë§¤ìë§ë¤ ' + number_format(dtl[dts]['repeat_price']) + 'ì ë°ë³µ ë¶ê³¼</li>'; 12624 } else if(dtl[dts]['price_type'] == 'WEIGHT') { 12625 tooltip += '<li class=\'title\'>무ê²ë³ ë°°ì¡ë¹</li>'; 12626 tooltip += '<li class=\'item\'>' + number_format(dtl[dts]['repeat_value']) + 'Kgë§ë¤ ' + number_format(dtl[dts]['repeat_price']) + 'ì ë°ë³µ ë¶ê³¼</li>'; 12627 } 12628 } 12629 if(tooltip && (dt == 'DELIVERY' || dt == 'DIRECT')) { 12630 if(!LUX) tooltip += '<li class=\'desc\'>ì¶ê° ìíì ë°°ì¡ë¹ ì¡°ê±´ì ë°ìëì§ ììµëë¤.</li>'; 12631 12632 if(dtl[dts]['price_type'] == 'WEIGHT' && weight_template_product[dts][dt]) { 12633 tooltip += '<li class=\'title product-weight\'>ìíë³ ë¬´ê²</li>'; 12634 $.each(weight_template_product[dts][dt], function(k, v) { 12635 tooltip += '<li class=\'item\'>' + v.product_name + ' : ' + number_format(v.product_weight) + 'kg</li>'; 12636 }); 12637 } 12638 12639 tooltip = '<ul class=\'delivery-tooltip\'>' + tooltip + '</ul>'; 12640 dtl[dts]['tooltip'] = tooltip; 12641 } 12642 } 12643 } 12644 12645 modal_str += '<table class="table product-table">'; 12646 for (var i=0;i<data.r.odata.length;i++) { 12647 if (c_data.odata[i].d_status == '' || c_data.odata[i].d_status == 'CN') { 12648 noneChecked = ''; 12649 if (!checkNoneAll) noneAll = ''; 12650 } else { 12651 if (!checkNoneAll) noneAll = 'noneAll'; 12652 noneChecked = 'noneChecked'; 12653 } 12654 if (c_data.odata[i].p_status == 'W') { 12655 if (!checkNoneAll) noneAll = 'noneAll'; 12656 noneChecked = 'noneChecked'; 12657 checkboxNone = 'checked'; 12658 } 12659 var curr_point = 0; 12660 var usable_point = 0; 12661 var refund_point = 0; 12662 var expired_point = 0; 12663 12664 if(c_data.odata[i].used_point) { 12665 curr_point = Math.abs(c_data.odata[i].used_point.point); 12666 usable_point = Math.abs(c_data.odata[i].used_point.usable_point); 12667 } 12668 12669 // if(c_data.odata[i].refund_point) { 12670 // refund_point = c_data.odata 12671 // } 12672 12673 if(c_data.odata[i].expired_point) { 12674 expired_point = Math.abs(c_data.odata[i].expired_point.point); 12675 } 12676 12677 12678 var dts = c_data.odata[i].state == 'normal' ? c_data.odata[i].delivery_template_seq : ''; 12679 if(c_data.odata[i].state == 'normal' && c_data.odata[i].mix_yn != 'Y') dts += '-' + c_data.odata[i].product_number; 12680 var dt = c_data.odata[i].state == 'normal' ? c_data.odata[i].delivery_type : ''; 12681 12682 modal_str += '\ 12683 <tr class="cl-s-product-jumbotron clearfix">\ 12684 <td ' + (c_data.odata[i].state != 'normal' ? 'colspan="2"' : '') + '>\ 12685 <div class="newcheckbox hand">\ 12686 <label>\ 12687 <
12687input type="checkbox" class="status-checkbox cancel-info-data '+noneAll+' '+noneChecked+'" data-curr_point="' + curr_point + '" data-usable_point="' + usable_point + '" data-expired_point="' + expired_point + '" data-type="'+c_data.pdata[i].state+'" name="order_number_ary[]" value="'+c_data.odata[i].order_number+'" '+checkboxNone+' data-option_type="' + c_data.pdata[i].option_type + '" data-product_number="' + c_data.odata[i].product_number + '" data-mix_yn="' + (c_data.odata[i].state == 'normal' ? c_data.odata[i].mix_yn : '') + '" data-delivery_template_seq="' + (c_data.odata[i].state == 'normal' ? dts : '') + '" data-delivery_type="' + (c_data.odata[i].state == 'normal' ? c_data.odata[i].delivery_type : '') + '" data-quantity="' + c_data.odata[i].quantity + '" data-product_weight="' + (c_data.odata[i].state == 'normal' ? c_data.odata[i].product_weight : 0) + '" data-delivery_price="' + (c_data.odata[i].state == 'normal' && dtl[dts]['pay_type'] == 'PREPAY' ? c_data.odata[i].delivery_price : 0) + '">\ 12688 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\ 12689 <path d="M13 0H3C1.3 0 0 1.3 0 3v10c0 1.7 1.3 3 3 3h10c1.7 0 3-1.3 3-3V3C16 1.3 14.7 0 13 0zM15 13c0 1.1-0.9 2-2 2H3c-1.1 0-2-0.9-2-2V3c0-1.1 0.9-2 2-2h10c1.1 0 2 0.9 2 2V13z"/>\ 12690 </svg>\ 12691 <svg class="active" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\ 12692 <path d="M13 0H3C1.34 0 0 1.34 0 3v10c0 1.66 1.34 3 3 3h10c1.66 0 3-1.34 3-3V3C16 1.34 14.66 0 13 0zM13.03 6.03l-5.5 5.5C7.38 11.68 7.19 11.75 7 11.75s-0.38-0.07-0.53-0.22l-3.5-3.5c-0.29-0.29-0.29-0.77 0-1.06s0.77-0.29 1.06 0L7 9.94l4.97-4.97c0.29-0.29 0.77-0.29 1.06 0S13.32 5.74 13.03 6.03z"/>\ 12693 </svg>\ 12694 </label>\ 12695 </div>\ 12696 <div class="cl-s-product-thumb">\ 12697 <img src="' + c_data.pdata[i].img + '" alt="' + c_data.pdata[i].name + '" class="' + c_data.pdata[i].img_align + '" />\ 12698 </div>\ 12699 <div class="cl-s-product-info">\ 12700 <h5 class="cl-s-product-title">' + c_data.pdata[i].name + '</h5>\ 12701 '; 12702 12703 console.log(c_data.odata[i]); 12704 12705 var price = (Number(c_data.odata[i].sale_price) > 0) ? c_data.odata[i].sale_price : c_data.odata[i].price, 12706 quantity = Number(c_data.odata[i].quantity), 12707 optionPrice = c_data.odata[i].price * quantity, 12708 sum_price = quantity * price, 12709 option_name = (typeof c_data.pdata[i].option != "undefined" && c_data.pdata[i].option) ? c_data.pdata[i].option : '', 12710 option_str = '', 12711 etc_str = (typeof c_data.pdata[i].etc_date != "undefined" && c_data.pdata[i].etc_date) ? '<span class="etc-date">ì íì¼ì: '+c_data.pdata[i].etc_date+'</span>' : '', 12712 option_title = (c_data.pdata[i].option_type == 'A') ? 'ì¶ê°ìµì : ' + (c_data.pdata[i].option_group ? c_data.pdata[i].option_group + ': ' : '') : 'ìµì : '; 12713 if(option_name) { 12714 option_str = (c_data.pdata[i].option_text_str) ? '<span class="' + (etc_str ? 'option-name' : '') + '">' + option_title + option_name+' / '+c_data.pdata[i].option_text_str+'</span>' : '<span class="' + (etc_str ? 'option-name' : '') + '">' + option_title + option_name+'</span>'; 12715 } else { 12716 option_str = (c_data.pdata[i].option_text_str) ? '<span class="' + (etc_str ? 'option-name' : '') + '">' + option_title + c_data.pdata[i].option_text_str+'</span>' : ''; 12717 } 12718 modal_str += '\ 12719 <div class="option-str option-check" data-optionPrice="'+optionPrice+'">' + option_str + etc_str + '<span>' + quantity + 'ê°</span><div class="price"><span>
12719' + number_format(optionPrice) + '</span> ì</div></div>\ 12720 </div>\ 12721 </td>\ 12722 '; 12723 12724 if(c_data.odata[i].state == 'normal') { 12725 var delivery_cnt = dtl[dts]['dtype'][dt].delivery_cnt; 12726 if(!dtl[dts]['dtype'][dt].hasOwnProperty('counter')) { 12727 dtl[dts]['dtype'][dt]['counter'] = 0; 12728 } 12729 12730 dtl[dts]['dtype'][dt]['counter']++; 12731 12732 if(dtl[dts]['dtype'][dt]['counter'] == 1) { 12733 modal_str +='\ 12734 <td rowspan="' + delivery_cnt + '" class="delivery-price"><div>ë°°ì¡ë¹</div><div class="price"><span>'; 12735 if(dt == 'DELIVERY' || dt == 'DIRECT') { 12736 if(dtl[dts]['price_type'] == 'ETC') { 12737 modal_str += 'ë³ëìë´</span>'; 12738 } else { 12739 modal_str += number_format(dtl[dts]['dtype'][dt]['price']) + '</span> ì'; 12740 } 12741 if(dtl[dts]['pay_type'] == 'DELIVERED') modal_str += '(ì°©ë¶)'; 12742 12743 if(dtl[dts]['price_type'] == 'FREE_CONDITION') { 12744 modal_str += '<div class="price-desc">' + number_format(dtl[dts]['free_condition']) + 'ì ì´ì<br>ë°°ì¡ë¹ 무ë£</div>'; 12745 } 12746 } else { 12747 modal_str += $.lang[LANG]['shopping.delivery.template.delivery_type.' + dt.toLowerCase()] + '</span>'; 12748 if(dt == 'QUICK') modal_str += '(ì°©ë¶)'; 12749 } 12750 if(dtl[dts]['tooltip'] && (dt == 'DELIVERY' || dt == 'DIRECT')) { 12751 modal_str += '<svg class="cm-popover-info" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 13" width="13" height="13" tabindex="0" data-trigger="hover" data-toggle="popover" fill="#4789e7" data-html="true" data-placement="top" data-content="' + dtl[dts]['tooltip'] + '" data-original-title="" title=""><path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"></path><path d="M6.66 3.01C5.61 3.01 4.58 3.5 4.5 4.8c0 0.06-0.01 0.12 0 0.2h1.02c0-0.07 0.01-0.15 0.02-0.23 0.08-0.62 0.52-0.76 1.08-0.76 0.63 0 1.02 0.37 1.02 0.95 -0.01 0.48-0.3 0.87-0.76 1.34C6.21 6.97 6.02 7.37 6 8h0.99C7 7.66 7.04 7.37 7.67 6.75 8.17 6.27 8.7 5.68 8.7 4.87 8.7 3.85 7.89 3.01 6.66 3.01z"></path><rect x="6" y="9" width="1" height="1"></rect></svg>'; 12752 } 12753 modal_str +='</div></td>\ 12754 '; 12755 } 12756 12757 modal_str += '\ 12758 </tr>'; 12759 12760 if(dtl[dts]['dtype'][dt]['counter'] == dtl[dts]['dtype'][dt]['delivery_cnt']) { 12761 modal_str += '\ 12762 <tr class="cl-s-product-jumbotron clearfix delivery-price delivery-price-mobile">\ 12763 <td><div class="delivery-title">묶ì ë°°ì¡ë¹</div><div class="delivey-price"><span>'; 12764 12765 if(dtl[dts]['tooltip'] && (dt == 'DELIVERY' || dt == 'DIRECT')) { 12766 modal_str += '<svg class="cm-popover-info" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 13" width="13" height="13" tabindex="0" data-trigger="hover" data-toggle="popover" fill="#4789e7" data-html="true" data-placement="top" data-content="' + dtl[dts]['tooltip'] + '" data-original-title="" title=""><path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"></path><path d="M6.66 3.01C5.61 3.01 4.58 3.5 4.5 4.8c0 0.06-0.01 0.12 0 0.2h1.02c0-0.07 0.01-0.15 0.02-0.23 0.08-0.62 0.52-0.76 1.08-0.76 0.63 0 1.02 0.37 1.02 0.95 -0.01 0.48-0.3 0.87-0.76 1.34C6.21 6.97 6.02 7.37 6 8h0.99C7 7.
1276666 7.04 7.37 7.67 6.75 8.17 6.27 8.7 5.68 8.7 4.87 8.7 3.85 7.89 3.01 6.66 3.01z"></path><rect x="6" y="9" width="1" height="1"></rect></svg>'; 12767 } 12768 12769 if(dt == 'DELIVERY' || dt == 'DIRECT') { 12770 modal_str += number_format(dtl[dts]['dtype'][dt]['price']) + '</span> ì'; 12771 if(dtl[dts]['pay_type'] == 'DELIVERED') modal_str += '(ì°©ë¶)'; 12772 if(dtl[dts]['price_type'] == 'FREE_CONDITION') { 12773 modal_str += '<div class="price-desc">' + number_format(dtl[dts]['free_condition']) + 'ì ì´ì ë°°ì¡ë¹ 무ë£</div>'; 12774 } 12775 } else { 12776 modal_str += $.lang[LANG]['shopping.delivery.template.delivery_type.' + dt.toLowerCase()] + '</span>'; 12777 if(dt == 'QUICK') modal_str += '(ì°©ë¶)'; 12778 } 12779 12780 modal_str += '</div></td>\ 12781 </tr>\ 12782 '; 12783 } 12784 } 12785 } 12786 modal_str += '</table>'; 12787 12788 modal_str += '<div class="order-cancel-content">\ 12789 <div class="cl-s-form-selector">\ 12790 <select class="selectpicker dropdown" id="cancel-reason" name="reason">\ 12791 <option value="구매ìì¬ ì·¨ì">구매ìì¬ ì·¨ì</option>\ 12792 <option value="ë¤ë¥¸ ìí ì못 주문">ë¤ë¥¸ ìí ì못 주문</option>\ 12793 <option value="기í">기í</option>\ 12794 </select>\ 12795 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 8 4" width="8" height="4"><polygon points="0 0 4 4 8 0 "></polygon></svg>\ 12796 </div>\ 12797 <div class="cl-s-form-wrap">\ 12798 <div class="cl-s-form-group input-label-hide">\ 12799 <textarea class="cl-s-form-control control-textarea" id="cancel-requests" name="requests" maxlength="500" required="required"></textarea>\ 12800 <label for="input" class="cl-s-control-label">ìì¸í ë´ì©ì ì ì´ì£¼ì¸ì. (500ì ì´ë´)</label>\ 12801 </div>\ 12802 </div>\ 12803 </div>'; 12804 12805 modal_str += '<div class="order-cancel-content">\ 12806 <div class="cancel-info-box">\ 12807 <div class="cancel-info"><span class="cancel-info-title">ì·¨ììí í©ê³</span><span class="cancel-info-price" id="cancel-price">0ì</span></div>\ 12808 <div class="cancel-info"><span class="cancel-info-title">ì·¨ì ë°°ì¡ë¹ í©ê³</span><span class="cancel-info-price" id="cancel-delivery-price">0ì</span></div>\ 12809 <div class="cancel-info"><span class="cancel-info-title">ì 립ê¸</span><span class="cancel-info-price" id="cancel-point-price">0ì</span></div>\ 12810 <div class="cancel-info"><span class="cancel-info-title">ì¿ í°</span><span class="cancel-info-price" id="cancel-coupon-price">0ì</span></div>\ 12811 <div class="cancel-info"><span class="cancel-info-title cancel-coupon-title"></span><span class="cancel-info-price" id="cancel-coupon-detail"></span></div>\ 12812 <div class="cancel-info-line"></div>\ 12813 <div class="return-total-info"><span class="cancel-info-title">íë¶ ìì ê¸ì¡</span><span class="cancel-info-price"><span id="return-total-price">0</span>ì</span></div>\ 12814 </div>'+checkEscrowFooter+'\ 12815 </div>'; 12816 modal_str += checkDepositCancel; 12817 12818 var status = []; 12819 for (var i=0;i<c_data.pdata.length;i++) { 12820 status.push(c_data.pdata[i].p_status); 12821 } 12822 12823 if (pclass == '무íµì¥ ì ê¸' || pclass == 'ê°ìê³ì¢') { 12824 var returnClass = ''; 12825 if (c_data.return_bank.length > 1 && c_data.return_bank.indexOf('')===-1) returnClass = 'returnDisabled'; 12826 modal_str += '\ 12827 <div class="modal-sub-title">íë¶ ê³ì¢</div>\ 12828 <ul class="qna-writer clearfix">\ 12829 <li class="">\ 12830 <div class="cl-s-form-wrap '+returnClass+'">\ 12831 <div class="cl-s-form-group">'; 12832 if (c_data.return_bank.length > 1 && c_data.return_bank.indexOf('')===-1) modal_str += '<input type="text" class="cl-s-form-control has-value" id="no-bank" name="no_bank" readonly required="required" value="'+c_data.return_bank[1]+'">'; 12833 else modal_str += '<input type="text" class="cl-s-form-control" id="no-bank" name="no_bank" required="required" value="">'; 12834 modal_str += '<label for="input" class="cl-s-control-label">ìíëª </label>\ 12835 </div>\ 12836 </div>\ 12837 </li>\ 12838 <li>\ 12839 <div class="cl-s-form-wrap '+returnClass+'">\ 12840 <div class="cl-s-form-group">'; 12841 if (c_data.return_bank.length > 1 && c_data.return_bank.indexOf('')===-1) modal_str += '<input type="text" class="cl-s-form-control has-value" id="no-bank-name" readonly name="no_bank_name" required="required" value="'+c_data.return_bank[2]+'">'; 12842 else modal_str += '<input type="text" class="cl-s-form-control" id="no-bank-name" name="no_bank_name" required="required">'; 12843 modal_str += '<label for="input" class="cl-s-control-label">ìê¸ì£¼</label>\ 12844 </div>\ 12845 </div>\ 12846 </li>\ 12847 <li>\ 12848 <div class="cl-s-form-wrap '+returnClass+'">\ 12849 <div class="cl-s-form-group">'; 12850 if (c_data.return_bank.length > 1 && c_data.return_bank.indexOf('')===-1) modal_str += '<input type="text" class="cl-s-form-control has-value" id="no-bank-number" name="no_bank_number" readonly data-type="email" required="required" value="'+c_data.return_bank[3]+'">'; 12851 else modal_str += '<input type="text" class="cl-s-form-control" id="no-bank-number" name="no_bank_number" data-type="email" required="required" value="">'; 12852 modal_str += '<label for="input" class="cl-s-control-label">ê³ì¢ë²í¸</label>\ 12853 </div>\ 12854 </div>\ 12855 </li>\ 12856 </ul>'; 12857 if(status.indexOf('W')===-1) modal_str += '\ 12858 <div class="modal-comment">ëì¼ ì£¼ë¬¸ ë´ ì¬ë¬ ìíì íë¶ ìì²íìë ê²½ì°, ì
12858µì´ ì ë ¥í íë¶ê³ì¢ë¡ ì¼ê´ íë¶ì²ë¦¬ë©ëë¤.</div>\ 12859 '; 12860 } 12861 12862 modal_str += '\ 12863 <div class="modal-comment point-used-desc hide">\ 12864 <div class="desc-box">\ 12865 <div class="desc-title">ì ë¦½ê¸ íë¶ ìë´</div>\ 12866 <div class="section">ìí(ë¤)ì 구매íì¬ ì 립ë ì ë¦½ê¸ <span id="disp_used_point_total" class="point-color"></span>ìì´ ì´ë¯¸ ì¬ì©ëê±°ë ì í¨ê¸°ê°ì´ ë§ë£ëììµëë¤.</div>\ 12867 <div class="section">íì¬ ë³´ì ì 립ê¸ì´ <span class="point-color">' + addCommas(my_point) + '</span>ì ì¼ë¡ 구매 ì 립ë ì ë¦½ê¸ <span id="disp_cancel_after_point" class="point-color"></span>ìì ì·¨ì ì²ë¦¬í ì ììµëë¤.</div>\ 12868 <div class="section">미 ì·¨ìë ì 립ê¸ì ëí ì²ë¦¬ë í매ìì íìí´ì£¼ì¸ì.</div>\ 12869 </div>\ 12870 <div class="newcheckbox hand">\ 12871 <label style="margin-left: 25px;">\ 12872 <input type="checkbox" class="cancel-agree" />\ 12873 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\ 12874 <path d="M13 0H3C1.3 0 0 1.3 0 3v10c0 1.7 1.3 3 3 3h10c1.7 0 3-1.3 3-3V3C16 1.3 14.7 0 13 0zM15 13c0 1.1-0.9 2-2 2H3c-1.1 0-2-0.9-2-2V3c0-1.1 0.9-2 2-2h10c1.1 0 2 0.9 2 2V13z"></path>\ 12875 </svg>\ 12876 <svg class="active" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\ 12877 <path d="M13 0H3C1.34 0 0 1.34 0 3v10c0 1.66 1.34 3 3 3h10c1.66 0 3-1.34 3-3V3C16 1.34 14.66 0 13 0zM13.03 6.03l-5.5 5.5C7.38 11.68 7.19 11.75 7 11.75s-0.38-0.07-0.53-0.22l-3.5-3.5c-0.29-0.29-0.29-0.77 0-1.06s0.77-0.29 1.06 0L7 9.94l4.97-4.97c0.29-0.29 0.77-0.29 1.06 0S13.32 5.74 13.03 6.03z"></path>\ 12878 </svg>\ 12879 ì ë´ì©ì íì¸íììµëë¤.</label>\ 12880 </div>\ 12881 <div class="point-used-cancel-agree-desc">\ 12882 <svg viewBox="0 0 13 13" width="13" height="13"><path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"/><rect x="6" y="3" width="1" height="5"/><rect x="6" y="9" width="1" height="1"/></svg>\ 12883 ì ë¦½ê¸ íë¶ ìë´ì ëìí´ì£¼ì¸ì.\ 12884 </div>\ 12885 </div>\ 12886 '; 12887 12888 modal_str += '</form>\ 12889 '; 12890 12891 var ocModal = $(this).showModalFlat('ì·¨ì ìì²', modal_str,true,true,function () { 12892 12893 var f = document.cancel_form; 12894 if(ocModal.find('#cancel-reason').prop('value') == '') { 12895 // $('#cancel-reason').selectpicker('toggle'); 12896 // return false; 12897 $('#cancel-reason').closest('.cl-s-form-selector').addClass('empty'); 12898 } 12899 12900 ocModal.find('.cl-s-form-wrap').each(function() { 12901 var check_input = $(this).find('.cl-s-form-control'), 12902 val = check_input.val().trim(); 12903 12904 if(val.length == 0) { 12905 $(this).removeClass('error').addClass('empty'); 12906 $(this).find('.cl-s-control-label.error').remove(); 12907 } else { 12908 if($(this).hasClass('error')) { 12909 check_input.focus(); 12910 } 12911 } 12912 }); 12913 var checkCnt = 0; 12914 12915 $(".status-checkbox").each(function (i, index) { 12916 if ($(this).is(":checked") === true) { 12917 checkCnt++; 12918 } 12919 }); 12920 12921 if (checkCnt < 1) { 12922 alert('ìíì 1ê° ì´ì ì íí´ ì£¼ì¸ì'); 12923 return false;
12924 } 12925 12926 if(ocModal.find('.cl-s-form-wrap.empty, .cl-s-form-wrap.error').length > 0) { 12927 // ocModal.find('.cl-s-form-wrap.empty, .cl-s-form-wrap.error').eq(0).find('.cl-s-form-control').focus(); 12928 return false; 12929 } 12930 12931 if(ocModal.find("input[type='checkbox'].cancel-agree:visible").length && ocModal.find("input[type='checkbox'].cancel-agree:visible").length != ocModal.find("input[type='checkbox'].cancel-agree:visible:checked").length) { 12932 $(".point-used-cancel-agree-desc").show(); 12933 return false; 12934 } else { 12935 $(".point-used-cancel-agree-desc").hide(); 12936 } 12937 12938 $.processON(); 12939 12940 f.submit(); 12941 ocModal.modal('hide'); 12942 12943 },'close','ë±ë¡í기','cl-s-order-cancel cl-modal cl-s-btn cover ' + checkEscrowClass, false, '', function() { 12944 var totalCnt = 0, totalNomalCheck = 0, nomalCheck = 0, price = 0, deliveryPrice = 0, 12945 $form = $('form[name="cancel_form"]'); 12946 12947 $('.status-checkbox').each(function(i, index) { 12948 if ($(this).is(":checked") === true) { 12949 price += ($(this).closest('.cl-s-product-jumbotron').find('.option-check').attr('data-optionPrice') * 1); 12950 totalCnt++; 12951 if ($(this).attr('data-type') == 'normal') { 12952 nomalCheck++; 12953 var mix_yn = $(this).data('mix_yn'); 12954 var delivery_price = 0; 12955 var delivery_template_seq = $(this).data('delivery_template_seq'); 12956 var delivery_type = $(this).data('delivery_type'); 12957 if(ocModal.find('input[name="order_number_ary[]"][data-delivery_type="' + delivery_type + '"][data-delivery_template_seq="' + delivery_template_seq + '"]').length == ocModal.find('input[name="order_number_ary[]"][data-delivery_type="' + delivery_type + '"][data-delivery_template_seq="' + delivery_template_seq + '"]:checked').length) { 12958 delivery_price = Number($(this).data('delivery_price')); 12959 } 12960 deliveryPrice += delivery_price; 12961 } 12962 } 12963 12964 if ($(this).attr('data-type') == 'normal') { 12965 totalNomalCheck++; 12966 } 12967 }); 12968 12969 if(c_data.order_status == 'W') { 12970 $("#product-check, .status-checkbox").click(function(e){ 12971 return false; 12972 }); 12973 } 12974 var product_price = price + deliveryPrice, 12975 rePayment = parseInt(c_data.pay_info.request.payment.total) - parseInt(c_data.pay_info.request.payment.coupon) - parseInt(c_data.pay_info.request.cancel.total) - parseInt(c_data.pay_info.request.return.total); 12976 12977 rePayment = (rePayment > 0) ? rePayment : 0; 12978 12979 // coupon ì²ë¦¬ 12980 var coupon = c_data.pay_info.coupon_list, 12981 cancel_coupon_price = 0; 12982 if(coupon.length) { 12983 var checked_order_number = $('.cancel-info-data:checked').map(function(){ return this.value; }).toArray(); 12984 12985 $.each(coupon, function(i,v) { 12986 if(checked_order_number.indexOf(v.order_number) > -1 || v.kind == 'C') { 12987 cancel_coupon_price += parseInt(v.discount_price); 12988 12989 // íë¶ê¸ìì ì¿ í°ì²ë¦¬ 12990 if($('.coupon-detail-info[data-seq="' + v.seq + '"]').length == 0) { 12991 $('.cancel-coupon-title').append('<span class="coupon-name coupon-detail-info" data-seq="' + v.seq + '">' + v.coupon_name + '</span>'); 12992 $('#cancel-coupon-detail').append('<span class="coupon-price coupon-detail-info" data-seq="' + v.seq + '">-' + number_format(parseInt(v.discount_price)) + 'ì</span>'); 12993 } 12994 } else { 12995 $('.coupon-detail-info[data-seq="' + v.seq + '"]').remove(); 12996 } 12997 }); 12998 // ì·¨ìë ì¿ í° ì ì¥ 12999 } 13000 product_price = product_price - parseInt(cancel_coupon_price); 13001 13002 var use_point = (rePayment - product_price > 0) ? 0 : rePayment - product_price; 13003 product_price = product_price + use_point; 13004 13005 $('#cancel-price').html(number_format(price)+'ì'); 13006 $('#cancel-delivery-price').html(number_format(deliveryPrice)+'ì'); 13007 $('#cancel-point-price').html(number_format(use_point)+'ì'); 13008 $('#cancel-coupon-price').html(((cancel_coupon_price > 0) ? '-' + number_format(cancel_coupon_price) : '0')+'ì'); 13009 $('#return-total-price').html(number_format(product_price)); 13010 13011 $('.cancel-info-data').on('change', function (e) { 13012 if($(this).hasClass('noneAll')) return; 13013 var cancel_after_point = my_point; 13014 var disp_used_point_total = 0; 13015 var deliveryPrice = 0; 13016 var extra_delivery_flag = {}; 13017 var dtl_copy = JSON.parse(JSON.stringify(dtl)); 13018 13019 13020 var product_number = $(this).attr('data-product_number'); 13021 if($(this).attr('data-option_type') != 'A' && !$('input[name="order_number_ary[]"][data-product_number="' + product_number + '"][data-option_type!="A"]:not(:checked)').length) { 13022 $('input[name="order_number_ary[]"][data-product_number="' + product_number + '"][data-option_type="A"]').prop('checked',true); 13023 } else if($(this).attr('data-option_type') == 'A' && !$('input[name="order_number_ary[]"][data-product_number="' + product_number + '"][data-option_type!="A"]:not(:checked)').length && !$(this).prop('checked')) { 13024 $('input[name="order_number_ary[]"][data-product_number="' + product_number + '"][data-option_type!="A"]:last').prop('checked',fal
13024se); 13025 } 13026 13027 if($("input[name='order_number_ary[]']:checked").length) { 13028 coupon.map(function(v,k) { coupon[k]['apply'] = '' }); 13029 $("input[name='order_number_ary[]']:checked").each(function() { 13030 cancel_after_point = Number(cancel_after_point) + ((Number($(this).data("expired_point"))) - Number($(this).data("curr_point"))); 13031 disp_used_point_total += ((Number($(this).data("expired_point"))) - Number($(this).data("curr_point"))); 13032 c_ord_num = $(this).val(); 13033 13034 if($(this).data('type') != 'normal' || $(this).data('option_type') == 'A') return; 13035 var mix_yn = $(this).data('mix_yn'); 13036 var delivery_price = 0; 13037 var delivery_template_seq = $(this).data('delivery_template_seq'); 13038 var delivery_type = $(this).data('delivery_type'); 13039 var product_weight = $(this).data('product_weight'); 13040 13041 if(delivery_type != 'DELIVERY' && delivery_type != 'DIRECT') return; 13042 // if(dtl[delivery_template_seq]['price_type'] != 'WEIGHT' && dtl[delivery_template_seq]['price_type'] != 'QUANTITY') { 13043 if(ocModal.find('input[name="order_number_ary[]"][data-delivery_type="' + delivery_type + '"][data-delivery_template_seq="' + delivery_template_seq + '"]').length == ocModal.find('input[name="order_number_ary[]"][data-delivery_type="' + delivery_type + '"][data-delivery_template_seq="' + delivery_template_seq + '"]:checked').length) { 13044 delivery_price = Number($(this).data('delivery_price')); 13045 13046 coupon.map(function(v,k) { if(v.order_number == c_ord_num && delivery_price > 0 && v.benefit == 'DELIVERY') coupon[k]['apply'] = '1'; }); 13047 } 13048 13049 if(dtl[delivery_template_seq]['price_type'] != 'WEIGHT' && dtl[delivery_template_seq]['price_type'] != 'QUANTITY') { 13050 } else { 13051 dtl_copy[delivery_template_seq]['dtype'][delivery_type]['real_weight'] -= Number((Number($(this).data('product_weight')) * Number($(this).data('quantity'))).toFixed(3)); 13052 dtl_copy[delivery_template_seq]['dtype'][delivery_type]['real_weight'] = Number(dtl_copy[delivery_template_seq]['dtype'][delivery_type]['real_weight'].toFixed(3)); 13053 dtl_copy[delivery_template_seq]['dtype'][delivery_type]['real_quantity'] -= Number($(this).data('quantity')); 13054 13055 if(dtl[delivery_template_seq]['price_type_detail']['method'] == 'REPEAT') { 13056 if(dtl[delivery_template_seq]['price_type'] == 'WEIGHT') { 13057 dtl_copy[delivery_template_seq]['dtype'][delivery_type]['real_price'] = Math.ceil(dtl_copy[delivery_template_seq]['dtype'][delivery_type]['real_weight'] / dtl[delivery_template_seq]['repeat_value']) * dtl[delivery_template_seq]['repeat_price']; 13058 } else if(dtl[delivery_template_seq]['price_type'] == 'QUANTITY') { 13059 dtl_copy[delivery_template_seq]['dtype'][delivery_type]['real_price'] = dtl_copy[delivery_template_seq]['dtype'][delivery_type]['real_price'] - Math.ceil(dtl_copy[delivery_template_seq]['dtype'][delivery_type]['real_quantity'] / dtl[delivery_template_seq]['repeat_value']) * dtl[delivery_template_seq]['repeat_price']; 13060 } 13061 // if() 13062 } else if(dtl[delivery_template_seq]['price_type_detail']['method'] == 'DIFFERENTIAL') { 13063 if(dtl[delivery_template_seq]['price_type'] == 'WEIGHT') { 13064 $.each(dtl[delivery_template_seq]['price_type_detail'].detail, function() { 13065 var r_value = Number(Object.keys(this)[0]); 13066 var r_price = Number(Object.values(this)[0]); 13067 if(dtl_copy[delivery_template_seq]['dtype'][delivery_type]['real_weight'] == 0) { 13068 dtl_copy[delivery_template_seq]['dtype'][delivery_type]['real_price'] = 0; 13069 } else if(dtl_copy[delivery_template_seq]['dtype'][delivery_type]['real_weight'] >= r_value) { 13070 dtl_copy[delivery_template_seq]['dtype'][delivery_type]['real_price'] = r_price; 13071 } 13072 }); 13073 } else if(dtl[delivery_template_seq]['price_type'] == 'QUANTITY') { 13074 $.each(dtl[delivery_template_seq]['price_type_detail'].detail, function() { 13075 var r_value = Number(Object.keys(this)[0]); 13076 var r_price = Number(Object.values(this)[0]); 13077 if(dtl_copy[delivery_template_seq]['dtype'][delivery_type]['real_quantity'] == 0) { 13078 dtl_copy[delivery_template_seq]['dtype'][delivery_type]['real_price'] = 0; 13079 } else if(dtl_copy[delivery_template_seq]['dtype'][delivery_type]['real_quantity'] >= r_value) { 13080 dtl_copy[delivery_template_seq]['dtype'][delivery_type]['real_price'] = r_price; 13081 } 13082 }); 13083 } 13084 } 13085 if(dtl[delivery_template_seq]['dtype'][delivery_type]['real_price'] > dtl_copy[delivery_template_seq]['dtype'][delivery_type]['real_price'] && dtl_copy[delivery_template_seq]['dtype'][delivery_type]['real_price'] > 0) 13086 extra_delivery_flag[delivery_template_seq+'|'+delivery_type] = true; 13087 else 13088 extra_delivery_flag[delivery_template_seq+'|'+delivery_type] = false;
13089 } 13090 deliveryPrice += delivery_price; 13091 }); 13092 } 13093 13094 $form.find('.extra-delivery-fee-box').remove(); 13095 13096 if(cancel_after_point < 0) { 13097 $(".point-used-desc #disp_cancel_after_point").html(addCommas(Math.abs(cancel_after_point))); 13098 $(".point-used-desc #disp_used_point_total").html(addCommas(Math.abs(disp_used_point_total))); 13099 $(".point-used-desc").removeClass("hide"); 13100 } else { 13101 $(".point-used-desc").addClass("hide"); 13102 $(".point-used-desc #disp_cancel_after_point").html(""); 13103 $(".point-used-desc #disp_used_point_total").html(""); 13104 } 13105 13106 var price = 0; 13107 var oLength = $('.option-check').length; 13108 var totalCnt = 0, totalNomalCheck = 0, nomalCheck = 0; 13109 13110 $form.find('.order-cancel-content.extra-info').remove(); 13111 13112 if ($(this).hasClass('noneAll') === true) { 13113 if ($(this).hasClass('noneChecked') === true) { 13114 $(this).prop('checked', false); 13115 } else { 13116 $(this).prop('checked', true); 13117 $(".status-checkbox").each(function () { 13118 if ($(this).prop('disabled') !== true) $(this).prop('checked', true); 13119 }); 13120 } 13121 } 13122 13123 $(".status-checkbox").each(function (i, index) { 13124 if ($(this).is(":checked") === true) { 13125 price += ($(this).closest('.cl-s-product-jumbotron').find('.option-check').attr('data-optionPrice') * 1); 13126 totalCnt++; 13127 if ($(this).attr('data-type') == 'normal') nomalCheck++; 13128 } 13129 13130 if ($(this).attr('data-type') == 'normal') totalNomalCheck++; 13131 }); 13132 13133 var product_price = price + deliveryPrice, 13134 rePayment = parseInt(c_data.pay_info.request.payment.total) - parseInt(c_data.pay_info.request.cancel.total) - parseInt(c_data.pay_info.request.return.total); 13135 13136 rePayment = (rePayment > 0) ? rePayment : 0; 13137 13138 // coupon ì²ë¦¬ 13139 var cancel_coupon_price = 0; 13140 if(coupon.length) { 13141 var checked_order_number = $('.cancel-info-data:checked').map(function(){ return this.value; }).toArray(); 13142 $.each(coupon, function(i,v) { 13143 rePayment -= v.discount_price; 13144 v.apply = (v.apply || v.benefit != 'DELIVERY') ? '1' : ''; 13145 if((checked_order_number.indexOf(v.order_number) > -1 && v.apply) || v.kind == 'C') { 13146 cancel_coupon_price += parseInt(v.discount_price); 13147 // íë¶ê¸ìì ì¿ í°ì²ë¦¬ 13148 if($('.coupon-detail-info[data-seq="' + v.seq + '"]').length == 0) { 13149 $('.cancel-coupon-title').append('<span class="coupon-name coupon-detail-info" data-seq="' + v.seq + '">' + v.coupon_name + '</span>'); 13150 $('#cancel-coupon-detail').append('<span class="coupon-price coupon-detail-info" data-seq="' + v.seq + '">-' + number_format(parseInt(v.discount_price)) + 'ì</span>'); 13151 } 13152 } else { 13153 $('.coupon-detail-info[data-seq="' + v.seq + '"]').remove(); 13154 } 13155 }); 13156 // ì·¨ìë ì¿ í° ì ì¥ 13157 } 13158 13159 product_price = product_price - parseInt(cancel_coupon_price); 13160 13161 var use_point = (rePayment - product_price > 0) ? 0 : rePayment - product_price; 13162 product_price = product_price + use_point; 13163 13164 $('#cancel-price').html(number_format(price)+'ì'); 13165 $('#cancel-delivery-price').html(number_format(deliveryPrice)+'ì'); 13166 $('#cancel-point-price').html(number_format(use_point)+'ì'); 13167 $('#cancel-coupon-price').html(((cancel_coupon_price > 0) ? '-' + number_format(cancel_coupon_price) : '0')+'ì'); 13168 $('#return-total-price').html(number_format(product_price)); 13169 13170 var priceSumArr = []; 13171 var extra_charge_flag = {}; 13172 if(ocModal.find('.cancel-info-data:checked').length) { 13173 ocModal.find('.cancel-info-data:checked').each(function() { 13174 if($(this).data('type') != 'normal') 13175 return; 13176 13177 var dts = $(this).data('delivery_template_seq'); 13178 if(dtl[dts]['price_type'] != 'FREE_CONDITION') return; 13179 var dt = $(this).data('delivery_type'); 13180 if(dt != 'DELIVERY' && dt != 'DIRECT') return; 13181 13182 if(!priceSumArr.hasOwnProperty(dts)) { 13183 priceSumArr[dts] = []; 13184 13185 } 13186 13187 if(!priceSumArr[dts].hasOwnProperty(dt)) { 13188 priceSumArr[dts][dt] = 0; 13189 } 13190 // cancel_after_point = Number(cancel_after_point) + ((Number($(this).data("usable_point")) + Number($(this).data("expired_point"))) - Number($(this).data("curr_point"))); 13191 var selectedPrice = 0; 13192 selectedPrice = Number($(this).closest('tr').find('[data-optionprice]').data('optionprice')); 13193 priceSumArr[dts][dt] += selectedPrice; 13194 13195 if(dtl[dts]['dtype'][dt]['product_price'] - priceSumArr[dts][dt] < dtl[dts]['free_condition'] && dtl[dts]['dtype'][dt]['product_price'] - priceSumArr[dts][dt] > 0 && dtl[dts]['dtype'][dt]['price'] == 0) { 13196 extra_charge_flag[dts + '|' + dt] = true; 13197 } else { 13198 extra_charge_flag[dts + '|' + dt] = false;
13199 } 13200 }); 13201 } 13202 13203 extra_charge_info($form, 'C', Object.values(extra_charge_flag).indexOf(true) > -1 ? true : false, Object.values(extra_delivery_flag).indexOf(true) > -1 ? true : false); 13204 13205 if($('input[name="order_number_ary[]"]').length == $('input[name="order_number_ary[]"]:checked').length) $('#product-check').prop('checked', true); 13206 else $('#product-check').prop('checked', false); 13207 }); 13208 13209 $(document).on('click', '#product-check', function () { 13210 var price = 0; 13211 var deliveryPrice = 0; 13212 var totalCnt = 0, totalNomalCheck = 0, nomalCheck = 0; 13213 $form.find('.order-cancel-content.extra-info').remove(); 13214 if ($(this).hasClass('noneAll') === true) { 13215 $(this).prop('checked', true); 13216 $(".status-checkbox").each(function () { 13217 if ($(this).prop('disabled') !== true) $(this).prop('checked', true).change(); 13218 }); 13219 } 13220 if ($(this).is(":checked") === true) { 13221 $(".status-checkbox").each(function (i) { 13222 if ($(this).prop('disabled') !== true) { 13223 $(this).prop('checked', true).change(); 13224 } 13225 13226 }); 13227 } else { 13228 $(".status-checkbox").each(function () { 13229 if ($(this).prop('disabled') !== true) $(this).prop('checked', false).change(); 13230 }); 13231 13232 $('#cancel-price').html('0ì'); 13233 $('#cancel-delivery-price').html('0ì'); 13234 $('#cancel-point-price').html('0ì'); 13235 $('#return-total-price').html('0'); 13236 } 13237 }); 13238 13239 /* first option setting */ 13240 $('.cl-s-order-cancel .cl-s-form-selector').each(function(e) { 13241 var checkSelectOption = ($(this).find('select option').length > 0) ? true : false; 13242 if(checkSelectOption) { 13243 var selectId = $(this).find('select').attr('id'), 13244 val = $(this).find('select').children().eq(0).val(); 13245 $(this).find('select').selectpicker({'val':val, dropupAuto:false}); 13246 } 13247 }); 13248 13249 $('.cl-s-order-cancel .cl-s-form-group').on('click',function(e) { 13250 if($(e.target).hasClass('cl-s-form-group')) { 13251 $(e.target).find('.cl-s-form-control:not([type=hidden])').focus(); 13252 } 13253 }); 13254 13255 $('#cancel-reason').on({ 13256 'show.bs.select': function (e) { 13257 $(this).closest('.cl-s-form-selector').addClass('active'); 13258 }, 13259 'hidden.bs.select': function(e) { 13260 $(this).closest('.cl-s-form-selector').removeClass('active'); 13261 13262 if($('#cancel-reason').prop('value') == '') { 13263 $(this).closest('.cl-s-form-selector').addClass('empty'); 13264 } else { 13265 $(this).closest('.cl-s-form-selector').removeClass('empty'); 13266 } 13267 }, 13268 'changed.bs.select': function (e, clickedIndex, newValue, oldValue) { 13269 // console.log(this.value, clickedIndex, newValue, oldValue); 13270 } 13271 }); 13272 13273 $('.cl-s-order-cancel .control-textarea').on({ 13274 focus: function(e) { 13275 $(this).closest('.cl-s-form-wrap').addClass('active'); 13276 }, 13277 blur: function(e) { 13278 var val = $(this).val().trim(); 13279 13280 $(this).closest('.cl-s-form-wrap').removeClass('active'); 13281 if(val.length == 0) { 13282 $(this).closest('.cl-s-form-wrap').removeClass('error').addClass('empty'); 13283 $(this).closest('.cl-s-form-wrap').find('.cl-s-control-label.error').remove(); 13284 return false;
13285 } else { 13286 $(this).closest('.cl-s-form-wrap').removeClass('empty'); 13287 var error_str = ''; 13288 if(checkEmojis(val)) error_str = $.lang[LANG]['config.unable.emoji']; 13289 else if(val.length < 5) error_str = $.lang[LANG]['customsite.validate.message.minlengthto5']; 13290 13291 if(error_str.length > 0) { 13292 $(this).closest('.cl-s-form-wrap').addClass('error'); 13293 if($(this).parent().find('.cl-s-control-label.error').length > 0) { 13294 $(this).parent().find('.cl-s-control-label.error').html(error_str); 13295 } else { 13296 $(this).after('<label for="input" class="cl-s-control-label error">' + error_str + '</label>'); 13297 } 13298 return false; 13299 } 13300 } 13301 13302 $(this).closest('.cl-s-form-wrap').removeClass('error').removeClass('empty'); 13303 $(this).closest('.cl-s-form-wrap').find('.cl-s-control-label.error').remove(); 13304 } 13305 }); 13306 13307 $('.cl-s-form-wrap .cl-s-form-control').on({ 13308 focus: function(e) { 13309 $(this).closest('.cl-s-form-wrap').addClass('active'); 13310 }, 13311 blur: function(e) { 13312 var val = $(this).val().trim(); 13313 13314 $(this).closest('.cl-s-form-wrap').removeClass('active'); 13315 if(val.length == 0) { 13316 $(this).closest('.cl-s-form-wrap').removeClass('error').addClass('empty'); 13317 $(this).closest('.cl-s-form-wrap').find('.cl-s-control-label.error').remove(); 13318 return false; 13319 } else { 13320 $(this).closest('.cl-s-form-wrap').removeClass('empty'); 13321 13322 if(checkEmojis(val)) { 13323 $(this).closest('.cl-s-form-wrap').addClass('error'); 13324 if($(this).parent().find('.cl-s-control-label.error').length > 0) { 13325 $(this).parent().find('.cl-s-control-label.error').html($.lang[LANG]['config.unable.emoji']); 13326 } else { 13327 $(this).after('<label for="input" class="cl-s-control-label error">' + $.lang[LANG]['config.unable.emoji'] + '</label>'); 13328 } 13329 return false; 13330 } 13331 } 13332 13333 $(this).closest('.cl-s-form-wrap').removeClass('error'); 13334 $(this).closest('.cl-s-form-wrap').find('.cl-s-control-label.error').remove(); 13335 } 13336 }); 13337 13338 if(escrow == 'Y') { 13339 $('.cancel-info-data').off('change'); 13340 } 13341 13342 ocModal.find('[data-toggle="popover"]').popover(); 13343 }); 13344 13345 },'json'); 13346 }, 13347 orderReturnExchangeModal: function(sid, pnum, onum, ognum, status, pclass) { 13348 if(typeof sid == 'undefined' || typeof pnum == 'undefined' || typeof onum == 'undefined') { 13349 alert('ì ë³´ê° ì¬ë°ë¥´ì§ ììµëë¤'); 13350 return false; 13351 } 13352 13353 $.post('/_check_order', { sid:sid, pnum:pnum, onum:onum, mode:'return', ognum: ognum }, function(data) { 13354 var LUX = false; 13355 if(data.lux) LUX = data.lux; 13356 13357 if(typeof data.error != 'undefined' && data.error) { 13358 $(this).showModalFlat('ERROR', data.error, true, false, '', 'close'); 13359 return false;
13360 } 13361 var c_data = data.r, checkboxNone = '', noneAll = '', noneChecked = '', checkNoneAll = '', checkEscrowFooter = '', checkEscrowClass = '', checkEscrowExchangeFooter = '', checkDepositCancel = ''; 13362 13363 var checkEscrow = '', exchangeCheck = 'N'; 13364 var dtl = c_data.delivery_template_list; 13365 var used_code_coupon = false; 13366 13367 if (status == 'Y') { 13368 checkboxNone = 'checked'; 13369 noneAll = ' noneAll'; 13370 checkNoneAll = 'fule'; 13371 checkEscrow = '<div class="escrow-warring top-escrow">\ 13372 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 13" width="15" height="15">\ 13373 <path fill="#4789e7" d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"/>\ 13374 <rect fill="#4789e7" x="6" y="3" width="1" height="5"/>\ 13375 <rect fill="#4789e7" x="6" y="9" width="1" height="1"/>\ 13376 </svg>\ 13377 ìì¤í¬ë¡ ê²°ì ìíì ì·¨ì/ë°í ìì² ì ì ì²´ì íë§ ê°ë¥í©ëë¤.\ 13378 </div>'; 13379 13380 checkEscrowFooter = '<div class="escrow-warring bottom-escrow">\ 13381 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 13" width="15" height="15">\ 13382 <path fill="#4789e7" d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"/>\ 13383 <rect fill="#4789e7" x="6" y="3" width="1" height="5"/>\ 13384 <rect fill="#4789e7" x="6" y="9" width="1" height="1"/>\ 13385 </svg>\ 13386 ìì¤í¬ë¡ íë¶ ìë´\ 13387 <div class="escrow-return-info">- ì·¨ìì²ë¦¬ ì 구매ìì íë¶ì ì°ì¡ìì ì·¨ì ììë£(330ì)ê° ì°¨ê°ë©ëë¤.</div>\ 13388 <div class="escrow-return-info">- íë¶ì ì°ì¡ì ì·¨ìì²ë¦¬ í 1~3ìì ì¼ íì ì§ê¸ë©ëë¤.</div>\ 13389 </div>'; 13390 checkEscrowClass = 'cl-s-escrow-info'; 13391 13392 checkEscrowExchangeFooter = '\ 13393 <div class="escrow-warring escrow-exchange-warning bottom-escrow" style="display: none;">\ 13394 <div class="escrow-return-info">- ìì¤í¬ë¡ ê²°ì ìíì ê²½ì°, êµí ìì²/ìë£ ììë ë°íì´ ë¶ê°ë¥í©ëë¤.</div>\ 13395 <div class="escrow-return-info">- ìì¸í ì¬íì í매ìì ìë´ë¥¼ ë°ë¼ì£¼ì¸ì.</div>\ 13396 </div>\ 13397 '; 13398 } 13399 13400 if(c_data.pay_info.coupon_list && c_data.pay_info.coupon_list.length) { 13401 $.each(c_data.pay_info.coupon_list, function(k, v) { 13402 if(v.kind == 'C') { 13403 used_code_coupon = true; 13404 } 13405 }) 13406 } 13407 13408 if(used_code_coupon) { 13409 checkboxNone = 'checked'; 13410 noneAll = ' noneAll'; 13411 checkNoneAll = 'fule'; 13412 checkDepositCancel = '<div class="modal-comment deposit-cancel-desc codecoupon-cancel-desc">\ 13413 <div class="desc-box">\ 13414 <div class="desc-title">ì½ëì¿ í° ì¬ì© 주문취ì ìë´</div>\ 13415 <div class="section">- ì½ëì¿ í° ì¬ì© 주문 ê±´ì <span class="cl-red">ì ì²´ ë°í</span>ë§ ê°ë¥í©ëë¤.</div>\ 13416 <div class="section">- ì ì²´ ë°í í 구매를 ìíë ìíì ë¤ì 주문í´ì£¼ì¸ì.</div>\ 13417 ' + (c_data.order_status == 'W' ? '<div class="section">- í¹ìë ì ê¸ì íì ê²½ì° ë³ëë¡ ë¬¸ì 주ì기 ë°ëëë¤.</div>' : '') + '\ 13418 </div>\ 13419 </div>\ 13420 '; 13421 13422 checkEscrowExchangeFooter = '\ 13423 <div class="code-coupon-exchange-warning escrow-warring escrow-exchange-warning bottom-escrow" style="display: none;">\ 13424 <div class="escrow-return-info">- ì½ë ì¿ í°ì´ ì ì©ë 주문건ì êµí ì ì ì ë°íì´ ë¶ê°ë¥í©ëë¤.</div>\ 13425 <div class="escrow-return-info">- ìì¸í ì¬íì í매ìì ìë´ë¥¼ ë°ë¼ì£¼ì¸ì.</div>\ 13426 </div>\ 13427 '; 13428 } 13429 13430 var modal_str = '\ 13431 <form name="re_form" method="post" action="/_return_exchange">\ 13432 <input type="hidden" name="sid" value="' + sid + '">\ 13433 <input type="hidden" name="order_group" id="cancel-order-group" value="' + ognum + '">\ 13434 <input type="hidden" name="order_number" id="cancel-order-number" value="' + onum + '">\ 13435 <input type="hidden" name="m_status" value="M">\ 13436 <div class="cl-s-btn-group-toggle btn-group btn-group-toggle" data-toggle="buttons">\ 13437 '; 13438 13439 if(status == 'Y' && data.r.exchange_check == true) { 13440 modal_str += '\ 13441 <label class="btn btn-secondary disable">\ 13442 <input type="radio" name="status" id="order-radio-return" value="R"> ë°í ìì²\ 13443 </label>\ 13444 <label class="btn btn-secondary active">\ 13445 <input type="radio" name="status" id="order-radio-exchange" value="E" checked>
13445 êµí ìì²\ 13446 </label>\ 13447 '; 13448 } else { 13449 modal_str += '\ 13450 <label class="btn btn-secondary active">\ 13451 <input type="radio" name="status" id="order-radio-return" value="R" checked> ë°í ìì²\ 13452 </label>\ 13453 <label class="btn btn-secondary">\ 13454 <input type="radio" name="status" id="order-radio-exchange" value="E"> êµí ìì²\ 13455 </label>\ 13456 '; 13457 } 13458 13459 modal_str += '\ 13460 </div>\ 13461 '+checkEscrow+'\ 13462 <div class="cancel-product-title">\ 13463 <div class="newcheckbox hand">\ 13464 <label>\ 13465 <input type="checkbox" class="'+noneAll+'" id="product-check" '+checkboxNone+'>\ 13466 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\ 13467 <path d="M13 0H3C1.3 0 0 1.3 0 3v10c0 1.7 1.3 3 3 3h10c1.7 0 3-1.3 3-3V3C16 1.3 14.7 0 13 0zM15 13c0 1.1-0.9 2-2 2H3c-1.1 0-2-0.9-2-2V3c0-1.1 0.9-2 2-2h10c1.1 0 2 0.9 2 2V13z"/>\ 13468 </svg>\ 13469 <svg class="active" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\ 13470 <path d="M13 0H3C1.34 0 0 1.34 0 3v10c0 1.66 1.34 3 3 3h10c1.66 0 3-1.34 3-3V3C16 1.34 14.66 0 13 0zM13.03 6.03l-5.5 5.5C7.38 11.68 7.19 11.75 7 11.75s-0.38-0.07-0.53-0.22l-3.5-3.5c-0.29-0.29-0.29-0.77 0-1.06s0.77-0.29 1.06 0L7 9.94l4.97-4.97c0.29-0.29 0.77-0.29 1.06 0S13.32 5.74 13.03 6.03z"/>\ 13471 </svg>\ 13472 </label>\ 13473 </div>\ 13474 ë°í/êµíìì² ìí\ 13475 </div>'; 13476 var my_point = Number(data.r.my_point); 13477 var weight_template_product = {}; 13478 13479 for (var i=0;i<data.r.odata.length;i++) { 13480 if(c_data.odata[i].state != 'normal') return; 13481 if (c_data.odata[i].exchange_check == 'Y') exchangeCheck = 'Y'; 13482 var dts = c_data.odata[i].state == 'normal' ? c_data.odata[i].delivery_template_seq : ''; 13483 if(c_data.odata[i].state == 'normal' && c_data.odata[i].mix_yn != 'Y') dts += '-' + c_data.odata[i].product_number; 13484 var dt = c_data.odata[i].state == 'normal' ? c_data.odata[i].delivery_type : ''; 13485 13486 if(!weight_template_product.hasOwnProperty(dts)) weight_template_product[dts] = {}; 13487 if(!weight_template_product[dts].hasOwnProperty(dt)) weight_template_product[dts][dt] = {}; 13488 if(!weight_template_product[dts][dt].hasOwnProperty(c_data.odata[i].product_number)) weight_template_product[dts][dt][c_data.odata[i].product_number] = data.r.odata[i]; 13489 13490 var tooltip = ''; 13491 if(dtl[dts]['price_type'] == 'WEIGHT' || dtl[dts]['price_type'] == 'QUANTITY') { 13492 if(dtl[dts]['price_type_detail']['method'] == 'DIFFERENTIAL') { 13493 if(dtl[dts]['price_type'] == 'QUANTITY') { 13494 tooltip += '<li class=\'title\'>ìëë³ ë°°ì¡ë¹</li>'; 13495 $(dtl[dts]['price_type_detail']['detail']).each(function(k, detail) { 13496 var d_v = Object.keys(detail)[0]; 13497 var d_p = detail[d_v]; 13498 tooltip += '<li class=\'item\'>' + d_v + 'ê° ì´ì ' + number_format(d_p) + 'ì</li>'; 13499 }); 13500 } else if(dtl[dts]['price_type'] == 'WEIGHT') { 13501 tooltip += '<li class=\'title\'>무ê²ë³ ë°°ì¡ë¹</li>'; 13502 $(dtl[dts]['price_type_detail']['detail']).each(function(k, detail) { 13503 var d_v = Object.keys(detail)[0]; 13504 var d_p = detail[d_v]; 13505 tooltip += '<li class=\'item\'>' + d_v + 'Kg ì´ì ' + number_format(d_p) + 'ì</li>'; 13506 }); 13507 } 13508 } else if(dtl[dts]['price_type_detail']['method'] == 'REPEAT') { 13509 if(dtl[dts]['price_type'] == 'QUANTITY') { 13510 tooltip += '<li class=\'title\'>ìëë³ ë°°ì¡ë¹</li>'; 13511 tooltip += '<li class=\'item\'>' + number_format(dtl[dts]['repeat_value']) + 'ê° êµ¬ë§¤ìë§ë¤ ' + number_format(dtl[dts]['repeat_price']) + 'ì ë°ë³µ ë¶ê³¼</li>'; 13512 } else if(dtl[dts]['price_type'] == 'WEIGHT') { 13513 tooltip += '<li class=\'title\'>무ê²ë³ ë°°ì¡ë¹</li>'; 13514 tooltip += '<li class=\'item\'>' + number_format(dtl[dts]['repeat_value']) + 'Kgë§ë¤ ' + number_format(dtl[dts]['repeat_price']) + 'ì ë°ë³µ ë¶ê³¼</li>'; 13515 } 13516 } 13517 if(tooltip && (dt == 'DELIVERY' || dt == 'DIRECT')) { 13518 if(!LUX) tooltip += '<li class=\'desc\'>ì¶ê° ìíì ë°°ì¡ë¹ ì¡°ê±´ì ë°ìëì§ ììµëë¤.</li>'; 13519 13520 if(dtl[dts]['price_type'] == 'WEIGHT' && weight_template_product[dts][dt]) { 13521 tooltip += '<li class=\'title product-weight\'>ìíë³ ë¬´ê²</li>'; 13522 $.each(weight_template_product[dts][dt], function(k, v) { 13523 tooltip += '<li class=\'item\'>' + v.product_name + ' : ' + number_format(v.product_weight) + 'kg</li>'; 13524 }); 13525 } 13526 13527 tooltip = '<ul class=\'delivery-tooltip\'>' + tooltip + '</ul>'; 13528 dtl[dts]['tooltip'] = tooltip; 13529 } 13530 } 13531 } 13532 13533 modal_str += '<table class="table product-table">'; 13534 for (var i=0;i<data.r.odata.length;i++) { 13535 if (c_data.odata[i].d_status == '' || c_data.odata[i].d_status == 'CN') { 13536 noneChecked = ''; 13537 if (!checkNoneAll) noneAll = ''; 13538 } else { 13539 if (!checkNoneAll) noneAll = 'noneAll'; 13540 noneChecked = 'noneChecked'; 13541 } 13542 13543 var curr_point = 0; 13544 var usable_point = 0; 13545 var refund_point = 0; 13546 var expired_point = 0; 13547 13548 if(c_data.odata[i].used_point) { 13549 curr_point = Math.abs(c_data.odata[i].used_point.point); 13550 usable_point = Math.abs(c_data.odata[i].used_point.usable_point); 13551 } 13552 13553 // if(c_data.odata[i].refund_point) { 13554 // refund_point = c_data.odata 13555 // } 13556 13557 if(c_data.odata[i].expired_point) { 13558 expired_point = Math.abs(c_data.odata[i].expired_point.point); 13559 } 13560 13561 var dts = c_data.odata[i].state == 'normal' ? c_data.odata[i].delivery_template_seq : ''; 13562 if(c_data.odata[i].state == 'normal' && c_data.odata[i].mix_yn != 'Y') dts += '-' + c_data.odata[i].product_number; 13563 var dt = c_data.odata[i].state == 'normal' ? c_data.odata[i].delivery_type : ''; 13564 13565 modal_str += '\ 13566 <tr class="cl-s-product-jumbotron clearfix">\ 13567 <td>\ 13568 <div class="newcheckbox hand">\ 13569 <label>\ 13570 <input type="checkbox" class="status-checkbox cancel-info-data '+noneAll+' '+noneChecked+'" data-curr_point="' + curr_point + '" data-usable_point="' + usable_point + '" data-expired_point="' + expired_point + '" data-type="'+c_data.pdata[i].state
13570+'" name="order_number_ary[]" value="'+c_data.odata[i].order_number+'" '+checkboxNone+' data-option_type="' + c_data.pdata[i].option_type + '" data-product_number="' + c_data.odata[i].product_number + '" data-product_weight="' + (c_data.odata[i].state == 'normal' ? c_data.odata[i].product_weight : 0) + '" data-mix_yn="' + (c_data.odata[i].state == 'normal' ? c_data.odata[i].mix_yn : '') + '" data-delivery_template_seq="' + (c_data.odata[i].state == 'normal' ? dts : '') + '" data-delivery_type="' + (c_data.odata[i].state == 'normal' ? c_data.odata[i].delivery_type : '') + '" data-quantity="' + c_data.odata[i].quantity + '" data-delivery_price="'+ (c_data.odata[i].state == 'normal' && dtl[dts]['pay_type'] == 'PREPAY' ? c_data.odata[i].delivery_price : 0) +'">\ 13571 <svg viewBox="0 0 16 16" width="16" height="16">\ 13572 <path d="M13 0H3C1.3 0 0 1.3 0 3v10c0 1.7 1.3 3 3 3h10c1.7 0 3-1.3 3-3V3C16 1.3 14.7 0 13 0zM15 13c0 1.1-0.9 2-2 2H3c-1.1 0-2-0.9-2-2V3c0-1.1 0.9-2 2-2h10c1.1 0 2 0.9 2 2V13z"/>\ 13573 </svg>\ 13574 <svg class="active" viewBox="0 0 16 16" width="16" height="16">\ 13575 <path d="M13 0H3C1.34 0 0 1.34 0 3v10c0 1.66 1.34 3 3 3h10c1.66 0 3-1.34 3-3V3C16 1.34 14.66 0 13 0zM13.03 6.03l-5.5 5.5C7.38 11.68 7.19 11.75 7 11.75s-0.38-0.07-0.53-0.22l-3.5-3.5c-0.29-0.29-0.29-0.77 0-1.06s0.77-0.29 1.06 0L7 9.94l4.97-4.97c0.29-0.29 0.77-0.29 1.06 0S13.32 5.74 13.03 6.03z"/>\ 13576 </svg>\ 13577 </label>\ 13578 </div>\ 13579 <div class="cl-s-product-thumb">\ 13580 <img src="' + c_data.pdata[i].img + '" alt="' + c_data.pdata[i].name + '" class="' + c_data.pdata[i].img_align + '" />\ 13581 </div>\ 13582 <div class="cl-s-product-info">\ 13583 <h5 class="cl-s-product-title">' + c_data.pdata[i].name + '</h5>\ 13584 '; 13585 13586 var price = c_data.odata[i].price, 13587 quantity = Number(c_data.odata[i].quantity), 13588 sum_price = quantity * price; 13589 option_name = (typeof c_data.pdata[i].option != "undefined" && c_data.pdata[i].option) ? c_data.pdata[i].option : '', 13590 option_str = '', 13591 etc_str = (typeof c_data.pdata[i].etc_date != "undefined" && c_data.pdata[i].etc_date) ? '<span>ì íì¼ì: '+c_data.pdata[i].etc_date+'</span>' : '', 13592 option_title = (c_data.pdata[i].option_type == 'A') ? 'ì¶ê°ìµì : ' + (c_data.pdata[i].option_group ? c_data.pdata[i].option_group + ' : ' : '') : 'ìµì '; 13593 if(option_name) { 13594 option_str = (c_data.pdata[i].option_text_str) ? '<span>' + option_title + ': '+option_name+' / '+c_data.pdata[i].option_text_str+'</span>' : '<span>' + option_title + ': '+option_name+'</span>'; 13595 } else { 13596 option_str = (c_data.pdata[i].option_text_str) ? '<span>' + option_title + ': '+c_data.pdata[i].option_text_str+'</span>' : ''; 13597 } 13598 13599 modal_str += '\ 13600 <div class="option-str option-check" data-optionState="" data-optionPrice="'+sum_price+'" data-deliveryPrice="'+(dtl[dts]['sel_pay_type'] == 'DELIVERED' ? 0 : c_data.odata[i].delivery_price)+'"><span>' + number_format(sum_price) + 'ì</span>' + option_str + etc_str + '<span>' + quantity + 'ê°</span></div>\ 13601 </div>\ 13602 </td>'; 13603 13604 if(c_data.odata[i].state == 'normal') { 13605 var delivery_cnt = dtl[dts]['dtype'][dt].delivery_cnt; 13606 if(!dtl[dts]['dtype'][dt].hasOwnProperty('counter')) { 13607 dtl[dts]['dtype'][dt]['counter'] = 0; 13608 } 13609 13610 dtl[dts]['dtype'][dt]['counter']++; 13611 13612 if(dtl[dts]['dtype'][dt]['counter'] == 1) { 13613 modal_str +='\ 13614 <td rowspan="' + delivery_cnt + '" class="delivery-price"><div>ë°°ì¡ë¹</div><div class="price"><span>'; 13615 if(dt == 'DELIVERY' || dt == 'DIRECT') { 13616 if(dtl[dts]['price_type'] == 'ETC') { 13617 modal_str += 'ë³ëìë´</span>'; 13618 } else { 13619 modal_str += number_format(dtl[dts]['dtype'][dt]['price']) + '</span> ì'; 13620 } 13621 if(dtl[dts]['pay_type'] == 'DELIVERED') modal_str += '(ì°©ë¶)'; 13622 13623 if(dtl[dts]['price_type'] == 'FREE_CONDITION') { 13624 modal_str += '<div class="price-desc">' + number_format(dtl[dts]['free_condition']) + 'ì ì´ì<br>ë°°ì¡ë¹ 무ë£</div>'; 13625 } 13626 } else { 13627 modal_str += $.lang[LANG]['shopping.delivery.template.delivery_type.' + dt.toLowerCase()] + '</span>'; 13628 if(dt == 'QUICK') modal_str += '(ì°©ë¶)'; 13629 } 13630 if(dtl[dts]['tooltip'] && (dt == 'DELIVERY' || dt == 'DIRECT')) { 13631 modal_str += '<svg class="cm-popover-info" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 13" width="13" height="13" tabindex="0" data-trigger="hover" data-toggle="popover" fill="#4789e7" data-html="true" data-placement="top" data-content="' + dtl[dts]['tooltip'] + '" data-original-title="" title=""><path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"></path><path d="M6.66 3.01C5.61 3.01 4.58 3.5 4.5 4.8c0 0.06-0.01 0.12 0 0.2h1.02c0-0.07 0.01-0.15 0.02-0.23 0.08-0.62 0.52-0.76 1.08-0.76 0.63 0 1.02 0.37 1.02 0.95 -0.01 0.48-0.3 0.87-0.76 1.34C6.21 6.97 6.02 7.37 6 8h0.99C7 7.
1363166 7.04 7.37 7.67 6.75 8.17 6.27 8.7 5.68 8.7 4.87 8.7 3.85 7.89 3.01 6.66 3.01z"></path><rect x="6" y="9" width="1" height="1"></rect></svg>'; 13632 } 13633 modal_str +='</div></td>\ 13634 '; 13635 } 13636 13637 modal_str += '\ 13638 </tr>'; 13639 13640 if(dtl[dts]['dtype'][dt]['counter'] == dtl[dts]['dtype'][dt]['delivery_cnt']) { 13641 modal_str += '\ 13642 <tr class="cl-s-product-jumbotron clearfix delivery-price delivery-price-mobile">\ 13643 <td><div class="delivery-title">묶ì ë°°ì¡ë¹</div><div class="delivey-price"><span>'; 13644 13645 if(dtl[dts]['tooltip'] && (dt == 'DELIVERY' || dt == 'DIRECT')) { 13646 modal_str += '<svg class="cm-popover-info" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 13" width="13" height="13" tabindex="0" data-trigger="hover" data-toggle="popover" fill="#4789e7" data-html="true" data-placement="top" data-content="' + dtl[dts]['tooltip'] + '" data-original-title="" title=""><path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"></path><path d="M6.66 3.01C5.61 3.01 4.58 3.5 4.5 4.8c0 0.06-0.01 0.12 0 0.2h1.02c0-0.07 0.01-0.15 0.02-0.23 0.08-0.62 0.52-0.76 1.08-0.76 0.63 0 1.02 0.37 1.02 0.95 -0.01 0.48-0.3 0.87-0.76 1.34C6.21 6.97 6.02 7.37 6 8h0.99C7 7.66 7.04 7.37 7.67 6.75 8.17 6.27 8.7 5.68 8.7 4.87 8.7 3.85 7.89 3.01 6.66 3.01z"></path><rect x="6" y="9" width="1" height="1"></rect></svg>'; 13647 } 13648 13649 if(dt == 'DELIVERY' || dt == 'DIRECT') { 13650 modal_str += number_format(dtl[dts]['dtype'][dt]['price']) + '</span> ì'; 13651 if(dtl[dts]['pay_type'] == 'DELIVERED') modal_str += '(ì°©ë¶)'; 13652 if(dtl[dts]['price_type'] == 'FREE_CONDITION') { 13653 modal_str += '<div class="price-desc">' + number_format(dtl[dts]['free_condition']) + 'ì ì´ì ë°°ì¡ë¹ 무ë£</div>'; 13654 } 13655 } else { 13656 modal_str += $.lang[LANG]['shopping.delivery.template.delivery_type.' + dt.toLowerCase()] + '</span>'; 13657 if(dt == 'QUICK') modal_str += '(ì°©ë¶)'; 13658 } 13659 13660 modal_str += '</div></td>\ 13661 </tr>\ 13662 '; 13663 } 13664 } 13665 } 13666 13667 modal_str += '</table>'; 13668 13669 modal_str += '<div class="order-re-content">\ 13670 <div class="cl-s-form-selector">\ 13671 <select class="selectpicker dropdown" id="re-reason" name="reason">\ 13672 <option value="구매ìì¬ ì·¨ì">구매ìì¬ ì·¨ì</option>\ 13673 <option value="ë¤ë¥¸ ìí ì못 주문">ë¤ë¥¸ ìí ì못 주문</option>\ 13674 <option value="ìííì">ìííì</option>\ 13675 <option value="ë°°ì¡ì§ì°">ë°°ì¡ì§ì°</option>\ 13676 <option value="ìíì ë³´ ìì´">ìíì ë³´ ìì´</option>\ 13677 <option value="ì¤ë°°ì¡">ì¤ë°°ì¡</option>\ 13678 <option value="기í">기í</option>\ 13679 </select>\ 13680 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 8 4" width="8" height="4"><polygon points="0 0 4 4 8 0 "></polygon></svg>\ 13681 </div>\ 13682 <div class="cl-s-form-wrap">\ 13683 <div class="cl-s-form-group input-label-hide">\ 13684 <textarea class="cl-s-form-control cl-s-form-textarea" id="re-requests" name="requests" maxlength="500" required="required"></textarea>\ 13685 <label for="input" class="cl-s-control-label">ìì¸í ë´ì©ì ì ì´ì£¼ì¸ì. (500ì ì´ë´)</label>\ 13686 </div>\ 13687 </div>\ 13688 </div>'; 13689 /* ë°í/êµí ì¬ì§ ì ê±° 13690 <div class="cl-s-files re-files">\ 13691 <input id="re-file" type="file" name="files[]" multiple data-sid="' + sid + '" data-uid=\"' + c_data.writer.id + '\">\ 13692 <label class="cl-s-file-update re-file-update clearfix"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" width="20" height="20"><path d="M0 0v20h20V0H0zM19 1v11.3l-3-3 -4 4 -6-6 -5 5V1H19zM1 19v-5.3l5-5 6 6 4-4 3 3V19H1z"/><circle cx="14.5" cy="5.5" r="1.5"/></svg> <span>ì¬ì§</span></label>\ 13693 <ul class="cl-s-files-list re-files-list clearfix">\ 13694 </ul>\ 13695 </div>\ 13696 */ 13697 13698 modal_str += checkEscrowExchangeFooter; 13699 13700 modal_str += '<div class="order-cancel-content">\ 13701 <div class="cancel-info-box">\ 13702 <div class="cancel-info"><span class="cancel-info-title">ë°íìí í©ê³</span><span class="cancel-info-price" id="cancel-price">0ì</span></div>\ 13703 <div class="cancel-info"><span class="cancel-info-title">ë°í ë°°ì¡ë¹ í©ê³</span><span class="cancel-info-price" id="cancel-delivery-price">0ì</span></div>\ 13704 <div class="cancel-info"><span class="cancel-info-title">ì 립ê¸</span><span class="cancel-info-price" id="cancel-point-price">0ì</span></div>\ 13705 <div class="cancel-info"><span class="cancel-info-title">ì¿ í°</span><span class="cancel-info-price" id="cancel-coupon-price">0ì</span></div>\ 13706 <div class="cancel-info"><span class="cancel-info-title cancel-coupon-title"></span><span class="cancel-info-price" id="cancel-coupon-detail"></span></div>\ 13707 <div class="cancel-info-line"></div>\ 13708 <div class="return-total-info"><span class="cancel-info-title">íë¶ ìì ê¸ì¡</span><span class="cancel-info-price"><span id="return-total-price">0</span>ì</span></div>\ 13709 </div>'+checkEscrowFooter+'\ 13710 </div>'; 13711 modal_str += checkDepositCancel; 13712 13713 if (pclass == '무íµì¥ ì ê¸' || pclass == 'ê°ìê³ì¢') { 13714 var returnClass = ''; 13715 if (c_data.return_bank.length > 1 && c_data.return_bank.indexOf('')===-1) returnClass = 'returnDisabled'; 13716 13717 modal_str += '\ 13718 <div id="return-modal">\ 13719 <div class="modal-sub-title">íë¶ ê³ì¢</div>\ 13720 <ul class="qna-writer clearfix">\ 13721 <li class="">\ 13722 <div class="cl-s-form-wrap '+returnClass+'">\ 13723 <div class="cl-s-form-group">'; 13724 if (c_data.return_bank.length > 1 && c_data.return_bank.indexOf('')===-1) modal_str += '<input type="text" class="cl-s-form-control has-value" id="no-bank" name="no_bank" readonly required="required" value="'+c_data.return_bank[1]+'">'; 13725 else modal_str += '<input type="text" class="cl-s-form-control" id="no-bank" name="no_bank" required="required" value="">'; 13726 modal_str += '<label for="input" class="cl-s-control-label">ìíëª </label>\ 13727 </div>\ 13728 </div>\ 13729 </li>\ 13730 <li>\ 13731 <div class="cl-s-form-wrap '+returnClass+'">\ 13732 <div class="cl-s-form-group">'; 13733 if (c_data.return_bank.length > 1 && c_data.return_bank.indexOf('')===-1) modal_str += '<input type="text" class="cl-s-form-control has-value" id="no-bank-name" readonly name="no_bank_name" required="required" value="'+c_data.return_bank[2]+'">'; 13734 else modal_str += '<input type="text" class="cl-s-form-control" id="no-bank-name" name="no_bank_name" required="required">'; 13735 modal_str += '<label for="input" class="cl-s-control-label">ìê¸ì£¼</label>\ 13736 </div>\ 13737 </div>\ 13738 </li>\ 13739 <li>\ 13740 <div class="cl-s-form-wrap '+returnClass+'">\ 13741 <div class="cl-s-form-group">'; 13742 if (c_data.return_bank.length > 1 && c_data.return_bank.indexOf('')===-1) modal_str += '<input type="text" class="cl-s-form-control has-value" id="no-bank-number" name="no_bank_number" readonly data-type="email" required="required" value="'+c_data.return_bank[3]+'">'; 13743 else modal_str += '<input type="text" class="cl-s-form-control" id="no-bank-number" name="no_bank_number" data-type="email" required="required" value="">'; 13744 modal_str += '<label for="input" class="cl-s-control-label">ê³ì¢ë²í¸</label>\ 13745 </div>\ 13746 </div>\ 13747 </li>\ 13748 </ul>\ 13749 <div class="modal-comment">ëì¼ ì£¼ë¬¸ ë´ ì¬ë¬ ìíì íë¶ ìì²íìë ê²½ì°, ì
13749µì´ ì ë ¥í íë¶ê³ì¢ë¡ ì¼ê´ íë¶ì²ë¦¬ë©ëë¤.</div>\ 13750 <div class="modal-comment point-used-desc hide">\ 13751 <div class="desc-box">\ 13752 <div class="desc-title">ì ë¦½ê¸ íë¶ ìë´</div>\ 13753 <div class="section">ìí(ë¤)ì 구매íì¬ ì 립ë ì ë¦½ê¸ <span id="disp_used_point_total" class="point-color"></span>ìì´ ì´ë¯¸ ì¬ì©ëê±°ë ì í¨ê¸°ê°ì´ ë§ë£ëììµëë¤.</div>\ 13754 <div class="section">íì¬ ë³´ì ì 립ê¸ì´ <span class="point-color">' + addCommas(my_point) + '</span>ì ì¼ë¡ 구매 ì 립ë ì ë¦½ê¸ <span id="disp_cancel_after_point" class="point-color"></span>ìì ì·¨ì ì²ë¦¬í ì ììµëë¤.</div>\ 13755 <div class="section">미 ì·¨ìë ì 립ê¸ì ëí ì²ë¦¬ë í매ìì íìí´ì£¼ì¸ì.</div>\ 13756 </div>\ 13757 <div class="newcheckbox hand">\ 13758 <label style="margin-left: 25px;">\ 13759 <input type="checkbox" class="cancel-agree" />\ 13760 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\ 13761 <path d="M13 0H3C1.3 0 0 1.3 0 3v10c0 1.7 1.3 3 3 3h10c1.7 0 3-1.3 3-3V3C16 1.3 14.7 0 13 0zM15 13c0 1.1-0.9 2-2 2H3c-1.1 0-2-0.9-2-2V3c0-1.1 0.9-2 2-2h10c1.1 0 2 0.9 2 2V13z"></path>\ 13762 </svg>\ 13763 <svg class="active" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\ 13764 <path d="M13 0H3C1.34 0 0 1.34 0 3v10c0 1.66 1.34 3 3 3h10c1.66 0 3-1.34 3-3V3C16 1.34 14.66 0 13 0zM13.03 6.03l-5.5 5.5C7.38 11.68 7.19 11.75 7 11.75s-0.38-0.07-0.53-0.22l-3.5-3.5c-0.29-0.29-0.29-0.77 0-1.06s0.77-0.29 1.06 0L7 9.94l4.97-4.97c0.29-0.29 0.77-0.29 1.06 0S13.32 5.74 13.03 6.03z"></path>\ 13765 </svg>\ 13766 ì ë´ì©ì íì¸íììµëë¤.</label>\ 13767 </div>\ 13768 <div class="point-used-cancel-agree-desc">\ 13769 <svg viewBox="0 0 13 13" width="13" height="13"><path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"/><rect x="6" y="3" width="1" height="5"/><rect x="6" y="9" width="1" height="1"/></svg>\ 13770 ì ë¦½ê¸ íë¶ ìë´ì ëìí´ì£¼ì¸ì.\ 13771 </div>\ 13772 </div>\ 13773 </div>\ 13774 '; 13775 } 13776 modal_str += '</form>\ 13777 '; 13778 13779 var oreModal = $(this).showModalFlat('ë°í/êµí ìì²', modal_str,true,true,function () { 13780 13781 var f = document.re_form; 13782 13783 if(oreModal.find('#re-reason').prop('value') == '') { 13784 // $('#re-reason').selectpicker('toggle'); 13785 // return false; 13786 $('#re-reason').closest('.cl-s-form-selector').addClass('empty'); 13787 } 13788 13789 oreModal.find('.cl-s-form-wrap').each(function() { 13790 var check_input = $(this).find('.cl-s-form-control'), 13791 val = check_input.val().trim(); 13792 13793 if(val.length == 0) { 13794 $(this).removeClass('error').addClass('empty'); 13795 $(this).find('.cl-s-control-label.error').remove(); 13796 } else { 13797 if($(this).hasClass('error')) { 13798 check_input.focus(); 13799 } 13800 } 13801 }); 13802 var checkCnt = 0; 13803 13804 $(".status-checkbox").each(function (i, index) { 13805 if ($(this).is(":checked") === true) { 13806 checkCnt++; 13807 } 13808 }); 13809 13810 if (checkCnt < 1) { 13811 alert('ìíì 1ê° ì´ì ì íí´ ì£¼ì¸ì'); 13812 return false;
13813 } 13814 13815 if(oreModal.find('.cl-s-form-wrap.empty, .cl-s-form-wrap.error').length > 0) { 13816 // oreModal.find('.cl-s-form-wrap.empty, .cl-s-form-wrap.error').eq(0).find('.cl-s-form-control').focus(); 13817 return false; 13818 } 13819 13820 13821 if(oreModal.find("input[type='checkbox'].cancel-agree:visible").length && oreModal.find("input[type='checkbox'].cancel-agree:visible").length != oreModal.find("input[type='checkbox'].cancel-agree:visible:checked").length) { 13822 $(".point-used-cancel-agree-desc").show(); 13823 return false; 13824 } else { 13825 $(".point-used-cancel-agree-desc").hide(); 13826 } 13827 13828 $.processON(); 13829 13830 f.submit(); 13831 13832 },'close','ë±ë¡í기','cl-s-order-returnexchange cl-s-order-cancel cl-modal cl-s-btn cover ' + checkEscrowClass, false, '', function() { 13833 var totalCnt = 0, totalNomalCheck = 0, nomalCheck = 0; 13834 var price = 0; 13835 var deliveryPrice = 0; 13836 13837 var mix_yn = $(this).data('mix_yn'); 13838 var delivery_price = 0; 13839 var $form = $('form[name="re_form"]'); 13840 13841 $('.status-checkbox').each(function(i, index) { 13842 if ($(this).is(":checked") === true) { 13843 price += ($(this).closest('.cl-s-product-jumbotron').find('.option-check').attr('data-optionPrice') * 1); 13844 totalCnt++; 13845 if ($(this).attr('data-type') == 'normal') { 13846 nomalCheck++; 13847 var mix_yn = $(this).data('mix_yn'); 13848 var delivery_price = 0; 13849 var delivery_template_seq = $(this).data('delivery_template_seq'); 13850 var delivery_type = $(this).data('delivery_type'); 13851 if(oreModal.find('input[name="order_number_ary[]"][data-delivery_type="' + delivery_type + '"][data-delivery_template_seq="' + delivery_template_seq + '"]').length == oreModal.find('input[name="order_number_ary[]"][data-delivery_type="' + delivery_type + '"][data-delivery_template_seq="' + delivery_template_seq + '"]:checked').length) { 13852 delivery_price = Number($(this).data('delivery_price')); 13853 } 13854 deliveryPrice += delivery_price; 13855 } 13856 } 13857 13858 if ($(this).attr('data-type') == 'normal') { 13859 totalNomalCheck++; 13860 } 13861 }); 13862 13863 var product_price = price + deliveryPrice, 13864 rePayment = parseInt(c_data.pay_info.request.payment.total) - parseInt(c_data.pay_info.request.payment.coupon) - parseInt(c_data.pay_info.request.cancel.total) - parseInt(c_data.pay_info.request.return.total); 13865 13866 rePayment = (rePayment > 0) ? rePayment : 0; 13867 13868 // coupon ì²ë¦¬ 13869 var coupon = c_data.pay_info.coupon_list, 13870 cancel_coupon_price = 0; 13871 if(coupon.length) { 13872 var checked_order_number = $('.cancel-info-data:checked').map(function(){ return this.value; }).toArray(); 13873 $.each(coupon, function(i,v) { 13874 if(checked_order_number.indexOf(v.order_number) > -1 || v.kind == 'C') { 13875 cancel_coupon_price += parseInt(v.discount_price); 13876 13877 // íë¶ê¸ìì ì¿ í°ì²ë¦¬ 13878 if($('.coupon-detail-info[data-seq="' + v.seq + '"]').length == 0) { 13879 $('.cancel-coupon-title').append('<div class="coupon-name coupon-detail-info" data-seq="' + v.seq + '">' + v.coupon_name + '</div>'); 13880 $('#cancel-coupon-detail').append('<div class="coupon-price coupon-detail-info" data-seq="' + v.seq + '">-' + number_format(parseInt(v.discount_price)) + 'ì</div>'); 13881 } 13882 } else { 13883 $('.coupon-detail-info[data-seq="' + v.seq + '"]').remove(); 13884 } 13885 }); 13886 // ì·¨ìë ì¿ í° ì ì¥ 13887 13888 } 13889 product_price = product_price - parseInt(cancel_coupon_price); 13890 13891 var use_point = (rePayment - product_price > 0) ? 0 : rePayment - product_price; 13892 product_price = product_price + use_point; 13893 13894 $('#cancel-price').html(number_format(price)+'ì'); 13895 $('#cancel-delivery-price').html(number_format(deliveryPrice)+'ì'); 13896 $('#cancel-point-price').html(number_format(use_point)+'ì'); 13897 $('#cancel-coupon-price').html(((cancel_coupon_price > 0) ? '-' + number_format(cancel_coupon_price) : '0')+'ì'); 13898 $('#return-total-price').html(number_format(product_price)); 13899 13900 $('.cancel-info-data').on('change', function () { 13901 if($(this).hasClass('noneAll')) return; 13902 var cancel_after_point = my_point; 13903 var disp_used_point_total = 0; 13904 var deliveryPrice = 0; 13905 13906 var product_number = $(this).attr('data-product_number'); 13907 // console.log(product_number); 13908 if($('input[name="status"]:checked').val() == 'R') { // ë°íì¼ëë§ 13909 if($(this).attr('data-option_type') != 'A' && !$('input[name="order_number_ary[]"][data-product_number="' + product_number + '"][data-option_type!="A"]:not(:checked)').length) { 13910 $('input[name="order_number_ary[]"][data-product_number="' + product_number + '"][data-option_type="A"]').prop('checked',true); 13911 } else if($(this).attr('data-option_type') == 'A' && !$('input[name="order_number_ary[]"][data-product_number="' + product_number + '"][data-option_type!="A"]:not(:checked)').length && !$(this).prop('checked')) { 13912 $('input[name="order_number_ary[]"][data-product_number="' + product_number + '"][data-option_type!="A"]:last').prop('checked',fal
13912se); 13913 } 13914 } 13915 13916 if($("input[name='order_number_ary[]']:checked").length) { 13917 coupon.map(function(v,k) { coupon[k]['apply'] = ''; }); 13918 $("input[name='order_number_ary[]']:checked").each(function() { 13919 cancel_after_point = Number(cancel_after_point) + ((Number($(this).data("expired_point"))) - Number($(this).data("curr_point"))); 13920 disp_used_point_total += ((Number($(this).data("expired_point"))) - Number($(this).data("curr_point"))); 13921 c_ord_num = $(this).val(); 13922 13923 if($(this).data('type') != 'normal' || $(this).data('option_type') == 'A') return; 13924 var mix_yn = $(this).data('mix_yn'); 13925 var delivery_price = 0; 13926 var delivery_template_seq = $(this).data('delivery_template_seq'); 13927 var delivery_type = $(this).data('delivery_type'); 13928 var product_weight = $(this).data('product_weight'); 13929 13930 13931 13932 if(delivery_type != 'DELIVERY' && delivery_type != 'DIRECT') return; 13933 // if(dtl[delivery_template_seq]['price_type'] != 'WEIGHT' && dtl[delivery_template_seq]['price_type'] != 'QUANTITY') { 13934 if(oreModal.find('input[name="order_number_ary[]"][data-delivery_type="' + delivery_type + '"][data-delivery_template_seq="' + delivery_template_seq + '"]').length == oreModal.find('input[name="order_number_ary[]"][data-delivery_type="' + delivery_type + '"][data-delivery_template_seq="' + delivery_template_seq + '"]:checked').length) { 13935 delivery_price = Number($(this).data('delivery_price')); 13936 13937 coupon.map(function(v,k) { if(v.order_number == c_ord_num && delivery_price > 0 && v.benefit == 'DELIVERY') coupon[k]['apply'] = '1'; }); 13938 } 13939 deliveryPrice += delivery_price; 13940 }); 13941 } 13942 13943 if(cancel_after_point < 0) { 13944 $(".point-used-desc #disp_cancel_after_point").html(addCommas(Math.abs(cancel_after_point))); 13945 $(".point-used-desc #disp_used_point_total").html(addCommas(Math.abs(disp_used_point_total))); 13946 $(".point-used-desc").removeClass("hide"); 13947 } else { 13948 $(".point-used-desc").addClass("hide"); 13949 $(".point-used-desc #disp_cancel_after_point").html(""); 13950 $(".point-used-desc #disp_used_point_total").html(""); 13951 } 13952 13953 var price = 0; 13954 var oLength = $('.option-check').length; 13955 var totalCnt = 0, totalNomalCheck = 0, nomalCheck = 0; 13956 var isReturn = $('input[name="status"]:checked').val(); 13957 13958 13959 $form.find('.order-cancel-content.extra-info').remove(); 13960 13961 if ($(this).hasClass('noneAll') === true) { 13962 if ($(this).hasClass('noneChecked') === true) { 13963 $(this).prop('checked', false); 13964 } else { 13965 $(this).prop('checked', true); 13966 $('.status-checkbox').each(function () { 13967 if ($(this).prop('disabled') !== true) $(this).prop('checked', true); 13968 }); 13969 } 13970 } 13971 13972 $('.status-checkbox').each(function (i, index) { 13973 if ($(this).is(':checked') === true) { 13974 price += ($(this).closest('.cl-s-product-jumbotron').find('.option-check').attr('data-optionPrice') * 1); 13975 totalCnt++; 13976 if ($(this).attr('data-type') == 'normal') { 13977 nomalCheck++; 13978 } 13979 } 13980 13981 if ($(this).attr('data-type') == 'normal') { 13982 totalNomalCheck++; 13983 } 13984 }); 13985 13986 var product_price = price + deliveryPrice, 13987 rePayment = parseInt(c_data.pay_info.request.payment.total) - parseInt(c_data.pay_info.request.payment.coupon) - parseInt(c_data.pay_info.request.cancel.total) - parseInt(c_data.pay_info.request.return.total); 13988 13989 rePayment = (rePayment > 0) ? rePayment : 0; 13990 13991 13992 // coupon ì²ë¦¬ 13993 var cancel_coupon_price = 0; 13994 if(coupon.length) { 13995 var checked_order_number = $('.cancel-info-data:checked').map(function(){ return this.value; }).toArray(); 13996 $.each(coupon, function(i,v) { 13997 v.apply = (v.apply || v.benefit != 'DELIVERY') ? '1' : ''; 13998 if((checked_order_number.indexOf(v.order_number) > -1 && v.apply) || v.kind == 'C') { 13999 cancel_coupon_price += parseInt(v.discount_price); 14000 14001 // íë¶ê¸ìì ì¿ í°ì²ë¦¬ 14002 if($('.coupon-detail-info[data-seq="' + v.seq + '"]').length == 0) { 14003 $('.cancel-coupon-title').append('<div class="coupon-name coupon-detail-info" data-seq="' + v.seq + '">' + v.coupon_name + '</div>'); 14004 $('#cancel-coupon-detail').append('<div class="coupon-price coupon-detail-info" data-seq="' + v.seq + '">-' + number_format(parseInt(v.discount_price)) + 'ì</div>'); 14005 } 14006 } else { 14007 $('.coupon-detail-info[data-seq="' + v.seq + '"]').remove(); 14008 } 14009 }); 14010 // ì·¨ìë ì¿ í° ì ì¥ 14011 } 14012 product_price = product_price - parseInt(cancel_coupon_price); 14013 14014 var use_point = (rePayment - product_price > 0) ? 0 : rePayment - product_price; 14015 product_price = product_price + use_point; 14016 14017 $('#cancel-price').html(number_format(price)+'ì'); 14018 $('#cancel-delivery-price').html(number_format(deliveryPrice)+'ì'); 14019 $('#cancel-point-price').html(number_format(use_point)+'ì'); 14020 $('#cancel-coupon-price').html(((cancel_coupon_price > 0) ? '-' + number_format(cancel_coupon_price) : '0')+'ì'); 14021 $('#return-total-price').html(number_format((product_price>0) ? product_price : '0')); 14022 14023 var priceSumArr = []; 14024 var extra_charge_flag = {}; 14025 if(oreModal.find('.cancel-info-data:checked').length) { 14026 oreModal.find('.cancel-info-data:checked').each(function() { 14027 if($(this).data('type') != 'normal') 14028 return; 14029 14030 var dts = $(this).data('delivery_template_seq'); 14031 if(dtl[dts]['price_type'] != 'FREE_CONDITION') return; 14032 var dt = $(this).data('delivery_type'); 14033 if(dt != 'DELIVERY' && dt != 'DIRECT') return; 14034 14035 if(!priceSumArr.hasOwnProperty(dts)) { 14036 priceSumArr[dts] = []; 14037 } 14038 if(!priceSumArr[dts].hasOwnProperty(dt)) { 14039 priceSumArr[dts][dt] = 0; 14040 } 14041 // cancel_after_point = Number(cancel_after_point) + ((Number($(this).data("usable_point")) + Number($(this).data("expired_point"))) - Number($(this).data("curr_point"))); 14042 var selectedPrice = 0; 14043 selectedPrice = Number($(this).closest('tr').find('[data-optionprice]').data('optionprice')); 14044 priceSumArr[dts][dt] += selectedPrice; 14045 14046 if(dtl[dts]['dtype'][dt]['product_price'] - priceSumArr[dts][dt] < dtl[dts]['free_condition'] && dtl[dts]['dtype'][dt]['product_price'] - priceSumArr[dts][dt] > 0 && dtl[dts]['dtype'][dt]['price'] == 0) { 14047 extra_charge_flag[dts + '|' + dt] = true; 14048 } else { 14049 extra_charge_flag[dts + '|' + dt] = false;
14050 } 14051 }); 14052 } 14053 14054 extra_charge_info($form, 'R', Object.values(extra_charge_flag).indexOf(true) > -1 ? true : false, false); 14055 14056 if($('input[name="order_number_ary[]"]').length == $('input[name="order_number_ary[]"]:checked').length) $('#product-check').prop('checked', true); 14057 else $('#product-check').prop('checked', false); 14058 }); 14059 14060 $(document).on('click', '#product-check', function () { 14061 var price = 0; 14062 var deliveryPrice = 0; 14063 var totalCnt = 0, 14064 isReturn = $('input[name="status"]:checked').val(); 14065 $form.find('.order-cancel-content.extra-info').remove(); 14066 if ($(this).hasClass('noneAll') === true) { 14067 $(this).prop('checked', true); 14068 $(".status-checkbox").each(function () { 14069 if ($(this).prop('disabled') !== true) $(this).prop('checked', true).change(); 14070 }); 14071 } 14072 if ($(this).is(':checked') === true) { 14073 $('.status-checkbox').each(function (i) { 14074 if ($(this).prop('disabled') !== true) { 14075 $(this).prop('checked', true).change(); 14076 } 14077 }); 14078 } else { 14079 $(".status-checkbox").each(function () { 14080 if ($(this).prop('disabled') !== true) $(this).prop('checked', false).change(); 14081 }); 14082 14083 $('#cancel-price').html('0ì'); 14084 $('#cancel-delivery-price').html('0ì'); 14085 $('#cancel-point-price').html('0ì'); 14086 $('#return-total-price').html('0'); 14087 } 14088 }); 14089 14090 /* first option setting */ 14091 $('.cl-s-order-returnexchange .cl-s-form-selector').each(function(e) { 14092 var checkSelectOption = ($(this).find('select option').length > 0) ? true : false; 14093 if(checkSelectOption) { 14094 var selectId = $(this).find('select').attr('id'), 14095 val = $(this).find('select').children().eq(0).val(); 14096 $(this).find('select').selectpicker({'val':val, dropupAuto:false}); 14097 } 14098 }); 14099 14100 $('#re-reason').on({ 14101 'show.bs.select': function (e) { 14102 $(this).closest('.cl-s-form-selector').addClass('active'); 14103 }, 14104 'hidden.bs.select': function(e) { 14105 $(this).closest('.cl-s-form-selector').removeClass('active'); 14106 14107 if($('#re-reason').prop('value') == '') { 14108 $(this).closest('.cl-s-form-selector').addClass('empty'); 14109 } else { 14110 $(this).closest('.cl-s-form-selector').removeClass('empty'); 14111 } 14112 }, 14113 'changed.bs.select': function (e, clickedIndex, newValue, oldValue) { 14114 // console.log(this.value, clickedIndex, newValue, oldValue); 14115 } 14116 }); 14117 14118 14119 $('.cl-s-order-returnexchange .cl-s-form-group').on('click',function(e) { 14120 if($(e.target).hasClass('cl-s-form-group')) { 14121 $(e.target).find('.cl-s-form-control:not([type=hidden])').focus(); 14122 } 14123 }); 14124 14125 14126 $('.cl-s-order-returnexchange .cl-s-form-textarea').on({ 14127 focus: function(e) { 14128 $(this).closest('.cl-s-form-wrap').addClass('active'); 14129 }, 14130 blur: function(e) { 14131 var error_str = '', 14132 val = $(this).val().trim(); 14133 14134 $(this).closest('.cl-s-form-wrap').removeClass('active'); 14135 if(val.length == 0) { 14136 $(this).closest('.cl-s-form-wrap').removeClass('error').addClass('empty'); 14137 $(this).closest('.cl-s-form-wrap').find('.cl-s-control-label.error').remove(); 14138 return false;
14139 } else { 14140 $(this).closest('.cl-s-form-wrap').removeClass('empty'); 14141 14142 if(checkEmojis(val)) error_str = $.lang[LANG]['config.unable.emoji']; 14143 else if(val.length < 5) error_str = $.lang[LANG]['customsite.validate.message.minlengthto5']; 14144 14145 if(error_str.length > 0) { 14146 $(this).closest('.cl-s-form-wrap').addClass('error'); 14147 if($(this).parent().find('.cl-s-control-label.error').length > 0) { 14148 $(this).parent().find('.cl-s-control-label.error').html(error_str); 14149 } else { 14150 $(this).after('<label for="input" class="cl-s-control-label error">' + error_str + '</label>'); 14151 } 14152 return false; 14153 } 14154 } 14155 14156 $(this).closest('.cl-s-form-wrap').removeClass('error'); 14157 $(this).closest('.cl-s-form-wrap').find('.cl-s-control-label.error').remove(); 14158 } 14159 }); 14160 14161 $('.cl-s-form-wrap .cl-s-form-control').on({ 14162 focus: function(e) { 14163 $(this).closest('.cl-s-form-wrap').addClass('active'); 14164 }, 14165 blur: function(e) { 14166 var val = $(this).val().trim(); 14167 14168 $(this).closest('.cl-s-form-wrap').removeClass('active'); 14169 if(val.length == 0) { 14170 $(this).closest('.cl-s-form-wrap').removeClass('error').addClass('empty'); 14171 $(this).closest('.cl-s-form-wrap').find('.cl-s-control-label.error').remove(); 14172 return false; 14173 } else { 14174 $(this).closest('.cl-s-form-wrap').removeClass('empty'); 14175 14176 if(checkEmojis(val)) { 14177 $(this).closest('.cl-s-form-wrap').addClass('error'); 14178 if($(this).parent().find('.cl-s-control-label.error').length > 0) { 14179 $(this).parent().find('.cl-s-control-label.error').html($.lang[LANG]['config.unable.emoji']); 14180 } else { 14181 $(this).after('<label for="input" class="cl-s-control-label error">' + $.lang[LANG]['config.unable.emoji'] + '</label>'); 14182 } 14183 return false; 14184 } 14185 } 14186 14187 $(this).closest('.cl-s-form-wrap').removeClass('error'); 14188 $(this).closest('.cl-s-form-wrap').find('.cl-s-control-label.error').remove(); 14189 } 14190 }); 14191 14192 14193 14194 $(document).on('click', '.cl-s-order-returnexchange .re-img-close', function() { 14195 $(this).closest('li').remove(); 14196 }) 14197 14198 $('.cl-s-order-returnexchange .re-file-update').on('click', function () { 14199 $("#re-file").click(); 14200 }); 14201 14202 $('.cl-s-order-returnexchange #re-file').on({ 14203 click: function () { 14204 14205 var reImageCnt = $('.re-files-list').children('li').length; 14206 if (reImageCnt >= 5) { 14207 alert('ì´ë¯¸ì§ë ìµë 5ê°ê¹ì§ ë±ë¡ì´ ê°ë¥í©ëë¤.'); 14208 return false; 14209 } 14210 14211 var sid = $('#re-file').attr('data-sid'), 14212 uid = $('#re-file').attr('data-uid'); 14213 14214 $.uploadON(); 14215 $(this).fileupload({ 14216 url: '/_upload/type/re/sid/'+sid+'/uid/'+uid, 14217 dataType: 'json', 14218 pasteZone: null, 14219 async: true, 14220 sequentialUploads: true, 14221 add: function(e, data) { 14222 var r = $.upload_add(e,data,'image'); 14223 14224 if(r.submit) { 14225 var jqXHR = data.submit(); 14226 UPLOAD++; 14227 } else { 14228 data.context.find('.loading').html('<i class="fa fa-times error"></i>'); 14229 data.context.find('.ing').addClass('error').text(r.err); 14230 } 14231 14232 $('.uploadModal .upload-cancel .btn, .uploadModal .upload-close').off('click').on('click', function(e) { 14233 if(jqXHR != undefined) jqXHR.abort(); 14234 data.context.fadeOut().remove(); 14235 $('.uploadModal #file-upload-progress').css('width','0%'); 14236 $.uploadOFF(); 14237 UPLOAD = 0; 14238 UPLOADED = 0; 14239 PROGRESS = 0; 14240 }); 14241 }, 14242 progress: function(e, data) { 14243 $.upload_progress(e,data); 14244 }, 14245 done: function(e, data) { 14246 $.upload_done(e,data); 14247 UPLOADED++; 14248 var src = (typeof data.result.magic != 'undefined') ? data.result.magic : data.result.src; 14249 var reImage = '\ 14250 <li id="re-image-'+reImageCnt+'">\ 14251 <img src="'+src+'" class="img-responsive" />\ 14252 <input type="hidden" name="review_image[]" value="'+src+'" />\ 14253 <div class="cl-s-files-img-close re-img-close"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 8 8" width="8" height="8"><path d="M4.71 4l3.15-3.15c0.2-0.2 0.2-0.51 0-0.71s-0.51-0.2-0.71 0L4 3.29 0.85 0.15c-0.2-0.2-0.51-0.2-0.71 0s-0.2 0.51 0 0.71L3.29 4 0.15 7.15c-0.2 0.2
14253-0.2 0.51 0 0.71C0.24 7.95 0.37 8 0.5 8s0.26-0.05 0.35-0.15L4 4.71l3.15 3.15C7.24 7.95 7.37 8 7.5 8s0.26-0.05 0.35-0.15c0.2-0.2 0.2-0.51 0-0.71L4.71 4z"/></svg></div>\ 14254 </li>\ 14255 '; 14256 14257 $(".cl-s-order-returnexchange .re-files-list").append(reImage); 14258 reImageCnt++; 14259 14260 if(UPLOADED) { 14261 if(UPLOAD==UPLOADED) { 14262 setTimeout(function() { 14263 $.uploadOFF(); 14264 UPLOAD = 0; 14265 UPLOADED = 0; 14266 PROGRESS = 0; 14267 },1000); 14268 } 14269 } 14270 }, 14271 progressall: function (e, data) { 14272 $.upload_progressall(e,data); 14273 }, 14274 start : function(e, data) { 14275 $.upload_start(e,data); 14276 progress1 = 0; progress2 = 0; PROGRESS = 0; 14277 }, 14278 dragover : function(e, data) { 14279 e.preventDefault(); 14280 }, 14281 }).prop('disabled', !$.support.fileInput) 14282 .parent().addClass($.support.fileInput ? undefined : 'disabled'); 14283 } 14284 }); 14285 if(status == 'Y') { 14286 $('.status-checkbox').off('change'); 14287 } 14288 if(status == 'Y' && data.r.exchange_check == true) { 14289 $('.btn-group-toggle').off('click'); 14290 // console.log(oreModal.find('[btn-toggle="buttons"] .btn-secondary.disable')); 14291 oreModal.find('[data-toggle="buttons"] .btn-secondary.disable').on('click', function(e) { 14292 e.preventDefault(); 14293 e.stopPropagation(); 14294 alert('ìì¤í¬ë¡ ê²°ì ìíì êµí ìì²/ìë£ê° ìë ê²½ì° ë°í ìì²ì´ ë¶ê°ë¥í©ëë¤.\n기í ìì²ì´ ìë ê²½ì° ê´ë¦¬ì
14294ìê² ë¬¸ìí´ ì£¼ì¸ì.'); 14295 return false; 14296 }); 14297 } 14298 14299 oreModal.find('[data-toggle="popover"]').popover(); 14300 }); 14301 14302 var used_code_coupon = false; 14303 var coupon = c_data.pay_info.coupon_list; 14304 if(coupon.length) { 14305 $.each(coupon, function(i,v) { 14306 if(v.kind == 'C') used_code_coupon = true; 14307 }); 14308 } 14309 14310 $('.cl-s-order-returnexchange .cl-s-btn-group-toggle input:radio').on({ 14311 change: function() { 14312 var order_status = $(this).val(), 14313 re_reason_obj = { 14314 'R' : '\ 14315 <option value="구매ìì¬ ì·¨ì">구매ìì¬ ì·¨ì</option>\ 14316 <option value="ë¤ë¥¸ ìí ì못 주문">ë¤ë¥¸ ìí ì못 주문</option>\ 14317 <option value="ìííì">ìííì</option>\ 14318 <option value="ë°°ì¡ì§ì°">ë°°ì¡ì§ì°</option>\ 14319 <option value="ìíì ë³´ ìì´">ìíì ë³´ ìì´</option>\ 14320 <option value="ì¤ë°°ì¡">ì¤ë°°ì¡</option>\ 14321 <option value="기í">기í</option>\ 14322 ', 14323 'E' : '\ 14324 <option value="ì»¬ë¬ ë° ì¬ì´ì¦ ë³ê²½">ì»¬ë¬ ë° ì¬ì´ì¦ ë³ê²½</option>\ 14325 <option value="ë¤ë¥¸ ìí ì못 주문">ë¤ë¥¸ ìí ì못 주문</option>\ 14326 <option value="ìííì">ìííì</option>\ 14327 <option value="ìíì ë³´ ìì´">ìíì ë³´ ìì´</option>\ 14328 <option value="ì¤ë°°ì¡">ì¤ë°°ì¡</option>\ 14329 <option value="기í">기í</option>\ 14330 ' 14331 }; 14332 $('.order-candel-content.extra-info').remove(); 14333 $(this).closest('.btn-group-toggle').find('.btn-secondary').removeClass('active'); 14334 $(this).parent('.btn-secondary').addClass('active'); 14335 14336 if (order_status == 'R') { 14337 if (status == 'Y' && data.r.exchange_check == true) { 14338 alert('ìì¤í¬ë¡ ê²°ì ìíì êµí ìì²/ìë£ê° ìë ê²½ì° ë°í ìì²ì´ ë¶ê°ë¥í©ëë¤.\n기í ìì²ì´ ìë ê²½ì° ê´ë¦¬ì
14338ìê² ë¬¸ìí´ ì£¼ì¸ì.'); 14339 setTimeout(function () { 14340 $('#order-radio-exchange').click(); 14341 }, 500); 14342 return false; 14343 } else if(used_code_coupon && data.r.exchange_check == true) { 14344 alert('ì½ë ì¿ í°ì´ ì ì©ë 주문건ì êµí ì ì ì ë°íì´ ë¶ê°ë¥í©ëë¤.\nìì¸í ì¬íì í매ìì ìë´ë¥¼ ë°ë¼ì£¼ì¸ì.'); 14345 setTimeout(function() { 14346 $('#order-radio-exchange').click(); 14347 }); 14348 return false; 14349 } 14350 14351 $('#return-modal').css('display', 'block'); 14352 $('.order-cancel-content').css('display', 'block'); 14353 $('#no-bank').parent().parent().addClass('cl-s-form-wrap'); 14354 $('#no-bank-name').parent().parent().addClass('cl-s-form-wrap'); 14355 $('#no-bank-number').parent().parent().addClass('cl-s-form-wrap'); 14356 $('.code-coupon-exchange-warning').hide(); 14357 14358 if (status == 'Y') { 14359 $('.status-checkbox').each(function () { 14360 $(this).prop('checked', true); 14361 $(this).addClass('noneAll'); 14362 }); 14363 $('#product-check').addClass('noneAll'); 14364 $('#product-check').prop('checked', true); 14365 $('.escrow-warring').css({'display': 'block'}); 14366 $('.escrow-exchange-warning').hide(); 14367 } else if(used_code_coupon) { 14368 $('.status-checkbox').each(function () { 14369 $(this).prop('checked', true); 14370 $(this).addClass('noneAll'); 14371 }); 14372 $('#product-check').addClass('noneAll'); 14373 $('#product-check').prop('checked', true); 14374 } 14375 var totalCnt = 0, totalNomalCheck = 0, nomalCheck = 0; 14376 var price = 0; 14377 var deliveryPrice = 0; 14378 $(".status-checkbox").each(function (i, index) { 14379 if ($(this).is(":checked") === true) { 14380 price += ($(this).closest('.cl-s-product-jumbotron').find('.option-check').attr('data-optionPrice') * 1); 14381 totalCnt++; 14382 if ($(this).attr('data-type') == 'normal') { 14383 nomalCheck++; 14384 var mix_yn = $(this).data('mix_yn'); 14385 var delivery_price = 0; 14386 var delivery_template_seq = $(this).data('delivery_template_seq'); 14387 var delivery_type = $(this).data('delivery_type'); 14388 if(oreModal.find('input[name="order_number_ary[]"][data-delivery_type="' + delivery_type + '"][data-delivery_template_seq="' + delivery_template_seq + '"]').length == oreModal.find('input[name="order_number_ary[]"][data-delivery_type="' + delivery_type + '"][data-delivery_template_seq="' + delivery_template_seq + '"]:checked').length) { 14389 delivery_price = Number($(this).data('delivery_price')); 14390 } 14391 deliveryPrice += delivery_price; 14392 } 14393 14394 var product_number = $(this).attr('data-product_number'); 14395 if($(this).attr('data-option_type') != 'A' && !$('input[name="order_number_ary[]"][data-product_number="' + product_number + '"][data-option_type!="A"]:not(:checked)').length) { 14396 $('input[name="order_number_ary[]"][data-product_number="' + product_number + '"][data-option_type="A"]').prop('checked',true).change(); 14397 } else if($(this).attr('data-option_type') == 'A' && !$('input[name="order_number_ary[]"][data-product_number="' + product_number + '"][data-option_type!="A"]:not(:checked)').length && !$(this).prop('checked')) { 14398 $('input[name="order_number_ary[]"][data-product_number="' + product_number + '"][data-option_type!="A"]:last').prop('checked',fal
14398se).change(); 14399 } 14400 } 14401 14402 if ($(this).attr('data-type') == 'normal') { 14403 totalNomalCheck++; 14404 } 14405 }); 14406 14407 var product_price = price + deliveryPrice, 14408 rePayment = parseInt(c_data.pay_info.request.payment.total) - parseInt(c_data.pay_info.request.payment.coupon) - parseInt(c_data.pay_info.request.cancel.total) - parseInt(c_data.pay_info.request.return.total); 14409 14410 rePayment = (rePayment > 0) ? rePayment : 0; 14411 14412 // coupon ì²ë¦¬ 14413 14414 var cancel_coupon_price = 0; 14415 if(coupon.length) { 14416 var checked_order_number = $('.cancel-info-data:checked').map(function(){ return this.value; }).toArray(); 14417 $.each(coupon, function(i,v) { 14418 if(checked_order_number.indexOf(v.order_number) > -1 || v.kind == 'C') { 14419 cancel_coupon_price += parseInt(v.discount_price); 14420 14421 // íë¶ê¸ìì ì¿ í°ì²ë¦¬ 14422 if($('.coupon-detail-info[data-seq="' + v.seq + '"]').length == 0) { 14423 $('.cancel-coupon-title').append('<div class="coupon-name coupon-detail-info" data-seq="' + v.seq + '">' + v.coupon_name + '</div>'); 14424 $('#cancel-coupon-detail').append('<div class="coupon-price coupon-detail-info" data-seq="' + v.seq + '">-' + number_format(parseInt(v.discount_price)) + 'ì</div>'); 14425 } 14426 } else { 14427 $('.coupon-detail-info[data-seq="' + v.seq + '"]').remove(); 14428 } 14429 }); 14430 // ì·¨ìë ì¿ í° ì ì¥ 14431 14432 } 14433 product_price = product_price - parseInt(cancel_coupon_price); 14434 14435 var use_point = (rePayment - product_price > 0) ? 0 : rePayment - product_price; 14436 product_price = product_price + use_point; 14437 14438 $('#cancel-price').html(number_format(price)+'ì'); 14439 $('#cancel-delivery-price').html(number_format(deliveryPrice)+'ì'); 14440 $('#cancel-point-price').html(number_format(use_point)+'ì'); 14441 $('#cancel-coupon-price').html(((cancel_coupon_price > 0) ? '-' + number_format(cancel_coupon_price) : '0')+'ì'); 14442 $('#return-total-price').html(number_format(product_price)); 14443 $('.codecoupon-cancel-desc').show(); 14444 14445 var priceSumArr = []; 14446 var extra_charge_flag = {}; 14447 if(oreModal.find('.cancel-info-data:checked').length) { 14448 oreModal.find('.cancel-info-data:checked').each(function() { 14449 if($(this).data('type') != 'normal') 14450 return; 14451 14452 var dts = $(this).data('delivery_template_seq'); 14453 if(dtl[dts]['price_type'] != 'FREE_CONDITION') return; 14454 var dt = $(this).data('delivery_type'); 14455 if(dt != 'DELIVERY' && dt != 'DIRECT') return; 14456 14457 if(!priceSumArr.hasOwnProperty(dts)) { 14458 priceSumArr[dts] = []; 14459 } 14460 if(!priceSumArr[dts].hasOwnProperty(dt)) { 14461 priceSumArr[dts][dt] = 0; 14462 } 14463 // cancel_after_point = Number(cancel_after_point) + ((Number($(this).data("usable_point")) + Number($(this).data("expired_point"))) - Number($(this).data("curr_point"))); 14464 var selectedPrice = 0; 14465 selectedPrice = Number($(this).closest('tr').find('[data-optionprice]').data('optionprice')); 14466 priceSumArr[dts][dt] += selectedPrice; 14467 14468 if(dtl[dts]['dtype'][dt]['product_price'] - priceSumArr[dts][dt] < dtl[dts]['free_condition'] && dtl[dts]['dtype'][dt]['product_price'] - priceSumArr[dts][dt] > 0 && dtl[dts]['dtype'][dt]['price'] == 0) { 14469 extra_charge_flag[dts + '|' + dt] = true; 14470 } else { 14471 extra_charge_flag[dts + '|' + dt] = false;
14472 } 14473 }); 14474 } 14475 14476 extra_charge_info($form, 'R', Object.values(extra_charge_flag).indexOf(true) > -1 ? true : false, false); 14477 } else { 14478 14479 $('.order-candel-content.extra-info').remove(); 14480 $('#return-modal').css('display', 'none'); 14481 $('.order-cancel-content').css('display', 'none'); 14482 $('#no-bank').parent().parent().removeClass('cl-s-form-wrap'); 14483 $('#no-bank-name').parent().parent().removeClass('cl-s-form-wrap'); 14484 $('#no-bank-number').parent().parent().removeClass('cl-s-form-wrap'); 14485 if (status == 'Y') { 14486 $('.status-checkbox').each(function () { 14487 $(this).prop('checked', false); 14488 $(this).removeClass('noneAll'); 14489 }); 14490 $('#product-check').removeClass('noneAll'); 14491 $('#product-check').prop('checked', false); 14492 $('.escrow-warring').css({'display': 'none'}); 14493 $('.escrow-exchange-warning').show(); 14494 } else if(used_code_coupon) { 14495 $('.status-checkbox').each(function () { 14496 $(this).prop('checked', false); 14497 $(this).removeClass('noneAll'); 14498 }); 14499 $('#product-check').removeClass('noneAll'); 14500 $('#product-check').prop('checked', false); 14501 $('.code-coupon-exchange-warning').show(); 14502 $('.codecoupon-cancel-desc').hide(); 14503 } 14504 } 14505 14506 $('#re-reason').closest('.cl-s-form-selector').removeClass('empty'); 14507 $('#re-reason').html(re_reason_obj[order_status]).selectpicker('refresh'); 14508 $('#re-reason').selectpicker('val', $('#re-reason').val()); 14509 } 14510 }); 14511 if((status == 'Y' || used_code_coupon) && data.r.exchange_check == true) { // ìì¤í¬ë¡ì´ê³ êµíê±´ ì¡´ì¬ 14512 $('#order-radio-exchange[value="E"]').prop('checked', true).change(); 14513 } 14514 14515 },'json'); 14516 14517 $('.close-button-dialog').css({'display': 'block'}); 14518 }, 14519 writeReviewModal: function(sid, pnum, onum, type) { 14520 if(typeof sid == 'undefined' || typeof pnum == 'undefined' || typeof onum == 'undefined') { 14521 alert('ì ë³´ê° ì¬ë°ë¥´ì§ ììµëë¤'); 14522 return false; 14523 } 14524 $.post('/_check_order', { sid:sid, pnum:pnum, onum:onum, mode:'review' }, function(data) { 14525 if(typeof data.error != 'undefined' && data.error) { 14526 $(this).showModalFlat('', data.error, true, false, '', 'close'); 14527 return false; 14528 } 14529 14530 var c_data = data.r, 14531 modal_str = '', 14532 order_group = data.order_group, 14533 picturePointStr = ''; 14534 14535 let use_review_img_upload = (typeof c_data.use_review_img_upload != 'undefined' && c_data.use_review_img_upload)? c_data.use_review_img_upload : 'true'; 14536 14537 if(c_data.writer.status == 'A') { 14538 alert('ê´ë¦¬ìë ìí í기 ìì±ì ì¬ì©í ì ììµëë¤.'); 14539 return false; 14540 } 14541 if (c_data.pay_info.settings.point_data != null && c_data.pay_info.settings.point_data['point_use'] == 'Y' && c_data.writer.status != 'T') { 14542 if (c_data.pay_info.settings.point_data['review_point_status'] == 'Y') { 14543 if(typeof c_data.pay_info.settings.point_data != "undefined" && c_data.pay_info.settings && c_data.odata.price > 0) { 14544 var photoPoint = (c_data.pay_info.settings.point_data['review_photo_point'] > 0) ? c_data.pay_info.settings.point_data['review_photo_point'] : 0, 14545 textPoint = (c_data.pay_info.settings.point_data['review_point'] > 0) ? c_data.pay_info.settings.point_data['review_point'] : 0; 14546 picturePointStr = '\ 14547 <div class="cl-s-ps">\ 14548 <svg viewBox="0 0 13 13" width="13" height="13">\ 14549 <path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"/>\ 14550 <rect x="6" y="3" width="1" height="5"/><rect x="6" y="9" width="1" height="1"/>\ 14551 </svg>ì¬ì§ ì²¨ë¶ ì <span>'+number_format(photoPoint)+'ì</span>ì´ ì 립ë©ëë¤.\ 14552 </div>\ 14553 '; 14554 } 14555 14556 let maxPoint = textPoint; 14557 let pointPopoverContent = `í ì¤í¸ í기 : ${number_format(textPoint)}ì`; 14558 if(use_review_img_upload != 'false') { 14559 maxPoint = photoPoint; 14560 pointPopoverContent = `í ì¤í¸ í기 : ${number_format(textPoint)}ì <br>í¬í í기 : ${number_format(photoPoint)}ì<br><p>í ì¤í¸ í기ì í¬í í기 ì 립ê¸ì ì¤ë³µì§ê¸ëì§ ìì¼ë©°, ìµì´ ìì±í í기를 기ì¤ì¼ë¡ ì§ê¸ë©ëë¤.</p>`; 14561 } 14562 14563 if(c_data.odata.price > 0) { 14564 modal_str += ` 14565 <div class="review-point review-icon">í기 ìì± ì ì ë¦½ê¸ <span>ìµë ${maxPoint}ì</span> 14566 <svg viewBox="0 0 13 13" width="13" height="13" class="cm-popover-info" tabindex="0" data-trigger="hover" data-toggle="popover" data-placement="bottom" data-html="true" data-content="${pointPopoverContent}"> 14567 <path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"/>\ 14568 <rect x="6" y="9" width="1" height="1"/> 14569 <path d="M6.66 3.01C5.61 3.01 4.58 3.5 4.5 4.8c0 0.06-0.01 0.12 0 0.2h1.02c0-0.07 0.01-0.15 0.02-0.23 0.08-0.62 0.52-0.76 1.08-0.76 0.63 0 1.02 0.37 1.02 0.95 -0.01 0.48-0.3 0.87-0.76 1.34C6.21 6.97 6.02 7.37 6 8h0.99C7 7.
1456966 7.04 7.37 7.67 6.75 8.17 6.27 8.7 5.68 8.7 4.87 8.7 3.85 7.89 3.01 6.66 3.01z"/> 14570 </svg> 14571 </div> 14572 `; 14573 } 14574 } 14575 } 14576 14577 modal_str += '\ 14578 <div class="review-body review-write-body">\ 14579 <div class="cl-s-product-jumbotron clearfix">\ 14580 <div class="cl-s-product-thumb">\ 14581 <img src="' + c_data.pdata.img + '" alt="' + c_data.pdata.name + '" class="' + c_data.pdata.img_align + '" />\ 14582 </div>\ 14583 <div class="cl-s-product-info">\ 14584 <h5 class="cl-s-product-title">' + c_data.pdata.name + '</h5>\ 14585 '; 14586 var option_title = (c_data.pdata.option_type == 'A') ? 'ì¶ê°ìµì : ' + (c_data.pdata.option_group ? c_data.pdata.option_group + ': ' : '') : 'ìµì : '; 14587 if(typeof c_data.pdata.option != "undefined" && c_data.pdata.option) { 14588 modal_str += (c_data.pdata.option_text_str)? '\ 14589 <div class="option-str">' + option_title + c_data.pdata.option + ' / ' + c_data.pdata.option_text_str + '</div>\ 14590 ' : '\ 14591 <div class="option-str">' + option_title + c_data.pdata.option + '</div>\ 14592 '; 14593 } else { 14594 modal_str += (c_data.pdata.option_text_str)? '\ 14595 <div class="option-str">' + c_data.pdata.option_text_str + '</div>\ 14596 ' : ''; 14597 } 14598 if(typeof c_data.pdata.etc_date != "undefined" && c_data.pdata.etc_date) { 14599 modal_str += '\ 14600 <div class="option-str">ì íì¼ì: ' + c_data.pdata.etc_date + '</div>\ 14601 '; 14602 } 14603 modal_str += '\ 14604 </div>\ 14605 </div>\ 14606 <div class="review-star">\ 14607 <h5>ìíì´ ë§ì¡±ì¤ë¬ì°ì ¨ëì?</h5>\ 14608 <div class="star text-center">\ 14609 <span data-idx="1" class="active"></span>\ 14610 <span data-idx="2" class="active"></span>\ 14611 <span data-idx="3" class="active"></span>\ 14612 <span data-idx="4" class="active"></span>\ 14613 <span data-idx="5" class="active"></span>\ 14614 </div>\ 14615 </div>\ 14616 <div class="review-content">\ 14617 <h5>ì´ë¤ ì ì´ ì¢ìëì?</h5>\ 14618 <div class="cl-s-form-wrap">\ 14619 <div class="cl-s-form-group input-label-hide">\ 14620 <textarea class="cl-s-form-control" id="review-str" name="review" maxlength="1000" required="required"></textarea>\ 14621 <label for="input" class="cl-s-control-label">ìì¸í ë´ì©ì ì ì´ì£¼ì¸ì. (1000ì ì´ë´)</label>\ 14622 </div>\ 14623 </div>\ 14624 '; 14625 if(use_review_img_upload != 'false') { 14626 modal_str += '\ 14627 <div class="cl-s-files review-files file-center">\ 14628 <input id="review-file" type="file" name="files[]" accept="image/jpeg,image/gif,image/png" multiple data-sid="' + sid + '" data-uid=\"' + c_data.writer.id + '\">\ 14629 <label class="cl-s-file-update review-file-update display-flex align-items-center justify-center"><svg viewBox="0 0 42 36" width="18" height="16"><path d="M36 6h-5l-3-5c0 0-0.71-1-1.99-1 -0.72 0-2.54 0-3.99 0 0 0-0.91 0-2.04 0 -1.45 0-3.27 0-3.99 0C14.71 0 14 1 14 1l-3 5H6c-3.31 0-6 2.69-6 6v18c0 3.31 2.69 6 6 6h30c3.31 0 6-2.69 6-6V12C42 8.69 39.31 6 36 6zM21 31c-5.52 0-10-4.48-10-10 0-5.52 4.48-10 10-10 5.52 0 10 4.48 10 10C31 26.52 26.52 31 21 31z"/><circle cx="21" cy="21" r="6"/></svg><span>ì¬ì§ 첨ë¶í기</span></label>'; 14630 if(c_data.pay_info.settings.point_data != null && c_data.pay_info.settings.point_data['point_use'] == 'Y' && c_data.pay_info.settings.point_data['review_point_status'] == 'Y') modal_str += picturePointStr; 14631 modal_str += '\ 14632 <ul class="cl-s-files-list review-files-list clearfix files-list-wrap">\ 14633 </ul>\ 14634 </div>\ 14635 '; 14636 } 14637 modal_str += '\ 14638 </div>\ 14639 </div>\ 14640 '; 14641 14642 // $('.flat-modal .modal').modal('hide'); 14643 var wrModal = $(this).showModalFlat('í기 ìì±', modal_str, true, true,function () { 14644 14645 var cl_s_f_body = $('.cl-s-product-review-write .review-content'); 14646 cl_s_f_body.find('.cl-s-form-wrap').each(function() { 14647 var check_input = $(this).find('.cl-s-form-control'), 14648 val = check_input.val().trim(); 14649 14650 if(val.length == 0) { 14651 $(this).removeClass('error').addClass('empty'); 14652 $(this).find('.cl-s-control-label.error').remove(); 14653 } else { 14654 if($(this).hasClass('error')) { 14655 check_input.focus(); 14656 } 14657 } 14658 }); 14659 14660 if(cl_s_f_body.find('.cl-s-form-wrap.empty, .cl-s-form-wrap.error').length > 0) { 14661 cl_s_f_body.find('.cl-s-form-wrap.empty, .cl-s-form-wrap.error').eq(0).find('.cl-s-form-control').focus(); 14662 return false;
14663 } 14664 14665 var page_mode = ($('.cl-s-mypage').length > 0) ? 'mypage' : 'no_member', 14666 review = $('#review-str').val().trim(), 14667 review_star = $('.cl-s-product-review-write .review-star .star .active').length, 14668 review_image = new Array(); 14669 review_image_orig = new Array(); 14670 14671 $('input[name="review_image[]"]').each(function(i) { 14672 review_image[i] = $(this).val(); 14673 }); 14674 14675 $('input[name="review_image_orig[]"]').each(function(i) { 14676 review_image_orig[i] = $(this).val(); 14677 }); 14678 14679 var review_data = { 14680 status : 'S', 14681 page_mode : page_mode, 14682 pnum : pnum, 14683 onum : onum, 14684 mb_status : c_data.writer.status, 14685 review : review, 14686 review_count : review_star, 14687 review_image : review_image, 14688 review_image_orig : review_image_orig 14689 }; 14690 14691 if(c_data.writer.status == 'T') { 14692 review_data['name'] = c_data.odata.name; 14693 // review_data['order_group'] = c_data.order_data.group; 14694 } 14695 14696 $('.ok-button-dialog').prop('disabled', true); 14697 14698 $.post('/_review_write', { sid:sid, order_group: order_group, data:JSON.stringify(review_data) }, function(rw_data) { 14699 if(typeof rw_data.error != 'undefined' && rw_data.error) { 14700 $(this).showModalFlat('ERROR', rw_data.error, true, false, '', 'close'); 14701 return false; 14702 } 14703 14704 location.reload(); 14705 }, 'json'); 14706 14707 },'close','ë±ë¡í기','cl-s-product-review-write cl-modal cl-s-btn cover', true, '', function() { 14708 14709 $('.cl-s-product-review-write .cl-s-form-group').on('click',function(e) { 14710 if($(e.target).hasClass('cl-s-form-group')) { 14711 $(e.target).find('.cl-s-form-control:not([type=hidden])').focus(); 14712 } 14713 }); 14714 $('[data-toggle="popover"]').popover(); 14715 $('.cl-s-product-review-write .cl-s-form-control').on({ 14716 focus: function(e) { 14717 $(this).closest('.cl-s-form-wrap').addClass('active'); 14718 }, 14719 blur: function(e) { 14720 var val = $(this).val().trim(); 14721 14722 $(this).closest('.cl-s-form-wrap').removeClass('active'); 14723 if(val.length == 0) { 14724 $(this).closest('.cl-s-form-wrap').removeClass('error').addClass('empty'); 14725 $(this).closest('.cl-s-form-wrap').find('.cl-s-control-label.error').remove(); 14726 return false; 14727 } else { 14728 $(this).closest('.cl-s-form-wrap').removeClass('empty'); 14729 var passEmoji = ($.inArray($(this).attr('name'),['review']) > -1) ? true : false, 14730 error_str = ''; 14731 if(!passEmoji && checkEmojis(val)) error_str = $.lang[LANG]['config.unable.emoji']; 14732 else if(val.length < 5) error_str = $.lang[LANG]['customsite.validate.message.minlengthto5']; 14733 14734 if(error_str.length > 0) { 14735 $(this).closest('.cl-s-form-wrap').addClass('error'); 14736 if($(this).parent().find('.cl-s-control-label.error').length > 0) { 14737 $(this).parent().find('.cl-s-control-label.error').html(error_str); 14738 } else { 14739 $(this).after('<label for="input" class="cl-s-control-label error">' + error_str + '</label>'); 14740 } 14741 return false;
14742 } 14743 } 14744 14745 $(this).closest('.cl-s-form-wrap').removeClass('error').removeClass('empty'); 14746 $(this).closest('.cl-s-form-wrap').find('.cl-s-control-label.error').remove(); 14747 } 14748 }); 14749 14750 $(document).on('click', '.cl-s-product-review-write .review-img-close', {mode: 'review'}, deleteReviewQnaImg); 14751 14752 $('.cl-s-product-review-write .review-file-update').on('click', function () { 14753 $("#review-file").click(); 14754 }); 14755 14756 $('.cl-s-product-review-write #review-file').on('click', {mode: 'review'}, uploadReviewQnaImg); 14757 14758 $('.cl-s-product-review-write .review-star .star span').on('click', function() { 14759 var rCount = $(this).attr('data-idx'); 14760 $(this).parent().children('span').removeClass('active'); 14761 $(this).addClass('active').prevAll('span').addClass('active'); 14762 }); 14763 }, function() { 14764 if($('.cl-s-product-review-write .review-img-close').length > 0){ 14765 $.each($('.cl-s-product-review-write .review-img-close'), function(){ 14766 $(this).trigger('click'); 14767 }); 14768 } 14769 }); 14770 14771 14772 },'json'); 14773 14774 }, 14775 14776 orderConfirmModal: function(sid, pnum, onum, ognum, status, dStatus, pclass) { 14777 if(typeof sid == "undefined" || typeof pnum == "undefined" || typeof onum == "undefined") { 14778 alert('ì ë³´ê° ì¬ë°ë¥´ì§ ììµëë¤'); 14779 return false; 14780 } 14781 $.post('/_check_order', { sid:sid, pnum:pnum, onum:onum, mode:'confirm', ognum: ognum }, function(data) { 14782 14783 if(typeof data.error != "undefined" && data.error) { 14784 $(this).showModalFlat('ERROR', data.error, true, false, '', 'close'); 14785 return false; 14786 } 14787 var c_data = data.r, checkboxNone = '', noneAll = '', noneChecked = '', checkNoneAll = '', checkEscrowFooter = '', checkEscrowClass = '', checkOrderConfirm = ''; 14788 var dtl = c_data.delivery_template_list; 14789 var used_code_coupon = false; 14790 14791 if(c_data.pay_info.coupon_list && c_data.pay_info.coupon_list.length) { 14792 $.each(c_data.pay_info.coupon_list, function(k, v) { 14793 if(v.kind == 'C') { 14794 used_code_coupon = true; 14795 } 14796 }) 14797 } 14798 14799 if(used_code_coupon) { 14800 checkboxNone = 'checked'; 14801 noneAll = ' noneAll'; 14802 checkNoneAll = 'fule'; 14803 checkOrderConfirm = '<div class="modal-comment deposit-cancel-desc codecoupon-cancel-desc order-cancel-content">\ 14804 <div class="desc-box">\ 14805 <div class="desc-title">ì½ëì¿ í° ì¬ì© 구매íì ìë´</div>\ 14806 <div class="section">- ì½ëì¿ í° ì¬ì© 주문 ê±´ì <span class="cl-red">ì ì²´ 구매íì </span>ë§ ê°ë¥í©ëë¤.</div>\ 14807 </div>\ 14808 </div>\ 14809 '; 14810 } 14811 14812 var modal_str = '\ 14813 <form name="cancel_form" method="post" action="/_confirm">\ 14814 <input type="hidden" name="sid" value="' + sid + '">\ 14815 <input type="hidden" name="order_group" id="cancel-order-group" value="' + ognum + '">\ 14816 <input type="hidden" name="order_number" id="cancel-order-number" value="' + onum + '">\ 14817 <div class="cancel-product-title">\ 14818 <div class="newcheckbox hand">\ 14819 <label>\ 14820 <input type="checkbox" class="'+noneAll+'" id="product-check" '+checkboxNone+'>\ 14821 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\ 14822 <path d="M13 0H3C1.3 0 0 1.3 0 3v10c0 1.7 1.3 3 3 3h10c1.7 0 3-1.3 3-3V3C16 1.3 14.7 0 13 0zM15 13c0 1.1-0.9 2-2 2H3c-1.1 0-2-0.9-2-2V3c0-1.1 0.9-2 2-2h10c1.1 0 2 0.9 2 2V13z"/>\ 14823 </svg>\ 14824 <svg class="active" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\ 14825 <path d="M13 0H3C1.34 0 0 1.34 0 3v10c0 1.66 1.34 3 3 3h10c1.66 0 3-1.34 3-3V3C16 1.34 14.66 0 13 0zM13.03 6.03l-5.5 5.5C7.38 11.68 7.19 11.75 7 11.75s-0.38-0.07-0.53-0.22l-3.5-3.5c-0.29-0.29-0.29-0.77 0-1.06s0.77-0.29 1.06 0L7 9.94l4.97-4.97c0.29-0.29 0.77-0.29 1.06 0S13.32 5.74 13.03 6.03z"/>\ 14826 </svg>\ 14827 </label>\ 14828 </div>\ 14829 구매íì ìí\ 14830 </div>'; 14831 14832 modal_str += '<table class="table product-table">'; 14833 for (var i=0;i<data.r.odata.length;i++) { 14834 if (c_data.odata[i].d_status == '' || c_data.odata[i].d_status == 'CN' || c_data.odata[i].d_status == 'EY' || c_data.odata[i].d_status == 'ED' || c_data.odata[i].d_status == 'EN' || c_data.odata[i].d_status == 'RN' || c_data.odata[i].d_status == 'RD') { 14835 noneChecked = ''; 14836 if (!checkNoneAll) noneAll = ''; 14837 } else { 14838 if (!checkNoneAll) noneAll = 'noneAll'; 14839 noneChecked = 'noneChecked'; 14840 } 14841 if (c_data.odata[i].p_status == 'W') { 14842 if (!checkNoneAll) noneAll = 'noneAll'; 14843 noneChecked = 'noneChecked'; 14844 checkboxNone = 'checked'; 14845 } 14846 14847 var dts = c_data.odata[i].state == 'normal' ? c_data.odata[i].delivery_template_seq : ''; 14848 if(c_data.odata[i].state == 'normal' && c_data.odata[i].mix_yn != 'Y') dts += '-' + c_data.odata[i].product_number; 14849 var dt = c_data.odata[i].state == 'normal' ? c_data.odata[i].delivery_type : ''; 14850 14851 modal_str += '\ 14852 <tr class="cl-s-product-jumbotron clearfix">\ 14853 <td>\ 14854 <div class="newcheckbox hand">\ 14855 <label>\ 14856 <input type="checkbox" class="status-checkbox cancel-info-data '+noneAll+' '+noneChecked+'" data-type="'+c_data.pdata[i].state
14856+'" name="order_number_ary[]" value="'+c_data.odata[i].order_number+'" '+checkboxNone+' data-option_type="' + c_data.pdata[i].option_type + '" data-product_number="' + c_data.odata[i].product_number + '" data-mix_yn="' + (c_data.odata[i].state == 'normal' ? c_data.odata[i].mix_yn : '') + '" data-delivery_template_seq="' + (c_data.odata[i].state == 'normal' ? dts : '') + '" data-delivery_type="' + (c_data.odata[i].state == 'normal' ? c_data.odata[i].delivery_type : '') + '" data-quantity="' + c_data.odata[i].quantity + '" data-product_weight="' + (c_data.odata[i].state == 'normal' ? c_data.odata[i].product_weight : 0) + '" data-delivery_price="' + (c_data.odata[i].state == 'normal' && dtl[dts]['pay_type'] == 'PREPAY' ? c_data.odata[i].delivery_price : 0) + '">\ 14857 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\ 14858 <path d="M13 0H3C1.3 0 0 1.3 0 3v10c0 1.7 1.3 3 3 3h10c1.7 0 3-1.3 3-3V3C16 1.3 14.7 0 13 0zM15 13c0 1.1-0.9 2-2 2H3c-1.1 0-2-0.9-2-2V3c0-1.1 0.9-2 2-2h10c1.1 0 2 0.9 2 2V13z"/>\ 14859 </svg>\ 14860 <svg class="active" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\ 14861 <path d="M13 0H3C1.34 0 0 1.34 0 3v10c0 1.66 1.34 3 3 3h10c1.66 0 3-1.34 3-3V3C16 1.34 14.66 0 13 0zM13.03 6.03l-5.5 5.5C7.38 11.68 7.19 11.75 7 11.75s-0.38-0.07-0.53-0.22l-3.5-3.5c-0.29-0.29-0.29-0.77 0-1.06s0.77-0.29 1.06 0L7 9.94l4.97-4.97c0.29-0.29 0.77-0.29 1.06 0S13.32 5.74 13.03 6.03z"/>\ 14862 </svg>\ 14863 </label>\ 14864 </div>\ 14865 <div class="cl-s-product-thumb">\ 14866 <img src="' + c_data.pdata[i].img + '" alt="' + c_data.pdata[i].name + '" class="' + c_data.pdata[i].img_align + '" />\ 14867 </div>\ 14868 <div class="cl-s-product-info">\ 14869 <h5 class="cl-s-product-title">' + c_data.pdata[i].name + '</h5>\ 14870 '; 14871 14872 // console.log(c_data.odata[i]); 14873 14874 var price = (Number(c_data.odata[i].sale_price) > 0) ? c_data.odata[i].sale_price : c_data.odata[i].price, 14875 quantity = Number(c_data.odata[i].quantity), 14876 optionPrice = c_data.odata[i].price * quantity, 14877 sum_price = quantity * price, 14878 option_name = (typeof c_data.pdata[i].option != "undefined" && c_data.pdata[i].option) ? c_data.pdata[i].option : '', 14879 option_str = '', 14880 etc_str = (typeof c_data.pdata[i].etc_date != "undefined" && c_data.pdata[i].etc_date) ? '<span class="etc-date">ì íì¼ì: '+c_data.pdata[i].etc_date+'</span>' : '', 14881 option_title = (c_data.pdata[i].option_type == 'A') ? 'ì¶ê°ìµì : ' + (c_data.pdata[i].option_group ? c_data.pdata[i].option_group + ': ' : '') : 'ìµì : '; 14882 if(option_name) { 14883 option_str = (c_data.pdata[i].option_text_str) ? '<span class="' + (etc_str ? 'option-name' : '') + '">' + option_title + option_name+' / '+c_data.pdata[i].option_text_str+'</span>' : '<span class="' + (etc_str ? 'option-name' : '') + '">' + option_title + option_name+'</span>'; 14884 } else { 14885 option_str = (c_data.pdata[i].option_text_str) ? '<span class="' + (etc_str ? 'option-name' : '') + '">' + option_title + c_data.pdata[i].option_text_str+'</span>' : ''; 14886 } 14887 modal_str += '\ 14888 <div class="option-str option-check" data-optionPrice="'+optionPrice+'">' + option_str + etc_str + '<span>' + quantity + 'ê°</span><div class="price"><span>
14888' + number_format(optionPrice) + '</span> ì</div></div>\ 14889 </div>\ 14890 </td></tr>\ 14891 '; 14892 14893 } 14894 modal_str += '</table>'; 14895 14896 14897 var status = []; 14898 for (var i=0;i<c_data.pdata.length;i++) { 14899 status.push(c_data.pdata[i].p_status); 14900 } 14901 modal_str += checkOrderConfirm; 14902 modal_str += '\ 14903 <div class="modal-sub-title order-cancel-content">구매íì ì ì§ííìê² ìµëê¹?</div>\ 14904 <div class="modal-comment order-cancel-content"></div>\ 14905 '; 14906 14907 14908 var ocModal = $(this).showModalFlat('구매 íì ', modal_str,true,true,function () { 14909 14910 var f = document.cancel_form; 14911 14912 ocModal.find('.cl-s-form-wrap').each(function() { 14913 var check_input = $(this).find('.cl-s-form-control'), 14914 val = check_input.val().trim(); 14915 14916 if(val.length == 0) { 14917 $(this).removeClass('error').addClass('empty'); 14918 $(this).find('.cl-s-control-label.error').remove(); 14919 } else { 14920 if($(this).hasClass('error')) { 14921 check_input.focus(); 14922 } 14923 } 14924 }); 14925 var checkCnt = 0; 14926 14927 $(".status-checkbox").each(function (i, index) { 14928 if ($(this).is(":checked") === true) { 14929 checkCnt++; 14930 } 14931 }); 14932 14933 if (checkCnt < 1) { 14934 alert('ìíì 1ê° ì´ì ì íí´ ì£¼ì¸ì'); 14935 return false; 14936 } 14937 14938 if(ocModal.find('.cl-s-form-wrap.empty, .cl-s-form-wrap.error').length > 0) { 14939 // ocModal.find('.cl-s-form-wrap.empty, .cl-s-form-wrap.error').eq(0).find('.cl-s-form-control').focus(); 14940 return false; 14941 } 14942 14943 if(ocModal.find("input[type='checkbox'].cancel-agree:visible").length && ocModal.find("input[type='checkbox'].cancel-agree:visible").length != ocModal.find("input[type='checkbox'].cancel-agree:visible:checked").length) { 14944 $(".point-used-cancel-agree-desc").show(); 14945 return false; 14946 } else { 14947 $(".point-used-cancel-agree-desc").hide(); 14948 } 14949 14950 $.processON(); 14951 14952 f.submit(); 14953 ocModal.modal('hide'); 14954 14955 },'ì·¨ì','íì¸','cl-s-order-cancel cl-modal cl-s-btn cover ', false, '', function() { 14956 var totalCnt = 0, totalNomalCheck = 0, nomalCheck = 0, price = 0, deliveryPrice = 0, 14957 $form = $('form[name="cancel_form"]'); 14958 14959 $('.status-checkbox').each(function(i, index) { 14960 if ($(this).is(":checked") === true) { 14961 price += ($(this).closest('.cl-s-product-jumbotron').find('.option-check').attr('data-optionPrice') * 1); 14962 totalCnt++; 14963 } 14964 14965 if ($(this).attr('data-type') == 'normal') { 14966 totalNomalCheck++; 14967 } 14968 }); 14969 14970 $('.cancel-info-data').on('change', function (e) { 14971 if($(this).hasClass('noneAll')) return; 14972 14973 var product_number = $(this).attr('data-product_number'); 14974 if($(this).attr('data-option_type') != 'A' && !$('input[name="order_number_ary[]"][data-product_number="' + product_number + '"][data-option_type!="A"]:not(:checked)').length) { 14975 $('input[name="order_number_ary[]"][data-product_number="' + product_number + '"][data-option_type="A"]').prop('checked',true); 14976 } else if($(this).attr('data-option_type') == 'A' && !$('input[name="order_number_ary[]"][data-product_number="' + product_number + '"][data-option_type!="A"]:not(:checked)').length && !$(this).prop('checked')) { 14977 $('input[name="order_number_ary[]"][data-product_number="' + product_number + '"][data-option_type!="A"]:last').prop('checked',fal
14977se); 14978 } 14979 14980 var totalCnt = 0, totalNomalCheck = 0, nomalCheck = 0; 14981 14982 $form.find('.order-cancel-content.extra-info').remove(); 14983 14984 if ($(this).hasClass('noneAll') === true) { 14985 if ($(this).hasClass('noneChecked') === true) { 14986 $(this).prop('checked', false); 14987 } else { 14988 $(this).prop('checked', true); 14989 $(".status-checkbox").each(function () { 14990 if ($(this).prop('disabled') !== true) $(this).prop('checked', true); 14991 }); 14992 } 14993 } 14994 14995 $(".status-checkbox").each(function (i, index) { 14996 if ($(this).is(":checked") === true) { 14997 price += ($(this).closest('.cl-s-product-jumbotron').find('.option-check').attr('data-optionPrice') * 1); 14998 totalCnt++; 14999 if ($(this).attr('data-type') == 'normal') nomalCheck++; 15000 } 15001 15002 if ($(this).attr('data-type') == 'normal') totalNomalCheck++; 15003 }); 15004 15005 if($('input[name="order_number_ary[]"]').length == $('input[name="order_number_ary[]"]:checked').length) $('#product-check').prop('checked', true); 15006 else $('#product-check').prop('checked', false); 15007 }); 15008 15009 $(document).on('click', '#product-check', function () { 15010 15011 $form.find('.order-cancel-content.extra-info').remove(); 15012 if ($(this).hasClass('noneAll') === true) { 15013 $(this).prop('checked', true); 15014 $(".status-checkbox").each(function () { 15015 if ($(this).prop('disabled') !== true) $(this).prop('checked', true).change(); 15016 }); 15017 } 15018 if ($(this).is(":checked") === true) { 15019 $(".status-checkbox").each(function (i) { 15020 if ($(this).prop('disabled') !== true) { 15021 $(this).prop('checked', true).change(); 15022 } 15023 15024 }); 15025 } else { 15026 $(".status-checkbox").each(function () { 15027 if ($(this).prop('disabled') !== true) $(this).prop('checked', false).change(); 15028 }); 15029 } 15030 }); 15031 15032 ocModal.find('[data-toggle="popover"]').popover(); 15033 }); 15034 15035 },'json'); 15036 $('.close-button-dialog').css({'display': 'block'}); 15037 }, 15038 editReviewModal: function(sid, pnum, onum, seq) { 15039 if(typeof sid == "undefined" || typeof pnum == "undefined" || typeof onum == "undefined") { 15040 alert('ì ë³´ê° ì¬ë°ë¥´ì§ ììµëë¤'); 15041 return false; 15042 } 15043 $.post('/_check_review', { sid:sid, seq: seq, mode:'review' }, function(data) { 15044 15045 if(typeof data.error != "undefined" && data.error) { 15046 $(this).showModalFlat('', data.error, true, false, '', 'close'); 15047 return false; 15048 } 15049 15050 var c_data = data.r, 15051 modal_str = '\ 15052 <div class="review-body review-write-body">\ 15053 <div class="cl-s-product-jumbotron clearfix">\ 15054 <div class="cl-s-product-thumb">\ 15055 <a href="' + c_data.pdata.product_url + '" target="_blank"><img src="' + c_data.pdata.img + '" alt="' + c_data.pdata.name + '" class="' + c_data.pdata.img_align + '" onerror="this.src=\'//storage.googleapis.com/i.addblock.net/img_broken_fill_500.png\'"/></a>\ 15056 </div>\ 15057 <div class="cl-s-product-info">\ 15058 <h5 class="cl-s-product-title"><a href="' + c_data.pdata.product_url + '" target="_blank">' + c_data.pdata.name + '</a></h5>\ 15059 '; 15060 let use_review_img_upload = (typeof c_data.use_review_img_upload != 'undefined' && c_data.use_review_img_upload)? c_data.use_review_img_upload : 'true'; 15061 var option_title = (c_data.pdata.option_type == 'A') ? 'ì¶ê°ìµì : ' + (c_data.pdata.option_group ? c_data.pdata.option_group + ': ' : '') : 'ìµì : '; 15062 if(typeof c_data.pdata.option != "undefined" && c_data.pdata.option) { 15063 modal_str += (c_data.pdata.option_text_str)? '\ 15064 <div class="option-str">' + option_title + c_data.pdata.option + ' / ' + c_data.pdata.option_text_str + '</div>\ 15065 ' : '\ 15066 <div class="option-str">' + option_title + c_data.pdata.option + '</div>\ 15067 '; 15068 } else { 15069 modal_str += (c_data.pdata.option_text_str)? '\ 15070 <div class="option-str">' + option_title + c_data.pdata.option_text_str + '</div>\ 15071 ' : ''; 15072 } 15073 if(typeof c_data.pdata.etc_date != "undefined" && c_data.pdata.etc_date) { 15074 modal_str += '\ 15075 <div class="option-str">ì íì¼ì: ' + c_data.pdata.etc_date + '</div>\ 15076 '; 15077 } 15078 var image = c_data.review.review_image.split("||").filter(function(v){return v!==''}); 15079 var image_orig = c_data.review.review_image_orig.split("||").filter(function(v){return v!==''}); 15080 var reviewImage = ''; 15081 if(image.length > 0) { 15082 for (var i=0;i<image.length;i++) {
15083 reviewImage += '\ 15084 <li id="review-image-'+i+'">\ 15085 <img src="'+image[i]+'" class="img-responsive" />\ 15086 <input type="hidden" name="review_image[]" value="'+image[i]+'" />\ 15087 <input type="hidden" name="review_image_orig[]" value="'+image_orig[i]+'" />\ 15088 <div class="cl-s-files-img-close review-img-close"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 8 8" width="8" height="8"><path d="M4.71 4l3.15-3.15c0.2-0.2 0.2-0.51 0-0.71s-0.51-0.2-0.71 0L4 3.29 0.85 0.15c-0.2-0.2-0.51-0.2-0.71 0s-0.2 0.51 0 0.71L3.29 4 0.15 7.15c-0.2 0.2-0.2 0.51 0 0.71C0.24 7.95 0.37 8 0.5 8s0.26-0.05 0.35-0.15L4 4.71l3.15 3.15C7.24 7.95 7.37 8 7.5 8s0.26-0.05 0.35-0.15c0.2-0.2 0.2-0.51 0-0.71L4.71 4z"/></svg></div>\ 15089 </li>\ 15090 '; 15091 } 15092 } 15093 15094 modal_str += '\ 15095 </div>\ 15096 </div>\ 15097 <div class="review-star">\ 15098 <h5>ìíì´ ë§ì¡±ì¤ë¬ì°ì ¨ëì?</h5>\ 15099 <div class="star text-center">'; 15100 for(var i=0;i<5;i++) { 15101 var rs_onof = (i < c_data.review.review_score) ? 'active' : ''; 15102 modal_str += '<span data-idx="'+(i+1)+'" class="'+rs_onof+'"></span>'; 15103 } 15104 modal_str += '\ 15105 </div>\ 15106 </div>\ 15107 <div class="review-content">\ 15108 <h5>ì´ë¤ ì ì´ ì¢ìëì?</h5>\ 15109 <div class="cl-s-form-wrap">\ 15110 <div class="cl-s-form-group input-label-hide">\ 15111 <textarea class="cl-s-form-control" id="review-str" name="review" maxlength="1000" required="required">'+c_data.review.review+'</textarea>\ 15112 <label for="input" class="cl-s-control-label">ìì¸í ë´ì©ì ì ì´ì£¼ì¸ì. (1000ì ì´ë´)</label>\ 15113 </div>\ 15114 </div>\ 15115 '; 15116 if(use_review_img_upload != 'false') { 15117 modal_str += '\ 15118 <div class="cl-s-files review-files">\ 15119 <input id="review-file" type="file" name="files[]" multiple data-sid="' + sid + '" data-uid=\"' + c_data.writer.id + '\" data-seq=\"'+seq+'\">\ 15120 <label class="cl-s-file-update review-file-update display-flex align-items-center justify-center"><svg viewBox="0 0 42 36" width="18" height="16"><path d="M36 6h-5l-3-5c0 0-0.71-1-1.99-1 -0.72 0-2.54 0-3.99 0 0 0-0.91 0-2.04 0 -1.45 0-3.27 0-3.99 0C14.71 0 14 1 14 1l-3 5H6c-3.31 0-6 2.69-6 6v18c0 3.31 2.69 6 6 6h30c3.31 0 6-2.69 6-6V12C42 8.69 39.31 6 36 6zM21 31c-5.52 0-10-4.48-10-10 0-5.52 4.48-10 10-10 5.52 0 10 4.48 10 10C31 26.52 26.52 31 21 31z"/><circle cx="21" cy="21" r="6"/></svg><span>ì¬ì§ 첨ë¶í기</span></label>\ 15121 <ul class="cl-s-files-list review-files-list clearfix" >\ 15122 '+reviewImage+'\ 15123 </ul>\ 15124 </div>\ 15125 '; 15126 } 15127 modal_str += '\ 15128 </div>\ 15129 </div>\ 15130 \ 15131 '; 15132 15133 // $('.flat-modal .modal').modal('hide'); 15134 var wrModal = $(this).showModalFlat('í기 ìì±', modal_str, true, true, function () { 15135 15136 var cl_s_f_body = $('.cl-s-product-review-write .review-content'); 15137 cl_s_f_body.find('.cl-s-form-wrap').each(function() { 15138 var check_input = $(this).find('.cl-s-form-control'), 15139 val = check_input.val().trim(); 15140 15141 if(val.length == 0) { 15142 $(this).removeClass('error').addClass('empty'); 15143 $(this).find('.cl-s-control-label.error').remove(); 15144 } else { 15145 if($(this).hasClass('error')) { 15146 check_input.focus(); 15147 } 15148 } 15149 }); 15150 15151 if(cl_s_f_body.find('.cl-s-form-wrap.empty, .cl-s-form-wrap.error').length > 0) { 15152 cl_s_f_body.find('.cl-s-form-wrap.empty, .cl-s-form-wrap.error').eq(0).find('.cl-s-form-control').focus(); 15153 return false;
15154 } 15155 15156 var review = $('#review-str').val().trim(), 15157 review_star = $('.cl-s-product-review-write .review-star .star .active').length, 15158 review_image = new Array(); 15159 review_image_orig = new Array(); 15160 $('input[name="review_image[]"]').each(function(i) { 15161 review_image[i] = $(this).val(); 15162 }); 15163 $('input[name="review_image_orig[]"]').each(function(i) { 15164 review_image_orig[i] = $(this).val(); 15165 }); 15166 15167 var review_data = { 15168 status : 'U', 15169 page_mode : 'product', 15170 pnum : pnum, 15171 onum : onum, 15172 seq : seq, 15173 mb_status : c_data.writer.status, 15174 review : review, 15175 review_count : review_star, 15176 review_image : review_image, 15177 review_image_orig : review_image_orig 15178 }; 15179 15180 if(c_data.writer.status == 'T') { 15181 review_data['name'] = c_data.odata.name; 15182 // review_data['order_group'] = c_data.order_data.group; 15183 } 15184 15185 $('.ok-button-dialog').prop('disabled', true); 15186 15187 $.post('/_review_write', { sid:sid, data:JSON.stringify(review_data) }, function(rw_data) { 15188 if(typeof rw_data.error != 'undefined' && rw_data.error) { 15189 $(this).showModalFlat('ERROR', rw_data.error, true, false, '', 'close'); 15190 return false; 15191 } 15192 15193 wrModal.modal('hide'); 15194 setTimeout(function () { 15195 location.reload(); 15196 }, 200); 15197 }, 'json'); 15198 15199 15200 15201 },'close','ìì í기','cl-s-product-review-write cl-modal cl-s-btn cover', true, '', function() { 15202 $('.cl-s-product-review-write .cl-s-form-group').on('click',function(e) { 15203 if($(e.target).hasClass('cl-s-form-group')) { 15204 $(e.target).find('.cl-s-form-control:not([type=hidden])').focus(); 15205 } 15206 }); 15207 15208 $('.cl-s-product-review-write .cl-s-form-control').on({ 15209 focus: function(e) { 15210 $(this).closest('.cl-s-form-wrap').addClass('active'); 15211 }, 15212 blur: function(e) { 15213 var val = $(this).val().trim(); 15214 15215 $(this).closest('.cl-s-form-wrap').removeClass('active'); 15216 if(val.length == 0) { 15217 $(this).closest('.cl-s-form-wrap').removeClass('error').addClass('empty'); 15218 $(this).closest('.cl-s-form-wrap').find('.cl-s-control-label.error').remove(); 15219 return false; 15220 } else { 15221 $(this).closest('.cl-s-form-wrap').removeClass('empty'); 15222 15223 var passEmoji = ($.inArray($(this).attr('name'),['review']) > -1) ? true : false, 15224 error_str = ''; 15225 if(!passEmoji && checkEmojis(val)) error_str = $.lang[LANG]['config.unable.emoji']; 15226 else if(val.length < 5) error_str = $.lang[LANG]['customsite.validate.message.minlengthto5']; 15227 15228 if(error_str.length > 0) { 15229 $(this).closest('.cl-s-form-wrap').addClass('error'); 15230 if($(this).parent().find('.cl-s-control-label.error').length > 0) { 15231 $(this).parent().find('.cl-s-control-label.error').html(error_str); 15232 } else { 15233 $(this).after('<label for="input" class="cl-s-control-label error">' + error_str + '</label>'); 15234 } 15235 return false;
15236 } 15237 } 15238 15239 $(this).closest('.cl-s-form-wrap').removeClass('error').removeClass('empty'); 15240 $(this).closest('.cl-s-form-wrap').find('.cl-s-control-label.error').remove(); 15241 } 15242 }); 15243 15244 15245 $(document).on('click', '.cl-s-product-review-write .review-img-close', {mode: 'review'}, deleteReviewQnaImg); 15246 15247 15248 $('.cl-s-product-review-write .review-file-update').on('click', function () { 15249 $("#review-file").click(); 15250 }); 15251 15252 $('.cl-s-product-review-write #review-file').on('click', {mode: 'review'}, uploadReviewQnaImg); 15253 15254 $('.cl-s-product-review-write .review-star .star span').on('click', function() { 15255 var rCount = $(this).attr('data-idx'); 15256 $(this).parent().children('span').removeClass('active'); 15257 $(this).addClass('active').prevAll('span').addClass('active'); 15258 }); 15259 15260 }); 15261 15262 },'json'); 15263 15264 }, 15265 viewReviewModal: function(sid, seq, page) { 15266 if(typeof sid == 'undefined' || typeof seq == 'undefined') { 15267 alert('ì ë³´ê° ì¬ë°ë¥´ì§ ììµëë¤'); 15268 return false; 15269 } 15270 15271 $.post('/_check_review', { sid:sid, seq:seq }, function(data) { 15272 if(typeof data.error != 'undefined' && data.error) { 15273 $(this).showModalFlat('', data.error, true, false, '', 'close'); 15274 return false; 15275 } 15276 15277 var c_data = data.r; 15278 var um_id = c_data.review.um_id; 15279 var writer = c_data.writer.id; 15280 var writerName = (um_id == writer)? c_data.review.name : c_data.review.masked_name; 15281 writerName = (c_data.writer.status == 'A')? c_data.review.name : writerName; 15282 var image = c_data.review.review_image.split("||").filter(function(v){return v!==''}); 15283 var reviewImage = ''; 15284 for (var i=0;i<image.length;i++) { 15285 reviewImage += '<img src="'+getServeImage(image[i], '800', '')+'">'; 15286 } 15287 15288 var modal_str = '\ 15289 <div class="review-body">\ 15290 <div class="cl-s-product-jumbotron clearfix">\ 15291 <div class="cl-s-product-thumb">\ 15292 <a href="' + c_data.pdata.product_url + '" target="_blank"><img src="' + c_data.pdata.img + '" alt="' + c_data.pdata.name + '" class="' + c_data.pdata.img_align + '" onerror="this.src=\'//storage.googleapis.com/i.addblock.net/img_broken_fill_500.png\'"/></a>\ 15293 </div>\ 15294 <div class="cl-s-product-info">\ 15295 <h5 class="cl-s-product-title"><a href="' + c_data.pdata.product_url + '" target="_blank">' + c_data.pdata.name + '</a></h5>\ 15296 '; 15297 var option_title = (c_data.pdata.option_type == 'A') ? 'ì¶ê°ìµì : ' + (c_data.pdata.option_group ? c_data.pdata.option_group + ': ' : '') : 'ìµì : '; 15298 if(typeof c_data.pdata.option != "undefined" && c_data.pdata.option) { 15299 modal_str += '\ 15300 <div class="option-str">' + option_title + c_data.pdata.option + '</div>\ 15301 '; 15302 } 15303 if(typeof c_data.pdata.etc_date != "undefined" && c_data.pdata.etc_date) { 15304 modal_str += '\ 15305 <div class="option-str">ì íì¼ì: ' + c_data.pdata.etc_date + '</div>\ 15306 '; 15307 } 15308 15309 c_data.review_status = (c_data.writer.status=='T' && page=='mypayment')? 'Y':c_data.review_status; 15310 modal_str += '\ 15311 </div>\ 15312 </div>\ 15313 <div class="review-member-info">\
15314 <span>' + (c_data.review.inflow=='NAVERPAY' ? '<svg class="ico-naverpay" viewBox="0 0 24 24" width="14" height="14"><polygon points="15.2 2.8 15.2 12.1 8.9 2.8 2 2.8 2 21.2 8.8 21.2 8.8 11.9 15.2 21.2 22 21.2 22 2.8 "></polygon></svg>' : '') + writerName + '<span class="view-review-date">' + c_data.review.reg_date + '</span></span>'; 15315 if (c_data.review_status == 'Y' || c_data.review_status == 'A' || c_data.writer.status == 'A') { 15316 modal_str += '<div class="review-edit-box" data-pnum="'+c_data.review.product_number+'" data-onum="'+c_data.review.order_number+'" data-ogroup="'+c_data.odata.order_group+'" data-seq="'+c_data.review.seq+'">'; 15317 if (c_data.review_status == 'Y' && c_data.review.status == 'N' && c_data.review.seq.indexOf('mlux|') == -1) { 15318 modal_str += '<button type="button" class="review-edit">ìì </button>'; 15319 modal_str += '<button type="button" class="review-delete">ìì </button>'; 15320 } 15321 if (c_data.writer.status == 'A' && c_data.review.seq.indexOf('mlux|') == -1) { 15322 modal_str += '<button type="button" class="review-delete">ìì </button>'; 15323 } 15324 modal_str += '</div>\ 15325 '; 15326 } 15327 modal_str += '\ 15328 </div>\ 15329 <div class="view-review-box">\ 15330 <div class="review-score">'; 15331 for(var i=0;i<5;i++) { 15332 var rs_onof = (i < c_data.review.review_score) ? 'on' : 'off'; 15333 modal_str += '<span class="re_starimg star_'+ rs_onof +'"><svg viewBox="0 0 15 15" width="15" height="15"><polygon points="15 5.8 9.78 4.77 7.5 0 5.22 4.77 0 5.8 3.59 9.55 2.93 15 7.5 12.61 12.07 15 11.41 9.55 "/></svg></span>'; 15334 } 15335 15336 if(c_data.review.inflow=='NAVERPAY') { 15337 if(c_data.review.review_image) { 15338 reviewImage = '<img src="' + c_data.review.review_image
15338+ '" />'; 15339 } else { 15340 reviewImage = ''; 15341 } 15342 } 15343 15344 modal_str += '\ 15345 </div>\ 15346 <div class="review-box-content">'+nl2br(c_data.review.review)+'</div>\ 15347 <div class="review-box-image">'+reviewImage+'</div>\ 15348 '; 15349 if(c_data.review.status == 'Y'){ 15350 modal_str += '\ 15351 <div class="review-box-content review-answer answer-content_'+seq+'">\ 15352 <div class="review-answer-info"><span>ê´ë¦¬ì<span class="view-review-date">'+c_data.review.answer_date+'</span></span></div>\ 15353 <div class="review-content">'+nl2br(c_data.review.answer)+'\ 15354 </div>'; //end review-answer-content 15355 if(c_data.writer.status == 'A') { 15356 modal_str += '\ 15357 <div class="answer-editor-button" data-pnum="'+c_data.review.product_number+'" data-onum="'+c_data.review.order_number+'" data-seq="'+c_data.review.seq+'">\ 15358 <button type="button" class="btn answer-modify-btn" data-seq="'+seq+'">ìì </button>\ 15359 <button type="button" class="btn answer-delete-btn" onclick="answerDelete('+seq+')">ëµê¸ ìì </button>\ 15360 </div>\ 15361 '; 15362 } 15363 modal_str += '\ 15364 </div>'; //end review-answer 15365 } 15366 15367 if(c_data.writer.status == 'A' && c_data.review.seq.indexOf('mlux|') == -1){ 15368 modal_str += '\ 15369 <div class="answer-editor answer-editor_'+seq+' answer_'+c_data.review.status+'">\ 15370 <div class="review-answer-info">ëµê¸</div>\ 15371 <textarea id="answer-'+seq+'" placeholder="ëµê¸ì ìì±í´ 주ì¸ì.">'+nl2br(c_data.review.answer)+'</textarea>\ 15372 <div class="answer-editor-button" data-pnum="'+c_data.review.product_number+'" data-onum="'+c_data.review.order_number+'" data-seq="'+c_data.review.seq+'">'; 15373 if(c_data.review.status == 'N'){ 15374 modal_str += '\ 15375 <button type="button" class="btn answer-submit-btn">ëµê¸ ë±ë¡</button>'; 15376 } 15377 else{ 15378 modal_str += '\ 15379 <button type="button" class="btn answer-cancel-btn">ì·¨ì</button>\ 15380 <button type="button" class="btn answer-submit-btn">ëµê¸ ìì </button>'; 15381 } 15382 modal_str += '\ 15383 </div>\ 15384 </div>'; 15385 } 15386 modal_str += '\ 15387 </div>\ 15388 </div>'; //end view-review-box 15389 15390 // $('.flat-modal .modal').modal('hide'); 15391 var wrModal = $(this).showModalFlat('ìí í기', modal_str, true, false, '', '','','cl-s-product-review-write cl-s-product-review-view cl-modal cl-s-btn cover', false, '', function () { 15392 $(document).off('click', '.review-edit'); 15393 $(document).on('click', '.review-edit', function (e) { 15394 e.stopPropagation(); 15395 var $parent = $(this).parent(), 15396 pnum = $parent.attr('data-pnum'), 15397 onum = $parent.attr('data-onum'), 15398 seq = $parent.attr('data-seq'); 15399 15400 $('.modal-backdrop').fadeOut(200); 15401 $('.modal').fadeOut(200); 15402 setTimeout(function () { 15403 $('.modal-backdrop').remove(); 15404 $('.modal').remove(); 15405 $('button[data-dismiss="modal"]').trigger('click'); 15406 $.shoppingmall.editReviewModal(sid, pnum, onum, seq); 15407 }, 200); 15408 }); 15409 15410 $(document).off('click', '.review-delete'); 15411 $(document).off('click', '.answer-modify-btn'); 15412 $(document).off('click', '.answer-cancel-btn'); 15413 $(document).off('click', '.answer-submit-btn'); 15414 15415 $(document).on('click', '.review-delete', function () { 15416 $this = $(this) 15417 var $parent = $(this).parent(), 15418 on = $parent.attr('data-onum'), 15419 og = $parent.attr('data-ogroup'); 15420 $.ajax({ 15421 url: '/_review_delete_chk', 15422 type: 'post', 15423 data: { 15424 review_og : og, 15425 review_on : on 15426 }, 15427 success: function (data) { 15428 var parsedData = JSON.parse(data); 15429 if(parsedData.result == true ){ 15430 if (confirm('ì ë§ë¡ ìì íìê² ìµëê¹?')) { 15431 var pnum = $parent.attr('data-pnum'), 15432 onum = $parent.attr('data-onum'), 15433 seq = $parent.attr('data-seq'), 15434 on = $parent.attr('data-onum'), 15435 og = $parent.attr('data-ogroup'); 15436 $.ajax({ 15437 url: '/_review_delete', 15438 type: 'post', 15439 data: { 15440 sid: sid, 15441 seq: seq, 15442 review_og : og, 15443 review_on : on 15444 }, 15445 success: function (data) { 15446 alert('ìì ê° ìë£ëììµëë¤.'); 15447 location.reload(); 15448 } 15449 }); 15450 } 15451 } else { 15452 console.log($(this),"2ë²") 15453 if($('.rv-cancel-paddingedit').length == 0) { 15454 $this.closest('.cl-s-product-review-view .modal-content').css('opacity','.5'); 15455 var modal = $(this).showModalFlat('í기 ìì ì ë°ë¥¸<br>ì ë¦½ê¸ íì ìë´','í기를 ìì íìë©´ í기 ìì± ì 립ê¸ì´ íìë©ëë¤.<br>í기를 ìì íìê² ìµëê¹?',true,true,function(){ 15456 var $parent = $this.parent(), 15457 pnum = $parent.attr('data-pnum'), 15458 onum = $parent.attr('data-onum'), 15459 seq = $parent.attr('data-seq'), 15460 on = $parent.attr('data-onum'), 15461 og = $parent.attr('data-ogroup'); 15462 15463 $.ajax({ 15464 url: '/_review_delete', 15465 type: 'post', 15466 data: { 15467 sid: sid, 15468 seq: seq, 15469 review_og : og, 15470 review_on : on 15471 }, 15472 success: function (data) { 15473 alert('ìì ê° ìë£ëììµëë¤.'); 15474 location.reload(); 15475 } 15476 }); 15477 },'cancel','ok','cl-cmmodal cl-s-btn w560 cl-p130 cl-p0 review-opacity rv-cancel-paddingedit','',function(){ 15478 $this.closest('.cl-s-product-review-view .modal-content').css('opacity','unset'); 15479 }, function() { 15480 $(document).on('click', '.ok-button-dialog', function (e) { 15481 $(this).prop("disabled", true); 15482 }); 15483 $(document).on('keydown', function(e) { 15484 if(e.keyCode == 27) modal.modal('hide'); 15485 }); 15486 }, function() { 15487 $this.closest('.cl-s-product-review-view .modal-content').css('opacity','unset'); 15488 }); 15489 } 15490 } 15491 } 15492 }); 15493 15494 }); 15495 15496 $(document).on('click', '.answer-modify-btn', function(){ 15497 var $parent = $(this).parent(), 15498 pnum = $parent.attr('data-pnum'), 15499 onum = $parent.attr('data-onum'), 15500 seq = $parent.attr('data-seq'); 15501 15502 $('.answer-content_'+seq).hide(); 15503 $('.answer-editor_'+seq).show(); 15504 }); 15505 15506 $(document).on('click', '.answer-cancel-btn', function(){ 15507 var $parent = $(this).parent(), 15508 pnum = $parent.attr('data-pnum'), 15509 onum = $parent.attr('data-onum'), 15510 seq = $parent.attr('data-seq'); 15511 15512 $('.answer-content_'+seq).show(); 15513 $('.answer-editor_'+seq).hide(); 15514 }); 15515 15516 $(document).on('click', '.answer-submit-btn', function(){ 15517 var $parent = $(this).parent(), 15518 pnum = $parent.attr('data-pnum'), 15519 onum = $parent.attr('data-onum'), 15520 seq = $parent.attr('data-seq'); 15521 15522 $.ajax({ 15523 url: '/_review_msg_write', 15524 type: 'post', 15525 data: { 15526 sid: sid, 15527 seq: seq, 15528 review_admin_msg: $('#answer-'+seq).val() 15529 }, 15530 success: function (data) { 15531 alert('ëµê¸ì´ ë±ë¡ëììµëë¤.'); 15532 location.reload(); 15533 } 15534 }); 15535 }); 15536 15537 $(document).on('click', '.answer-delete-btn', function(){ 15538 if (confirm('ì ë§ë¡ ìì íìê² ìµëê¹?')) { 15539 var $parent = $(this).parent(), 15540 pnum = $parent.attr('data-pnum'), 15541 onum = $parent.attr('data-onum'), 15542 seq = $parent.attr('data-seq'); 15543 15544 $.ajax({ 15545 url: '/_review_msg_write', 15546 type: 'post', 15547 data: { 15548 sid: sid, 15549 seq: seq, 15550 }, 15551 success: function (data) { 15552 alert('ëµê¸ì´ ìì ëììµëë¤.'); 15553 location.reload(); 15554 } 15555 }); 15556 } 15557 }); 15558 }); 15559 15560 15561 },'json'); 15562 15563 }, 15564 editQnAModal: function(sid, pnum, seq, onum) { 15565 if(typeof property == 'undefined') { 15566 // alert('í¸ì§ëª¨ëìì ì§ìíì§ ììµëë¤'); 15567 var modal = $(this).showModalFlat('','í¸ì§ëª¨ëìì ì§ìíì§ ììµëë¤',true,false,'','ok','','cl-cmmodal cl-s-btn w560 cl-p130 cl-t80 cl-modal cl-none-title cl-close-btn','','',function() { 15568 $(document).on('keydown', function(e) { 15569 if(e.keyCode == 27) modal.modal('hide'); 15570 }); 15571 }); 15572 return false;
15573 } 15574 if(typeof property.LOAD != 'undefined' && property.LOAD == 'RENDER') { 15575 alert('미리보기ììë ì§ìíì§ ììµëë¤'); 15576 return false; 15577 } 15578 if(typeof seq == 'undefined' || seq == '') seq = -1; 15579 var mode = (seq == -1) ? 'new' : 'edit'; 15580 var onum = (typeof onum == 'undefined' || onum == '')? '':onum; 15581 15582 $.ajax({ 15583 url: '/_qna_edit', 15584 type: 'POST', 15585 dataType: 'json', 15586 data: { sid:sid, pnum:pnum, seq:seq, mode:mode }, 15587 async: false, 15588 cache: false, 15589 success: function(data) { 15590 if (data.result == 'fail') { 15591 location.href = '/_login'; 15592 return false; 15593 } 15594 15595 if (data.error) { 15596 $(this).showModalFlat('', data.error, true, false, '', 'close'); 15597 return false; 15598 } 15599 15600 var status = data.um_status; 15601 if(status == 'A') { 15602 alert('ê´ë¦¬ìë ìí문ìí기를 ì¬ì©í ì ììµëë¤.'); 15603 return false; 15604 } 15605 15606 var qna_files_str = qna_secret_str = qna_answer_email_str = qna_answer_alimtalk_str = ''; 15607 15608 if(mode == 'edit') { 15609 if(data['secret'] == 'Y') qna_secret_str = 'checked'; 15610 if(data['answer_email'] == 'Y') qna_answer_email_str = 'checked'; 15611 if(data['answer_alimtalk'] == 'Y') qna_answer_alimtalk_str = 'checked'; 15612 15613 if(data['qna_image']) { 15614 var image = data['qna_image'].split('||').filter(function(v){return v!==''}); 15615 var image_orig = data['qna_image_orig'].split('||').filter(function(v){return v!==''}); 15616 $.each(image, function(i,v) { 15617 qna_files_str += '\ 15618 <li id="qna-image-' + i + '">\ 15619 <img src="' + v + '" class="img-responsive" />\ 15620 <input type="hidden" name="qna_image[]" value="' + v + '"/>\ 15621 <input type="hidden" name="qna_image_orig[]" value="' + image_orig[i] + '"/>\ 15622 <div class="cl-s-files-img-close qna-img-close"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 8 8" width="8" height="8"><path d="M4.71 4l3.15-3.15c0.2-0.2 0.2-0.51 0-0.71s-0.51-0.2-0.71 0L4 3.29 0.85 0.15c-0.2-0.2-0.51-0.2-0.71 0s-0.2 0.51 0 0.71L3.29 4 0.15 7.15c-0.2 0.2-0.2 0.51 0 0.71C0.24 7.95 0.37 8 0.5 8s0.26-0.05 0.35-0.15L4 4.71l3.15 3.15C7.24 7.95 7.37 8 7.5 8s0.26-0.05 0.35-0.15c0.2-0.2 0.2-0.51 0-0.71L4.71 4z"></path></svg></div>\ 15623 </li>\ 15624 '; 15625 }); 15626 } 15627 } 15628 data['email'] = (data['email'] !== null)? data['email']:''; 15629 seq = (seq !== -1)? seq:''; 15630 var qna_writer_str = (data['member']) ? '\ 15631 <input type="hidden" id="qna-name" class="cl-s-form-control" name="qna_name" value="' + data['name'] + '">\ 15632 <input type="hidden" id="qna-email" class="cl-s-form-control" name="qna_email" value="' + data['email'] + '">\ 15633 <input type="hidden" id="qna-tel" class="cl-s-form-control" name="qna_tel" value="' + data['tel'] + '">\ 15634 <input type="hidden" id="order-number" name="order_number" value="' + onum + '">\ 15635 ' : '\ 15636 <input type="hidden" id="order-number" name="order_number" value="' + onum + '">\ 15637 <ul class="qna-writer clearfix">\ 15638 <li>\ 15639 <div class="cl-s-form-wrap">\ 15640 <div class="cl-s-form-group">\ 15641 <input type="text" class="cl-s-form-control" id="qna-name" name="qna_name" required="required" value="' + data['name'] + '">\ 15642 <label for="input" class="cl-s-control-label">ì´ë¦</label>\ 15643 </div>\ 15644 </div>\ 15645 </li>\ 15646 <li>\ 15647 <div class="cl-s-form-wrap">\ 15648 <div class="cl-s-form-group">\ 15649 <input type="password" class="cl-s-form-control" id="qna-password" name="qna_password" required="required">\ 15650 <label for="input" class="cl-s-control-label">ë¹ë°ë²í¸</label>\ 15651 </div>\ 15652 </div>\ 15653 </li>\ 15654 </ul>\ 15655 '; 15656 15657 var qna_privacy_str = '\ 15658 <hr class="line"/>\ 15659 <div class="qna-privacy">\ 15660 '; 15661 if(!data['member']) { 15662 if(data['um_qna_fin'] == 'Y') { 15663 qna_privacy_str += '\ 15664 <div class="cl-s-checkbox">\ 15665 <label class="privacy-toggle" data-view="#qna-email-input">\ 15666 <input type="checkbox" id="qna-btn-email" name="answer_email" value="Y" ' + qna_answer_email_str + '>\ 15667 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path d="M13 0H3C1.3 0 0 1.3 0 3v10c0 1.7 1.3 3 3 3h10c1.7 0 3-1.3 3-3V3C16 1.3 14.7 0 13 0zM15 13c0 1.1-0.9 2-2 2H3c-1.1 0-2-0.9-2-2V3c0-1.1 0.9-2 2-2h10c1.1 0 2 0.9 2 2V13z"/></svg>\ 15668 <svg class="active" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path d="M13 0H3C1.34 0 0 1.34 0 3v10c0 1.66 1.34 3 3 3h10c1.66 0 3-1.34 3-3V3C16 1.34 14.66 0 13 0zM13.03 6.03l-5.5 5.5C7.38 11.68 7.19 11.75 7 11.75s-0.38-0.07-0.53-0.22l-3.5-3.5c-0.29-0.29-0.29-0.77 0-1.06s0.77-0.29 1.06 0L7 9.94l4.97-4.97c0.29-0.29 0.77-0.29 1.06 0S13.32 5.74 13.03 6.03z"/></svg>\ 15669 ì´ë©ì¼ë¡ ëµë³ìë£ ì림 ë°ê¸°\ 15670 </label>\ 15671 </div>\ 15672 <div class="cl-s-form-wrap" id="qna-email-input" style="display:' + ((qna_answer_email_str == 'checked')? 'block':'none') + ';">\ 15673 <div class="cl-s-form-group">\ 15674 <input type="text" class="cl-s-form-control" id="qna-email" name="qna_email" data-type="email" required="required" value="' + data['email'] + '">\ 15675 <label for="input" class="cl-s-control-label">ì´ë©ì¼ 주ì</label>\ 15676 </div>\ 15677 </div>\ 15678 '; 15679 if(data['talk_cnt'] > 0) { //alimtalk 15680 qna_privacy_str += '\ 15681 <div class="cl-s-checkbox">\ 15682 <label class="privacy-toggle" data-view="#qna-tel-input">\ 15683 <input type="checkbox" id="qna-btn-alimtalk" name="answer_alimtalk" value="Y" ' + qna_answer_alimtalk_str + '>\ 15684 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path d="M13 0H3C1.3 0 0 1.3 0 3v10c0 1.7 1.3 3 3 3h10c1.7 0 3-1.3 3-3V3C16 1.3 14.7 0 13 0zM15 13c0 1.1-0.9 2-2 2H3c-1.1 0-2-0.9-2-2V3c0-1.1 0.9-2 2-2h10c1.1 0 2 0.9 2 2V13z"/></svg>\ 15685 <svg class="active" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path d="M13 0H3C1.34 0 0 1.34 0 3v10c0 1.66 1.34 3 3 3h10c1.66 0 3-1.34 3-3V3C16 1.34 14.66 0 13 0zM13.03 6.03l-5.5 5.5C7.38 11.68 7.19 11.75 7 11.75s-0.38-0.07-0.53-0.22l-3.5-3.5c-0.29-0.29-0.29-0.77 0-1.06s0.77-0.29 1.06 0L7 9.94l4.97-4.97c0.29-0.29 0.77-0.29 1.06 0S13.32 5.74 13.03 6.03z"/></svg>\ 15686 ì림í¡ì¼ë¡ ëµë³ìë£ ì림 ë°ê¸°\ 15687 </label>\ 15688 </div>\ 15689 <div class="cl-s-form-wrap" id="qna-tel-input" style="display:' + ((qna_answer_alimtalk_str == 'checked')? 'block':'none') + ';">\ 15690 <div class="cl-s-form-group">\ 15691 <input type="text" class="cl-s-form-control" id="qna-tel" name="qna_tel" data-type="tel" required="required" value="' + data['tel'] + '">\ 15692 <label for="input" class="cl-s-control-label">
15692ì íë²í¸</label>\ 15693 </div>\ 15694 </div>\ 15695 '; 15696 } 15697 } 15698 qna_privacy_str += '\ 15699 <div class="cl-s-checkbox">\ 15700 <label>\ 15701 <input type="checkbox" id="qna-btn-privacy" name="qna_btn_privacy">\ 15702 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path d="M13 0H3C1.3 0 0 1.3 0 3v10c0 1.7 1.3 3 3 3h10c1.7 0 3-1.3 3-3V3C16 1.3 14.7 0 13 0zM15 13c0 1.1-0.9 2-2 2H3c-1.1 0-2-0.9-2-2V3c0-1.1 0.9-2 2-2h10c1.1 0 2 0.9 2 2V13z"/></svg>\ 15703 <svg class="active" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path d="M13 0H3C1.34 0 0 1.34 0 3v10c0 1.66 1.34 3 3 3h10c1.66 0 3-1.34 3-3V3C16 1.34 14.66 0 13 0zM13.03 6.03l-5.5 5.5C7.38 11.68 7.19 11.75 7 11.75s-0.38-0.07-0.53-0.22l-3.5-3.5c-0.29-0.29-0.29-0.77 0-1.06s0.77-0.29 1.06 0L7 9.94l4.97-4.97c0.29-0.29 0.77-0.29 1.06 0S13.32 5.74 13.03 6.03z"/></svg>\ 15704 <a href="javascript:;" class="qna-view-privacy privacy-toggle" data-view="#qna-privacy-textarea">ê°ì¸ì ë³´ ìì§ ë° ì´ì©</a>ì ëìí©ëë¤.\ 15705 </label>\ 15706 </div>\ 15707 <div class="qna-privacy-textarea hide" name="privacy_textarea" id="qna-privacy-textarea" style="display:none;">\ 15708 â» ë¹íì ìë¹ì¤ë¬¸ì를 ìí ê°ì¸ì ë³´ ìì§Â·ì´ì© ëì(íì)<br>\ 15709 ìë¹ì¤ ì´ì©ìì ê°ì¸ì 보를 ìì§íë 목ì ì ë¤ìê³¼ ê°ìµëë¤.\ 15710 <table>\ 15711 <colgroup>\ 15712 <col width="25%">\ 15713 <col width="45%">\ 15714 <col width="30%">\ 15715 </colgroup>\ 15716 <thead>\ 15717 <tr>\ 15718 <th>ìì§ëª©ì </th>\ 15719 <th>ìì§í목</th>\ 15720 <th>ì´ì©ê¸°ê°</th>\ 15721 </tr>\ 15722 </thead>\ 15723 <tbody>\ 15724 <tr>\ 15725 <td>문ì ìë ë° ìë¹ì¤ ê°ì </td>\ 15726 <td>(íì) ì´ë¦, ì´ë©ì¼, 문ìë´ì©</td>\ 15727 <td>문ì ì¢ ë£ì¼ë¡ 5ë </td>\ 15728 </tr>\ 15729 </tbody>\ 15730 </table>\ 15731 <br>\ 15732 - ëì를 ê±°ë¶í ê¶ë¦¬ê° ìì¼ë, ëìê±°ë¶ì ë°ë¥¸ ìë¹ì¤ ì´ì©ì ì íì´ ìì ì ììµëë¤.<br>\ 15733 - íì¬ë ê³ì½ ë° ìë¹ì¤ ì´íì ìí´ ê°ì¸ì ë³´ ì²ë¦¬ì 무를 ìíí ì ìì¼ë©°, ê°ì¸ì ë³´ì²ë¦¬ë°©ì¹¨ì ê·¸ ë´ì©ì ê³ ì§í©ëë¤.<br>\ 15734 </div>\ 15735 '; 15736 } else { 15737 if(data['um_qna_fin'] == 'Y') { 15738 qna_privacy_str += '\ 15739 <div class="cl-s-checkbox">\ 15740 <label>\ 15741 <input type="checkbox" id="qna-btn-email" name="answer_email" value="Y" ' + qna_answer_email_str + '>\ 15742 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path d="M13 0H3C1.3 0 0 1.3 0 3v10c0 1.7 1.3 3 3 3h10c1.7 0 3-1.3 3-3V3C16 1.3 14.7 0 13 0zM15 13c0 1.1-0.9 2-2 2H3c-1.1 0-2-0.9-2-2V3c0-1.1 0.9-2 2-2h10c1.1 0 2 0.9 2 2V13z"/></svg>\ 15743 <svg class="active" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path d="M13 0H3C1.34 0 0 1.34 0 3v10c0 1.66 1.34 3 3 3h10c1.66 0 3-1.34 3-3V3C16 1.34 14.66 0 13 0zM13.03 6.03l-5.5 5.5C7.38 11.68 7.19 11.75 7 11.75s-0.38-0.07-0.53-0.22l-3.5-3.5c-0.29-0.29-0.29-0.77 0-1.06s0.77-0.29 1.06 0L7 9.94l4.97-4.97c0.29-0.29 0.77-0.29 1.06 0S13.32 5.74 13.03 6.03z"/></svg>\ 15744 ì´ë©ì¼ë¡ ëµë³ìë£ ì림 ë°ê¸°\ 15745 </label>\ 15746 </div>\ 15747 '; 15748 15749 if(data['talk_cnt'] > 0) { //alimtalk 15750 qna_privacy_str += '\ 15751 <div class="cl-s-checkbox">\ 15752 <label>\ 15753 <input type="checkbox" id="qna-btn-alimtalk" name="answer_alimtalk" value="Y" ' + qna_answer_alimtalk_str + '>\ 15754 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path d="M13 0H3C1.3 0 0 1.3 0 3v10c0 1.7 1.3 3 3 3h10c1.7 0 3-1.3 3-3V3C16 1.3 14.7 0 13 0zM15 13c0 1.1-0.9 2-2 2H3c-1.1 0-2-0.9-2-2V3c0-1.1 0.9-2 2-2h10c1.1 0 2 0.9 2 2V13z"/></svg>\ 15755 <svg class="active" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path d="M13 0H3C1.34 0 0 1.34 0 3v10c0 1.66 1.34 3 3 3h10c1.66 0 3-1.34 3-3V3C16 1.34 14.66 0 13 0zM13.03 6.03l-5.5 5.5C7.38 11.68 7.19 11.75 7 11.75s-0.38-0.07-0.53-0.22l-3.5-3.5c-0.29-0.29-0.29-0.77 0-1.06s0.77-0.29 1.06 0L7 9.94l4.97-4.97c0.29-0.29 0.77-0.29 1.06 0S13.32 5.74 13.03 6.03z"/></svg>\ 15756 ì림í¡ì¼ë¡ ëµë³ìë£ ì림 ë°ê¸°\ 15757 </label>\ 15758 </div>\ 15759 '; 15760 } 15761 } 15762 } 15763 qna_privacy_str += '\ 15764 </div>\ 15765 '; //qna-privacy 15766 15767 var modal_str = '\ 15768 <div class="qna-body">\ 15769 <h5 class="product-title">' + data['ptitle'] + '</h5>\ 15770 ' + qna_writer_str + '\ 15771 <ul class="qna-content">\ 15772 <li>\ 15773 <div class="cl-s-form-wrap">\ 15774 <div class="cl-s-form-group">\ 15775 <input type="text" class="cl-s-form-control" id="qna-title" name="title" required="required" maxlength="100" value="' + data['title'] + '">\ 15776 <label for="input" class="cl-s-control-label">ì 목</label>\ 15777 </div>\ 15778 </div>\ 15779 </li>\ 15780 <li>\ 15781 <div class="cl-s-form-wrap">\ 15782 <div class="cl-s-form-group input-label-hide">\ 15783 <textarea type="text" class="cl-s-form-control" id="qna-str" name="qna" maxlength="500" required="required">' + data['qna'] + '</textarea>\ 15784 <label for="input" class="cl-s-control-label">ìì¸í ë´ì©ì ì ì´ì£¼ì¸ì. (500ì ì´ë´)</label>\ 15785 </div>\ 15786 </div>\ 15787 </li>\ 15788 <li class="last clearfix">\ 15789 <div class="qna-secret">\
15790 <div class="secret cl-s-checkbox">\ 15791 <label>\ 15792 <input type="checkbox" id="secret-checkbox" name="secret" value="Y" ' + qna_secret_str + '>\ 15793 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path d="M13 0H3C1.3 0 0 1.3 0 3v10c0 1.7 1.3 3 3 3h10c1.7 0 3-1.3 3-3V3C16 1.3 14.7 0 13 0zM15 13c0 1.1-0.9 2-2 2H3c-1.1 0-2-0.9-2-2V3c0-1.1 0.9-2 2-2h10c1.1 0 2 0.9 2 2V13z"/></svg>\ 15794 <svg class="active" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path d="M13 0H3C1.34 0 0 1.34 0 3v10c0 1.66 1.34 3 3 3h10c1.66 0 3-1.34 3-3V3C16 1.34 14.66 0 13 0zM13.03 6.03l-5.5 5.5C7.38 11.68 7.19 11.75 7 11.75s-0.38-0.07-0.53-0.22l-3.5-3.5c-0.29-0.29-0.29-0.77 0-1.06s0.77-0.29 1.06 0L7 9.94l4.97-4.97c0.29-0.29 0.77-0.29 1.06 0S13.32 5.74 13.03 6.03z"/></svg>\ 15795 ë¹ë°ê¸\ 15796 </label>\ 15797 </div>\ 15798 </div>\ 15799 <div class="cl-s-files qna-files f-left">\ 15800 <input id="qna-file" type="file" name="files[]" accept="image/jpeg,image/gif,image/png" multiple data-sid="' + sid + '" data-uid=\"' + data['um_id'] + '\" data-seq=\"'+seq+'\">\ 15801 <label class="cl-s-file-update qna-file-update clearfix"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" width="20" height="20"><path d="M0 0v20h20V0H0zM19 1v11.3l-3-3 -4 4 -6-6 -5 5V1H19zM1 19v-5.3l5-5 6 6 4-4 3 3V19H1z"/><circle cx="14.5" cy="5.5" r="1.5"/></svg> <span>ì¬ì§</span></label>\ 15802 <ul class="cl-s-files-list qna-files-list clearfix">\ 15803 ' + qna_files_str + '\ 15804 </ul>\ 15805 </div>\ 15806 </li>\ 15807 </ul>\ 15808 ' + qna_privacy_str + '\ 15809 </div>\ 15810 '; 15811 15812 15813 $('.flat-modal .modal').modal('hide'); 15814 var eqnaModal = $(this).showModalFlat('문ì ìì±', modal_str,true,true,function () { 15815 15816 var error_cnt = 0; 15817 var error_str = ''; 15818 var input_data = new Object(); 15819 15820 $('.cl-s-form-control').each(function(idx, v) { 15821 error_str = ''; 15822 if($(v).val().trim().length == 0) { 15823 if(!$('input[name="answer_email"]').is(':checked') && $(v).attr('name') == 'qna_email') return; 15824 if(!$('input[name="answer_alimtalk"]').is(':checked') && $(v).attr('name') == 'qna_tel') return; 15825 $(v).closest('.cl-s-form-wrap').addClass('empty'); 15826 error_str = 'íìí목ì ì ë ¥í´ì£¼ì¸ì.'; 15827 error_cnt++; 15828 if(error_cnt == 1) { 15829 alert(error_str); 15830 $(v).focus(); 15831 return true; 15832 } 15833 } else { 15834 $(v).closest('.cl-s-form-wrap').removeClass('empty'); 15835 var key = $(v).attr('name'); 15836 var val = $(v).val().trim(); 15837 var passEmoji = ($.inArray(key,['title','qna']) > -1) ? true : false; 15838 15839 if(!passEmoji && checkEmojis(val)) error_str = $.lang[LANG]['config.unable.emoji']; 15840 // else if(typeof regexp[key] != "undefined" && !regexp[key].test(val)) error_str = $.lang[LANG]['siteum.regexp.check.'+key]; 15841 15842 if(error_str && error_str.length > 0) { 15843 error_cnt ++; 15844 if(error_cnt == 1) $(v).focus(); 15845 15846 $(v).closest('.cl-s-form-wrap').addClass('error'); 15847 if($(v).closest('.cl-s-form-group').find('.cl-s-control-label.error').length > 0) { 15848 $(v).closest('.cl-s-form-group').find('.cl-s-control-label.error').html(error_str); 15849 } else { 15850 $(v).closest('.cl-s-form-group input').after('<label class="cl-s-control-label error">' + error_str + '</label>'); 15851 } 15852 } else { 15853 $(v).closest('.cl-s-form-wrap').removeClass('error'); 15854 $(v).closest('.cl-s-form-group').find('.cl-s-control-label.error').remove(); 15855 input_data[key] = $(v).val().trim(); 15856 } 15857 } 15858 15859 }); 15860 15861 15862 if(error_cnt > 0) { 15863 // alert(error_str); 15864 return false;
15865 } 15866 15867 if(status != 'U') { 15868 if(!$('#qna-btn-privacy').prop('checked')) { 15869 $("#qna-btn-privacy").addClass('error'); 15870 alert('ê°ì¸ì ë³´ ìì§ ë° ì´ì© ëìì ì²´í¬í´ 주ì¸ì.'); 15871 return false; 15872 } 15873 15874 if(!$('input[name="answer_email"]').is(':checked')) { 15875 input_data['qna_email'] = ''; 15876 } else { 15877 var regexp = { 15878 qna_email : /^[a-zA-Z0-9+-\_.]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$/i, 15879 }; 15880 if(typeof regexp['qna_email'] != "undefined" && !regexp['qna_email'].test(input_data['qna_email'])) { 15881 alert($.lang[LANG]['siteum.regexp.check.email']); 15882 input_data['qna_email'] = ''; 15883 $('#qna-email').closest('.cl-s-form-wrap').addClass('error'); 15884 return false; 15885 } 15886 } 15887 15888 if(!$('input[name="answer_alimtalk"]').is(':checked')) { 15889 input_data['qna_tel'] = ''; 15890 } else { 15891 if(input_data['qna_tel'].length > 0 && (input_data['qna_tel'].length < 10 || input_data['qna_tel'].length > 15)) { 15892 alert('ì¬ë°ë¥´ì§ ìì ë²í¸ ììì ëë¤.\në²í¸ë¥¼ ë¤ì íì¸í´ 주ì¸ì.'); 15893 input_data['qna_tel'] = ''; 15894 $('#qna-tel').closest('.cl-s-form-wrap').addClass('error'); 15895 return false; 15896 } 15897 } 15898 } 15899 15900 if($('.qna-files-list').children('li').length > 0) { 15901 var qna_files = ''; 15902 var qna_files_orig = ''; 15903 $('.qna-files-list').children('li').each(function() { 15904 if(qna_files != '') qna_files +='||'; 15905 qna_files += $(this).find('input[name="qna_image[]"]').val(); 15906 if(qna_files_orig != '') qna_files_orig +='||'; 15907 qna_files_orig += $(this).find('input[name="qna_image_orig[]"]').val(); 15908 }); 15909 } 15910 input_data['qna_image'] = (qna_files) ? qna_files : ''; 15911 input_data['qna_image_orig'] = (qna_files_orig) ? qna_files_orig : ''; 15912 input_data['secret'] = ($('#secret-checkbox').prop('checked')) ? 'Y' : ''; 15913 input_data['answer_email'] = ($('input[name="answer_email"]').prop('checked')) ? 'Y' : 'N'; 15914 input_data['answer_alimtalk'] = ($('input[name="answer_alimtalk"]').prop('checked')) ? 'Y' : 'N'; 15915 15916 var qna_status = { new:'S', edit:'E' }, 15917 page_type = (property.VIEW) ? 'product' : ''; 15918 15919 if($('.cl-s-mypage').length > 0) page_type = 'mypage'; 15920 else if($('.cl-s-nonmember-payment').length > 0) page_type = 'no_member'; 15921 15922 input_data['sid'] = sid; 15923 input_data['page_mode'] = page_type; 15924 input_data['qna_seq'] = (seq > 0) ? seq : ''; 15925 input_data['qna_type'] = 'P'; 15926 input_data['product_number'] = pnum; 15927 input_data['order_number'] = onum; 15928 input_data['status'] = qna_status[mode]; 15929 input_data['mb_status'] = status; 15930 input_data['qna_page'] = (property.VIEW) ? property.PAGE : ''; 15931 15932 $('.ok-button-dialog').prop('disabled', true).addClass('spinner'); 15933 $.ajax({ 15934 url: '/_qna_update', 15935 type: 'post', 15936 data: input_data, 15937 async: true, 15938 cache: false, 15939 success: function(data) { 15940 if(typeof data.error != 'undefined') { 15941 alert(data.error); 15942 return false;
15943 } 15944 location.reload(); 15945 }, 15946 error: function(request,status,error) { 15947 console.log('code:'+request.status+'\n'+'message:'+request.responseText+'\n'+'error:'+error); 15948 return false; 15949 } 15950 15951 }); 15952 15953 },'close','ë±ë¡í기','cl-s-product-qna-edit cl-modal cl-s-btn cover', true, '', function() { 15954 $('.cl-s-product-qna-edit .cl-s-form-group').on('click',function(e) { 15955 if($(e.target).hasClass('cl-s-form-group')) { 15956 $(e.target).find('.cl-s-form-control:not([type=hidden])').focus(); 15957 } 15958 }); 15959 15960 $('.cl-s-product-qna-edit .cl-s-form-control').on({ 15961 focus: function(e) { 15962 $(this).closest('.cl-s-form-wrap').addClass('active'); 15963 }, 15964 blur: function(e) { 15965 var type = $(this).attr('data-type'), 15966 // regexp = { 15967 // email : /^[a-zA-Z0-9+-\_.]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$/i 15968 // }, 15969 // checkRegexp = (typeof type != 'undefined' && typeof regexp[type] != 'undefined') ? true : false, 15970 passEmoji = ($.inArray($(this).attr('name'),['title','qna']) > -1) ? true : false, 15971 error_str = '', 15972 val = $(this).val().trim(); 15973 15974 $(this).closest('.cl-s-form-wrap').removeClass('active'); 15975 if(val.length == 0) { 15976 $(this).closest('.cl-s-form-wrap').removeClass('error').addClass('empty'); 15977 $(this).closest('.cl-s-form-wrap').find('.cl-s-control-label.error').remove(); 15978 return false; 15979 } else if(!passEmoji && checkEmojis(val)) error_str = $.lang[LANG]['config.unable.emoji']; 15980 // else if(checkRegexp && !regexp[type].test(val)) error_str = $.lang[LANG]['siteum.regexp.check.'+type]; 15981 15982 $(this).closest('.cl-s-form-wrap').removeClass('empty'); 15983 if(error_str.length > 0) { 15984 $(this).closest('.cl-s-form-wrap').addClass('error'); 15985 if($(this).parent().find('.cl-s-control-label.error').length > 0) { 15986 $(this).parent().find('.cl-s-control-label.error').html(error_str); 15987 } else { 15988 $(this).after('<label for="input" class="cl-s-control-label error">'+error_str+'</label>'); 15989 } 15990 return false; 15991 } else { 15992 $(this).closest('.cl-s-form-wrap').removeClass('error'); 15993 $(this).closest('.cl-s-form-wrap').find('.cl-s-control-label.error').remove(); 15994 } 15995 15996 } 15997 }); 15998 15999 $('.cl-s-product-qna-edit #qna-tel').on('keyup', function(e) { 16000 var txt = $(this).val(); 16001 var match = txt.match(/[0-9]+/g); 16002 $(this).val(match); 16003 }); 16004 16005 $('.cl-s-product-qna-edit #qna-btn-privacy').on('change', function(e) { 16006 if($(this).prop('checked')) $(this).removeClass('error'); 16007 else $(this).addClass('error'); 16008 }); 16009 16010 $(document).on('click', '.cl-s-product-qna-edit .qna-img-close', {mode: 'qna'}, deleteReviewQnaImg); 16011 16012 $('.cl-s-product-qna-edit .qna-file-update').on('click', function () { 16013 $("#qna-file").click(); 16014 }); 16015 16016 $('.cl-s-product-qna-edit #qna-file').on('click', {mode: 'qna'}, uploadReviewQnaImg); 16017 16018 $('label.privacy-toggle').on('change', function(e) { 16019 var $toggle = $($(this).attr('data-view')); 16020 if ($(this).find('input[type="checkbox"]').is(':checked')) { 16021 $toggle.removeClass('hide'); 16022 $toggle.slideDown(300); 16023 } else { 16024 $toggle.slideUp(300, function() { 16025 $toggle.addClass('hide'); 16026 }); 16027 } 16028 }); 16029 16030 $('a.privacy-toggle').on('click', function(e) { 16031 e.preventDefault(); 16032 var $toggle = $($(this).attr('data-view')); 16033 if ($toggle.hasClass('hide')) { 16034 $toggle.removeClass('hide'); 16035 $toggle.slideDown(300); 16036 } else { 16037 $toggle.slideUp(300, function() { 16038 $toggle.addClass('hide'); 16039 }); 16040 } 16041 }); 16042 16043 }, function(){
16044 if(qna_files_str.length === 0){ 16045 if($('.cl-s-product-qna-edit .qna-img-close').length > 0){ 16046 $.each($('.cl-s-product-qna-edit .qna-img-close'), function(){ 16047 $(this).trigger('click'); 16048 }); 16049 } 16050 } 16051 }); 16052 16053 }, 16054 error: function(request,status,error) { 16055 console.log('code:'+request.status+'\n'+'message:'+request.responseText+'\n'+'error:'+error); 16056 return false; 16057 } 16058 }); 16059 16060 }, 16061 orderReceiptModal: function(sid, ogroup, refund) { 16062 16063 $.post('/_check_receipt', { sid:sid, order_group:ogroup, mode:'default', refund : refund }, function(data) { 16064 16065 if(typeof data.error != 'undefined' && data.error) { 16066 $(this).showModalFlat('ERROR', data.error, true, false, '', 'ok'); 16067 return false; 16068 } 16069 16070 var d_price = (typeof data.r.delivery_price != 'undefined' && data.r.delivery_price) ? data.r.delivery_price : 0, 16071 d_price_str = number_format(d_price) + ' ì', 16072 o_list_cnt = data.r.list.length, 16073 o_org_total = 0, 16074 o_total = 0; 16075 16076 var orm_html = '\ 16077 <div class="receipt-wrap">\ 16078 <table>\ 16079 <colgroup>\ 16080 <col width="*" />\ 16081 <col width="120px" />\ 16082 <col width="100px" />\ 16083 </colgroup>\ 16084 \ 16085 <thead>\ 16086 <tr>\ 16087 <th>ìíì ë³´</th>\ 16088 <th>ìíê°ê²©</th>\ 16089 <th>ë°°ì¡ë¹<span class="visible-xs"> ' + d_price_str + '</span></th>\ 16090 </tr>\ 16091 </thead>\ 16092 <tbody>\ 16093 '; 16094 16095 var refund_count = 0, list_count = 0; 16096 $.each(data.r.list, function(i, val) { 16097 if(refund) { 16098 if(val['d_status'] == 'CY' || val['d_status'] == 'RY') ; 16099 else { 16100 return true; 16101 } 16102 } 16103 16104 var option_name = (!$.isEmptyObject(val['option_list']) && val['option_list']['option_name']) ? val['option_list']['option_name'] : '', 16105 option_type = (val['option_list']['option_type']=='A') ? 'ì¶ê°ìµì ' : 'ìµì ', 16106 option_str = ''; 16107 if(val['option_list']['option_type']=='A' && val['option_list']['option_group']) { 16108 option_type = option_type + ' : ' + val['option_list']['option_group']; 16109 } 16110 if(option_name && option_name!='noneOption') { 16111 option_str = (val['option_list']['option_text_str']) ? '<span>'+option_type+' : ' + option_name + '/' + val['option_list']['option_text_str'] + '</span>' : '<span>'+option_type+' : ' + option_name + '</span>'; 16112 } else { 16113 option_str = (val['option_list']['option_text_str']) ? '<span>'+option_type+' : ' + val['option_list']['option_text_str'] + '</span>' : ''; 16114 } 16115 var checkSale = (typeof val['option_list']['sale_price'] != "undefined" && val['option_list']['sale_price']) ? true : false, 16116 oi_org_price = (checkSale) ? val['option_list']['sale_price'] : val['option_list']['price'], 16117 oi_price = val['option_list']['price'], 16118 oi_quantity = val['option_list']['quantity'], 16119 oi_sum = oi_price * oi_quantity, 16120 rowspan = 0; 16121 16122 if(refund) { 16123 rowspan = data.r.refund; 16124 } else { 16125 rowspan = o_list_cnt; 16126 } 16127 o_org_total += (oi_org_price * oi_quantity); 16128 o_total += oi_sum; 16129 16130 orm_html += '\ 16131 <tr class="or-grid">\ 16132 <td class="mp-info">\ 16133 <div class="cl-s-product-jumbotron clearfix">\ 16134 <div class="cl-s-product-thumb">\ 16135 <img src="' + val["pimg"] + '" alt="' + val["pname"] + '" class="img-responsive"/>\ 16136 </div>\ 16137 <div class="cl-s-product-info">\ 16138 <h5 class="cl-s-product-title">' + val["pname"] + '</h5>\ 16139 <div class="option-str">\ 16140 <div>\
16141 <span class="visible-xs option-price">' + number_format(oi_sum) + ' ì</span>\ 16142 ' + option_str + '\ 16143 <span>' + oi_quantity + 'ê°</span>\ 16144 </div>'; 16145 if(val["etc_info"]) { 16146 orm_html += '\ 16147 <div>ì íì¼ì : '+val["etc_info"]+'</div>'; 16148 } 16149 orm_html += '\ 16150 </div>\ 16151 </div>\ 16152 </div>\ 16153 </td>\ 16154 <td>' + number_format(oi_sum) + ' ì</td>\ 16155 '; 16156 16157 if(list_count == 0) orm_html += '<td rowspan="' + ((rowspan) ? rowspan : '') + '">' + d_price_str + '</td>'; 16158 list_count++; 16159 16160 orm_html += '\ 16161 </tr>\ 16162 '; 16163 16164 }); 16165 16166 orm_html += '\ 16167 </tbody> \ 16168 </table>\ 16169 <p class="description">íê¸ììì¦ì ë°ê¸ ìë£ë 주문건ì íí´ ì¡°í ë° ì¶ë ¥ì´ ê°ë¥íë©°, 구매íì ì¼ ê¸°ì¤ì¼ë¡ ë°ê¸ë©ëë¤.<br>ì ì©ì¹´ë ë§¤ì¶ ì íë ê²°ì ìë£ ì ìë ë°ê¸ëë©°, ê²°ì ìë£ í íì¸ ë° ì¶ë ¥ì´ ê°ë¥í©ëë¤.\ 16170 '; 16171 16172 if(data.r.class_cd == 'PAKM') { 16173 orm_html += '\ 16174 <br>ì¹´ì¹´ì¤íì´ë¨¸ë ê²°ì ê±´ì ì¹´ì¹´ì¤íì´ APPìì ì íë°íì´ ì ê³µë©ëë¤.\ 16175 '; 16176 } 16177 16178 orm_html += '</p>\ 16179 '; 16180 16181 16182 orm_html += '\ 16183 <div class="receipt-btn-box">\ 16184 '; 16185 if(data.r.pay_method != '무íµì¥ ì ê¸' && data.r.class_cd != 'PAKM' && data.r.pay_method != 'í¬ì¸í¸ ê²°ì ') { 16186 orm_html += '<span class="cl-s-btn cl-s-btn-12 cl-s-btn-primary btn-card-slip" data-tno="' + data.r.tno + '">ì¹´ëì í</span>'; 16187 } 16188 orm_html += '\ 16189 <span class="cl-s-btn cl-s-btn-12 cl-s-btn-primary btn-receipt-details ' + ((refund == true) ? 'refund' : '') + '">' + ((refund == true) ? 'íë¶ììì¦' : '구매ììì¦') + '</span>\ 16190 </div>\ 16191 <span class="cl-s-btn cl-s-btn-12 cl-s-btn-default btn-order-receipt-close">ë«ê¸°</span>\ 16192 </div">\ 16193 '; 16194 var title = (refund) ? 'íë¶ ììì¦ ë°ê¸ë´ì' : 'ììì¦ ë°ê¸ë´ì'; 16195 var orModal = $(this).showModalFlat(title, orm_html, true, false, '', 'close', '', 'cl-s-receipt cl-modal cover', false, '', function() { 16196 $('.btn-order-receipt-close').on('click', function() { 16197 orModal.modal('hide'); 16198 }); 16199 16200 $('.btn-card-slip').on('click', function() { 16201 var tno = $(this).data('tno'); 16202 if(data.r.class_cd == 'PANP') { 16203 window.open('https://new-m.pay.naver.com'); 16204 } else if(isNaN(tno)) { // nicepay 16205 window.open('https://npg.nicepay.co.kr/issue/IssueLoader.do?type=0&TID='+tno, '', 'width=800, height=700, toolbar=no, menubar=no, scrollbars=no, resizable=yes'); 16206 } else { // kcp 16207 // window.open('https://www.kcp.co.kr/center.paysearch.do', '', 'width=1000,height=500,scrollbars=yes'); 16208 window.open('https://www.kcp.co.kr/viewPaymentParent/viewPayment', '', 'width=1200,height=860,scrollbars=yes'); 16209 } 16210 16211 }); 16212 16213 $('.btn-receipt-details').on('click', function() { 16214 var refund = ($(this).hasClass('refund')) ? true : false;
16215 $.shoppingmall.orderReceiptDetailModal(sid, ogroup, refund); 16216 }); 16217 16218 }); 16219 16220 }, 'json'); 16221 16222 }, 16223 orderReceiptDetailModal: function(sid, ogroup, refund) { 16224 16225 $.post('/_check_receipt', { sid:sid, order_group:ogroup, mode:'detail', refund : refund }, function(data) { 16226 16227 if(typeof data.error != 'undefined' && data.error) { 16228 $(this).showModalFlat('ERROR', data.error, true, false, '', 'ok'); 16229 return false; 16230 } 16231 var ordm_html = '\ 16232 <div class="receipt-wrap">\ 16233 <table>\ 16234 <colgroup>\ 16235 <col width="25%" />\ 16236 <col width="75%" />\ 16237 </colgroup>\ 16238 \ 16239 <tbody id="receipt-list">\ 16240 <tr>\ 16241 <td><span>주문ë²í¸</span><br>ORDER NO.</td>\ 16242 <td>' + ogroup + '</td>\ 16243 </tr>'; 16244 if(refund) { 16245 ordm_html+= '\ 16246 <tr>\ 16247 <td><span>íë¶ì¼ì</span><br>REFUND DATE</td>\ 16248 <td>' + data.pay_info.reg_date + '</td>\ 16249 </tr>\ 16250 '; 16251 } else { 16252 ordm_html+= '\ 16253 <tr>\ 16254 <td><span>주문ë ì§</span><br>TRANS DATE</td>\ 16255 <td>' + data.pay_info.reg_date + '</td>\ 16256 </tr>\ 16257 '; 16258 } 16259 ordm_html+= '\ 16260 <tr>\ 16261 <td><span>ìíëª </span><br>DESCRIPTION</td>\ 16262 <td>' + data.pay_info.product_name + '</td>\ 16263 </tr>\ 16264 <tr>\ 16265 <td><span>í©ê³</span><br>TOTAL</td>\ 16266 <td><span>'+number_format(data.pay_info.payment)+'</span> ì</td>\ 16267 </tr>\ 16268 <tr>\ 16269 <td><span>íì¬ëª </span><br>COMPANY NAME</td>\ 16270 <td>' + data.setting.b_name + '</td>\ 16271 </tr>\ 16272 <tr>\ 16273 <td><span>ëíì</span><br>MASTER</td>\ 16274 <td>' + data.setting.b_rep + '</td>\ 16275 </tr>\ 16276 <tr>\ 16277 <td><span>ì¬ì ìë±ë¡ë²í¸</span><br>BUSINESS NO.</td>\ 16278 <td>' + data.setting.b_number + '</td>\ 16279 </tr>\ 16280 <tr>\ 16281 <td><span>íì¬ì£¼ì</span><br>ADDRESS</td>\ 16282 <td>' + data.setting.b_addr + '</td>\ 16283 </tr>\ 16284 <tr>\ 16285 <td><span>문ìì í</span><br>TEL</td>\ 16286 <td>' + data.setting.b_tel + '</td>\ 16287 </tr>\ 16288 <tr>\ 16289 <td><span>ìëª </span><br>SIGNATURE</td>\ 16290 <td>' + data.pay_info.buyr_name + '</td>\ 16291 </tr>\ 16292 </tbody>\ 16293 </table>\ 16294 <div class="additional-box">구매 ììì¦ì ì¸ê¸ê³ì°ì ë± ì¦ë¹ìë¥ë¡ íì©í ì ììµëë¤.</div>\ 16295 </div>\ 16296 '; 16297 var title = (refund) ? 'íë¶ììì¦' : '구매ììì¦'; 16298 var ordModal = $(this).showModalFlat(title, ordm_html, true, true, function() { 16299 16300 $.shoppingmall.printModal(".cl-s-receipt-view"); 16301 16302 }, 'close', 'ì¶ë ¥', 'cl-s-receipt-view cl-modal cover', false); 16303 16304 16305 }, 'json'); 16306 }, 16307 printModal: function(modalEL) { 16308 var popupWindow = window.open("", "printPopup", "_blank" ); 16309 16310 var style = $('#cl_shopping').attr('href'); 16311
16312 popupWindow.document.write('<head>'); 16313 popupWindow.document.write($('head').html()); 16314 popupWindow.document.write('<link rel="stylesheet" href="'+style+'">'); 16315 popupWindow.document.write('<style>'); 16316 popupWindow.document.write($('#el_0css').html()); 16317 popupWindow.document.write('.close-button-dialog, .ok-button-dialog {display:none !important;}'); 16318 popupWindow.document.write('.cl-mobile-btn, button.close {display:none !important;}'); 16319 popupWindow.document.write('.modal-dialog {width:700px !important;max-width:700px !important;}'); 16320 popupWindow.document.write('</style>'); 16321 popupWindow.document.write('</head>'); 16322 16323 var $table = $(modalEL); 16324 16325 popupWindow.document.write('<body>'); 16326 popupWindow.document.write('<div style="display:block;" class="flat-modal cl-flat-modal">'); 16327 popupWindow.document.write($table.parent().parent().html()); 16328 popupWindow.document.write('
16328</div></body>'); 16329 16330 popupWindow.document.close(); 16331 16332 setTimeout(function () { 16333 popupWindow.print(); 16334 }, 1500); 16335 }, 16336 orderDownloadModal: function(sid, pnum, onum) { 16337 16338 $.post('/_check_download', { sid:sid, pnum:pnum, onum:onum }, function(data) { 16339 16340 if(typeof data.error != "undefined" && data.error) { 16341 $(this).showModalFlat('ERROR', data.error, true, false, '', 'close'); 16342 return false; 16343 } 16344 16345 var cnacelBtn = $('.mp-table[data-onum='+ onum +']').find('button[data-fn="orderCancel"]'); 16346 cnacelBtn.remove(); 16347 16348 var download_href = data.r.url, 16349 download_name = data.r.name, 16350 download_real_name = data.r.real_name, 16351 download_count = data.r.count; 16352 16353 var download_url = new getLocation(download_href), 16354 file_name = encodeURIComponent(download_name), 16355 file_real_name = encodeURIComponent(download_real_name), 16356 go = '/down?n=' + file_real_name + '&s=' + (download_url.pathname).replace('/cr-resource/forum/','').replace('/','&f='), 16357 temp_el = '<a href="'+go+'" target="_blank" download id="cl-download-a"></a>'; 16358 16359 $('body').append(temp_el); 16360 document.querySelector('#cl-download-a').click(); 16361 $('#cl-download-a').remove(); 16362 16363 if(download_count > 0) { 16364 $('.mp-table[data-onum=' + onum + ']').find('.download-str span').text(download_count); 16365 } else { 16366 $('.mp-table[data-onum=' + onum + ']').find('.download-str').html('<div class="cl-red">ë¤ì´ë¡ë 기íì´ ì§ë¬ê±°ë<br>ë¤ì´ë¡ë íì를 모ë ì¬ì©íììµëë¤.</div>'); 16367 $('.mp-table[data-onum=' + onum + ']').find('button[data-fn="orderDownload"]').addClass('disabled'); 16368 } 16369 16370 }, 'json'); 16371 }, 16372 orderusedModal: function(sid, pnum, onum) { 16373 16374 $.post('/_check_used', { sid:sid, pnum:pnum, onum:onum }, function(data) { 16375 console.log(data); 16376 if(typeof data.error != "undefined" && data.error) { 16377 $(this).showModalFlat('ERROR', data.error, true, false, '', 'close'); 16378 return false; 16379 } 16380 16381 var cnacelBtn = $('.mp-table[data-onum='+ onum +']').find('button[data-fn="orderCancel"]'); 16382 cnacelBtn.remove(); 16383 16384 var download_href = data.r.url, 16385 download_name = data.r.name, 16386 download_real_name = data.r.real_name, 16387 download_count = data.r.count; 16388 16389 var download_url = new getLocation(download_href), 16390 file_name = encodeURIComponent(download_name), 16391 file_real_name = encodeURIComponent(download_real_name), 16392 go = '/down?n=' + file_real_name + '&s=' + (download_url.pathname).replace('/cr-resource/forum/','').replace('/','&f='), 16393 temp_el = '<a href="'+go+'" target="_blank" download id="cl-download-a"></a>'; 16394 16395 $('body').append(temp_el); 16396 $('#cl-download-a').remove(); 16397 16398 if(download_count > 0) { 16399 $('.mp-table[data-onum=' + onum + ']').find('.download-str span').text(download_count); 16400 } else { 16401 $('.mp-table[data-onum=' + onum + ']').find('.download-str').html('<div class="cl-red">ë¤ì´ë¡ë 기íì´ ì§ë¬ê±°ë<br>ë¤ì´ë¡ë íì를 모ë ì¬ì©íììµëë¤.</div>'); 16402 $('.mp-table[data-onum=' + onum + ']').find('button[data-fn="orderDownload"]').addClass('disabled'); 16403 } 16404 16405 window.location.reload(); 16406 }, 'json'); 16407 }, 16408 } 16409 16410 // íì¼ì´ë¦ ì르기 16411 function limitFilenameLength(filename, maxLength) { 16412 if (filename.length <= maxLength) return filename; 16413 16414 let ext = ''; 16415 let name = filename; 16416 const dotIndex = filename.lastIndexOf('.'); 16417 if (dotIndex !== -1) { 16418 ext = filename.substring(dotIndex); 16419 name = filename.substring(0, dotIndex); 16420 } 16421 16422 const trimmed = name.substring(0, maxLength - ext.length); 16423 return trimmed + '..' + ext; 16424 } 16425 16426 $.quickbasket = { 16427 data: {}, 16428 dataReset: function(){ 16429 $.quickbasket.data = {} 16430 }, 16431 init: function (sid, pid, pnum) { 16432 $.ajax({ 16433 url: '/_quickbasket', 16434 type: 'post', 16435 data: { 'sid':sid, 'pid':pid, 'pnum':pnum }, 16436 async: false, 16437 cache: false, 16438 success: function (_data) { 16439 var data = JSON.parse(_data); 16440 16441 if(typeof data.error != 'undefined' & data.error) { 16442 var error_str = (data.error == 'error-none-unique') ? 'ì¥ë°êµ¬ëì ë´ê¸°ë ëì¤ ì¤ë¥ê° ë°ìíìµëë¤.\nì ìí ë¤ììë í´ì£¼ì¸ì.\nê°ì íìì´ ì§ìëë¤ë©´ ê³ ê°ì¼í°ë¡ 문ìí´ì£¼ì¸ì.' : data.error; 16443 $(this).showModalFlat('INFORMATION', error_str, false, false, '', '', '', 'cl-cmmodal cl-s-btn w560 cl-p0'); 16444 return false;
16445 } 16446 16447 $.quickbasket.dataReset(); 16448 var quickbasket_str = ''; 16449 if(typeof data.option_data != 'undefined' && data.option_data) { 16450 // product has options 16451 // var check_options_merge = data.option_data.checkOptionsMerge, 16452 var qbo_total_cnt = 0, 16453 qbo_total_price = 0, 16454 qbo_select_box = ''; 16455 16456 $.quickbasket.data = data.option_data; 16457 $.quickbasket.data.list.normal_md5 = {}; 16458 if(data.option_data.checkNomalOptionMixed) { 16459 $.each(data.option_data.list.normal_org, function(a,b) { 16460 var md5 = ''; 16461 switch(data.option_data.options_type) { 16462 case '1': md5 = clmd5.hex_md5(b.option_group + ' / ' + b.option_name); break; 16463 case '2': md5 = clmd5.hex_md5(b.option_mix2 + ' / ' + b.option_name); break; 16464 case '3': md5 = clmd5.hex_md5(b.option_mix2 + ' / ' + b.option_mix3 + ' / ' + b.option_name); break; 16465 default: break; 16466 } 16467 $.quickbasket.data.list.normal_md5[md5] = b; 16468 }); 16469 } 16470 16471 $.each(data.option_data.list, function(o_key, o_groups) { 16472 if($.inArray(o_key, ['normal_org','normal_md5']) > -1) return true; 16473 16474 var check_empty = (o_groups.length == 1 && o_groups[0]['arr'].length == 0) ? true : false; 16475 if(!check_empty) { 16476 var printedTitles = []; 16477 $.each(o_groups, function(og_idx, og_obj) { 16478 if (printedTitles.includes(og_obj['title'])) return true; 16479 printedTitles.push(og_obj['title']); 16480 if(o_key == 'additional' && og_idx == 0) quickbasket_str += (data.option_data.checkFooterStatus[2] == 'false') ? '' : '<p class="option-title">ì¶ê°ìµì </p>'; 16481 var qbo_wrap = '', 16482 qbo_box = '', 16483 qbo_noneoption_val = ''; 16484 16485 if(og_obj['arr'].length == 0 && (og_obj['value'].length == 0 || og_obj['title'] === null)) return true; 16486 let firstOptionNames = []; 16487 $.each(og_obj['arr'], function(og_idx2,og_obj2) { 16488 if (o_key == 'normal' && og_idx == 0) { 16489 // 첫 ë²ì§¸ ìµì 그룹ìì ì¤ë³µ ì´ë¦ ì ê±° 16490 if (firstOptionNames.includes(og_obj2.option_name)) { 16491 return true; // continue (ì¤ë³µì´ë©´ skip) 16492 } 16493 firstOptionNames.push(og_obj2.option_name); 16494 16495 // download íì¼ëª 16496 if (!$.quickbasket.productStates) $.quickbasket.productStates = {}; 16497 if (og_obj2.product_state) { 16498 $.quickbasket.productStates[og_obj2.option_seq] = og_obj2.product_state; 16499 } 16500 } 16501 var div_property = ''; 16502 if(o_key != 'text' && !og_obj2.soldout) { 16503 div_property += 'onclick="$.quickbasket.pdOptionPick(this, \'' + data.option_data.product_price + '\')" '; 16504 // div_property += 'data-status="' + data.option_data.product_state + '" '; 16505 div_property += 'data-status="normal" '; 16506 div_property += (o_key == 'additional') ? 'data-option_type="' + og_obj2.option_type + '" ' : 'data-type="' + data.option_data.options_type + '" '; 16507 div_property += 'data-id
16507x="' + (og_idx2-1) + '" '; 16508 if(o_key == 'normal') div_property += 'data-option-index="' + og_idx + '" '; 16509 div_property += 'data-option-price="' + og_obj2.option_price + '" '; 16510 } 16511 var option_str = { 16512 'div_class': (og_obj2.soldout) ? 'sold-out' : '', 16513 'div_property': div_property, 16514 'span1': (og_obj2.soldout) ? '<span class="text-d-lt">' : '', 16515 'span2': (og_obj2.soldout) ? '</span>' : '', 16516 'seq': (og_obj2.soldout) ? '' : 'data-option-seq="'+og_obj2.option_seq+'"', 16517 'soldout': (og_obj2.soldout) ? '<label>íì </label>' : '', 16518 } 16519 16520 if(og_obj2.option_name == 'noneOption') { 16521 16522 if(o_key == 'text') { 16523 qbo_noneoption_val = (data.option_data.checkNoneTextOption) ? og_obj2.option_group + ' / ' + og_obj2.val : ''; 16524 } else if(o_key == 'additional') { 16525 // var type = ''; 16526 // qbo_selectbox = $.quickbasket.pdOptionBoxHtml(data.option_data.product_price, type, data.option_data.product_state, og_obj2.option_type == null ? '' : og_obj2.option_type, o_obj.val.split('||'), '');s 16527 var val_arr = og_obj2.val.split('||'); 16528 if(data.option_data.checkOptionBox) { 16529 if(data.option_data.checkFooterStatus[1] != 'true') { 16530 qbo_select_box = '\ 16531 <div class="option-count-box">\ 16532 <input type="hidden" name="option_price[]" value="' + data.option_data.product_price + '">\ 16533 <input type="hidden" name="option_seq[]" class="option_seq" value="'+ val_arr[3] +'">\ 16534 <input type="hidden" class="total-quantity" value="'+ val_arr[2] +'">\ 16535 <input type="hidden" name="option_name[]" value="'+ val_arr[0] +'">\ 16536 <input type="hidden" name="option_type[]" value="' + ((og_obj2.option_type == null) ? '' : og_obj2.option_type) + '">\ 16537 <input type="hidden" name="option_text[]" value="">\ 16538 <div class="box-option-row">\ 16539 <div class="box-option-name">' + data.option_data.product_title + '</div>\ 16540 </div>\ 16541 <div class="box-option-row">\ 16542 <div class="box-option-price"><span class="option-price">' + addCommas(data.option_data.product_price) + '</span>ì</div>\ 16543 <div class="box-option-count"><div class="form-group"><span class="min"><svg viewBox="0 0 11 11" width="11" height="11"><rect y="5" width="11" height="1"></rect></svg></span><input type="text" class="option-normal-price" value="1" numberonly="true" name="option_count[]"><span class="plus"><svg viewBox="0 0 11 11" width="11" height="11"><polygon points="6 5 6 0 5 0 5 5 0 5 0 6 5 6 5 11 6 11 6 6 11 6 11 5 "></polygon></svg></span></div></div>\ 16544 </div>\ 16545 </div>\ 16546 '; 16547 16548 qbo_total_cnt++; 16549 qbo_total_price = data.option_data.product_price; 16550 } 16551 } else { 16552 qbo_select_box = '<input type="hidden" class="noneoption_seq" value="'+ og_obj2.option_seq +'">'; 16553 } 16554 } 16555 16556 } else { 16557 if(o_key == 'text') { 16558 qbo_box += '\ 16559 <div class="cl-s-option-text" data-selected_option="' + ((data.option_data.options_type == 'TR') ? 'Y' : 'N') + '" data-status="' + data.option_data.product_state + '" >\ 16560 <input type="text" placeholder="' + og_obj2.option_name + '" data-val="' + og_obj2.option_seq + '" data-status="' + data.option_data.product_state + '" data-option_type="T" maxlength="100" readonly>\ 16561 </div>\ 16562 '; 16563 } else { 16564 qbo_box += '\ 16565 <div class="' + option_str.div_class + '" data-val="' + og_obj2.val + '" ' + option_str.div_property + '>\ 16566 ' + option_str.span1 + '\ 16567 <div class="quick-option-row">\ 16568 <div class="option-left">\ 16569 <sp
16569an class="number">' + og_obj2.option_number + '.</span>\ 16570 <span class="option-name" ' + option_str.seq + '>' + og_obj2.option_name + option_str.soldout + '</span>\ 16571 </div>\ 16572 <span class="price">' + og_obj2.option_price_str + ' ì</span>\ 16573 </div>'; 16574 // download ì¼ë íì¼ëª ì¶ê° 16575 if (data.option_data.product_state === 'download' && og_obj2.product_state) { 16576 var ps = JSON.parse(og_obj2.product_state); 16577 if (ps.file_name && ps.file_url) { 16578 var trimmedName = limitFilenameLength(ps.file_name, 14); 16579 qbo_box += '\ 16580 <div class="quick-option-file">\ 16581 <span class="quick-option-file-name">' + trimmedName + '</span>\ 16582 <span class="quick-option-file-size">' + ps.file_size + '</span>\ 16583 </div>'; 16584 } 16585 } 16586 16587 if (og_obj2.product_state) { 16588 og_obj2.val += '||' + encodeURIComponent(og_obj2.product_state); 16589 } 16590 qbo_box += '\ 16591 ' + option_str.span2 + '\ 16592 </div>\ 16593 '; 16594 } 16595 } 16596 }); 16597 16598 var qbo_key_str = (o_key == 'additional') ? 'addt' : o_key, 16599 qbo_required = (o_key == 'normal') ? 'option-required' : '', 16600 qbo_disabled = (o_key == 'normal' && og_idx > 0) ? 'option-disabled' : '', 16601 qbo_def_index = (o_key == 'normal') ? 'data-def-index="' + og_idx + '"' : ''; 16602 16603 if(o_key == 'text') { 16604 if(data.option_data.checkFooterStatus[1] == 'true') { 16605 qbo_wrap = '\ 16606 <div id="selected-product-option" data-val="' + qbo_noneoption_val + '" data-selected_option="" data-status=""></div>\ 16607 <div class="text-option-box">\ 16608 ' + qbo_box + '\ 16609 </div>\ 16610 '; 16611 qbo_wrap += (qbo_box == '') ? '' : '\ 16612 <div class="text-center text-option-btn-box">\ 16613 <div onclick="$.quickbasket.pdTextOptionPick(this, \'' + data.option_data.product_price + '\', \'' + ((data.option_data.checkOnlyTextOption) ? 'T' : '') + '\',' + data.option_data.options_type + ')" class="btn text-center hand text-option-btn disabled">ì ë ¥í ìµì ì¼ë¡ ì í</div>\ 16614 </div>\ 16615 '; 16616 } 16617 } else { 16618 qbo_wrap = ( 16619 (o_key == 'normal' && data.option_data.checkFooterStatus[0] == 'false') || 16620 (o_key == 'additional' && data.option_data.checkFooterStatus[2] == 'false') 16621 ) ? '' : '\ 16622 <div class="select-box">\ 16623 <div class="selected-option ' + ((o_key == 'normal' && og_idx > 0) ? 'ex' : '' ) + '" id="selected-product' + ((o_key == 'normal') ? '' : qbo_key_str) + '-
16623option" data-val="" data-selected_option="" data-status="">\ 16624 <span class="selected-option-text">' + og_obj['title'] + '</span>\ 16625 <span class="selected-option-title hide">' + og_obj['title'] + '</span>\ 16626 ' + clSVG('caret',8,4,false) + '\ 16627 </div>\ 16628 </div>\ 16629 <div class="option-box product-option-box" style="display: none;">\ 16630 ' + qbo_box + '\ 16631 </div>\ 16632 '; 16633 } 16634 16635 quickbasket_str += (qbo_wrap == '') ? '' : '\ 16636 <div class="cl-s-option-selector cl-s-' + qbo_key_str + '-option-selector ' + qbo_required + ' ' + qbo_disabled + '" ' + qbo_def_index + '>\ 16637 ' + qbo_wrap + '\ 16638 </div>\ 16639 '; 16640 }); 16641 16642 } 16643 }); 16644 16645 quickbasket_str += '\ 16646 <div class="option-select-box">\ 16647 ' + qbo_select_box + '\ 16648 </div>\ 16649 <div class="total-price-box">\ 16650 <span class="panel-total-title">ì´ ìí ê¸ì¡</span>\ 16651 <span class="panel-total-cnt">ì´ ìë <span class="total-cnt">' + qbo_total_cnt + '</span>ê° </span>\ 16652 <span class="panel-total-price"><span class="total-price">' + addCommas(qbo_total_price) + '</span>ì</span>\ 16653 </div>\ 16654 '; 16655 16656 var quickBasketOptionModal = $(this).showModalFlat($.lang[LANG]['gallery.sh.quickbasket.option'], quickbasket_str, true, true, function() { 16657 16658 if($('.cl-modal-check-quantity').length > 0) return false; 16659 16660 var checkEmpty = false; 16661 quickBasketOptionModal.find('.option-normal-price').each(function() { 16662 if($(this).val() == '' || $(this).val() < 1) { 16663 checkEmpty = true; 16664 $(this).val(1); 16665 } 16666 }); 16667 if(checkEmpty) { 16668 if($('.cl-modal-check-quantity').length == 0) $.quickbasket.alertModal('ERROR','ìµì 구매 ìëì 1ê° ì ëë¤.','cl-modal-check-quantity'); 16669 return false; 16670 } 16671 16672 $.quickbasket.setKeepShopping(sid,RENDER.b.PAGE,pid,pnum); 16673 var optionName = quickBasketOptionModal.find('input[name="option_name[]"]'), 16674 optionPrice = quickBasketOptionModal.find('input[name="option_price[]"]'), 16675 optionCount = quickBasketOptionModal.find('input[name="option_count[]"]'), 16676 optionSeq = quickBasketOptionModal.find('.option_seq'), 16677 optionText = quickBasketOptionModal.find('input[name="option_text[]"]'), 16678 optionType = quickBasketOptionModal.find('input[name="option_type[]"]'), 16679 etcStartDate = quickBasketOptionModal.find('input[name="etc_start_date[]"]'), 16680 etcEndDate = quickBasketOptionModal.find('input[name="etc_end_date[]"]'), 16681 oCnt = quickBasketOptionModal.find('input[name="option_name[]"]').length, 16682 state = data.option_data.state, 16683 deliveryType = data.option_data.delivery_type, 16684 deliveryPayType = data.option_data.delivery_pay_type; 16685 16686 if (oCnt < 1) { 16687 $.quickbasket.alertModal('ERROR','ìµì ì ì íí´ì£¼ì¸ì.','cl-modal-check-select'); 16688 16689 // var modal = $(this).showModalFlat('','ìµì ì ì íí´ì£¼ì¸ì.',true,false,'','ok','','cl-cmmodal cl-s-btn w560 cl-p130 cl-t80 cl-modal cl-none-title cl-close-btn','','',function() { 16690 // modal.closest('.cl-flat-modal').next('.modal-backdrop.in').attr('style', 'z-index: 1050!important'); 16691 // modal.closest('.modal').css('z-index', 1051); 16692 // $(document).on('keydown', function(e) { 16693 // if(e.keyCode == 27) modal.modal('hide'); 16694 // }); 16695 // }); 16696 return false;
16697 } 16698 16699 if(quickBasketOptionModal.find('.cl-s-addt-option-selector').length > 0) { //ì¶ê°ìµì ì¡´ì¬ 16700 var optionLength = quickBasketOptionModal.find('.option-count-box:not(.additional) input[name="option_name[]"]').length; 16701 if(optionLength < 1) { 16702 $.quickbasket.alertModal('ERROR','ìµì ì ì íí´ì£¼ì¸ì.','cl-modal-check-select'); 16703 return false; 16704 } 16705 } 16706 16707 if(quickBasketOptionModal.find('.cl-s-option-text').length > 0) { //ì ë ¥íìµì ì¡´ì¬ 16708 var optionTextArr = quickBasketOptionModal.find('input[name="option_text[]"]').map(function(){ 16709 if($(this).val().trim() != '') { 16710 return $(this).val().trim(); 16711 } 16712 }).get(); 16713 if(optionTextArr.length < 1) { 16714 $.quickbasket.alertModal('ERROR','ìµì ì ì íí´ì£¼ì¸ì.','cl-modal-check-select'); 16715 return false; 16716 } 16717 } 16718 16719 if(!quickBasketOptionModal.find('.ok-button-dialog').hasClass('active')) return false; 16720 16721 var optionNameAry = [], 16722 optionPriceAry = [], 16723 optionCountAry = [], 16724 optionSeqAry = [], 16725 optionTextAry = [], 16726 optionTypeAry = [], 16727 etcStartDateAry = [], 16728 etcEndDateAry = []; 16729 16730 for (var i=0;i<oCnt;i++) { 16731 if (optionName[i].value == 'noneOption') { 16732 optionName[i].value = ''; 16733 } 16734 16735 if (optionName[i].value.length == 0) { 16736 if(optionText[i].value.length > 0) { 16737 optionSeqAry[i] = optionSeq[i].value; 16738 } else { 16739 optionSeqAry[i] = ''; 16740 } 16741 } else if (optionName[i].value.length > 0) { 16742 optionSeqAry[i] = optionSeq[i].value; 16743 } 16744 16745 if($("#product_state").val() == 'download') { 16746 optionSeqAry[i] = optionSeq[i].value; 16747 } 16748 16749 optionTextAry[i] = optionText[i].value; //ì ë ¥í ìµì 16750 optionTypeAry[i] = optionType[i].value; //ìµì íì 16751 optionNameAry[i] = optionName[i].value; 16752 16753 optionPriceAry[i] = optionPrice[i].value; 16754 optionCountAry[i] = optionCount[i].value; 16755 16756 etcStartDateAry[i] = etcStartDate[i] ? etcStartDate[i].value : ''; 16757 etcEndDateAry[i] = etcEndDate[i] ? etcEndDate[i].value : ''; 16758 } 16759 16760 var productBasketData = { 16761 'product_number': data.option_data.product_number, // ìí ë²í¸ 16762 'option_name': optionNameAry, // ìµì ëª 16763 'option_text': optionTextAry, 16764 'option_type': optionTypeAry, 16765 'option_price': optionPriceAry, // ìµì ê°ê²© 16766 'option_count': optionCountAry, // ìµì ê°ì 16767 'option_seq': optionSeqAry, // ìµì ìíì¤ 16768 'etc_start_date': etcStartDateAry, // 기í무í ìí ìì ë ì§ 16769 'etc_end_date': etcEndDateAry, // 기í무í ìí ì¢ ë£ ë ì§ 16770 'state': state, // ìí íì (normal: ì¼ë°ìí, download: ë¤ì´ë¡ë ìí, etc: 기í무í ìí) 16771 'sid': data.option_data.sid, // site id, 16772 'delivery_type' : deliveryType, // ë°°ì¡íì 16773 'delivery_pay_type' : deliveryPayType, // ë°°ì¡ë¹ ì§ë¶ (ì ì°©ë¶) 16774 } 16775 16776 $.quickbasket.initOptions(quickBasketOptionModal, productBasketData); 16777 16778 16779 }, 'cancel', 'gallery.sh.quickbasket.add', 'cl-cmmodal cl-s-btn w560 in-w360 cl-p0 cl-quickbasket-modal ', false, '', function() { 16780 16781 if(quickBasketOptionModal.find('.option-count-box:not(.additional)').length >
16781 0) quickBasketOptionModal.find('.modal-footer .ok-button-dialog').addClass('active'); 16782 else quickBasketOptionModal.find('.modal-footer .ok-button-dialog').removeClass('active'); 16783 16784 if(quickBasketOptionModal.find('.option-select-box > .option-count-box').length > 0) quickBasketOptionModal.find('.total-price-box .total-cnt').text('1'); 16785 else quickBasketOptionModal.find('.total-price-box .total-cnt').text('0'); 16786 16787 if( quickBasketOptionModal.find('.cl-s-normal-option-selector').length == 0 && 16788 quickBasketOptionModal.find('.cl-s-option-date-selector').length == 0 16789 ) { 16790 quickBasketOptionModal.find('.cl-s-option-text input').prop('readonly', false); 16791 } 16792 quickBasketOptionModal.find('.cl-s-option-text input').on('keyup blur', function(e) { 16793 var textOptionTarr = []; 16794 textOptionTarr = quickBasketOptionModal.find('.cl-s-option-text input').map(function(){ 16795 var input_str = ($(this).val().trim() != '') ? $(this).val().trim() : ''; 16796 if(input_str != '' && checkEmojis(input_str)) { 16797 input_str = removeEmojis(input_str); 16798 $(this).val(input_str); 16799 } 16800 16801 if(input_str != '') return input_str; 16802 }).get(); 16803 16804 if(quickBasketOptionModal.find('.cl-s-option-text input').length == textOptionTarr.length && quickBasketOptionModal.find('.cl-s-option-selector.option-required .selected-option[data-val=""]').length == 0) { 16805 quickBasketOptionModal.find('.text-option-btn').removeClass('disabled'); 16806 } else { 16807 quickBasketOptionModal.find('.text-option-btn').addClass('disabled'); 16808 } 16809 }); 16810 16811 quickBasketOptionModal.find('.cl-s-option-selector').each(function(idx, item){ 16812 var cnt = $('.cl-s-option-selector').length; 16813 $(this).css('z-index', cnt - idx + 1); 16814 }); 16815 quickBasketOptionModal.find('.cl-s-option-selector .selected-option').on('click', function (e) { 16816 if($(this).parents('.cl-s-option-selector').hasClass('option-disabled')) return false; 16817 var option_parent = $(this).closest('.cl-s-option-selector'); 16818 16819 if(quickBasketOptionModal.find('.product-option-box div').length == 0) return false; 16820 if ($(this).hasClass('active') === true) { 16821 option_parent.find('.product-option-box').slideUp(300); 16822 $(this).removeClass('active'); 16823 $(this).parents('.cl-s-option-selector').removeClass('active'); 16824 } else { 16825 option_parent.find('.product-option-box').slideDown(300); 16826 $(this).addClass('active'); 16827 $(this).parents('.cl-s-option-selector').addClass('active'); 16828 } 16829 }); 16830 16831 quickBasketOptionModal.on('click', function(e) { 16832 var container = quickBasketOptionModal.find('.cl-s-normal-option-selector #selected-product-option'); 16833 if(container.has(e.target).length == 0) { 16834 quickBasketOptionModal.find('.cl-s-normal-option-selector .product-option-box').slide
16834Up(200); 16835 container.removeClass('active'); 16836 container.parents('.cl-s-option-selector').removeClass('active'); 16837 } else { 16838 if($(e.target).closest('.cl-s-option-selector').length > 0) { 16839 $(e.target).closest('.cl-s-option-selector').siblings('.cl-s-option-selector').find('.product-option-box').slideUp(200); 16840 } 16841 } 16842 16843 if($(e.target).is('.btn')) { 16844 if(quickBasketOptionModal.find('.cl-modal-check-quantity').length > 0) { 16845 e.preventDefault(); 16846 return false; 16847 } 16848 var input_v = quickBasketOptionModal.find('.box-option-count input').val(); 16849 if(!$(e.target).hasClass('.box-option-count') && (input_v == '' || Number(input_v) < 1)) { 16850 $.quickbasket.alertModal('ERROR','ìµì 구매 ìëì 1ê° ì ëë¤.','cl-modal-check-quantity'); 16851 if(input_v) quickBasketOptionModal.find('.box-option-count input').val(1); 16852 $.quickbasket.pdTotalPriceUpdate(); 16853 return false; 16854 } 16855 } 16856 }); 16857 16858 }); 16859 16860 return false; 16861 16862 } else { 16863 // product none option 16864 $.quickbasket.setKeepShopping(sid,RENDER.b.PAGE,pid,pnum); 16865 $.quickbasket.close(true); 16866 return false; 16867 } 16868 16869 // var dataObj = JSON.parse(data.r); 16870 } 16871 }); 16872 }, 16873 initOptions: function (qbModal, pdBasketObj) { 16874 $.ajax({ 16875 url: '/_basket', 16876 type: 'post', 16877 data: pdBasketObj, 16878 async: false, 16879 cache: false, 16880 success: function (data) { 16881 if (data == 'error-none-unique') { 16882 alert('ì¥ë°êµ¬ëì ë´ê¸°ë ëì¤ ì¤ë¥ê° ë°ìíìµëë¤.\nì ìí ë¤ììë í´ì£¼ì¸ì.\nê°ì íìì´ ì§ìëë¤ë©´ ê³ ê°ì¼í°ë¡ 문ìí´ì£¼ì¸ì.'); 16883 return false; 16884 } 16885 16886 var checkClnav = $.clnav.check(); 16887 var dataObj = JSON.parse(data); 16888 var basketConfirm = dataObj.r.basket_confirm; 16889 var state = dataObj.r.state; 16890 var remainQuantity = dataObj.r.remain_quantity; 16891 var totalQuantity = $('.total-quantity').val(); 16892 16893 if(basketConfirm.indexOf(false)>-1 && basketConfirm.indexOf(true)==-1){ 16894 if(state=='download'){ 16895 alert('ì¥ë°êµ¬ëì ì´ë¯¸ ë´ê²¨ìë ìíì ëë¤.'); 16896 } else if(state == 'normal' && (deliveryType != dataObj.r.delivery_type || deliveryPayType != dataObj.r.delivery_pay_type)) { 16897 alert('í´ë¹ ìíì ì¥ë°êµ¬ëìì ë¹ì°ê±°ë ë°°ì¡ë°©ë²ì ' + $.lang[LANG]['shopping.delivery.template.delivery_type.' + dataObj.r.delivery_type.toLowerCase()] + ', ë°°ì¡ë¹ê²°ì 를 ' + $.lang[LANG]['shopping.delivery.template.pay_type.' + dataObj.r.delivery_pay_type.toLowerCase()] + 'ë¡ ìì í´ ì£¼ì¸ì.'); 16898 } 16899 else{ 16900 $(this).blur(); 16901 var modal = $(this).showModalFlat('ERROR','ì¬ê³ ìë('+remainQuantity+'ê°) ì´ì 구매íì¤ ì ììµëë¤.',true,false,'','ok','','cl-cmmodal cl-s-btn w560 cl-p130 cl-t80 cl-modal cl-none-title cl-close-btn','','',function() { 16902 modal.closest('.cl-flat-modal').next('.modal-backdrop.in').attr('style', 'z-index: 1050!important'); 16903 modal.closest('.modal').css('z-index', 1051); 16904 $(document).on('keydown', function(e) { 16905 if(e.keyCode == 27) modal.modal('hide'); 16906 }); 16907 }); 16908 } 16909 return false;
16910 } 16911 16912 var optionName = qbModal.find('input[name="option_name[]"]'), 16913 optionPrice = qbModal.find('input[name="option_price[]"]'), 16914 optionCount = qbModal.find('input[name="option_count[]"]'), 16915 optionSeq = qbModal.find('.option_seq'), 16916 optionQuantity = qbModal.find('.option-normal-price'), 16917 etcStartDate = qbModal.find('input[name="etc_start_date[]"]'), 16918 etcEndDate = qbModal.find('input[name="etc_end_date[]"]'), 16919 oCnt = qbModal.find('input[name="option_name[]"]').length, 16920 state = qbModal.find('#product_state').val(); 16921 16922 var optionNameAry = [], 16923 optionSeqAry = [], 16924 optionQuantityAry = [], 16925 optionPriceAry = [], 16926 optionCountAry = 16927 etcStartDateAry = [], 16928 etcEndDateAry = [], 16929 prod, prodAry = [], 16930 totalPrice = qbModal.find('.total-price').text().replace(/[\{\}\[\]\/?.,;:|\)*~`!^\-+<>@\#$%&\\\=\(\'\"]/gi, ""), 16931 fdq_arr = []; 16932 16933 for (var i=0;i<oCnt;i++) { 16934 if (optionName[i].value == 'noneOption') optionName[i].value = ''; 16935 optionNameAry[i] = optionName[i].value; 16936 optionSeqAry[i] = optionSeq[i].value; 16937 optionQuantityAry[i] = optionQuantity[i].value; 16938 optionPriceAry[i] = (optionPrice[i].value * 1) * (optionQuantity[i].value * 1); 16939 optionCountAry[i] = optionCount[i].value; 16940 etcStartDateAry[i] = etcStartDate[i] ? etcStartDate[i].value : ''; 16941 etcEndDateAry[i] = etcEndDate[i] ? etcEndDate[i].value : ''; 16942 prod = { 16943 'option_seq': optionSeq[i].value, 16944 'option_name': optionName[i].value, 16945 'option_quantity': optionQuantity[i].value, 16946 'option_price': optionPriceAry[i], 16947 'etc_option_start': etcStartDate[i] ? etcStartDate[i].value : '', 16948 'etc_option_end': etcEndDate[i] ? etcEndDate[i].value : '', 16949 } 16950 prodAry[i] = prod; 16951 16952 var fdq_pn = qbModal.find('.product-title [data-project-title]').text(), 16953 fdq_nm = (optionName[i].value) ? optionName[i].value : qbModal.find('.option-select-box .option-count-box:eq('+i+') .box-option-name').text(); 16954 fdq_arr.push({ 16955 'id': optionSeq[i].value, 16956 'name': (fdq_pn != fdq_nm) ? fdq_pn + ' ' + fdq_nm : fdq_nm, 16957 'quantity': optionQuantity[i].value, 16958 'price': optionPriceAry[i], 16959 }); 16960 } 16961 16962 var productCart = { 16963 'product_number': pdBasketObj.value, // ìí ë²í¸ 16964 'option': prodAry, // ìµì 16965 'state': state, // ìí íì (normal: ì¼ë°ìí, download: ë¤ì´ë¡ë ìí, etc: 기í무í ìí) 16966 'total_price': totalPrice, // ìí ì´ ê°ê²© 16967 'sid': pdBasketObj.sid, // site id 16968 } 16969 if(typeof productCartCallback == 'function') productCartCallback(productCart); 16970 if(typeof callbackEvtAddToCart == 'function') callbackEvtAddToCart(fdq_pn,fdq_arr,totalPrice); 16971 16972 if(basketConfirm.indexOf(true) > -1) { 16973 var checkFixTypeMenu = (typeof $('.el-menu header.navbar').attr('data-fixtype') != 'undefined' && $('.el-menu header.navbar').attr('data-fixtype')) ? true : false; 16974 property.CART = (checkFixTypeMenu || checkClnav) ? dataObj.r.cart_cnt : 'true'; 16975 if(checkClnav) $.clnav.setFixnavShopping($('.cl-nav')); 16976 else $.shopping.makeSiteFixedCART(); 16977 16978 qbModal.modal('hide'); 16979 $.quickbasket.close(false); 16980 return false;
16981 } else { 16982 if(checkClnav) $.clnav.setFixnavShopping($('.cl-nav')); 16983 else $.shopping.makeSiteFixedCART(); 16984 } 16985 } 16986 }); 16987 }, 16988 close: function (checkPlusCart) { 16989 quickbasket_str = '\ 16990 <div class="modal-footer mt-20\">\ 16991 <button type="button" class="btn btn-sm btn-line">' + $.lang[LANG]['gallery.sh.quickbasket.goto'] + '</button>\ 16992 <button type="button" class="btn btn-sm btn-active close-button-dialog" data-dismiss="modal">' + $.lang[LANG]['gallery.sh.quickbasket.keep'] + '</button>\ 16993 </div>\ 16994 '; 16995 16996 var checkClnav = $.clnav.check(); 16997 16998 var quickBasketModal = $(this).showModalFlat($.lang[LANG]['gallery.sh.quickbasket.success'], quickbasket_str, false, false, '', '', '', 'cl-cmmodal cl-s-btn w560 cl-p0 cl-quickbasket-modal', false, '', function() { 16999 // quickBasketModal.closest('.cl-flat-modal').next('.modal-backdrop.in').attr('style', 'z-index: 1050!important'); 17000 // quickBasketModal.closest('.modal').css('z-index', 1051); 17001 17002 if(checkPlusCart) { 17003 var checkFixTypeMenu = (typeof $('.el-menu header.navbar').attr('data-fixtype') != 'undefined' && $('.el-menu header.navbar').attr('data-fixtype')) ? true : false; 17004 property.CART = (checkFixTypeMenu || checkClnav) ? Number(property.CART) + 1 : 'true'; 17005 if(checkClnav) $.clnav.setFixnavShopping($('.cl-nav')); 17006 else $.shopping.makeSiteFixedCART(); 17007 } 17008 17009 quickBasketModal.find('.btn-line').on('click', function(e) { 17010 location.href = '/_cart'; 17011 quickBasketModal.modal('hide'); 17012 }); 17013 17014 $(document).on('keydown', function(e) { 17015 if(e.keyCode == 13) { 17016 e.preventDefault(); 17017 return false; 17018 } 17019 if(e.keyCode == 27) quickBasketModal.modal('hide'); 17020 }); 17021 }); 17022 }, 17023 alertModal: function (am_header, am_content, am_modalclass) { 17024 var am_selector = (am_modalclass) ? '.'+am_modalclass.replace(' ',',.') : ''; 17025 if(am_selector != '' && $(am_selector).length > 0) return false; 17026 17027 var am_zindex = ($('body').width() < 768) ? 9998 : 1050; 17028 var am_modal = $(this).showModalFlat(am_header, am_content, true, false, '', 'ok', '', 'cl-cmmodal cl-s-btn w560 cl-p130 cl-t80 cl-modal cl-none-title cl-close-btn ' + am_modalclass, '', '', function() { 17029 am_modal.closest('.cl-flat-modal').next('.modal-backdrop.in').attr('style', 'z-index: '+am_zindex+'!important'); 17030 am_modal.closest('.modal').css('z-index', am_zindex+1); 17031 17032 $(document).on('keydown', function(e) { 17033 if(e.keyCode == 27) am_modal.modal('hide'); 17034 }); 17035 }); 17036 }, 17037 checkQty: function (optionAry) { 17038 var currentOptCnt = 0; 17039 var selectedSeq = optionAry[3]; // option_seq 17040 17041 $('.cl-quickbasket-modal .box-option-name').each(function () { 17042 var box = $(this).closest('.option-count-box'); 17043 var boxOptionSeq = box.find('.option_seq').val(); 17044 var boxQty = parseInt(box.find('.option_count').val() || "0", 10); 17045 17046 if (boxOptionSeq === selectedSeq) { 17047 currentOptCnt += boxQty; 17048 } 17049 }); 17050 17051 if (currentOptCnt >= Number(optionAry[2])) { 17052 var modal = $(this).showModalFlat('ERROR', 'ì¬ê³ ìë(' + optionAry[2] + 'ê°) ì´ì 구매íì¤ ì ììµëë¤.', true, false, '', 'ok', '', 'cl-cmmodal cl-s-btn w560 cl-p130 cl-t80 cl-modal cl-none-title cl-close-btn', '', '', function () { 17053 modal.closest('.cl-cmmodal').next('.modal-backdrop.in').attr('style', 'z-index: 1050!important'); 17054 modal.closest('.modal').css('z-index', 1051); 17055 $(document).on('keydown', function (e) { 17056 if (e.keyCode === 27) modal.modal('hide'); 17057 }); 17058 }); 17059 return false;
17060 } 17061 17062 return true; 17063 }, 17064 pdOptionBoxHtml: function (productPrice, type, optionStatus, optionType, optionAry, textOption, textOptionObj) { 17065 // ìµì ì íì¼ëª ì¶ê° 17066 var trimmedName = '', fileSize = ''; 17067 var psRaw = $.quickbasket.productStates[optionAry[3]]; // option_seq 17068 if (psRaw) { 17069 var ps = JSON.parse(psRaw); 17070 if (ps.file_name && ps.file_size) { 17071 trimmedName = limitFilenameLength(ps.file_name, 14); 17072 fileSize = ps.file_size; 17073 } 17074 } 17075 var quickbasketModal = $('.cl-quickbasket-modal'), 17076 total = 0, 17077 dateCheckCnt = 1, 17078 etcStartDate = '', etcEndDate = '', etcDate = ''; 17079 17080 if (quickbasketModal.find('.cl-s-option-date-selector').length > 0) { //ê¸°ê° 17081 var optionStatus = 'etc'; 17082 etcStartDate = quickbasketModal.find('#etc-start-date-option').val(); 17083 etcEndDate = quickbasketModal.find('#etc-end-date-option').val(); 17084 etcTime = quickbasketModal.find('#etc-time').val(); 17085 if (etcEndDate) etcDate = etcStartDate + ' - ' + etcEndDate; 17086 else etcDate = etcStartDate; 17087 if(etcTime) { 17088 var etcTimeTmp = etcTime.split(' '); 17089 etcTimeTmp[0] = (etcTimeTmp[0] == 'am')? 'ì¤ì ' : 'ì¤í '; 17090 var etcTimeStr = etcTimeTmp[0] + etcTimeTmp[1]; 17091 etcDate += ' '+etcTimeStr; 17092 etcStartDate += '|'+etcTime; 17093 if(etcEndDate) etcEndDate += '|'+etcTime; 17094 } 17095 17096 var etcStartDateAry = quickbasketModal.find('#etc-start-date-option').val().split("."); 17097 var etcEndDateAry = quickbasketModal.find('#etc-end-date-option').val().split("."); 17098 var disabledDateArr = quickbasketModal.find('#etc-exclude-date').val().split(','); 17099 var startDateObj = new Date(etcStartDateAry[0], (etcStartDateAry[1] * 1) - 1, etcStartDateAry[2]); 17100 var endDateObj = new Date(etcEndDateAry[0], (etcEndDateAry[1] * 1) - 1, etcEndDateAry[2]); 17101 var betweenDate = (endDateObj.getTime() - startDateObj.getTime()) / 1000 / 60 / 60 / 24; 17102 17103 var dayArr = (quickbasketModal.find('#etc-term-setting').val() && JSON.parse(quickbasketModal.find('#etc-term-setting').val()).days !== undefined)? JSON.parse(quickbasketModal.find('#etc-term-setting').val()).days.split('|'):[]; 17104 var disabledDayArr = []; 17105 if(dayArr.length > 0) { 17106 disabledDayArr = [0, 1, 2, 3, 4, 5, 6]; 17107 $.each(dayArr, function(i, v){ 17108 enableIdx = disabledDayArr.indexOf(daysObj[v]); 17109 if(enableIdx > -1) { 17110 disabledDayArr.splice(enableIdx, 1); 17111 } 17112 }); 17113 } 17114 17115 for (var i=0;i<betweenDate;i++) { 17116 var dayCheck = 0; 17117 var dateCheck; 17118 var dt; 17119 17120 dayCheck = new Date(etcStartDateAry[0], (etcStartDateAry[1] * 1) - 1, (etcStartDateAry[2] * 1) + i).getDay(); 17121 dt = new Date(etcStartDateAry[0], (etcStartDateAry[1] * 1) - 1, (etcStartDateAry[2] * 1) + i); 17122 dateCheck = dt.getFullYear()+'.'+ String(dt.getMonth()+1).padStart(2, '0') +'.'+dt.getDate(); 17123 if (disabledDateArr.indexOf(dateCheck)===-1 && disabledDayArr.indexOf(dayCheck)===-1) dateCheckCnt++; 17124 } 17125 } 17126 var boxOptionTextStr = (textOptionObj)? textOptionObj.map(function(element, index, array){return Object.values(element);}).join(' / ') : ''; //ì ë ¥ìµì í ì¤í¸ê° 17127 if (dateCheckCnt == 0) dateCheckCnt = 1; 17128 17129 optionAry[0] = (optionAry[0] === undefined) ? '' : strReplace(optionAry[0], '\\quot;', """); 17130 optionAry[3] = (optionAry[3] === undefined) ? quickbasketModal.find('.noneoption_seq').val() : optionAry[3]; 17131 textOption = (textOption === undefined)? '' : textOption; 17132 var optionPrice = (optionAry[1] === undefined)? 0 : Number(optionAry[1]); 17133 var boxOptionPrice = 0; 17134 var boxOptionName = ''; 17135 var boxOptionNameArr = new Array(); 17136 if(optionType == 'A') { 17137 boxOptionNameArr.push(optionAry[0]); 17138 productPrice = 0; 17139 } else { 17140 if(optionAry[0] != '' && optionAry[0] != 'undefined') { //ì¼ë°ìµì 17141 boxOptionNameArr.push(optionAry[0]); 17142 } 17143 if(etcDate != '') { //무í-ë ì§ 17144 if(boxOptionNameArr.indexOf(etcDate) === -1) boxOptionNameArr.push(etcDate); 17145 } 17146 if(textOption!='') { //ì ë ¥ìµì 17147 boxOptionNameArr.push(boxOptionTextStr); 17148 } 17149 } 17150 boxOptionName = boxOptionNameArr.join(' / '); //ìµì ëª 17151 var cnt = 0; 17152 quickbasketModal.find('.box-option-name').each(function () { 17153 var boxOptionSeq = $(this).closest('.option-count-box').find('.option_seq').val(); 17154 var boxOptionText = $(this).closest('.option-count-box').find('input[name="option_text[]"]').val(); 17155 if (quickbasketModal.find('.cl-s-option-date-selector').length > 0) { //ë ì§ì íìµì 17156 if ($(this).text() == boxOptionName || $(this).text() == etcDate) { 17157 cnt++; 17158 $(this).blur(); 17159 $.quickbasket.alertModal('ERROR','ì´ ìµì ì ì´ë¯¸ ì íëì´ ììµëë¤.','cl-modal-check-select'); 17160 } 17161 } else { 17162 if(textOption !== undefined && textOption != '') { //ì ë ¥ìµì ìì 17163 if(optionAry[3] !== undefined) { //ì¼ë°ìµì ìì
17164 if (boxOptionSeq == optionAry[3] && boxOptionText == strReplace(textOption, '"', '"')) { 17165 cnt++; 17166 $(this).blur(); 17167 $.quickbasket.alertModal('ERROR','ì´ ìµì ì ì´ë¯¸ ì íëì´ ììµëë¤.','cl-modal-check-select'); 17168 } 17169 } else { //ì¼ë°ìµì ìì 17170 if (boxOptionText == strReplace(textOption, '"', '"')) { 17171 cnt++; 17172 $(this).blur(); 17173 $.quickbasket.alertModal('ERROR','ì´ ìµì ì ì´ë¯¸ ì íëì´ ììµëë¤.','cl-modal-check-select'); 17174 } 17175 } 17176 17177 } else { //ì¼ë°ìµì ë§ 17178 if (boxOptionSeq == optionAry[3]) { 17179 cnt++; 17180 $(this).blur(); 17181 $.quickbasket.alertModal('ERROR','ì´ ìµì ì ì´ë¯¸ ì íëì´ ììµëë¤.','cl-modal-check-select'); 17182 } 17183 } 17184 } 17185 }); 17186 17187 if (cnt > 0) return false; 17188 17189 var plusOptionPrice = (optionType == 'A')? optionPrice : ((productPrice * 1) + optionPrice) * dateCheckCnt; 17190 if(plusOptionPrice < 0) { 17191 alert('구매ê¸ì¡ì´ 0ìë³´ë¤ ì ì ì ììµëë¤.\r\ní매ììê² ë¬¸ìíì¸ì.'); 17192 return false; 17193 } 17194 if(optionType == 'A' && (optionAry[0]).indexOf(' / ') > -1) { 17195 var tmp = (optionAry[0]).split(' / '); 17196 optionAry[0] = tmp[1]; 17197 } 17198 var totalPriceOption = (plusOptionPrice + total); 17199 var html = ''; 17200 if(optionType == 'A') html += '<div class="option-count-box additional">'; 17201 else html += '<div class="option-count-box">'; 17202 html += '<input type="hidden" name="option_price[]" value="'+plusOptionPrice+'">'; 17203 html += '<input type="hidden" name="option_seq[]" class="option_seq" value="'+optionAry[3]+'">'; 17204 html += '<input type="hidden" class="total-quantity" value="'+optionAry[2]+'">'; 17205 if (type) html += '<input type="hidden" name="option_name[]" value="noneOption">'; 17206 else html += '<input type="hidden" name="option_name[]" value="'+optionAry[0]+'">'; 17207 if(optionType != '') html += '<input type="hidden" name="option_type[]" value="'+optionType+'">'; 17208 else html += '<input type="hidden" name="option_type[]" value="">'; 17209 html += '<input type="hidden" name="option_text[]" value="'+textOption+'">'; 17210 html += '<div class="box-option-row">'; 17211 if ($('.cl-s-option-date-selector').length > 0) { //ê¸°ê° ìì 17212 if(optionType != 'A') { 17213 html += '<input type="hidden" name="etc_start_date[]" value="'+etcStartDate+'">'; 17214 html += '<input type="hidden" name="etc_end_date[]" value="'+etcEndDate+'">'; 17215 } else { 17216 html += '<input type="hidden" name="etc_start_date[]" value="">'; 17217 html += '<input type="hidden" name="etc_end_date[]" value="">'; 17218 } 17219 if (type) html += '<div class="box-option-name">' + etcDate + '</div>'; 17220 else html += '<div class="box-option-name">' + boxOptionName + '</div>'; 17221 } else { //ê¸°ê° ìì 17222 html += '<div class="box-option-name">'+boxOptionName+'</div>'; 17223 } 17224 html += '<div class="box-option-del"><span class="box-delete"><svg viewBox="0 0 12 12" width="12" height="12"><polygon points="12 0.71 11.29 0 6 5.29 0.71 0 0 0.71 5.29 6 0 11.29 0.71 12 6 6.71 11.29 12 12 11.29 6.71 6 "/></svg></span></div>'; 17225 html += '</div>'; //end row 17226 17227 // íì¼ëª ì¶ê° 17228 if (trimmedName && fileSize) { 17229 html += '<div class="quick-option-file2">'; // ìë¡ì´ ì¤ 17230 html += '<span class="quick-option-file-name">' + trimmedName + '</span><br>'; 17231 html += '<span class="quick-option-file-size">' + fileSize + '</span>'; 17232 html += '</div>'; 17233 } 17234 17235 html += '<div class="box-option-row">'; 17236 html += '<div class="box-option-price">
17236<span class="option-price">'+number_format(plusOptionPrice)+'</span>ì</div>'; 17237 html += '<div class="box-option-count">'; 17238 html += '<div class="form-group">'; 17239 html += '<span class="min"><svg viewBox="0 0 11 11" width="11" height="11"><rect y="5" width="11" height="1"/></svg></span>'; 17240 html += '<input type="text" class="option-normal-price" value="1" numberOnly="true" name="option_count[]">'; 17241 html += '<span class="plus"><svg viewBox="0 0 11 11" width="11" height="11"><polygon points="6 5 6 0 5 0 5 5 0 5 0 6 5 6 5 11 6 11 6 6 11 6 11 5 "/></svg></span>'; 17242 html += '</div>'; 17243 html += '</div>'; 17244 html += '</div>'; //end row 17245 html += '</div>'; 17246 17247 return html; 17248 }, 17249 pdOptionPick: function (obj, productPrice) { 17250 // console.log('pdOptionPick() ----------------------------------------------'); 17251 // console.log($.quickbasket.data); 17252 17253 var quickbasketModal = $(obj).closest('.cl-quickbasket-modal'), 17254 type = '', 17255 option = obj.getAttribute('data-val'), 17256 optionAry = option.split('||'), 17257 optionStatus = obj.getAttribute('data-status'), 17258 optionType = obj.getAttribute('data-option_type'), 17259 _idx = obj.getAttribute('data-idx'), 17260 total = 0, 17261 totalCnt = 1, 17262 dateCheckCnt = 1, 17263 submit = false, 17264 reSelected = false, 17265 parent = $(obj).closest('.cl-s-option-selector'), 17266 textParent = $(obj).closest('.cl-s-option-text'), 17267 selectedBoxTitle = parent.find('.selected-option-title').text(), 17268 selectedPrice = $(obj).attr('data-option-price'), 17269 onlySelectedText = $(obj).find('.option-name').text(); 17270 17271 if(quickbasketModal.find('.cl-s-normal-option-selector').length > 1 && !$.quickbasket.checkQty(optionAry)) return false; //ìµì ì¬ê³ ìë ê²ì¬ 17272 17273 selectedBoxTitle += (selectedBoxTitle.length > 0) ? ' / ' : ''; 17274 if(selectedPrice != undefined) { 17275 selectedPrice = (selectedPrice.indexOf('-') > -1) ? '-' + number_format(selectedPrice.substring(1)) : '+' + number_format(selectedPrice); 17276 selectedPrice = ' (' + selectedPrice + 'ì)'; 17277 } else selectedPrice = ''; 17278 17279 if(parent.hasClass('cl-s-normal-option-selector')) { 17280 var selected_option = $(obj).parents('.cl-s-normal-option-selector'), 17281 selected_index = selected_option.attr('data-def-index'), 17282 last_index = quickbasketModal.find('.cl-s-normal-option-selector').last().attr('data-def-index'); 17283 if (selected_index != last_index) reSelected = true; 17284 } 17285 17286 // íìë©ë´ 리ì 17287 if(selected_index != undefined) { 17288 $.each(quickbasketModal.find('.cl-s-normal-option-selector'), function(i,v) { 17289 if(i > Number(selected_index)) { 17290 var otitle = $(this).find('.selected-option-title').text(); 17291 $(this).addClass('option-disabled'); 17292 $(this).find('.selected-option') 17293 .attr('data-selected_option','') 17294 .attr('data-val','') 17295 .attr('data-status',''); 17296 $(this).find('.selected-option-text').text(otitle); 17297 } 17298 }); 17299 } 17300 17301 setTimeout(function() { 17302 var checkSelectEmpty = (quickbasketModal.find('.cl-s-option-selector.option-required .selected-option[data-val=""]').length > 0) ? true : false, 17303 checkInputEmpty = false; 17304 quickbasketModal.find('.text-option-box input').each(function() { 17305 if($(this).val() == '' || $(this).val().trim() == '') checkInputEmpty = true; 17306 }); 17307 17308 if(!checkSelectEmpty && !checkInputEmpty) quickbasketModal.find('.text-option-btn').removeClass('disabled'); 17309 else quickbasketModal.find('.text-option-btn').addClass('disabled'); 17310 }, 100); 17311 17312 // ì¶ê°ìµì ì¡´ì¬ 17313 if(quickbasketModal.find('.cl-s-option-text input').length > 0 || quickbasketModal.find('.cl-s-normal-option-selector.option-disabled').length > 0 || reSelected) { 17314 //ì ë í¸ë°ì¤ ì í 17315 var optionSelectedVal = (quickbasketModal.find('.cl-s-option-text input').length > 0) ? quickbasketModal.find('#selected-product-option').attr('data-val') : ''; 17316 var selectedOptionName = selectedBoxTitle + onlySelectedText + selectedPrice; 17317 if (optionType == null) { 17318 parent.find('.selected-option-text').text(selectedOptionName); 17319 parent.find('.selected-option').attr('data-selected_option', onlySelectedText); 17320 parent.find('.selected-option').attr('data-val', option); 17321 parent.find('.selected-option').attr('data-status', optionStatus); 17322 } 17323 17324 // console.log(obj.getAttribute('data-type')); 17325 if(quickbasketModal.find('.cl-s-normal-option-selector.option-disabled').length == 0) { 17326 quickbasketModal.find('.cl-s-option-text input').prop('readonly', false); 17327 } 17328 17329 if(obj.getAttribute('data-type') == '1') { 17330 quickbasketModal.find('.cl-s-normal-option-selector.option-disabled').eq(0).removeClass('option-disabled'); 17331 } else if(obj.getAttribute('data-type') == '2') { 17332 var $required = quickbasketModal.find('.cl-s-normal-option-selector').eq(1), 17333 $op = $required.find('.product-option-box'), 17334 idx = 0; 17335 17336 $required.find('.selected-option-text').text('ì í'); 17337 $op.empty(); 17338 var selectedMix2 = onlySelectedText;
17338 // 첫 ë²ì§¸ ìµì ìì ì íí ê° 17339 $.each($.quickbasket.data.list.normal[_idx]['value'], function(a,b) { 17340 if (b.option_mix2 !== selectedMix2) return true; 17341 if(b.option_status == 'H') return true; 17342 var custom_option_number = (a + 1).toString().padStart(2, '0'); 17343 b.option_number = custom_option_number; 17344 var div_property = ''; 17345 if(!b.soldout) { 17346 div_property += 'onclick="$.quickbasket.pdOptionPick(this, \'' + productPrice + '\')" '; 17347 div_property += 'data-status="normal" '; 17348 div_property += 'data-idx="' + a + '" '; 17349 // if(o_key == 'normal') div_property += 'data-option-index="' + og_idx + '" '; 17350 div_property += 'data-option-price="' + b.option_price + '" '; 17351 } 17352 var option_str = { 17353 'div_class': (b.soldout) ? 'sold-out' : '', 17354 'div_property': div_property, 17355 'span1': (b.soldout) ? '<span class="text-d-lt">' : '', 17356 'span2': (b.soldout) ? '</span>' : '', 17357 'seq': 'data-option-seq="'+b.option_seq+'"', 17358 'soldout': (b.soldout) ? '<label>íì </label>' : '', 17359 } 17360 17361 var s = '\ 17362 <div class="' + option_str.div_class + '" data-val="' + b.val + '" ' + option_str.div_property + '>\ 17363 ' + option_str.span1 + '\ 17364 <span class="number">' + b.option_number + '.</span>\ 17365 <div class="option-name" ' + option_str.seq + '>' + b.option_name + option_str.soldout + '</div>\ 17366 <span class="price">' + b.option_price_str + ' ì</span>\ 17367 ' + option_str.span2 + '\ 17368 </div>\ 17369 '; 17370 17371 17372 /* 17373 if(soldout == true) { 17374 var s = '\ 17375 <div class="sold-out" data-val="' + b.option_name + '||' + b.option_price + '||0">\ 17376 <span class="text-d-lt">\ 17377 <span class="number">' + b.option_number + '.</span>\ 17378 <div class="option-name" data-option-seq="' + b.option_seq + '">' + b.option_name + '<label>íì </label></div>\ 17379 <span class="price">' + b.option_price_str + ' ì</span>\ 17380 </span>\ 17381 </div>\ 17382 '; 17383 } else { 17384 var s = '\ 17385 <div data-val="' + b.option_name + '||' + b.option_price + '||' + quantity + '||' + b.option_seq + '" onclick="$.quickbasket.pdOptionPick(this, \'' + productPrice + '\')" data-status="normal" data-idx=' + a + ' data-option-price="' + b.option_price + '">\ 17386 <span class="number">' + b.option_number + '.</span>\ 17387 <div class="option-name" data-option-seq="' + b.option_seq + '">' + b.option_name + '</div>\ 17388 <span class="price">' + b.option_price_str + ' ì</span>\ 17389 </div>\ 17390 '; 17391 } 17392 */ 17393 $op.append(s); 17394 idx++; 17395 }); 17396 $required.removeClass('option-disabled'); 17397 } else if(obj.getAttribute('data-type') == '3') { 17398 17399 var option_index = obj.getAttribute('data-option-index'), 17400 selected_index = Number(option_index) + 1, 17401 $required = quickbasketModal.find('.cl-s-normal-option-selector').eq(selected_index), 17402 $op = $required.find('.product-option-box'), 17403 idx = 0; 17404 $data = (option_index == '0') ? $.quickbasket.data.list.normal[_idx]['value'] : $.quickbasket.data.list.normal[_idx]['value2']; 17405 17406 if(option_index == '1') { 17407 var s1 = quickbasketModal.find('.cl-s-normal-option-selector').eq(0).find('.selected-option').attr('data-selected_option'), 17408 s2 = onlySelectedText, 17409 result = []; 17410 $.each($.quickbasket.data.list.normal_org, function(a,b) { 17411 if(b['option_mix2'] == s1 && b['option_mix3'] == s2) { 17412 var tmp = b; 17413 tmp['option_number'] = String(result.length + 1).padStart(2, '0'); 17414 result.push(tmp); 17415 } 17416 }); 17417 17418 $data = result; 17419 } 17420 // $required.find('.selected-option-text').text('ì í'); 17421 17422 $op.empty(); 17423 $.each($data, function(a,b) { 17424 var div_property = ''; 17425 if(selected_index == '2' && b.soldout) { 17426 } else { 17427 div_property += 'onclick="$.quickbasket.pdOptionPick(this, \'' + productPrice + '\')" '; 17428 // div_property += 'data-status="' + data.option_data.product_state + '" '; 17429 div_property += 'data-status="normal" data-type="3" ';
17430 div_property += 'data-idx="' + a + '" '; 17431 div_property += 'data-option-index="' + selected_index + '" '; 17432 div_property += 'data-option-price="' + b.option_price + '" '; 17433 } 17434 var option_val_arr = b.val.split('||'); 17435 option_val_arr[0] = (selected_index == '2') ? b.option_name : b.option_mix3; 17436 var option_str = { 17437 'div_class': (b.soldout) ? 'sold-out' : '', 17438 'div_property': div_property, 17439 'span1': (b.soldout) ? '<span class="text-d-lt">' : '', 17440 'span2': (b.soldout) ? '</span>' : '', 17441 'seq': 'data-option-seq="'+b.option_seq+'"', 17442 'soldout': (selected_index == '2' && b.soldout) ? '<label>íì </label>' : '', 17443 'val' : option_val_arr.join('||'), 17444 } 17445 17446 var s = '\ 17447 <div class="' + option_str.div_class + '" data-val="' + option_str.val + '" ' + option_str.div_property + '>\ 17448 ' + option_str.span1 + '\ 17449 <span class="number">' + b.option_number + '.</span>\ 17450 <div class="option-name" ' + option_str.seq + '>' + option_val_arr[0] + option_str.soldout + '</div>\ 17451 <span class="price">' + b.option_price_str + ' ì</span>\ 17452 ' + option_str.span2 + '\ 17453 </div>\ 17454 '; 17455 17456 17457 17458 // var quantity = ($.quickbasket.data.product_quantity_on == 'on') ? b.option_quantity : 99999, 17459 // soldout = (quantity == 0 || b.option_status == 'O') ? true : false, 17460 // col = (selected_index == '2') ? b.option_name : b.option_mix3; 17461 // if(selected_index == '2' && soldout == true) { 17462 // var s = '\ 17463 // <div class="sold-out" data-val="' + b.option_name + '||' + b.option_price + '||0">\ 17464 // <span class="text-d-lt">\ 17465 // <span class="number">' + b.option_number + '.</span>\ 17466 // <div class="option-name" data-option-seq="' + b.option_seq + '">' + col + '<label>íì </label></div>\ 17467 // <span class="price">' + b.option_price_str + ' ì</span>\ 17468 // </span>\ 17469 // </div>\ 17470 // '; 17471 // } else { 17472 // var s = '\ 17473 // <div data-val="' + col + '||' + b.option_price + '||' + quantity + '||' + b.option_seq + '" onclick="$.quickbasket.pdOptionPick(this, \'' + productPrice + '\')" data-status="normal" data-idx=' + _idx + ' data-type="3" data-option-index="' + selected_index + '" data-option-price="' + b.option_price + '">\ 17474 // <span class="number">' + b.option_number + '.</span>\ 17475 // <div class="option-name" data-option-seq="' + b.option_seq + '">' + col + '</div>\ 17476 // <span class="price">' + b.option_price_str + ' ì</span>\ 17477 // </div>\ 17478 // '; 17479 // } 17480 $op.append(s); 17481 idx++; 17482 }); 17483 $required.removeClass('option-disabled'); 17484 } 17485 17486 optionAry = (typeof optionSelectedVal !== 'undefined' && optionSelectedVal) ? optionSelectedVal.split('||') : optionAry; 17487 17488 if (optionType == 'A') { 17489 optionAry = option.split('||'); 17490 } 17491 // var boxOptionName = optionAry[0] ; 17492 if (optionType != 'A') { 17493 parent.find(".product-option-box").slideToggle(300); 17494 17495 if (parent.find(".selected-option").hasClass('active') === true) { 17496 parent.find(".selected-option").removeClass('active'); 17497 } else { 17498 parent.find(".selected-option").addClass('active'); 17499 } 17500 17501 return false;
17502 } 17503 } else { 17504 //ì ë í¸ë°ì¤ ì í 17505 var selectedOptionName = selectedBoxTitle + onlySelectedText + selectedPrice; 17506 if (optionType == null) { 17507 parent.find('.selected-option-text').text(selectedOptionName); 17508 parent.find('.selected-option').attr('data-selected_option', onlySelectedText); 17509 parent.find('.selected-option').attr('data-val', option); 17510 parent.find('.selected-option').attr('data-status', optionStatus); 17511 } 17512 17513 option = quickbasketModal.find('.selected-option:not(#selected-delivery-type)').eq(0).attr('data-val'); 17514 17515 if(option == undefined || option == '') { 17516 submit = false; 17517 } else { 17518 optionAry = option.split('||'); 17519 optionStatus = quickbasketModal.find('#selected-product-option').attr('data-status'); 17520 optionType = quickbasketModal.find('#selected-product-option').attr('data-option_type'); 17521 submit = true; 17522 } 17523 } 17524 17525 if($(obj).parents('.cl-s-option-selector').hasClass('cl-s-normal-option-selector')) { 17526 // ì¶ê°ë 기본 ìµì 17527 $.each(quickbasketModal.find('.selected-option.ex'), function(i,v) { 17528 var selectedOption = $(this).attr('data-val'); 17529 if(selectedOption == undefined) selectedOption = ''; 17530 var ex_option_arry = selectedOption.split('||'); 17531 if(ex_option_arry[0] !== undefined) { 17532 if(optionAry[0] !== undefined) optionAry[0]+=' / ' + ex_option_arry[0]; 17533 } 17534 if(ex_option_arry[1] !== undefined) { 17535 if(optionAry[1] !== undefined) optionAry[1] = Number(optionAry[1]) + Number(ex_option_arry[1]); 17536 } 17537 if(ex_option_arry[2] !== undefined) { 17538 if(optionAry[2] !== undefined) optionAry[2] = Number(ex_option_arry[2]); 17539 } 17540 if(ex_option_arry[3] !== undefined) { 17541 if($.quickbasket.data.options_type == '1') { 17542 if(optionAry[3] !== undefined) optionAry[3]+=',' + ex_option_arry[3]; 17543 } else optionAry[3] = ex_option_arry[3]; 17544 } 17545 }); 17546 } 17547 17548 if($(obj).parents('.cl-s-option-selector').hasClass('cl-s-addt-option-selector')) { 17549 var option_title = selectedBoxTitle; 17550 option = $(obj).attr('data-val'); 17551 optionType = $(obj).attr('data-option_type'); 17552 optionAry = option.split('||'); 17553 if(optionAry[0] !== undefined) optionAry[0] = option_title + optionAry[0]; 17554 $(obj).parents('.cl-s-option-selector').removeClass('active'); 17555 } 17556 17557 //html ìì± 17558 var html = $.quickbasket.pdOptionBoxHtml(productPrice, type, optionStatus, optionType == null ? '' : optionType, optionAry, ''); 17559 parent.find('.product-option-box').slideToggle(300); 17560 17561 if (parent.find('.selected-option').hasClass('active') === true) parent.find('.selected-option').removeClass('active'); 17562 else parent.find('.selected-option').addClass('active'); 17563 17564 if(quickbasketModal.find('.cl-s-option-text').length > 0 && optionType != 'A') { 17565 return false; 17566 } else { 17567 quickbasketModal.find('.option-select-box').append(html); 17568 if(quickbasketModal.find('.option-count-box:not(.additional)').length > 0) quickbasketModal.find('.modal-footer .ok-button-dialog').addClass('active'); 17569 else quickbasketModal.find('.modal-footer .ok-button-dialog').removeClass('active'); 17570 } 17571 17572 //í©ê³ 17573 $.quickbasket.pdTotalPriceUpdate(); 17574 17575 if (optionStatus === null || optionStatus=='etc') { 17576 var lastBox = quickbasketModal.find('.option-count-box').last(); 17577 var totalQuantity = lastBox.find('.total-quantity').val(); 17578 var state = quickbasketModal.find('#product_state').val(); 17579 var optionSeq = lastBox.find('input[name="option_seq[]"]').val(); 17580 var optionName = lastBox.find('input[name="option_name[]"]').val(); 17581 var optionStartDate = lastBox.find('input[name="etc_start_date[]"]').val(); 17582 var optionCount = quickbasketModal.find('input[name="option_count[]"]'); 17583 var optionCountAry = []; 17584 var etcTotalCount = 0; 17585 17586 if(optionStartDate!==undefined && optionStartDate.length > 0) { 17587 var sameOptions = (optionName!='noneOption') ? quickbasketModal.find('input[value="'+optionSeq+'"]').closest('.option-count-box').find('input[name="option_count[]"]') : quickbasketModal.find('input[value="'+optionName+'"]').closest('.option-count-box').find('input[name="option_count[]"]'); 17588 var sameOptionsTotal = sameOptions.find('.total-quantity').val(); 17589 17590 sameOptions.each(function(){ 17591 etcTotalCount += Number($(this).val()); 17592 }); 17593 17594 if(etcTotalCount > totalQuantity) { 17595 // alert('ì¬ê³ ìë('+totalQuantity+'ê°) ì´ì 구매íì¤ ì ììµëë¤.'); 17596 $(this).blur(); 17597 $.quickbasket.alertModal('ERROR','ì¬ê³ ìë('+totalQuantity+'ê°) ì´ì 구매íì¤ ì ììµëë¤.','cl-modal-check-quantity'); 17598 lastBox.remove(); 17599 } 17600 $.quickbasket.pdTotalPriceUpdate(); 17601 submit = true; 17602 } 17603 } 17604 17605 if(submit) { 17606 // ìµì ì´ê¸°í 17607 quickbasketModal.find('.selected-option') 17608 .attr('data-selected_option','') 17609 .attr('data-val','') 17610 .attr('data-status',''); 17611 // .find('.selected-option-text').text('ì í'); 17612 $.each(quickbasketModal.find('.cl-s-option-selector'), function(i,v) { 17613 var title = $(this).find('.selected-option-title').text(); 17614 if(title == '') title = 'ì í'; 17615 $(this).find('.selected-option-text').text(title); 17616 }); 17617 $.each(quickbasketModal.find('.cl-s-normal-option-selector'), function(i,v) { 17618 if(i > 0) $(this).addClass('option-disabled'); 17619 }); 17620 quickbasketModal.find('#etc-start-date-option, #etc-end-date-option, #etc-time, #etc-start-date-txt, #etc-end-date-txt').val(''); 17621 quickbasketModal.find('.selected-option > span').each(function(idx, v){ 17622 if($(v).attr('data-default') !== undefined) { 17623 $(v).text($(v).attr('data-default')); 17624 } 17625 }); 17626 } 17627 17628 17629 quickbasketModal.find('.option-select-box .box-option-count .plus').off('click').on('click', function(e) { 17630 if($('.cl-modal-check-quantity').length > 0) { 17631 e.preventDefault(); 17632 return false; 17633 } 17634 17635 var totalQuantity = $(this).closest('.option-count-box').find('.total-quantity').val(); 17636 var count = $(this).parent().children('input').val(); 17637 var state = quickbasketModal.find('#product_state').val(); 17638 var optionSeq = $(this).closest('.option-count-box').find('input[name="option_seq[]"]').val(); 17639 var optionName = $(this).closest('.option-count-box').find('input[name="option_name[]"]').val(); 17640 var optionStartDate = $(this).closest('.option-count-box').find('input[name="etc_start_date[]"]').val(); 17641 var etcTotalCount = 0; 17642 17643 var target = this; 17644 var sameCount = 0; 17645 quickbasketModal.find('input[name="option_seq[]"][value="' + optionSeq + '"]').each(function() { 17646 if($(this).closest('.option-count-box').has(target).length === 0) { 17647 sameCount += Number($(this).parent().find('input[name="option_count[]"]').val()); 17648 } 17649 }); 17650 17651 17652 if (count > 1000) { 17653 $(this).blur(); 17654 $.quickbasket.alertModal('ERROR','ìµë 구매 ìëì 1000ê° ì ëë¤.','cl-modal-check-quantity'); 17655 return false;
17656 } 17657 17658 count = (count * 1) + 1; 17659 17660 if(optionStartDate!==undefined && optionStartDate.length > 0){ 17661 etcTotalCount = 0; 17662 17663 var sameOptions = (optionName!='noneOption') ? quickbasketModal.find('input[value="'+optionSeq+'"]').closest('.option-count-box').find('input[name="option_count[]"]') : quickbasketModal.find('input[value="'+optionName+'"]').closest('.option-count-box').find('input[name="option_count[]"]'); 17664 17665 var sameOptionsTotal = sameOptions.find('.total-quantity').val(); 17666 sameOptions.each(function(){ 17667 etcTotalCount += Number($(this).val()); 17668 }); 17669 17670 if(etcTotalCount >= totalQuantity) { 17671 $(this).blur(); 17672 $.quickbasket.alertModal('ERROR','ì¬ê³ ìë('+totalQuantity+'ê°) ì´ì 구매íì¤ ì ììµëë¤.','cl-modal-check-quantity'); 17673 return false; 17674 } 17675 } 17676 else { 17677 if(count + sameCount > totalQuantity) { 17678 $(this).blur(); 17679 $.quickbasket.alertModal('ERROR','ì¬ê³ ìë('+totalQuantity+'ê°) ì´ì 구매íì¤ ì ììµëë¤.','cl-modal-check-quantity'); 17680 count = totalQuantity - sameCount; 17681 } 17682 } 17683 17684 17685 $(this).parent().children('input').val(count); 17686 $.quickbasket.pdTotalPriceUpdate(); 17687 }); 17688 quickbasketModal.find('.option-select-box .box-option-count .min').off('click').on('click', function(e) { 17689 if($('.cl-modal-check-quantity').length > 0) { 17690 e.preventDefault(); 17691 return false; 17692 } 17693 17694 var count = $(this).parent().children('input').val(); 17695 count = (count * 1) - 1; 17696 17697 if (count < 1) { 17698 $(this).blur(); 17699 $.quickbasket.alertModal('ERROR','ìµì 구매 ìëì 1ê° ì ëë¤.','cl-modal-check-quantity'); 17700 e.preventDefault(); 17701 return false; 17702 } 17703 17704 $(this).parent().children('input').val(count); 17705 $.quickbasket.pdTotalPriceUpdate(); 17706 }); 17707 17708 quickbasketModal.find('.option-normal-price').on('keyup blur', function(e) { 17709 if (e.keyCode == 13 || $('.cl-modal-check-quantity').length > 0) { 17710 e.preventDefault(); 17711 return false; 17712 } 17713 17714 var totalQuantity = $(this).closest('.option-count-box').find('.total-quantity').val(), 17715 cnt = $(this).val(); 17716 var state = quickbasketModal.find('#product_state').val(); 17717 var optionSeq = $(this).closest('.option-count-box').find('input[name="option_seq[]"]').val(); 17718 var optionName = $(this).closest('.option-count-box').find('input[name="option_name[]"]').val(); 17719 var optionStartDate = $(this).closest('.option-count-box').find('input[name="etc_start_date[]"]').val(); 17720 var etcTotalCount = 0; 17721 17722 cnt = (cnt) ? Number(cnt.replace(/[^0-9\.]/g,'')) : ''; 17723 if (!cnt) { 17724 // if(e.type == 'blur') { 17725 // $.quickbasket.alertModal('ERROR','ìµì 구매 ìëì 1ê° ì ëë¤.','cl-modal-check-quantity'); 17726 // return false; 17727 // } else { 17728 // return false; 17729 // } 17730 e.preventDefault(); 17731 return false; 17732 } 17733 $(this).val(cnt); 17734 17735 if(cnt < 1) { 17736 $.quickbasket.alertModal('ERROR','ìµì 구매 ìëì 1ê° ì ëë¤.','cl-modal-check-quantity'); 17737 $(this).val(1); 17738 return false; 17739 } 17740 if(totalQuantity==99999 && cnt > 1000) { 17741 $.quickbasket.alertModal('ERROR','ìµë 구매 ìëì 1000ê° ì ëë¤.','cl-modal-check-quantity'); 17742 cnt = 1000; 17743 $(this).val(cnt); 17744 return false;
17745 } 17746 17747 var target = this; 17748 var sameCount = 0; 17749 quickbasketModal.find('input[name="option_seq[]"][value="' + optionSeq + '"]').each(function() { 17750 if($(this).closest('.option-count-box').has(target).length === 0) { 17751 sameCount += Number($(this).parent().find('input[name="option_count[]"]').val()); 17752 } 17753 }); 17754 17755 cnt += sameCount; 17756 17757 if(optionStartDate!==undefined && optionStartDate.length > 0){ 17758 etcTotalCount = 0; 17759 17760 var sameOptions = (optionName!='noneOption')? quickbasketModal.find('input[value="'+optionSeq+'"]').closest('.option-count-box').find('input[name="option_count[]"]') : quickbasketModal.find('input[value="'+optionName+'"]').closest('.option-count-box').find('input[name="option_count[]"]'); 17761 17762 var sameOptionsTotal = sameOptions.find('.total-quantity').val(); 17763 sameOptions.each(function(){ 17764 etcTotalCount += Number($(this).val()); 17765 }); 17766 17767 if(etcTotalCount > totalQuantity) { 17768 var $this = $(this).val(); 17769 $(this).blur(); 17770 $.quickbasket.alertModal('ERROR','ì¬ê³ ìë('+totalQuantity+'ê°) ì´ì 구매íì¤ ì ììµëë¤.','cl-modal-check-quantity'); 17771 $(this).val($this-(etcTotalCount-totalQuantity)); 17772 return false; 17773 } 17774 17775 } 17776 else { 17777 if(cnt > totalQuantity) { 17778 $(this).blur(); 17779 $.quickbasket.alertModal('ERROR','ì¬ê³ ìë('+totalQuantity+'ê°) ì´ì 구매íì¤ ì ììµëë¤.','cl-modal-check-quantity'); 17780 $(this).val(totalQuantity - sameCount); 17781 return false; 17782 } 17783 } 17784 17785 $.quickbasket.pdTotalPriceUpdate(); 17786 }); 17787 17788 quickbasketModal.find('.option-select-box .box-delete').off('click').on('click', function(e) { 17789 var optionCountBox = $(this).closest('.option-count-box'), 17790 optionName = optionCountBox.find('input[name="option_name[]"]').val(); 17791 17792 if(optionName == 'noneOption') { 17793 if(quickbasketModal.find('.cl-s-option-text').length > 0) { 17794 quickbasketModal.find('.cl-s-option-text > input').prop('readonly', false); 17795 optionCountBox.find('input[name="option_text[]"]').val(''); 17796 } 17797 } 17798 optionCountBox.remove(); 17799 if(quickbasketModal.find('.option-count-box:not(.additional)').length > 0) quickbasketModal.find('.modal-footer .ok-button-dialog').addClass('active'); 17800 else quickbasketModal.find('.modal-footer .ok-button-dialog').removeClass('active'); 17801 17802 $.quickbasket.pdTotalPriceUpdate(); 17803 }); 17804 }, 17805 pdTextOptionPick: function (pickBtn, productPrice, type, options_type) { 17806 // console.log('pdTextOptionPick() ----------------------------------------------'); 17807 17808 var type = (typeof type == 'undefined') ? '' : type, 17809 pickOption = document.querySelector('#selected-product-option'), 17810 option = (pickOption !== null) ? pickOption.getAttribute('data-val') : '', 17811 optionAry = (pickOption !== null) ? option.split('||') : [], 17812 optionStatus = (pickOption !== null) ? pickOption.getAttribute('data-status') : $(pickBtn).closest('.cl-s-option-text').attr('data-status'), 17813 optionType = (pickOption !== null) ? pickOption.getAttribute('data-option_type') : type; 17814 17815 if(optionType == null) optionType = ''; 17816 // _idx = obj.getAttribute('data-idx'), 17817 var stock = optionAry[2], 17818 cnt = 0, 17819 total = 0, 17820 totalCnt = 1, 17821 // dateCheckCnt = 1, 17822 // submit = false, 17823 // reSelected = false, 17824 quickbasketModal = $(pickBtn).closest('.cl-quickbasket-modal'), 17825 parent = $(pickBtn).closest('.cl-s-text-option-selector'), 17826 textParent = parent.find('.text-option-box'), 17827 textOptionT = quickbasketModal.find('.cl-s-option-text input[data-option_type="T"], .cl-s-option-text input[data-option_type="TR"]'),
17828 textOptionTarr = []; 17829 // selectedBoxTitle = parent.find('.selected-option-title').text(), 17830 // selectedPrice = $(obj).attr('data-option-price'), 17831 // onlySelectedText = $(obj).find('.option-name').text(); 17832 17833 // if(selectedOption !== null && typeof obj.getAttribute('data-option_type') != 'undefined') optionType = obj.getAttribute('data-option_type'); 17834 quickbasketModal.find('input[name="option_seq[]"][value="' + optionAry[3] + '"]').each(function() { 17835 if(textParent.find('input[name="product_state"]').val() == 'download') cnt += 1; 17836 else cnt += Number($(this).parent().find('input[name="option_count[]"]').val()); 17837 }); 17838 17839 if(cnt + 1 > stock) { 17840 $(this).blur(); 17841 $.quickbasket.alertModal('ERROR','ì¬ê³ ìë('+stock+'ê°) ì´ì 구매íì¤ ì ììµëë¤.','cl-modal-check-quantity'); 17842 return false; 17843 } 17844 17845 // ì¶ê°ë 기본 ìµì 17846 $.each(quickbasketModal.find('.selected-option.ex'), function(i,v) { 17847 var ex_option_arry = $(this).attr('data-val').split('||'); 17848 if(ex_option_arry[0] !== undefined) { 17849 if(optionAry[0] !== undefined) optionAry[0]+=' / ' + ex_option_arry[0]; 17850 } 17851 if(ex_option_arry[1] !== undefined) { 17852 if(optionAry[1] !== undefined) optionAry[1] = Number(optionAry[1]) + Number(ex_option_arry[1]); 17853 } 17854 if(ex_option_arry[3] !== undefined) { 17855 if($.quickbasket.data.options_type == '1') { 17856 if(optionAry[3] !== undefined) optionAry[3]+=',' + ex_option_arry[3]; 17857 } else optionAry[3] = ex_option_arry[3]; 17858 } 17859 }); 17860 17861 if(options_type == 2 || options_type == 3) { 17862 var md5 = clmd5.hex_md5(optionAry[0]); 17863 if($.quickbasket.data.list.normal_md5.hasOwnProperty(md5)) { 17864 var selected = $.quickbasket.data.list.normal_md5[md5]; 17865 optionAry[1] = selected['option_price']; 17866 optionAry[2] = (optionAry[2] == '99999') ? '99999' : selected['option_quantity']; 17867 optionAry[3] = selected['option_seq']; 17868 } else { 17869 alert('ìµì ì íì ì¤ë¥ì ëë¤.\n ê´ë¦¬ììê² ë¬¸ìíì¸ì'); 17870 } 17871 } 17872 17873 var flag; 17874 textOptionT.each(function(){ 17875 if(checkEmojis($(this).val())) { 17876 alert('ì´ëª¨ì§ë¥¼ ì¬ì©í ì ììµëë¤.'); 17877 flag = false; 17878 return false; 17879 } 17880 }); 17881 17882 if(flag == false) { 17883 return false; 17884 } 17885 17886 textOptionT.each(function(){ 17887 if($(this).val() != "") { 17888 var objKey = $(this).attr('data-val'); 17889 var textTempObj = {}; 17890 textTempObj[$(this).attr('data-val')] = $(this).val().trim(); 17891 textOptionTarr.push(textTempObj); 17892 } 17893 }); 17894 17895 var textOption = ''; 17896 if(textOptionT.length == textOptionTarr.length) { 17897 textOption = strReplace(JSON.stringify(textOptionTarr), '"', '"'); //JSON 17898 } else { 17899 alert('íì ì ë ¥ìµì ì 모ë ì ë ¥í´ì£¼ì¸ì.'); 17900 return false; 17901 } 17902 17903 // ì¼ë°ìµì ììë ì²ë¦¬ 17904 if(optionAry[0] == ' / noneOption') { 17905 optionAry[0] = optionAry[0].replace(' / noneOption',''); 17906 } 17907 17908 var html = $.quickbasket.pdOptionBoxHtml(productPrice, type, optionStatus, optionType, optionAry, textOption, textOptionTarr); 17909 quickbasketModal.find('.option-select-box').append(html); 17910 17911 if(quickbasketModal.find('.option-count-box:not(.additional)').length > 0) quickbasketModal.find('.modal-footer .ok-button-dialog').addClass('active');
17912 else quickbasketModal.find('.modal-footer .ok-button-dialog').removeClass('active'); 17913 $.quickbasket.pdTotalPriceUpdate(); 17914 17915 if(quickbasketModal.find('.cl-s-normal-option-selector').length > 0 || quickbasketModal.find('.cl-s-option-date-selector').length > 0) textParent.find('input').val('').prop('readonly', true); 17916 else textParent.find('input').val(''); 17917 17918 quickbasketModal.find('#selected-product-option .selected-option-text').text('ì í'); 17919 quickbasketModal.find('#selected-product-option').attr('data-selected_option', ''); 17920 quickbasketModal.find('#selected-product-option').attr('data-val', ''); 17921 quickbasketModal.find('#selected-product-option').attr('data-status', ''); 17922 $(pickBtn).addClass('disabled'); 17923 17924 // ì¶ê°ë 기본 ìµì ì²ë¦¬ 17925 quickbasketModal.find('.selected-option.ex').attr('data-selected_option', ''); 17926 quickbasketModal.find('.selected-option.ex').attr('data-val', ''); 17927 quickbasketModal.find('.selected-option.ex').attr('data-status', ''); 17928 quickbasketModal.find('.selected-option.ex').parents('.cl-s-option-selector').addClass('option-disabled'); 17929 17930 quickbasketModal.find('#etc-start-date-option, #etc-end-date-option, #etc-time, #etc-start-date-txt, #etc-end-date-txt').val(''); 17931 quickbasketModal.find('.selected-option > span').each(function(idx, v){ 17932 if($(v).attr('data-default') !== undefined) { 17933 $(v).text($(v).attr('data-default')); 17934 } 17935 }); 17936 17937 // $.quickbasket.pdOptionPick(this, \'' + data.option_data.product_price + '\') 17938 17939 17940 quickbasketModal.find('.option-select-box .box-option-count .plus').off('click').on('click', function(e) { 17941 if($('.cl-modal-check-quantity').length > 0) { 17942 e.preventDefault(); 17943 return false; 17944 } 17945 17946 var totalQuantity = $(this).closest('.option-count-box').find('.total-quantity').val(); 17947 var count = $(this).parent().children('input').val(); 17948 var state = quickbasketModal.find('#product_state').val(); 17949 var optionSeq = $(this).closest('.option-count-box').find('input[name="option_seq[]"]').val(); 17950 var optionName = $(this).closest('.option-count-box').find('input[name="option_name[]"]').val(); 17951 var optionStartDate = $(this).closest('.option-count-box').find('input[name="etc_start_date[]"]').val(); 17952 var etcTotalCount = 0; 17953 17954 var target = this; 17955 var sameCount = 0; 17956 quickbasketModal.find('input[name="option_seq[]"][value="' + optionSeq + '"]').each(function() { 17957 if($(this).closest('.option-count-box').has(target).length === 0) { 17958 sameCount += Number($(this).parent().find('input[name="option_count[]"]').val()); 17959 } 17960 }); 17961 17962 17963 if (count > 1000) { 17964 // alert('ìµë 구매 ìëì 1000ê° ì ëë¤.'); 17965 $(this).blur(); 17966 $.quickbasket.alertModal('ERROR','ìµë 구매 ìëì 1000ê° ì ëë¤.','cl-modal-check-quantity'); 17967 return false; 17968 } 17969 17970 count = (count * 1) + 1; 17971 17972 if(optionStartDate!==undefined && optionStartDate.length > 0){ 17973 etcTotalCount = 0; 17974 17975 var sameOptions = (optionName!='noneOption') ? quickbasketModal.find('input[value="'+optionSeq+'"]').closest('.option-count-box').find('input[name="option_count[]"]') : quickbasketModal.find('input[value="'+optionName+'"]').closest('.option-count-box').find('input[name="option_count[]"]'); 17976 17977 var sameOptionsTotal = sameOptions.find('.total-quantity').val(); 17978 sameOptions.each(function(){ 17979 etcTotalCount += Number($(this).val()); 17980 }); 17981 17982 if(etcTotalCount >= totalQuantity) { 17983 // alert('ì¬ê³ ìë('+totalQuantity+'ê°) ì´ì 구매íì¤ ì ììµëë¤.'); 17984 $(this).blur(); 17985 $.quickbasket.alertModal('ERROR','ì¬ê³ ìë('+totalQuantity+'ê°) ì´ì 구매íì¤ ì ììµëë¤.','cl-modal-check-quantity'); 17986 return false;
17987 } 17988 } 17989 else { 17990 if(count + sameCount > totalQuantity) { 17991 // alert('ì¬ê³ ìë('+totalQuantity+'ê°) ì´ì 구매íì¤ ì ììµëë¤.'); 17992 $(this).blur(); 17993 $.quickbasket.alertModal('ERROR','ì¬ê³ ìë('+totalQuantity+'ê°) ì´ì 구매íì¤ ì ììµëë¤.','cl-modal-check-quantity'); 17994 count = totalQuantity - sameCount; 17995 } 17996 } 17997 17998 17999 $(this).parent().children('input').val(count); 18000 $.quickbasket.pdTotalPriceUpdate(); 18001 }); 18002 quickbasketModal.find('.option-select-box .box-option-count .min').off('click').on('click', function(e) { 18003 if($('.cl-modal-check-quantity').length > 0) { 18004 e.preventDefault(); 18005 return false; 18006 } 18007 18008 var count = $(this).parent().children('input').val(); 18009 count = (count * 1) - 1; 18010 18011 if (count < 1) { 18012 $(this).blur(); 18013 $.quickbasket.alertModal('ERROR','ìµì 구매 ìëì 1ê° ì ëë¤.','cl-modal-check-quantity'); 18014 return false; 18015 } 18016 18017 $(this).parent().children('input').val(count); 18018 $.quickbasket.pdTotalPriceUpdate(); 18019 }); 18020 quickbasketModal.find('.option-normal-price').on('keyup blur', function(e) { 18021 if (e.keyCode == 13 || $('.cl-modal-check-quantity').length > 0) { 18022 e.preventDefault(); 18023 return false; 18024 } 18025 18026 var totalQuantity = $(this).closest('.option-count-box').find('.total-quantity').val(), 18027 cnt = $(this).val(); 18028 var state = quickbasketModal.find('#product_state').val(); 18029 var optionSeq = $(this).closest('.option-count-box').find('input[name="option_seq[]"]').val(); 18030 var optionName = $(this).closest('.option-count-box').find('input[name="option_name[]"]').val(); 18031 var optionStartDate = $(this).closest('.option-count-box').find('input[name="etc_start_date[]"]').val(); 18032 var etcTotalCount = 0; 18033 18034 cnt = (cnt) ? Number(cnt.replace(/[^0-9\.]/g,'')) : ''; 18035 if (!cnt) { 18036 // if(e.type == 'blur') { 18037 // $.quickbasket.alertModal('ERROR','ìµì 구매 ìëì 1ê° ì ëë¤.','cl-modal-check-quantity'); 18038 // return false; 18039 // } else { 18040 // return false; 18041 // } 18042 e.preventDefault(); 18043 return false; 18044 } 18045 $(this).val(cnt); 18046 18047 if(cnt < 1) { 18048 $.quickbasket.alertModal('ERROR','ìµì 구매 ìëì 1ê° ì ëë¤.','cl-modal-check-quantity'); 18049 $(this).val(1); 18050 return false; 18051 } 18052 if(totalQuantity==99999 && cnt > 1000) { 18053 $.quickbasket.alertModal('ERROR','ìµë 구매 ìëì 1000ê° ì ëë¤.','cl-modal-check-quantity'); 18054 cnt = 1000; 18055 $(this).val(cnt); 18056 return false; 18057 } 18058 18059 var target = this; 18060 var sameCount = 0; 18061 quickbasketModal.find('input[name="option_seq[]"][value="' + optionSeq + '"]').each(function() { 18062 if($(this).closest('.option-count-box').has(target).length === 0) { 18063 sameCount += Number($(this).parent().find('input[name="option_count[]"]').val()); 18064 } 18065 }); 18066 18067 cnt += sameCount; 18068 18069 if(optionStartDate!==undefined && optionStartDate.length > 0){ 18070 etcTotalCount = 0; 18071 18072 var sameOptions = (optionName!='noneOption')? quickbasketModal.find('input[value="'+optionSeq+'"]').closest('.option-count-box').find('input[name="option_count[]"]') : quickbasketModal.find('input[value="'+optionName+'"]').closest('.option-count-box').find('input[name="option_count[]"]'); 18073 18074 var sameOptionsTotal = sameOptions.find('.total-quantity').val(); 18075 sameOptions.each(function(){ 18076 etcTotalCount += Number($(this).val()); 18077 }); 18078 18079 if(etcTotalCount > totalQuantity) { 18080 var $this = $(this).val(); 18081 $(this).blur(); 18082 $.quickbasket.alertModal('ERROR','ì¬ê³ ìë('+totalQuantity+'ê°) ì´ì 구매íì¤ ì ììµëë¤.','cl-modal-check-quantity'); 18083 $(this).val($this-(etcTotalCount-totalQuantity)); 18084 return false;
18085 } 18086 18087 } 18088 else { 18089 if(cnt > totalQuantity) { 18090 $(this).blur(); 18091 $.quickbasket.alertModal('ERROR','ì¬ê³ ìë('+totalQuantity+'ê°) ì´ì 구매íì¤ ì ììµëë¤.','cl-modal-check-quantity'); 18092 $(this).val(totalQuantity - sameCount); 18093 return false; 18094 } 18095 } 18096 18097 $.quickbasket.pdTotalPriceUpdate(); 18098 }); 18099 quickbasketModal.find('.option-select-box .box-delete').off('click').on('click', function(e) { 18100 var optionCountBox = $(this).closest('.option-count-box'); 18101 var optionName = optionCountBox.find('input[name="option_name[]"]').val(); 18102 if(optionName == 'noneOption') { 18103 if(quickbasketModal.find('.cl-s-option-text').length > 0) { 18104 quickbasketModal.find('.cl-s-option-text > input').prop('readonly', false); 18105 optionCountBox.find('input[name="option_text[]"]').val(''); 18106 } 18107 } 18108 $(this).closest('.option-count-box').remove(); 18109 if(quickbasketModal.find('.option-count-box:not(.additional)').length > 0) quickbasketModal.find('.modal-footer .ok-button-dialog').addClass('active'); 18110 else quickbasketModal.find('.modal-footer .ok-button-dialog').removeClass('active'); 18111 $.quickbasket.pdTotalPriceUpdate(); 18112 }); 18113 }, 18114 pdTotalPriceUpdate: function () { 18115 var total_price = 0, 18116 total_cnt = 0; 18117 $('.cl-quickbasket-modal .option-select-box').find('.option-count-box:not(.additional)').each(function() { 18118 var unti_price = $(this).find('input[name="option_price[]"]').val(), 18119 cnt = $(this).find('.option-normal-price').val(), 18120 price = (Number(unti_price) * Number(cnt)); 18121 18122 total_price += price; 18123 total_cnt += Number(cnt); 18124 18125 $(this).find('.option-price').text(number_format(price)); 18126 }); 18127 18128 18129 $('.cl-quickbasket-modal .option-select-box').find('.option-count-box.additional').each(function() { 18130 var unti_price = $(this).find('input[name="option_price[]"]').val(), 18131 cnt = $(this).find('.option-normal-price').val(), 18132 price = (Number(unti_price) * Number(cnt)); 18133 18134 total_price += price; 18135 total_cnt += Number(cnt); 18136 18137 $(this).find('.option-price').text(number_format(price)); 18138 }); 18139 18140 $('.cl-quickbasket-modal .total-price-box .total-price').text(number_format(total_price)); 18141 $('.cl-quickbasket-modal .total-price-box .total-cnt').text(total_cnt); 18142 }, 18143 setKeepShopping : function(sid,page,pid,pnum) { 18144 if(typeof sid == 'undefined') sid = RENDER.b.SID; 18145 if(typeof page == 'undefined') page = (RENDER.b.VIEW) ? RENDER.b.PARENT.ppage : RENDER.b.PAGE; 18146 if(typeof pid == 'undefined') pid = (RENDER.b.VIEW) ? RENDER.b.PARENT.pid : ''; 18147 if(typeof pnum == 'undefined') pnum = (RENDER.b.VIEW) ? RENDER.b.PARENT.seq : ''; 18148 18149 var cookie_g = $.cookie('gallery'), 18150 cookie_keepsh = []; 18151 if(typeof cookie_g != 'undefined' && cookie_g) { 18152 cookie_keepsh = [page,cookie_g,$.cookie('loadmore-'+cookie_g),$.cookie('gallery-category-'+cookie_g),$.cookie('gallery-orderby-'+cookie_g),$.cookie('gallery-item')]; 18153 } else { 18154 if(pid && pnum) cookie_keepsh = [page,pid,'1','','recent',pnum]; 18155 } 18156 18157 if(cookie_keepsh.length > 0) $.cookie('keep-shopping-'+sid, cookie_keepsh.toString(), { path : '/', expires: new Date(Date.now() + 1000*60*60*3) }); 18158 }, 18159 } 18160 18161 $.products = { 18162 init : function() { 18163 $.category.init(); 18164 var isMainImageClick = false, idx = -1, replace = false; 18165 $(document) 18166 .off('click', '.cl-p-modal') 18167 .on('click', '.cl-p-modal', function(e) { 18168 if($('#prod-category-lists').css('display') == 'block') {
18169 $('.category-lists').slideUp(200, function() { 18170 $('.category-wrap').removeClass('open'); 18171 }); 18172 } 18173 $('.option-price-status-select').slideUp(200, function() { 18174 $('.option-price-status-str').removeClass('open'); 18175 }); 18176 if($('.gallery-menus-wrap').css('display') == 'block') { 18177 $('.choose-gallery').removeClass('open'); 18178 $('.gallery-menus-wrap').hide(); 18179 } 18180 }); 18181 18182 $(document) 18183 .off('click','.form-label.textarea') 18184 .on('click','.form-label.textarea', function() { $('#prod-desc').focus(); }); 18185 $(document) 18186 .off('click','.prod-modal .modal-close') 18187 .on('click','.prod-modal .modal-close', function() { $.products.close(); }); 18188 18189 $(document) 18190 .off('keydown, keyup', '#prod-desc') 18191 .on('keydown, keyup', '#prod-desc', function(){ 18192 $('#prod-desc')[0].style.height = 'auto'; 18193 var descHeight = $('#prod-desc').prop('scrollHeight'); 18194 if(descHeight > 55) { 18195 $('#prod-desc').css('height', descHeight+'px'); 18196 } 18197 18198 //size check 18199 var value = $(this).val(); 18200 if(value.length > 255){ 18201 $(this).val(value.substr(0,255).trim()); 18202 } 18203 }); 18204 18205 $(document) 18206 .off('change','.switch-product') 18207 .on('change','.switch-product', function() { 18208 $('.switch-product + label').removeClass('active'); 18209 if($(this).val() == 'off') { 18210 $('#status-append').fadeOut(0); 18211 $('#sale-calendar').hide(); 18212 } else { 18213 var check = $('input[name="product_state"]:checked').val(); 18214 var a = 0; 18215 18216 if ($('#none-option-file').length > 0) { 18217 var fileBoxCnt = $('.file-box-list').length; 18218 $('.file-box-list').each(function (idx, v) { 18219 var downloadCnt = $(v).find('.file-name').length; 18220 if (fileBoxCnt > 1) { 18221 if (a == 0) a++; 18222 else { 18223 if (check == 'D' && downloadCnt == 0) { 18224 alert('ë¤ì´ë¡ë ìíì¼ ê²½ì° íì¼ì´ 1ê° ì´ì ë±ë¡ëì´ ìì´ì¼ í©ëë¤.'); 18225 $('.switch-product[value="off"]').prop('checked', true); 18226 $('#status-append').fadeOut(0); 18227 $('#sale-calendar').hide(); 18228 a++; 18229 return false; 18230 } 18231 } 18232 } else { 18233 if (check == 'D' && downloadCnt == 0) { 18234 alert('ë¤ì´ë¡ë ìíì¼ ê²½ì° íì¼ì´ 1ê° ì´ì ë±ë¡ëì´ ìì´ì¼ í©ëë¤.'); 18235 $('.switch-product[value="off"]').prop('checked', true); 18236 $('#status-append').fadeOut(0); 18237 $('#sale-calendar').hide(); 18238 a += 2; 18239 return false; 18240 } 18241 } 18242 }); 18243 if (a <= 1) { 18244 $(this).prop('checked', true); 18245 } 18246 } else { 18247 $(this).prop('checked', true); 18248 } 18249 18250 if(a <= 1) { 18251 if($(this).val() == 'lim') { 18252 $('#status-append').fadeIn(0); 18253 $('#sale-calendar').show(); 18254 } else { 18255 $('#status-append').fadeOut(0); 18256 $('#sale-calendar').hide(); 18257 } 18258 } 18259 } 18260 }); 18261 $(document) 18262 .off('change','.switch-quantity') 18263 .on('change','.switch-quantity', function() { //ì¬ê³ ê´ë¦¬ on 18264 switchQuantity(); 18265 }); 18266 $(document) 18267 .off('input.productQuantityLimit', '#prod-quantity') 18268 .on('input.productQuantityLimit', '#prod-quantity', function() {
18269 var quantity = Number(removeCommas($(this).val())); 18270 if(quantity > 9999) { 18271 alert('ìµë ì ë ¥ ìëì 9,999 ì ëë¤.'); 18272 $(this).val(addCommas('9999')); 18273 } 18274 }) 18275 .off('keydown.productQuantityLimit', '#prod-quantity') 18276 .on('keydown.productQuantityLimit', '#prod-quantity', function(e) { 18277 var is_number_key = (e.keyCode >= 48 && e.keyCode <= 57) || (e.keyCode >= 96 && e.keyCode <= 105); 18278 var value = String(removeCommas($(this).val())); 18279 var has_selection = this.selectionStart !== this.selectionEnd; 18280 18281 if(is_number_key && !e.ctrlKey && !e.metaKey && !e.altKey && !e.shiftKey && value.length >= 4 && !has_selection) { 18282 e.preventDefault(); 18283 alert('ìµë ì ë ¥ ìëì 9,999 ì ëë¤.'); 18284 $(this).val(addCommas('9999')); 18285 } 18286 }) 18287 .off('paste.productQuantityLimit', '#prod-quantity') 18288 .on('paste.productQuantityLimit', '#prod-quantity', function(e) { 18289 var clipboard = e.originalEvent && e.originalEvent.clipboardData; 18290 var value = clipboard ? clipboard.getData('text').replace(/[^0-9]/g, '')
18290: ''; 18291 var current_value = String(removeCommas($(this).val())); 18292 var selected_value = $(this).val().substring(this.selectionStart, this.selectionEnd).replace(/[^0-9]/g, ''); 18293 var result_length = current_value.length - selected_value.length + value.length; 18294 18295 if(value !== '' && result_length > 4) { 18296 e.preventDefault(); 18297 alert('ìµë ì ë ¥ ìëì 9,999 ì ëë¤.'); 18298 $(this).val(addCommas('9999')); 18299 } 18300 }); 18301 $(document) 18302 .off('click','.switch-category') 18303 .on('click','.switch-category', function() { 18304 if($(this).is(':checked')) { 18305 $(this).parents('.form-wrap').removeClass('disabled'); 18306 $(this).parents('.form-wrap').find('.category-text').removeClass('hide'); 18307 } else { 18308 $(this).parents('.form-wrap').addClass('disabled'); 18309 $(this).parents('.form-wrap').find('.category-text').addClass('hide'); 18310 $('.category-lists').slideUp(200, function() { 18311 $('.category-wrap').removeClass('open'); 18312 }); 18313 } 18314 }); 18315 $(document) 18316 .off('change','.switch-text-option') 18317 .on('change','.switch-text-option', function() { 18318 if($(this).is(':checked')) { 18319 $(this).parents('.form-wrap').removeClass('disabled'); 18320 $(this).parents('.form-wrap').find('#text-option-name').removeClass('hide'); 18321 } else { 18322 $(this).parents('.form-wrap').addClass('disabled'); 18323 $(this).parents('.form-wrap').find('#text-option-name').addClass('hide'); 18324 } 18325 }); 18326 18327 $(document) 18328 .off('click','.switch-prod-info') 18329 .on('click','.switch-prod-info', function() { 18330 if($(this).is(':checked')) { 18331 $(this).parents('.form-wrap').removeClass('disabled'); 18332 $(this).parents('.form-wrap').find('.info-selected').removeClass('hide'); 18333 } else { 18334 $(this).parents('.form-wrap').addClass('disabled'); 18335 $(this).parents('.form-wrap').find('.info-selected').addClass('hide'); 18336 18337 } 18338 }); 18339 18340 $(document) 18341 .off('click','.switch-mngprd') 18342 .on('click','.switch-mngprd', function() { 18343 if($(this).is(':checked')) { 18344 $('#mng-prd-info').removeClass('disabled'); 18345 $(this).parents('.mng-prd-wrap').find('.mng-prd-info-toggle').removeClass('hide'); 18346 } else { 18347 $('#mng-prd-info').addClass('disabled'); 18348 $(this).parents('.mng-prd-wrap').find('.mng-prd-info-toggle').addClass('hide'); 18349 } 18350 }); 18351 18352 $(document) 18353 .off('click', '.prod-discount-unit-select:not(.disabled)') 18354 .on('click', '.prod-discount-unit-select:not(.disabled)', function(e) { 18355 $(this).find('.discount-unit-select').toggle(); 18356 }); 18357 18358 $(document) 18359 .off('click', '.discount-unit-select > div') 18360 .on('click','.discount-unit-select > div', function(e) { 18361 var val = $(this).attr('data-value'); 18362 var unitStr = $(this).text(); 18363 18364 $('#prod-discount-unit').attr('data-value', val).text(unitStr); 18365 18366 if(val == 'P') { 18367 var discountRate = Number($('#prod-discount-rate').val().replace(/,/g, '')); 18368 if(discountRate > 100) discountRate = 100; 18369 $('#prod-discount-rate').val(discountRate); 18370 // $('#price-cut-btn').removeClass('hide'); 18371 } else { 18372 var discountRate = removeCommas($('#prod-discount-rate').val()); 18373 $('#prod-discount-rate').val(number_format(discountRate)); 18374 // $('#price-cut-btn').addClass('hide'); 18375 } 18376 18377 calDiscount($('#prod-discount-rate')); 18378 }); 18379 18380 $(document) 18381 .off('click','.switch-pccc, .switch-require-navershop') 18382 .on('click','.switch-pccc, .switch-require-navershop', function(e) { 18383 if($(this).closest('.input-switch').hasClass('editor-upgrade-popup')) { 18384 e.preventDefault(); 18385 return false;
18386 } 18387 18388 // ë¤ì´ë²ì¼í off ì ìë´íì 18389 if($(this).hasClass('switch-require-navershop') && $(this).closest('.form-wrap').hasClass('use-nshop-setting')) { 18390 var modal_description = 'DBURL 기ë¥ì ì¬ì©íê³ ìì§ ììµëë¤.<br>DBURL 기ë¥ì ì¬ì©ì¼ë¡ ì¤ì í ì´ì©í ì ììµëë¤.'; 18391 var link = (uadmin == 'um' ? '/_admin' : '') + '/shopping/setting/T'; 18392 var btnstr = '<div class="btn-box">\ 18393 <a href="' + link + '" target="_blank" style="line-height:2;">DBURL ì¤ì íë¬ ê°ê¸°</a>\ 18394 <button type="button" class="btn btn-default btn-sm close-button-dialog" data-dismiss="modal">' + $.lang[LANG]['config.close'] + '</button>\ 18395 </div>\ 18396 '; 18397 18398 var str = '\ 18399 <div class="site-upgrade-notice">\ 18400 <p><span class="text-centermodal">' + modal_description + '</span></p>\ 18401 ' + btnstr + 18402 '</div>\ 18403 '; 18404 $(this).showModalFlat('ìë´', str, false, false, '', '', '', 'cl-cmmodal cl-s-btn w560 cl-p0'); 18405 e.preventDefault(); 18406 return false; 18407 } 18408 18409 if($(this).is(':checked')) { 18410 $(this).parents('.form-wrap').removeClass('disabled'); 18411 } else { 18412 $(this).parents('.form-wrap').addClass('disabled'); 18413 } 18414 }); 18415 18416 $(document) 18417 .off('click','.check-sale > .checkbox > label') 18418 .on('click','.check-sale > .checkbox > label', function() { 18419 if($(this).prev('input').is(':disabled')) { 18420 alert('0ìì¸ ìíì í ì¸ì í ì ììµëë¤.'); 18421 return false; 18422 } 18423 }); 18424 18425 $(document) 18426 .off('click','#prod-sale-check') 18427 .on('click','#prod-sale-check', function() { 18428 if($(this).parents('.check-sale').hasClass('disabled')) { 18429 alert('ê°ê²©ì´ ì°ëì´ íì±í ëì´ììµëë¤.\nê°ê²©ì°ëì 먼ì í´ì íì¸ì'); 18430 return false; 18431 } 18432 18433 $('.form-group.discount-append + .error-msg').remove(); 18434 if($(this).is(':checked')) { 18435 var prod_price = ($('#prod-price').val()) ? $('#prod-price').val() : 0; 18436 $('#prod-sale').addClass('strike'); 18437 $('#prod-sale').text(prod_price); 18438 $('#prod-sale').show(); 18439 $('.discount-append').removeClass('hide'); 18440 // $('#prod-price').val('').attr('placeholder','í ì¸ ê°ê²©ì ì ë ¥íì¸ì').focus(); 18441 $('#prod-price').prop('readonly', true); 18442 $('#prod-price').addClass('sale-on'); 18443 $('#check-sale').html('<path d="M13 0H3C1.34 0 0 1.34 0 3v10c0 1.66 1.34 3 3 3h10c1.66 0 3-1.34 3-3V3C16 1.34 14.66 0 13 0zM13.03 6.03l-5.5 5.5C7.38 11.68 7.19 11.75 7 11.75s-0.38-0.07-0.53-0.22l-3.5-3.5c-0.29-0.29-0.29-0.77 0-1.06s0.77-0.29 1.06 0L7 9.94l4.97-4.97c0.29-0.29 0.77-0.29 1.06 0S13.32 5.74 13.03 6.03z"/>'); 18444 $('.check-sale').removeClass('unchecked').addClass('checked'); 18445 calDiscount($('#prod-discount-rate')); 18446 } else { 18447 var prod_price = ($('#prod-sale').text()) ? $('#prod-sale').text() : ''; 18448 $('#prod-price').val(prod_price); 18449 $('#prod-price').prop('readonly', false); 18450 $('#prod-price').removeClass('sale-on').focus(); 18451 // $('#prod-price').removeClass('sale-on').attr('placeholder','ê°ê²©ì ì ë ¥íì¸ì').focus(); 18452 $('#prod-sale').removeClass('strike'); 18453 $('#prod-sale').hide(); 18454 $('.discount-append').addClass('hide'); 18455 $('#check-sale').html('<path d="M13 0H3C1.3 0 0 1.3 0 3v10c0 1.7 1.3 3 3 3h10c1.7 0 3-1.3 3-3V3C16 1.3 14.7 0 13 0zM15 13c0 1.1-0.9 2-2 2H3c-1.1 0-2-0.9-2-2V3c0-1.1 0.9-2 2-2h10c1.1 0 2 0.9 2 2V13z"/>'); 18456 $('.check-sale').removeClass('checked').addClass('unchecked'); 18457 calInputWidth($('#prod-price')); 18458 } 18459 }); 18460 18461 $(document) 18462 .off('click','#price-cut-btn') 18463 .on('click','#price-cut-btn', function() { 18464 if($(this).hasClass('disabled')) { 18465 $(this).showModalFlat('','ìë¨ì ì ì¬ ë²í¼ì íë§¤ê° ìë¨ìê° 1ì´ìì¸ ê²½ì°ìë§ ì¬ì©í ì ììµëë¤.',true,false,'','ok','','cl-cmmodal cl-s-btn w560 cl-p130 cl-t80 cl-modal cl-none-title cl-close-btn','','',function() { 18466 $(document).on('keydown', function(e) { 18467 if(e.keyCode == 27) modal.modal('hide'); 18468 }); 18469 }); 18470 return false;
18471 } 18472 if($('#prod-discount-unit').attr('data-value') == 'P') { 18473 var orgPrice = Number(removeCommas($('#prod-sale').text())); 18474 var discountRate = Number($('#prod-discount-rate').val()); 18475 var discountPrice = orgPrice * (discountRate / 100); 18476 var price = ($('#prod-price').val()) ? Number(removeCommas($('#prod-price').val())) : 0; 18477 18478 price = Math.floor(price / 10) * 10; 18479 discountRate = Math.round(((orgPrice - price) / orgPrice) * 100); 18480 18481 $('#prod-price').val(number_format(price)); 18482 $('#prod-discount-rate').val(discountRate); 18483 18484 $(this).addClass('disabled'); 18485 } 18486 }); 18487 18488 $(document) 18489 .off('input', '#prod-price') 18490 .on('input', '#prod-price', function () { 18491 var price = $(this).val().replace(/[\u3131-\u318E\uAC00-\uD7A3]/g, ''); 18492 price = removeCommas(price); 18493 price = price * 1; 18494 var nPrice = Number(price); 18495 18496 if(!nPrice || nPrice == 0) { 18497 $('#prod-sale-check').prop('disabled', true); 18498 } else { 18499 $('#prod-sale-check').prop('disabled', false); 18500 } 18501 18502 if(nPrice > 1000000000) { 18503 $(this).val('1,000,000,000'); 18504 } 18505 18506 calInputWidth($(this)); 18507 }); 18508 18509 $(document) 18510 .off('focusout', '#prod-price') 18511 .on('focusout', '#prod-price', function () { 18512 if($(this).prop('readonly') == true) return false; 18513 18514 var price = $(this).val().replace(/[\u3131-\u318E\uAC00-\uD7A3]/g, ''); 18515 price = removeCommas(price); 18516 price = price * 1; 18517 18518 var nPrice = Number(price), 18519 submit = true; 18520 18521 if(nPrice > 1000000000) price = 1000000000; 18522 18523 // ìµì ê°ê²© ê²ì 18524 $.each($('.prod-option-price'), function(i,v) { 18525 var oPrice = $(this).attr('data-option-price'); 18526 if(i > 0) { 18527 if(nPrice + Number(oPrice) < 0) { 18528 $(this).click(); 18529 $(this).parents('li').addClass('err'); 18530 submit = false; 18531 } 18532 } 18533 }); 18534 18535 if(submit) { 18536 price = addCommas(price); 18537 $(this).val(price); 18538 } else { 18539 alert('í매ê°ê° 0ì ìëë¡ ì ì©ë ì ìë ìµì ê°ê²©ì´ ì¡´ì¬íì¬ ë³ê²½í ì ììµëë¤.'); 18540 $(this).val(price); 18541 } 18542 18543 if(!nPrice || nPrice == 0) { 18544 $('#prod-sale-check').prop('disabled', true); 18545 } else { 18546 $('#prod-sale-check').prop('disabled', false); 18547 } 18548 18549 calInputWidth($(this)); 18550 }); 18551 18552 $(document) 18553 .off('input', '#prod-discount-rate') 18554 .on('input', '#prod-discount-rate', function(){ 18555 calDiscount($(this)); 18556 }); 18557 18558 $(document) 18559 .off('focusout', '#prod-discount-rate') 18560 .on('focusout', '#prod-discount-rate', function(){ 18561 var discountUnit = $('#prod-discount-unit').attr('data-value'); 18562 var discountRate = $(this).val(); 18563 $(this).removeClass('empty'); 18564 $('.form-group.discount-append + .error-msg').remove(); 18565 18566 if(discountRate) { 18567 if(discountUnit == 'P') { 18568 var percentVal = Number((Math.floor(discountRate * 100) / 100).toFixed(2)); 18569 $(this).val(percentVal); 18570 } 18571 } else { 18572 $(this).val(0); 18573 } 18574 18575 if($(this).val() == 0) { 18576 var error_str = '<svg viewBox="0 0 13 13" width="13" height="13">
18576<path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12.13c-3.11 0-5.63-2.53-5.63-5.63S3.39 0.87 6.5 0.87s5.63 2.53 5.63 5.63S9.61 12.13 6.5 12.13z"></path><path d="M7.44 9.58c-0.1-0.02-0.18-0.05-0.25-0.1C7.12 9.44 7.07 9.37 7.03 9.28 6.98 9.19 6.96 9.07 6.96 8.92V5h-1.7v0.4h0.03c0.11 0 0.21 0.01 0.3 0.02 0.09 0.02 0.18 0.05 0.25 0.09 0.07 0.05 0.13 0.11 0.17 0.2 0.04 0.09 0.06 0.2 0.06 0.34v2.91c0 0.14-0.02 0.25-0.06 0.34C5.97 9.39 5.91 9.45 5.84 9.5 5.77 9.54 5.68 9.57 5.59 9.58 5.49 9.6 5.39 9.6 5.29 9.6H5.16v0.4h2.71V9.6H7.75C7.64 9.6 7.54 9.6 7.44 9.58z"></path><rect x="6" y="3" width="1" height="1"></rect></svg>\ 18577 1 ì´ì ì ë ¥í´ ì£¼ì¸ì.'; 18578 $('.form-group.discount-append').after('<div class="error-msg c-red">'+error_str+'</div>'); 18579 $(this).addClass('empty'); 18580 } 18581 }); 18582 18583 $(document) 18584 .off('click','.prod-item-image-add,.prod-item-image') 18585 .on('click','.prod-item-image-add,.prod-item-image',function(e) { 18586 idx = -1; 18587 isMainImageClick = ($(this).hasClass('prod-item-image')) ? true : false; 18588 replace = (isMainImageClick && $('.prod-item-image .preview-img').length) ? true : false; 18589 if($(this).hasClass('.prod-item-image-add')) { 18590 $('img').removeClass('replace'); 18591 } 18592 if($(this).hasClass('.prod-item-image')) $(this).find('.preview-img').addClass('replace'); 18593 $.resource.open(); 18594 }); 18595 18596 $(document) 18597 .off('click','.prod-item-thumb img:not(.guide-img)') 18598 .on('click','.prod-item-thumb img:not(.guide-img)',function(e) { 18599 isMainImageClick = false; 18600 idx = $(this).parent().index(); 18601 replace = true; 18602 $(this).addClass('replace'); 18603 $(this).attr('data-idx',idx); 18604 $.resource.open(); 18605 }); 18606 18607 $(document) 18608 .off('hover', '.prod-item-thumb li') 18609 .on('hover', '.prod-item-thumb li',function(e) { 18610 e.stopPropagation(); 18611 $('.img-delete').hide(); 18612 $(this).find('.img-delete').show(); 18613 }); 18614 18615 $(document) 18616 .off('click','.img-delete') 18617 .on('click','.img-delete',function(e) { 18618 $(this).parent().remove(); 18619 if($('.prod-item-thumb li').length < 11) $('.prod-item-image-add').removeClass('hide'); 18620 if($(this).index() == 1) { 18621 var src = $('.prod-item-thumb li:not(.prod-item-image-add):eq(0)').find('img:not(.guide-img)').attr('src'); 18622 if(typeof src != 'undefined') { 18623 src = src.replace('/250/','/800/'); 18624 $('.prod-item-image .preview-img').css('background-image', 'url("'+ src +'")'); 18625 } else { 18626 $('.prod-item-image').removeClass('active').find('.preview-img').remove(); 18627 } 18628 } 18629 }); 18630 18631 $(document) 18632 .off('click','.resource-useit') 18633 .on('click','.resource-useit',function(e) { 18634 if($('.prod-modal').length == 0) return; 18635 18636 var isLink = $(this).attr('data-property'); 18637 if(typeof flinkChange !== 'function' && isLink == 'flink-change') { 18638 setFileLink(); 18639 return false; 18640 } 18641 18642 var useitResourceTab = $(this).closest('.tab-pane.active'); 18643 var useitResourceSelected = useitResourceTab.find('.resource-selected-ul'); 18644 var useitResourceBtn = $(this); 18645 var rmode = useitResourceTab.attr('id').replace(/storage$/gi,''); 18646 18647 if(useitResourceSelected.children('li').length == 0) { 18648 var z_idx = ($('.flink-fileupload').length) ? 'z-1044' : 'z-1042'; 18649 var error_modal = $(this).showModalFlat($.lang[LANG]['config.information'], $.lang[LANG]['editor.resource.useit'], true, false, '', 'ok', '', 'cl-p130 cl-cmmodal cl-s-btn w560 cl-p0 cl-okbtn-pbt70', '', '', '', function() { 18650 useitResourceBtn.removeClass('clicked'); 18651 }); 18652 error_modal.closest('.flat-modal').addClass(z_idx); 18653 return; 18654 } 18655 18656 var imgs = $.resource.selected(), 18657 empty = ($('.prod-item-image').find('.preview-img').length) ? false : true; 18658 18659 var url = (typeof RESOURCE == 'undefined') ? property.RESOURCE : RESOURCE, 18660 site = (typeof SID == 'undefined') ? property.SID : SID, 18661 folder = '', f = ''; 18662 18663 var thumbs = $('.prod-item-thumb li:not(.prod-item-image-add)').length, 18664 remain = 10-thumbs; 18665 18666 replace = ($('.replace').length) ? true : false;
18667 if(imgs.length > remain && !replace) imgs.length = remain; 18668 if(replace) imgs.length = 1; 18669 if(replace && imgs.length > 1) { 18670 $(this).showModalFlat('INFORMATION', $.lang[LANG]['editor.resource.choose.count.1'], true, false, '', 'ok'); 18671 useitResourceBtn.removeClass('clicked'); 18672 return false; 18673 } 18674 if(rmode == 'free' && useitResourceSelected.children('li').length > 0) { 18675 $.processON('Image upload to storage...'); 18676 var frUpload = frStorageUpload(imgs.join('|'),800); 18677 18678 frUpload.then(function(data) { 18679 $.each(data.u, function(i,v) { 18680 if(empty && i == 0) { 18681 folder = 800; 18682 f = v.path + folder + '/' + v.file; 18683 var thumb = v.path + '250/' + v.file, 18684 img_src = (v.magic) ? v.magic : v.file, 18685 src_s800 = getServeImage(img_src,'800',v.path), 18686 src_s250 = getServeImage(img_src,'250',v.path); 18687 18688 $('.prod-item-image').append('<div class="preview-img" style="background-image: url(' + src_s800 + ')">').addClass('active'); 18689 $('.prod-item-thumb .prod-item-image-add').before('<li><img src="' + src_s250 + '"><span class="img-delete"><i class="fa fa-times-circle" aria-hidden="true"></i></span></li>'); 18690 } else { 18691 if(isMainImageClick && i == 0) { 18692 folder = 800; 18693 f = v.path + folder + '/' + v.file; 18694 var thumb = v.path + '250/' + v.file, 18695 img_src = (v.magic) ? v.magic : v.file, 18696 src_s800 = getServeImage(img_src,'800',v.path), 18697 src_s250 = getServeImage(img_src,'250',v.path); 18698 18699 $('.prod-item-image').addClass('active').find('.preview-img').css('background-image','url("'+ src_s800 +'")'); 18700 if($('.prod-item-thumb .prod-item-image-add').before().hasClass('.prod-item-image-add')) { 18701 $('.prod-item-thumb .prod-item-image-add').before('<li><img src="' + src_s250 + '"><span class="img-delete"><i class="fa fa-times-circle" aria-hidden="true"></i></span></li>'); 18702 } else { 18703 $('.prod-item-thumb li:eq(0) img').replaceWith('<img src="' + src_s250 + '">'); 18704 } 18705 } else { 18706 folder = 250; 18707 f = v.path + folder + '/' + v.file; 18708 var thumb = v.path + '250/' + v.file, 18709 img_src = (v.magic) ? v.magic : v.file, 18710 src_s800 = getServeImage(img_src,'800',v.path), 18711 src_s250 = getServeImage(img_src,'250',v.path); 18712 18713 if(idx > -1) { 18714 if(idx == 0) $('.prod-item-image .preview-img').css('background-image', 'url("' + src_s800 + '")'); 18715 $('.prod-item-thumb li:eq(' + idx +') img').replaceWith('<img src="' + src_s250 + '">'); 18716 } else { 18717 $('.prod-item-thumb .prod-item-image-add').before('<li><img src="' + src_s250 + '"><span class="img-delete"><i class="fa fa-times-circle" aria-hidden="true"></i></span></li>'); 18718 } 18719 } 18720 } 18721 if(imgs.length) $('.prod-item-image').removeClass('empty'); 18722 if($('.prod-item-thumb li').length > 10) $('.prod-item-image-add').addClass('hide'); 18723 }); 18724 $('#el-fileupload').modal('hide'); 18725 }); 18726 } else { 18727 $.each(imgs, function(i,v) { 18728 if(empty && i == 0) {
18729 p = url + '/' + site + '/'; 18730 var thumb = p + '250/' + v, 18731 src_s800 = getServeImage(v,"800",p), 18732 src_s250 = getServeImage(v,"250",p); 18733 $('.prod-item-image').append('<div class="preview-img" style="background-image: url(' + src_s800 + ');">').addClass('active'); 18734 $('.prod-item-thumb .prod-item-image-add').before('<li><img src="' + src_s250 + '"><span class="img-delete"><i class="fa fa-times-circle" aria-hidden="true"></i></span></li>'); 18735 } else { 18736 if(isMainImageClick && i == 0) { 18737 p = url + '/' + site + '/'; 18738 var thumb = p + '250/' + v, 18739 src_s800 = getServeImage(v,"800",p), 18740 src_s250 = getServeImage(v,"250",p); 18741 $('.prod-item-image').addClass('active').find('.preview-img').css('background-image','url("'+ src_s800 +'")'); 18742 $('.prod-item-thumb li:eq(0) img').replaceWith('<img src="' + src_s250 + '">'); 18743 } else { 18744 p = url + '/' + site + '/'; 18745 var thumb = p + '250/' + v, 18746 src_s800 = getServeImage(v,"800",p), 18747 src_s250 = getServeImage(v,"250",p); 18748 if(idx > -1) { 18749 if(idx == 0) $('.prod-item-image .preview-img').css('background-image', 'url("' + src_s800 + '")'); 18750 $('.prod-item-thumb li:eq(' + idx +') img').replaceWith('<img src="' + src_s250 + '">'); 18751 } else { 18752 $('.prod-item-thumb .prod-item-image-add').before('<li><img src="' + src_s250 + '"><span class="img-delete"><i class="fa fa-times-circle" aria-hidden="true"></i></span></li>'); 18753 } 18754 } 18755 } 18756 }); 18757 } 18758 if(imgs.length) $('.prod-item-image').removeClass('empty'); 18759 if($('.prod-item-thumb li').length > 10) $('.prod-item-image-add').addClass('hide'); 18760 $('#el-fileupload').modal('hide'); 18761 useitResourceBtn.removeClass('clicked'); 18762 }); 18763 18764 $(document) 18765 .off('keyup', '.option-price-number') 18766 .on('keyup', '.option-price-number', function(e) { 18767 var key = e.keyCode || e.which; 18768 txt = $(this).val(); 18769 var match; 18770 18771 if($(this).closest('.prod-option').attr('data-option_mode') == 'additional') { 18772 match = txt.match(/[0-9]+/g); 18773 } else { 18774 match = txt.match(/[0-9,\-\+]+/g); 18775 } 18776 18777 $(this).val(match); 18778 var price = removeCommas($('#prod-price').val()), 18779 input = (match == null) ? 0 : removeCommas(match[0]); 18780 18781 if(parseInt(price) + parseInt(input) < 0) { 18782 alert('í매ê°ê° 0ì ìëë¡ ì ì©ë ì ìë ìµì ê°ê²©ì ëë¤.'); 18783 $(this).val('0').focus(); 18784 } 18785 }); 18786 18787 $(document) 18788 .off('keyup', '#brand') 18789 .on('keyup', '#brand', function (e) { 18790 var key = e.keyCode || e.which; 18791 txt = $(this).val(); 18792 var match = txt.match(/[a-zA-Zã±-ã ã -ã £ê°-í£0-9-_/:&+() ]/g); 18793 if (match != null) { 18794 $(this).val(match.join('')); 18795 } else { 18796 $(this).val(''); 18797 } 18798 }); 18799 18800 $(document) 18801 .off('click','.choose-gallery') 18802 .on('click','.choose-gallery', function(e) { 18803 e.stopPropagation(); 18804 var pid = $('#prod-pid').val(); 18805 $(this).toggleClass('open'); 18806 $('.gallery-menus-wrap').toggle(); 18807 $('.gallery-menus-wrap .gallery-menus li').removeClass('active'); 18808 $('.gallery-menus-wrap .gallery-menus li.gallery-name[data-gallery-id="' + pid + '"]').addClass('active'); 18809 }); 18810 18811 $(document) 18812 .off('click','.gallery-menus-wrap .gallery-menus li') 18813 .on('click','.gallery-menus-wrap .gallery-menus li', function(e) { 18814 e.stopPropagation(); 18815 if($(this).hasClass('gallery-name')) { 18816 var pid = $(this).attr('data-gallery-id'), 18817 name = $(this).html(); 18818 if(typeof pid == 'undefined' || pid == '') { 18819 alert('ë¸ë ì¤ë¥ ì ëë¤. ê´ë¦¬ì
18819ìê² ë¬¸ìíì¸ì'); 18820 $('.gallery-menus-wrap').hide(); 18821 return false; 18822 } 18823 $('#prod-pid').val(pid); 18824 $('.product-gallery-name').html(name); 18825 $(this).parents('.form-wrap').removeClass('empty'); 18826 $('.choose-gallery').removeClass('open'); 18827 $('.gallery-menus-wrap').hide(); 18828 } 18829 }); 18830 }, 18831 add : function(id,gpos,gcate) { 18832 if($('.prod-modal.cl-p-modal').length > 0) return false; 18833 18834 var site = (typeof SID == 'undefined') ? property.SID : SID, 18835 page = ($.gallery.item_of_page) ? $.gallery.item_of_page : '', 18836 pid = (typeof selectID == 'undefined') ? null : selectID; 18837 18838 if(page == '') page = $('.gallery-modal').attr('data-page'); 18839 if(typeof page == 'undefined' || page == '') 18840 page = (typeof PAGE == 'undefined') ? ((typeof property == 'undefined') ? '' : property.PAGE) : PAGE; 18841 18842 if(typeof page == 'undefined' || page == '') { 18843 alert('Undefined page!!!'); 18844 return false; 18845 } 18846 if(typeof $.gallery.block_id != 'undefined' && $.gallery.block_id) pid = $.gallery.block_id; 18847 // ìí ìµì 18848 product_options = {}; 18849 fileUpdateCnt = 0; 18850 // pid = $('.gallery-add-items').attr('data-pid'); 18851 // if(typeof pid == 'undefined' || pid == null) pid = $('.config-image-edit').attr('data-pid'); 18852 // if(typeof pid == 'undefined' || pid == null) { pid = (typeof PARENT == 'undefined') ? property.PARENT.pid : PARENT.pid } 18853 // if(typeof pid == 'undefined' || pid == null) pid = (typeof selectID == 'string') ? selectID : null; 18854 // console.log(site,page,pid); 18855 // return false; 18856 18857 if(pid.toString().toLowerCase().match(/^cl-s-product-detail,/g) !== null) { 18858 pid = PARENT.pid; 18859 } 18860 18861 page = (page.indexOf(',') > -1) ? page_split(page) : page; 18862 if(!site || !pid || typeof pid == 'undefined' || pid == null) { 18863 alert('Undefined gallery'); 18864 return false; 18865 } 18866 18867 if($('.table-item[data-seq="' + id + '"]').length) pid = $('.table-item[data-seq="' + id + '"]').attr('data-pid'); 18868 18869 var parentDocument = $(window.parent.document), 18870 $detail_modal = parentDocument.find('.product-detail-modal'); 18871 if($detail_modal.length) $detail_modal.addClass('overlap'); 18872 18873 var params = ($('.gallery-modal').length) ? getProductParams() : getSearchURL(); 18874 $.processON(); 18875 $.ajax({ 18876 url: '/template/products', 18877 data: { type:'get', sid:site, id:id, pid:pid, params:params }, 18878 dataType: 'json', 18879 type: 'POST', 18880 async: true, 18881 cache: false, 18882 success: function (data) { 18883 $.processOFF(); 18884 if(data.error != 'undefined' && data.error) { 18885 alert(data.error); 18886 return false; 18887 } 18888 var i = data.item, 18889 plan = i.valid_plan; 18890 18891 closeProductNumber = i.no; 18892 product_options = i.prod_options_settings; 18893 var prod_quantity = parseInt(i.quantity), 18894 category = ''; 18895 if(id == -1 && $.gallery.category) { 18896 category = $.gallery.category; 18897 } 18898 if(typeof gcate != 'undefined' && gcate) category = gcate; 18899 if(!category) category = i.category; 18900 18901 if(prod_quantity < 0 || isNaN(prod_quantity)) i.quantity = 0; 18902 if(!i.price) i.price = 0; 18903 18904 $m = $(data.r).hide(); 18905 $('body').append($m); 18906 $('#sid').val(i.sid); 18907 $('#prod-page').val(page); 18908 $('#prod-pid').val(i.pid); 18909 $('#prod-no').val(i.no); 18910 $('#prod-title').val(i.title); 18911 $('#prod-desc').val(i.desc); 18912 $('#prod-price').val(i.price); 18913 $('#prod-sale').text(i.sale); 18914 $('#lux-product').val(i.lux_product); 18915 18916 if(!LUX) { 18917 if(i.discount_unit == 'P') { 18918 $('#prod-discount-rate').val(i.discount_rate); 18919 // $('#price-cut-btn').removeClass('hide'); 18920 } else { 18921 $('#prod-discount-rate').val(number_format(i.discount_rate)); 18922 } 18923 } 18924 18925 if(typeof i.discount_rate == 'undefined' || i.discount_rate == 0) i.discount_unit = 'W'; 18926 $('#prod-discount-unit').attr('data-value', i.discount_unit); 18927 $('#prod-discount-unit').text($('.discount-unit-select > div[data-value="'+i.discount_unit+'"]').text()); 18928 18929 // ìí ì¸ì¼ê° hidden 18930 $('#retail-price').val(i.retail_price); 18931 $('#prod-quantity').val(i.quantity); 18932 if(typeof gpos != 'undefined' && gpos) $('#prod-gpos').val(gpos); 18933 else $('#prod-gpos').val(''); 18934 $('#prod-category-text').text(category); 18935 $('#prod-category-lists ul').empty(); 18936 $('#prod-category').attr('data-category',i.category_lists.toString()); 18937 18938 18939 if(plan.type == 'SM' && plan.valid_plan == true) { 18940 $('.form-wrap.culture-benefit').removeClass('plan-upgrade'); 18941 if(i.use_naverpay == true) { 18942 $('.form-wrap.culture-benefit').removeClass('not-support');
18943 if(i.culture_benefit_yn == 'Y') { 18944 $('.form-wrap.culture-benefit').removeClass('disabled'); 18945 } 18946 } 18947 18948 $('.form-wrap#pccc-yn, .form-wrap#require-navershop, .form-wrap#mng-prd-info').removeClass('plan-upgrade'); 18949 $('.form-wrap#pccc-yn,.form-wrap#require-navershop, .form-wrap#mng-prd-info').find('input-switch').removeClass('editor-upgrade-popup').removeAttr('data-mode'); 18950 18951 if(i.product_pccc_yn == 'Y') { 18952 $('.form-wrap#pccc-yn').removeClass('disabled'); 18953 } 18954 18955 if(i.nshop_setting == 'Y') { 18956 if(LUX && i.require_navershop == 'T') { 18957 $('.form-wrap#require-navershop').removeClass('disabled'); 18958 $('.form-wrap#require-navershop').find('input').prop('checked', true); 18959 } 18960 } else { 18961 $('.form-wrap#require-navershop').addClass('use-nshop-setting not-support'); 18962 } 18963 if(i.mng_product_info_use == 'on') { 18964 $('.form-wrap#mng-prd-info').removeClass('disabled'); 18965 } 18966 } 18967 18968 if(i.culture_benefit_yn == 'Y') { 18969 $('.form-wrap.culture-benefit').find('input').prop('checked', true); 18970 } 18971 if(i.product_pccc_yn == 'Y') { 18972 $('.form-wrap#pccc-yn').find('input').prop('checked', true); 18973 } 18974 18975 if(parseFloat(i.total_unit_value)) { 18976 $('.form-wrap.unit-pricing').find('input').prop('checked', true).change(); 18977 $('input[name="total_unit_value"]').val(number_format(parseFloat(i.total_unit_value))); 18978 $('select[name="total_unit"]').val(i.total_unit).selectpicker('render'); 18979 $('input[name="total_unit_bundle"]').val(number_format(i.total_unit_bundle)); 18980 $('select[name="total_unit"]').change(); 18981 $('select[name="basic_unit"]').val(i.basic_unit).selectpicker('render'); 18982 $('input[name="basic_unit_value"]').val(number_format(parseFloat(i.basic_unit_value))).change(); 18983 } else { 18984 $('select[name="total_unit"]').change(); 18985 } 18986 18987 18988 var delivery_template_str = ''; 18989 if(i.delivery_template) { 18990 $.each(i.delivery_template, function(k, v) { 18991 var template_desc = ''; 18992 template_desc += '('; 18993 template_desc += $.lang[LANG]['shopping.delivery.template.mix_yn.' + v.mix_yn.toLowerCase()]; 18994 var delivery_type_arr = v.delivery_type.split(','); 18995 var delivery_type_str = ''; 18996 $.each(delivery_type_arr, function(idx, delivery_type) { 18997 if(delivery_type_str) delivery_type_str += ', '; 18998 delivery_type_str += $.lang[LANG]['shopping.delivery.template.delivery_type.' + delivery_type.toLowerCase()]; 18999 }); 19000 if(delivery_type_str) 19001 template_desc += ' / ' + delivery_type_str; 19002 19003 if(delivery_type_arr.indexOf('DELIVERY') > -1) { 19004 template_desc += ' / ' + $.lang[LANG]['shopping.delivery.' + v.delivery_company.toLowerCase()]; 19005 } 19006 19007 template_desc += ' / ' + $.lang[LANG]['shopping.delivery.template.price_type.' + v.price_type.toLowerCase()]; 19008 19009 if(v.price_type == 'FIX') { 19010 template_desc += '(' + number_format(v.delivery_fee) + 'ì)'; 19011 } else if(v.price_type == 'QUANTITY' || v.price_type == 'WEIGHT') { 19012 var price_type_detail = v.price_type_detail ? JSON.parse(v.price_type_detail) : {}; 19013 19014 if(price_type_detail.method == 'DIFFERENTIAL') { 19015 var detail = ''; 19016 if(price_type_detail.detail) { 19017 $.each(price_type_detail.detail, function(i, j) { 19018 var value = Object.keys(j); 19019 var price = Object.values(j); 19020 19021 if(v.price_type == 'QUANTITY') { 19022 // if(i < 2) { 19023 if(detail) detail += ', '; 19024 detail += value + 'ê° ì´ì(' + number_format(price) + 'ì)'; 19025 // } 19026 } else if(v.price_type == 'WEIGHT') { 19027 // if(i < 2) { 19028 if(detail) detail += ', '; 19029 detail += value + 'Kg ì´ì(' + number_format(price) + 'ì)'; 19030 // } 19031 } 19032 }); 19033 } 19034 if(template_desc) { 19035 detail = '(ì°¨ë± / ' + detail + ')'; 19036 template_desc += detail; 19037 } 19038 } else if(price_type_detail.method == 'REPEAT') { 19039 var detail = ''; 19040 var value = Object.keys(price_type_detail.detail); 19041 var price = Object.values(price_type_detail.detail); 19042 19043 if(v.price_type == 'QUANTITY') { 19044 detail += value + 'ê° êµ¬ë§¤ìë§ë¤ ' + number_format(price) + 'ì ë°ë³µ ë¶ê³¼'; 19045 } else if(v.price_type == 'WEIGHT') { 19046 detail += value + 'Kgë§ë¤ ' + number_format(price) + 'ì ë°ë³µ ë¶ê³¼'; 19047 } 19048 19049 if(detail) { 19050 detail = '(ë°ë³µ / ' + detail + ')'; 19051 template_desc += detail; 19052 } 19053 } 19054 } 19055 19056 if(v.additional_yn == 'Y') { 19057 template_desc += ' / ëìì°ê° ì§ì ì¶ê° ë°°ì¡ë¹ (ì 주 ' + number_format(v.additional_jeju_price) + 'ì, ì 주 ì¸ ëìì°ê° ' + number_format(v.additional_land_price) + 'ì)'; 19058 } 19059 19060 template_desc += ' / ' + $.lang[LANG]['shopping.delivery.template.pay_type.' + v.pay_type.toLowerCase()]; 19061 19062 if(v.free_condition_yn == 'Y') { 19063 template_desc += ' / ' + number_format(v.free_condition) + 'ì ì´ì ë¬´ë£ ë°°ì¡'; 19064 } 19065 19066 if(v.make_to_order_yn == 'Y') { 19067 template_desc += ' / 주문 íì¸ í ' + v.due_date + 'ì¼ í ë°°ì¡ ìì '; 19068 } 19069 if(v.install_fee_yn == 'Y') { 19070 template_desc += ' / ë³ë ì¤ì¹ë¹ ìì'; 19071 } 19072 template_desc += ')'; 19073 19074 delivery_template_str += '\ 19075 <li data-val="' + v.seq + '" data-weight="' + (v.price_type == 'WEIGHT' ? 'true' : 'false') + '">\ 19076 <input type="radio" id="delivery_template_seq_' + v.seq + '" name="delivery_template_seq" value="' + v.seq + '" />\ 19077 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18" width="18" height="18"><path d="M9 0a9 9 0 1 0 .001 18.001A9 9 0 0 0 9 0zm0 17c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18" width="18" height="18"><path d="M9 0a9 9 0 1 0 .001 18.001A9 9 0 0 0 9 0zm0 17c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"></path><circle cx="9" cy="9" r="6"></circle></svg>\ 19078 <label for="delivery_template_seq_' + v.seq + '">\
19079 <span class="template-name">' + v.name + '</span>\ 19080 <span class="template-desc">' + template_desc + '</span>\ 19081 </label>\ 19082 </li>'; 19083 }); 19084 } 19085 19086 $('.option-delivery-template-select').html(delivery_template_str); 19087 19088 if(typeof i.delivery_template_seq != 'undefined' && i.delivery_template_seq) { 19089 $('.option-delivery-template-select input[name="delivery_template_seq"][value="' + i.delivery_template_seq + '"]').prop('checked', true); 19090 19091 $('.option-delivery-template-str').html($('.option-delivery-template-select li[data-val="' + i.delivery_template_seq + '"] label').html()); 19092 19093 if($('.option-delivery-template-select li[data-val="' + i.delivery_template_seq + '"]').data('weight') == false) { 19094 $('.product-weight').hide(); 19095 $('#product_weight').val(''); 19096 } else { 19097 $('#product_weight').val(number_format(i.p.product_weight) + 'kg'); 19098 } 19099 } else { 19100 $('.option-delivery-template-select input[name="delivery_template_seq"]:first').prop('checked', true).change(); 19101 } 19102 uadmin = i.uadmin; 19103 var etcAry = []; 19104 if (i.etc_info) etcAry = i.etc_info.split('||'); 19105 $('.cl_etc_state_check').removeClass('active'); 19106 switch(etcAry[0]) { 19107 case 'Y': 19108 case 'T': 19109 $('#cl_etc_state_'+etcAry[0].toLowerCase()).addClass('active'); 19110 19111 if(etcAry[0] == 'Y') { 19112 $('.etc-setting').not('.time-setting').removeClass('hide'); 19113 } else { 19114 $('.etc-setting').removeClass('hide'); 19115 } 19116 19117 if (etcAry[1] == 'S') { 19118 $('#cl_etc_status_s').addClass('active'); 19119 $('#cl_etc_status_p').removeClass('active'); 19120 } else { 19121 $('#cl_etc_status_s').removeClass('active'); 19122 $('#cl_etc_status_p').addClass('active'); 19123 } 19124 $('#etc-date-state').val(etcAry[0]); 19125 $('#etc-date-status').val(etcAry[1]); 19126 $('#etc-week').val(etcAry[2]); 19127 $('#etc-start-date').val(etcAry[3]); 19128 $('#etc-end-date').val(etcAry[4]); 19129 $('#etc-date-time').val(etcAry[5]); 19130 $('#etc-exclude-date').val(etcAry[6]); 19131 $('#etc-term').val(etcAry[7]); 19132 $('#etc-time').val(etcAry[8]); 19133 break; 19134 default: 19135 $('#etc-term').val(etcAry[7]); 19136 $('#etc-time').val(etcAry[8]); 19137 $('#cl_etc_state_n').addClass('active'); 19138 break; 19139 } 19140 19141 19142 if(LUX) { 19143 if(!id || id < 1 || id == '0' || id >= 1000000000) { 19144 $('.prod-price-sync').removeClass('active').hide(); 19145 $('.margin-config').addClass('disabled'); 19146 $('#prod-price').removeAttr('readonly'); 19147 $('.check-sale').removeClass('disabled'); 19148 } else if(i.price_sync == 'F') { 19149 $('.prod-price-sync').removeClass('active'); 19150 $('.margin-config').addClass('disabled'); 19151 $('#prod-price').removeAttr('readonly'); 19152 $('.check-sale').removeClass('disabled'); 19153 } 19154 19155 if(i.prod_status) { 19156 $('.prod-status').removeClass('active'); 19157 $('.prod-status[data-val="' + i.prod_status + '"]').addClass('active'); 19158 } 19159 } 19160 19161 var cate = (category) ? category.split(', ') : []; 19162 $.each(i.category_lists, function(i,v) { 19163 $li = $('<li>' + v + '</li>'); 19164 if($.inArray(v.trim(),cate) > -1) $li.addClass('active'); 19165 $('#prod-category-lists ul').append($li); 19166 }); 19167 19168 $('input#product_weight').on('focus', function() { 19169 $(this).val($.trim($(this).val()).replace('kg', '')); 19170 }).on('blur', function() { 19171 $(this).val($.trim($(this).val()).replace('kg', '') + ($.trim($(this).val()).replace('kg', '') ? 'kg' : '')); 19172 }); 19173 19174 if(LUX) { 19175 $.each(i.footer, function(idx,v) { 19176 if (idx == 1) return true; 19177 if(idx <= 3 && v == 'true') { 19178 if (idx == 2) { 19179 $('.page-options input:eq(1)').prop('checked',true); 19180 } else if (idx == 3) { //photo 19181 if (v == 'true') { 19182 $('.photo-review-tab #photo-review').prop('checked',true); 19183 } else { 19184 $('.photo-review-tab #photo-review').prop('checked',fal
19184se); 19185 } 19186 } else { 19187 $('.page-options input:eq(' + idx + ')').prop('checked',true); 19188 } 19189 } 19190 }); 19191 } else { 19192 // $.each(i.footer, function(idx,v) { 19193 // if(idx <= 3 && v == 'true') { 19194 // if (idx == 3) { //photo 19195 // if (v == 'true') { 19196 // $('.photo-review-tab #photo-review').prop('checked',true); 19197 // } else { 19198 // $('.photo-review-tab #photo-review').prop('checked',false); 19199 // } 19200 // } else { 19201 // $('.page-options input:eq(' + idx + ')').prop('checked',true); 19202 // } 19203 // } 19204 // if (idx == 1) { //review 19205 // if (v == 'true') { 19206 // $('.photo-review-tab').removeClass('hide'); 19207 // } else { 19208 // $('.photo-review-tab').addClass('hide'); 19209 // } 19210 // } 19211 // }); 19212 19213 if(i.footer[1] == 'true') { //review 19214 $('#review-checkbox').closest('.form-wrap').removeClass('disabled'); 19215 $('#review-checkbox').prop('checked',true); 19216 $('.photo-review-tab').removeClass('hide'); 19217 } else { 19218 $('#review-checkbox').closest('.form-wrap').addClass('disabled'); 19219 $('#review-checkbox').prop('checked',false); 19220 $('.photo-review-tab').addClass('hide'); 19221 } 19222 19223 if(i.footer[2] == 'true') { //qna 19224 $('#qna-checkbox').closest('.form-wrap').removeClass('disabled'); 19225 $('#qna-checkbox').prop('checked',true); 19226 } else { 19227 $('#qna-checkbox').closest('.form-wrap').addClass('disabled'); 19228 $('#qna-checkbox').prop('checked',false); 19229 } 19230 19231 if(i.footer[3] == 'true') { //top photo review 19232 $('.photo-review-tab #photo-review').prop('checked',true); 19233 } else { 19234 $('.photo-review-tab #photo-review').prop('checked',false); 19235 } 19236 // if(i.footer.length > 0 && i.footer[1] == 'true' && typeof i.footer[7] == 'undefined') { 19237 // $('.photo-review-top-view').removeClass('hide'); 19238 // $('.photo-review-tab #use-review-img-upload').prop('checked',true); 19239 // } 19240 if (i.use_review_img_upload != 'false') { 19241 $('.photo-review-top-view').removeClass('hide'); 19242 $('.photo-review-tab #use-review-img-upload').prop('checked',true); 19243 } else { 19244 $('.photo-review-top-view').addClass('hide'); 19245 $('.photo-review-tab #use-review-img-upload').prop('checked',false); 19246 $('.photo-review-tab #photo-review').prop('checked',false); 19247 } 19248 } 19249 19250 if(i.imgs.length > 10) $('.prod-item-image-add').addClass('hide'); 19251 $.each(i.imgs, function(idx,img) { 19252 if(idx > 10) return true; 19253 if(img) { 19254 (idx == 0) ? $('.prod-item-image').addClass('active').append('<div class="preview-img" style="background-image: url(' + img + ');">') : 19255 $('.prod-item-thumb .prod-item-image-add').before('<li><img src="' + img + '"><span class="img-delete"><i class="fa fa-times-circle" aria-hidden="true"></i></li>'); 19256 } 19257 }); 19258 19259 $('.prod-option').each(function(){ 19260 if($(this).data('option_mode') == 'normal' && i.options.length == 0) { 19261 i.options[0] = { 19262 'seq' : '', 19263 'option_name' : 'noneOption', 19264 'option_price' : 0 19265 } 19266 } 19267 }); 19268 19269 if(i.quantity_on == 'on') { 19270 $('.switch-quantity').prop('checked','checked').parents('.form-wrap').removeClass('disabled'); 19271 } 19272 19273 setOptionlist(i.options); 19274 i.footer[4] = (i.footer[4] == '' || i.footer[4] == undefined)? 'true':i.footer[4]; 19275 $('#normal-option').prop('checked', true); 19276 19277 $('.prod-option-tab').addClass('hide'); 19278 $('#normal-option').prop('checked', false); 19279 $('#text-option').prop('checked', false); 19280 $('#additional-option').prop('checked', false); 19281 $('.prod-option-tab .prod-option').addClass('hide'); 19282 if(i.footer[4]=='true' && $('.prod-option[data-option_mode="normal"] .prod-option-list>li').length > 1) { 19283 $('#normal-option').prop('checked', true); 19284 $('.prod-option-tab').removeClass('hide'); 19285 $('.prod-option[data-option_mode="normal"]').removeClass('hide'); 19286 $('.prod-option[data-option_mode="normal"] .plus-price').removeClass('hide'); 19287 $('.prod-option[data-option_mode="normal"] .plus-status').removeClass('hide'); 19288 if(i.quantity_on == 'on') { 19289 $('.prod-option[data-option_mode="normal"] .plus-quantity').removeClass('hide'); 19290 } 19291 } 19292 if(i.footer[5]=='true' && $('.prod-option[data-option_mode="text"] .prod-option-list>li').length > 0) { 19293 $('#text-option').prop('checked', true); 19294 $('.prod-option-tab').removeClass('hide'); 19295 $('.prod-option[data-option_mode="text"]').removeClass('hide'); 19296 $('.prod-option[data-option_mode="text"] .plus-price').removeClass('hide'); 19297 $('.prod-option[data-option_mode="text"] .plus-status').removeClass('hide'); 19298 if(i.quantity_on == 'on') { 19299 $('.prod-option[data-option_mode="text"] .plus-quantity').removeClass('hide'); 19300 } 19301 if($('.prod-option[data-option_mode="text"] .prod-option-list>li').length >= 7) { //ì ë ¥ìµì 7ê°ì´ì ì¶ê°X 19302 $('.prod-option[data-option_mode="text"] > .prod-option-add').addClass('disabled'); 19303 } 19304 } 19305 if(i.footer[6]=='true' && $('.prod-option[data-option_mode="additional"] .prod-option-list>li').length > 0) { 19306 $('#additional-option').prop('checked', true); 19307 $('.prod-option-tab').removeClass('hide'); 19308 $('.prod-option[data-option_mode="additional"]').removeClass('hide'); 19309 $('.prod-option[data-option_mode="additional"] .plus-price').removeClass('hide'); 19310 $('.prod-option[data-option_mode="additional"] .plus-status').removeClass('hide'); 19311 if(i.quantity_on == 'on') { 19312 $('.prod-option[data-option_mode="additional"] .plus-quantity').removeClass('hide'); 19313 } 19314 } 19315 19316 if(i.prod_info_on == 'on') { 19317 $('.switch-prod-info').prop('checked','checked').parents('.form-wrap').removeClass('disabled'); 19318 $('.prod-info-toggle').addClass('open'); 19319 $('.info-selected').removeClass('hide'); 19320 } else { 19321 $('.switch-prod-info').prop('checked', '').parents('.form-wrap').addClass('disabled'); 19322 $('.prod-info-toggle').removeClass('open'); 19323 $('.info-selected').addClass('hide'); 19324 } 19325 19326 if(i.product_on) { 19327 $('.switch-product[value="'+i.product_on+'"]').prop('checked', true); 19328 $('.switch-product[value="'+i.product_on+'"] + label').addClass('active'); 19329 19330 if(i.product_on == 'lim') { 19331 $('#status-append').fadeIn(0); 19332 $('#sale-calendar').show(); 19333 } else { 19334 $('#status-append').hide(); 19335 $('#sale-calendar').hide(); 19336 } 19337 } else { 19338 $('.switch-product[value="on"]').prop('checked', true); 19339 $('.switch-product[value="on"] + label').addClass('active'); 19340 } 19341 19342 if(i.sales_start && i.sales_end) { 19343 $('#sale-start-datetime').val(i.sales_start); 19344 $('#sale-end-datetime').val(i.sales_end); 19345 var startDateTimeArr = i.sales_start.split(' '); 19346 var endDateTimeArr = i.sales_end.split(' '); 19347 var startTime = convertTime12(startDateTimeArr[1]); 19348 var endTime = convertTime12(endDateTimeArr[1]); 19349 $('.sale-setting .setting-text .content-start').text(startDateTimeArr[0].replace(/-/g, '.') + '. ' + startTime); 19350 $('.sale-setting .setting-text .content-end').text(endDateTimeArr[0].replace(/-/g, '.') + '. ' + endTime); 19351 } 19352 19353 if(i.quantity_on == 'on') { 19354 $('.switch-quantity').prop('checked','checked').parents('.form-wrap').removeClass('disabled'); 19355 if($('#normal-option').is(':checked') === true) { 19356 // $('#prod-quantity').attr('readonly','true').removeClass('hide').attr('placeholder','ìµì ìì ì¬ê³ ê´ë¦¬'); 19357 $('.quantity-label').addClass('on'); 19358 $('.plus-quantity').removeClass('hide'); 19359 } else if($('#normal-option').is(':checked') === false && $('#additional-option').is(':checked') === true) { 19360 $('.quantity-label').removeClass('on'); 19361 $('#prod-quantity').removeAttr('readonly').removeClass('hide'); 19362 $('.plus-quantity').removeClass('hide'); 19363 } else { 19364 $('.quantity-label').removeClass('on'); 19365 $('#prod-quantity').removeAttr('readonly').removeClass('hide'); 19366 $('.plus-quantity').addClass('hide'); 19367 } 19368 } else { 19369 $('.prod-option-quantity, .edit-option-quantity').hide(); 19370 $('.plus-quantity').addClass('hide'); 19371 } 19372 19373 if(!i.sale && i.price == 0) { 19374 $('#prod-sale-check').prop('disabled', true); 19375 } else { 19376 $('#prod-sale-check').prop('disabled', false); 19377 } 19378 19379 if(i.sale) { 19380 $('#prod-price').addClass('sale-on'); 19381 $('#prod-price').prop('readonly', true); 19382 $('#prod-sale').show().addClass('strike'); 19383 $('.discount-append').removeClass('hide'); 19384 $('#prod-sale-check').prop('checked',true); 19385 $('#check-sale').html('<path d="M13 0H3C1.34 0 0 1.34 0 3v10c0 1.66 1.34 3 3 3h10c1.66 0 3-1.34 3-3V3C16 1.34 14.66 0 13 0zM13.03 6.03l-5.5 5.5C7.38 11.68 7.19 11.75 7 11.75s-0.38-0.07-0.53-0.22l-3.5-3.5c-0.29-0.29-0.29-0.77 0-1.06s0.77-0.29 1.06 0L7 9.94l4.97-4.97c0.29-0.29 0.77-0.29 1.06 0S13.32 5.74 13.03 6.03z"/>'); 19386 $('.check-sale').addClass('checked'); 19387
19388 // if (Number(removeCommas(i.price)) % 10 == 0 || Number(removeCommas(i.price)) == 0) $('#price-cut-btn').addClass('disabled'); 19389 // else $('#price-cut-btn').removeClass('disabled'); 19390 } 19391 19392 calInputWidth($('#prod-price')); 19393 19394 $('.prod-option').each(function(){ 19395 if($(this).data('option_mode') == 'normal' && i.options.length == 0) { 19396 i.options[0] = { 19397 'seq' : '', 19398 'option_name' : 'noneOption', 19399 'option_price' : 0 19400 } 19401 } 19402 }); 19403 19404 $m.fadeIn(300); 19405 $('.prod-option-list').sortable({ 19406 handle : ".prod-option-move", 19407 refreshPositions: true 19408 }); 19409 19410 if (i.product_state == 'download') { 19411 $('#download-product').attr('checked', true); 19412 $('.cl_product_state_check').each(function () { 19413 if ($(this).attr('for') == 'download-product') { 19414 $(this).find('.cl-icon').removeClass('cl_icon_check02_off').removeClass('cl_icon_check02_on').addClass('cl_icon_check02_on'); 19415 $(this).click(); 19416 $('#download-date').val(i.download_date); 19417 $('#download-count').val(i.download_count); 19418 } else { 19419 $(this).find('.cl-icon').removeClass('cl_icon_check02_off').removeClass('cl_icon_check02_on').addClass('cl_icon_check02_off'); 19420 } 19421 }); 19422 $('.delivery-template, .product-weight, .brand, .culture-benefit').hide(); 19423 } 19424 19425 if (i.product_state == 'normal') { 19426 $('#normal-product').attr('checked', true); 19427 $('.cl_product_state_check').each(function () { 19428 if ($(this).attr('for') == 'normal-product') { 19429 $(this).find('.cl-icon').removeClass('cl_icon_check02_off').removeClass('cl_icon_check02_on').addClass('cl_icon_check02_on'); 19430 $(this).click(); 19431 } else { 19432 $(this).find('.cl-icon').removeClass('cl_icon_check02_off').removeClass('cl_icon_check02_on').addClass('cl_icon_check02_off'); 19433 } 19434 }); 19435 19436 if(!$('.delivery-template-list').find('[data-val]').find('input[name="delivery_template_seq"]:checked').length) { 19437 $('.delivery-template-list').find('[data-val]:first').find('input[name="delivery_template_seq"]').prop('checked', true).change(); 19438 } 19439 19440 $('.delivery-template').show(); 19441 } 19442 19443 if (i.product_state == 'etc') { 19444 $('#etc-product').attr('checked', true); 19445 $('.cl_product_state_check').each(function () { 19446 if ($(this).attr('for') == 'etc-product') { 19447 $(this).find('.cl-icon').removeClass('cl_icon_check02_off').removeClass('cl_icon_check02_on').addClass('cl_icon_check02_on'); 19448 $(this).click(); 19449 } else { 19450 $(this).find('.cl-icon').removeClass('cl_icon_check02_off').removeClass('cl_icon_check02_on').addClass('cl_icon_check02_off'); 19451 } 19452 }); 19453 $('.delivery-template, .product-weight, .brand, .culture-benefit').hide(); 19454 } 19455 19456 if(typeof updateNpayButtonSettingState == 'function') { 19457 var npayProductState = i.product_state == 'normal' ? 'normal-product' : (i.product_state == 'download' ? 'download-product' : 'etc-product'); 19458 updateNpayButtonSettingState(npayProductState); 19459 } 19460 19461 taxUse = i.tax_use; 19462 if (i.tax_use == 'TG03') { 19463 $('#state-append').fadeIn(0); 19464 $('#normal-product-state').fadeIn(0); 19465 if (i.tax == 'TG01') { 19466 $('#tax').attr('data-val', 'TG01'); 19467 $('#tax').html('ê³¼ì¸'); 19468 } 19469 19470 if (i.tax == 'TG02') { 19471 $('#tax').attr('data-val', 'TG02'); 19472 $('#tax').html('ë¹ê³¼ì¸'); 19473 } 19474 $('#tax').attr('data-total-tax', 'TG03'); 19475 } else { 19476 if (i.product_state == 'normal') $('#state-append').fadeOut(0); 19477 $('#normal-product-state').fadeOut(0); 19478 $('#tax').attr('data-val', 'TG01'); 19479 $('#tax').html('ê³¼ì¸'); 19480 } 19481 setAdvancedMode(product_options.advanced); 19482 19483 var descHeight = $('#prod-desc').prop('scrollHeight'); 19484 if(descHeight > 55) { 19485 $('#prod-desc').css('height', descHeight+'px'); 19486 } else { 19487 $('#prod-desc').removeAttr('style'); 19488 } 19489 }, 19490 error : function(xhr, status, error) { 19491 var parentDocument = $(window.parent.document), 19492 $detail_modal = parentDocument.find('.product-detail-modal'); 19493 if($detail_modal.length) $detail_modal.removeClass('overlap'); 19494 19495 $.processOFF(); 19496 alert("Error " + xhr.status); 19497 } 19498 }); 19499 }, 19500 review : function(id,page) { 19501 var site = (typeof SID == 'undefined') ? property.SID : SID; 19502 19503 $.ajax({ 19504 url: '/template/products/', 19505 data: { type:'review', sid:site, id:id, page:page }, 19506 dataType: 'json', 19507 type: 'POST', 19508 async: false, 19509 cache: false, 19510 success: function (data) { 19511 if(data.error != 'undefined' && data.error) { 19512 alert(data.error); 19513 return false;
19514 } 19515 var $review = $(data.r).hide(); 19516 if(typeof property == "undefined") { 19517 $lastEl = ($('.el-footer_ctrl').length) ? $('.el-footer_ctrl') : $('.add-footer-information'); 19518 if($('.page-bottomlist').length) $lastEl = $('.page-bottomlist'); 19519 if($('.fnav').length) $lastEl = $('.fnav'); 19520 $lastEl.before($review); 19521 $review.show(); 19522 } else { 19523 if(typeof property.ISLOCK != 'undefined' && property.ISLOCK == 'true') { 19524 $review.addClass('hide'); 19525 } 19526 if($('.el-footer').length) { 19527 $lastEl = ($('.page-bottomlist').length) ? $('.page-bottomlist') : $('.el-footer'); 19528 if($('.fnav').length) $lastEl = $('.fnav'); 19529 $lastEl.before($review); 19530 $review.show(); 19531 19532 var reviewArr = new Array(); 19533 19534 $('.s-table-review .review-content>div').each(function(idx, item){ 19535 reviewArr[idx] = $(this).html(); 19536 }); 19537 19538 truncateReviewTitle(reviewArr); 19539 19540 $(window).on('resize', function(){ 19541 truncateReviewTitle(reviewArr) 19542 }); 19543 } else { 19544 $('.dsgn-body').append($review); 19545 $review.show(); 19546 } 19547 } 19548 var cnt = ($('.review-wrap h4 > span').text()=="") ? 0 : $('.review-wrap h4 > span').text(); 19549 $('.review-count').text(' ' + cnt); 19550 } 19551 }); 19552 }, 19553 qna : function(id,page) { 19554 var site = (typeof SID == 'undefined') ? property.SID : SID; 19555 19556 $.ajax({ 19557 url: '/template/products/', 19558 data: { type:'qna', sid:site, id:id, page:page }, 19559 dataType: 'json', 19560 type: 'POST', 19561 async: false, 19562 cache: false, 19563 success: function (data) { 19564 if(data.error != 'undefined' && data.error) { 19565 alert(data.error); 19566 return false; 19567 } 19568 var $qna = $(data.r).hide(); 19569 if(typeof property == "undefined") { 19570 $lastEl = ($('.el-footer_ctrl').length) ? $('.el-footer_ctrl') : $('.add-footer-information'); 19571 if($('.page-bottomlist').length) $lastEl = $('.page-bottomlist'); 19572 if($('.fnav').length) $lastEl = $('.fnav'); 19573 $lastEl.before($qna); 19574 $qna.show(); 19575 } else { 19576 if(typeof property.ISLOCK != 'undefined' && property.ISLOCK == 'true') { 19577 $qna.addClass('hide'); 19578 } 19579 if($('.el-footer').length) { 19580 $lastEl = ($('.page-bottomlist').length) ? $('.page-bottomlist') : $('.el-footer'); 19581 if($('.fnav').length) $lastEl = $('.fnav'); 19582 $lastEl.before($qna); 19583 $qna.show(); 19584 } else { 19585 $('.dsgn-body').append($qna); 19586 $qna.show(); 19587 } 19588 } 19589 var cnt = ($('.qna-wrap h4 > span').text()=="") ? 0 : $('.qna-wrap h4 > span').text(); 19590 $('.qna-count').text(' ' + cnt); 19591 } 19592 }); 19593 }, 19594 list : function(id, page, view, page_num, sfl, stx, scate) { 19595 }, 19596 save : function(go) { 19597 var before_prod = {}; 19598 $('.product-wrap form input[name="before_prod[]"]').each(function() { 19599 var bd_key = $(this).attr('data-key'), 19600 bd_val = $(this).val(); 19601 19602 before_prod[bd_key] = bd_val; 19603 }); 19604 19605 var seq = $('#prod-no').val(), 19606 page = $('#prod-page').val(), 19607 pid = $('#prod-pid').val(), 19608 gpos = $('#prod-gpos').val(), 19609 $title = $('#prod-title'), 19610 $price = $('#prod-price'), 19611 $sale = $('#prod-sale'), 19612 $quantity = $('#prod-quantity'), 19613 $img = $('.prod-item-image'), 19614 $desc = $('#prod-desc'), 19615 $category = $('#prod-category-text'), 19616 $brand = $('#brand'), 19617 discountRate = ($('#prod-sale-check').is(':checked'))? $('#prod-discount-rate').val().trim().replace(/,/gi, '') : 0, 19618 discountUnit = ($('#prod-sale-check').is(':checked'))? $('#prod-discount-unit').attr('data-value') : 'W', 19619 // checkSaleCut = ($('#price-cut-btn').is(':checked'))? 'Y':'N', 19620 quantity_on = ($('.switch-quantity').is(":checked") == true) ? 'on' : 'off', 19621 product_on = $('input[name="product_status"]:checked').val(), 19622 category_on = ($('.switch-category').is(":checked") == true) ? 'ON' : 'OFF', 19623 product_info_on = ($('.switch-prod-info').is(":checked") == true) ? 'on' : 'off', 19624 mng_product_info_use = ($('.switch-mngprd').is(":checked") == true) ? 'on' : 'off', 19625 mng_product_name = $('#mng-prd-name').val(), 19626 mng_product_code = $('#mng-prd-code').val(), 19627 submit = true, 19628 downloadDate = $('#download-date').val(), 19629 downloadCount = $('#download-count').val(), 19630 submit = true, 19631 productState = '', 19632 taxState = $('#tax').attr('data-val'), 19633 etcDateState = '', 19634 etcDateStatus = '', etcDateWeek = '', 19635 salesStart = '', salesEnd = '', open_out_datetime_yn = 'N', 19636 delete_options = $('#options-delete-list').val(), 19637 deliveryTemplateSeq = $('input[name="delivery_template_seq"]:checked').val(), 19638 productWeight = $('#product_weight').val().replace(/kg|,/gi, ''),
19639 culture_benefit_yn = $('.switch-culture-benefit').is(':checked') ? 'Y' : 'N', 19640 npay_button = $('.switch-npay-button').is(':checked') ? 'Y' : 'N', 19641 product_pccc_yn = $('.switch-pccc').is(':checked') ? 'Y' : 'N', 19642 require_navershop = $('.switch-require-navershop').is(':checked') ? 'T' : 'F', 19643 startDate = '', endDate = '', etcDate = '', exceptDate = '', termData = '', timeData = '', 19644 dayCheck = false, dayCheckLan = $('#etc-date-time').val(); 19645 prod_info = getProductInfoList(), 19646 lux_product = ($('#lux-product').val() == "true") ? true : false, 19647 unit_use_yn = $('.switch-unit-pricing').prop('checked') ? 'Y' : 'N', 19648 total_unit_value = $('input[name="total_unit_value"]').val().replace(/,/g, ''), 19649 total_unit = $('select[name="total_unit"]').val(), 19650 total_unit_bundle = $('input[name="total_unit_bundle"]').val().replace(/,/g, ''), 19651 basic_unit_value = $('input[name="basic_unit_value"]').val().replace(/,/g, ''), 19652 basic_unit = $('select[name="basic_unit"]').val(); 19653 19654 var price = $price.val(); 19655 price = removeCommas(price); 19656 price = price * 1; 19657 19658 var nPrice = Number(price), 19659 submit = true; 19660 19661 // ìµì ê°ê²© ê²ì 19662 $.each($('.prod-option-price'), function(i,v) { 19663 var oPrice = $(v).attr('data-option-price'); 19664 if(i > 0) { 19665 if(nPrice + Number(oPrice) < 0) { 19666 $(v).parents('li').addClass('err'); 19667 submit = false; 19668 } 19669 } 19670 }); 19671 if(submit == false) { 19672 // alert('ìµì ê°ê²©ì´ ì¬ë°ë¥´ì§ ììµëë¤.'); 19673 var modal = $(this).showModalFlat('','í매ê°ê° 0ì ìëë¡ ì ì©ë ì ìë ìµì ê°ê²©ì´ ì¡´ì¬íì¬ ì ì¥í ì ììµëë¤.',true,false,'','ok','','cl-cmmodal cl-s-btn w560 cl-p130 cl-t80 cl-modal cl-none-title cl-close-btn','','',function() { 19674 $(document).on('keydown', function(e) { 19675 if(e.keyCode == 27) modal.modal('hide'); 19676 }); 19677 }); 19678 return false; 19679 } 19680 19681 if(product_on == 'lim') { 19682 if($('#sale-start-datetime').val() && $('#sale-end-datetime').val()) { 19683 salesStart = $('#sale-start-datetime').val(); 19684 salesEnd = $('#sale-end-datetime').val(); 19685 open_out_datetime_yn = $('input[name="open_out_datetime_yn"]:checked').val(); 19686 } else { 19687 submit = false; 19688 var modal = $(this).showModalFlat('','í매 ìì, í매 ì¢ ë£ ë ì§/ìê°ì 모ë ì ë ¥í´ì£¼ì¸ì.',true,false,'','ok','','cl-cmmodal cl-s-btn w560 cl-p130 cl-t80 cl-modal cl-none-title cl-close-btn','','',function() { 19689 $(document).on('keydown', function(e) { 19690 if(e.keyCode == 27) modal.modal('hide'); 19691 }); 19692 }); 19693 return false; 19694 } 19695 19696 } 19697 19698 if ($('#download-product').is(":checked") == true) productState = 'download'; 19699 if ($('#normal-product').is(":checked") == true) productState = 'normal'; 19700 if ($('#etc-product').is(":checked") == true) { 19701 productState = 'etc'; 19702 etcDateState = $('#etc-date-state').val(); 19703 if (etcDateState == 'Y' || etcDateState == 'T') { 19704 etcDateStatus = $('#etc-date-status').val(); 19705 etcDateWeek = $('#etc-week').val(); 19706 startDate = $('#etc-start-date').val(); 19707 endDate = $('#etc-end-date').val(); 19708 exceptDate = $('#etc-exclude-date').val(); 19709 termData = $('#etc-term').val(); 19710 timeData = $('#etc-time').val(); 19711 19712 // var checkStartDate = startDate.split('.'); 19713 // var checkEndDate = endDate.split('.'); 19714 // var checkStart = new Date(checkStartDate[0], (checkStartDate[1] * 1) - 1, checkStartDate[2]); 19715 // var checkEnd = new Date(checkEndDate[0], (checkEndDate[1] * 1) - 1, checkEndDate[2]); 19716 // if (checkStart.getTime() > checkEnd.getTime()) { 19717 // alert('ììì¼ì´ ì¢ ë£ì¼ë³´ë¤ í½ëë¤.'); 19718 // return false;
19719 // } 19720 if($('input.select-terms:checked').val() == 'Y' && (!startDate || !endDate)) { 19721 alert('ë ì§ ê¸°ê°ì ì íí´ì£¼ì¸ì.'); 19722 return false; 19723 } 19724 } 19725 19726 etcDate = etcDateState+'||'+etcDateStatus+'||'+etcDateWeek+'||'+startDate+'||'+endDate; 19727 etcDate += (dayCheckLan)? '||' + dayCheckLan : '||'; 19728 etcDate += (exceptDate)? '||' + exceptDate : '||'; 19729 etcDate += (termData)? '||' + termData : '||'; 19730 etcDate += (timeData)? '||' + timeData : '||'; 19731 } 19732 // ë¹ ê°¤ë¬ë¦¬ ì²ë¦¬ 19733 if(pid == '-1') { 19734 $('.choose-gallery').parent().addClass('empty'); 19735 submit = false; 19736 } else $('.choose-gallery').parent().removeClass('empty'); 19737 19738 if($img.find('.preview-img').length == 0) { 19739 $img.addClass('empty'); 19740 submit = false; 19741 } else $img.removeClass('.empty'); 19742 19743 if(!$title.val().trim()) { 19744 $title.focus().parents('.form-wrap').addClass('empty'); 19745 submit = false; 19746 } else $title.parents('.form-wrap').removeClass('empty'); 19747 if(!$price.val().trim()) { 19748 $price.focus().parents('.form-wrap').addClass('empty'); 19749 submit = false; 19750 } else $price.parents('.form-wrap').removeClass('empty'); 19751 19752 var item_quantity = (typeof $quantity.val() == 'undefined') ? 0 : parseInt($quantity.val().trim().replace(/\,/g, ''), 10), 19753 item_price = ($price.val().trim()) ? parseInt($price.val().trim().replace(/\,/g, ''), 10) : 0; 19754 if(item_quantity > 9999) { 19755 alert('ìµë ì ë ¥ ìëì 9,999 ì ëë¤.'); 19756 item_quantity = 9999; 19757 $quantity.val(addCommas('9999')).parents('.form-wrap').removeClass('empty'); 19758 } 19759 if(item_price > 1000000000) { 19760 $price.focus().parents('.form-wrap').addClass('empty'); 19761 alert('ìµëìíê°ê²©ì 10ìµì ëë¤'); 19762 return false; 19763 } 19764 19765 if($('#prod-sale-check').is(':checked') && discountRate == 0) { 19766 var error_str = '<svg viewBox="0 0 13 13" width="13" height="13"><path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12.13c-3.11 0-5.63-2.53-5.63-5.63S3.39 0.87 6.5 0.87s5.63 2.53 5.63 5.63S9.61 12.13 6.5 12.13z"></path><path d="M7.44 9.58c-0.1-0.02-0.18-0.05-0.25-0.1C7.12 9.44 7.07 9.37 7.03 9.28 6.98 9.19 6.96 9.07 6.96 8.92V5h-1.7v0.4h0.03c0.11 0 0.21 0.01 0.3 0.02 0.09 0.02 0.18 0.05 0.25 0.09 0.07 0.05 0.13 0.11 0.17 0.2 0.04 0.09 0.06 0.2 0.06 0.34v2.91c0 0.14-0.02 0.25-0.06 0.34C5.97 9.39 5.91 9.45 5.84 9.5 5.77 9.54 5.68 9.57 5.59 9.58 5.49 9.6 5.39 9.6 5.29 9.6H5.16v0.4h2.71V9.6H7.75C7.64 9.6 7.54 9.6 7.44 9.58z"></path><rect x="6" y="3" width="1" height="1"></rect></svg>\ 19767 1 ì´ì ì ë ¥í´ ì£¼ì¸ì.'; 19768 $('.form-group.discount-append + .error-msg').remove(); 19769 $('.form-group.discount-append').after('<div class="error-msg c-red">'+error_str+'</div>'); 19770 $('#prod-discount-rate').addClass('empty'); 19771 submit = false; 19772 } else { 19773 $('.form-group.discount-append + .error-msg').remove(); 19774 $('#prod-discount-rate').removeClass('empty'); 19775 } 19776 19777 $('.unit-pricing').removeClass('empty'); 19778 if($('#normal-product').is(":checked") == true && $('.switch-unit-pricing').prop('checked') && $('.unit-pricing').find('input').filter(function() { return $.trim(this.value) == '' || $.trim(this.value) == '0'}).length) { 19779 $('.unit-pricing').addClass('empty'); 19780 $('.unit-pricing').find('input').filter(function() { return $.trim(this.value) == '' || $.trim(this.value) == '0'})[0].focus(); 19781 return false; 19782 } 19783 19784 var delivery_template_weight = $('input[name="delivery_template_seq"]:checked').parent().data('weight'); 19785 var product_weight = $.trim($('#product_weight').val()).replace(/kg/gi, ''); 19786 if((lux_product || $('#normal-product').is(":checked") == true) && delivery_template_weight == true && (product_weight == '' || product_weight == 0)) { 19787 $('#product_weight').closest('.form-wrap.product-weight').addClass('empty'); 19788 alert('ìí 무ê²ë¥¼ ì ë ¥í´ ì£¼ì¸ì.'); 19789 return false;
19790 } else { 19791 $('#product_weight').closest('.form-wrap.product-weight').removeClass('empty'); 19792 } 19793 19794 var emptyval ='\ 19795 <div class="value-empty">\ 19796 <svg viewBox="0 0 13 13" width="13" height="13"><path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"/><rect x="6" y="3" width="1" height="5"/><rect x="6" y="9" width="1" height="1"/></svg>íì ì ë ¥ í목 ì ëë¤.\ 19797 </div>\ 19798 '; 19799 19800 if(product_info_on=='on') { 19801 if(prod_info.cate_null) { 19802 $('.prod-info-notice').addClass('empty'); 19803 return false; 19804 } 19805 if(prod_info.input_empty) { 19806 $('.value-empty').remove(); 19807 $('.prod-info-notice').css('border','3px solid #ee445f'); 19808 var offset_idx = 0; 19809 19810 $.each(prod_null, function(i,v) { 19811 $('.prod-input-value:eq(' + v + ')').parent('div').append(emptyval); 19812 if(i==0) offset_idx = v; 19813 }); 19814 prod_null.offset_idx = offset_idx; 19815 var input_height = $('.prod-input-value:eq(' + prod_null.offset_idx + ')').offset().top; 19816 if($('.prod.empty').length==0) $('.prod-modal').animate({ scrollTop: input_height*0.8 }, 500, 'easeInOutQuart'); 19817 return false; 19818 } 19819 } 19820 19821 if(productState != 'normal') npay_button = 'N'; 19822 19823 if(mng_product_info_use=='on') { 19824 $('.value-empty').remove(); 19825 $('.mng-prd-info-toggle').removeClass('err'); 19826 if(mng_product_code.trim()=='') { 19827 var mng_prd_empty_val = (mng_product_name.trim()=='') ? 'name' : 'code'; 19828 if (mng_product_code.trim()=='') $('.form-mng-prd-code').after(emptyval); 19829 $('.mng-prd-info-toggle').addClass('err'); 19830 19831 return false; 19832 } 19833 } 19834 19835 if(lux_product) { 19836 if(!$('.prod-type.active').length) { 19837 alert('ìíì íì ì íí´ì£¼ì¸ì.'); 19838 return false; 19839 } 19840 19841 if(!$('#lux-category-text').find('ul').length) { 19842 alert('ì¹´í ê³ ë¦¬ë¥¼ íë ì´ì ì¶ê°í´ì£¼ì¸ì.'); 19843 return false; 19844 } 19845 19846 var selected_brand = $('.prod-input.prod-brand').val(); 19847 if(selected_brand == '') { 19848 alert('ë¸ëë를 ê²ì í í목ìì ì íí´ì£¼ì¸ì.'); 19849 $('#brand').focus(); 19850 return false; 19851 } 19852 19853 var brand_check = brand_list.indexOf(selected_brand) > -1 ? true : false; 19854 19855 if(!brand_check) { 19856 alert('ë¸ëë 목ë¡ì ìë ë¸ëëëª ì ëë¤.\në¸ëë를 ê²ì í 목ë¡ìì ì íí´ì£¼ì¸ì.'); 19857 $('#brand').focus(); 19858 return false; 19859 } 19860 } 19861 19862 if($('.prod-option-list > li').hasClass('err') == true) { 19863 alert('ìµì í목ì 모ë ìì±í´ì£¼ì¸ì.') 19864 return false; 19865 } 19866 19867 var options = $('.prod-option-list > li').map(function(i,v) { 19868 if($(this).find('.prod-option-title').text().trim()) { 19869 var quantity = $(this).find('.prod-option-quantity').text().trim(), 19870 status = $(this).find('.option-price-status-str').attr('data-val'), 19871 type = ''; 19872 if ($(this).closest('.prod-option').data('option_mode') == 'additional') type = 'A'; 19873 else if ($(this).closest('.prod-option').data('option_mode') == 'text') type = 'T'; 19874 19875 if(quantity == '') quantity = '0'; 19876 if(quantity == '0' && quantity_on == 'on') status = 'O'; 19877 19878 var fileUrl = [], 19879 fileSize = [], 19880 fileStrName = [], 19881 fileName = []; 19882 19883 var fileUrlCheck = $(this).find('.file-url'), 19884 fileSizeCheck = $(this).find('.file-size'), 19885 fileStrNameCheck = $(this).find('.file-name-detail'), 19886 fileNameCheck = $(this).find('.real-file-name'); 19887 19888 if (fileUrlCheck.length > 0) $(this).find('.file-url').each(function () { fileUrl.push($(this).text()); }); 19889 else fileUrl.push(''); 19890 if (fileUrlCheck.length > 0) $(this).find('.file-size').each(function () { fileSize.push($(this).text()); }); 19891 else fileUrl.push(''); 19892 if (fileUrlCheck.length > 0) $(this).find('.file-name-detail').each(function () { fileStrName.push($(this).text()); }); 19893 else fileUrl.push(''); 19894 if (fileUrlCheck.length > 0) $(this).find('.real-file-name').each(function () { fileName.push($(this).text()); }); 19895 else fileUrl.push(''); 19896 19897 var strFileUrl = fileUrl.join('||'), 19898 strFileSize = fileSize.join('||'), 19899 strFileStrName = fileStrName.join('||'), 19900 strFileName = fileName.join('||'); 19901 19902 if(type == 'T' || type == 'A') { 19903 strFileStrName = ""; 19904 strFileSize = ""; 19905 strFileName = ""; 19906 strFileUrl=""; 19907 } 19908 19909 var optionTitle = ''; 19910 if(product_options.advanced == 'true') { 19911 if(i == 0 || type == 'T') { 19912 optionTitle = $(this).find('.prod-option-title').text().trim(); 19913 } else { 19914 var $val = $(this).find('.prod-option-title > label.owidth'); 19915 optionTitle = $val.map(function() { 19916 return $(this).text(); 19917 }).get().join(' / '); 19918 19919 } 19920 } else { 19921 optionTitle = $(this).find('.prod-option-title').text().trim(); 19922 } 19923 19924 var optionPrice = (type != 'T')? $(this).find('.prod-option-price').attr('data-option-price').trim() : 0; 19925 var optionGroup = '', m2 = '', m3 = ''; 19926 var arrTitle = optionTitle.split(" / "); 19927 switch(arrTitle.length) { 19928 case 1: optionTitle = arrTitle[0]; break; 19929 case 2: optionTitle = arrTitle[1]; m2 = arrTitle[0]; break; 19930 case 3: optionTitle = arrTitle[2]; m2 = arrTitle[0]; m3 = arrTitle[1]; break; 19931 } 19932 19933 if(type == 'T') { 19934 status = 'S'; 19935 type = 'T'; 19936 optionPrice = "0"; 19937 } else if(type == 'A') { 19938 optionGroup = m2; 19939 m2 = ''; 19940 } else if(type == '') { 19941 if(product_options.type == "1") { 19942 optionGroup = m2; 19943 m2 = ""; 19944 } 19945 } 19946 // if(product_options.advanced == false && optionTitle != 'noneOption') { 19947 // switch(type) { 19948 // case "" : product_options.config1[0].title = 'ìµì ì í'; break; 19949 // case "A" : product_options.config3[0].title = 'ì¶ê°ìµì '; break; 19950 // } 19951 // } 19952 return { 19953 s : $(this).find('.prod-option-title').attr('data-seq'), 19954 m2 : m2, 19955 m3 : m3, 19956 o : optionTitle, 19957 v : optionPrice, 19958 fn : strFileName, 19959 fdn : strFileStrName, 19960 fs : strFileSize, 19961 fu : strFileUrl, 19962 q : quantity, 19963 t : status, 19964 g : optionGroup, 19965 a : i, 19966 ty: type 19967 } 19968 } 19969 }).get(); 19970 19971 if(options.length==0 && $('.prod-option-tab .prod-option.hide').length < 3) { 19972 $('.prod-option-add').addClass('empty'); 19973 submit = false;
19974 } 19975 19976 var optionsAry = [options]; 19977 // console.log(optionsAry); 19978 var price1 = removeCommas($price.val().trim()), //í ì¸ê° 19979 price2 = removeCommas($sale.text().trim()); //ì ê° 19980 19981 if($sale.css('display') == 'none') { 19982 $sale.text(''); 19983 price2 = 0; 19984 } 19985 19986 if(lux_product == false) { 19987 if($('#prod-sale-check').is(':checked') && (parseInt(price1) - parseInt(price2) >= 0)) { 19988 // alert('í ì¸ ê°ê²©ì ì ê°ë³´ë¤ ëê±°ë ëì¼í ì ììµëë¤'); 19989 var modal = $(this).showModalFlat('','í ì¸ ê°ê²©ì ì ê°ë³´ë¤ ëê±°ë ëì¼í ì ììµëë¤',true,false,'','ok','','cl-cmmodal cl-s-btn w560 cl-p130 cl-t80 cl-modal cl-none-title cl-close-btn','','',function() { 19990 $(document).on('keydown', function(e) { 19991 if(e.keyCode == 27) modal.modal('hide'); 19992 }); 19993 }); 19994 if(price2 == 0) $price.val(''); 19995 submit = false; 19996 return; 19997 } 19998 } else { 19999 if($('#prod-sale-check').is(':checked') && (parseInt(price1) - parseInt(price2) > 0)) { 20000 var modal = $(this).showModalFlat('','í ì¸ ê°ê²©ì ì ê°ë³´ë¤ ëì ì ììµëë¤',true,false,'','ok','','cl-cmmodal cl-s-btn w560 cl-p130 cl-t80 cl-modal cl-none-title cl-close-btn','','',function() { 20001 $(document).on('keydown', function(e) { 20002 if(e.keyCode == 27) modal.modal('hide'); 20003 }); 20004 }); 20005 if(price2 == 0) $price.val(''); 20006 submit = false; 20007 return; 20008 } 20009 } 20010/* 20011 if(nPrice > 0 && nPrice < 10) { 20012 $('#prod-price').focus(); 20013 $('.prod-item-price1').addClass('err') 20014 // alert('ìí ê°ê²©ì 10ì ì´ì ì ë ¥í´ì£¼ì¸ì.'); 20015 var modal = $(this).showModalFlat('','ìí ê°ê²©ì 10ì ì´ì ì ë ¥í´ì£¼ì¸ì.',true,false,'','ok','','cl-cmmodal cl-s-btn w560 cl-p130 cl-t80 cl-modal cl-none-title cl-close-btn','','',function() { 20016 $(document).on('keydown', function(e) { 20017 if(e.keyCode == 27) modal.modal('hide'); 20018 }); 20019 }); 20020 submit = false; 20021 } else { 20022 $('.prod-item-price1').removeClass('err'); 20023 } 20024*/ 20025 var imgs = []; 20026 if(submit) { 20027 $('.prod-item-thumb li').each(function(i,v) { 20028 var s = $(this).find('img:not(.guide-img)').attr('src'); 20029 if($(this).hasClass('prod-item-image-add')) return true; 20030 imgs.push(s); 20031 }); 20032 20033 20034 $.processON('ìíì ë±ë¡ì¤ì ëë¤...'); 20035 20036 var func = new Array(); 20037 func[0] = true; 20038 func[1] = $('#review-checkbox').is(":checked"); // 리뷰ì¬ì© 20039 func[2] = $('#qna-checkbox').is(":checked"); // QNA ì¬ì© 20040 func[3] = $('#photo-review').is(":checked"); // ìë¨ í¬í 리뷰 íì 20041 20042 func[4] = ($('#normal-option').is(':checked'))? true : false; //ì¼ë°ìµì íì±í 20043 func[5] = ($('#text-option').is(':checked'))? true : false; //ì ë ¥ìµì íì±í 20044 func[6] = ($('#additional-option').is(':checked'))? true : false; //ì¶ê°ìµì íì±í 20045 20046 var useReviewImgUpload = $('#use-review-img-upload').is(":checked"); // í기 ì¬ì§ì ë¡ë ì¬ì©ì¬ë¶ 20047 20048 var cate = ($category.text().trim()) ? $category.text().trim().split(',') : '', 20049 brand = ($brand.val().trim())? $brand.val().trim():'', 20050 //ì¬ê³ ìë 20051 quantity_val = (func[4] == 'true' || func[6] == 'true')? 0 : item_quantity, 20052 options_config = $.extend(true, {}, product_options); 20053 20054 delete options_config.options1; 20055 delete options_config.options2; 20056 delete options_config.options3; 20057 20058 var prod_user_margin = (typeof $('.prod-user-margin').val() == 'undefined') ? 0 : $('.prod-user-margin').val().trim(), 20059 prod_user_price = (typeof $('.prod-user-price').val() == 'undefined') ? 0 : $('.prod-user-price').val().trim(), 20060 prod_price_sync = ($('.prod-price-sync').hasClass('active')) ? 'T' : 'F', 20061 prod_status = $('.prod-status.active').attr('data-val'), 20062 prod_type = $('.prod-type.active').attr('data-val'), 20063 prod_brand = $('.prod-brand').val(), 20064 prod_category = []; 20065 20066 if(lux_product) { 20067 if(seq < 1 || seq >= 1000000000) { 20068 if(prod_status == 'T' && $('.prod-option-quantity').not(':first').length == $('.prod-option-quantity').not(':first').map(function(k, v) { if($(v).text() == 0 ) return v;}).length) { 20069 prod_status = 'F'; 20070 } else if(prod_status == 'T' && $('.prod-option-status').not(':first').length == $('.prod-option-status').not(':first').map(function(k, v) { if($(v).attr('data-val') == 'O') return v;}).length) { 20071 prod_status = 'F'; 20072 } 20073 var invenCheck = false;
20074 20075 $.each(optionsAry[0], function(idx, v) { 20076 if(prod_status != 'T' || (idx > 0 && v.t != 'O')) { 20077 invenCheck = true; 20078 } 20079 }); 20080 20081 if(!invenCheck) prod_status = 'F'; 20082 } 20083 } 20084 20085 if($('#lux-category-text').length) { 20086 $.each($('#lux-category-text ul'),function(i,v) { 20087 prod_category[i] = { 20088 'sid' : $(this).attr('data-sid'), 20089 'no' : $(this).attr('data-no'), 20090 'category' : [], 20091 'category_name' : [], 20092 'update' : [] 20093 } 20094 $.each($(this).find('li'),function(a,b) { 20095 prod_category[i]['category'].push($(this).attr('data-category-no')); 20096 var seq = (typeof $(this).attr('data-seq') != 'undefined' && $(this).attr('data-seq') != '') ? $(this).attr('data-seq') : ''; 20097 prod_category[i]['update'].push(seq); 20098 prod_category[i]['category_name'].push($(this).text().trim()); 20099 }); 20100 }); 20101 } 20102 20103 setTimeout(function() { 20104 for (var optionCnt=0;optionCnt<optionsAry.length;optionCnt++) { 20105 var prod = { 20106 'seq' : seq, 20107 'page' : page, 20108 'pid' : pid, 20109 'gpos' : gpos, 20110 'title' : $title.val().trim(), 20111 'price' : $price.val().trim(), 20112 'sale' : $sale.text().trim(), 20113 'discount_rate' : discountRate, 20114 'discount_unit' : discountUnit, 20115 // 'check_sale_cut' : checkSaleCut, 20116 'product_on' : product_on, 20117 'product_info_on' : product_info_on, 20118 'mng_product_info_use' : mng_product_info_use, 20119 'mng_product_name' : mng_product_name, 20120 'mng_product_code' : mng_product_code, 20121 'quantity' : quantity_val, 20122 'quantity_on' : quantity_on, 20123 'desc' : $desc.val().trim(), 20124 'category' : cate, 20125 'category_on' : category_on, 20126 'brand' : brand, 20127 'imgs' : imgs, 20128 'func' : func, 20129 'product_state' : productState, 20130 'tax' : taxState, 20131 'download_date' : downloadDate, 20132 'download_count' : downloadCount, 20133 'etc_data' : etcDate, 20134 'options' : JSON.stringify(optionsAry[optionCnt]), 20135 'prod_info' : prod_info, 20136 'options_config' : options_config, 20137 'delete_options' : delete_options, 20138 'before_prod' : JSON.stringify(before_prod), 20139 'delivery_template_seq' : deliveryTemplateSeq, 20140 'product_weight' : productWeight, 20141 'culture_benefit_yn' : culture_benefit_yn, 20142 'npay_button' : npay_button, 20143 'lux' : lux_product, 20144 'prod_user_margin' : prod_user_margin, 20145 'prod_user_price' : prod_user_price, 20146 'prod_price_sync' : prod_price_sync, 20147 'prod_status' : prod_status, 20148 'prod_type' : prod_type, 20149 'prod_category' : prod_category, 20150 'prod_brand' : prod_brand, 20151 'category_deleted' : ($('#category-deleted').length) ? $('#category-deleted').val() : '', 20152 'product_pccc_yn' : product_pccc_yn, 20153 'require_navershop' : require_navershop,
20154 'sales_start': salesStart, 20155 'sales_end': salesEnd, 20156 'open_out_datetime_yn': open_out_datetime_yn, 20157 'unit_use_yn': unit_use_yn, 20158 'total_unit_value' : total_unit_value, 20159 'total_unit' : total_unit, 20160 'total_unit_bundle' : total_unit_bundle, 20161 'basic_unit_value' : basic_unit_value, 20162 'basic_unit' : basic_unit, 20163 'use_review_img_upload' : useReviewImgUpload 20164 } 20165 20166 $.post('/template/products', { sid: SID, type : 'add', s: prod, lux : lux_product }, function (data) { 20167 // checkError(data); 20168 if(data.error) { 20169 $.processOFF(); 20170 if(data.price) $('#prod-price').val(''); 20171 var modal = $(this).showModalFlat('',data.error,true,false,'','ok','','cl-cmmodal cl-s-btn w560 cl-p130 cl-t80 cl-modal cl-none-title cl-close-btn','','',function() { 20172 $(document).on('keydown', function(e) { 20173 if(e.keyCode == 27) modal.modal('hide'); 20174 }); 20175 }); 20176 return false; 20177 } 20178 20179 // control panel 20180 if (optionsAry.length == (optionCnt + 1)) { 20181 $('img.galleryItemEdit[data-seq="' + data.r.id + '"]').attr('src',data.r.imgs[0].path+'/60/'+data.r.imgs[0].file); 20182 $('.image-title.galleryItemEdit[data-seq="' + data.r.id + '"]').text(data.r.title); 20183 20184 PRODINFO = (product_info_on=='on') ? prod_info : ''; 20185 PRODSETTING = 'on'; 20186 20187 // dashboard 20188 if(typeof MODE == 'undefined') { 20189 $.processOFF(); 20190 $.products.close(); 20191 if($('.gallery-modal').length) { 20192 var now_page = getStorageItem('gallery-product-page'); 20193 $.gallery.show($.gallery.block_id,now_page,$.gallery.category); 20194 } 20195 20196 } else { 20197 if(go) { 20198 var block = ($('.el_1').length) ? '.el_1' : '.default_project_contents', 20199 menuPage = PAGE.split(','); 20200 if(LUX) menuPage[0] = '_product'; 20201 $.cookie('product-detail', true, { expires: 60*60, path : '/' }); 20202 location.href = '/'+CONFIG_URL+'config/page/'+menuPage[0]+'/view/'+data.r.id; 20203 20204 } else { 20205 var $emptyShoppingGallery = $('.element[data-id="' + pid + '"][data-type="gallery"][data-mode="shopping"].emptyGallery'); 20206 if(seq < 1 && $emptyShoppingGallery.length > 0) { 20207 $.cookie('block-add', '.element[data-id="' + pid + '"]', { path: '/' }); 20208 } 20209 showPageCallback(showPage); 20210 $.processOFF(); 20211 $.products.close(); 20212 if($('.gallery-modal').length) { 20213 var now_page = getStorageItem('gallery-product-page'); 20214 $.gallery.show($.gallery.block_id,now_page,$.gallery.category); 20215 } 20216 } 20217 } 20218 } 20219 }, 'json').fail(function() { 20220 $.processOFF(); 20221 var modal = $(this).showModalFlat('','ìí ì ì¥ ì¤ ì¤ë¥ê° ë°ìíìµëë¤. ì ì í ë¤ì ìëí´ ì£¼ì¸ì.',true,false,'','ok','','cl-cmmodal cl-s-btn w560 cl-p130 cl-t80 cl-modal cl-none-title cl-close-btn','','',function() { 20222 $(document).on('keydown', function(e) { 20223 if(e.keyCode == 27) modal.modal('hide'); 20224 }); 20225 }); 20226 }); 20227 } 20228 }); 20229 } 20230 }, 20231 display_info : function() { 20232 var prodObj = (typeof property == "undefined") ? PRODINFO : property.PRODINFO; 20233 var s = '\ 20234 <div class="cl-s-product-info-notice element el_000">\ 20235 <div class="container">\
20236 <span class="prod-info-notice">ìíì ë³´ ì ê³µê³ ì</span>\ 20237 <table>\ 20238 <colgroup>\ 20239 <col width="">\ 20240 <col width="*">\ 20241 </colgroup>\ 20242 <tbody>\ 20243 '; 20244 20245 $.each(prodObj.content, function(i,v) { 20246 s = s + '\ 20247 <tr>\ 20248 <td class="prod-info-title">' + v.title + '</td>\ 20249 <td>' + v.content + '</td>\ 20250 </tr>\ 20251 '; 20252 }); 20253 s = s + '\ 20254 </tbody>\ 20255 </table>\ 20256 </div>\ 20257 </div>\ 20258 '; 20259 20260 if(typeof property == "undefined") { 20261 $lastEl = ($('.el-footer_ctrl').length) ? $('.el-footer_ctrl') : $('.add-footer-information'); 20262 if($('.page-bottomlist').length) $lastEl = $('.page-bottomlist'); 20263 if($('.fnav').length) $lastEl = $('.fnav'); 20264 $lastEl.before(s); 20265 } else { 20266 if($('.el-footer').length) { 20267 $lastEl = ($('.page-bottomlist').length) ? $('.page-bottomlist') : $('.el-footer'); 20268 if($('.fnav').length) $lastEl = $('.fnav'); 20269 $lastEl.before(s); 20270 } else { 20271 $('.dsgn-body').append($s); 20272 } 20273 } 20274 }, 20275 close : function() { 20276 var parentDocument = $(window.parent.document), 20277 $detail_modal = parentDocument.find('.product-detail-modal'); 20278 if($detail_modal.length) $detail_modal.removeClass('overlap'); 20279 20280 if($('.prod-modal').length) { 20281 $('.prod-modal').fadeOut(300, function() { 20282 $(this).remove(); 20283 }); 20284 } 20285 } 20286 } 20287 20288 var clicking = false; 20289 $.gallery = { 20290 mode : '', 20291 SMENU : '', 20292 SFOLDER : '', 20293 valid_plan : '', 20294 valid_type : '', 20295 service : '', 20296 one : '', 20297 block_id : '', 20298 block_name : '', 20299 block_el : '', 20300 blocks : [], 20301 pages : [], 20302 seqs : [], 20303 copy : [], 20304 move : [], 20305 delete : [], 20306 ex_id : [], 20307 view_item : 30, 20308 update : false, 20309 unlink : false, 20310 category : '', 20311 cates : '', 20312 drag : '', 20313 last : '', 20314 site_settings : '', 20315 item_of_page : '', 20316 sort_icon_checked : '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-check2-square" viewBox="0 0 16 16"><path d="M3 14.5A1.5 1.5 0 0 1 1.5 13V3A1.5 1.5 0 0 1 3 1.5h8a.5.5 0 0 1 0 1H3a.5.5 0 0 0-.5.5v10a.5.5 0 0 0 .5.5h10a.5.5 0 0 0 .5-.5V8a.5.5 0 0 1 1 0v5a1.5 1.5 0 0 1-1.5 1.5z"/><path d="m8.354 10.354 7-7a.5.5 0 0 0-.708-.708L8 9.293 5.354 6.646a.5.5 0 1 0-.708.708l3 3a.5.5 0 0 0 .708 0"/></svg>', 20317 sort_icon_desc : '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="down" viewBox="0 0 16 16"><path d="M3.5 2.5a.5.5 0 0 0-1 0v8.793l-1.146-1.147a.5.5 0 0 0-.708.708l2 1.999.007.007a.497.497 0 0 0 .7-.006l2-2a.5.5 0 0 0-.707-.708L3.5 11.293zm3.5 1a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5M7.5 6a.5.5 0 0 0 0 1h5a.5.5 0 0 0 0-1zm0 3a.5.5 0 0 0 0 1h3a.5.5 0 0 0 0-1zm0 3a.5.5 0 0 0 0 1h1a.5.5 0 0 0 0-1z"/></svg>', 20318 sort_icon_asc : '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="up" viewBox="0 0 16 16"><path d="M3.5 3.5a.5.5 0 0 0-1 0v8.793l-1.146-1.147a.5.5 0 0 0-.708.708l2 1.999.007.007a.497.497 0 0 0 .7-.006l2-2a.5.5 0 0 0-.707-.708L3.5 12.293zm4 .5a.5.5 0 0 1 0-1h1a.5.5 0 0 1 0 1zm0 3a.5.5 0 0 1 0-1h3a.5.5 0 0 1 0 1zm0 3a.5.5 0 0 1 0-1h5a.5.5 0 0 1 0 1zM7 12.5a.5.5 0 0 0 .5.5h7a.5.5 0 0 0 0-1h-7a.5.5 0 0 0-.5.5"/></svg>', 20319 edit_icon : '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 16 16"><path d="M15.41 0.76l-0.17-0.17C14.85 0.2 14.34 0 13.83 0s-1.02 0.2-1.41 0.59L1 12l-1 4 4-1L15.41 3.59C16.2 2.8 16.2 1.54 15.41 0.76zM3.49 14.1l-2.11 0.53 0.53-2.11 8.95-8.95 1.59 1.59L3.49 14.1zM14.71 2.88l-1.56 1.56 -1.59-1.59 1.56-1.56C13.31 1.1 13.56 1 13.83 1s0.52 0.1 0.71 0.29l0.17 0.17C15.1 1.85 15.1 2.49 14.71 2.88z"></path></svg>', 20320 close_icon : '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-x-lg" viewBox="0 0 16 16"><path d="M2.146 2.854a.5.5 0 1 1 .708-.708L8 7.293l5.146-5.147a.5.5 0 0 1 .708.708
20320L8.707 8l5.147 5.146a.5.5 0 0 1-.708.708L8 8.707l-5.146 5.147a.5.5 0 0 1-.708-.708L7.293 8z"/></svg>', 20321 conf_icon : '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-gear-fill" viewBox="0 0 16 16"><path d="M9.405 1.05c-.413-1.4-2.397-1.4-2.81 0l-.1.34a1.464 1.464 0 0 1-2.105.872l-.31-.17c-1.283-.698-2.686.705-1.987 1.987l.169.311c.446.82.023 1.841-.872 2.105l-.34.1c-1.4.413-1.4 2.397 0 2.81l.34.1a1.464 1.464 0 0 1 .872 2.105l-.17.31c-.698 1.283.705 2.686 1.987 1.987l.311-.169a1.464 1.464 0 0 1 2.105.872l.1.34c.413 1.4 2.397 1.4 2.81 0l.1-.34a1.464 1.464 0 0 1 2.105-.872l.31.17c1.283.698 2.686-.705 1.987-1.987l-.169-.311a1.464 1.464 0 0 1 .872-2.105l.34-.1c1.4-.413 1.4-2.397 0-2.81l-.34-.1a1.464 1.464 0 0 1-.872-2.105l.17-.31c.698-1.283-.705-2.686-1.987-1.987l-.311.169a1.464 1.464 0 0 1-2.105-.872zM8 10.93a2.929 2.929 0 1 1 0-5.86 2.929 2.929 0 0 1 0 5.858z"/></svg>', 20322 info_icon_option_true : '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-info-circle" viewBox="0 0 16 16" data-toggle="tooltip" data-placement="top" title="ì ì²´ ëë ì¼ë¶ ìíë¤ ì¬ê³ ê° 5ê° ì´íì ëë¤"><path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14m0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16"/><path d="m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0"/></svg>', 20323 info_icon_option_false : '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-info-circle" viewBox="0 0 16 16" data-toggle="tooltip" data-placement="top" title="íì¬ ì¬ê³ ê° 5ê° ì´íì ëë¤"><path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14m0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16"/><path d="m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0"/></svg>', 20324 reset : function() { $.gallery.move = []; $.gallery.copy = []; $.gallery.seqs = []; }, 20325 init : function() { 20326 var clearLocalStorage = function() { 20327 window.localStorage.removeItem('gallery-product-page'); 20328 window.localStorage.removeItem('gallery-product-name'); 20329 window.localStorage.removeItem('gallery-product-filter'); 20330 window.localStorage.removeItem('gallery-product-sort'); 20331 window.localStorage.removeItem('gallery-product-by'); 20332 } 20333 clearLocalStorage(); 20334 var galleryMoveItem = function(block_id,seq,page,callback) { 20335 if(CANCEL) return true; 20336 var seqs = []; 20337 seqs.push(seq); 20338 $.ajax({ 20339 url: '/template/gallery/move', 20340 data: { s: seqs, sid : SID, page : page, block_id : block_id }, 20341 dataType: 'json', 20342 type: 'POST', 20343 async: true, 20344 cache: false, 20345 success: function(data) { 20346 checkError(data); 20347 if(typeof callback == 'function') { 20348 callback(); 20349 } 20350 } 20351 }); 20352 } 20353 var reloadItems = function(items) { 20354 20355 } 20356 var updateItem = function(item) { 20357 20358 } 20359 var getSearchProduct = function(product_name) { 20360 if(typeof product_name == 'undefined' || (product_name.length > 0 && product_name.length < 2)) { 20361 alert('ìµì 2ìì´ì ê²ìì´ë¥¼ ì ë ¥íì¸ì'); 20362 $('.gallery-list-search-text').focus(); 20363 return false; 20364 } 20365 window.localStorage.setItem('gallery-product-name',product_name); 20366 $.gallery.show($.gallery.block_id,1,$.gallery.category); 20367 } 20368 var setQuantity = function(seqs) { 20369 if(typeof seqs == 'undefined') { 20370 var product_number_arr = $('[name="item_check[]"]:checked').map(function() { return $(this).closest('.table-item').attr('data-seq'); }).toArray(); 20371 } else { 20372 var product_number_arr = seqs; 20373 } 20374 var route = (CONFIG_URL) ? '/_admin' : ''; 20375 $.ajax({ 20376 url: route + '/shopping/stock_use_check', 20377 type:'post', 20378 dataType:'json', 20379 async: true, 20380 data:{ 20381 'sid' : SID, 20382 'product_number' : product_number_arr 20383 }, 20384 success:function(data) {
20385 var valid_data = data.filter(function(v){ if(v.product_quantity_on == 'on') return v; }); 20386 var invalid_data = data.filter(function(v){ if(v.product_quantity_on != 'on') return v; }); 20387 if(valid_data.length > 0 && valid_data.length <= product_number_arr.length) { 20388 var invalid_products = invalid_data.map(function(v) { return v.title; }).join('<br>'); 20389 var showProductList = function() { 20390 $.ajax({ 20391 url: route + '/shopping/batch_stock_list', 20392 type:'post', 20393 dataType:'html', 20394 data: { 20395 'sid' : SID, 20396 'product_number' : valid_data.map(function(v) { return v.product_number; }) 20397 }, 20398 success:function(data) { 20399 var modal = $(this).showModalFlat($.lang[LANG]['editor.block.gallery.product.stock'] + $.lang[LANG]['editor.block.gallery.product.price'], data, false, true, function() { //confirm 20400 20401 var dataSet = []; 20402 20403 modal.find('.setting_product_list [data-product_number]').each(function() { 20404 var product_number = $(this).attr('data-product_number'); 20405 var option_seq = $(this).attr('data-option_seq'); 20406 var pre_quantity = Number(removeCommas($(this).find('.input-stock[data-quantity]').attr('data-pre_quantity'))); 20407 var quantity = Number(removeCommas($(this).find('.input-stock[data-quantity]').attr('data-quantity'))); 20408 var option_status = $(this).find('.input-stock[data-quantity]').attr('data-option_status'); 20409 var product_name = $(this).find('.product_title').text(); 20410 var option_name = $(this).find('.option_name').text(); 20411 var option_value = $(this).find('.option_value').text(); 20412 var option_type = $(this).find('.input-stock[data-quantity]').attr('data-option_type'); 20413 20414 var arr = {'product_number': product_number, 'option_seq': option_seq, 'pre_quantity': pre_quantity, 'quantity': quantity, 'option_status' : option_status, 'product_name' : product_name, 'option_name' : option_name, 'option_value' : option_value, 'option_type' : option_type }; 20415 dataSet.push(arr); 20416 }); 20417 20418 $.ajax({ 20419 url : route + '/shopping/batch_stock_set', 20420 type:'post', 20421 dataType:'json', 20422 data: { 20423 'sid' : SID, 20424 'datalist' : dataSet 20425 }, 20426 success: function(data) { 20427 // if(data.result == true) $.gallery.show($.gallery.block_id); 20428 }, error: function() { 20429 20430 }, complete: function() { 20431 // showPageCallback(showPage) 20432 var page = getStorageItem('gallery-product-page'); 20433 $.gallery.show($.gallery.block_id,page,$.gallery.category); 20434 } 20435 }); 20436 20437 modal.modal('hide'); 20438 } ,'cancel', 'config.change', 'cl-cmmodal cl-s-btn cl-p0 w900 cl-edit-discount modal-product-discount site-popup-discount cl-product-setting cover fullcover-modal fixed', '', '', function() { //show 20439 }, function(){ //hide 20440 },true); 20441 } 20442 }); 20443 20444 }; 20445 if(!invalid_products) { 20446 showProductList(); 20447 return false;
20448 } 20449 20450 $(this).showModalFlat('ìë´', '<div>ì¬ê³ ì¼ê´ ê´ë¦¬ë ìíì ë³´ <span style="color:#4789e7;">ì¤ì íì´ì§ > ì¬ê³ ê´ë¦¬ ìµì </span>ì´<br><span style="color:#4789e7;">ì¬ì©</span>ì¼ë¡ ì¤ì ë ìíë§ ê°ë¥í©ëë¤.<br><br>ìë ìíë¤ì ì¬ê³ ê´ë¦¬ ìµì ì´ <span style="color:#4789e7;">ì¬ì©ìí¨</span>ì¼ë¡ ì¤ì ëì´ ììµëë¤.<br>ì´ ìíë¤ì ì ì¸íê³ ì¬ê³ ì¤ì íì´ì§ë¡ ì´ëí©ëë¤.<br>(ì¬ê³ ê´ë¦¬ ìµì ì ê° ìíë¤ì ìíì ë³´ ì¤ì íì´ì§ìì ì¤ì í ì ììµëë¤.)</div><div class="title">ìíëª </div><div class="scroll">' + invalid_products + '</div>', true, false, function() { 20451 // ok callback 20452 // showProductList(); 20453 }, 'ok', '', 'cl-cmmodal cl-s-btn w700 cl-p70 cl-t80 cl-close-btn cover cover-inner-scroll', false, function() { 20454 // close callback 20455 // showProductList(); 20456 }, function() { 20457 // show callback 20458 }, function() { 20459 // hide callback 20460 showProductList(); 20461 }); 20462 } else if(valid_data.length == 0) { 20463 var modal = $(this).showModalFlat('ìë´', '<div>ì¬ê³ ì¼ê´ ê´ë¦¬ë ìíì ë³´ <span style="color:#4789e7;">ì¤ì íì´ì§ > ì¬ê³ ê´ë¦¬ ìµì </span>ì´<br><span style="color:#4789e7;">ì¬ì©</span>ì¼ë¡ ì¤ì ë ìíë§ ê°ë¥í©ëë¤.</div>', true, false, function() { 20464 // ok callback 20465 modal.modal('hide'); 20466 }, 'ok', '', 'cl-cmmodal cl-s-btn w700 cl-p70 cl-t80 cl-close-btn', false, function() { 20467 // close callback 20468 }, function() { 20469 // show callback 20470 }, function() { 20471 // hide callback 20472 }); 20473 } 20474 } 20475 }); 20476 } 20477 var checkUserEdit = function(v,type) { 20478 console.log(v,type); 20479 switch(type) { 20480 case 'sale': 20481 if(!isNaN(parseFloat(v)) && isFinite(v) && parseFloat(v) >= 0 && parseFloat(v) <= 1000000000) return true; 20482 break; 20483 case 'org': 20484 if(!isNaN(parseFloat(v)) && isFinite(v) && parseFloat(v) >= 0 && parseFloat(v) <= 1000000000) return true; 20485 break; 20486 case 'disc': 20487 if(!isNaN(parseFloat(v)) && isFinite(v) && parseFloat(v) <= 100) return true; 20488 break; 20489 case 'quantity': 20490 if(!isNaN(parseFloat(v)) && isFinite(v) && parseFloat(v) < 10000) return true; 20491 break; 20492 default: return false; 20493 } 20494 20495 return false; 20496 } 20497 var getEditType = function($o) { 20498 var type = ''; 20499 if($o.parent().hasClass('td-orig-price')) type = 'org'; 20500 if($o.parent().hasClass('td-price')) type = 'sale'; 20501 if($o.parent().hasClass('td-discount')) type = 'disc'; 20502 if($o.parent().hasClass('td-quantity')) type = 'quantity'; 20503 if(type == '') { 20504 alert('Invalid type'); 20505 return false; 20506 } 20507 return type; 20508 } 20509 $(document).on('click','.gallery-modal .gallery-block-select', function(e) { 20510 $('.gallery-modal .gallery-blocks.mobile').toggle(); 20511 }) 20512 $(document).on('click','.item-header .product-sort, .table-toolbar li .product-sort',function(e) { 20513 var sort = $(this).attr('data-sort'), 20514 by = $(this).attr('data-by'); 20515 20516 if(by == '') by = 'desc'; 20517 else { 20518 by = (by == 'desc') ? 'asc' : 'desc'; 20519 } 20520 window.localStorage.setItem('gallery-product-sort',sort); 20521 window.localStorage.setItem('gallery-product-by',by); 20522 $.gallery.show($.gallery.block_id,1,$.gallery.category); 20523 }); 20524 $(document).on('click','.item-header .product-sort-checked, .table-toolbar li .product-sort-checked',function(e) { 20525 window.localStorage.removeItem('gallery-product-sort'); 20526 window.localStorage.removeItem('gallery-product-by'); 20527 $.gallery.show($.gallery.block_id,1,$.gallery.category); 20528 }); 20529 $(document).on('click','.gallery-blocks .all-items', function(e) { 20530 clearLocalStorage(); 20531 $.gallery.show('',1); 20532 }); 20533 $(document).on('click','.table-item .td-status', function(e) { 20534 var is_product = $(this).parent().attr('data-product'); 20535 if(typeof is_product == 'undefined' || is_product == 'false') { 20536 $(this).showModalFlat($.lang[LANG]["config.information"], 'ìí ì 보를 ì ë ¥í íì ì´ì© ê°ë¥í©ëë¤.<br>ìí ì¤ì ì ìë£í´ì£¼ì¸ì', true, false, '', 'ok','','cl-p130 cl-cmmodal cl-s-btn w560 cl-p0 cl-okbtn-pbt70'); 20537 return false;
20538 } 20539 e.stopPropagation(); 20540 if($(this).hasClass('open')) { 20541 $(this).removeClass('open').find('.table-item-status').hide(); 20542 return false; 20543 } 20544 $(this).toggleClass('open'); 20545 $('.table-item-status').hide(); 20546 var $status = $(this).find('.table-item-status'); 20547 ($(this).hasClass('open')) ? $status.show() : $status.hide().removeClass('open'); 20548 }); 20549 $(document).on('click','.table-item .table-item-status li', function(e) { 20550 e.preventDefault(); 20551 var product_number = $(this).parent().attr('data-seq'), 20552 status = $(this).attr('data-val'); 20553 $(this).parent().find('li').removeClass('active'); 20554 $(this).addClass('active'); 20555 20556 $.processON(); 20557 var route = (CONFIG_URL) ? '/_admin' : ''; 20558 $.ajax({ 20559 url: route + '/shopping/setProductStatus', 20560 type: 'post', 20561 data: { sid : SID, product_number : product_number, status : status }, 20562 async: true, 20563 cache: false, 20564 dataType: 'json', 20565 success: function(data) { 20566 $.processOFF(); 20567 if(typeof data.error != 'undefined' && data.error) { 20568 $p.find('.prev-value').text(t); 20569 alert(data.error); 20570 return false; 20571 } 20572 var page = getStorageItem('gallery-product-page'); 20573 $.gallery.show($.gallery.block_id,page,$.gallery.category); 20574 $.gallery.update = true; 20575 $.gallery.reset(); 20576 }, 20577 error: function(request,status,error) { 20578 $.processOFF(); 20579 alert('code:'+request.status+'\n'+'message:'+request.responseText+'\n'+'error:'+error); 20580 return false; 20581 } 20582 }); 20583 }); 20584 $(document).on('keyup','.gallery-list-search-text', function(e) { 20585 var product_name = $(this).val().trim(); 20586 // if(product_name.length == 0) return false; 20587 if(e.key === 'Enter') { 20588 getSearchProduct(product_name); 20589 } 20590 }); 20591 $(document).on('click','.gallery-list-search-submit', function(e) { 20592 var product_name = $('.gallery-list-search-text').val().trim(); 20593 // if(product_name.length == 0) return false; 20594 getSearchProduct(product_name); 20595 }); 20596 $(document).on('click','.gallery-list-search-cancel',function(e) { 20597 // $(this).hide(); 20598 $('.gallery-list-search-submit').show(); 20599 $('.gallery-list-search-text').val(''); 20600 window.localStorage.removeItem('gallery-product-name'); 20601 $.gallery.show($.gallery.block_id,1,$.gallery.category); 20602 }); 20603 $(document).on('click','.gallery-list-filter ul li', function(e) { 20604 $('.gallery-list-filter ul li').removeClass('active'); 20605 $(this).addClass('active'); 20606 var filter = $(this).attr('data-val'); 20607 window.localStorage.setItem('gallery-product-filter',filter); 20608 $.gallery.show($.gallery.block_id,1,$.gallery.category); 20609 }); 20610 var isClose = false; 20611 $(document).on('click','.table-item .edit-button',function(e) { 20612 isClose = false; 20613 if($(this).hasClass('conf')) { 20614 var $parent = $(this).parents('.table-item'), 20615 seq = $parent.attr('data-seq'), 20616 seqs = [seq]; 20617 setQuantity(seqs); 20618 return false; 20619 } 20620 var s = $(this).parent().find('.prev-value').text(), 20621 type = getEditType($(this)); 20622 $('#user-edit').remove(); 20623 $('.close-button').hide(); 20624 $(this).parents('.table-item').find('.edit-button').show(); 20625 $(this).hide(); 20626 if($(this).parent().find('input').length == 0) { 20627 $(this).parent().append('<input type="text" class="' + type + '" id="user-edit" value="' + s + '" numberOnly>'); 20628 $('#user-edit').focus(); 20629 $(this).parent().find('.close-button').show(); 20630 $('.edit-button').hide(); 20631 } 20632 }); 20633 $(document).on('mousedown','.close-button',function(e) { 20634 e.preventDefault(); 20635 }); 20636 $(document).on('click','.close-button', function(e) { 20637 var s = $(this).attr('data-val'), 20638 $this = $(this); 20639 isClose = true; 20640 $(this).removeClass('err not').hide(); 20641 $(this).parent().find('.prev-value').text(s); 20642 $(this).parent().find('input').remove(); 20643 $(this).parents('.table-item').find('.edit-button').show(); 20644 }); 20645 $(document).on('blur','#user-edit',function(e) { 20646 if(isClose) return false;
20647 var s = $(this).val().trim(), 20648 $p = $(this).parent(), 20649 $this = $(this), 20650 type = getEditType($(this)), 20651 $parent = $this.parents('.table-item'), 20652 pid = $parent.attr('data-pid'), 20653 seq = $parent.attr('data-seq'), 20654 t = $this.parent().find('.prev-value').text(), 20655 p_orig = $parent.find('.td-orig-price').find('.prev-value').text(), 20656 p_price = $parent.find('.td-price').find('.prev-value').text(), 20657 p_discount = $parent.find('.td-discount').find('.prev-value').text(), 20658 p_quantity = $parent.find('.td-quantity').find('.prev-value').text(); 20659 20660 if(type == 'quantity' && Number(uncomma(s)) > 9999) { 20661 alert('ìµë ì ë ¥ ìëì 9,999 ì ëë¤.'); 20662 s = addCommas('9999'); 20663 $this.val(s); 20664 } 20665 20666 $this.parents('.table-item').find('.close-button').removeClass('err not'); 20667 if(!checkUserEdit(uncomma(s),type) || s.length == 0) { 20668 $this.parent().find('.close-button').show().addClass('err'); 20669 // setTimeout(function() { $this.focus(); },0); 20670 return false; 20671 } 20672 var submit = false; 20673 if(type == 'org' || type == 'sale') { 20674 var orig = (type == 'org') ? parseFloat(uncomma(s)) : parseFloat(uncomma(p_orig)), 20675 price = (type == 'org') ? parseFloat(uncomma(p_price)) : parseFloat(uncomma(s)); 20676 if(orig < price) { 20677 $this.parent().find('.close-button').show().addClass('err not'); 20678 // setTimeout(function() { $this.focus(); },0); 20679 return false; 20680 } 20681 } 20682 20683 $('.close-button').hide(); 20684 $this.parent().find('.close-button').attr('data-val',s).removeClass('err not').hide(); 20685 $this.parent().find('.prev-value').text(s); 20686 $this.parents('.table-item').find('.edit-button').show(); 20687 $this.remove(); 20688 20689 if(s == t) return false; 20690 $.processON(); 20691 20692 var paramData = { sid : SID, pid : pid, seqs : [seq], type : type, mark : 'change', v : s, p : t, fx : 'disc', c : 's'}; 20693 if(type == 'quantity') paramData['t'] = $parent.find('.item-title-str').text(); 20694 20695 var route = (CONFIG_URL) ? '/_admin' : ''; 20696 $.ajax({ 20697 url: route + '/shopping/setProduct', 20698 type: 'post', 20699 data: paramData, 20700 async: true, 20701 cache: false, 20702 dataType: 'json', 20703 success: function(data) { 20704 $.processOFF(); 20705 if(typeof data.error != 'undefined' && data.error) { 20706 $p.find('.prev-value').text(t); 20707 alert(data.error); 20708 return false; 20709 } 20710 var page = getStorageItem('gallery-product-page'); 20711 $.gallery.show($.gallery.block_id,page,$.gallery.category); 20712 $.gallery.update = true; 20713 $.gallery.reset(); 20714 var cmd = ''; 20715 switch(type) { 20716 case "org": cmd = "org-price"; break; 20717 case "sale": cmd = "sale-price"; break; 20718 case "disc": cmd = "disc-price"; break; 20719 } 20720 if(cmd) setLogs('ELEM','product.'+cmd +'.modify','modify','ELEM','product-manager','el'); 20721 }, 20722 error: function(request,status,error) { 20723 $.processOFF(); 20724 alert('code:'+request.status+'\n'+'message:'+request.responseText+'\n'+'error:'+error); 20725 return false;
20726 } 20727 }); 20728 }); 20729 $(document).on('keyup','#user-edit',function(e) { 20730 if(e.key === 'Enter') { 20731 $(this).parents('.table-item').find('.close-button').removeClass('err not'); 20732 $(this).blur(); 20733 } 20734 }); 20735 $(document).on('click','#section-top-menu .product-manager', function(e) { 20736 clearLocalStorage(); 20737 $.gallery.show('',1); 20738 }); 20739 $(window).resize(function(e) { 20740 if($('.gallery-items').length == 0) return; 20741 shoppingGalleryResize(); 20742 // resizeGalleryModal(); 20743 }); 20744 $(document).on('click','.product-gallery-list-toggle',function(e) { 20745 var $list = $('.product-gallery-list'), 20746 $category = $('.gallery-category'), 20747 $more = $('.gallery-items-loadmore'), 20748 $items = $('.gallery-items'), 20749 $toggle = $('.product-gallery-list-toggle'), 20750 $pagination = $('.pagination-wrap'), 20751 $filter = $('.gallery-list-filter'), 20752 $name = $('.selected-gallery-name'), 20753 $lux_filter = $('.shop-filter-header'), 20754 svg_open = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-chevron-right" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z"/></svg>', 20755 svg_close = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-chevron-left" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M11.354 1.646a.5.5 0 0 1 0 .708L5.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0"/></svg>'; 20756 $toggle.toggleClass('open'); 20757 $list.toggleClass('open'); 20758 $category.toggleClass('open'); 20759 $more.toggleClass('open'); 20760 $items.toggleClass('open'); 20761 $pagination.toggleClass('open'); 20762 $filter.toggleClass('open'); 20763 $name.toggleClass('open'); 20764 $lux_filter.toggleClass('open'); 20765 if($toggle.hasClass('open')) { 20766 $toggle.html(svg_open); 20767 } else { 20768 $toggle.html(svg_close); 20769 } 20770 20771 ($('.product-gallery-list-toggle').hasClass('open')) ? 20772 window.localStorage.setItem('product-gallery-closed',false): 20773 window.localStorage.setItem('product-gallery-closed',true); 20774 }); 20775 $(document).bind('cut', '.gallery-modal', function(e) { 20776 if($('.cl-change-badge-design').length > 0) return; 20777 $.gallery.move = $.gallery.seqs; 20778 $.gallery.seqs = []; 20779 $.each($.gallery.move, function(i,v) { 20780 $('.gallery-items .item[data-seq="' + v + '"]').removeClass('copy').addClass('move'); 20781 $('.gallery-toolbar.mod-gallery').remove(); 20782 }); 20783 }); 20784 $(document).bind('copy', '.gallery-modal', function(e) { 20785 if($.gallery.block_id == -1 || $('.cl-common-modal').length) return; 20786 if($('.cl-change-badge-design').length > 0) return; 20787 $.gallery.copy = $.gallery.seqs; 20788 $.gallery.seqs = []; 20789 $.each($.gallery.copy, function(i,v) { 20790 $('.gallery-items .item[data-seq="' + v + '"]').removeClass('move').addClass('copy'); 20791 $('.gallery-toolbar.mod-gallery').remove(); 20792 20793 $('.table-item .td-check input[type="checkbox"]').prop('checked',false); 20794 $('.table-item').removeClass('ui-selected return'); 20795 $('.table-toolbar .toolbar-cmd').addClass('hide'); 20796 $('.table-toolbar .toolbar-cmd i[data-glseq]').attr('data-glseq',''); 20797 $('.table-toolbar .toolbar-cmd i[data-cmd="link"]').attr('data-glink','').attr('data-glink-target',''); 20798 $('.table-toolbar .toolbar-cmd i[data-cmd="visible"]').attr('data-visible','0').text($.lang[LANG]['editor.gallery.icon.visible.off']); 20799 $('.gallery-toolbar').removeClass('hide_col'); 20800 $('.gallery-toolbar').addClass('hide'); 20801 $('.gallery-items .item-header').removeClass('hide');
20802 $('.check-all').prop('checked',false); 20803 $.toast({'title' : ($.gallery.copy).length + 'ê°ì ë°ì´í°ê° ë³µì¬ ëììµëë¤'}); 20804 }); 20805 }); 20806 $(document).bind('paste', '.gallery-modal', function(e) { 20807 if($('.gallery-modal').length == 0 || $('.galleryController').length || $('.prod-modal').length || $('.cl-product-setting').length) return; 20808 if($('.edit-link-Content').length) return; 20809 if($('.cl-change-badge-design').length > 0) return; 20810 20811 if(($.gallery.copy).length) $.gallery.cp(); 20812 if(($.gallery.move).length) $.gallery.mv(); 20813 }); 20814 $(document).bind('keydown', 'ctrl+a', function(e) { 20815 if( e.ctrlKey && 20816 !$(e.target).is('input:not([type="checkbox"])') && 20817 !$(e.target).is('textarea') && 20818 !$(e.target).is('.pace-disable.modal-open') && 20819 $('.prod-modal').length == 0 && 20820 $('.galleryController').length == 0 && 20821 $('.cl-category-modal.category-modal').length == 0 20822 ) { 20823 if(e.keyCode == 65 || e.keyCode == 85) { 20824 $.gallery.seqs = []; 20825 20826 var item_selector = ($('.table-item').length) ? '.table-item' : '.gallery-items .item', 20827 visible_button = false; 20828 $(item_selector).find('.td-check input[type="checkbox"]').prop('checked',true); 20829 $(item_selector).addClass('ui-selected'); 20830 $.each($(item_selector), function(i,v) { 20831 $.gallery.seqs.push($(this).attr('data-seq')); 20832 if($(this).attr('data-out-datetime') == "1") visible_button = true; 20833 }); 20834 20835 if(item_selector == '.table-item') { 20836 var firstItem = $('.gallery-items '+item_selector+'.ui-selected').eq(0), 20837 first_seq = firstItem.attr('data-seq'), 20838 link = firstItem.attr('data-link'), 20839 target = firstItem.attr('data-target'), 20840 visible = firstItem.attr('data-visible'), 20841 vstr = (visible == '1') ? $.lang[LANG]['editor.gallery.icon.visible.on'] : $.lang[LANG]['editor.gallery.icon.visible.off']; 20842 20843 if(visible_button) { 20844 $('.table-toolbar .toolbar-cmd.toolbar-visible').addClass('disabled'); 20845 } else $('.table-toolbar .toolbar-cmd.toolbar-visible').removeClass('disabled'); 20846 if($.gallery.block_id == -1) { 20847 $('.table-toolbar .toolbar-cmd.toolbar-copy').addClass('disabled'); 20848 } 20849 $('.table-toolbar .toolbar-cmd').removeClass('hide'); 20850 $('.table-toolbar .toolbar-cmd i[data-glseq]').attr('data-glseq',first_seq); 20851 $('.table-toolbar .toolbar-cmd i[data-cmd="link"]').attr('data-glink',link).attr('data-glink-target',target); 20852 $('.table-toolbar .toolbar-cmd i[data-cmd="visible"]').attr('data-visible',visible).text(vstr); 20853 $('.gallery-toolbar').addClass('hide_col'); 20854 $('.check-all').prop('checked',true); 20855 $.gallery.setNumber(); 20856 $('.gallery-toolbar').removeClass('hide'); 20857 $('.gallery-items .item-header').addClass('hide'); 20858 stickyToolbar(); 20859 } else { 20860 $.gallery.toolbar(); 20861 stickyToolbar(); 20862 } 20863 } 20864 } 20865 }); 20866 $(document).on('click','.gallery-category > .category-text', function(e) { 20867 var s = $(this).text().trim(), 20868 pid = $('.gallery-modal').attr('data-pid'); 20869 $.gallery.show(pid,1,s); 20870 }); 20871 $(document).on('click', '.gallery-modal', function(e) { 20872 $('.table-item-status').hide(); 20873 $('.status-change').removeClass('open'); 20874 $(this).find('.gallery-toolbar.mod-gallery').remove(); 20875 if($.gallery.mode == 'shopping') { 20876 if(typeof e.target.className != 'object') { 20877 if(e.target.className.indexOf('ui-selectable') === -1) { 20878 $.gallery.seqs = []; 20879 $('.gallery-items .table-item > div').removeClass('hide-text'); 20880 $('.gallery-items .table-item input').prop('checked',fal
20880se); 20881 $('.gallery-items .check-all').prop('checked',false); 20882 $('.gallery-items .table-item').removeClass('ui-selected return'); 20883 $('.table-toolbar > li').removeClass('open'); 20884 $('.table-toolbar .toolbar-cmd').addClass('hide'); 20885 $('.table-toolbar .toolbar-cmd i[data-glseq]').attr('data-glseq',''); 20886 $('.table-toolbar .toolbar-cmd i[data-cmd="link"]').attr('data-glink','').attr('data-glink-target',''); 20887 $('.table-toolbar .toolbar-cmd i[data-cmd="visible"]').attr('data-visible','0').text($.lang[LANG]['editor.gallery.icon.visible.off']); 20888 $('.gallery-toolbar').removeClass('hide_col'); 20889 $('.col-check > input[type="checkbox"]').prop('checked',false); 20890 $('.gallery-toolbar').addClass('hide'); 20891 $('.gallery-items .item-header').removeClass('hide'); 20892 } 20893 } 20894 } else { 20895 if(typeof e.target.className == 'string' && e.target.className.indexOf('item') === -1) { 20896 $.gallery.seqs = []; 20897 $('.gallery-items .item').removeClass('ui-selected return'); 20898 $('.gallery-toolbar').empty(); 20899 } else { 20900 } 20901 } 20902 $('.toolbar-sort').removeClass('open'); 20903 $('.gallery-view-count').removeClass('open').find('.view-submenu').hide(); 20904 // $('.table-toolbar > li').addClass('disabled').removeClass('open'); 20905 $('.gallery-blocks .btn-group').removeClass('open'); 20906 }); 20907 $(document).on('mousemove', '.gallery-modal', function(e) { 20908 if($(".item-title").is(':focus') || clicking === false) return; 20909 if($('.gallery-modal .clone-item').length) { 20910 $('.gallery-modal .clone-item').css({ 20911 'left' : e.pageX+10, 20912 'top' : e.pageY+10 20913 }).attr('data-count',($.gallery.seqs).length).find('input').remove(); 20914 if(($.gallery.seqs).length >1) $('.gallery-modal .clone-item').addClass('multi'); 20915 $('.gallery-items .table-item').removeClass('prev last'); 20916 if(window.innerHeight-80 < e.pageY) $('.gallery-modal').scrollTop($('.gallery-modal').scrollTop() + 30); 20917 if(e.pageY < 80) $('.gallery-modal').scrollTop($('.gallery-modal').scrollTop() - 30); 20918 } 20919 if($('.ui-selectable-helper').length == 0) return; 20920 if(e.target.className.match(/(gallery-items ui-selectable|item-ctrl|img-responsive|ui-selected|ui-selectee|item-title|table-item|td-handle|item-handle|td-check|td-input|td-check|td-number|td-title|td-edit|td-img|info-link|td-edut|td-category|td-price|td-quantity)/)) { 20921 $('.gallery-modal, .gallery-items-loadmore, .gallery-category, .gallery-category li, .checkbox label, .gallery-toolbar .toolbar li, .btn, .gallery-button li').removeClass('not-allowed'); 20922 } else { 20923 $('.gallery-modal, .gallery-items-loadmore, .gallery-category, .gallery-category li, .checkbox label, .gallery-toolbar .toolbar li, .btn, .gallery-button li').addClass('not-allowed'); 20924 } 20925 }).on('mouseup', function(e) { 20926 if($('.gallery-modal .clone-item').length) { 20927 $('.gallery-modal .clone-item').remove(); 20928 $('.gallery-items .item').removeClass('prev last drag'); 20929 $('.gallery-items .table-item').removeClass('prev last drag'); 20930 clicking = false; 20931 } 20932 // $('.gallery-items').selectable('enable'); 20933 $('.gallery-modal, .gallery-items-loadmore, .gallery-category, .gallery-category li, .checkbox label, .gallery-toolbar .toolbar li, .btn, .gallery-button li').removeClass('not-allowed'); 20934 stickyToolbar(); 20935 }); 20936 $(document).on('mousedown','.gallery-items',function(e) { 20937 if(typeof e.target.className == 'string' && typeof e.target.className != 'undefined' && e.target.className.indexOf('gallery-items') > -1) { 20938 $.each($('.item-title'), function(i,v) { 20939 if($(this).is(':focus')) { 20940 $(this).blur(); 20941 } 20942 }); 20943 } 20944 }); 20945 $(document).on('mouseup','.gallery-items',function(e) { 20946 $('.table-item-status').hide(); 20947 $('.status-change').removeClass('open'); 20948 var group = ($('.table-item').length) ? '.table-item' : '.gallery-items .item'; 20949 if($(group + '.ui-selected').length == 0 && $(group).length) { 20950 if($.gallery.mode == 'shopping') { 20951 $('.gallery-items .table-item').removeClass('ui-selected return'); 20952 $('.table-toolbar > li').removeClass('open').find('.item-submenu').hide(); 20953 $('.gallery-view-count').removeClass('open').find('.view-submenu').hide(); 20954 $('.gallery-items .table-item > div').removeClass('hide-text'); 20955 $('.gallery-items .table-item input').prop('checked',fal
20955se); 20956 $('.table-toolbar .toolbar-cmd').addClass('hide'); 20957 $('.table-toolbar .toolbar-cmd i[data-glseq]').attr('data-glseq',''); 20958 $('.table-toolbar .toolbar-cmd i[data-cmd="link"]').attr('data-glink','').attr('data-glink-target',''); 20959 $('.table-toolbar .toolbar-cmd i[data-cmd="visible"]').attr('data-visible','0').text($.lang[LANG]['editor.gallery.icon.visible.off']); 20960 $('.gallery-toolbar').removeClass('hide_col'); 20961 $('.col-check > input[type="checkbox"]').prop('checked',false); 20962 $('.gallery-toolbar').addClass('hide'); 20963 $('.gallery-items .item-header').removeClass('hide'); 20964 } else { 20965 $.gallery.seqs = []; 20966 $('.gallery-items .item').removeClass('ui-selected return'); 20967 $('.gallery-toolbar').empty(); 20968 $('.gallery-toolbar').addClass('hide'); 20969 $('.gallery-items .item-header').removeClass('hide'); 20970 } 20971 } 20972 $('.ui-selectable-helper').removeClass('hide'); 20973 // $(".gallery-items").selectable("enable"); 20974 if($.gallery.seqs.length && ($('.gallery-items .item').hasClass('prev') || $('.gallery-items .item').hasClass('last'))) { 20975 if($('.gallery-items .item.last').length) { 20976 if($('.gallery-items .item.last').next().length) { 20977 $.gallery.drag = $('.gallery-items .item.last').next().attr('data-seq'); 20978 } else { 20979 $.gallery.drag = $('.gallery-items .item.last').attr('data-seq'); 20980 $.gallery.last = '-1'; 20981 } 20982 } else if($('.gallery-items .item.prev').length) { 20983 $.gallery.drag = $('.gallery-items .item.prev').attr('data-seq'); 20984 } 20985 $('.gallery-modal .clone-item').remove(); 20986 $('.gallery-items .item').removeClass('prev drag last'); 20987 20988 $.gallery.move = $.gallery.seqs; 20989 $.gallery.mv(); 20990 } 20991 if(typeof e.target.className == 'string' && e.target.className.indexOf('gallery-items') > -1) { 20992 $.each($('.item-title'), function(i,v) { 20993 if($(this).is(':focus')) { 20994 $(this).blur(); 20995 } 20996 }); 20997 } 20998 }); 20999 var isDragging = false; 21000 var startingPos = []; 21001 $(document).on('mousedown','.gallery-items .table-item',function(e) { 21002 isDragging = false; 21003 clicking = true; 21004 startingPos = [e.pageX, e.pageY]; 21005 if(e.shiftKey) { 21006 var seq_start = $('.gallery-items .table-item[data-seq="' + $.gallery.seqs[0] + '"]').index(), 21007 seq_end = $(this).index(); 21008 $.gallery.seqs = []; 21009 $('.gallery-items .item').removeClass('ui-selected return'); 21010 21011 // header, sticky ìì ì¶ê°ë¡ -2 21012 seq_start = seq_start - 2; 21013 seq_end = seq_end - 2; 21014 var start = 0, end = 0; 21015 if(seq_start<seq_end) { 21016 for(var i=seq_start; i<=seq_end; i++) { 21017 var $shifted_item = $('.gallery-items .table-item'); 21018 $shifted_item.eq(i).addClass('ui-selected'); 21019 // $.gallery.seqs.push($shifted_item.eq(i).attr('data-seq')); 21020 } 21021 } else { 21022 for(var i=seq_start; i>=seq_end; i--) { 21023 var $shifted_item = $('.gallery-items .table-item'); 21024 $shifted_item.eq(i).addClass('ui-selected'); 21025 // $.gallery.seqs.push($shifted_item.eq(i).attr('data-seq')); 21026 } 21027 } 21028 $('.gallery-toolbar').removeClass('hide'); 21029 $('.gallery-items .item-header').addClass('hide'); 21030 stickyToolbar(); 21031 } 21032 }); 21033 $(document).on('mousedown','.gallery-items .item',function(e) { 21034 if($('.item-title').is(':focus')) return; 21035 isDragging = false;
21036 clicking = true; 21037 startingPos = [e.pageX, e.pageY]; 21038 $('.gallery-modal .clone-item').remove(); 21039 if(e.target.className.indexOf('item') === 0) { 21040 $(".ui-selectable-helper").addClass('hide'); 21041 $(".gallery-items").selectable("disable"); 21042 } 21043 21044 $('.gallery-blocks .btn-group').removeClass('open'); 21045 var key = e.keyCode || e.which, 21046 seq = $(this).attr('data-seq'), 21047 seq_idx = ($.gallery.seqs).indexOf(seq); 21048 21049 if(e.ctrlKey) { 21050 if(seq_idx > -1) { 21051 $(this).removeClass('ui-selected return'); 21052 // ($.gallery.seqs).splice(seq_idx,1); 21053 } else { 21054 $(this).addClass('ui-selected'); 21055 // $.gallery.seqs.push(seq); 21056 } 21057 $.gallery.selected(); 21058 stickyToolbar(); 21059 } else if(e.shiftKey) { 21060 if(($.gallery.seqs).length > 0) { 21061 var seq_start = $('.gallery-items .item[data-seq="' + $.gallery.seqs[0] + '"]').index(), 21062 seq_end = $(this).index(); 21063 $.gallery.seqs = []; 21064 $('.gallery-items .item').removeClass('ui-selected return'); 21065 // console.log(seq_start,seq_end); 21066 // header, sticky ìì ì¶ê°ë¡ -2 21067 seq_start = seq_start - 1; 21068 seq_end = seq_end - 1; 21069 var start = 0, end = 0; 21070 if(seq_start<seq_end) { 21071 for(var i=seq_start; i<=seq_end; i++) { 21072 var $shifted_item = $('.gallery-items .item'); 21073 $shifted_item.eq(i).addClass('ui-selected'); 21074 // $.gallery.seqs.push($shifted_item.eq(i).attr('data-seq')); 21075 } 21076 } else { 21077 for(var i=seq_start; i>=seq_end; i--) { 21078 var $shifted_item = $('.gallery-items .item'); 21079 $shifted_item.eq(i).addClass('ui-selected'); 21080 // $.gallery.seqs.push($shifted_item.eq(i).attr('data-seq')); 21081 } 21082 } 21083 $.gallery.selected(); 21084 stickyToolbar(); 21085 } 21086 } else { 21087 if(!$(this).hasClass('ui-selected')) { 21088 $.gallery.seqs = []; 21089 $.gallery.seqs.push(seq); 21090 $('.gallery-items .item').removeClass('ui-selected return'); 21091 // $(this).parent().removeClass('move').removeClass('copy'); 21092 $(this).addClass('ui-selected'); 21093 stickyToolbar(); 21094 21095 // cut, copy remove 21096 var i = ($.gallery.copy).indexOf(seq); 21097 if(i !== -1) ($.gallery.copy).splice(i,1); 21098 21099 var i = ($.gallery.move).indexOf(seq); 21100 if(i !== -1) ($.gallery.move).splice(i,1); 21101 } 21102 } 21103 }); 21104 $(document).on('mousedown','.gallery-items .td-handle',function(e) { 21105 // if($('.gallery-items .table-item.ui-selected').length == 0) { 21106 if($(this).parent().hasClass('ui-selected') == false) { 21107 $(this).parent().addClass('ui-selected').find('.td-check input[type="checkbox"]').prop('checked',true); 21108 $.gallery.seqs.push($(this).parent().attr('data-seq')); 21109 } 21110 }); 21111 $(document).on('mousemove','.gallery-items .table-item',function(e) { 21112 if(clicking === false) return; 21113 $('.gallery-items .table-item').removeClass('prev'); 21114 21115 if($('.gallery-modal .clone-item').length) { 21116 var $clone = $('.gallery-modal .clone-item'); 21117 $clone.css({ 21118 'position' : 'fixed', 21119 'cursor' : 'move', 21120 'z-index' : '1090' 21121 }); 21122 $clone.css({ 21123 'left' : e.pageX+5, 21124 'top' : e.pageY-25 21125 }).attr('data-count',($.gallery.seqs).length).find('input').remove(); 21126 if(($.gallery.seqs).length >1) $clone.addClass('multi'); 21127 21128 var this_top = e.pageY - $(this).offset().top; 21129 if($(this).is(':last-child') && this_top > 45) { 21130 $(this).removeClass('prev').addClass('last'); 21131 } else $(this).removeClass('last').addClass('prev'); 21132 if(window.innerHeight-80 < e.pageY) $('.gallery-modal').scrollTop($('.gallery-modal').scrollTop() + 30); 21133 if(e.pageY < 80) $('.gallery-modal').scrollTop($('.gallery-modal').scrollTop() - 30); 21134 e.stopPropagation(); 21135 } 21136 }); 21137 $(document).on('mouseenter','.gallery-items .table-item',function(e) { 21138 if($('#user-edit').length == 0) { 21139 $('.edit-button').hide(); 21140 if($(this).hasClass('yet')) return; 21141 $(this).find('.edit-button').show(); 21142 } else $('.edit-button').hide(); 21143 }).on('mouseleave','.gallery-items .table-item',function(e) { 21144 $('.edit-button').hide(); 21145 }); 21146 $(document).on('mouseenter','.gallery-items .td-category', function(e) { 21147 var cate_arr = $(this).text().trim().split(','); 21148 if(cate_arr.length < 2) return; 21149 21150 var cate_str = ''; 21151 $.each(cate_arr, function(i,v) { 21152 cate_str += '<li>' + v.trim() + '</li>'; 21153 }); 21154 21155 var gcate_tooltip_place = ($('.gallery-modal').height() <= $(this).closest('.table-item').offset().top + $(this).closest('.table-item').outerHeight()) ? 'top' : 'bottom'; 21156 var gcate_tooltip_css = (gcate_tooltip_place == 'to
21156p') ? { 21157 'top': (Math.floor($('.gallery-modal').scrollTop() + $(this).offset().top - (100 + ((cate_arr.length-2) * 20)))) + 'px', 21158 'left': (Math.floor($(this).offset().left) -30) + 'px', 21159 } : { 21160 'top': (Math.floor($('.gallery-modal').scrollTop() + $(this).offset().top + $(this).outerHeight()) - 7) + 'px', 21161 'left': (Math.floor($(this).offset().left) -30) + 'px', 21162 } 21163 21164 $('.gcategory-tooltip ul').empty().html(cate_str); 21165 $('.gcategory-tooltip').attr('data-place',gcate_tooltip_place).css(gcate_tooltip_css).show(); 21166 }); 21167 $(document).on('mouseleave', '.gallery-items .td-category', function(e) { 21168 if($('.gcategory-tooltip').css('display') === 'none') return; 21169 $('.gcategory-tooltip').hide().removeAttr('style'); 21170 $('.gcategory-tooltip ul').empty(); 21171 }); 21172 $(document).on('mousemove','.gallery-items .td-handle',function(e) { 21173 if($('.gallery-modal').attr('data-pid') == undefined) { 21174 return false; 21175 } 21176 if(clicking === false || $('.gallery-items .table-item.ui-selected').length == 0) return; 21177 $('.td-edit .item-edit').css('display','none'); 21178 if ((e.pageX < startingPos[0]-10 || e.pageX > startingPos[0]+10) || 21179 (e.pageY < startingPos[1]-10 || e.pageY > startingPos[1]+10)) { 21180 $('.gallery-items .table-item.ui-selected').addClass('drag'); 21181 if($('.gallery-modal .clone-item').length == 0 && !LUX) { 21182 var $clone = $(this).parent().clone(); 21183 $clone.css({ 21184 'position' : 'fixed', 21185 'cursor' : 'move', 21186 'z-index' : '1090' 21187 }).addClass('clone-item').attr('data-count',($.gallery.seqs).length).find('input').remove(); 21188 $('.gallery-modal').append($clone); 21189 21190 $clone.css({ 21191 'left' : e.pageX+10, 21192 'top' : e.pageY+10 21193 }); 21194 if(($.gallery.seqs).length >1) $clone.addClass('multi'); 21195 } 21196 isDragging = true; 21197 // var parentOffset = $(this).parent().offset(); 21198 // var relX = e.pageX - parentOffset.left; 21199 // var relY = e.pageY - parentOffset.top; 21200 // $('.gallery-items .item').removeClass('prev last'); 21201 // var this_top = $(this).position().top, 21202 // next_top = ($(this).next().length) ? $(this).next().position() : -1; 21203 // console.log(parentOffset); 21204 // if(this_top == next_top) { 21205 // (relX - $(this).position().left < 62) ? $(this).addClass('prev') : $(this).next().addClass('prev'); 21206 // } else { 21207 // (relX - $(this).position().left < 62) ? $(this).addClass('prev') : $(this).addClass('last'); 21208 // } 21209 } 21210 }); 21211 $(document).on('mousemove','.gallery-items .item',function(e) { 21212 if(clicking === false || $('.item-title').is(':focus')) return; 21213 if ((e.pageX < startingPos[0]-10 || e.pageX > startingPos[0]+10) || 21214 (e.pageY < startingPos[1]-10 || e.pageY > startingPos[1]+10)) { 21215 $('.gallery-items .item.ui-selected').addClass('drag'); 21216 if($('.gallery-modal .clone-item').length == 0 && !LUX) { 21217 var $clone = $(this).clone(); 21218 $clone.css({ 21219 'position' : 'fixed' 21220 }).addClass('clone-item').attr('data-count',($.gallery.seqs).length).find('input').remove(); 21221 $('.gallery-modal').append($clone); 21222 if(($.gallery.seqs).length >1) $clone.addClass('multi'); 21223 } 21224 isDragging = true; 21225 var parentOffset = $(this).parent().offset(); 21226 var relX = e.pageX - parentOffset.left; 21227 var relY = e.pageY - parentOffset.top; 21228 $('.gallery-items .item').removeClass('prev last'); 21229 var this_top = $(this).position().top, 21230 next_top = ($(this).next().length) ? $(this).next().position() : -1; 21231 if(this_top == next_top) { 21232 (relX - $(this).position().left < 62) ? $(this).addClass('prev') : $(this).next().addClass('prev'); 21233 } else { 21234 (relX - $(this).position().left < 62) ? $(this).addClass('prev') : $(this).addClass('last'); 21235 } 21236 } 21237 }); 21238 $(document).on('mouseup','.gallery-items .table-item',function(e) { 21239 clicking = false;
21240 if (isDragging) { 21241 if($.gallery.seqs.length && $('.gallery-modal .clone-item').length) { 21242 if($('.gallery-items .table-item.last').length) { 21243 if($('.gallery-items .table-item.last').next().length) { 21244 $.gallery.drag = $('.gallery-items .table-item.last').next().attr('data-seq'); 21245 } else { 21246 $.gallery.drag = $('.gallery-items .table-item.last').attr('data-seq'); 21247 $.gallery.last = '-1'; 21248 } 21249 } else if($('.gallery-items .table-item.prev').length) { 21250 $.gallery.drag = $('.gallery-items .table-item.prev').attr('data-seq'); 21251 } 21252 $('.gallery-modal .clone-table-item').remove(); 21253 $('.gallery-items .table-item').removeClass('prev drag last'); 21254 21255 $.gallery.move = $.gallery.seqs; 21256 $.gallery.mv(); 21257 } 21258 } else { 21259 $('.gallery-items .table-item.ui-selecting').removeClass('active').addClass('ui-selected'); 21260 $('.check-all').prop('checked',false); 21261 stickyToolbar(); 21262 } 21263 isDragging = false; 21264 startingPos = []; 21265 21266 var l = ($(this).index()%7 > 3) ? 'right' : '', 21267 mode = $('.gallery-add-items').attr('data-mode'); 21268 21269 if(typeof mode == 'undefined' || !mode) { 21270 alert('Undefined gallery mode'); 21271 return false; 21272 } 21273 $.gallery.setNumber(); 21274 $('.ui-selectable-helper').removeClass('hide'); 21275 if($('.gallery-modal').attr('data-pid') != undefined) { 21276 $('.gallery-items').selectable('enable'); 21277 } 21278 }); 21279 $(document).on('mouseup','.gallery-items .item',function(e) { 21280 e.preventDefault(); 21281 clicking = false; 21282 if (isDragging) { 21283 if($.gallery.seqs.length && $('.gallery-modal .clone-item').length) { 21284 if($('.gallery-items .item.last').length) { 21285 if($('.gallery-items .item.last').next().length) { 21286 $.gallery.drag = $('.gallery-items .item.last').next().attr('data-seq'); 21287 } else { 21288 $.gallery.drag = $('.gallery-items .item.last').attr('data-seq'); 21289 $.gallery.last = '-1'; 21290 } 21291 } else if($('.gallery-items .item.prev').length) { 21292 $.gallery.drag = $('.gallery-items .item.prev').attr('data-seq'); 21293 } 21294 $('.gallery-modal .clone-item').remove(); 21295 $('.gallery-items .item').removeClass('prev drag last'); 21296 21297 $.gallery.move = $.gallery.seqs; 21298 $.gallery.mv(); 21299 } 21300 } else { 21301 var parentOffset = $(this).parent().offset(), 21302 relX = e.pageX - parentOffset.left, 21303 relY = e.pageY - parentOffset.top; 21304 $('.gallery-items .item.ui-selecting').removeClass('active').addClass('ui-selected'); 21305 stickyToolbar(); 21306 } 21307 isDragging = false; 21308 startingPos = []; 21309 21310 var l = ($(this).index()%7 > 3) ? 'right' : '', 21311 mode = $('.gallery-add-items').attr('data-mode'); 21312 21313 if(typeof mode == 'undefined' || !mode) { 21314 alert('Undefined gallery mode'); 21315 return false; 21316 } 21317 // $.gallery.toolbar(); 21318 21319 $.gallery.setNumber(); 21320 $('.ui-selectable-helper').removeClass('hide'); 21321 $('.gallery-items').selectable('enable'); 21322 }); 21323 $(document).on('click','.toolbar-cmd.null', function(e) { 21324 e.stopPropagation(); 21325 $.gallery.seqs = []; 21326 $('.gallery-toolbar').addClass('hide'); 21327 $('.gallery-items .item-header').removeClass('hide'); 21328 setTimeout(()=> { 21329 $('.gallery-items .table-item input').prop('checked',fal
21329se); 21330 $('.gallery-items .table-item').removeClass('ui-selected ui-selecting'); 21331 },100); 21332 }); 21333 $(document).on('click','.gallery-controller',function(e) { 21334 $.gallery.show($.gallery.block_id); 21335 }); 21336 $(document).on('click','.gallery-all',function(e) { 21337 $.gallery.show($.gallery.block_id); 21338 }); 21339 $(document).on('click','.gallery-button .modal-close', function(e) { 21340 $.gallery.close(); 21341 }); 21342 $(document).on('click','.gallery-button .modal-save', function(e) { 21343 $.gallery.save(); 21344 }); 21345 $(document).on('keyup','.item-title', function(e) { 21346 if(e.keyCode == 13) $('#empty-text').focus().blur(); 21347 }); 21348 $(document).on('focus','.item-title', function(e) { 21349 $.gallery.seqs = []; 21350 var seq = $(this).parent().attr('data-seq'); 21351 $.gallery.seqs.push(seq); 21352 $('.gallery-items .item').removeClass('ui-selected'); 21353 $(this).parent().addClass('ui-selected'); 21354 }); 21355 $(document).on('mouseenter', '.gallery-items .item > img', function(e) { 21356 // e.stopPropagation(); 21357 $('.gallery-items .item .gallery-paste-icon').remove(); 21358 var s = '<div class="item-ctrl"></div>', 21359 $ctrl = $(s); 21360 if($(this).parent().find('.item-ctrl').length == 0) 21361 $(this).parent().append($ctrl); 21362 }); 21363 $(document).on('mouseleave', '.gallery-items .item', function(e) { 21364 $(this).find('.item-ctrl').remove(); 21365 $('.gallery-paste-icon').remove(); 21366 }); 21367 $(document).on('click','.gallery-items .item .gallery-paste-icon', function(e) { 21368 e.stopPropagation(); 21369 ($.gallery.seqs).push($(this).parents('.item').attr('data-seq')); 21370 if(($.gallery.copy).length) $.gallery.cp(); 21371 if(($.gallery.move).length) $.gallery.mv(); 21372 }); 21373 $(document).on('click', '.gallery-items .item input', function(e) { 21374 e.stopPropagation(); 21375 $('.gallery-toolbar.mod-gallery').remove(); 21376 }); 21377 $(document).on('keypress click', '.gallery-items .item .item-ctrl', function(e) { 21378 $('.gallery-blocks .btn-group').removeClass('open'); 21379 var key = e.keyCode || e.which, 21380 seq = $(this).parent().attr('data-seq'), 21381 seq_idx = ($.gallery.seqs).indexOf(seq); 21382 if(e.ctrlKey) { 21383 if(seq_idx > -1) { 21384 $(this).parents().removeClass('ui-selected'); 21385 ($.gallery.seqs).splice(seq_idx,1); 21386 } else { 21387 $(this).parent().addClass('ui-selected'); 21388 $.gallery.seqs.push(seq); 21389 } 21390 } else if(e.shiftKey) { 21391 if(($.gallery.seqs).length > 0) { 21392 var seq_start = $('.gallery-items .item[data-seq="' + $.gallery.seqs[0] + '"]').index(), 21393 seq_end = $(this).parent().index(); 21394 $.gallery.seqs = []; 21395 $('.gallery-items .item').removeClass('ui-selected'); 21396 // console.log(seq_start,seq_end); 21397 var start = 0, end = 0; 21398 if(seq_start<seq_end) { 21399 for(var i=seq_start; i<=seq_end; i++) { 21400 var $shifted_item = $('.gallery-items .item'); 21401 $shifted_item.eq(i).addClass('ui-selected'); 21402 $.gallery.seqs.push($shifted_item.eq(i).attr('data-seq')); 21403 } 21404 } else { 21405 for(var i=seq_start; i>=seq_end; i--) { 21406 var $shifted_item = $('.gallery-items .item'); 21407 $shifted_item.eq(i).addClass('ui-selected'); 21408 $.gallery.seqs.push($shifted_item.eq(i).attr('data-seq')); 21409 } 21410 } 21411 } 21412 } else { 21413 $.gallery.seqs = []; 21414 $.gallery.seqs.push(seq); 21415 $('.gallery-items .item').removeClass('ui-selected return'); 21416 // $(this).parent().removeClass('move').removeClass('copy'); 21417 $(this).parent().addClass('ui-selected'); 21418 21419 // cut, copy remove 21420 var i = ($.gallery.copy).indexOf(seq); 21421 if(i !== -1) ($.gallery.copy).splice(i,1); 21422 21423 var i = ($.gallery.move).indexOf(seq); 21424 if(i !== -1) ($.gallery.move).splice(i,1); 21425 } 21426 var l = ($(this).index()%7 > 3) ? 'right' : '', 21427 mode = $('.gallery-add-items').attr('data-mode'); 21428 21429 if(typeof mode == 'undefined' || !mode) { 21430 alert('Undefined gallery mode'); 21431 return false;
21432 } 21433 $(this).parents('.gallery-items').find('.toolbar.mod-gallery').remove(); 21434 // var str = '', cmd = ''; 21435 // if(($.gallery.move).length || ($.gallery.copy).length) { 21436 // str = 'ë¶ì¬ë£ê¸°'; cmd = 'paste'; 21437 // } else { 21438 // str = 'ìë¼ë´ê¸°'; cmd = 'move'; 21439 // } 21440 21441 var seq = $(this).parent().attr('data-seq'), 21442 pid = $(this).parent().attr('data-pid'), 21443 link = $(this).parent().attr('data-link'), 21444 target = $(this).parent().attr('data-target'), 21445 visible = $(this).parent().attr('data-visible'); 21446 21447 var vstr = (visible == '1') ? $.lang[LANG]["editor.gallery.icon.visible.on"] : $.lang[LANG]["editor.gallery.icon.visible.off"], 21448 vicon = (visible == '1') ? 'cl_icon_hide02' : 'cl_icon_show', 21449 edit_name = ($.gallery.mode == 'gallery') ? $.lang[LANG]['editor.block.gallery.item.edit.image'] : $.lang[LANG]['editor.block.gallery.item.edit']; 21450 var outDatetime = $(this).parent().attr('data-out-datetime'); 21451 if(outDatetime !== 'off') { 21452 visible = outDatetime; 21453 if(outDatetime == 1) vstr = $.lang[LANG]['editor.gallery.icon.visible.on']; 21454 } 21455 var s = '\ 21456 <ul>\ 21457 <li class="active gallery-item-edit">\ 21458 <i class="" data-glseq="' + seq + '" data-cmd="edit"></i>' + edit_name + '\ 21459 </li>\ 21460 '; 21461 s = s + '<li><i class="" data-glseq="' + seq + '" data-cmd="copy"></i>' + $.lang[LANG]['editor.gallery.icon.clone'] + '</li>'; 21462 21463 s = s + '<li class="toolbar-sort item-sort">' + $.lang[LANG]['editor.gallery.icon.order'] + ' <i class="fa fa-caret-down" aria-hidden="true" data-glseq="" data-cmd="item-sort"></i>\ 21464 <ul class="item-submenu">\ 21465 <li class="sort-top">' + $.lang[LANG]['editor.gallery.icon.order.front'] + '</li>\ 21466 <li class="sort-bottom">' + $.lang[LANG]['editor.gallery.icon.order.end'] + '</li>\ 21467 </ul>\ 21468 </li>'; 21469 s = s + '<li class="toolbar-category"><i class="" data-glseq="" data-cmd="category"></i>' + $.lang[LANG]['editor.block.gallery.category.change'] + ' <i class="fa fa-caret-down" aria-hidden="true"></i>'; 21470 s = s + '<ul class="item-submenu">' + $.gallery.cates + '</ul>'; 21471 s = s + '</li>'; 21472 21473 s = s + '\ 21474 <li><i class="" data-glseq="' + seq + '" data-glink="' + link + '" data-glink-target="' + target + '" data-cmd="link"></i>' + $.lang[LANG]['editor.gallery.icon.link'] + '</li>\ 21475 '; 21476 21477 s = s + '\ 21478 <li><i class="" data-glseq="' + seq + '" data-visible="' + visible + '" data-cmd="visible">' + vstr + '</i></li>\ 21479 <li><i class="" data-glseq="' + seq + '" data-cmd="delete"></i>' + $.lang[LANG]['editor.gallery.icon.delete'] + '</li>\ 21480 </ul>\ 21481 '; 21482 var $tool_back = $('<div class="toolbar mod-gallery ' + l + '">' + s + '</div>'); 21483 $(this).parents('.container').find('.gallery-toolbar').empty(); 21484 $(this).parents('.container').find('.gallery-toolbar').append($tool_back); 21485 21486 // $(this).parent().prev().append($tool_back); 21487 $.gallery.selected(); 21488 stickyToolbar(); 21489 $.gallery.setNumber(); 21490 }); 21491 $(document).on('click','.gallery-modal .check-all', function(e) { 21492 e.stopPropagation(); 21493 var check = $(this).prop('checked'), 21494 disabled = false, 21495 visible_button = false; 21496 if(check) { 21497 $('.table-item .td-check input[type="checkbox"]').prop('checked',true); 21498 $('.table-item').addClass('ui-selected'); 21499 $.each($('.table-item'), function(i,v) { 21500 if($.gallery.seqs.indexOf($(this).attr('data-seq')) == -1) $.gallery.seqs.push($(this).attr('data-seq')); 21501 }); 21502 21503 $.each($('.gallery-items .table-item.ui-selected'), function(i,v) { 21504 if($(this).attr('data-product') == "false") disabled = true; 21505 if($(this).attr('data-out-datetime') == "1") visible_button = true; 21506 }); 21507 var firstItem = $('.gallery-items .table-item.ui-selected').eq(0), 21508 first_seq = firstItem.attr('data-seq'), 21509 link = firstItem.attr('data-link'), 21510 target = firstItem.attr('data-target'), 21511 visible = firstItem.attr('data-visible'), 21512 vstr = (visible == '1') ? $.lang[LANG]['editor.gallery.icon.visible.on'] : $.lang[LANG]['editor.gallery.icon.visible.off']; 21513 if(visible_button) { 21514 $('.table-toolbar .toolbar-cmd.toolbar-visible').addClass('disabled'); 21515 } else $('.table-toolbar .toolbar-cmd.toolbar-visible').removeClass('disabled'); 21516 if($.gallery.block_id == -1) { 21517 $('.table-toolbar .toolbar-cmd.toolbar-copy').addClass('disabled'); 21518 } 21519 $('.table-toolbar .toolbar-cmd').removeClass('hide'); 21520 $('.table-toolbar .toolbar-cmd i[data-glseq]').attr('data-glseq',first_seq); 21521 $('.table-toolbar .toolbar-cmd i[data-cmd="link"]').attr('data-glink',link).attr('data-glink-target',target); 21522 $('.table-toolbar .toolbar-cmd i[data-cmd="visible"]').attr('data-visible',visible).text(vstr); 21523 $('.gallery-toolbar').addClass('hide_col'); 21524 $('.gallery-toolbar').removeClass('hide'); 21525 $('.gallery-items .item-header').addClass('hide'); 21526 $('.checkbox-cmd .check-all').prop('checked',true); 21527 stickyToolbar(); 21528 } else { 21529 $('.table-item .td-check input[type="checkbox"]').prop('checked',fal
21529se); 21530 $('.table-item').removeClass('ui-selected return'); 21531 $('.table-toolbar .toolbar-cmd').addClass('hide'); 21532 $('.table-toolbar .toolbar-cmd i[data-glseq]').attr('data-glseq',''); 21533 $('.table-toolbar .toolbar-cmd i[data-cmd="link"]').attr('data-glink','').attr('data-glink-target',''); 21534 $('.table-toolbar .toolbar-cmd i[data-cmd="visible"]').attr('data-visible','0').text($.lang[LANG]['editor.gallery.icon.visible.off']); 21535 $('.gallery-toolbar').removeClass('hide_col'); 21536 $('.gallery-toolbar').addClass('hide'); 21537 $('.gallery-items .item-header').removeClass('hide'); 21538 $('.check-all').prop('checked',false); 21539 $.gallery.seqs = []; 21540 } 21541 (disabled) ? $('.product-cmd').addClass('disabled') : $('.product-cmd').removeClass('disabled'); 21542 if($('.gallery-modal').attr('data-pid') == undefined) { 21543 $('.toolbar-sort.item-sort').addClass('disabled'); 21544 } 21545 21546 $.gallery.setNumber(); 21547 }); 21548 $(document).on('click','.gallery-view-count', function(e) { 21549 e.stopPropagation(); 21550 $(this).toggleClass('open'); 21551 if($(this).hasClass('open')) { 21552 $(this).find('.view-submenu').show(); 21553 } else $(this).find('.view-submenu').hide(); 21554 }); 21555 $(document).on('click','.gallery-view-count li', function(e) { 21556 $('.gallery-view-count li').removeClass('active'); 21557 $(this).addClass('active'); 21558 }); 21559 $(document).on('click','.gallery-move:not(.disabled)', function(e) { 21560 $('.gallery-move-list').removeClass('not-selected'); 21561 $('.move-alert').text(''); 21562 $('.gallery-move').removeClass('active'); 21563 $(this).toggleClass('active'); 21564 21565 var block_id = $(this).attr('data-gallery-id'), 21566 first_title = ''; 21567 $.gallery.ex_id = []; 21568 21569 // ì íë ìí ê°ì ê°¤ë¬ë¦¬ ì´ëì ì²ë¦¬ 21570 $.each($.gallery.move, function(i,v) { 21571 var $product = $('.table-item[data-seq="' + v + '"]'), 21572 product_pid = $product.attr('data-pid'), 21573 product_title = $product.find('.td-title .item-title-str').text(); 21574 if(block_id == product_pid) { 21575 if(first_title == '') first_title = "'" + product_title + "'"; 21576 $.gallery.ex_id.push(v); 21577 } 21578 }); 21579 if($.gallery.ex_id.length) { 21580 $('.move-alert').append('<p>' + first_title + (($.gallery.ex_id.length == 1) ? ' ìíì<br>ì´ë¯¸ ê°¤ë¬ë¦¬ì ì¡´ì¬íì¬ ì´ëìì ì ì¸ë©ëë¤.' : ' ì¸ ' + $.gallery.ex_id.length + 'ê° ìíë¤ì<br>ì´ë¯¸ ê°¤ë¬ë¦¬ì ì¡´ì¬íì¬ ì´ëìì ì ì¸ë©ëë¤.</p>')); 21581 } 21582 ($.gallery.ex_id.length == $.gallery.move.length) ? 21583 $('.ok-button-dialog').addClass('disabled') : 21584 $('.ok-button-dialog').removeClass('disabled'); 21585 }); 21586 $(document).on('click', '.gallery-modal .toolbar li', function(e) { 21587 var check_disabled = ($(this).hasClass('product-cmd') && ($(this).hasClass('disabled') || $(this).hasClass('no_price'))) ? true : false; 21588 21589 if(check_disabled) { 21590 var modal_str = ($(this).hasClass('disabled')) ? 'ìí ì 보를 ì ë ¥í íì ì´ì© ê°ë¥í©ëë¤.<br>ìí ì¤ì ì ìë£í´ì£¼ì¸ì.' : 'ì ê°ê° 1ì ì´ìì´ì´ì¼ë§ [í ì¸] ë° [í매ê°] ì¤ì ì´ ê°ë¥í©ëë¤'; 21591 $(this).showModalFlat($.lang[LANG]["config.information"], modal_str, true, false, '', 'ok','','cl-p130 cl-cmmodal cl-s-btn w560 cl-p0 cl-okbtn-pbt70'); 21592 return false; 21593 } 21594 21595 if($(this).hasClass('toolbar-visible') && $(this).hasClass('disabled')) { 21596 $(this).showModalFlat($.lang[LANG]["config.information"], 'í매ìì /íë§¤ì¢ ë£ì¸ 기ê°íì í매 ìíì ì¨ê¹/ë³´ì´ê¸° ìµì ì ì´ì©í ì ììµëë¤.', true, false, '', 'ok','','cl-p130 cl-cmmodal cl-s-btn w560 cl-p0 cl-okbtn-pbt70'); 21597 return false;
21598 } 21599 21600 if($(this).hasClass('toolbar-copy') && $(this).hasClass('disabled')) { 21601 $(this).showModalFlat($.lang[LANG]["config.information"], 'ìí ë³µì ë íë©´ ì¢ì¸¡ì ê°¤ë¬ë¦¬ 목ë¡ìì ê°¤ë¬ë¦¬ ì í í ì¬ì© ê°ë¥í©ëë¤.', true, false, '', 'ok','','cl-p130 cl-cmmodal cl-s-btn w560 cl-p0 cl-okbtn-pbt70'); 21602 return false; 21603 } 21604 21605 if($(this).hasClass('toolbar-sort') && $(this).hasClass('disabled')) { 21606 $(this).showModalFlat($.lang[LANG]["config.information"], 'ìí ìì ë³ê²½ì íë©´ ì¢ì¸¡ì ê°¤ë¬ë¦¬ 목ë¡ìì ê°¤ë¬ë¦¬ ì í í ì¬ì© ê°ë¥í©ëë¤.', true, false, '', 'ok','','cl-p130 cl-cmmodal cl-s-btn w560 cl-p0 cl-okbtn-pbt70'); 21607 return false; 21608 } 21609 21610 $('.ui-selectable-helper').remove(); 21611 e.stopPropagation(); 21612 var cmd = $(this).find('i').attr('data-cmd'), 21613 mode = $('.gallery-add-items').attr('data-mode'), 21614 seq = $(this).find('i').attr('data-glseq'), 21615 sub = ($(this).parent().hasClass('item-submenu')) ? true : false, 21616 $this = $(this); 21617 21618 if(typeof cmd == 'undefined' && sub == false && !$(this).hasClass('disabled')) { 21619 $('.item-submenu').hide(); 21620 $('.submenu').removeClass('open'); 21621 var $submenu = $(this).find('.item-submenu'), 21622 display = $submenu.css('display'); 21623 (display == 'none') ? $submenu.css('display','block') : $submenu.css('display','none'); 21624 return; 21625 } 21626 if($(this).hasClass('disabled')) { 21627 if($(this).hasClass('gallery-item-edit')) { 21628 $(this).showModalFlat($.lang[LANG]["config.information"], $.lang[LANG]['editor.gallery.select.items.info'], true, false, '', 'ok','','cl-p130 cl-cmmodal cl-s-btn w560 cl-p0 cl-okbtn-pbt70'); 21629 } 21630 return false; 21631 } 21632 if(($.gallery.seqs).length == 0 && cmd != 'checkall') { 21633 $(this).showModalFlat($.lang[LANG]["config.information"], $.lang[LANG]["editor.gallery.select.item"], true, false,'','ok', '', 'cl-p130 cl-cmmodal cl-s-btn w560 cl-p0 cl-okbtn-pbt70'); 21634 return false; 21635 } 21636 switch(cmd) { 21637 case "item-sort": 21638 $(this).toggleClass('open'); 21639 $('.item-submenu').hide(); 21640 if($(this).hasClass('open')) { 21641 $(this).find('.item-submenu').show(); 21642 } 21643 $('.toolbar-category').removeClass('open'); 21644 $('.toolbar-category .item-submenu').hide(); 21645 break; 21646 case "category": 21647 $(this).toggleClass('open'); 21648 $('.item-submenu').hide(); 21649 $('.toolbar-category .item-submenu li').removeClass('active'); 21650 if($(this).hasClass('open')) { 21651 $(this).find('.item-submenu').show(); 21652 } 21653 $('.toolbar-sort').removeClass('open'); 21654 $('.toolbar-sort .item-submenu').hide(); 21655 if(($.gallery.seqs).length == 1) { 21656 var s = ($('.table-item').length) ? $('.table-item[data-seq="' + $.gallery.seqs[0] + '"]').attr('data-category') : $('.gallery-items .item[data-seq="' + $.gallery.seqs[0] + '"]').attr('data-category'); 21657 if(s) { 21658 $('.toolbar-category .item-submenu li').each(function() { 21659 if(s.includes(`|${$(this).text().trim()}|`)) $(this).addClass('active'); 21660 }); 21661 } 21662 } else { 21663 var category_active_text = $('.gallery-category-menu.active').text(); 21664 $('.toolbar-category .item-submenu li:contains("'+category_active_text+'")').addClass('active'); 21665 } 21666 break; 21667 case "checkall": 21668 var check = $(this).find('input').prop('checked'); 21669 if(check) { 21670 $('.table-item input').prop('checked',true); 21671 $('.table-item').addClass('ui-selected'); 21672 $.each($('.table-item'), function(i,v) { 21673 $.gallery.seqs.push($(this).attr('data-seq')); 21674 }); 21675 stickyToolbar(); 21676 } else { 21677 $('.table-item input').prop('checked',fal
21677se); 21678 $('.table-item').removeClass('ui-selected return'); 21679 $.gallery.seqs = []; 21680 } 21681 break; 21682 case "edit": 21683 ($.gallery.mode == 'shopping') ? $.products.add(seq) : galleryItemController(seq); break; 21684 case "copy": 21685 $.gallery.copy = $.gallery.seqs; $.gallery.move = []; $.gallery.delete = []; // $.gallery.seqs = []; 21686 $('.gallery-items .item').removeClass('move'); 21687 $('.gallery-toolbar.mod-gallery').remove(); 21688 $.gallery.cp(); 21689 break; 21690 case "move": 21691 $.gallery.move = $.gallery.seqs; $.gallery.copy = []; $.gallery.delete = []; $.gallery.seqs = []; $.gallery.ex_id = []; 21692 $('.gallery-items .item').removeClass('copy'); 21693 $('.gallery-toolbar.mod-gallery').remove(); 21694 var content = '<ul class="gallery-move-list ui-sortable">', 21695 gallery_count = 0; 21696 21697 $.each($.gallery.blocks, function(i,v) { 21698 $.each(v, function(m, s) { 21699 if(s.length) { 21700 $.each(s, function(k,n) { 21701 if(n.id == $.gallery.block_id && s.length == 1) { 21702 return true; 21703 } 21704 if(k == 0) { 21705 content+= '<li><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 4 8"><path d="m-.05-.06 4 4-4 4v-8z"/></svg> ' + m + '</li>'; 21706 } 21707 if(n.id != $.gallery.block_id) { 21708 switch(n.mode) { 21709 case 'shopping': icon = '<svg class="shopping" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 14"><path d="M9.82 2C9.4 0.84 8.3 0 7 0H6C4.7 0 3.6 0.84 3.18 2H0v12h13V2H9.82zM6 1h1c0.74 0 1.37 0.41 1.72 1H4.28C4.63 1.41 5.26 1 6 1zM12 13H1V3h2v3h1V3h5v3h1V3h2V13z"/></svg>ã'; break; 21710 case 'project' : icon = '<svg class="project" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M13 0H3v3H0v13h13v-3h3V3L13 0zM13 1.41L14.59 3H13V1.41zM1 15V4h8v3h3v8H1zM10 4.41L11.59 6H10V4.41zM15 12h-2V6l-3-3H4V1h8v3h3V12z"/><rect x="3" y="9" width="7" height="1"/><rect x="3" y="12" width="7" height="1"/></svg>ã'; break; 21711 case 'gallery' : icon = '<svg class="gallery" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 13"><path d="M0 0v13h13V0H0zM12 1v7.29l-2-2 -2 2 -4-4 -3 3V1H12zM1 12V8.71l3-3 4 4 2-2 2 2V12H1z"/><circle cx="10" cy="3" r="1"/></svg>ã'; break; 21712 } 21713 icon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 4 8"><path d="m-.05-.06 4 4-4 4v-8z"/></svg>'; 21714 var move_disabled = (n.isActive) ? '' : 'disabled'; 21715 if(LUX && n.mode == 'shopping') move_disabled = 'disabled'; 21716 content+= '<li class="gallery-move ' + move_disabled + '" data-gallery-id="' + ((move_disabled == '') ? n.id : '') + '"><span class="gallery-block-name">' + n.name + '</span><span class="f-right gallery-name-edit"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M15.41 0.76l-0.17-0.17C14.85 0.2 14.34 0 13.83 0s-1.02 0.2-1.41 0.59L1 12l-1 4 4-1L15.41 3.59C16.2 2.8 16.2 1.54 15.41 0.76zM3.49 14.1l-2.11 0.53 0.53-2.11 8.95-8.95 1.59 1.59L3.49 14.1zM14.71 2.88l-1.56 1.56 -1.59-1.59 1.56-1.56C13.31 1.1 13.56 1 13.83 1s0.52 0.1 0.71 0.29l0.17 0.17C15.1 1.85 15.1 2.49 14.71 2.88z"/></svg></span></li>'; 21717 gallery_count++; 21718 } 21719 }); 21720 } 21721 }); 21722 }); 21723 if(gallery_count == 0) { 21724 content+= "<li>" + $.lang[LANG]['editor.block.gallery.item.move.none'] + "</li>"; 21725 } 21726 content+= "</ul><div class='move-alert error'></div>"; 21727 21728 if(gallery_count) { 21729 content+= '\ 21730 <div class="gallery-confirm-str">' + $.lang[LANG]['editor.block.gallery.item.move.after'] + '</div>\ 21731 <div class="gallery-confirm-select">\ 21732 <div class="gallery-move-select radio">\ 21733 <label><input type="radio" name="gallery_move_info" class="gallery-move-info" value="stay" checked>' + $.lang[LANG]['editor.block.gallery.item.move.after.1'] + '</label>\ 21734 </div>\ 21735 <div class="gallery-move-select radio">\ 21736 <label><input type="radio" name="gallery_move_info" class="gallery-move-info" value="move">' + $.lang[LANG]['editor.block.gallery.item.move.after.2'] + '</label>\ 21737 </div>\ 21738 </div>\ 21739 '; 21740 } 21741 21742 var moveModal = $(this).showModalFlat($.lang[LANG]['editor.block.gallery.item.move.title'], $.lang[LANG]['editor.block.gallery.item.move.select.1'] + ($.gallery.move).length + $.lang[LANG]['editor.block.gallery.item.move.select.2'] + content, true, true, function() { 21743 $('.gallery-move-list').removeClass('not-selected'); 21744 $('.move-alert').text(''); 21745 21746 var $active = $('.gallery-move.active:not(.disabled)'); 21747 if($active.length == 0 && gallery_count > 0) { 21748 $('.gallery-move-list').addClass('not-selected'); 21749 $('.move-alert').text($.lang[LANG]['editor.block.gallery.item.move.error']); 21750 return false;
21751 } 21752 var block_id = $active.attr('data-gallery-id'), 21753 isMove = $("input.gallery-move-info:checked").val(); 21754 if(typeof block_id == "undefined") { 21755 $('.move-alert').text($.lang[LANG]['editor.block.gallery.error']); 21756 return false; 21757 } 21758 21759 if($.gallery.ex_id.length) { 21760 $.gallery.move = $.gallery.move.filter(item => !$.gallery.ex_id.includes(item)); 21761 } 21762 moveModal.modal('hide'); 21763 var move_block_id = (isMove == "stay") ? $.gallery.block_id : block_id; 21764 $.progressON($.lang[LANG]['editor.block.gallery.moving.str.1']); 21765 var total = ($.gallery.move).length, 21766 moving = $.lang[LANG]['editor.block.gallery.moving.str.2'], 21767 progress = 0, 21768 loading = '<i class="fa fa-circle-o-notch fa-spin fa-3x fa-fw"></i> ', 21769 done = 0, 21770 group = ($('.table-item').length) ? '.table-item' : '.gallery-items .item', 21771 item = $(group).length, 21772 cpage = Math.ceil(item/30), 21773 spos = $('.gallery-modal').scrollTop(); 21774 seqs = $.gallery.move; 21775 21776 $('.progressModal .info1').html(loading + moving); 21777 $.each($.gallery.move,function(i,v) { 21778 var t = setTimeout(function() { 21779 if(CANCEL) { 21780 if(ABORT) { 21781 // 리ì¤í¸ ê°±ì ìì 21782 $.gallery.show($.gallery.block_id,cpage,$.gallery.category, function() { 21783 setTimeout(function() { 21784 $.gallery.move = []; 21785 $('.gallery-modal').scrollTop(spos); 21786 $.processOFF(); 21787 $.gallery.update = true; 21788 }, 500); 21789 }); 21790 ABORT = false; 21791 $.progressOFF(); 21792 } 21793 i=0; return false; 21794 } 21795 galleryMoveItem(block_id,v,$.gallery.pages[block_id],function() { 21796 done++; 21797 progress = parseInt((done / total) * 100,10); 21798 $('.file-upload-progress .progress-bar').css('width',progress + "%"); 21799 $('.progressModal .info2').text(done.toString() + ' / ' + total.toString()); 21800 if(typeof VIEW == 'undefined') { 21801 $.gallery.unlink = true; 21802 } else if(v==VIEW) $.gallery.unlink = true; 21803 if(total == done) { 21804 $.gallery.show(move_block_id,1,$.gallery.category, function() { 21805 var group = ($('.table-item').length) ? '.table-item' : '.gallery-items .item'; 21806 $.each($.gallery.move, function(i,v) { 21807 $(group + '[data-seq="' + v + '"]').addClass('return'); 21808 }); 21809 setTimeout(function() { 21810 $.gallery.move = []; 21811 $('.gallery-modal').scrollTop(spos); 21812 $.progressOFF(); 21813 $.gallery.update = true; 21814 }, 500); 21815 }); 21816 } else { 21817 moving = $(group + '[data-seq="' + seqs[i+1] + '"] .td-title .item-title-str').text(); 21818 if(moving == "") moving = $.lang[LANG]['editor.block.gallery.moving.str.2']; 21819 $('.progressModal .info1').html(loading + moving); 21820 } 21821 }); 21822 },500*i); 21823 }); 21824 },'cancel', 'ok', 'cl-cmmodal cl-s-btn w560 cl-p70 cl-p0',true,'','',function() { 21825 $.gallery.seqs = $.gallery.move; 21826 }); 21827 21828 break; 21829 case "paste": 21830 if(($.gallery.copy).length) $.gallery.cp(); 21831 if(($.gallery.move).length) $.gallery.mv(); 21832 break; 21833 case "delete": 21834 $.gallery.delete = $.gallery.seqs; $.gallery.move = []; $.gallery.copy = []; 21835 $('.gallery-toolbar.mod-gallery').remove(); 21836 $.gallery.del(); 21837 break; 21838 case "visible": 21839 var seq = $(this).find('i').attr('data-glseq'), 21840 visible = $(this).find('i').attr('data-visible'), 21841 mode = ''; 21842 var $this = $(this); 21843 21844 visible = (visible == 1) ? 0 : 1; 21845 21846 var limitCnt = 0; 21847 if($('.table-item').length) { 21848 mode = 'product'; 21849 $.each($.gallery.seqs, function(i,v) { 21850 var outDatetime = $('.gallery-items .table-item[data-seq="' + v + '"]').attr('data-out-datetime'); 21851 if(visible == 0 && outDatetime == '1') { 21852 limitCnt++; 21853 } 21854 }); 21855 } 21856 21857 if(limitCnt > 0) { 21858 var modal_str = 'ì íë ìíì 기ê°íì í매 ìíì ëë¤.<br>\ 21859 íë§¤ê¸°ê° ì ì¸ ìíë ¸ì¶ ê¸°ë¥ì´ ì¬ì©ì¼ë¡ ë³ê²½ë©ëë¤.<br>\
21860 ì íí ìíì ë ¸ì¶ ìí¤ê² ìµëê¹?'; 21861 21862 if(limitCnt > 1) modal_str = 'ì íë ìí ì¤ ê¸°ê°íì í매 ìíì´ í¬í¨ëì´ ììµëë¤.<br>\ 21863 기ê°íì í매 ìíì íë§¤ê¸°ê° ì ì¸ ìíë ¸ì¶ ê¸°ë¥ì´ ì¬ì©ì¼ë¡ ë³ê²½ë©ëë¤.<br>\ 21864 ì íí '+limitCnt+'ê°ì ìíì ë ¸ì¶ ìí¤ê² ìµëê¹?'; 21865 21866 var modal = $(this).showModalFlat($.lang[LANG]['config.information'], modal_str, true, true, function(){ 21867 $.post('/template/gallery/visible', { s: $.gallery.seqs, view: visible, mode: mode }, function (data) { 21868 checkError(data); 21869 updateItem(data.item); 21870 },'json'); 21871 21872 var type = 'ELEM', 21873 checked = (visible) ? false : true; 21874 setLogs(type,'gallery.item.visible.'+checked,'visible-'+checked,type,'product-manager','el'); 21875 21876 $.each($.gallery.seqs, function(i,v) { 21877 if($('.table-item').length) { 21878 var outDatetime = $('.gallery-items .table-item[data-seq="' + v + '"]').attr('data-out-datetime'); 21879 switch (outDatetime) { 21880 case 'off': 21881 if(visible == '1') { 21882 $('.gallery-items .table-item[data-seq="' + v + '"]').addClass('invisible').attr('data-visible','1'); 21883 // $('.gallery-items .table-item[data-seq="' + v + '"] .td-note').text('ì¨ê¹'); 21884 } else { 21885 $('.gallery-items .table-item[data-seq="' + v + '"]').removeClass('invisible').attr('data-visible','0'); 21886 // $('.gallery-items .table-item[data-seq="' + v + '"] .td-note').text(''); 21887 } 21888 break; 21889 case '0': 21890 if(visible == '1') { 21891 $('.gallery-items .table-item[data-seq="' + v + '"]').addClass('invisible').attr('data-visible','1'); 21892 } else { 21893 $('.gallery-items .table-item[data-seq="' + v + '"]').removeClass('invisible').attr('data-visible','0'); 21894 } 21895 break; 21896 21897 case '1': 21898 (visible == '1') ? $('.gallery-items .table-item[data-seq="' + v + '"]').addClass('invisible').attr('data-out-datetime','1') 21899 : $('.gallery-items .table-item[data-seq="' + v + '"]').removeClass('invisible').attr('data-out-datetime','0'); 21900 break; 21901 } 21902 } else { 21903 (visible == '1') ? $('.gallery-items .item[data-seq="' + v + '"]').addClass('invisible').attr('data-visible','1') 21904 : $('.gallery-items .item[data-seq="' + v + '"]').removeClass('invisible').attr('data-visible','0'); 21905 } 21906 }); 21907 21908 (visible == '1') ? $this.find('i').attr('data-visible','1') : $this.find('i').attr('data-visible','0'); 21909 (visible == '1') ? $('.gallery-modal .toolbar li > i[data-cmd="visible"]').text($.lang[LANG]["editor.gallery.icon.visible.on"]) 21910 : $('.gallery-modal .toolbar li > i[data-cmd="visible"]').text($.lang[LANG]["editor.gallery.icon.visible.off"]); 21911 $.gallery.update = true; 21912 $.gallery.unlink = true; 21913 modal.modal('hide'); 21914 }, 'cancel', 'ok', 'cl-p70 cl-cmmodal cl-s-btn w560 cl-p0'); 21915 21916 return false;
21917 } 21918 21919 $.post('/template/gallery/visible', { s: $.gallery.seqs, view: visible, mode: mode }, function (data) { 21920 checkError(data); 21921 updateItem(data.item); 21922 },'json'); 21923 // showPageCallback(showPage); 21924 var type = 'ELEM', 21925 checked = (visible) ? false : true; 21926 setLogs(type,'gallery.item.visible.'+checked,'visible-'+checked,type,'product-manager','el'); 21927 21928 $.each($.gallery.seqs, function(i,v) { 21929 if($('.table-item').length) { 21930 var outDatetime = $('.gallery-items .table-item[data-seq="' + v + '"]').attr('data-out-datetime'); 21931 switch (outDatetime) { 21932 case 'off': 21933 if(visible == '1') { 21934 $('.gallery-items .table-item[data-seq="' + v + '"]').addClass('invisible').attr('data-visible','1'); 21935 // $('.gallery-items .table-item[data-seq="' + v + '"] .td-note').text('ì¨ê¹'); 21936 } else { 21937 $('.gallery-items .table-item[data-seq="' + v + '"]').removeClass('invisible').attr('data-visible','0'); 21938 // $('.gallery-items .table-item[data-seq="' + v + '"] .td-note').text(''); 21939 } 21940 break; 21941 case '0': 21942 if(visible == '1') { 21943 $('.gallery-items .table-item[data-seq="' + v + '"]').addClass('invisible').attr('data-visible','1'); 21944 } else { 21945 $('.gallery-items .table-item[data-seq="' + v + '"]').removeClass('invisible').attr('data-visible','0'); 21946 } 21947 break; 21948 21949 case '1': 21950 (visible == '1') ? $('.gallery-items .table-item[data-seq="' + v + '"]').addClass('invisible').attr('data-out-datetime','1') 21951 : $('.gallery-items .table-item[data-seq="' + v + '"]').removeClass('invisible').attr('data-out-datetime','0'); 21952 break; 21953 } 21954 // if(outDatetime != 'off') { 21955 // (visible == '1') ? $('.gallery-items .table-item[data-seq="' + v + '"]').addClass('invisible').attr('data-out-datetime','1') 21956 // : $('.gallery-items .table-item[data-seq="' + v + '"]').removeClass('invisible').attr('data-out-datetime','0'); 21957 21958 // } else { 21959 // console.log($('.gallery-items .table-item[data-seq="' + v + '"] .td-note')); 21960 // if(visible == '1') { 21961 // $('.gallery-items .table-item[data-seq="' + v + '"]').addClass('invisible').attr('data-visible','1'); 21962 // $('.gallery-items .table-item[data-seq="' + v + '"] .td-note').text('ì¨ê¹'); 21963 // } else { 21964 // $('.gallery-items .table-item[data-seq="' + v + '"]').removeClass('invisible').attr('data-visible','0'); 21965 // $('.gallery-items .table-item[data-seq="' + v + '"] .td-note').text(''); 21966 // } 21967 // } 21968 } else { 21969 (visible == '1') ? $('.gallery-items .item[data-seq="' + v + '"]').addClass('invisible').attr('data-visible','1') 21970 : $('.gallery-items .item[data-seq="' + v + '"]').removeClass('invisible').attr('data-visible','0'); 21971 } 21972 }); 21973 21974 (visible == '1') ? $this.find('i').attr('data-visible','1') : $this.find('i').attr('data-visible','0'); 21975 (visible == '1') ? $('.gallery-modal .toolbar li > i[data-cmd="visible"]').text($.lang[LANG]["editor.gallery.icon.visible.on"]) 21976 : $('.gallery-modal .toolbar li > i[data-cmd="visible"]').text($.lang[LANG]["editor.gallery.icon.visible.off"]); 21977 // $('.gallery-toolbar').empty();
21978 // galleryStatusInit(); 21979 $.gallery.update = true; 21980 $.gallery.unlink = true; 21981 // $.gallery.reset(); 21982 21983 break; 21984 case "link": 21985 var config_icon = ($(this).hasClass('gl-item-link')) ? 'gl-item-link' : 'gallery-item-link-icon', 21986 seq = $(this).find('i').attr('data-glseq'), 21987 glink = $(this).find('i').attr('data-glink'), 21988 is_glink_target = $(this).find('i').attr('data-glink-target'), 21989 glmode = $('.gallery-modal').attr('data-mode'), 21990 glpid = $('.gallery-modal').attr('data-pid'), 21991 glpage = $('.gallery-modal').attr('data-page'), 21992 glel = $('.' + $.gallery.block_id), 21993 prev_glink = '', input_glink = '', 21994 target_check = (typeof is_glink_target != 'undefined' && is_glink_target == '_blank') ? 'checked' : '', 21995 link_content = '', 21996 glname = $.gallery.block_name; 21997 21998 var group = ($('.table-item').length) ? '.table-item' : '.gallery-items .item'; 21999 $select_glink = $('.gallery-item[data-seq="'+seq+'"]').find('a'); 22000 if(typeof glink != 'undefined' && glink) { 22001 if($select_glink.attr('data-user-link')) { 22002 prev_glink = glink; 22003 } else if ($select_glink.attr('attr-bookmark')) { 22004 prev_glink = $select_glink.attr('href'); 22005 } else if ($select_glink.attr('attr-flink')) { 22006 prev_glink = 'flink@' + $select_glink.attr('attr-flink'); 22007 } else if ($select_glink.attr('attr-link')) { 22008 prev_glink = $select_glink.attr('attr-link'); 22009 } else { 22010 prev_glink = glink; 22011 } 22012 } 22013 var site_smenu = (typeof SMENU == 'undefined') ? $.gallery.SMENU : SMENU, 22014 block_el = (typeof selectEL == 'undefined') ? $.gallery.block_el : selectEL; 22015 link_content = '<ul class="link-content gallery edit-link-Content" data-type="' + glmode + '" data-name="' + glname + '">\ 22016 ' + makeLinkList(site_smenu,'gallery',glname,glink); 22017 link_content = link_content + '\ 22018 </ul>\ 22019 <div class="link-target">\ 22020 <div class="newcheckbox hand ">\ 22021 <label>\ 22022 <div class="newcheckboxSvg">\ 22023 <input type="checkbox" class="img-link-target" id="linktarget-onoff" '+target_check+' data-el="'+block_el+'" />\ 22024 <svg viewBox="0 0 16 16" width="16" height="16">\ 22025 <path class="st6" d="M3 0h10c1.66 0 3 1.34 3 3v10c0 1.66-1.34 3-3 3H3c-1.66 0-3-1.34-3-3V3C0 1.34 1.34 0 3 0z"/>\ 22026 <path class="st19" d="M13 1c1.1 0 2 0.9 2 2v10c0 1.1-0.9 2-2 2H3c-1.1 0-2-0.9-2-2V3c0-1.1 0.9-2 2-2H13M13 0H3C1.34 0 0 1.34 0 3v10c0 1.66 1.34 3 3 3h10c1.66 0 3-1.34 3-3V3C16 1.34 14.66 0 13 0L13 0z"/>\ 22027 </svg>\ 22028 <svg class="active" viewBox="0 0 16 16" width="16" height="16">\ 22029 <rect x="2" y="2" class="st6" width="12" height="12"/>\ 22030 <path class="st19" d="M13 0H3C1.34 0 0 1.34 0 3v10c0 1.66 1.34 3 3 3h10c1.66 0 3-1.34 3-3V3C16 1.34 14.66 0 13 0zM13.03 6.03l-5.5 5.5C7.38 11.68 7.19 11.75 7 11.75s-0.38-0.07-0.53-0.22l-3.5-3.5c-0.29-0.29-0.29-0.77 0-1.06s0.77-0.29 1.06 0L7 9.94l4.97-4.97c0.29-0.29 0.77-0.29 1.06 0S13.32 5.74 13.03 6.03z"/>\ 22031 </svg>\ 22032 </div>\
22033 <span>'+ $.lang[LANG]['editor.link.open.target'] +'</span>\ 22034 </label>\ 22035 </div>\ 22036 </div>\ 22037 \ 22038 '; 22039 22040 var modal = $(this).showModalFlat($.lang[LANG]['editor.link.modal.title.gallery'], link_content, true, true, function() { 22041 var input_type = $('.link-content').find('.link-type.active').children().attr('class'); 22042 var result = getInputLink(input_type); 22043 link = result[0], isOkay = result[1], isActive = result[2], 22044 target_val = '', target_change = ''; 22045 22046 target_val = ($('#linktarget-onoff').prop('checked')) ? '_blank' : ''; 22047 target_change = (((target_check=='checked') ? 'on' : 'off') == ((target_val=='_blank') ? 'on' : 'off')) ? false : true; 22048 22049 if(isOkay) { 22050 $.each($.gallery.seqs, function(i,v) { 22051 if((isActive && prev_glink==link || isActive==false && prev_glink=='') && !target_change && ($.gallery.seqs).length == 1) { 22052 modal.modal('hide'); 22053 return true; 22054 } 22055 22056 var gsettings = { 22057 'glink' : (checkBase64Encode(decodeURIComponent(link))) ? link : Base64.encode(link), 22058 'glink_target' : target_val 22059 } 22060 $.post('/template/settings', {sid: SID, settings: JSON.stringify(gsettings), el: 'gallery_settings', seq: v}, function(data) { 22061 checkError(data); 22062 22063 $select_glink.removeAttr('data-gallery').removeAttr('data-user-link').removeAttr('attr-link').removeAttr('attr-bookmark').removeAttr('attr-flink'); 22064 $select_glink_config = $('#el-property[data-element="'+block_el+'"] #gallery-list-config'); 22065 22066 if(link) { 22067 var gallery_link = makeLinkUrl(link, ONE, VIEW); 22068 22069 $select_glink.attr('href',gallery_link); 22070 if($.inArray(link.replace(/ /g,'-'),MENULIST) > -1) { 22071 $select_glink.attr('data-user-link',gallery_link); 22072 } else if(link.match(/^\@/g) !== null) { 22073 $select_glink.attr('attr-bookmark',link.replace(/^\@/g,'')); 22074 } else if(link.match(/^flink\@/g) !== null) { 22075 $select_glink.attr('attr-flink',link.replace(/^flink\@/g,'')); 22076 }else { 22077 $select_glink.attr('attr-link',link); 22078 } 22079 22080 $select_glink_config.find('.gl-item-link[data-glseq="'+v+'"]').attr('data-glink',link).addClass('active'); 22081 if(config_icon == 'gallery-item-link-icon') $('.gallery-item-link-icon[data-glseq="'+v+'"]').attr('data-glink',link); 22082 22083 } else { 22084 $select_glink_config.find('.gl-item-link[data-glseq="'+v+'"]').attr('data-glink',link).removeClass('active'); 22085 if(config_icon == 'gallery-item-link-icon') $('.gallery-item-link-icon[data-glseq="'+v+'"]').attr('data-glink',link); 22086 var imgURL = $('.gallery-item[data-seq="' + v + '"]').find('img').prop('src'); 22087 if(glmode == 'gallery') { 22088 if((typeof imgURL=='undefined' || !imgURL) && glmode == 'gallery') { 22089 var imgURL_popup = $('.ui-selectee[data-seq="' + v + '"]').find('img').prop('src'); 22090 imgURL = imgURL_popup.split('=')[0] + '=s0'; 22091 } 22092 $select_glink.attr({'href': imgURL ,'data-gallery': '#gframe-' + glpid}); 22093 } else { 22094 $select_glink.removeAttr('data-gallery'); 22095 $select_glink.attr('href', '/'+CONFIG_URL+'config/page/' + glpage + '/view/' + v); 22096 } 22097 22098 } 22099 22100 $(group + '[data-seq="' + v + '"]').attr('data-link',Base64.decode(data.data.glink)).attr('data-target',data.data.glink_target); 22101 $('.gallery-modal .gallery-toolbar li [data-cmd="link"]').attr('data-glink',Base64.decode(data.data.glink)).attr('data-glink-target',data.data.glink_target); 22102 $('.cl_icon_link').attr('data-glink',data.data.glink).attr('data-glink-target',data.data.glink_target); 22103 22104 if(data.data.glink == '') { 22105 $('.gallery-items .item[data-seq="' + v + '"]').find('.info').remove(); 22106 $('.gallery-items .table-item[data-seq="' + v + '"]').find('.info-link').remove(); 22107 } 22108 else { 22109 if($('.gallery-items .item[data-seq="' + v + '"]').find('.info-link').length == 0) { 22110 // $('.gallery-items .item[data-seq="' + v + '"]').find('.info').append('<span class="info-link"><svg class="svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15"><path d="M6 9.85c-0.22 0-0.44-0.08-0.6-0.25 -0.33-0.33-0.33-0.87 0-1.2l3-3c0.33-0.33 0.87-0.33 1.2 0 0.33 0.33 0.33 0.87 0 1.2l-3 3C6.44 9.77 6.22 9.85 6 9.85z"/><path d="M3.85 15c-1.03 0-2-0.4-2.72-1.13C0.4 13.15 0 12.18 0 11.15s0.4-2 1.13-2.72l2-2C3.46 6.1 4 6.1 4.33 6.43c0.33 0.33 0.33 0.87 0 1.2l-2 2c-0.41 0.41-0.63 0.95-0.63 1.52s0.22 1.11 0.63 1.52c0.81 0.81 2.23 0.81 3.04 0l2-2c0.33-0.33 0.87-0.33 1.2 0 0.33 0.33 0.33 0.87 0 1.2l-2 2C5.85 14.6 4.88 15 3.85 15z"/><path d="M11.2 8.85c-0.22 0-0.44-0.08-0.6-0.25 -0.33-0.33-0.33-0.87 0-1.2l2.07-2.07c0.41-0.41 0.63-0.95 0.63-1.52s-0.22-1.11-0.63-1.52c-0.81-0.81-2.23-0.81-3.04 0L7.56 4.36c-0.33 0.33-0.87 0.33-1.2 0 -0.33-0.33-0.33-0.87 0-1.2l2.07-2.07c1.45-1.46 3.99-1.46 5.44 0C14.6 1.82 15 2.78 15 3.81s-0.4 2-1.13 2.72L11.8 8.61C11.64 8.77 11.42 8.85 11.2 8.85z"/></svg></span>'); 22111 $('.gallery-items .item[data-seq="' + v + '"]').append('<div class="info"><span class="info-link"><svg class="svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15"><path d="M6 9.85c-0.22 0-0.44-0.08-0.6-0.25 -0.33-0.33-0.33-0.87 0-1.2l3-3c0.33-0.33 0.87-0.33 1.2 0 0.33 0.33 0.33 0.87 0 1.2l-3 3C6.44 9.77 6.22 9.85 6 9.85z"/><path d="M3.85 15c-1.03 0-2-0.4-2.72-1.13C0.4 13.15 0 12.18 0 11.15s0.4-2 1.13-2.72l2-2C3.46 6.1 4 6.1 4.33 6.43c0.33 0.33 0.33 0.87 0 1.2l-2 2c-0.41 0.41-0.63 0.95-0.63 1.52s0.22 1.11 0.63 1.52c0.81 0.81 2.23 0.81 3.04 0l2-2c0.33-0.33 0.87-0.33 1.2 0 0.33 0.33 0.33 0.87 0 1.2l-2 2C5.85 14.6 4.88 15 3.85 15z"/><path d="M11.2 8.85c-0.22 0-0.44-0.08-0.6-0.25 -0.33-0.33-0.33-0.87 0-1.2l2.07-2.07c0.41-0.41 0.63-0.95 0.63-1.52s-0.22-1.11-0.63-1.52c-0.81-0.81-2.23-0.81-3.04 0L7.56 4.36c-0.33 0.33-0.87 0.33-1.2 0 -0.33-0.33-0.33-0.87 0-1.2l2.07-2.07c1.45-1.46 3.99-1.46 5.44 0C14.6 1.82 15 2.78 15 3.81s-0.4 2-1.13 2.72L11.8 8.61C11.64 8.77 11.42 8.85 11.2 8.85z"/></svg></span></div>'); 22112 } 22113 if($('.gallery-items .table-item[data-seq="' + v + '"] .td-img .info-link').length == 0) { 22114 $('.gallery-items .table-item[data-seq="' + v + '"]').find('.td-img').append('<span class="info-link"><svg class="svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15"><path d="M6 9.85c-0.22 0-0.44-0.08-0.6-0.25 -0.33-0.33-0.33-0.87 0-1.2l3-3c0.33-0.33 0.87-0.33 1.2 0 0.33 0.33 0.33 0.87 0 1.2l-3 3C6.44 9.77 6.22 9.85 6 9.85z"/><path d="M3.85 15c-1.03 0-2-0.4-2.72-1.13C0.4 13.15 0 12.18 0 11.15s0.4-2 1.13-2.72l2-2C3.46 6.1 4 6.1 4.33 6.43c0.33 0.33 0.33 0.87 0 1.2l-2 2c-0.41 0.41-0.63 0.95-0.63 1.52s0.22 1.11 0.63 1.52c0.81 0.81 2.23 0.81 3.04 0l2-2c0.33-0.33 0.87-0.33 1.2 0 0.33 0.33 0.33 0.87 0 1.2l-2 2C5.85 14.6 4.88 15 3.85 15z"/><path d="M11.2 8.85c-0.22 0-0.44-0.08-0.6-0.25 -0.33-0.33-0.33-0.87 0-1.2l2.07-2.07c0.41-0.41 0.63-0.95 0.63-1.52s-0.22-1.11-0.63-1.52c-0.81-0.81-2.23-0.81-3.04 0L7.56 4.36c-0.33 0.33-0.87 0.33-1.2 0 -0.33-0.33-0.33-0.87 0-1.2l2.07-2.07c1.45-1.46 3.99-1.46 5.44 0C14.6 1.82 15 2.78 15 3.81s-0.4 2-1.13 2.72L11.8 8.61C11.64 8.77 11.42 8.85 11.2 8.85z"/></svg></span>'); 22115 } 22116 } 22117 22118 if(target_val == '_blank') $select_glink.attr('target','_blank'); 22119 else $select_glink.removeAttr('target'); 22120 22121 // if(target_change) { 22122 // if(target_val) $select_glink.attr('target',target_val); 22123 // else $select_glink.removeAttr('target'); 22124 // // $select_glink_config.find('.gl-item-link[data-glseq="'+seq+'"]').attr('data-glink-target',target_val); 22125 // // if(config_icon == 'gallery-item-link-icon') $('.gallery-item-link-icon[data-glseq="'+seq+'"]').attr('data-glink-target',target_val); 22126 // } 22127 22128 var log_text = (isActive || !isActive && target_change) ? 'active' : 'broken', 22129 type = getElementType(); 22130 setLogs(type,'gallery.link.'+log_text,'link-'+log_text,type,'product-manager','el'); 22131
22132 // galleryStatusInit(); 22133 }, 'json'); 22134 }); 22135 22136 modal.modal('hide'); 22137 } 22138 } ,'cancel', 'ok', 'cl-cmmodal cl-s-btn w560 cl-p70 cl-p0 cl-edit-link modal-portfolio-link site-popup-link cover fullcover-modal',true,'',function(){ 22139 $('[data-toggle="popover"]').popover(); 22140 }); 22141 break; 22142 case "org-price": 22143 case "disc-price": 22144 case "sale-price": 22145 if($this.hasClass('disabled')) return; 22146 var price_type = cmd.replace('-price',''); 22147 selectedProduct_html = getSelectedProductList(SID,price_type,$.gallery.seqs), 22148 config_icon = ($(this).hasClass('gl-item-discount')) ? 'gl-item-discount' : 'gallery-item-discount-icon', 22149 seq = $(this).find('i').attr('data-glseq'), 22150 discount = $(this).find('i').attr('data-discount'), 22151 is_discount_target = $(this).find('i').attr('data-discount-target'), 22152 glmode = $('.gallery-modal').attr('data-mode'), 22153 glpid = $('.gallery-modal').attr('data-pid'), 22154 glpage = $('.gallery-modal').attr('data-page'), 22155 glel = $('.'+ $.gallery.block_id), 22156 prev_discount = '', input_discount = '', 22157 target_check = (typeof is_discount_target != 'undefined' && is_discount_target == '_blank') ? 'checked' : ''; 22158 22159 var price_content = ''; 22160 22161 price_content += '<div class="price_setting_box modal-contents-box">'+ selectedProduct_html + '</div>'; 22162 22163 var modal = $(this).showModalFlat($.lang[LANG]['editor.block.gallery.product.'+price_type] + $.lang[LANG]['editor.block.gallery.product.price'], price_content, false, true, function() { //confirm 22164 var useDiscount = $('input[name="use_discount"]:checked').val(), 22165 discountRate = Number(removeCommas($('#prod-price-rate').val())), 22166 discountUnit = $('#prod-price-unit').attr('data-value'); 22167 22168 if($('.price_setting_box').find('.error_text').length > 0) return false; 22169 22170 var category_type = $('.price_setting_input_box').attr('data-category'), 22171 price_input_val = Number(removeCommas($('#prod-price-rate').val())), 22172 price_unit = $('#prod-price-unit').attr('data-value'), 22173 price_mark = $('#price-setting-mark-select').attr('data-value'), 22174 price_fixtype = (category_type=='org') ? $('input[name="pr_detail_fix_type"][checked="checked"]').attr('data-fix') : '', 22175 ch_val = (price_mark=='change') ? price_input_val : (price_mark=='raise' ? price_input_val : -price_input_val); 22176 22177 if(!$('.setting_product_list').hasClass('change_price')) { 22178 modal.modal('hide'); 22179 return false; 22180 } 22181 22182 var route = (CONFIG_URL) ? '/_admin' : ''; 22183 // $.processON(); 22184 // $.ajax({ 22185 // type: 'POST', 22186 // url : route + '/shopping/setProduct', 22187 // data : unit_obj, 22188 // dataType : 'json', 22189 // async: true, 22190 // cache: false, 22191 // success : function(data) { 22192 // checkError(data); 22193 // var page = getStorageItem('gallery-product-page'); 22194 // $.gallery.show($.gallery.block_id,page,$.gallery.cateogry); 22195 // $.gallery.update = true; 22196 // $.gallery.reset(); 22197 // $.processOFF(); 22198 // modal.modal('hide'); 22199 // }, 22200 // error : function(xhr, status, error) { 22201 // $.processOFF(); 22202 // alert("Error " + xhr.status + " : ê´ë¦¬ì
22202ìê² ë¬¸ì"); 22203 // } 22204 // }); 22205 22206 var list_html = ``; 22207 var list_items = modal.find('.setting_product_list ul[data-gseq]').map(function(){ return {'seq' : $(this).data('gseq'),'pname':$(this).find('.product_title').text()}}).toArray(); 22208 $(list_items).each(function(k, v) { 22209 list_html += ` 22210 <div class="process" data-seq="${v.seq}"> 22211 <div class="bar"> 22212 <div class="progressbar"></div> 22213 </div> 22214 <div class="desc"> 22215 <span class="name" style="">${v.pname}</span> 22216 <div class="status">ë³ê²½ ì¤</div> 22217 </div> 22218 </div> 22219 `; 22220 }); 22221 22222 var html = ` 22223 <div> 22224 <div class="main-progress"> 22225 <div class="bar"> 22226 <div></div> 22227 </div> 22228 <div class="spin"> 22229 <span><i class="fa fa-circle-o-notch fa-spin fa-3x fa-fw"></i></span> 22230 <div class="counter"><span>0</span>/${list_items.length}</div> 22231 </div> 22232 </div> 22233 <div class="detail-progress"> 22234 ${list_html} 22235 </div> 22236 </div> 22237 `; 22238 22239 var total_cnt = list_items.length; 22240 var cur_cnt = 0; 22241 var ajaxController; 22242 var cancelFlag = false; 22243 var hasError = false; 22244 var product_modal_title = 'ì ê°ë¥¼ ë³ê²½ ì¤ì ëë¤.'; 22245 if(category_type == 'disc') { 22246 product_modal_title = (price_unit == 'P') ? 'í ì¸ì¨ì ë³ê²½ ì¤ì ëë¤.' : 'í ì¸ê°ë¥¼ ë³ê²½ ì¤ì ëë¤.'; 22247 } else if(category_type == 'sale') { 22248 product_modal_title = 'í매ê°ë¥¼ ë³ê²½ ì¤ì ëë¤.'; 22249 } 22250 22251 var product_modal = $(this).showModalFlat(product_modal_title, html, true, true, function() { 22252 product_modal.modal('hide'); 22253 },'cancel', 'ok', 'cl-cmmodal cl-product-price-setting cl-s-btn cl-p0 w700 zindex1045 cover fullcover-modal', true, function() { 22254 // close callback 22255 console.log('ì¤ê°ì 꺼ë²ë¦¼') 22256 if(ajaxController) ajaxController.abort(); 22257 cancelFlag = true; 22258 },'',function(){ 22259 modal.modal('hide'); 22260 var page = getStorageItem('gallery-product-page'); 22261 $.gallery.show($.gallery.block_id,page,$.gallery.cateogry); 22262 $.gallery.update = true; 22263 $.gallery.reset(); 22264 }); 22265 22266 product_modal.find('.ok-button-dialog').hide(); 22267 22268 function ajaxRequest(item) { 22269 return new Promise((resolve, reject) => { 22270 if(cancelFlag) { 22271 reject(); 22272 return; 22273 } 22274 ajaxController = $.ajax({ 22275 url : route + '/shopping/setProduct', 22276 async:false, 22277 dataType:'json', 22278 type:'post', 22279 data: { 22280 sid: SID, 22281 seqs: item.seq, 22282 type: category_type, 22283 mark : price_mark, 22284 v : ch_val,
22285 unit : price_unit, 22286 fx : category_type == 'org' ? price_fixtype : '', 22287 }, 22288 success: function(response) { 22289 // AJAX ì±ê³µ ì ì ëë©ì´ì í¨ê³¼ ì¶ê° 22290 product_modal.find(`.process[data-seq="${item.seq}"]`).find('.progressbar').css('width', '100%'); 22291 if(!response.error) { 22292 setTimeout(function() { 22293 product_modal.find(`.process[data-seq="${item.seq}"]`).find('.status').addClass('info').text('ë³ê²½ ìë£') 22294 },500); 22295 } else { 22296 hasError = true; 22297 setTimeout(function() { 22298 product_modal.find(`.process[data-seq="${item.seq}"]`).find('.progressbar').addClass('danger'); 22299 product_modal.find(`.process[data-seq="${item.seq}"]`).find('.status').addClass('danger').text('ë³ê²½ ì¤í¨'); 22300 product_modal.find(`.process[data-seq="${item.seq}"]`).append( 22301 ` 22302 <div class="desc"> 22303 <span class="error"> 22304 <svg viewBox="0 0 13 13" width="13" height="13"><path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"></path><rect x="6" y="3" width="1" height="5"></rect><rect x="6" y="9" width="1" height="1"></rect></svg> 22305 ${response.error} 22306 </span> 22307 </div> 22308 ` 22309 ); 22310 }, 500); 22311 } 22312 }, 22313 error: function(error) { 22314 console.log(error); 22315 if(error.statusText === 'abort') { 22316 reject(); 22317 return; 22318 } 22319 hasError = true; 22320 product_modal.find(`.process[data-seq="${item.seq}"]`).find('.progressbar').addClass('danger').css('width', '100%'); 22321 product_modal.find(`.process[data-seq="${item.seq}"]`).find('.status').addClass('danger').text('ë³ê²½ ì¤í¨'); 22322 }, 22323 complete:function() { 22324 cur_cnt++; 22325 product_modal.find(`.main-progress .bar`).find('div').css('width', (cur_cnt/total_cnt*100) + '%'); 22326 product_modal.find(`.main-progress .counter span`).text(cur_cnt) 22327 setTimeout(function() { 22328 resolve(); 22329 },600); 22330 } 22331 }); 22332 }); 22333 } 22334 async function runAjaxRequests(items) { 22335 try { 22336 for (var item of items) { 22337 await ajaxRequest(item); // ê° ìì²ì´ ìë£ë ëê¹ì§ 기ë¤ë¦¼ 22338 } 22339 } catch (error) { 22340 console.log('ì¤ì§ìì¼ë²ë¦¼') 22341 } 22342 } 22343 22344 setTimeout(function() { 22345 runAjaxRequests(list_items).then(function() { 22346 if(cancelFlag) return; 22347 if(hasError) { 22348 product_modal.find('.ok-button-dialog').show(); 22349 product_modal.find('.close-button-dialog').hide(); 22350 } else { 22351 product_modal.modal('hide'); 22352 } 22353 }); 22354 },1100) 22355 } ,'cancel', 'config.change', 'cl-cmmodal cl-s-btn cl-p0 w900 cl-edit-discount modal-product-discount site-popup-discount cl-product-setting cover fullcover-modal fixed', true, '',function(){ 22356 22357 var scrollHeight = document.querySelector('.product_contents').scrollHeight, 22358 clientHeight = document.querySelector('.product_contents').clientHeight; 22359 22360 if(scrollHeight > clientHeight) $('.product_contents').addClass('pr_scroll'); 22361 else $('.product_contents').removeClass('pr_scroll'); 22362 22363 }, function(){ //hide 22364 // $('[data-toggle="popover"]').popover(); 22365 },true); 22366 break; 22367 case "badge": 22368 var badgeInput = 'change'; 22369 var badgeArr = ['new', 'best', 'md', 'free', 'hot']; 22370 var product_list = ''; 22371 var badge_head = ''; 22372 var badge_settings = $.parseJSON(localStorage.getItem('badge_settings')); 22373 22374 $.each(badgeArr, function(idx, type) { 22375 var bsettings = (typeof badge_settings[type] != 'undefined')? badge_settings[type] : {}; 22376 var badgeType = (typeof bsettings.type != 'undefined' && bsettings.type)? bsettings.type : 'edit'; 22377 var badgeStyle = (typeof bsettings.style != 'undefined' && bsettings.style)? bsettings.style : 'default-1 small'; 22378 var badgeText = (typeof bsettings.badge_text != 'undefined' && bsettings.badge_text)? bsettings.badge_text : $.lang[LANG]['gallery.shopping.badge.'+type]; 22379 var badgeBorderColor = (typeof bsettings.border_color != 'undefined' && bsettings.border_color)? bsettings.border_color : '';
22380 var badgeBackgroundColor = (typeof bsettings.background_color != 'undefined' && bsettings.background_color)? bsettings.background_color : ''; 22381 var badgeFontColor = (typeof bsettings.font_color != 'undefined' && bsettings.font_color)? bsettings.font_color : ''; 22382 var badgeImgSrc = (typeof bsettings.image_src != 'undefined' && bsettings.image_src)? bsettings.image_src : ''; 22383 var $badge = (badgeType == 'edit')? $('<span class="change-badge-design hand product-badge ' + badgeStyle + '" data-type="'+type+'" data-style="' + badgeStyle + '" data-border_color="' + bsettings.border_color + '" data-background_color="' + bsettings.background_color + '" data-font_color="' + bsettings.font_color + '">' + badgeText + '</span>') : $('<span class="change-badge-design hand product-badge" data-type="'+type+'"><img src="' + bsettings.image_src + '"></span>'); 22384 var badgeCnt = $('.table-item.ui-selected .product-badge[data-type="'+type+'"]').length; 22385 var checkedAll = ''; 22386 if(badgeBorderColor) $badge.css('border-color', badgeBorderColor);
22387 if(badgeBackgroundColor) $badge.css('background-color', badgeBackgroundColor); 22388 if(badgeFontColor) $badge.css('color', badgeFontColor); 22389 22390 if($.gallery.seqs.length == badgeCnt) { 22391 checkedAll = 'checked'; 22392 } 22393 22394 badge_head += '\ 22395 <div class="divTableHead">\ 22396 <div class="badge-view">' + $badge[0].outerHTML + '</div>\ 22397 <div class="newcheckbox">\ 22398 <label>\ 22399 <input type="checkbox" class="check-all" data-type="' + type + '" '+checkedAll+'>\ 22400 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\ 22401 <path d="M13 0H3C1.3 0 0 1.3 0 3v10c0 1.7 1.3 3 3 3h10c1.7 0 3-1.3 3-3V3C16 1.3 14.7 0 13 0zM15 13c0 1.1-0.9 2-2 2H3c-1.1 0-2-0.9-2-2V3c0-1.1 0.9-2 2-2h10c1.1 0 2 0.9 2 2V13z"/>\ 22402 </svg>\ 22403 <svg class="active" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\ 22404 <path d="M13 0H3C1.34 0 0 1.34 0 3v10c0 1.66 1.34 3 3 3h10c1.66 0 3-1.34 3-3V3C16 1.34 14.66 0 13 0zM13.03 6.03l-5.5 5.5C7.38 11.68 7.19 11.75 7 11.75s-0.38-0.07-0.53-0.22l-3.5-3.5c-0.29-0.29-0.29-0.77 0-1.06s0.77-0.29 1.06 0L7 9.94l4.97-4.97c0.29-0.29 0.77-0.29 1.06 0S13.32 5.74 13.03 6.03z"/>\ 22405 </svg>\ 22406 </label>\ 22407 </div>\ 22408 </div>\ 22409 '; 22410 }); 22411 $.each($.gallery.seqs, function(i,v) { 22412 var badge_list = ''; 22413 22414 $.each(badgeArr, function(idx, type) { 22415 var $badge = $('.table-item[data-seq="'+v+'"] .product-badge[data-type="'+type+'"]'); 22416 badge_list += '\ 22417 <div class="divTableCell product-badge-item" data-seq="'+v+'">\ 22418 <div class="newcheckbox">\ 22419 <label>\ 22420 <input type="checkbox" class="product-badge badge-' + type + '" data-type="' + type + '" '+ (($badge.length > 0)? 'checked' : '') +'>\ 22421 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\ 22422 <path d="M13 0H3C1.3 0 0 1.3 0 3v10c0 1.7 1.3 3 3 3h10c1.7 0 3-1.3 3-3V3C16 1.3 14.7 0 13 0zM15 13c0 1.1-0.9 2-2 2H3c-1.1 0-2-0.9-2-2V3c0-1.1 0.9-2 2-2h10c1.1 0 2 0.9 2 2V13z"/>\ 22423 </svg>\ 22424 <svg class="active" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\ 22425 <path d="M13 0H3C1.34 0 0 1.34 0 3v10c0 1.66 1.34 3 3 3h10c1.66 0 3-1.34 3-3V3C16 1.34 14.66 0 13 0zM13.03 6.03l-5.5 5.5C7.38 11.68 7.19 11.75 7 11.75s-0.38-0.07-0.53-0.22l-3.5-3.5c-0.29-0.29-0.29-0.77 0-1.06s0.77-0.29 1.06 0L7 9.94l4.97-4.97c0.29-0.29 0.77-0.29 1.06 0S13.32 5.74 13.03 6.03z"/>\ 22426 </svg>\ 22427 </label>\ 22428 </div>\ 22429 </div>\ 22430 '; 22431 }); 22432 var num = i + 1; 22433 product_list += '<div class="divTableRow display-flex space-between align-items-center" data-seq="' + v + '">\ 22434 <div class="divTableCell row-num">' + ((num < 10)? '0' + num : num) + '</div>\ 22435 <div class="divTableCell product-title">' + $('.table-item[data-seq="'+v+'"] .td-title .item-title-str').text() + '</div>\ 22436 ' + badge_list + '</div>'; 22437 }); 22438 var badge_content = '\ 22439 <div class="badge-setting-header display-flex space-between align-items-center">\ 22440 <h2>' + $.lang[LANG]['editor.block.gallery.product.badge'] + '</h2>\ 22441 <ul class="badge-setting-button">\ 22442 <li class="modal-close">ì·¨ì</li>\ 22443 <li class="modal-save ok-button-dialog">ì ì¥</li>\ 22444 </ul>\ 22445 </div>\ 22446 <div class="badge-setting-table thin-scroll-bar">\ 22447 <div class="badge-setting-top display-flex space-between align-items-center">\ 22448 <div class="row-cnt">ì í목ë¡<span>' + ($.gallery.seqs.length) + 'ê°</span></div>\ 22449 <button class="change-badge-design"><svg viewBox="0 0 12 12" width="13" height="12"><path d="M11.56 0.57l-0.13-0.13C11.14 0.15 10.76 0 10.37 0 9.99 0 9.6 0.15 9.31 0.44L0.75 9 0 12l3-0.75 8.56-8.56C12.15 2.1 12.15 1.15 11.56 0.57zM2.49 10.35l-1.11 0.28 0.28-1.11 6.58-6.58 0.84 0.84L2.49 10.35zM10.85 1.98L9.77 3.06 8.94 2.23l1.08-1.08C10.15 1.02 10.29 1 10.37 1s0.23 0.02 0.35 0.15l0.13 0.13C11.05 1.47 11.05 1.79 10.85 1.98z"></path></svg>ë±ì§ ëìì¸ ë³ê²½</button>\ 22450 </div>\ 22451 <div class="divTable">\ 22452 <div class="divTableHeading display-flex space-between align-items-center">\ 22453 <div class="divTableHead row-num">ë²í¸</div>\ 22454 <div class="divTableHead product-title">ìí</div>' 22455 + badge_head + 22456 '</div>\ 22457 <div class="divTableBody">' + product_list + '</div>\ 22458 </div>\ 22459 <div class="badge-setting-bottom"></div>\ 22460 </div>\ 22461 '; 22462 22463 var badgeSettingModal = $(this).showModalFlat('', badge_content, false, true, function() { //confirm 22464 var same = 0; 22465 var total = $.gallery.seqs.length; 22466 var spos = $('.gallery-modal').scrollTop(); 22467 22468 var useBadge_obj = {}; 22469 var before_useBadge_obj = {}; 22470 var update_obj = {}; 22471 $.each($.gallery.seqs, function(i,v) { 22472 var productName = $('.table-item[data-seq="'+v+'"] .td-title .item-title-str').text(); 22473 var useBadge = []; 22474 var beforeUseBadge = []; 22475 $('.product-badge-item[data-seq="'+v+'"]').each(function(idx, badge){ 22476 var badgeType = $(badge).find('input.product-badge:checked').attr('data-type'); 22477 if(typeof badgeType != 'undefined' && badgeType) useBadge.push(badgeType); 22478 }); 22479 22480 $.each(badgeArr, function(idx, type) { 22481 var $badge = $('.table-item[data-seq="'+v+'"] .product-badge[data-type="'+type+'"]'); 22482 if ($badge.length > 0) beforeUseBadge.push(type); 22483 }); 22484 22485 if (JSON.stringify(useBadge) === JSON.stringify(beforeUseBadge)) { 22486 same ++; 22487 } else { 22488 update_obj[v] = useBadge; 22489 useBadge_obj[v] = {'pname': productName, 'use_badge': useBadge}; 22490 before_useBadge_obj[v] = {'pname': productName, 'use_badge': beforeUseBadge}; 22491 } 22492 22493 }); 22494 22495 if(total <= same) { 22496 if($('.modal-product-badge').eq(0).hasClass('design-update')) { 22497 var p = $.gallery.pages; 22498 $.gallery.show($.gallery.block_id, p.page, '', function() { 22499 setTimeout(function() { 22500 $('.gallery-modal').scrollTop(spos); 22501 }, 200); 22502 }); 22503 22504 $.gallery.update = true; 22505 $.gallery.reset(); 22506 } 22507 22508 badgeSettingModal.modal('hide'); 22509 return false;
22510 } 22511 22512 $.progressON('ë±ì§ ì¤ì ì ì©ì¤ì ëë¤...', '', '', true); 22513 22514 var done = 0; 22515 var progress = 0; 22516 var route = (CONFIG_URL) ? '/_admin' : ''; 22517 total = Object.keys(update_obj).length; 22518 $.each(update_obj, function(seq, useBadge) { 22519 var gsettings = {'use_badge' : useBadge}; 22520 setTimeout(function(){ 22521 $.ajax({ 22522 type: 'POST', 22523 url: '/template/settings', 22524 data: {sid: SID, settings: JSON.stringify(gsettings), el: 'gallery_settings', seq: seq, screenupdate: 'directupload'}, 22525 dataType: 'json', 22526 async: true, 22527 success: function(data) { 22528 checkError(data); 22529 done++; 22530 progress = parseInt((done / total) * 100,10); 22531 $('.progressModal .progress-bar').css('width', progress+'%'); 22532 $('.progressModal .info2').html('<span class="progressCnt">' + done + '</span>' + ' / ' + total); 22533 22534 if(total == done) { 22535 $.ajax({ 22536 type: 'POST', 22537 url: route + '/shopping/badge_design', 22538 data: {sid: SID, type: 'use_badge_slog', slog: JSON.stringify(useBadge_obj), before_slog: JSON.stringify(before_useBadge_obj)}, 22539 dataType: 'json', 22540 async: true, 22541 success: function(data) { 22542 } 22543 }); 22544 22545 var p = $.gallery.pages; 22546 setTimeout(function(){ 22547 $.gallery.show($.gallery.block_id, p.page, '', function() { 22548 setTimeout(function() { 22549 $('.gallery-modal').scrollTop(spos); 22550 }, 200); 22551 }); 22552 22553 $.gallery.update = true; 22554 $.gallery.reset(); 22555 $.progressOFF(); 22556 22557 badgeSettingModal.modal('hide'); 22558 }, 400); 22559 } 22560 } 22561 }); 22562 }, 200*done); 22563 }); 22564 }, '', '', 'cl-cmmodal cover cl-s-btn cl-p70 cl-p0 cl-edit-badge modal-product-badge', true, '', function() { //show 22565 22566 $(document).on('change', '.modal-product-badge-wrap .divTableHead .check-all', function() { 22567 var type = $(this).attr('data-type'); 22568 if($(this).prop('checked') == true) { 22569 // $('input.check-all').prop('checked', true); 22570 $('.modal-product-badge-wrap input[data-type="'+type+'"]').prop('checked', true); 22571 } else { 22572 $('.modal-product-badge-wrap input[data-type="'+type+'"]').prop('checked', false); 22573 } 22574 }); 22575 22576 $(document).on('change', '.modal-product-badge-wrap .product-badge-item input[type="checkbox"]', function() { 22577 var type = $(this).attr('data-type'); 22578 if($(this).prop('checked') == true && ($.gallery.seqs.length == $('.modal-product-badge-wrap .product-badge-item input[type="checkbox"][data-type="'+type+'"]:checked').length)) { 22579 $('.modal-product-badge-wrap .divTableHead .check-all[data-type="'+type+'"]').prop('checked', true); 22580 } else { 22581 $('.modal-product-badge-wrap .divTableHead .check-all[data-type="'+type+'"]').prop('checked', false); 22582 } 22583 }); 22584 22585 var chBadgeDsgnContent = '\ 22586 <div class="badge-setting-header display-flex space-between align-items-center">\ 22587 <h2>ë±ì§ ëìì¸ ë³ê²½</h2>\ 22588 <ul class="badge-setting-button">\ 22589 <li class="modal-close">ì·¨ì</li>\ 22590 <li class="modal-save ok-button-dialog">ì ì¥</li>\ 22591 </ul>\ 22592 </div>\ 22593 <div class="badge-setting-top display-flex space-between">\ 22594 <div class="return-default-design hand"><svg viewBox="0 0 20 20" width="20" height="20"><path d="M11.18 3C7.54 3 4.55 5.78 4.21 9.33L2.53 7.65l-.71.7 2.85 2.85 2.85-2.85-.7-.7-1.59 1.59C5.61 6.29 8.13 4 11.18 4c3.31 0 6 2.69 6 6s-2.69 6-6 6c-1.66 0-3.17-.68-4.26-1.78l-.71.71A6.981 6.981 0 0 0 11.
2259418 17c3.87 0 7-3.13 7-7s-3.14-7-7-7z"></path></svg>ë±ì§ ëìì¸ ì´ê¸°í</div>\ 22595 </div>\ 22596 <div class="divTable">\ 22597 <div class="divTableHeading display-flex space-between align-items-center">\ 22598 <div class="divTableHead">ë±ì§</div>\ 22599 <div class="divTableHead">ì¤íì¼</div>\ 22600 <div class="divTableHead">문구</div>\ 22601 <div class="divTableHead">ì </div>\ 22602 <div class="divTableHead">ë°°ê²½</div>\ 22603 <div class="divTableHead">í ì¤í¸</div>\ 22604 </div>\ 22605 <div class="divTableBody">\ 22606 </div>\ 22607 </div>\ 22608 \ 22609 '; 22610 22611 // $('.modal-product-badge-wrap .return-prev-setting').on('click', function(){ 22612 // $('.divTableCell.product-badge-item input[type="checkbox"]').prop('checked', false); 22613 // $.each($.gallery.seqs, function(i,v) { 22614 // $.each(badgeArr, function(idx, type) { 22615 // var $badge = $('.table-item[data-seq="'+v+'"] .product-badge[data-type="'+type+'"]'); 22616 // var checked = ($badge.length > 0)? 'checked' : ''; 22617 // $('.divTableCell.product-badge-item[data-seq="'+v+'"] input.product-badge[data-type="'+type+'"]').prop('checked', checked); 22618 22619 // var badgeCnt = $('.table-item.ui-selected .product-badge[data-type="'+type+'"]').length; 22620 // if($.gallery.seqs.length == badgeCnt) { 22621 // $('.check-all[data-type="'+type+'"]').prop('checked', checked); 22622 // } 22623 // }); 22624 // }); 22625 22626 // var settings = localStorage.getItem('badge_settings'); 22627 // var before_settings = localStorage.getItem('before_badge_settings'); 22628 // $('.modal-product-badge').eq(0).addClass('return-prev'); 22629 // localStorage.setItem('badge_settings', before_settings); 22630 // $.badgeSettings.init($.parseJSON(before_settings)); 22631 22632 // // $.ajax({ 22633 // // type: 'POST', 22634 // // url: '/shopping/badge_design', 22635 // // data: { sid: SID, type: 'add', settings: before_settings, before_settings: settings }, 22636 // // dataType: 'json', 22637 // // async: true, 22638 // // success: function(data) { 22639 // // localStorage.setItem('badge_settings', before_settings); 22640 // // $.badgeSettings.init($.parseJSON(before_settings)); 22641 // // } 22642 // // }); 22643 // }); 22644 22645 $(document).off('click', '.modal-product-badge-wrap .change-badge-design'); 22646 $(document).on('click', '.modal-product-badge-wrap .change-badge-design', function(e){ 22647 e.stopPropagation(); 22648 if($('.cl-change-badge-design').length > 0) return false; 22649 var chBadgeModal = $(this).showModalFlat('', chBadgeDsgnContent, false, true, function(){ //confirm 22650 var before_settings = localStorage.getItem('before_badge_settings'); 22651 var input_data = new Object(); 22652 $('.badge-option-row').each(function(idx, v) { 22653 var key = $(v).attr('data-default'); 22654 input_data[key] = { 22655 'type': $(v).find('input[name="type"]').val(), 22656 'style': ($(v).find('input[name="type"]').val() == 'edit')? $(v).find('input[name="style"]').val() : '', 22657 'badge_text': $(v).find('input[name="badge_text"]').val(), 22658 'border_color': $(v).find('input[name="border_color"]').val(), 22659 'background_color': $(v).find('input[name="background_color"]').val(), 22660 'font_color': $(v).find('input[name="font_color"]').val(), 22661 'image_src': $(v).find('input[name="image_src"]').val(), 22662 'image_name': $(v).find('input[name="image_name"]').val(), 22663 }; 22664 }); 22665 var isReset = $('.cl-change-badge-design').hasClass('reset-design'); 22666 var route = (CONFIG_URL) ? '/_admin' : ''; 22667 $.ajax({ 22668 type: 'POST', 22669 url: route + '/shopping/badge_design', 22670 data: { sid: SID, type: 'add', settings: JSON.stringify(input_data), before_settings: before_settings, is_reset: isReset}, 22671 dataType: 'json', 22672 async: true, 22673 success: function(data) { 22674 if(Object.keys(data).length > 0) { 22675 // console.log(data); 22676 var badge_settings = data; 22677 $.badgeSettings.init(badge_settings); 22678 localStorage.setItem('badge_settings', JSON.stringify(badge_settings)); 22679 $('.modal-product-badge').eq(0).addClass('design-update'); 22680 $.gallery.update = true; 22681 } 22682 22683 chBadgeModal.modal('hide'); 22684 } 22685 }); 22686 }, '', '', 'cl-cmmodal cover cl-s-btn cl-p70 cl-p0 cl-edit-badge cl-change-badge-design modal-product-badge', true, '', function() { //show 22687 var badge_settings = $.parseJSON(localStorage.getItem('badge_settings')); 22688 var changeBadgeDsgnRow = $.badgeSettings.initDesign(badgeArr, badge_settings); 22689 $('.cl-change-badge-design .divTableBody').html(changeBadgeDsgnRow); 22690 $('.cl-change-badge-design .divTable').after('<div class="text-right">â» ë±ì§ ëìì¸ ë³ê²½ ì, 모ë ê°¤ë¬ë¦¬ ë¸ëì ë±ì§ ëìì¸ì ë°ìë©ëë¤.</div>'); 22691 22692 $('.cl-change-badge-design').closest('.modal-default').css('z-index', 1043); 22693 // $('.cl-change-badge-design').closest('.cl-common-modal').next('.modal-backdrop.fade.in').css('z-index', 1044); 22694 22695 $('.badge-option-row').each(function(idx, v){ 22696 if($(v).find('input[name="type"]').val() == 'edit') { 22697 var $badge = $(v).find('.product-badge'); 22698 var badgeBorderColor = style.getHex($badge.css('border-color'));
22699 var badgeBackgroundColor = style.getHex($badge.css('background-color')); 22700 var badgetextColor = style.getHex($badge.css('color')); 22701 22702 $(v).find('.color-picker-badge[pn="border-color"]').css('background-color', badgeBorderColor); 22703 $(v).find('.color-picker-badge[pn="background-color"]').css('background-color', badgeBackgroundColor); 22704 $(v).find('.color-picker-badge[pn="color"]').css('background-color', badgetextColor); 22705 } 22706 }); 22707 22708 $('input[name="badge_text"]').on({ 22709 focusout: function(){ 22710 $('.cl-change-badge-design').removeClass('reset-design'); 22711 // $('.modal-product-badge').eq(0).removeClass('return-prev'); 22712 22713 var badgeText = $(this).val().trim(); 22714 if(badgeText) $(this).closest('.badge-option-row').find('.product-badge').text(badgeText); 22715 }, 22716 keyup: function(e){ 22717 if(e.keyCode == 13) { 22718 $('.cl-change-badge-design').removeClass('reset-design'); 22719 // $('.modal-product-badge').eq(0).removeClass('return-prev'); 22720 22721 var badgeText = $(this).val().trim(); 22722 if(badgeText) $(this).closest('.badge-option-row').find('.product-badge').text(badgeText); 22723 } 22724 } 22725 }); 22726 22727 setBadgeColorPicker(); 22728 22729 //ë±ì§ ì¤íì¼ ë³ê²½ 22730 $(document).off('click', '.modal-product-badge-wrap .cl-change-badge-design .select-style-btn'); 22731 $(document).on('click', '.modal-product-badge-wrap .cl-change-badge-design .select-style-btn', function(){ 22732 var uploadedImgs = ''; 22733 if(localStorage.getItem('badge_imgs')) { 22734 var uploadedImgsArr = localStorage.getItem('badge_imgs').split('||'); 22735 // console.log(uploadedImgsArr); 22736 $.each(uploadedImgsArr, function(idx, v){ 22737 var img = v.split('::'); 22738 var src = (typeof img[1] != 'undefined') ? img[1] : img[0]; 22739 uploadedImgs += '\ 22740 <div class="select-badge user-upload hand">\ 22741 <span class="product-badge"><img src="'+src+'" alt="'+img[0]+'"></span>\ 22742 <span class="delete-badge"><svg viewBox="0 0 12 13" width="12" height="13" data-idx="0"><path d="M12 2h-1H9V0H3.02v2H1 0v1h1v8c0 1.1 0.9 2 2 2h6c1.1 0 2-0.9 2-2V3h1V2zM4.02 1H8v1H4.02V1zM10 11c0 0.55-0.45 1-1 1H3c-0.55 0-1-0.45-1-1V3h1.02H9h1V11z"></path><rect x="4" y="4" width="1" height="7"></rect><rect x="7" y="4" width="1" height="7"></rect></svg></span>\ 22743 </div>'; 22744 }); 22745 } 22746 var badgeStylePopup = '\ 22747 <div class="badge-style-popup">\ 22748 <div class="badge-style-header display-flex align-items-center space-between">\ 22749 <div class="badge-style-title">ì¤íì¼ ì í</div>\ 22750 <div class="modal-close hand"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path d="M8.71 8l7.15-7.15c0.2-0.2 0.2-0.51 0-0.71s-0.51-0.2-0.71 0L8 7.29 0.85 0.15c-0.2-0.2-0.51-0.2-0.71 0s-0.2 0.51 0 0.71L7.29 8l-7.15 7.15c-0.2 0.2
22750-0.2 0.51 0 0.71C0.24 15.95 0.37 16 0.5 16s0.26-0.05 0.35-0.15L8 8.71l7.15 7.15c0.1 0.1 0.23 0.15 0.35 0.15s0.26-0.05 0.35-0.15c0.2-0.2 0.2-0.51 0-0.71L8.71 8z"></path></svg></div>\ 22751 </div>\ 22752 <ul class="badge-type-tab display-flex align-items-center">\ 22753 <li class="hand active" data-tab="edit">í¸ì§í</li>\ 22754 <li class="hand" data-tab="image">ì´ë¯¸ì§í</li>\ 22755 </ul>\ 22756 <div class="badge-type-tab-content badge-tab-edit">\ 22757 <div class="badge-size-tab display-flex align-items-center">\ 22758 <span class="select-badge-size hand active" data-size="small">ìì</span>\ 22759 <span>·</span>\ 22760 <span class="select-badge-size hand" data-size="medium">ì¤ê°</span>\ 22761 <span>·</span>\ 22762 <span class="select-badge-size hand" data-size="large">í°</span>\ 22763 </div>\ 22764 <div class="select-badge-table display-flex" data-size="small">\ 22765 <div class="hand select-badge selected" data-style="default-1"><span class="product-badge default-1 small">NEW</span></div>\ 22766 <div class="hand select-badge" data-style="red-1"><span class="product-badge red-1 small">NEW</span></div>\ 22767 <div class="hand select-badge" data-style="blue-1"><span class="product-badge blue-1 small">NEW</span></div>\ 22768 <div class="hand select-badge" data-style="black-1"><span class="product-badge black-1 small">NEW</span></div>\ 22769 \ 22770 <div class="hand select-badge" data-style="default-2"><span class="product-badge default-2 small">NEW</span></div>\ 22771 <div class="hand select-badge" data-style="red-2"><span class="product-badge red-2 small">NEW</span></div>\ 22772 <div class="hand select-badge" data-style="blue-2"><span class="product-badge blue-2 small">NEW</span></div>\ 22773 <div class="hand select-badge" data-style="black-2"><span class="product-badge black-2 small">NEW</span></div>\ 22774 \ 22775 <div class="hand select-badge" data-style="default-3"><span class="product-badge default-3 small">NEW</span></div>\ 22776 <div class="hand select-badge" data-style="red-3"><span class="product-badge red-3 small">NEW</span></div>\ 22777 <div class="hand select-badge" data-style="blue-3"><span class="product-badge blue-3 small">NEW</span></div>\ 22778 <div class="hand select-badge" data-style="black-3"><span class="product-badge black-3 small">NEW</span></div>\ 22779 \ 22780 <div class="hand select-badge" data-style="default-4"><span class="product-badge default-4 small">NEW</span></div>\ 22781 <div class="hand select-badge" data-style="red-4"><span class="product-badge red-4 small">NEW</span></div>\ 22782 <div class="hand select-badge" data-style="blue-4"><span class="product-badge blue-4 small">NEW</span></div>\ 22783 <div class="hand select-badge" data-style="black-4"><span class="product-badge black-4 small">NEW</span></div>\ 22784 \ 22785 <div class="hand select-badge" data-style="default-5"><span class="product-badge default-5 small">NEW</span></div>\ 22786 <div class="hand select-badge" data-style="red-5"><span class="product-badge red-5 small">NEW</span></div>\ 22787 <div class="hand select-badge" data-style="blue-5"><span class="product-badge blue-5 small">NEW</span></div>\ 22788 <div class="hand select-badge" data-style="black-5"><span class="product-badge black-5 small">NEW</span></div>\ 22789 \ 22790 <div class="hand select-badge" data-style="default-6"><span class="product-badge default-6 small">NEW</span></div>\ 22791 <div class="hand select-badge" data-style="red-6"><span class="product-badge red-6 small">NEW</span></div>\ 22792 <div class="hand select-badge" data-style="blue-6"><span class="product-badge blue-6 small">NEW</span></div>\ 22793 <div class="hand select-badge" data-style="black-6"><span class="product-badge black-6 small">NEW</span></div>\ 22794 \ 22795 <div class="hand select-badge" data-style="red-7"><span class="product-badge red-7 small">NEW</span></div>\ 22796 <div class="hand select-badge" data-style="red-8"><span class="product-badge red-8 small">NEW</span></div>\ 22797 <div class="hand select-badge" data-style="red-9"><span class="product-badge red-9 small">NEW</span></div>\ 22798 <div class="hand select-badge" data-style="blue-7"><span class="product-badge blue-7 small">NEW</span></div>\ 22799 <div class="hand select-badge" data-style="blue-8"><span class="product-badge blue-8 small">NEW</span></div>\ 22800 <div class="hand select-badge" data-style="blue-9"><span class="product-badge blue-9 small">NEW</span></div>\ 22801 </div>\ 22802 </div>\ 22803 <div class="badge-type-tab-content badge-tab-image hide">\ 22804 <div class="select-badge-table display-flex">\ 22805 <div class="hand select-badge"><span class="product-badge"><img src="https://storage.googleapis.com/i.addblock.net/shopping_mall/badge/new.gif" alt="new.gif"></span></div>\ 22806 <div class="hand select-badge"><span class="product-badge"><img src="https://storage.googleapis.com/i.addblock.net/shopping_mall/badge/new_r.gif" alt="new_r.gif"></span></div>\ 22807 <div class="hand select-badge"><span class="product-badge"><img src="https://storage.googleapis.com/i.addblock.net/shopping_mall/badge/new_g.gif" alt="new_g.gif"></span></div>\ 22808 <div class="hand select-badge"><span class="product-badge"><img src="https://storage.googleapis.com/i.addblock.net/shopping_mall/badge/new_b.gif" alt="new_b.gif"></span></div>\ 22809 \ 22810 <div class="hand select-badge"><span class="product-badge"><img src="https://storage.googleapis.com/i.addblock.net/shopping_mall/badge/best.gif" alt="best.gif"></span></div>\ 22811 <div class="hand select-badge"><span class="product-badge"><img src="https://storage.googleapis.com/i.addblock.net/shopping_mall/badge/best_r.gif" alt="best_r.gif"></span></div>\ 22812 <div class="hand select-badge"><span class="product-badge"><img src="https://storage.googleapis.com/i.addblock.net/shopping_mall/badge/best_g.gif" alt="best_g.gif"></span></div>\ 22813 <div class="hand select-badge"><span class="product-badge"><img src="https://storage.googleapis.com/i.addblock.net/shopping_mall/badge/best_b.gif" alt="best_b.gif"></span></div>\ 22814 \ 22815 <div class="hand select-badge"><span class="product-badge"><img src="https://storage.googleapis.com/i.addblock.net/shopping_mall/badge/sale.gif" alt="sale.gif"></span></div>\ 22816 <div class="hand select-badge"><span class="product-badge"><img src="https://storage.googleapis.com/i.addblock.net/shopping_mall/badge/sale_r.gif" alt="sale_r.gif"></span></div>\ 22817 <div class="hand select-badge"><span class="product-badge"><img src="https://storage.googleapis.com/i.addblock.net/shopping_mall/badge/sale_g.gif" alt="sale_g.gif"></span></div>\ 22818 <div class="hand select-badge"><span class="product-badge"><img src="https://storage.googleapis.com/i.addblock.net/shopping_mall/badge/sale_b.gif" alt="sale_b.gif"></span></div>\ 22819 \ 22820 <div class="hand select-badge"><span class="product-badge"><img src="https://storage.googleapis.com/i.addblock.net/shopping_mall/badge/md.gif" alt="md.gif"></span></div>\ 22821 <div class="hand select-badge"><span class="product-badge"><img src="https://storage.googleapis.com/i.addblock.net/shopping_mall/badge/md_r.gif" alt="md_r.gif"></span></div>\ 22822 <div class="hand select-badge"><span class="product-badge"><img src="https://storage.googleapis.com/i.addblock.net/shopping_mall/badge/md_g.gif" alt="md_g.gif"></span></div>\ 22823 <div class="hand select-badge"><span class="product-badge"><img src="https://storage.googleapis.com/i.addblock.net/shopping_mall/badge/md_b.gif" alt="md_b.gif"></span></div>\ 22824 \ 22825 <div class="hand select-badge"><span class="product-badge"><img src="https://storage.googleapis.com/i.addblock.net/shopping_mall/badge/hot.gif" alt="hot.gif"></span></div>\ 22826 <div class="hand select-badge"><span class="product-badge"><img src="https://storage.googleapis.com/i.addblock.net/shopping_mall/badge/hot_g.gif" alt="hot_g.gif"></span></div>\ 22827 <div class="hand select-badge"><span class="product-badge"><img src="https://storage.googleapis.com/i.addblock.net/shopping_mall/badge/hot_b.gif" alt="hot_b.gif"></span></div>\ 22828 <div class="hand select-badge"><span class="product-badge"><img src="https://storage.googleapis.com/i.addblock.net/shopping_mall/badge/hit.gif" alt="hit.gif"></span></div>\ 22829 \ 22830 ' + uploadedImgs + '\ 22831 </div>\ 22832 <div class="upload-badge-image hand">ì´ë¯¸ì§ ì§ì ì¬ë¦¬ê¸°<svg viewBox="0 0 12 10" width="12" height="10"><polygon points="10 6 10 8 2 8 2 6 0 6 0 10 12 10 12 6 "></polygon><polygon points="10 3 7 3 7 0 5 0 5 3 2 3 6 7 "></polygon></svg></div>\ 22833 </div>\ 22834 <div class="badge-style-footer display-flex align-items-center">\
22835 <span class="hide">ê¶ì¥ ì´ë¯¸ì§ ëì´ : 20px ì´í</span>\ 22836 <ul class="display-flex align-items-center">\ 22837 <li class="modal-close hand">ì·¨ì</li>\ 22838 <li class="modal-save hand">ì ì¥</li>\ 22839 </ul>\ 22840 </div>\ 22841 </div>\ 22842 '; 22843 22844 $('.badge-style-popup').remove(); 22845 $(this).toggleClass('active'); 22846 if($(this).hasClass('active')) { 22847 $(this).after(badgeStylePopup); 22848 $.badgeSettings.initStylePopup($(this)); 22849 } 22850 }); 22851 22852 $('.modal-product-badge-wrap .cl-change-badge-design .return-default-design').on('click', function(e) { 22853 e.stopPropagation(); 22854 if($('.cl-reset-badge-design').length > 0) return false; 22855 var modal = $(this).showModalFlat('ë±ì§ ëìì¸ ì´ê¸°í', '모ë ê°¤ë¬ë¦¬ ë¸ë¡ì ì ì©ë ë±ì§ ëìì¸ì´ ì´ê¸°íë©ëë¤.<br>ì ë§ ì´ê¸°ííìê² ìµëê¹?', true, true, function(){ //confirm 22856 $('.badge-option-row').each(function(idx, v){ 22857 var $badge = $(v).find('.product-badge-view > .product-badge'); 22858 var defaultType = $(v).attr('data-default'); 22859 $badge.attr('class', 'product-badge default-1 small'); 22860 $badge.removeAttr('style'); 22861 $badge.html($.lang[LANG]['gallery.shopping.badge.'+defaultType]); 22862 22863 $(v).find('input[name="badge_text"]').prop('disabled', false); 22864 $(v).find('input[name="badge_text"]').val($.lang[LANG]['gallery.shopping.badge.'+defaultType]); 22865 $(v).find('input[name="type"]').val('edit'); 22866 $(v).find('input[name="style"]').val('default-1 small'); 22867 $(v).find('input[name="border_color"]').val('#bebebe'); 22868 $(v).find('input[name="background_color"]').val('#ffffff'); 22869 $(v).find('input[name="font_color"]').val('#000000'); 22870 $(v).find('input[name="image_src"]').val(''); 22871 $(v).find('input[name="image_name"]').val(''); 22872 22873 $(v).find('.color-picker-badge').removeClass('disabled'); 22874 $(v).find('.color-picker-badge[pn="border-color"]').css('background-color', '#bebebe'); 22875 $(v).find('.color-picker-badge[pn="background-color"]').css('background-color', '#ffffff'); 22876 $(v).find('.color-picker-badge[pn="color"]').css('background-color', '#000000'); 22877 }); 22878 $('.cl-change-badge-design').addClass('reset-design'); 22879 modal.modal('hide'); 22880 }, 'cancel', 'ok', 'cl-cmmodal cl-reset-badge-design cl-s-btn w560 cl-p70 cl-p0', false, '', function(){ //show 22881 $('.cl-reset-badge-design').closest('.modal-default').css('z-index', 1046); 22882 $('.cl-reset-badge-design').closest('.cl-common-modal').next('.modal-backdrop.fade.in').css('z-index', 1045); 22883 }); 22884 22885 }); 22886 22887 $(document).off('click', '.badge-style-popup .modal-save'); 22888 $(document).on('click', '.badge-style-popup .modal-save', function(){ 22889 var $selectedBadge = $('.badge-style-popup .badge-type-tab-content:not(.hide) .select-badge-table .select-badge.selected'); 22890 if($selectedBadge.length > 0) $.badgeSettings.handleSelection($selectedBadge); 22891 22892 $('.select-style-btn').removeClass('active'); 22893 $('.badge-style-popup').remove(); 22894 }); 22895 22896 $(document).off('click', '.badge-style-popup .modal-close'); 22897 $(document).on('click', '.badge-style-popup .modal-close', function(){ 22898 $('.select-style-btn').removeClass('active'); 22899 $('.badge-style-popup').remove(); 22900 }); 22901 22902 // $('.cl-change-badge-design .modal-body').off('click'); 22903 // $('.cl-change-badge-design .modal-body').on('click', function(e){ 22904 // if(!$(e.target).is('.select-style-btn') && $(e.target).closest('.badge-style-popup').length == 0) { 22905 // $('.select-style-btn').removeClass('active'); 22906 // $('.badge-style-popup').remove(); 22907 // } 22908 // }); 22909 22910 $(document).off('click', '.badge-type-tab > li'); 22911 $(document).on('click', '.badge-type-tab > li', function(){ //í¸ì§í, ì´ë¯¸ì§í í 22912 var optionIdx = $(this).closest('.badge-option-row').attr('data-idx'); 22913 var badgeText = $('.badge-option-row[data-idx="'+optionIdx+'"] input[name="badge_text"]').val(); 22914 var badgeType = $('.badge-option-row[data-idx="'+optionIdx+'"] input[name="type"]').val(); 22915 var badgeStyle = $('.badge-option-row[data-idx="'+optionIdx+'"] input[name="style"]').val(); 22916 var badgeStyleArr = badgeStyle.split(' '); 22917 var style = badgeStyleArr[0]; 22918 var size = badgeStyleArr[1]; 22919 22920 $('.badge-type-tab > li').removeClass('active'); 22921 $(this).addClass('active'); 22922 $('.badge-type-tab-content').addClass('hide'); 22923 $('.badge-style-popup .badge-style-footer > span').addClass('hide'); 22924 22925 $('.badge-tab-' + $(this).attr('data-tab')).removeClass('hide'); 22926 if($(this).attr('data-tab') == 'edit') { 22927 if(!style) style = 'default-1'; 22928 if(!size) { 22929 size = 'small'; 22930 $('.badge-size-tab .select-badge-size').removeClass('active'); 22931 $('.badge-size-tab .select-badge-size[data-size="'+size
22931+'"]').addClass('active'); 22932 $('.select-badge-table').attr('data-size', size); 22933 } 22934 if(!badgeText) badgeText = $.lang[LANG]['gallery.shopping.badge.'+ $(this).closest('.badge-option-row').attr('data-default')] 22935 $('.badge-style-popup .badge-tab-edit .select-badge .product-badge').html(badgeText); 22936 $('.badge-style-popup .badge-tab-edit .select-badge .product-badge').addClass(size); 22937 } else { 22938 $('.badge-style-popup .badge-style-footer > span').removeClass('hide'); 22939 $('.badge-style-popup .select-badge-table .product-badge').removeClass('small medium large'); 22940 } 22941 }); 22942 22943 $(document).off('click', '.badge-style-popup .badge-size-tab .select-badge-size'); 22944 $(document).on('click', '.badge-style-popup .badge-size-tab .select-badge-size', function() { //ë±ì§ ì¬ì´ì¦ í 22945 $('.badge-size-tab .select-badge-size').removeClass('active'); 22946 $(this).addClass('active'); 22947 22948 var badgeSize = $(this).attr('data-size'); 22949 $('.select-badge-table').attr('data-size', badgeSize); 22950 $('.select-badge-table .product-badge').removeClass('small medium large'); 22951 $('.select-badge-table .product-badge').addClass(badgeSize); 22952 }); 22953 22954 $(document).off('click', '.badge-style-popup .select-badge-table .select-badge'); 22955 $(document).on('click', '.badge-style-popup .select-badge-table .select-badge', function() { 22956 if($(this).find('.product-badge > img').attr('src') == '//storage.googleapis.com/i.addblock.net/icon_broken_img.png') { 22957 return false; 22958 } 22959 $('.badge-style-popup .select-badge-table .select-badge').removeClass('selected'); 22960 $(this).addClass('selected'); 22961 22962 // $.badgeSettings.handleSelection($(this)); 22963 }); 22964 22965 $(document).off('click', '.badge-style-popup .select-badge-table .select-badge .delete-badge'); 22966 $(document).on('click', '.badge-style-popup .select-badge-table .select-badge .delete-badge', function() { 22967 var $this = $(this); 22968 var modal = $(this).showModalFlat('ë±ì§ ì´ë¯¸ì§ ìì ', 'ì íí ì´ë¯¸ì§ë¥¼ ìì íìê² ìµëê¹?', true, true, function(){ //confirm 22969 var optionIdx = Number($this.closest('.badge-option-row').attr('data-idx')); 22970 var imgSrc = $this.closest('.select-badge').find('img').attr('src'); 22971 var imgName = $this.closest('.select-badge').find('img').attr('alt'); 22972 var beforeImgSrcArr = $('.badge-option-row input[name="image_src"]').map(function(idx, v){ 22973 return $(v).val(); 22974 }).get(); 22975 // console.log(optionIdx, imgSrc, beforeImgSrcArr); 22976 $this.closest('.select-badge').remove(); 22977 22978 var badgeImgsArr = new Array(); 22979 $('.badge-tab-image .select-badge-table .select-badge.user-upload .product-badge img').each(function(idx, v){ 22980 var imgData = (typeof $(v).attr('alt') != 'undefined' && $(v).attr('alt')) ? $(v).attr('alt') + '::' + $(v).attr('src') : $(v).attr('src');
22981 badgeImgsArr.push(imgData); 22982 }); 22983 // console.log('badgeImgsArr', badgeImgsArr); 22984 var badge_imgs = (badgeImgsArr.length > 0)? badgeImgsArr.join('||') : ''; 22985 var route = (CONFIG_URL) ? '/_admin' : ''; 22986 $.ajax({ 22987 type: 'POST', 22988 url: route + '/shopping/badge_design', 22989 data: { sid: SID, type: 'delete-image', settings: badge_imgs, file_name: imgName, }, 22990 dataType: 'json', 22991 async: true, 22992 success: function(data) { 22993 // console.log(data); 22994 localStorage.setItem('badge_imgs', badge_imgs); 22995 var imgIdx = beforeImgSrcArr.indexOf(imgSrc); 22996 22997 if(imgIdx > -1) { 22998 var badgeText = $('.badge-option-row[data-idx="'+imgIdx+'"] input[name="badge_text"]').val(); 22999 23000 if(imgIdx == optionIdx) { 23001 $('.badge-style-popup .select-badge-table .select-badge').removeClass('selected'); 23002 $('.badge-style-popup .badge-tab-edit .select-badge-table').attr('data-size', 'small'); 23003 $('.badge-style-popup .badge-tab-edit .select-badge-table .select-badge .product-badge').addClass('small'); 23004 $('.badge-style-popup .badge-tab-edit .select-badge-table .select-badge .product-badge').html(badgeText); 23005 23006 var defaultBadge = $('.badge-style-popup .badge-tab-edit .select-badge-table[data-size="small"] .select-badge[data-style="default-1"]'); 23007 defaultBadge.addClass('selected'); 23008 // console.log('defaultBadge', defaultBadge); 23009 $.badgeSettings.handleSelection(defaultBadge); 23010 } else { 23011 var badgeEL = $('<span class="product-badge default-1 small">' + badgeText + '</span>'); 23012 $('.badge-option-row[data-idx="'+imgIdx+'"] .product-badge-view').html(badgeEL); 23013 23014 $('.badge-option-row[data-idx="'+imgIdx+'"]').find('.color-picker-badge').removeClass('disabled'); 23015 $('.badge-option-row[data-idx="'+imgIdx+'"]').find('input[name="badge_text"]').prop('disabled', false); 23016 23017 $('.badge-option-row[data-idx="'+imgIdx+'"]').find('.color-picker-badge[pn="border-color"]').css('background-color', '#bebebe'); 23018 $('.badge-option-row[data-idx="'+imgIdx+'"]').find('.color-picker-badge[pn="background-color"]').css('background-color', '#ffffff'); 23019 $('.badge-option-row[data-idx="'+imgIdx+'"]').find('.color-picker-badge[pn="color"]').css('background-color', '#000000'); 23020 23021 $('.badge-option-row[data-idx="'+imgIdx+'"] input[name="type"]').val('edit'); 23022 $('.badge-option-row[data-idx="'+imgIdx+'"] input[name="style"]').val('default-1 small'); 23023 $('.badge-option-row[data-idx="'+imgIdx+'"] input[name="border_color"]').val('#bebebe'); 23024 $('.badge-option-row[data-idx="'+imgIdx+'"] input[name="background_color"]').val('#ffffff'); 23025 $('.badge-option-row[data-idx="'+imgIdx+'"] input[name="font_color"]').val('#000000'); 23026 $('.badge-option-row[data-idx="'+imgIdx+'"] input[name="image_src"]').val(''); 23027 $('.badge-option-row[data-idx="'+imgIdx+'"] input[name="image_name"]').val(''); 23028 } 23029 } 23030 } 23031 }); 23032 modal.modal('hide'); 23033 }, 'cancel', 'ok', 'cl-cmmodal cl-delete-badge-image cl-s-btn w560 cl-p70 cl-p0', false); 23034 }); 23035 $(document).on('click', '.upload-badge-image', function(){ 23036 setResourceBtn(true,{maxcount:0, property:'upload-badge-image', element:'.product-badge'}); 23037 }); 23038 23039 23040 }, function(){ //hide 23041 $('[data-toggle="popover"]').popover(); 23042 }); 23043 23044 $('.cl-change-badge-design .badge-setting-button > .modal-close').on('click', function() { 23045 chBadgeModal.modal('hide'); 23046 }); 23047 }); 23048 }, function(){ //hide 23049 $('[data-toggle="popover"]').popover(); 23050 }); 23051 23052 $('.modal-product-badge-wrap .badge-setting-header .modal-close').on('click', function() { 23053 badgeSettingModal.modal('hide'); 23054 if($(this).closest('.modal-product-badge').hasClass('design-update')) $.gallery.show($.gallery.block_id); 23055 }); 23056 23057 break; 23058 case "margin": 23059 var route = (CONFIG_URL) ? '/_admin' : ''; 23060 var firstItem = $('.gallery-items .table-item.ui-selected').eq(0), 23061 margin_rate = firstItem.find('.margin-info .rate').text().trim().replace(/[^0-9.]/g,'') * 1, 23062 margin_add = firstItem.find('.margin-info .add').text().trim().replace(/[^0-9.]/g,'') * 1, 23063 margin_seqs = $.gallery.seqs, 23064 margin_html = '\ 23065 <ul>\ 23066 <li>\
23067 <span class="title">ë§ì§ì¨</span>\ 23068 <span class="prod-margin-price cal-margin">\ 23069 <svg xmlns="http://www.w3.org/2000/svg" width="17" height="17" fill="currentColor" class="bi bi-plus-lg plus" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M8 2a.5.5 0 0 1 .5.5v5h5a.5.5 0 0 1 0 1h-5v5a.5.5 0 0 1-1 0v-5h-5a.5.5 0 0 1 0-1h5v-5A.5.5 0 0 1 8 2Z"/></svg>\ 23070 <input type="text" class="prod-user-margin input-margin" value="'+ margin_rate +'" numberOnly>%\ 23071 <svg xmlns="http://www.w3.org/2000/svg" width="17" height="17" fill="currentColor" class="bi bi-dash-lg minus" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M2 8a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11A.5.5 0 0 1 2 8Z"/></svg>\ 23072 </span>\ 23073 </li>\ 23074 <li>\ 23075 <span class="title">ë§ì§ê°</span>\ 23076 <span class="prod-margin-price cal-price">\ 23077 <svg xmlns="http://www.w3.org/2000/svg" width="17" height="17" fill="currentColor" class="bi bi-plus-lg plus" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M8 2a.5.5 0 0 1 .5.5v5h5a.5.5 0 0 1 0 1h-5v5a.5.5 0 0 1-1 0v-5h-5a.5.5 0 0 1 0-1h5v-5A.5.5 0 0 1 8 2Z"/></svg>\ 23078 <input type="text" class="prod-user-price input-margin" value="'+ addCommas(margin_add) +'" numberOnly>ì\ 23079 <svg xmlns="http://www.w3.org/2000/svg" width="17" height="17" fill="currentColor" class="bi bi-dash-lg minus" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M2 8a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11A.5.5 0 0 1 2 8Z"/></svg>\ 23080 </span>\ 23081 </li>\ 23082 </ul>\ 23083 '; 23084 23085 var marginModal = $(this).showModalFlat('ë§ì§ ì¤ì ', margin_html, true, true, function() { 23086 var new_mrate = marginModal.find('.prod-user-margin').val().trim().replace(/[^0-9.]/g,'') * 1, 23087 new_madd = marginModal.find('.prod-user-price').val().trim().replace(/[^0-9.]/g,'') * 1; 23088 $.processON(); 23089 setTimeout(function() { 23090 $.post(route + '/shopping/setMargin', {sid: SID, seqs: margin_seqs, rate: new_mrate, val: new_madd}, function(data) { 23091 if(typeof data.error != 'undefined' && data.error) { 23092 var marginError = $(this).showModalFlat('ERROR','ì¤í¨',true,false,'','close','','cl-cmmodal cl-s-btn w560 cl-p130 cl-p0'); 23093 marginModal.modal('hide'); 23094 return false; 23095 } 23096 23097 var changed_seqs = margin_seqs; 23098 $('.gallery-modal .table-item.ui-selected').each(function() { 23099 // if($.inArray($(this).attr('data-seq'), margin_seqs.i) > -1 || $.inArray($(this).attr('data-seq'), margin_seqs.u) > -1) { 23100 if($.inArray($(this).attr('data-seq'), data.list.edit) > -1) { 23101 var p_retail = $(this).find('.td-title .add-info .sale-rate').attr('data-retail').trim() * 1, 23102 p_supply = $(this).find('.td-title .add-info .margin-info .price').attr('data-supply').trim() * 1, 23103 tmp_cal = p_supply * (new_mrate/100), 23104 tmp_five = (tmp_cal - Math.floor(tmp_cal) == 0.5) ? true : false, 23105 tmp_r = (tmp_five) ? Math.floor(tmp_cal) : Math.round(tmp_cal), 23106 new_margin = tmp_r + new_madd, 23107 new_price = p_supply + new_margin, 23108 new_srate = (p_retail - new_price > 0) ? Math.floor((p_retail - new_price) / p_retail * 100) : 0; 23109 23110 var new_price_span = (new_price > 0) ? '<span class="price-val">' + addCommas(new_price) + 'ì</span>' : '<span class="price-val">-</span>', 23111 new_srate_span = (new_price < p_retail) ? 'í ì¸ì¨ <span class="rate">' + new_srate + '</span>%' : '', 23112 new_sale_span = (new_price < p_retail) ? '<span class="price-sale">' + addCommas(p_retail) + 'ì</span>' : ''; 23113 23114 var p_name = $(this).find('.td-title .item-title-str').text().trim(), 23115 p_seq = $(this).attr('data-seq'), 23116 pid = $(this).closest('.gallery-modal').attr('data-pid'), 23117 before_margin = '미ì§ì ', 23118 after_margin = 'ë§ì§ì¨ : ' + new_mrate + '% / ë§ì§ê° : ' + addCommas(new_madd) + 'ì'; 23119 23120 if($(this).find('.margin-info .rate').length > 0) { 23121 var old_mrate = $(this).find('.margin-info .rate').text().trim().replace(/[^0-9.]/g,'') * 1, 23122 old_madd = $(this).find('.margin-info .add').text().trim().replace(/[^0-9.]/g,'') * 1, 23123 before_margin = 'ë§ì§ì¨ : ' + old_mrate + '% / ë§ì§ê° : ' + addCommas(old_madd) + 'ì'; 23124 } 23125 var slog_obj = {'pname':p_name, 'seq':p_seq, 'pid':pid, 'supply_price': addCommas(p_supply)+'ì', 'before_margin':before_margin, 'margin':after_margin}; 23126 setSiteLogs('sh.product.edit','margin',slog_obj,'sh.config',p_seq); 23127 23128 $(this).attr('data-pcase','M'); 23129 $(this).find('.td-title .add-info .sale-rate').html(new_srate_span); 23130 $(this).find('.td-title .add-info .margin-info .rate').text(new_mrate); 23131 $(this).find('.td-title .add-info .margin-info .add').text(addCommas(new_madd)); 23132 $(this).find('.td-title .add-info .margin-info .price').text(addCommas(new_margin)); 23133 $(this).find('.td-price').html(new_price_span + new_sale_span); 23134 } 23135 23136 }); 23137 23138 $.processOFF(); 23139 marginModal.modal('hide'); 23140 23141 if(typeof data.list.error != 'undefined' && data.list.error.length > 0) { 23142 var error_msg = 'í매ê°ê° 10ìµì´ ëê² ì ì©ëë ì¼ë¶ ìí(ë¤)ì´ ì¡´ì¬í©ëë¤.<br>ë§ì§ ì¤ì ì ìµì¢ í매ê°ê° 10ìµ ì´íì ìíë¤ìë§ ì ì©ëê³ ,<br>10ìµì´ ëë ìíë¤ì ê°ê²© ëë ë§ì§ ì¤ì ì ì¬ ê²í í´ ì£¼ì¸ì.'; 23143 // var error_msg = (data.list.error.length == $.gallery.seqs.length) ? '문구ìì²1. ì í ìí ë§ì§ ë³ê²½ ë¶ê°. ê¸ì¡ 10ìµ ì´ì ì´ë¼ì' : '문구ìì²1. ì í ìí ì¤ ì¼ë¶ ìí ë§ì§ ë³ê²½ ë¶ê°. ê¸ì¡ 10ìµ ì´ì ì´ë¼ì'; 23144 $(this).showModalFlat('ë§ì§ ì¤ì ', error_msg, true, false, '', 'ok', '', 'cl-cmmodal cl-s-btn w560 cl-p70 cl-p0 cl-shopping-margin-error'); 23145 } 23146 23147 }, 'json'); 23148 }); 23149 } ,'cancel', 'ok', 'cl-cmmodal cl-s-btn w560 cl-p70 cl-p0 cl-shopping-margin','','',function(){ 23150 23151 $('.cl-shopping-margin .prod-margin-price > svg.bi').off('click').on({ 23152 click: function(e) { 23153 var margin_type = ($(this).closest('.prod-margin-price').hasClass('cal-margin')) ? 'margin' : 'price', 23154 marginInput = $(this).closest('.prod-margin-price').find('.prod-user-'+margin_type), 23155 isPlus = (($(this).attr('class')).indexOf('plus') > -1) ? true : false, 23156 margin = marginInput.val().trim(), 23157 r = Number(margin.replace(/[^0-9.]/g,'')); 23158 if(margin_type == 'margin') { 23159 r = (isPlus) ? r + 1 : r - 1; 23160 if(r < 0) r = 0; 23161 if(r > 100) r = 100; 23162 } else { 23163 r = (isPlus) ? r + 10000 : r - 10000; 23164 if(r < 0) r = 0; 23165 r = addCommas(r); 23166 } 23167 marginInput.val(r); 23168 } 23169 }); 23170 23171 $('.cl-shopping-margin .prod-user-margin, .cl-shopping-margin .prod-user-price').off('blur').on({ 23172 blur: function(e) { 23173 if($(this).val().trim() == '') $(this).val('0'); 23174 if($(this).hasClass('prod-user-margin')) {
23175 if(Number(removeCommas($('.prod-user-margin').val())) > 100) $(this).val('100'); 23176 } 23177 if($(this).hasClass('prod-user-price')) { 23178 if(Number(removeCommas($('.prod-user-price').val())) > 1000000000) $(this).val('1,000,000,000'); 23179 } 23180 } 23181 }); 23182 23183 }); 23184 break; 23185 case "stock" : 23186 setQuantity(); 23187 break; 23188 default: 23189 break; 23190 } 23191 }); 23192 $(document).on('click','.gallery-add-items', function(e) { 23193 if($(this).hasClass('disabled')) { 23194 ($(this).hasClass('gallery-need')) 23195 ? $(this).showModalFlat('ìë´', 'íë©´ ì¢ì¸¡ì ê°¤ë¬ë¦¬ 목ë¡ìì ê°¤ë¬ë¦¬ ì í í ìíì ì¶ê°í ì ììµëë¤.', true, false, '', 'ok','','cl-cmmodal cl-s-btn w560 cl-p130 cl-p0 cl-okbtn-pbt70') 23196 : $(this).showModalFlat('ìë´', 'ìíê´ë¦¬ë¥¼ ì¬ì©íë ¤ë©´ ì¼íê°¤ë¬ë¦¬ê° íìí©ëë¤.<br><a href="/config" style="text-decoration:underline;color:#4789e7;font-weight:600;">[í¸ì§ëª¨ë]</a>ìì ì¼í ê°¤ë¬ë¦¬ë¥¼ 먼ì ìì±íì¸ì', true, false, '', 'ok','','cl-cmmodal cl-s-btn w560 cl-p130 cl-p0 cl-okbtn-pbt70'); 23197 return false; 23198 } 23199 23200 var mode = $(this).attr('data-mode'); 23201 if(typeof mode == 'undefined' || !mode) { 23202 alert('Undefined gallery mode'); 23203 return false; 23204 } 23205 switch(mode) { 23206 case 'shopping' : $.products.add(-1); break; 23207 default: 23208 setResourceBtn(false,{maxcount:0}); 23209 selectID = $('.gallery-modal').attr('data-pid'); 23210 $.resource.open(); 23211 break; 23212 } 23213 }); 23214 $(document).on('blur','.item-title', function(e) { 23215 var title = $(this).val().trim(), 23216 s = $(this).attr('data-title'), 23217 seq = $(this).attr('data-seq'), 23218 caption = $(this).attr('data-caption'), 23219 hashtag = $(this).attr('data-hashtag'), 23220 category = $(this).attr('data-category'), 23221 datetime = $(this).attr('data-datetime'), 23222 thumb = $(this).attr('data-url'), 23223 file = (thumb.indexOf('googleusercontent') > -1) ? thumb : thumb.replace(/^.*[\\\/]/, ''), 23224 $gitem = $('.' + $.gallery.block_id).find('.gallery-item[data-seq="'+seq+'"]'), 23225 pathinfo = thumb.split('/'); 23226 23227 if($gitem.length == 0) { 23228 if($(this).parents('.gallery-modal').attr('data-mode')=='gallery') { 23229 $gitem = $('.gallery-popup').find('.gallery-item[data-seq="'+seq+'"]'); 23230 } 23231 } 23232 23233 if($('.' + $.gallery.block_id).attr('data-msny') == 'true') $.gallery.update = true; 23234 23235 if(title != s && title) { 23236 if(typeof seq == 'undefined' || !seq) { 23237 alert('Invalid item'); 23238 return false; 23239 } 23240 23241 $gitem.find('[data-gallery]').attr({'data-title':title}); 23242 if($('.gallery-items .item').length < 3) $('.gallery-popup').find('.gallery-item[data-seq="'+seq+'"]').find('[data-gallery]').attr({'data-title':title}); 23243 var type = 'ELEM', 23244 s = ''; 23245 if(pathinfo[4]!= 'free') s = 'false'; 23246 else { 23247 var p = pathinfo.slice(1,6); 23248 p.unshift(''); 23249 p.push(''); 23250 s = p.join('/'); 23251 } 23252 23253 $.post('/template/update/type/gallery',{ s: seq, id : SID, title : title, caption : caption, datetime : datetime, hashtag : hashtag, category : category, file : file, storage : s}, function(data) { 23254 var isCheck = checkError(data); 23255 if(!isCheck) return false;
23256 setLogs(type,'gallery.data.edit','modify',type,'product-manager','el'); 23257 }, 'json'); 23258 23259 (title.length>0) ? $gitem.find('h5.figure').html(title) : $gitem.find('h5.figure').text('Title'); 23260 $(this).attr({'value':title,'data-title':title}); 23261 } 23262 $('.gallery-items').selectable('enable'); 23263 }); 23264 $(document).on('click', '.prod-button .modal-save, .prod-detail-edit', function(e) { 23265 var hasEmoji = false; 23266 $('.prod-input, .prod-input-value').each(function() { 23267 var passEmoji = ($.inArray($(this).attr('id'),['prod-title', 'prod-desc']) > -1) ? true : false, 23268 check_val = ($(this).is('div')) ? $(this).text().trim() : $(this).val().trim(); 23269 23270 if(!passEmoji && checkEmojis(check_val)) { 23271 hasEmoji = true; 23272 return false; 23273 } 23274 }); 23275 if(hasEmoji) { 23276 e.preventDefault(); 23277 errorEmojisModal(); 23278 return false; 23279 } 23280 23281 var go = $(this).hasClass('prod-detail-edit') ? true : false; 23282 // var modal = $(this).showModalFlat('INFORMATION', 'í¸ì§í ë´ì© ì ì¥ ì ì¤ ì¬ì´í¸ìë ë°ìì´ ë©ëë¤.<br>ì ì¥ íìê² ìµëê¹?', true, true, function() { 23283 // modal.modal('hide'); 23284 $.products.save(go); 23285 // }); 23286 }); 23287 $(document).on('click', '.gallery-blocks .gallery-name[data-gallery-id]:not(.disabled)', function(e) { 23288 e.stopPropagation(); 23289 var id = $(this).attr('data-gallery-id'); 23290 if(typeof id == 'undefined') return false; 23291 $.gallery.block_id = id; 23292 $('#prod-pid').val(id); 23293 if(LUX) { 23294 setProductParams({'category_no' : $(this).attr('data-category')}); 23295 } 23296 clearLocalStorage(); 23297 $.gallery.show($.gallery.block_id); 23298 }); 23299 $(document).on('click','.gallery-items-loadmore', function(e) { 23300 var id = $(this).attr('data-pid'), 23301 page = Number($(this).attr('data-page')), 23302 cate_str = $(this).attr('data-category-str'); 23303 page++; 23304 $.gallery.list(id,page,cate_str); 23305 }); 23306 $(document).on('hover','.gallery-items .table-item', function(e) { 23307 if (e.type == "mouseenter") { 23308 if(!LUX && $('.gallery-modal').attr('data-pid') != undefined) $(this).find('.item-handle').show(); 23309 $(this).find('.item-edit').show(); 23310 } else { // mouseleave 23311 if(!LUX) $(this).find('.item-handle').hide(); 23312 $(this).find('.item-edit').hide(); 23313 $(this).find('.item-edit').find('.item-submenu').hide(); 23314 } 23315 }); 23316 $(document).on('click', '.gallery-modal .item-edit li', function(e) { 23317 $('.item-submenu').hide(); 23318 $('.submenu').removeClass('open'); 23319 var $submenu = $(this).find('.item-submenu'), 23320 display = $submenu.css('display'); 23321 (display == 'none') ? $submenu.css('display','block') : $submenu.css('display','none'); 23322 return; 23323 }); 23324 $(document).on('click', '.gallery-modal .product-item-edit li', function(e) { 23325 var group = ($('.table-item').length) ? '.table-item' : '.gallery-items .item'; 23326 var mode = $(this).attr('data-mode'), 23327 seq = $(this).parent().attr('data-seq'), 23328 // page = $('.gallery-modal').attr('data-page'), 23329 page = $(group).attr('data-page'), 23330 config_url = (CONFIG_URL) ? '_config' : 'config'; 23331 if(typeof seq == 'undefined' || seq == '' || typeof page == 'undefined' || page == '') { 23332 alert('Undefined product seq or page!'); 23333 return false;
23334 } 23335 page = encodeURIComponent(page); 23336 if(mode == 'prodInfo') { 23337 $.gallery.item_of_page = $(this).parents('.table-item').attr('data-page'); 23338 $.products.add(seq); 23339 } else { 23340 if(LUX) page = '_product'; 23341 // location.href = '/'+config_url+'/page/'+page+'/view/'+seq; 23342 $.detail.open('/'+config_url+'/page/'+page+'/view/'+seq, mode); 23343 } 23344 }); 23345 $(document).on('click', '.td-check input[type="checkbox"]', function(e) { 23346 e.stopPropagation(); 23347 var seq = $(this).parents('.table-item').attr('data-seq'), 23348 seq_idx = ($.gallery.seqs).indexOf(seq), 23349 disabled = false, visible_button = false, no_price = false; 23350 // disabled = ($(this).parents('.table-item').attr('data-product') == "false") ? true : false; 23351 23352 if($(this).is(':checked')) { 23353 $(this).parents('.table-item').addClass('ui-selected return'); 23354 if(typeof seq != 'undefined') 23355 $.gallery.seqs.push(seq); 23356 $('.gallery-toolbar').addClass('hide_col'); 23357 } else { 23358 if(seq_idx > -1) ($.gallery.seqs).splice(seq_idx,1); 23359 $(this).parents('.table-item').removeClass('ui-selected return'); 23360 if($.gallery.seqs.length == 0) $('.gallery-toolbar').removeClass('hide_col'); 23361 } 23362 stickyToolbar(); 23363 23364 $.each($('.gallery-items .table-item.ui-selected'), function(i,v) { 23365 if($(this).attr('data-product') == "false") disabled = true; 23366 if($(this).attr('data-out-datetime') == "1") visible_button = true; 23367 if($(this).attr('data-pricechk') == "false") no_price = true; 23368 }); 23369 23370 $('.gallery-items .table-item > div').addClass('hide-text'); 23371 $('.table-toolbar > li').removeClass('open').find('.item-submenu').hide(); 23372 $('.gallery-view-count').removeClass('open').find('.view-submenu').hide(); 23373 23374 if($('.gallery-items .table-item.ui-selected').length == 0) { 23375 $.gallery.seqs = []; 23376 $('.gallery-toolbar').removeClass('hide_col'); 23377 $('.gallery-items .table-item > div').removeClass('hide-text'); 23378 $('.table-toolbar .toolbar-cmd').addClass('hide'); 23379 $('.table-toolbar .toolbar-cmd i[data-glseq]').attr('data-glseq',''); 23380 $('.table-toolbar .toolbar-cmd i[data-cmd="link"]').attr('data-glink','').attr('data-glink-target',''); 23381 $('.table-toolbar .toolbar-cmd i[data-cmd="visible"]').attr('data-visible','0').text($.lang[LANG]['editor.gallery.icon.visible.off']); 23382 $('.gallery-toolbar').addClass('hide'); 23383 $('.gallery-items .item-header').removeClass('hide'); 23384 } else { 23385 var firstItem = $('.gallery-items .table-item.ui-selected').eq(0), 23386 first_seq = firstItem.attr('data-seq'), 23387 link = firstItem.attr('data-link'), 23388 target = firstItem.attr('data-target'), 23389 visible = firstItem.attr('data-visible'), 23390 vstr = (visible == '1') ? $.lang[LANG]['editor.gallery.icon.visible.on'] : $.lang[LANG]['editor.gallery.icon.visible.off']; 23391 if(visible_button) { 23392 $('.table-toolbar .toolbar-cmd.toolbar-visible').addClass('disabled'); 23393 } else $('.table-toolbar .toolbar-cmd.toolbar-visible').removeClass('disabled'); 23394 if($.gallery.block_id == -1) { 23395 $('.table-toolbar .toolbar-cmd.toolbar-copy').addClass('disabled'); 23396 } 23397 $('.table-toolbar .toolbar-cmd').removeClass('hide'); 23398 $('.table-toolbar .toolbar-cmd i[data-glseq]').attr('data-glseq',first_seq); 23399 $('.table-toolbar .toolbar-cmd i[data-cmd="link"]').attr('data-glink',link).attr('data-glink-target',target); 23400 $('.table-toolbar .toolbar-cmd i[data-cmd="visible"]').attr('data-visible',visible).text(vstr); 23401 $('.gallery-toolbar').removeClass('hide'); 23402 $('.gallery-items .item-header').addClass('hide'); 23403 } 23404 (no_price) ? $('.product-cmd').not('.toolbar-org-price').not('.toolbar-stock').addClass('no_price') : $('.product-cmd').removeClass('no_price'); 23405 (disabled) ? $('.product-cmd').addClass('disabled') : $('.product-cmd').removeClass('disabled'); 23406 if($('.gallery-modal').attr('data-pid') == undefined) { 23407 $('.toolbar-sort.item-sort').addClass('disabled'); 23408 } 23409 if($('.gallery-modal .table-item').length == $('.gallery-modal .table-item .td-input:checked').length) $('.table-toolbar .check-all').prop('checked', true); 23410 $.gallery.setNumber(); 23411 }); 23412 $(document).on('change','.category-onoff-check', function(e) { 23413 var gc = $(this).prop('checked'), 23414 g_category_onoff = (gc) ? 'ON' : 'OFF', 23415 settings = { 23416 category_display : g_category_onoff 23417 }; 23418 $.gallery.update = true; 23419 if(gc) { 23420 $('.gallery-category-menu').removeClass('hide'); 23421 $('.category-title-str').addClass('on'); 23422 $('.td-category').removeClass('hide'); 23423 } else { 23424 $('.gallery-category-menu').addClass('hide'); 23425 $('.category-title-str').removeClass('on'); 23426 $('.td-category').addClass('hide'); 23427 } 23428 $.post('/template/settings', {sid: SID, settings : JSON.stringify(settings), el: $.gallery.block_id}, function(data) { 23429 checkError(data); 23430 $.gallery.show($.gallery.block_id); 23431 }, 'json'); 23432 23433 var type = (typeof selectEL != 'undefined') ? getElementType() : 'ELEM'; 23434 setLogs(type,'gallery.category.' + gc,'toggle-' + gc, type,'product-manager','el'); 23435 }); 23436 $(document).on('click','.toolbar-category ul.item-submenu li', function(e) { 23437 if(($.gallery.seqs).length) { 23438 $(this).toggleClass('active'); 23439 var click_cate = $(this).text(), 23440 cate_str = $('.toolbar-category ul.item-submenu li.active').map(function() { return $(this).text(); }).get(), 23441 text_str = cate_str.join(), 23442 data_str = '|' + text_str.replace(/\,/g,'|,|') + '|'; 23443 23444 $.each($.gallery.seqs, function(i,v) { 23445 if($('.gallery-modal').hasClass('shopping')) { 23446 $('.table-item[data-seq="' + v + '"]').attr('data-category', data_str).find('.td-category').text(text_str).attr('data-original-title',text_str); 23447 23448 if(text_str.indexOf(',') > -1) $('.table-item[data-seq="' + v + '"] .td-category').addClass('line'); 23449 else $('.table-item[data-seq="' + v + '"] .td-category').removeClass('line'); 23450 } else { 23451 $('.gallery-items .item[data-seq="' + v + '"]').attr('data-category', data_str).find('.td-category').text(text_str); 23452 } 23453 23454 $.post('/template/gallery/category', { sid : SID, s : cate_str, mode : 'gallery', seq : v }, function(r) { 23455 23456 if($('.element[data-id="' + $.gallery.block_id + '"] .gallery-category-nav li:nth-child(1)').hasClass('hide')) { 23457 if($('.element[data-id="' + $.gallery.block_id + '"] .gallery-category-nav li.active a').text() == click_cate) { 23458 $.gallery.update = true; 23459 } 23460 } 23461 23462 }, 'json'); 23463 }); 23464 } 23465 }); 23466 $(document).on('click','.toolbar-sort ul.item-submenu li', function(e) { 23467 if(($.gallery.seqs).length) { 23468 var group = ($('.table-item').length) ? '.table-item' : '.gallery-items .item'; 23469 $.gallery.move = $.gallery.seqs; 23470 if($(this).hasClass('sort-top')) { 23471 $.gallery.drag = $(group).first().attr('data-seq'); 23472 // $.gallery.seqs = []; 23473 var modal = $(this).showModalFlat($.lang[LANG]['config.gallery.order.move'],$.lang[LANG]['editor.gallery.move'],true,true,function() { 23474 modal.modal('hide'); 23475 // $.gallery.mv(); 23476 var spos = $('.gallery-modal').scrollTop(); 23477 $.processON('move gallery item(s)...'); 23478 $.ajax({ 23479 url: '/template/gallery/sort-top', 23480 data: { sid : SID, seq : $.gallery.seqs, block_id : $.gallery.block_id }, 23481 dataType: 'json', 23482 type: 'POST', 23483 async: false, 23484 cache: false, 23485 success: function (data) { 23486 checkError(data); 23487 var p = $.gallery.pages; 23488 $.gallery.show($.gallery.block_id,p.page,$.gallery.category, function() { 23489 $.each(data.seqs, function(i,v) { 23490 $(group + '[data-seq="' + v + '"]').addClass('return'); 23491 }); 23492 setTimeout(function() { 23493 $('.gallery-modal').scrollTop(spos); 23494 $.processOFF(); 23495 }, 500); 23496 }); 23497 $.gallery.update = true; 23498 $.gallery.reset(); 23499 $.processOFF(); 23500 } 23501 }); 23502 }, 'cancel','ok','cl-cmmodal cl-s-btn w560 cl-p130 cl-p0',false, function() { 23503 // cancel callback 23504 $.gallery.seqs = $.gallery.move; 23505 }); 23506 } else if($(this).hasClass('sort-bottom')) { 23507 if($('.gallery-items-loadmore').length == 0) {
23508 var last = $(group).last().attr('data-seq'); 23509 if($.gallery.seqs[0] == last) { 23510 var s = (group == '.gallery-items .item') ? $.lang[LANG]['editor.gallery.select.front.last.1'] : $.lang[LANG]['editor.gallery.select.front.last.2'], 23511 contents2_str = (LANG =='ko') ? $.lang[LANG]['editor.gallery.select.contents.2'] : ''; 23512 23513 $(this).showModalFlat($.lang[LANG]['config.gallery.order.move'], $.lang[LANG]['editor.gallery.select.contents.1'] + s + contents2_str, true, false, '', 'ok','','cl-cmmodal cl-s-btn w560 cl-p130 cl-p0 cl-okbtn-pbt70'); 23514 return false; 23515 } 23516 } 23517 23518 var modal = $(this).showModalFlat($.lang[LANG]['config.gallery.order.move'],$.lang[LANG]['editor.gallery.move'],true,true,function() { 23519 var item = $(group).length, 23520 cpage = Math.ceil(item/30), 23521 spos = $('.gallery-modal').scrollTop(); 23522 23523 modal.modal('hide'); 23524 $.processON('move gallery item(s)...'); 23525 $.ajax({ 23526 url: '/template/gallery/sort-bottom', 23527 data: { sid : SID, seq : $.gallery.seqs, block_id : $.gallery.block_id }, 23528 dataType: 'json', 23529 type: 'POST', 23530 async: false, 23531 cache: false, 23532 success: function (data) { 23533 checkError(data); 23534 var p = $.gallery.pages; 23535 $.gallery.show($.gallery.block_id,p.page,$.gallery.category, function() { 23536 $.each(data.seqs, function(i,v) { 23537 $(group + '[data-seq="' + v + '"]').addClass('return'); 23538 }); 23539 setTimeout(function() { 23540 $('.gallery-modal').scrollTop(spos); 23541 $.processOFF(); 23542 }, 500); 23543 }); 23544 $.gallery.update = true; 23545 $.gallery.reset(); 23546 $.processOFF(); 23547 } 23548 }); 23549 }, 'cancel','ok','cl-cmmodal cl-s-btn w560 cl-p130 cl-p0', false, function() { 23550 // cancel callback 23551 $.gallery.seqs = $.gallery.move; 23552 }); 23553 } 23554 } 23555 }); 23556 $(document).on('click','.view-submenu li', function(e) { 23557 $.processON(); 23558 23559 var view = (typeof $(this).attr('data-view') != 'undefined' && $(this).attr('data-view')) ? $(this).attr('data-view') : 30; 23560 23561 window.localStorage.setItem('gallery-product-view',view); 23562 $.gallery.show($.gallery.block_id,'',$.gallery.category,function() { 23563 setTimeout(function() { 23564 $.processOFF(); 23565 }, 500); 23566 }); 23567 }); 23568 $(document).on('click', '.gallery-modal .edit-gallery-detail', function(e) { 23569 var seq = $(this).attr('data-seq'), 23570 mode = $(this).attr('data-mode'); 23571 var page = $('.gallery-modal').attr('data-page'); 23572 var config_url = (CONFIG_URL) ? '_config' : 'config'; 23573 if(typeof seq == 'undefined') return; 23574 // location.href = '/'+config_url+'/page/' + page + '/view/' + seq; 23575 $.detail.open('/'+config_url+'/page/' + page + '/view/' + seq, 'gallery'); 23576 }); 23577 $(document).on('click','.gallery-name-edit', function(e) { 23578 e.stopPropagation(); 23579 $('.gallery-name-edit-input').remove(); 23580 var v = $(this).parents('.gallery-name').text(), 23581 s = '<div class="gallery-name-edit-input"><input type="text" class="gallery-name-edit-inputbox" value="' + v.trim() + '" maxlength="20"><div class="gallery-name-edit-close"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 12"><polygon points="12 0.71 11.29 0 6 5.29 0.71 0 0 0.71 5.29 6 0 11.29 0.71 12 6 6.71 11.29 12 12 11.29 6.71 6 "/></svg></div><div class="gallery-name-edit-save"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 10"><path d="M14.29 0L5.5 8.79 0.71 4 0 4.71l5.15 5.15C5.24 9.95 5.37 10 5.5 10s0.26-0.05 0.35-0.15L15 0.71 14.29 0z"/></svg></div></div>'; 23582 $(this).parents('.gallery-name').append(s); 23583 }); 23584 $(document).on('click','.gallery-name-edit-inputbox',function(e) { 23585 e.stopPropagation(); 23586 }); 23587 $(document).on('keypress', '.gallery-name-edit-inputbox', function(e) { 23588 var keyCode = e.keyCode, 23589 blockname = $(this).val().trim(); 23590 23591 if(keyCode == 13) { 23592 saveGalleryBlockName($(this), blockname); 23593 } 23594 }); 23595 $(document).on('click','.gallery-name-edit-save',function(e) { 23596 e.stopPropagation(); 23597 var blockname = $('.gallery-name-edit-inputbox').val().trim(), 23598 $input = $('.gallery-name-edit-inputbox'); 23599 23600 if(checkEmojis(blockname)) { 23601 e.preventDefault(); 23602 var open_el = $(this).closest('.gallery-blocks').find('.btn-group'), 23603 focus_el = $(this).closest('.gallery-name-edit-input').find('.gallery-name-edit-inputbox'); 23604 errorEmojisModal('','','',function() { 23605 open_el.addClass('open'); 23606 focus_el.focus(); 23607 }); 23608 return false;
23609 } 23610 saveGalleryBlockName($input, blockname); 23611 }); 23612 $(document).on('click','.gallery-name-edit-close',function(e) { 23613 e.stopPropagation(); 23614 $(this).parents('.gallery-name-edit-input').remove(); 23615 }); 23616 }, 23617 cp : function() { 23618 var seqs = $.gallery.copy, 23619 page = $('.gallery-modal').attr('data-page'), 23620 pid = $('.gallery-modal').attr('data-pid'); 23621 23622 seqs = seqs.reverse(); 23623 if(typeof seqs.length == 0 || seqs == '') { 23624 alert('Invalid variable'); 23625 return false; 23626 } 23627 var modal = $(this).showModalFlat($.lang[LANG]['editor.gallery.clone.title'],($.gallery.mode == 'shopping' ? $.lang[LANG]['editor.gallery.shoppingclone' + (LUX ? '.lux' : '')] : $.lang[LANG]['editor.gallery.clone']),true,true,function() { 23628 var count = seqs.length; 23629 23630 modal.modal('hide'); 23631 var group = ($('.table-item').length) ? '.table-item' : '.gallery-items .item', 23632 item = $(group).length, 23633 cpage = Math.ceil(item/30), 23634 spos = $('.gallery-modal').scrollTop(); 23635 23636 $.processON('copy gallery item(s)...'); 23637 // console.log('ModalPlugin cp '); 23638 // console.log(seqs); 23639 $.ajax({ 23640 url: '/template/gallery/copy', 23641 data: { s: seqs, sid : SID, page : page, block_id : $.gallery.block_id }, 23642 dataType: 'json', 23643 type: 'POST', 23644 async: true, 23645 cache: false, 23646 success: function (data) { 23647 checkError(data); 23648 // console.log(data); 23649 galleryStatusInit(); 23650 $.gallery.copy = []; 23651 var type = (typeof selectEL != 'undefined') ? getElementType() : 'ELEM'; 23652 setLogs(type,'gallery.item.clone','clone',type,'product-manager','el'); 23653 23654 $.gallery.show($.gallery.block_id,cpage,$.gallery.category,function() { 23655 $.each(data.r, function(i,v) { 23656 // console.log(v.seq); 23657 $(group + '[data-seq="' + v.seq + '"]').addClass('return'); 23658 }); 23659 setTimeout(function() { 23660 $('.gallery-modal').scrollTop(spos); 23661 $.processOFF(); 23662 }, 500); 23663 }); 23664 23665 $.gallery.update = true; 23666 } 23667 }); 23668 }, 'cancel','ok','cl-cmmodal cl-s-btn w560 cl-p130 cl-p0'); 23669 }, 23670 mv : function(func) { 23671 var seqs = $.gallery.move, 23672 page = $('.gallery-modal').attr('data-page'); 23673 // seqs = seqs.reverse(); 23674 if(typeof seqs.length == 0 || seqs == '') { 23675 alert('Invalid variable'); 23676 return false; 23677 } 23678 clicking = false; 23679 var group = ($('.table-item').length) ? '.table-item' : '.gallery-items .item'; 23680 23681 if($.gallery.drag) { 23682 if(($.gallery.drag == seqs[0] || 23683 $.gallery.drag == $(group + '[data-seq="' + seqs[0] + '"]').next().attr('data-seq')) || 23684 $.gallery.drag == $(group + '[data-seq="' + seqs[0] + '"]').next().hasClass('prev')) { 23685 if($('.clone-item').length) { 23686 $('.clone-item').remove(); 23687 // $.gallery.seqs = []; 23688 return false; 23689 } else { 23690 if($('.item-sort').hasClass('open')) { 23691 var s = (group == '.gallery-items .item') ? $.lang[LANG]['editor.gallery.select.front.first.1'] : $.lang[LANG]['editor.gallery.select.front.first.2'], 23692 contents2_str = (LANG =='ko') ? $.lang[LANG]['editor.gallery.select.contents.2'] : ''; 23693 $.gallery.seqs = $.gallery.move; 23694 $(this).showModalFlat($.lang[LANG]['config.gallery.order.move'], $.lang[LANG]['editor.gallery.select.contents.1'] + s + contents2_str, true, false, '', 'ok','','cl-cmmodal cl-s-btn w560 cl-p130 cl-p0 cl-okbtn-pbt70'); 23695 return false;
23696 } 23697 } 23698 } 23699 } 23700 var count = seqs.length, 23701 selected = $.gallery.drag; 23702 23703 var item = $(group).length 23704 cpage = Math.ceil(item/30), 23705 spos = $('.gallery-modal').scrollTop(); 23706 23707 // modal.modal('hide'); 23708 $.processON('move gallery item(s)...'); 23709 $.ajax({ 23710 url: '/template/gallery/move', 23711 data: { s: seqs, sid : SID, page : page, block_id : $.gallery.block_id, selected : selected, last : $.gallery.last }, 23712 dataType: 'json', 23713 type: 'POST', 23714 async: true, 23715 cache: false, 23716 success: function (data) { 23717 checkError(data); 23718 $.gallery.update = true; 23719 $.gallery.drag = ''; 23720 $.gallery.last = ''; 23721 if(typeof func == 'function') { 23722 func(); 23723 } else { 23724 $.gallery.show($.gallery.block_id,cpage,$.gallery.category, function() { 23725 $.each(data.seqs, function(i,v) { 23726 $(group + '[data-seq="' + v + '"]').addClass('return'); 23727 }); 23728 setTimeout(function() { 23729 $('.gallery-modal').scrollTop(spos); 23730 $.processOFF(); 23731 }, 500); 23732 }); 23733 } 23734 23735 } 23736 }); 23737 }, 23738 del : function() { 23739 var seqs = $.gallery.delete, 23740 page = $('.gallery-modal').attr('data-page'), 23741 pid = $('.gallery-modal').attr('data-pid'), 23742 total = seqs.length, 23743 title = (LANG == 'ko') ? 'ê°¤ë¬ë¦¬ ë°ì´í°ë¥¼ ìì ì¤ì ëë¤...' : 'Deleting gallery data...', 23744 sub_des = (LANG == 'ko') ? 'ë°ì´í°ë¥¼ ìì ì¤ì ëë¤' : 'Deleting', 23745 loading = '<i class="fa fa-circle-o-notch fa-spin fa-3x fa-fw"></i> '; 23746 23747 if(typeof seqs.length == 0 || seqs == '') { 23748 alert('Invalid variable'); 23749 return false; 23750 } 23751 var modal = $(this).showModalFlat($.lang[LANG]['config.delete'],$.lang[LANG]['editor.gallery.selected.1'] + (seqs.length) + $.lang[LANG]['editor.gallery.selected.2'] + $.lang[LANG]['editor.gallery.selected.delete'],true,true, function() { 23752 var count = seqs.length; 23753 modal.modal('hide'); 23754 $.progressON(title); 23755 23756 var group = ($('.table-item').length) ? '.table-item' : '.gallery-items .item', 23757 item = $(group).length, 23758 item = ((item - count) < 0) ? 1 : item - count, 23759 cpage = Math.ceil(item/30), 23760 spos = $('.gallery-modal').scrollTop(), 23761 done = 0, 23762 pid = $('.gallery-modal').attr('data-pid'), 23763 mode = $('.gallery-modal').attr('data-mode'); 23764 23765 $.each(seqs, function(i,v) { 23766 $(group + '[data-seq="' + v + '"]').fadeOut(100, function() { $(this).remove(); }); 23767 23768 var t = setTimeout(function() { 23769 if(CANCEL) { 23770 if(ABORT) { 23771 // 리ì¤í¸ ê°±ì ìì 23772 $.gallery.show($.gallery.block_id,cpage,$.gallery.category, function() { 23773 setTimeout(function() { 23774 $.gallery.move = []; 23775 $('.gallery-modal').scrollTop(spos); 23776 $.processOFF(); 23777 }, 500); 23778 }); 23779 ABORT = false; 23780 $.progressOFF(); 23781 } 23782 i=0; return false; 23783 } 23784 galleryDeleteItem(v,function(data) { 23785 done++; 23786 progress = parseInt((done / total) * 100,10); 23787 $('.file-upload-progress .progress-bar').
23787css('width',progress + "%"); 23788 $('.progressModal .info2').text(done.toString() + ' / ' + total.toString()); 23789 23790 var d = data.data; 23791 $.each(d, function(i,o) { 23792 blockBookmarkDelete(o.sid,o.seq); 23793 }); 23794 23795 glItemDelete(v,page); 23796 if(v==VIEW) $.gallery.unlink = true; 23797 23798 if(total == done) { 23799 var type = getElementType(); 23800 setLogs(type,'gallery.item.delete','delete',type,'product-manager','el'); 23801 $.gallery.reset(); 23802 $.gallery.update = true; 23803 23804 $.gallery.show($.gallery.block_id,cpage,$.gallery.category, function() { 23805 setTimeout(function() { 23806 $.gallery.move = []; 23807 $('.gallery-modal').scrollTop(spos); 23808 $.progressOFF(); 23809 }, 500); 23810 }); 23811 } else { 23812 moving = $(group + '[data-seq="' + seqs[i+1] + '"] .td-title .item-title-str').text(); 23813 if(moving == "") moving = sub_des; 23814 $('.progressModal .info1').html(loading + moving); 23815 } 23816 }); 23817 },500*i); 23818 }); 23819 }, 'cancel', 'ok', 'cl-cmmodal cl-s-btn w560 cl-p130 cl-p0'); 23820 }, 23821 show : function(id,page,category,func) { 23822 // if(typeof id == 'undefined' || !id) { 23823 // alert('Undefined gallery ID'); 23824 // return false; 23825 // } 23826 23827 if(typeof page =='undefined' || !page) page = 1; 23828 if(typeof category =='undefined') category = ''; 23829 if(typeof id == 'undefined') id = ''; 23830 // var params = ($('.gallery-modal').length) ? getProductParams() : getSearchURL(); 23831 23832 var params = getProductParams(), 23833 product_name = getStorageItem('gallery-product-name'), 23834 product_filter = getStorageItem('gallery-product-filter'), 23835 product_view = getStorageItem('gallery-product-view'), 23836 sort = getStorageItem('gallery-product-sort'), 23837 by = getStorageItem('gallery-product-by'), 23838 manager = (id == '' || id == -1) ? SID : ''; 23839 23840 $.gallery.seqs = []; 23841 $.gallery.block_id = (id == '') ? -1 : id; 23842 $.gallery.category = category; 23843 $.processON(); 23844 $.ajax({ 23845 type: 'POST', 23846 url : '/template/gallery/show', 23847 data : { mode : 'show', id : id, page : page, category : category, params : params, manager : manager, product_name : product_name, product_filter : product_filter, product_view : product_view, sort : sort, by : by }, 23848 dataType : 'json', 23849 async: true, 23850 cache: false, 23851 success : function(data) { 23852 $.processOFF(); 23853 if(LUX && data.mode == 'shopping' && params) { 23854 setProductParams(params); 23855 } 23856 if(data.error != 'undefined' && data.error) { 23857 alert(data.error); 23858 return false; 23859 } 23860 $.gallery.site_settings = data.settings; 23861 // premium block 23862 if( !$('#el-blockConfig').hasClass('open') && 23863 $('.element[data-id="' + $.gallery.block_id + '"][data-type="gallery"] input.gjs').length > 0 23864 ) { 23865 stopGalleryJS($('.element[data-id="' + $.gallery.block_id + '"]')); 23866 } 23867 23868 $.gallery.mode = data.mode; 23869 $.gallery.SMENU = data.SMENU; 23870 $.gallery.SFOLDER = data.SFOLDER; 23871 $.gallery.valid_plan = data.valid_plan; 23872 $.gallery.valid_type = data.valid_type; 23873 $.gallery.one = data.one; 23874 $.gallery.service = data.service; 23875 $.gallery.block_el = ($.gallery.block_id == '-1') ? 'el_prod' : data.gallerys[$.gallery.block_id].el; 23876 var $backdrop = $('<div id="dummy-drop" style="position:fixed;top:0;left:0;right:0;bottom:0;background-color:#fff;z-index:1039;"></div>'); 23877 if($('#dummy-drop').length == 0) 23878 $('body').append($backdrop); 23879 23880 $('.gallery-modal').hide().remove(); 23881 $('#gallery-style').remove(); 23882 $('#gallery-modal-script').remove(); 23883 $m = $(data.r).hide(); 23884 $('body').append($m); 23885 23886 if($.gallery.mode != 'shopping') $('.gallery-list-filter').remove();
23887 if(data.name) $('.selected-gallery-name').text(data.name); 23888 if(typeof id == 'undefined' || !id || id == -1) { 23889 $('.gallery-category').addClass('product-all-items'); 23890 $('.gallery-category .category-title-str').hide(); 23891 $('.gallery-category .gallery-category-onoff').hide(); 23892 $('.gallery-blocks .all-items').addClass('active'); 23893 $('.gallery-block-select, .selected-gallery-name').text('ì ì²´ìí'); 23894 $('.gallery-add-items').addClass('disabled gallery-need'); 23895 } else { 23896 $('.gallery-blocks .all-items').removeClass('active'); 23897 $('.gallery-category').show(); 23898 $('.gallery-category').removeClass('product-all-items'); 23899 $('.gallery-add-items').removeClass('disabled gallery-need'); 23900 } 23901 23902 $('.gallery-modal').attr('data-page',data.page).attr('data-pid',data.pid).attr('data-mode',data.mode).attr('data-category',data.category).attr('data-total',data.total); 23903 (data.mode == 'shopping') ? $('.gallery-modal').addClass('shopping') : $('.gallery-modal .gallery-items').addClass('mod-gallery'); 23904 if(data.mode == 'shopping' && LUX) $('.gallery-modal').addClass('lux'); 23905 $('#gallery-name').text(data.name); 23906 $('.gallery-add-items').attr('data-mode',data.mode).attr('data-page',data.page); 23907 var check_only_cate = (typeof data.only_category != 'undefined' && data.only_category === true) ? true : false; 23908 if(!check_only_cate && data.id == '') $('.gallery-add-items').hide(); 23909 (data.mode == 'shopping') ? $('.gallery-modal-title').text($.lang[LANG]['bc.tp.gallery-contents.shopping']) : $('.gallery-modal-title').text($.lang[LANG]['editor.block.gallery.title']); 23910 $('.view-submenu li[data-view="' + data.view + '"]').addClass('active'); 23911 $('#gallery_view').text(data.view); 23912 var icon = ''; 23913 $.gallery.blocks = []; var idx = 0, menu_name = ''; 23914 $.gallery.pages = []; 23915 $.each(data.lists, function(i,v) { 23916 $.gallery.blocks.push(v); 23917 $.each(v, function(m, menus) { 23918 $('.gallery-blocks').append('<ul class="menus" data-name="' + m + '"><li><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 4 8"><path d="m-.05-.06 4 4-4 4v-8z"/></svg> ' + m + '</li>'); 23919 if(menus.length) { 23920 menu_name = m; 23921 for(var key in menus) { 23922 var value = menus[key]; 23923 switch(value.mode) { 23924 case 'shopping': icon = '<svg class="shopping" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 14"><path d="M9.82 2C9.4 0.84 8.3 0 7 0H6C4.7 0 3.6 0.84 3.18 2H0v12h13V2H9.82zM6 1h1c0.74 0 1.37 0.41 1.72 1H4.28C4.63 1.41 5.26 1 6 1zM12 13H1V3h2v3h1V3h5v3h1V3h2V13z"/></svg>ã'; break; 23925 case 'project' : icon = '<svg class="project" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M13 0H3v3H0v13h13v-3h3V3L13 0zM13 1.41L14.59 3H13V1.41zM1 15V4h8v3h3v8H1zM10 4.41L11.59 6H10V4.41zM15 12h-2V6l-3-3H4V1h8v3h3V12z"/><rect x="3" y="9" width="7" height="1"/><rect x="3" y="12" width="7" height="1"/></svg>ã'; break; 23926 case 'gallery' : icon = '<svg class="gallery" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 13"><path d="M0 0v13h13V0H0zM12 1v7.29l-2-2 -2 2 -4-4 -3 3V1H12zM1 12V8.71l3-3 4 4 2-2 2 2V12H1z"/><circle cx="10" cy="3" r="1"/></svg>ã'; break; 23927 } 23928 if(value.id == id) $.gallery.block_name = value.name; 23929 var gb_li_class = (value.id == id) ? 'active' : '', 23930 gb_li_attr = ''; 23931 23932 if(gb_li_class == 'active') $('.gallery-block-select').text(value.name); 23933 23934 if(!value.isActive) { 23935 gb_li_class += 'disabled editor-upgrade-popup'; 23936 gb_li_attr = 'data-mode="gallery.primeum"'; 23937 } 23938 23939 if(LUX) { 23940 gb_li_attr += ' data-category="' + value.lux_category_no + '" '; 23941 } 23942 23943 var gb_li_html = '\ 23944 <li class="gallery-name ' + gb_li_class + '" data-gallery-id="' + value.id + '" ' + gb_li_attr + '>\
23945 <span class="gallery-block-name">' + value.name + '</span>\ 23946 <span class="f-right gallery-name-edit"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M15.41 0.76l-0.17-0.17C14.85 0.2 14.34 0 13.83 0s-1.02 0.2-1.41 0.59L1 12l-1 4 4-1L15.41 3.59C16.2 2.8 16.2 1.54 15.41 0.76zM3.49 14.1l-2.11 0.53 0.53-2.11 8.95-8.95 1.59 1.59L3.49 14.1zM14.71 2.88l-1.56 1.56 -1.59-1.59 1.56-1.56C13.31 1.1 13.56 1 13.83 1s0.52 0.1 0.71 0.29l0.17 0.17C15.1 1.85 15.1 2.49 14.71 2.88z"/></svg></span>\ 23947 </li>\ 23948 '; 23949 23950 $('.gallery-blocks ul[data-name="' + m + '"]').append(gb_li_html); 23951 cates = cates + '<li class="gallery-name" data-gallery-id="' + value.id + '">' + value.name + '</li>'; 23952 // if(value.id == id) $.gallery.blocks[idx][menu_name].splice(k,1); 23953 $.gallery.pages[value.id] = menu_name; 23954 } 23955 } 23956 }); 23957 idx++; 23958 }); 23959 23960 if((data.lists).length == 0) $('.gallery-modal .gallery-add-items').addClass('disabled'); 23961 var cates = ''; 23962 var show = (data.cate_onoff == 'ON') ? '' : 'hide'; 23963 if(show) $('.gallery-cog').addClass('hide'); 23964 $.each(data.category, function(i,v) { 23965 var active = (data.cate_str == v) ? 'active' : ''; 23966 $('.gallery-category .gallery-category-onoff').before('<li class="category-text gallery-category-menu ' + show + ' ' + active + '">' + v + '</li>'); 23967 cates = cates + '<li>' + v + '</li>'; 23968 if(data.cate_str == '') { 23969 $('.gallery-category > li:nth-child(2)').addClass('active'); 23970 } 23971 }); 23972 $.gallery.cates = cates; 23973 if(data.cate_onoff == 'ON') { 23974 $('.category-onoff-check').prop('checked','checked'); 23975 $('.category-title-str').addClass('on'); 23976 } else { 23977 $('.category-onoff-check').prop('checked',''); 23978 $('.gallery-category > li:nth-child(2)').addClass('hide'); 23979 // $('.gallery-category > li:last-child').addClass('hide'); 23980 } 23981 var selected_category = '', 23982 $tag = $('.gallery-modal > .container'); 23983 23984 // lux shopping 23985 if(LUX) { 23986 $('.gallery-category').hide(); 23987 $tag.prepend('<div class="shop-filter-header open"></div>'); 23988 shopHeaderDisplay($tag.find('.shop-filter-header'),data); 23989 23990 $('.gallery-list-filter').hide(); 23991 $('.selected-gallery-name').hide(); 23992 $('.gallery-category').hide(); 23993 } else { 23994 // shopping filter 23995 if(data.mode == 'shopping') { 23996 var s = '\ 23997 <ul class="filter">\ 23998 <li data-val="all" class="active">ì ì²´</li>\ 23999 <li data-val="on">í매ì¤</li>\ 24000 <li data-val="off">í매ì¤ì§</li>\ 24001 <li data-val="out">íì </li>\ 24002 <li data-val="hide">ì¨ê¹</li>\ 24003 <li data-val="wait">í매ìì </li>\ 24004 <li data-val="end">íë§¤ì¢ ë£</li>\ 24005 </ul>\ 24006 '; 24007 $('.gallery-list-filter').append(s); 24008 } 24009 } 24010 24011 var keys = {'title' : '', 'date' : '', 'orig' : '', 'disc' : '', 'price' : ''}, 24012 keys_by = {'title' : '', 'date' : '', 'orig' : '', 'disc' : '', 'price' : ''}, 24013 checked = {'title' : '','date' : '', 'orig' : '', 'disc' : '', 'price' : ''}, 24014 icons = { 24015 'title' : $.gallery.sort_icon_desc, 24016 'date' : $.gallery.sort_icon_desc, 24017 'orig' : $.gallery.sort_icon_desc, 24018 'disc' : $.gallery.sort_icon_desc, 24019 'price' : $.gallery.sort_icon_desc 24020 }; 24021 switch(sort) { 24022 case '' : break; 24023 default : 24024 keys[sort] = 'sorted'; 24025 checked[sort] = '\
24026 <span class="product-sort-checked">' + 24027 $.gallery.sort_icon_checked + '</span>\ 24028 '; 24029 break; 24030 } 24031 if(sort) { 24032 keys_by[sort] = by; 24033 icons[sort] = (by == 'desc') ? $.gallery.sort_icon_desc : $.gallery.sort_icon_asc; 24034 } 24035 24036 var filter = getStorageItem('gallery-product-filter'); 24037 if(filter != null && filter.length) { 24038 $('.gallery-list-filter .filter li').removeClass('active'); 24039 $('.gallery-list-filter .filter li[data-val="' + filter + '"]').addClass('active'); 24040 } 24041 var s = '<ul class="table-toolbar">'; 24042 // lux shopping 24043 if(LUX) { 24044 s = s + '<li class="checkbox-cmd toolbar-cmd hide"><i class="" data-glseq="" data-cmd="checkall"></i> <input type="checkbox" class="check-all"></li>'; 24045 s = s + '<li class="toolbar-copy toolbar-cmd hide"><i class="" data-glseq="" data-cmd="copy"></i>' + $.lang[LANG]['editor.gallery.icon.clone'] + '</li>'; 24046 s = s + '<li class="toolbar-margin toolbar-cmd hide"><i class="" data-glseq="" data-cmd="margin"></i>ë§ì§ì¨</li>'; 24047 s = s + '<li class="toolbar-delete toolbar-cmd hide"><i class="" data-glseq="" data-cmd="delete"></i>' + $.lang[LANG]['editor.gallery.icon.delete'] + '</li>'; 24048 } else { 24049 s = s + '<li class="checkbox-cmd toolbar-cmd hide"><i class="" data-glseq="" data-cmd="checkall"></i> <input type="checkbox" class="check-all"></li>'; 24050 s = s + '<li class="toolbar-org-price product-cmd toolbar-cmd hide"><i class="" data-glseq="" data-discount="" data-discount-target="" data-cmd="org-price"></i>' + $.lang[LANG]['editor.gallery.icon.org.price'] + '</li>'; 24051 s = s + '<li class="toolbar-disc-price product-cmd toolbar-cmd hide"><i class="" data-glseq="" data-discount="" data-discount-target="" data-cmd="disc-price"></i>' + $.lang[LANG]['editor.gallery.icon.disc.price'] + '</li>'; 24052 s = s + '<li class="toolbar-sale-price product-cmd toolbar-cmd hide"><i class="" data-glseq="" data-discount="" data-discount-target="" data-cmd="sale-price"></i>' + $.lang[LANG]['editor.gallery.icon.sale.price'] + '</li>'; 24053 s = s + '<li class="toolbar-stock product-cmd toolbar-cmd hide"><i class="" data-glseq="" data-discount="" data-discount-target="" data-cmd="stock"></i>' + $.lang[LANG]['editor.gallery.icon.stock'] + '</li>'; 24054 24055 if(!$('.gallery-modal .gallery-category .gallery-all').hasClass('hide')) { 24056 s = s + '<li class="toolbar-category toolbar-cmd submenu hide"><i class="" data-glseq="" data-cmd="category"></i>' + $.lang[LANG]['editor.block.gallery.category.change'] + ' <i class="fa fa-caret-down" aria-hidden="true"></i>'; 24057 s = s + '<ul class="item-submenu">' + cates + '</ul>'; 24058 s = s + '</li>'; 24059 } 24060 24061 s = s + '<li class="toolbar-sort item-sort toolbar-cmd submenu hide">' + $.lang[LANG]['editor.gallery.icon.order'] + ' <i class="fa fa-caret-down" aria-hidden="true" data-glseq="" data-cmd="item-sort"></i>\ 24062 <ul class="item-submenu">\ 24063 <li class="sort-top">' + $.lang[LANG]['editor.gallery.icon.order.shopping.front'] + '</li>\ 24064 <li class="sort-bottom">' + $.lang[LANG]['editor.gallery.icon.order.shopping.end'] + '</li>\ 24065 </ul>\ 24066 </li>'; 24067 // s = s + '<li class="toolbar-discount toolbar-cmd hide"><i class="" data-glseq="" data-discount="" data-discount-target="" data-cmd="discount"></i>' + $.lang[LANG]['editor.gallery.icon.discount'] + '</li>'; 24068 24069 s = s + '<li class="toolbar-badge toolbar-cmd hide"><i class="" data-glseq="" data-badge="" data-badge-target="" data-cmd="badge"></i>' + $.lang[LANG]['editor.gallery.icon.badge'] + '</li>'; 24070 24071 s = s + '\ 24072 <li class="toolbar-visible toolbar-cmd hide"><i class="" data-glseq="" data-visible="" data-cmd="visible">' + $.lang[LANG]['editor.gallery.icon.visible.off'] + '</i></li>\ 24073 <li class="toolbar-move toolbar-cmd hide"><i class="" data-glseq="" data-visible="" data-cmd="move">' + $.lang[LANG]['editor.block.gallery.item.move'] + '</i></li>\ 24074 <li class="toolbar-link toolbar-cmd hide"><i class="" data-glseq="" data-glink="" data-glink-target="" data-cmd="link"></i>' + $.lang[LANG]['editor.gallery.icon.link'] + '</li>\ 24075 <li class="toolbar-copy toolbar-cmd hide"><i class="" data-glseq="" data-cmd="copy"></i>' + $.lang[LANG]['editor.gallery.icon.clone'] + '</li>\ 24076 <li class="toolbar-delete toolbar-cmd hide"><i class="" data-glseq="" data-cmd="delete"></i>' + $.lang[LANG]['editor.gallery.icon.delete'] + '</li>\ 24077 '; 24078 if(id == '') { 24079 s = s + '<li class="dummy dm-gallery all">ê°¤ë¬ë¦¬</li><li class="dummy dm-date all">ë±ë¡ì¼<span class="product-sort ' + keys['date'] + '" data-sort="date" data-by="' + keys_by['date'] + '">' + icons['date'] + '</span>' + checked['date'] + '</li><li class="dummy dm-category">ì¹´í ê³ ë¦¬</li>'; 24080 } else { 24081 s = s + ((data.cate_onoff == 'ON' || !id || id == -1) ? 24082 '<li class="dummy dm-date select">ë±ë¡ì¼<span class="product-sort ' + keys['date'] + '" data-sort="date" data-by="' + keys_by['date'] + '">' + icons['date'] + '</span>' + checked['date'] + '</li><li class="dummy dm-category">ì¹´í ê³ ë¦¬</li>' : 24083 '<li class="dummy dm-date">ë±ë¡ì¼<span class="product-sort ' + keys['date'] + '" data-sort="date" data-by="' + keys_by['date'] + '">' + icons['date'] + '</span>' + checked['date'] + '</li>'); 24084 } 24085 s = s + '\ 24086 <li class="dummy dm-orig-price">ì ê°<span class="product-sort ' + keys['orig'] + '" data-sort="orig" data-by="' + keys_by['orig'] + '">' + icons['orig'] + '</span>' + checked['orig'] + '</li>\ 24087 <li class="dummy dm-discount">í ì¸ì¨<span class="product-sort ' + keys['disc'] + '" data-sort="disc" data-by="' + keys_by['disc'] + '">' + icons['disc'] + '</span>' + checked['disc'] + '</li>\ 24088 <li class="dummy dm-price">í매ê°<span class="product-sort ' + keys['price'] + '" data-sort="price" data-by="' + keys_by['price'] + '">' + icons['price'] + '</span>' + checked['price'] + '</li>\ 24089 <li class="dummy dm-quantity">ì¬ê³ </li>\ 24090 <li class="dummy dm-status">ìí</li>\ 24091 </ul>\ 24092 '; 24093 } 24094 var $tool_back = $('<div class="toolbar sort
24094-disabled sticky">' + s + '</div>'); 24095 if(data.mode == 'shopping') { 24096 $('.gallery-toolbar').append($tool_back).addClass('hide'); 24097 } 24098 24099 var badge_settings = (data.badge_settings !== undefined && data.badge_settings)? JSON.stringify(data.badge_settings) : '{}'; 24100 var badge_imgs = (data.badge_imgs !== undefined && data.badge_imgs)? data.badge_imgs : ''; 24101 localStorage.setItem('badge_settings', badge_settings); 24102 localStorage.setItem('badge_imgs', badge_imgs); 24103 localStorage.setItem('before_badge_settings', badge_settings); 24104 24105 var num = (page > 1) ? data.total : data.total - ((page-1) * data.view); 24106 if((data.items).length && data.mode == 'shopping') { 24107 var item_header = '\ 24108 <div class="item-header sticky">\ 24109 <div class="td-handle"></div>\ 24110 <div class="td-check"><input type="checkbox" class="check-all"></div>\ 24111 <div class="td-number">ë²í¸</div>\ 24112 <div class="td-img"></div>\ 24113 <div class="td-title">ì 목<span class="product-sort ' + keys['title'] + '" data-sort="title" data-by="' + keys_by['title'] + '">' + icons['title'] + '</span>' + checked['title'] + '\ 24114 </div>\ 24115 '; 24116 24117 item_header+= (typeof id == 'undefined' || !id || id == -1) ? '<div class="td-gallery">ê°¤ë¬ë¦¬</div>' : ''; 24118 item_header+='\ 24119 <div class="td-date">ë±ë¡ì¼<span class="product-sort ' + keys['date'] + '" data-sort="date" data-by="' + keys_by['date'] + '">' + icons['date'] + '</span>' + checked['date'] + '</div>\ 24120 '; 24121 item_header+= (data.cate_onoff == 'ON' || !id || id == -1) ? '<div class="td-category">ì¹´í ê³ ë¦¬</div>' : ''; 24122 item_header+= '\ 24123 <div class="td-orig-price">ì ê°<span class="product-sort ' + keys['orig'] + '" data-sort="orig" data-by="' + keys_by['orig'] + '">' + icons['orig'] + '</span>' + checked['orig'] + '</div>\ 24124 <div class="td-discount">í ì¸ì¨<span class="product-sort ' + keys['disc'] + '" data-sort="disc" data-by="' + keys_by['disc'] + '">' + icons['disc'] + '</span>' + checked['disc'] + '</div>\ 24125 <div class="td-price">í매ê°<span class="product-sort ' + keys['price'] + '" data-sort="price" data-by="' + keys_by['price'] + '">' + icons['price'] + '</span>' + checked['price'] + '</div>\ 24126 <div class="td-quantity">ì¬ê³ </div>\ 24127 <div class="td-status">ìí</div>\ 24128 </div>\ 24129 '; 24130 $('.gallery-items').append(item_header); 24131 } 24132 24133 if(window.localStorage.getItem('product-gallery-closed') == 'true' || $(document).width() < 1440) { 24134 var $list = $('.product-gallery-list'), 24135 $category = $('.gallery-category'), 24136 $more = $('.gallery-items-loadmore'), 24137 $items = $('.gallery-items'), 24138 $toggle = $('.product-gallery-list-toggle'), 24139 $pagination = $('.pagination-wrap'), 24140 $filter = $('.gallery-list-filter'), 24141 $name = $('.selected-gallery-name'), 24142 $lux_filter = $('.shop-filter-header'); 24143 $list.removeClass('open'); 24144 $category.removeClass('open'); 24145 $more.removeClass('open'); 24146 $items.removeClass('open'); 24147 $toggle.removeClass('open'); 24148 $pagination.removeClass('open'); 24149 $filter.removeClass('open'); 24150 $name.removeClass('open'); 24151 $lux_filter.removeClass('open'); 24152 } 24153 $.each(data.items, function(i,v) { 24154 var settings = (v.gsettings) ? $.parseJSON(v.gsettings) : {}, 24155 link = (typeof settings.glink != 'undefined') ? settings.glink : '', 24156 link_icon = (typeof settings.glink != 'undefined' && settings.glink) ? clSVG('gallery-link','20','20',true,'info-link') : '', 24157 target = (typeof settings.glink_target != 'undefined') ? settings.glink_target : '', 24158 cp_class = ($.inArray(v.seq,$.gallery.copy) > -1) ? ' active copy' : '', 24159 mv_class = ($.inArray(v.seq,$.gallery.move) > -1) ? ' active move' : '', 24160 invisible = (v.visible == '1') ? true : false;
24161 // file = ((v.image).indexOf('googleusercontent') > -1) ? v.image : v.url 24162 imgPATH = (typeof settings.storage == 'undefined') ? RPATH : settings.storage, 24163 // src_s250 = getServeImage(v.image,'250',imgPATH); 24164 src_s250 = v.url; 24165 24166 link = Base64.decode(link); 24167 if(data.mode == 'shopping') { 24168 var yet = (v.price == null) ? 'yet' : ''; 24169 $table = $('<div class="table-item ' + yet + '" data-page="' + v.page + '" data-product="' + v.is_product + '" data-pos="' + v.pos + '" data-page="' + v.page + '" data-pid="' + v.pid + '" data-seq="' + v.seq + '" data-link="' + link + '" data-target="' + target + '" data-visible="' + v.visible + '" data-category="' + v.category + '" data-out-datetime="off" data-pricechk="' + v.price_check + '">'); 24170 // lux 24171 if(LUX) { 24172 v.sale = (v.price < v.sale) ? v.sale : ''; 24173 if(v.prod_case) $table.attr('data-pcase',v.prod_case); 24174 } 24175 24176 var title = (v.title) ? v.title : 'ìíëª ì ì ë ¥íì¸ì', 24177 price = (v.price != null && v.price !== '') ? addCommas(v.price) : '-', 24178 sale = (v.sale != null && v.sale !== '') ? addCommas(v.sale) : '-', 24179 soldout = '', 24180 24181 quantity = (v.quantity_on == 'on' && v.quantity) ? addCommas(v.quantity) : 0; 24182 var discount_settings = (settings.discount)? settings.discount : ''; 24183 var discount_rate = (discount_settings.rate !== undefined && discount_settings.rate)? discount_settings.rate : ''; 24184 var discount_unit = (discount_settings.unit !== undefined && discount_settings.unit)? discount_settings.unit : ''; 24185 24186 var discount = addCommas(discount_rate) + discount_unit; 24187 var use_badge = (settings.use_badge)? settings.use_badge : ''; 24188 var status = ''; 24189 24190 if(invisible) $table.addClass('invisible'); 24191 24192 var is_soldout = false, 24193 is_soldout_label = false, 24194 saleStatus = '', 24195 badgeList = ''; 24196 24197 quantity = (v.quantity_on == 'off' || v.quantity_on == null) ? '-' : quantity; 24198 24199 if(LUX) { 24200 if(v.soldout) is_soldout = is_soldout_label = true; 24201 } else { 24202 if(v.quantity_on == 'off' || v.quantity_on == null || v.quantity_on == '') { 24203 if(v.status == 'off' || v.status == '') is_soldout = true; 24204 } else { 24205 if(v.status == 'off' || v.status == '') is_soldout = true; 24206 if(v.quantity == 0) is_soldout = is_soldout_label = true; 24207 } 24208 if(v.status == 'lim') { 24209 saleStatus = '<span class="item-limit" data-toggle="tooltip" data-placement="top" data-original-title="' + v.sales_start + ' ~ ' + v.sales_end + '">기ê°íì í매</span>'; 24210 $table.attr('data-out-datetime', (v.sale_now) ? '0' : '1'); 24211 } 24212 24213 if(use_badge) { 24214 var badge_settings = $.parseJSON(localStorage.getItem('badge_settings')); 24215 badgeList = drawBadgeList(use_badge, badge_settings); 24216 } 24217 } 24218 if(is_soldout) { 24219 $table.addClass('soldout'); 24220 if(is_soldout_label) soldout = '<span class="item-soldout">íì </span>'; 24221 } 24222 24223 switch(v.status) { 24224 case "on": status = "í매ì¤"; break; 24225 case "off": status = "í매ì¤ì§"; break; 24226 default: status = "í매ì¤ì§"; break; 24227 } 24228 // if(v.quantity_on == 'on' && v.quantity == 0) status = "íì "; 24229 if(sale == '') sale = price; 24230 if(price == 0 && sale == 0) { 24231 v.sale_per = 0; 24232 sale = price; 24233 } 24234 if(invisible) $table.addClass('invisible'); 24235 24236 if(LUX) { 24237 var margin_str = (v.prod_case == 'O' || v.price_sync == 'F') ? '' : '<span class="margin-info">ë§ì§ì¨ <span class="rate">' + v.margin.rate + '</span>% + <span class="add">' + addCommas(v.margin.value) + '</span> = ë§ì§ê¸ì¡ <span class="price" data-supply="' + v.supply_price + '">' + addCommas(v.margin_price) + '</span>ì</span/>', 24238 add_info = '\ 24239 <div class="add-info">\
24240 <span class="brand">' + v.brand_name + '</span/>\ 24241 <span class="sale-rate" data-retail="' + v.retail_price + '">' + ((v.price < v.sale) ? 'í ì¸ì¨ <span class="rate">' + v.sale_rate + '</span>%' : '') + '</span/>\ 24242 '+ margin_str + '\ 24243 </div>'; 24244 soldout += add_info; 24245 } 24246 24247 var empty_title = (v.title == '' || price == '-') ? ' empty' : ''; 24248 var s = '\ 24249 <div class="td-handle"><div class="item-handle cl-sort-handle">' + clSVG('move_handle', 20, 20) + '</div></div>\ 24250 <div class="td-check"><input type="checkbox" name="item_check[]" class="td-input" data-ownproduct="' + (LUX && v.seq >= 1000000000 ? 'Y' : 'N') + '"></div>\ 24251 <div class="td-number">' + (num - i) + '</div>\ 24252 <div class="td-img"><img src="' + src_s250 + '" class="img-responsive">' + link_icon + '</div>\ 24253 <div class="td-title' + empty_title + '"><span class="item-title-str">' + title + '</span>' + saleStatus + badgeList + soldout +'\ 24254 <ul class="product-item-edit" data-seq="' + v.seq + '">\ 24255 <li class="edit-gallery-item" data-mode="prodDetail">'+ $.lang[LANG]['editor.block.gallery.product.detail'] +'</li>\ 24256 <li class="edit-gallery-item" data-mode="prodInfo">'+ $.lang[LANG]['editor.block.gallery.product.info'] +'</li>\ 24257 </ul>\ 24258 </div>\ 24259 '; 24260 if(typeof id == 'undefined' || !id || id == -1) 24261 if(typeof data.gallerys[v.pid] != 'undefined') 24262 s+= '<div class="td-gallery"><span title="' + data.gallerys[v.pid].title + '" alt="' + data.gallerys[v.pid].title + '">' + data.gallerys[v.pid].title + '</span></div>'; 24263 else 24264 s+= '<div class="td-gallery"></div>'; 24265 24266 s+= '<div class="td-date">' + v.datetime2 + '</div>'; 24267 if(LUX) { 24268 s+= '\ 24269 <div class="td-category">' + v.category_name + '</div>\ 24270 '; 24271 } else { 24272 if(typeof data.gallerys[v.pid] != 'undefined') { 24273 s+= '\ 24274 <div class="td-category' + empty_title + ((data.cate_onoff == 'OFF') ? ' hide' : '') + ((v.item_category.indexOf(',') > -1) ? ' line' : '') + '">' + ((data.gallerys[v.pid].cate_onoff == 'ON') ? v.item_category : '') + '</div>\ 24275 '; 24276 } else { 24277 s+= '\ 24278 <div class="td-category' + empty_title + ((data.cate_onoff == 'OFF') ? ' hide' : '') + ((v.item_category.indexOf(',') > -1) ? ' line' : '') + '"></div>\ 24279 '; 24280 } 24281 } 24282 var edit_button = '', str_quantity = '', hint_quantity = ''; 24283 quantity_need = (v.quantity_on == 'on' && (parseInt(uncomma(quantity)) < 6 || parseInt(uncomma(v.quantity_add_op)) < 6)) ? '<span class="need">' + ((v.add_options == true) ? $.gallery.info_icon_option_true : $.gallery.info_icon_option_false) + '</span>' : ''; 24284 if(v.quantity_on == 'on') { 24285 if(v.normal_options == false && v.add_options == false) { 24286 edit_button = '<div class="edit-button">' + $.gallery.edit_icon + '</div><div class="close-button" data-val="' + quantity + '">' + $.gallery.close_icon + '</div>'; 24287 } else { 24288 edit_button = '<div class="edit-button conf">' + $.gallery.edit_icon + '</div>'; 24289 } 24290 } 24291 24292 str_quantity = (v.add_options == true && v.quantity_on == "on") ? quantity + '|' + addCommas(v.quantity_add_op) : addCommas(quantity); 24293 hint_quantity = (v.add_options == true && v.quantity_on == "on") ? ' data-toggle="tooltip" data-html="true" data-placement="top" data-original-title="ì¼ë° ì¬ê³ ìµì : ' + quantity + '<br>ì¶ê° ìµì ì¬ê³ : ' + addCommas(v.quantity_add_op) + '"' : ''; 24294 var product_status = status; 24295 if(v.status == 'lim') { 24296 product_status = ((v.sale_now) ? 'í매ì¤' : (v.sale_fin) ? 'íë§¤ì¢ ë£' : 'í매ìì '); 24297 if(v.sale_now) product_status = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-clock" viewB
24297ox="0 0 16 16"><path d="M8 3.5a.5.5 0 0 0-1 0V9a.5.5 0 0 0 .252.434l3.5 2a.5.5 0 0 0 .496-.868L8 8.71z"/><path d="M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16m7-8A7 7 0 1 1 1 8a7 7 0 0 1 14 0"/></svg> ' + product_status; 24298 } 24299 var status_select = changeStatus(v.status, v.seq); 24300 if(LUX) { 24301 s+= '\ 24302 <div class="td-orig-price' + empty_title + '">' + sale + '</div>\ 24303 <div class="td-discount' + empty_title + '">' + (LUX ? v.sale_rate : v.sale_per) + '</div>\ 24304 <div class="td-price' + empty_title + '">' + price + '</div>\ 24305 <div class="td-quantity' + empty_title + '">' + quantity_need + str_quantity + '</div>\ 24306 <div class="td-status">' + product_status + '</div>\ 24307 '; 24308 } else { 24309 var sale_per = (v.sale_per) ? v.sale_per : ((typeof v.sale_per === 'number') ? 0 : '-'); 24310 s+= '\ 24311 <div class="td-orig-price' + empty_title + '"><span class="prev-value">' + sale + '</span><div class="edit-button">' + $.gallery.edit_icon + '</div><div class="close-button" data-val="' + sale + '">' + $.gallery.close_icon + '</div></div>\ 24312 <div class="td-discount' + empty_title + '"><span class="prev-value">' + sale_per + '</span><div class="edit-button">' + $.gallery.edit_icon + '</div><div class="close-button" data-val="' + (LUX ? v.sale_rate : sale_per) + '">' + $.gallery.close_icon + '</div></div>\ 24313 <div class="td-price' + empty_title + '"><span class="prev-value">' + price + '</span><div class="edit-button">' + $.gallery.edit_icon + '</div><div class="close-button" data-val="' + price + '">' + $.gallery.close_icon + '</div></div>\ 24314 <div class="td-quantity' + empty_title + '">' + quantity_need + '<span class="prev-value" ' + hint_quantity + '>' + str_quantity + '</span>' + edit_button + '</div>\ 24315 <div class="td-status">' + product_status + status_select + '</div>\ 24316 '; 24317 } 24318 24319 $table.append(s); 24320 24321 if ($table.find('.td-title > span').length > 4) { 24322 $table.find('.td-title .item-title-str').addClass('fw-title-block') 24323 } 24324 24325 $('.gallery-items').append($table); 24326 } else { 24327 var $info = $('<div class="info"></div>'), 24328 $item = $('<div class="item" data-pos="' + v.pos + '" data-page="' + v.page + '" data-pid="' + v.pid + '" data-seq="' + v.seq + '" data-link="' + link + '" data-target="' + target + '" data-visible="' + v.visible + '" data-category="' + v.category.split(", ").map(item => `|${item}|`).join(",") + '"><img src="' + src_s250 + '" class="img-responsive"><input type="text" name="item_name" class="item-title" value="' + v.title + '" placeholder="' + $.lang[LANG]['board.enter-title'] + '" data-seq="' + v.seq + '" data-title="' + v.title + '" data-caption="' + v.content + '" data-category="' + v.category + '" data-date="' + v.datetime2 + '" data-hash="' + v.hashtag + '" data-url="' + src_s250 + '"></div>'); 24329 24330 // if(mv_class) $item.addClass('active move'); 24331 // if(cp_class) $item.addClass('active copy'); 24332 $info.empty(); 24333 if(invisible) $item.addClass('invisible'); 24334 if(typeof settings.glink != 'undefined' && settings.glink) { 24335 $info.append(link_icon); 24336 $item.append($info); 24337 } 24338 24339 $('.gallery-items').append($item); 24340 } 24341 }); 24342 24343 $('.gallery-items-loadmore').remove(); 24344 if(data.mode == 'shopping') { 24345 if($('.gallery-modal').find('.pagination-wrap').length == 0 && data.total > 0) { 24346 $('.gallery-items').after('<div class="pagination-wrap open"><ul class="pagination" id="product-pagination"></ul></div>'); 24347 var totalPage = (data.total > 0) ? Math.ceil(data.total/data.view) : 1; 24348 $.jqPaginator('#product-pagination', { 24349 totalPages: totalPage, 24350 totalCounts: data.total, 24351 currentPage: 1, 24352 visiblePages: 10, 24353 onPageChange: function (num, type) { 24354 if(type == 'change') { 24355 $.gallery.list($.gallery.block_id,num,$.gallery.category,'list'); 24356 $.gallery.update = true; 24357 } 24358 window.localStorage.setItem('gallery-product-page',num); 24359 } 24360 }); 24361 } 24362 if(data.total == 0) { 24363 var msg = (data.mode == 'shopping') ? $.lang[LANG]['editor.gallery.product.empty'] : $.lang[LANG]['editor.gallery.list.empty']; 24364 msg = (data.search) ? 'ê²°ê³¼ê° ììµëë¤' : msg; 24365 $('.gallery-items').append('<p class="text-center sort-disabled category-empty"> ' + msg + '</p>'); 24366 } 24367 } else { 24368 if((data.items).length == 0) { 24369 var msg = (data.mode == 'shopping') ? $.lang[LANG]['editor.gallery.product.empty'] : $.lang[LANG]['editor.gallery.list.empty']; 24370 msg = (data.search) ? 'ê²°ê³¼ê° ììµëë¤' : msg; 24371 $('.gallery-items').append('<p class="text-center sort-disabled category-empty"> ' + msg + '</p>'); 24372 } else { 24373 if((data.items).length < data.total) { 24374 var count = (data.mode == 'shopping') ? $('.gallery-items .table-item').length : $('.gallery-items .item').length; 24375 $('.gallery-items').after('<div class="gallery-items-loadmore open" data-pid="' + data.pid + '" data-category-str="' + data.cate_str + '" data-page="1">' + $.lang[LANG]['data.loadmore'] + ' (' + count + ' / ' + number_format(data.total) + ')</div>'); 24376 } 24377 } 24378 } 24379 if(product_name != null && product_name.length) { 24380 $('.gallery-list-search-text').val(product_name); 24381 // $('.gallery-list-search-submit').hide(); 24382 // $('.gallery-list-search-cancel').show(); 24383 } 24384 $('.gallery-ctrl-category').attr('data-category',data.category.toString()).attr('data-pid',data.pid); 24385 24386 var handle = (data.mode == 'shopping') ? '.td-handle' : '.item-ctrl'; 24387 var $item = $('.gallery-items .item'); 24388 24389 var gallery_items_handle = (LUX) ? '' : ', .td-handle'; 24390 $('.gallery-items').selectable({ 24391 // distance: 3, 24392 filter : '.table-item,.item', 24393 cancel : '.gallery-toolbar, .td-orig-price, .td-discount, .td-price, .td-quantity, .item-edit, .product-item-edit, .item.ui-selected, .table-item-status, .td-check, .td-status, .item-title, .item .info, svg'+gallery_items_handle, 24394 stop : function(event,ui) { 24395 if($('#user-edit').length) $('#user-edit').blur(); 24396 $.gallery.selected(event,ui); 24397 } 24398 }); 24399 $('.item-header').removeClass('ui-selectee'); 24400 24401 $m.fadeIn(300, function() { 24402 if(typeof func == 'function') func(); 24403 $('#dummy-drop').remove(); 24404 }); 24405 24406 $('.gallery-modal').off('scroll').on('scroll', function(e) { 24407 if($('.gallery-blocks').length && $(this).scrollTop() < 65) { 24408 $('.product-gallery-list').css('top','93px'); 24409 } else $('.product-gallery-list').css('top','0px'); 24410 stickyToolbar(); 24411 }); 24412 // resizeGalleryModal(); 24413 setLanguage(LANG); 24414 24415 if(typeof GALLERY_MODE != 'undefined') { 24416 GALLERY_MODE.push({ 24417 seq : data.pid, 24418 mode : data.mode 24419 }); 24420 } 24421 24422 if(data.gallery_mode != 'shopping' || LUX) { 24423 $('.gallery-blocks .all-items').addClass('hide'); 24424 if(data.pid) { 24425 $('.gallery-blocks .menus li[data-gallery-id="' + data.pid +'"]').addClass('active'); 24426 $.gallery.block_id = data.pid; 24427 } 24428 } 24429 }, 24430 error : function(xhr, status, error) { 24431 $.processOFF();
24432 alert("Error " + xhr.status + " : ê´ë¦¬ììê² ë¬¸ì"); 24433 } 24434 }); 24435 }, 24436 list : function(id, page, category, type) { 24437 // if(typeof id == 'undefined' || !id) { 24438 // alert('Undefined gallery ID'); 24439 // return false; 24440 // } 24441 $.gallery.seqs = []; 24442 if(typeof page =='undefined') page = 1; 24443 if(typeof category =='undefined') category = ''; 24444 if(typeof type == 'undefined') type = 'load'; 24445 // $('.gallery-items-loadmore').addClass('spinner'); 24446 var params = ($('.gallery-modal').length) ? getProductParams() : getSearchURL(), 24447 product_name = getStorageItem('gallery-product-name'), 24448 product_filter = getStorageItem('gallery-product-filter'), 24449 product_view = getStorageItem('gallery-product-view'), 24450 sort = getStorageItem('gallery-product-sort'), 24451 by = getStorageItem('gallery-product-by'), 24452 manager = (id == '' || id == -1) ? SID : ''; 24453 24454 $.processON(); 24455 $.ajax({ 24456 type: 'POST', 24457 url : '/template/gallery/show', 24458 data : { mode : 'list', id : id, page : page, category : category, params : params, manager : manager, product_name : product_name, product_filter : product_filter, product_view : product_view, sort : sort, by : by }, 24459 dataType : 'json', 24460 async: true, 24461 cache: false, 24462 success : function(data) { 24463 $.processOFF(); 24464 if(data.error != 'undefined' && data.error) { 24465 alert(data.error); 24466 return false; 24467 } 24468 (typeof id == 'undefined' || !id) ? $('.gallery-category').hide() : $('.gallery-category').show(); 24469 if(LUX) { 24470 $('.gallery-list-filter').hide(); 24471 $('.selected-gallery-name').hide(); 24472 $('.gallery-category').hide(); 24473 } 24474 if(type == 'list') $('.gallery-items').find('.table-item').remove(); 24475 var num = data.total - ((page-1) * data.view); 24476 $.each(data.items, function(i,v) { 24477 var settings = (v.gsettings) ? $.parseJSON(v.gsettings) : {}, 24478 link = (typeof settings.glink != 'undefined') ? settings.glink : '', 24479 link_icon = (typeof settings.glink != 'undefined' && settings.glink) ? clSVG('gallery-link','16','16',true,'info-link') : '', 24480 target = (typeof settings.glink_target != 'undefined') ? settings.glink_target : '', 24481 cp_class = ($.inArray(v.seq,$.gallery.copy) > -1) ? ' active copy' : '', 24482 mv_class = ($.inArray(v.seq,$.gallery.move) > -1) ? ' active move' : '', 24483 invisible = (v.visible == '1') ? true : false; 24484 // file = ((v.image).indexOf('googleusercontent') > -1) ? v.image : v.url 24485 imgPATH = (typeof settings.storage == 'undefined') ? RPATH : settings.storage, 24486 // src_s250 = getServeImage(v.image,'250',imgPATH); 24487 src_s250 = v.url; 24488 24489 link = Base64.decode(link); 24490 if(data.mode == 'shopping') { 24491 var yet = (v.price == null) ? 'yet' : ''; 24492 $table = $('<div class="table-item ' + yet + '" data-product="' + v.is_product + '" data-pos="' + v.pos + '" data-page="' + v.page + '" data-pid="' + v.pid + '" data-seq="' + v.seq + '" data-link="' + link + '" data-target="' + target + '" data-visible="' + v.visible + '" data-category="' + v.category + '" data-out-datetime="off" data-pricechk="' + v.price_check + '">'); 24493 // lux 24494 if(LUX) { 24495 v.sale = (v.price < v.sale) ? v.sale : ''; 24496 if(v.prod_case) $table.attr('data-pcase',v.prod_case); 24497 } 24498 24499 var title = (v.title) ? v.title : 'ìíëª ì ì ë ¥íì¸ì', 24500 price = (v.price != null && v.price !== '') ? addCommas(v.price) : 0, 24501 sale = (v.sale != null && v.sale !== '') ? addCommas(v.sale) : 0, 24502 soldout = '', 24503 quantity = (v.quantity_on == 'on' && v.quantity) ? addCommas(v.quantity) : '-'; 24504 var discount_settings = (settings.discount)? settings.discount : ''; 24505 var discount_rate = (discount_settings.rate !== undefined && discount_settings.rate)? discount_settings.rate : ''; 24506 var discount_unit = (discount_settings.unit !== undefined && discount_settings.unit)? discount_settings.unit : ''; 24507 var discount = addCommas(discount_rate) + discount_unit; 24508 24509 var use_badge = (settings.use_badge)? settings.use_badge : ''; 24510 // console.log('use_badge', use_badge); 24511 if(invisible) $table.addClass('invisible'); 24512 24513 var is_soldout = false, 24514 is_soldout_label = false, 24515 saleStatus = '', 24516 badgeList = ''; 24517 24518 quantity = (v.quantity_on == 'off' || v.quantity_on == null) ? '-' : quantity; 24519 if(LUX) { 24520 if(v.soldout) is_soldout = is_soldout_label = true; 24521 } else { 24522 if(v.quantity_on == 'off' || v.quantity_on == null || v.quantity_on == '') { 24523 if(v.status == 'off' || v.status == '') is_soldout = true; 24524 } else { 24525 if(v.status == 'off' || v.status == '') is_soldout = true; 24526 if(v.quantity == 0) is_soldout = is_soldout_label = true; 24527 } 24528 if(v.status == 'lim') { 24529 saleStatus = '<span class="item-limit" data-toggle="tooltip" data-placement="top" data-original-title="' + v.sales_start + ' ~ ' + v.sales_end + '">기ê°íì í매</span>'; 24530 $table.attr('data-out-datetime', (v.sale_now) ? '0' : '1'); 24531 } 24532 24533 if(use_badge) { 24534 var badge_settings = $.parseJSON(localStorage.getItem('badge_settings')); 24535 badgeList = drawBadgeList(use_badge, badge_settings); 24536 } 24537 } 24538 if(is_soldout) { 24539 $table.addClass('soldout'); 24540 if(is_soldout_label) soldout = '<span class="item-soldout">íì </span>'; 24541 } 24542 24543 switch(v.status) { 24544 case "on": status = "í매ì¤"; break; 24545 case "off": status = "í매ì¤ì§"; break; 24546 default: status = "í매ì¤ì§"; break; 24547 } 24548 // if(v.quantity_on == 'on' && v.quantity == 0) status = "íì "; 24549 if(sale == '') sale = price; 24550 if(price == 0 && sale == 0) { 24551 v.sale_per = 0; 24552 sale = price 24553 } 24554 if(invisible) $table.addClass('invisible'); 24555 24556 if(LUX) { 24557 var margin_str = (v.prod_case == 'O' || v.price_sync == 'F') ? '' : '<span class="margin-info">ë§ì§ì¨ <span class="rate">' + v.margin.rate + '</span>% + <span class="add">' + addCommas(v.margin.value) + '</span> = ë§ì§ê¸ì¡ <span class="price" data-supply="' + v.supply_price + '">' + addCommas(v.margin_price) + '</span>ì</span/>', 24558 add_info = '\ 24559 <div class="add-info">\
24560 <span class="brand">' + v.brand_name + '</span/>\ 24561 <span class="sale-rate" data-retail="' + v.retail_price + '>' + ((v.price < v.sale) ? 'í ì¸ì¨ <span class="rate">' + v.sale_rate + '</span>%' : '') + '</span/>\ 24562 ' + margin_str + '\ 24563 </div>'; 24564 soldout += add_info; 24565 } 24566 24567 var empty_title = (v.title == '' || price == '-') ? ' empty' : ''; 24568 var s = '\ 24569 <div class="td-handle"><div class="item-handle cl-sort-handle">' + clSVG('move_handle', 20, 20) + '</div></div>\ 24570 <div class="td-check"><input type="checkbox" name="item_check[]" class="td-input" data-ownproduct="' + (LUX && v.seq >= 1000000000 ? 'Y' : 'N') + '"></div>\ 24571 <div class="td-number">' + (num - i) + '</div>\ 24572 <div class="td-img"><img src="' + src_s250 + '" class="img-responsive">' + link_icon + '</div>\ 24573 <div class="td-title' + empty_title + '"><span class="item-title-str">' + title + '</span>' + saleStatus + badgeList + soldout + '\ 24574 <ul class="product-item-edit" data-seq="' + v.seq + '">\ 24575 <li class="edit-gallery-item" data-mode="prodDetail">ìì¸íì´ì§</li>\ 24576 <li class="edit-gallery-item" data-mode="prodInfo">ìíì¤ì </li>\ 24577 </ul>\ 24578 </div>\ 24579 '; 24580 // <!--<div class="td-edit' + empty_title + '"><div class="item-edit" data-seq="' + v.seq + '"><span class="cl-icon cl_icon_edit04"></span> ' + $.lang[LANG]['editor.block.gallery.item.edit'] + '</div></div>-->\ 24581 s+= '<div class="td-date">' + v.datetime2 + '</div>'; 24582 if(LUX) { 24583 s+= '\ 24584 <div class="td-category">' + v.category_name + '</div>\ 24585 '; 24586 } else { 24587 s+= '\ 24588 <div class="td-category' + empty_title + ((data.cate_onoff == 'OFF') ? ' hide' : '') + ((v.item_category.indexOf(',') > -1) ? ' line' : '') + '">' + ((data.gallerys[v.pid].cate_onoff == 'ON') ? v.item_category : '') + '</div>\ 24589 '; 24590 } 24591 var edit_button = '', str_quantity = '', hint_quantity = ''; 24592 quantity_need = (v.quantity_on == 'on' && (parseInt(uncomma(quantity)) < 6 || parseInt(uncomma(v.quantity_add_op)) < 6)) ? '<span class="need">' + ((v.add_options == true) ? $.gallery.info_icon_option_true : $.gallery.info_icon_option_false) + '</span>' : ''; 24593 if(v.quantity_on == 'on') { 24594 if(v.normal_options == false && v.add_options == false) { 24595 edit_button = '<div class="edit-button">' + $.gallery.edit_icon + '</div><div class="close-button" data-val="' + quantity + '">' + $.gallery.close_icon + '</div>'; 24596 } else { 24597 edit_button = '<div class="edit-button conf">' + $.gallery.edit_icon + '</div>'; 24598 } 24599 } 24600 24601 str_quantity = (v.add_options == true && v.quantity_on == "on") ? addCommas(quantity) + '|' + addCommas(v.quantity_add_op) : addCommas(quantity); 24602 hint_quantity = (v.add_options == true && v.quantity_on == "on") ? ' data-toggle="tooltip" data-html="true" data-placement="top" data-original-title="ì¼ë° ì¬ê³ ìµì : ' + quantity + '<br>ì¶ê° ìµì ì¬ê³ : ' + addCommas(v.quantity_add_op) + '"' : ''; 24603 var product_status = status; 24604 if(v.status == 'lim') { 24605 product_status = ((v.sale_now) ? 'í매ì¤' : (v.sale_fin) ? 'íë§¤ì¢ ë£' : 'í매ìì '); 24606 if(v.sale_now) product_status = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-clock" viewB
24606ox="0 0 16 16"><path d="M8 3.5a.5.5 0 0 0-1 0V9a.5.5 0 0 0 .252.434l3.5 2a.5.5 0 0 0 .496-.868L8 8.71z"/><path d="M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16m7-8A7 7 0 1 1 1 8a7 7 0 0 1 14 0"/></svg> ' + product_status; 24607 } 24608 var status_select = changeStatus(v.status, v.seq); 24609 if(LUX) { 24610 s+= '\ 24611 <div class="td-orig-price' + empty_title + '">' + sale + '</div>\ 24612 <div class="td-discount' + empty_title + '">' + (LUX ? v.sale_rate : v.sale_per) + '</div>\ 24613 <div class="td-price' + empty_title + '">' + price + '</div>\ 24614 <div class="td-quantity' + empty_title + '">' + quantity_need + str_quantity + '</div>\ 24615 <div class="td-status">' + product_status + '</div>\ 24616 '; 24617 } else { 24618 var sale_per = (v.sale_per) ? v.sale_per : ((typeof v.sale_per === 'number') ? 0 : '-'); 24619 s+= '\ 24620 <div class="td-orig-price' + empty_title + '"><span class="prev-value">' + sale + '</span><div class="edit-button">' + $.gallery.edit_icon + '</div><div class="close-button" data-val="' + sale + '">' + $.gallery.close_icon + '</div></div>\ 24621 <div class="td-discount' + empty_title + '"><span class="prev-value">' + sale_per + '</span><div class="edit-button">' + $.gallery.edit_icon + '</div><div class="close-button" data-val="' + (LUX ? v.sale_rate : sale_per) + '">' + $.gallery.close_icon + '</div></div>\ 24622 <div class="td-price' + empty_title + '"><span class="prev-value">' + price + '</span><div class="edit-button">' + $.gallery.edit_icon + '</div><div class="close-button" data-val="' + price + '">' + $.gallery.close_icon + '</div></div>\ 24623 <div class="td-quantity' + empty_title + '">' + quantity_need + '<span class="prev-value" ' + hint_quantity + '>' + str_quantity + '</span>' + edit_button + '</div>\ 24624 <div class="td-status">' + product_status + status_select + '</div>\ 24625 '; 24626 /* 24627 s+= '\ 24628 <div class="td-orig-price' + empty_title + '"><span class="prev-value">' + sale + '</span><div class="edit-button">' + $.gallery.edit_icon + '</div><div class="close-button" data-val="' + sale + '">' + $.gallery.close_icon + '</div></div>\ 24629 <div class="td-discount' + empty_title + '"><span class="prev-value">' + (LUX ? v.sale_rate : v.sale_per) + '</span><div class="edit-button">' + $.gallery.edit_icon + '</div><div class="close-button" data-val="' + (LUX ? v.sale_rate : v.sale_per) + '">' + $.gallery.close_icon + '</div></div>\ 24630 <div class="td-price' + empty_title + '"><span class="prev-value">' + price + '</span><div class="edit-button">' + $.gallery.edit_icon + '</div><div class="close-button" data-val="' + price + '">' + $.gallery.close_icon + '</div></div>\ 24631 <div class="td-quantity' + empty_title + '">' + quantity_need + '<span class="prev-value">' + str_quantity + '</span>' + edit_button + '</div>\ 24632 <div class="td-status">' + product_status + status_select + '</div>\ 24633 '; 24634 */ 24635 } 24636 24637 $table.append(s); 24638 $('.gallery-items').append($table); 24639 } else { 24640 var $info = $('<div class="info"></div>'), 24641 $item = $('<div class="item" data-pos="' + v.pos + '" data-pid="' + v.pid + '" data-seq="' + v.seq + '" data-link="' + link + '" data-target="' + target + '" data-visible="' + v.visible + '" data-category="' + v.category + '"><img src="' + src_s250 + '" class="img-responsive"><input type="text" name="item_name" class="item-title" value="' + v.title + '" placeholder="' + $.lang[LANG]['board.enter-title'] + '" data-seq="' + v.seq + '" data-title="' + v.title + '" data-caption="' + v.content + '" data-category="' + v.category + '" data-date="' + v.datetime2 + '" data-hash="' + v.hashtag + '" data-url="' + src_s250 + '"></div>'); 24642 24643 $info.empty(); 24644 if(invisible) $item.addClass('invisible'); 24645 if(typeof settings.glink != 'undefined' && settings.glink) { 24646 $info.append(link_icon); 24647 $item.append($info); 24648 } 24649 24650 $('.gallery-items').append($item); 24651 } 24652 }); 24653 24654 $('.gallery-toolbar').addClass('hide'); 24655 if(product_name != null && product_name.length) { 24656 $('.gallery-list-search-text').val(product_name); 24657 // $('.gallery-list-search-submit').hide(); 24658 // $('.gallery-list-search-cancel').show(); 24659 } 24660 24661 if(type == 'load') { 24662 $('.gallery-items-loadmore').remove(); 24663 var itemCheck = (data.mode == 'shopping') ? '.table-item' : '.item'; 24664 24665 if($('.gallery-items ' + itemCheck).length < data.total) { 24666 $('.gallery-items').after('<div class="gallery-items-loadmore" data-pid="' + data.pid + '" data-category-str="' + data.cate_str + '" data-page="' + data.page_num + '">' + $.lang[LANG]['data.loadmore'] + ' (' + $('.gallery-items ' + itemCheck).length + ' / ' + number_format(data.total) + ')</div>'); 24667 } 24668 } 24669 24670 // $('.gallery-items').sortable('refresh'); 24671 }, 24672 error : function(xhr, status, error) { 24673 $.processOFF();
24674 alert("Error " + xhr.status + " : ê´ë¦¬ììê² ë¬¸ì"); 24675 } 24676 }); 24677 }, 24678 setNumber: function() { 24679 var items = $.gallery.seqs; 24680 if(items.length) { 24681 var group = ($('.table-item').length) ? '.table-item' : '.gallery-items .item'; 24682 $.each(items, function(i,v) { 24683 $(group+'[data-seq="' + v + '"]').attr('data-index',(i+1)); 24684 }); 24685 } 24686 24687 if(LUX) { 24688 if($.gallery.seqs.length > 0) { 24689 var checkDefault = ($('.gallery-items .table-item.ui-selected:not([data-pcase="O"])').length > 0) ? true : false, 24690 checkPcaseO = ($('.gallery-items .table-item.ui-selected[data-pcase="O"]').length > 0) ? true : false, 24691 checkMargin = ($('.gallery-items .table-item.ui-selected:not([data-pcase="O"])').length == $('.gallery-items .table-item.ui-selected:not([data-pcase="O"]) .margin-info').length) ? true : false; 24692 24693 if(checkPcaseO && !checkDefault) $('.table-toolbar .toolbar-delete').removeClass('hide'); 24694 else $('.table-toolbar .toolbar-delete').addClass('hide'); 24695 24696 if(!checkPcaseO && checkDefault && checkMargin) $('.table-toolbar .toolbar-margin').removeClass('hide'); 24697 else $('.table-toolbar .toolbar-margin').addClass('hide'); 24698 24699 if($('.gallery-items .table-item.ui-selected').length == $('.gallery-items .table-item').length) $('.checkbox-cmd > input[type="checkbox"]').prop('checked',true); 24700 else $('.checkbox-cmd > input[type="checkbox"]').prop('checked',false); 24701 } else { 24702 $('.gallery-toolbar').removeClass('hide_col'); 24703 $('.table-toolbar .toolbar-cmd').addClass('hide'); 24704 $('.table-toolbar .toolbar-cmd i[data-glseq]').attr('data-glseq',''); 24705 $('.table-toolbar .toolbar-cmd i[data-cmd="link"]').attr('data-glink','').attr('data-glink-target',''); 24706 $('.table-toolbar .toolbar-cmd i[data-cmd="visible"]').attr('data-visible','0').text($.lang[LANG]['editor.gallery.icon.visible.off']); 24707 $('.checkbox-cmd > input[type="checkbox"], .col-check > input[type="checkbox"]').prop('checked',false); 24708 $('.gallery-toolbar').addClass('hide'); 24709 $('.gallery-items .item-header').removeClass('hide'); 24710 } 24711 } 24712 }, 24713 selected: function(e,ui) { 24714 $.gallery.seqs = []; 24715 var disabled = false, visible_button = false; no_price = false; 24716 if($.gallery.mode == 'shopping') { 24717 $('.table-item .td-check > input[type="checkbox"]').prop('checked',false); 24718 $.each($('.gallery-items .table-item.ui-selected'), function(i,v) { 24719 if($(this).attr('data-product') == "false") disabled = true; 24720 if($(this).attr('data-out-datetime') == "1") visible_button = true; 24721 if($(this).attr('data-pricechk') == "false") no_price = true; 24722 $(this).find('.td-check > input[type="checkbox"]').prop('checked',true); 24723 ($.gallery.seqs).push($(v).attr('data-seq')); 24724 }); 24725 24726 if($.gallery.seqs.length > 0) { 24727 if($('.gallery-items .table-item.ui-selected').length && $('.gallery-items .table-item').length) { 24728 $('.table-toolbar li').removeClass('hide open'); 24729 $('.gallery-toolbar').addClass('hide_col'); 24730 } 24731 var firstItem = $('.gallery-items .table-item.ui-selected').eq(0), 24732 first_seq = firstItem.attr('data-seq'), 24733 seq = firstItem.attr('data-seq'), 24734 pid = firstItem.attr('data-pid'), 24735 link = firstItem.attr('data-link'), 24736 target = firstItem.attr('data-target'), 24737 visible = firstItem.attr('data-visible'), 24738 vstr = (visible == '1') ? $.lang[LANG]['editor.gallery.icon.visible.on'] : $.lang[LANG]['editor.gallery.icon.visible.off']; 24739 if(visible_button) { 24740 $('.table-toolbar .toolbar-cmd.toolbar-visible').addClass('disabled'); 24741 } else $('.table-toolbar .toolbar-cmd.toolbar-visible').removeClass('disabled'); 24742 if($.gallery.block_id == -1) { 24743 $('.table-toolbar .toolbar-cmd.toolbar-copy').addClass('disabled'); 24744 } 24745 $('.table-toolbar .toolbar-cmd').removeClass('hide'); 24746 $('.table-toolbar .toolbar-cmd i[data-glseq]').attr('data-glseq',first_seq); 24747 $('.table-toolbar .toolbar-cmd i[data-cmd="link"]').attr('data-glink',link).attr('data-glink-target',target); 24748 $('.table-toolbar .toolbar-cmd i[data-cmd="visible"]').attr('data-visible',visible).text(vstr); 24749 $('.gallery-toolbar').removeClass('hide'); 24750 $('.gallery-items .item-header').addClass('hide'); 24751 stickyToolbar(); 24752 $.gallery.setNumber(); 24753 } else { 24754 $('.gallery-items .table-item > div').removeClass('hide-text'); 24755 $('.table-toolbar .toolbar-cmd').addClass('hide'); 24756 $('.table-toolbar .toolbar-cmd i[data-glseq]').attr('data-glseq',''); 24757 $('.table-toolbar .toolbar-cmd i[data-cmd="link"]').attr('data-glink','').attr('data-glink-target',''); 24758 $('.table-toolbar .toolbar-cmd i[data-cmd="visible"]').attr('data-visible','0').text($.lang[LANG]['editor.gallery.icon.visible.off']); 24759 $('.gallery-toolbar').addClass('hide'); 24760 $('.gallery-items .item-header').removeClass('hide'); 24761 } 24762 } else { 24763 $.each($('.gallery-items .item.ui-selected'), function(i,v) { 24764 ($.gallery.seqs).push($(v).attr('data-seq')); 24765 }); 24766 $.gallery.toolbar(); 24767 stickyToolbar(); 24768 } 24769 24770 (no_price) ? $('.product-cmd').not('.toolbar-org-price').not('.toolbar-stock').addClass('no_price') : $('.product-cmd').removeClass('no_price'); 24771 (disabled) ? $('.product-cmd').addClass('disabled') : $('.product-cmd').removeClass('disabled'); 24772 if($('.gallery-modal').attr('data-pid') == undefined) { 24773 $('.toolbar-sort.item-sort').addClass('disabled'); 24774 } 24775 24776 $('.item-submenu, .view-submenu').hide(); 24777 $('.toolbar-sort, .gallery-view-count').removeClass('open'); 24778 $('.gallery-blocks .btn-group').removeClass('open'); 24779 }, 24780 toolbar : function() { 24781 $('.gallery-list-filter').remove(); 24782 $('.gallery-items').find('.toolbar.mod-gallery').remove(); 24783 if($.gallery.seqs.length == 0) return false;
24784 var $s = $('.gallery-items .item[data-seq="' + $.gallery.seqs[0] + '"]'), 24785 seq = $s.attr('data-seq'), 24786 pid = $s.attr('data-pid'), 24787 link = $s.attr('data-link'), 24788 target = $s.attr('data-target'), 24789 visible = $s.attr('data-visible'), 24790 edit_name = ($.gallery.mode == 'gallery') ? $.lang[LANG]['editor.block.gallery.item.edit.image'] : $.lang[LANG]['editor.block.gallery.item.edit']; 24791 24792 var l = ($s.index()%7 > 3) ? 'right' : '', 24793 mode = $('.gallery-add-items').attr('data-mode'); 24794 24795 var vstr = (visible == "1") ? $.lang[LANG]["editor.gallery.icon.visible.on"] : $.lang[LANG]["editor.gallery.icon.visible.off"], 24796 vicon = (visible == "1") ? 'cl_icon_hide02' : 'cl_icon_show', 24797 editable = ($.gallery.seqs.length > 1) ? "disabled" : ""; 24798 24799 var s = '\ 24800 <ul>\ 24801 <li class="active gallery-item-edit submenu' + editable + ' edit-'+ $.gallery.mode +'">\ 24802 '; 24803 if($.gallery.mode == 'project') { 24804 s = s + '\ 24805 ' + $.lang[LANG]['editor.block.gallery.item.edit'] + '</span> <i class="fa fa-caret-down"></i>\ 24806 <ul class="item-submenu">\ 24807 <li class="edit-gallery-item"><i class="" data-glseq="' + seq + '" data-cmd="edit">'+$.lang[LANG]["editor.gallery.icon.thumnail.config"]+'</i></li>\ 24808 <li class="edit-gallery-detail" data-seq="' + seq + '" >'+$.lang[LANG]["editor.gallery.icon.Project.page"]+'</li>\ 24809 </ul>\ 24810 </li>\ 24811 '; 24812 } else { 24813 s = s + '\ 24814 <i class="" data-glseq="' + seq + '" data-cmd="edit"></i>' + edit_name + '\ 24815 </li>\ 24816 '; 24817 } 24818 s = s + '<li><i class="" data-glseq="' + seq + '" data-cmd="copy"></i>' + $.lang[LANG]['editor.gallery.icon.clone'] + '</li>'; 24819 24820 s = s + '<li class="toolbar-sort item-sort submenu">' + $.lang[LANG]['editor.gallery.icon.order'] + ' <i class="fa fa-caret-down" aria-hidden="true" data-glseq="" data-cmd="item-sort"></i>\ 24821 <ul class="item-submenu">\ 24822 <li class="sort-top">' + $.lang[LANG]['editor.gallery.icon.order.front'] + '</li>\ 24823 <li class="sort-bottom">' + $.lang[LANG]['editor.gallery.icon.order.end'] + '</li>\ 24824 </ul>\ 24825 </li>'; 24826 if(!$('.gallery-modal .gallery-category .gallery-all').hasClass('hide')) { 24827 s = s + '<li class="toolbar-category submenu"><i class="" data-glseq="" data-cmd="category"></i>' + $.lang[LANG]['editor.block.gallery.category.change'] + ' <i class="fa fa-caret-down" aria-hidden="true"></i>'; 24828 s = s + '<ul class="item-submenu">' + $.gallery.cates + '</ul>'; 24829 s = s + '</li>'; 24830 } 24831 24832 s = s + '\ 24833 <li><i class="" data-glseq="' + seq + '" data-glink="' + link + '" data-glink-target="' + target + '" data-cmd="link"></i>' + $.lang[LANG]['editor.gallery.icon.link'] + '</li>\ 24834 '; 24835 s = s + '\ 24836 <li><i class="" data-glseq="' + seq + '" data-visible="' + visible + '" data-cmd="visible">' + vstr + '</i></li>\ 24837 <li><i class="" data-glseq="' + seq + '" data-cmd="move">' + $.lang[LANG]['editor.block.gallery.item.move'] + '</i></li>\ 24838 <li><i class="" data-glseq="' + seq + '" data-cmd="delete"></i>' + $.lang[LANG]['editor.gallery.icon.delete'] + '</li>\ 24839 </ul>\ 24840 '; 24841 var $tool_back = $('<div class="toolbar mod-gallery ' + l + '">' + s + '</div>'); 24842 $('.gallery-toolbar').empty(); 24843 $('.gallery-toolbar').append($tool_back).removeClass('hide'); 24844 24845 if($.gallery.seqs.length > 1) { 24846 $('.gallery-toolbar .toolbar .gallery-item-edit').addClass('disabled'); 24847 } else { 24848 $('.gallery-toolbar .toolbar .gallery-item-edit').removeClass('disabled'); 24849 } 24850 // $('.gallery-items').selectable('disable'); 24851 }, 24852 pages : function() { 24853 var group = ($('.table-item').length) ? '.table-item' : '.gallery-items .item', 24854 item = $(group).length,
24855 cpage = Math.ceil(item/30), 24856 spos = $('.gallery-modal').scrollTop(); 24857 return { 24858 page : cpage, pos : spos 24859 } 24860 }, 24861 close : function() { 24862 $.gallery.mode = ''; 24863 localStorage.removeItem('gallery-product-view'); 24864 24865 if($('.gallery-modal').hasClass('view-detail') && $.gallery.unlink) { // ìì¸íì´ì§ê° ìì ëìê²½ì° ë¦¬ì¤í¸ë¡ ì´ë 24866 var go_url = PAGE.split(","); 24867 location.replace('/'+CONFIG_URL+'config/page/' + go_url[0]); 24868 } else { 24869 if($('.gallery-modal').length) { 24870 localStorage.removeItem('badge_settings'); 24871 localStorage.removeItem('badge_imgs'); 24872 localStorage.removeItem('before_badge_settings'); 24873 $('.gallery-modal').fadeOut(300, function() { 24874 $('#gallery-style').remove(); 24875 $('#gallery-modal-script').remove(); 24876 $(this).remove(); 24877 }); 24878 } 24879 24880 if($.gallery.update) { 24881 if(typeof showPageCallback == 'function') 24882 showPageCallback(showPage); 24883 } 24884 24885 // premium block 24886 if( !$('#el-blockConfig').hasClass('open') && $('.element[data-id="' + $.gallery.block_id + '"][data-type="gallery"][data-type2="premium"]').length > 0) { 24887 if(typeof elGalleryJS[selectID] != 'undefined') elGalleryJS[selectID] = true; 24888 startGalleryJS($('.element[data-id="' + $.gallery.block_id + '"]')); 24889 } 24890 } 24891 }, 24892 save : function() { 24893 var dlink = (typeof PUBDOMAIN != 'undefined' && PUBDOMAIN)? PUBDOMAIN.replace('http://', '') : $('#pubhost a').text(); 24894 var publish_str = $.lang[LANG]['editor.publish.info'] + '<p class="publish-site-link">' + dlink + '</p>' + $.lang[LANG]['editor.publish.confirm']; 24895 var modal = $(this).showModalFlat($.lang[LANG]['config.information'], publish_str, true, true, function() { 24896 modal.modal('hide'); 24897 $(this).sitePublishByConfig(SID); 24898 }, 'cancel', '', 'cl-cmmodal cl-s-btn w560 cl-p130 cl-p0 cl-publish-confirm'); 24899 }, 24900 } 24901 24902 $.detail = { 24903 open : function(product, mode) { 24904 var $detail = $('.product-detail-modal'), 24905 title = ''; 24906 if($.gallery.mode) { 24907 title = ($.gallery.mode == 'shopping') ? 'ìí ìì¸íì´ì§' : 'ìì¸íì´ì§'; 24908 } else { 24909 title = (mode == 'shopping') ? 'ìí ìì¸íì´ì§' : 'ìì¸íì´ì§'; 24910 } 24911 if($detail.length == 0) { 24912 var s = '\ 24913 <div class="product-detail-modal">\ 24914 <div class="detail-page"><iframe class="detail-iframe" src="' + product + '#detail"></iframe></div>\ 24915 </div>\ 24916 '; 24917 $('body').append(s); 24918 setTimeout(function() { 24919 $('.product-detail-modal').addClass('open'); 24920 },50); 24921 } 24922 $(document).on('click', '.product-detail-modal .modal-close', function(e) { 24923 $.detail.close(); 24924 }); 24925 }, 24926 close : function() { 24927 if($('.product-detail-modal').length) { 24928 $('.product-detail-modal').removeClass('open'); 24929 setTimeout(function() { $('.product-detail-modal').remove(); },750); 24930 } 24931 } 24932 } 24933 24934 var setBadgeColorPicker = function() { 24935 // console.log('setBadgeColorPicker'); 24936 $('.color-picker-badge').each(function(idx, v){ 24937 $(v).colpick({ 24938 onBeforeShow: function(picker) { 24939 var this_color = style.getHex($(v).css('background-color')); 24940 $(this).colpickSetColor(this_color); 24941 }, 24942 onShow: function(picker) { 24943 if($(v).hasClass('disabled')){ 24944 $(picker).colpickHide(); 24945 return false;
24946 } 24947 }, 24948 onSubmit: function(hsb, hex, rgb, root_picker) { 24949 var $optionRow = $(root_picker).closest('.badge-option-row'); 24950 var pn = $(root_picker).attr('pn'); 24951 var val = '#'+hex; 24952 24953 switch(pn) { 24954 case 'border-color': 24955 $optionRow.find('input[name="border_color"]').val(val); 24956 break; 24957 case 'background-color': 24958 $optionRow.find('input[name="background_color"]').val(val); 24959 break; 24960 case 'color': 24961 $optionRow.find('input[name="font_color"]').val(val); 24962 break; 24963 } 24964 // console.log($optionRow.find('.product-badge'), pn, val); 24965 $optionRow.find('.product-badge-view > .product-badge').css(pn, val); 24966 $('.cl-change-badge-design').removeClass('reset-design'); 24967 // $('.modal-product-badge').eq(0).removeClass('return-prev'); 24968 24969 $(root_picker).css('background-color', val); 24970 $(root_picker).colpickHide(); 24971 } 24972 }); 24973 }); 24974 } 24975 $.badgeSettings = { 24976 init: function(badge_settings){ 24977 $.each(badge_settings, function(k, v) { 24978 var $badge = $('.badge-view .product-badge[data-type="'+k+'"]'); 24979 if(v.type == 'edit') { 24980 var badgeType = (v.type)? v.type : 'edit'; 24981 var badgeStyle = (v.style)? v.style : 'default-1 small'; 24982 var badgeText = (v.badge_text)? v.badge_text : $.lang[LANG]['gallery.shopping.badge.'+k] 24983 var badgeBorderColor = (v.border_color)? v.border_color : '';
24984 var badgeBackgroundColor = (v.background_color)? v.background_color : ''; 24985 var badgeFontColor = (v.font_color)? v.font_color : ''; 24986 24987 $badge.attr('class', 'change-badge-design hand product-badge '+badgeStyle); 24988 if(badgeBorderColor) $badge.css('border-color', badgeBorderColor); 24989 if(badgeBackgroundColor) $badge.css('background-color', badgeBackgroundColor); 24990 if(badgeFontColor) $badge.css('color', badgeFontColor); 24991 $badge.html(badgeText); 24992 } else { 24993 // console.log('img',v.image_src); 24994 $badge.attr('class', 'change-badge-design hand product-badge'); 24995 $badge.removeAttr('style'); 24996 $badge.html('<img src="'+v.image_src+'">'); 24997 } 24998 }); 24999 }, 25000 initDesign: function(badgeArr, badge_settings) { 25001 var changeBadgeDsgnRow = ''; 25002 $.each(badgeArr, function(idx, type) { 25003 var bsettings = (typeof badge_settings[type] != 'undefined')? badge_settings[type] : {}; 25004 25005 var badgeType = (typeof bsettings.type != 'undefined' && bsettings.type)? bsettings.type : 'edit'; 25006 var badgeStyle = (typeof bsettings.style != 'undefined' && bsettings.style)? bsettings.style : 'default-1 small'; 25007 var badgeText = (typeof bsettings.badge_text != 'undefined' && bsettings.badge_text)? bsettings.badge_text : $.lang[LANG]['gallery.shopping.badge.'+type]; 25008 var badgeBorderColor = (typeof bsettings.border_color != 'undefined' && bsettings.border_color)? bsettings.border_color : '';
25009 var badgeBackgroundColor = (typeof bsettings.background_color != 'undefined' && bsettings.background_color)? bsettings.background_color : ''; 25010 var badgeFontColor = (typeof bsettings.font_color != 'undefined' && bsettings.font_color)? bsettings.font_color : ''; 25011 var badgeImgSrc = (typeof bsettings.image_src != 'undefined' && bsettings.image_src)? bsettings.image_src : ''; 25012 var badgeImgName = (typeof bsettings.image_name != 'undefined' && bsettings.image_name)? bsettings.image_name : ''; 25013 var $badge = (badgeType == 'edit')? $('<span class="product-badge ' + badgeStyle + '" data-style="' + badgeStyle + '" data-border_color="' + bsettings.border_color + '" data-background_color="' + bsettings.background_color + '" data-font_color="' + bsettings.font_color + '">' + badgeText + '</span>') 25014 : $('<span class="product-badge"><img src="'+badgeImgSrc+'"></span>'); 25015 if(badgeBorderColor) $badge.css('border-color', badgeBorderColor);
25016 if(badgeBackgroundColor) $badge.css('background-color', badgeBackgroundColor); 25017 if(badgeFontColor) $badge.css('color', badgeFontColor); 25018 var disabled = (badgeType == 'image')? 'disabled' : ''; 25019 25020 changeBadgeDsgnRow += '\ 25021 <div class="divTableRow badge-option-row" data-idx="' + idx + '" data-default="' + type + '">\ 25022 <div class="divTableCell product-badge-view">'+ $badge[0].outerHTML +'</div>\ 25023 <div class="divTableCell product-badge-option">\ 25024 <div class="select-style-btn hand">ì í</div>\ 25025 </div>\ 25026 <div class="divTableCell product-badge-option">\ 25027 <input type="text" name="badge_text" value="'+ badgeText +'" maxlength="7" ' + disabled + '>\ 25028 </div>\ 25029 <div class="divTableCell product-badge-option">\ 25030 <span class="color tooltips color-picker-badge '+disabled+'" el=".product-badge" pn="border-color" data-toggle="tooltip" data-placement="top" title="" style="" data-original-title="color"></span>\ 25031 </div>\ 25032 <div class="divTableCell product-badge-option">\ 25033 <span class="color tooltips color-picker-badge '+disabled+'" el=".product-badge" pn="background-color" data-toggle="tooltip" data-placement="top" title="" style="" data-original-title="color"></span>\ 25034 </div>\ 25035 <div class="divTableCell product-badge-option">\ 25036 <span class="color tooltips color-picker-badge '+disabled+'" el=".product-badge" pn="color" data-toggle="tooltip" data-placement="top" title="" style="" data-original-title="color"></span>\ 25037 </div>\ 25038 <input type="hidden" name="type" value="' + badgeType + '">\ 25039 <input type="hidden" name="style" value="' + badgeStyle + '">\ 25040 <input type="hidden" name="border_color" value="' + badgeBorderColor + '">\ 25041 <input type="hidden" name="background_color" value="' + badgeBackgroun
25041dColor + '">\ 25042 <input type="hidden" name="font_color" value="' + badgeFontColor + '">\ 25043 <input type="hidden" name="image_src" value="'+badgeImgSrc+'">\ 25044 <input type="hidden" name="image_name" value="'+badgeImgName+'">\ 25045 </div>\ 25046 '; 25047 }); 25048 25049 return changeBadgeDsgnRow; 25050 }, 25051 initStylePopup: function($selection) { 25052 var optionIdx = $selection.closest('.badge-option-row').attr('data-idx'); 25053 var badgeText = $('.badge-option-row[data-idx="'+optionIdx+'"] input[name="badge_text"]').val(); 25054 var badgeType = $('.badge-option-row[data-idx="'+optionIdx+'"] input[name="type"]').val(); 25055 var badgeStyle = $('.badge-option-row[data-idx="'+optionIdx+'"] input[name="style"]').val(); 25056 var badgeImgSrc = (badgeType == 'image')? $('.badge-option-row[data-idx="'+optionIdx+'"] input[name="image_src"]').val() : ''; 25057 25058 if(!badgeText) badgeText = $.lang[LANG]['gallery.shopping.badge.'+$selection.closest('.badge-option-row').attr('data-default')] 25059 $('.badge-style-popup .badge-tab-edit .select-badge .product-badge').html(badgeText); 25060 25061 if(badgeType) { 25062 $('.badge-type-tab li').removeClass('active'); 25063 $('.badge-type-tab li[data-tab="'+badgeType+'"]').addClass('active'); 25064 } 25065 // console.log('initStylePopup', localStorage.getItem('badge_imgs')) 25066 25067 var popoverObj = { 25068 trigger: 'hover', 25069 container: '.cl-change-badge-design', 25070 placement: 'top', 25071 html: true, 25072 content: 'ì´ë¯¸ì§ê° ìì ëììµëë¤.' 25073 }; 25074 25075 $('.badge-style-popup .select-badge-table img').each(function(idx, v){ 25076 // console.log($(v).attr('src')); 25077 $(v).error(function(){ 25078 $(this).attr('src', '//storage.googleapis.com/i.addblock.net/icon_broken_img.png'); 25079 $(this).closest('.product-badge').popover(popoverObj); 25080 }); 25081 25082 if($(v).attr('src').indexOf('//storage.googleapis.com/i.addblock.net/icon_broken_img.png') > -1) { 25083 $(v).closest('.product-badge').popover(popoverObj); 25084 } 25085 25086 if(badgeType == 'image' && badgeImgSrc == $(v).attr('src') && !$('.badge-style-popup .badge-tab-image .select-badge').hasClass('selected')) { 25087 $(v).closest('.select-badge').addClass('selected'); 25088 } 25089 }); 25090 25091 if(badgeType == 'edit') { 25092 $('.badge-type-tab > li').removeClass('active'); 25093 $('.badge-type-tab > li[data-tab="edit"]').addClass('active'); 25094 $('.badge-type-tab-content').addClass('hide'); 25095 $('.badge-style-popup .badge-style-footer > span').addClass('hide'); 25096 $('.badge-tab-edit').removeClass('hide'); 25097 25098 var badgeStyleArr = badgeStyle.split(' '); 25099 var style = badgeStyleArr[0]; 25100 var size = badgeStyleArr[1]; 25101 // console.log(style, size); 25102 $('.badge-style-popup .badge-size-tab > span').removeClass('active'); 25103 $('.badge-style-popup .select-badge-table .product-badge').removeClass('small medium large'); 25104 $('.badge-style-popup .select-badge-table .select-badge').removeClass('selected'); 25105 25106 $('.badge-style-popup .badge-size-tab > span[data-size="'+size+'"]').addClass('active'); 25107 $('.badge-style-popup .select-badge-table').attr('data-size', size); 25108 $('.badge-style-popup .select-badge-table .product-badge').addClass(size); 25109 $('.badge-style-popup .select-badge-table .select-badge').removeClass('selected'); 25110 $('.badge-style-popup .select-badge-table .select-badge[data-style="'+style+'"]').addClass('selected'); 25111 } else { //ì´ë¯¸ì§í 25112 $('.badge-type-tab > li').removeClass('active'); 25113 $('.badge-type-tab > li[data-tab="image"]').addClass('active'); 25114 $('.badge-type-tab-content').addClass('hide'); 25115 $('.badge-tab-image').removeClass('hide'); 25116 $('.badge-style-popup .badge-style-footer > span').removeClass('hide'); 25117 } 25118 }, 25119 handleSelection: function($selection, idx){ 25120 var optionIdx = $selection.closest('.badge-option-row').attr('data-idx'); 25121 var badgeTab = $selection.closest('.badge-type-tab-content'); 25122 var badgeEL = $selection.find('.product-badge').clone(); 25123 25124 $('.badge-option-row[data-idx="'+optionIdx+'"] .product-badge-view > .product-badge').attr('class', 'product-badge'); 25125 $('.cl-change-badge-design').removeClass('reset-design'); 25126 // $('.modal-product-badge').eq(0).removeClass('return-prev'); 25127 25128 if($selection.closest('.badge-type-tab-content').hasClass('badge-tab-edit')) { //í¸ì§í 25129 var $selectedBadge = $selection.find('.product-badge'); 25130 var badgeStyle = $selectedBadge.attr('class').replace('product-badge ', ''); 25131 25132 var badgeBorderColor = style.getHex($selectedBadge.css('border-color'));
25133 var badgeBackgroundColor = style.getHex($selectedBadge.css('background-color')); 25134 var badgetextColor = style.getHex($selectedBadge.css('color')); 25135 25136 $('.badge-option-row[data-idx="'+optionIdx+'"] .product-badge-view').html(badgeEL); 25137 25138 $('.badge-option-row[data-idx="'+optionIdx+'"]').find('.color-picker-badge').removeClass('disabled'); 25139 $('.badge-option-row[data-idx="'+optionIdx+'"]').find('input[name="badge_text"]').prop('disabled', false); 25140 25141 $('.badge-option-row[data-idx="'+optionIdx+'"]').find('.color-picker-badge[pn="border-color"]').css('background-color', badgeBorderColor); 25142 $('.badge-option-row[data-idx="'+optionIdx+'"]').find('.color-picker-badge[pn="background-color"]').css('background-color', badgeBackgroundColor); 25143 $('.badge-option-row[data-idx="'+optionIdx+'"]').find('.color-picker-badge[pn="color"]').css('background-color', badgetextColor); 25144 25145 $('.badge-option-row[data-idx="'+optionIdx+'"] input[name="type"]').val('edit'); 25146 $('.badge-option-row[data-idx="'+optionIdx+'"] input[name="style"]').val(badgeStyle.trim()); 25147 $('.badge-option-row[data-idx="'+optionIdx+'"] input[name="border_color"]').val(badgeBorderColor); 25148 $('.badge-option-row[data-idx="'+optionIdx+'"] input[name="background_color"]').val(badgeBackgroun
25148dColor); 25149 $('.badge-option-row[data-idx="'+optionIdx+'"] input[name="font_color"]').val(badgetextColor); 25150 $('.badge-option-row[data-idx="'+optionIdx+'"] input[name="image_src"]').val(''); 25151 $('.badge-option-row[data-idx="'+optionIdx+'"] input[name="image_name"]').val(''); 25152 } else { //ì´ë¯¸ì§í 25153 var imgSrc = $selection.find('.product-badge > img').attr('src'); 25154 var imgName = $selection.find('.product-badge > img').attr('alt'); 25155 if(imgSrc == '//storage.googleapis.com/i.addblock.net/icon_broken_img.png') { 25156 return false; 25157 } 25158 25159 $('.badge-option-row[data-idx="'+optionIdx+'"] .product-badge-view').html(badgeEL); 25160 25161 $('.badge-option-row[data-idx="'+optionIdx+'"]').find('.color-picker-badge').addClass('disabled'); 25162 // $('.badge-option-row[data-idx="'+optionIdx+'"]').find('input[name="badge_text"]').val(''); 25163 $('.badge-option-row[data-idx="'+optionIdx+'"]').find('input[name="badge_text"]').prop('disabled', true); 25164 25165 $('.badge-option-row[data-idx="'+optionIdx+'"] input[name="type"]').val('image'); 25166 $('.badge-option-row[data-idx="'+optionIdx+'"] input[name="style"]').val(''); 25167 $('.badge-option-row[data-idx="'+optionIdx+'"] input[name="border_color"]').val(''); 25168 $('.badge-option-row[data-idx="'+optionIdx+'"] input[name="background_color"]').val(''); 25169 $('.badge-option-row[data-idx="'+optionIdx+'"] input[name="font_color"]').val(''); 25170 $('.badge-option-row[data-idx="'+optionIdx+'"] input[name="image_src"]').val(imgSrc); 25171 $('.badge-option-row[data-idx="'+optionIdx+'"] input[name="image_name"]').val(imgName); 25172 } 25173 25174 setBadgeColorPicker(); 25175 } 25176 } 25177})(jQuery); 25178 25179var getSelectedProductList = function(sid, cmd, gallery_seqs) { 25180 var returnHtml = ''; 25181 var route = (CONFIG_URL) ? '/_admin' : ''; 25182 $.ajax({ 25183 url: route + '/shopping/productListInfo', 25184 type: 'post', 25185 data: { sid : sid, cmd : cmd, gseqs : JSON.stringify(gallery_seqs) }, 25186 dataType: 'html', 25187 success: function (list_html) { 25188 // $('.order-list-area').html(list_html); 25189 returnHtml += list_html; 25190 }, error: function () { 25191 25192 }, complete: function () { 25193 // $.processOFF(); 25194 } 25195 }); 25196 25197 return returnHtml; 25198} 25199 25200var SFOLDER_ACTIVE = ''; 25201var updateOutputFolder = function (e) { 25202 var list = e.length ? e : $(e.target), 25203 output = list.data('output'); 25204 25205 if (window.JSON && list.attr('class') == 'dd') { 25206 output.val(window.JSON.stringify(list.nestable('serialize'))); 25207 } else { 25208 if (typeof output != 'undefined') output.val('JSON browser support required'); 25209 } 25210 25211 if (SID) { 25212 SFOLDER = JSON.parse($('#nestableFolder-output').val()); 25213 $.ajaxSetup({ async : false }); 25214 $.post('/template/update/type/folder', { s: $('#nestableFolder-output').val(), id: SID }, function (data) { 25215 checkError(data); 25216 }, 'json'); 25217 } 25218} 25219 25220function sortFolderFavoritesTop() { 25221 var $list = $('#nestableFolder > .dd-list'); 25222 if (!$list.length) return null; 25223 25224 var $items = $list.children('li.dd-item'); 25225 if (!$items.length) return null; 25226 25227 var $all = $items.filter(function () { 25228 return String($(this).attr('data-id')) === 'all'; 25229 }); 25230 25231 var $rest = $items.not($all); 25232 var $fav = $rest.filter(function () { 25233 return String($(this).attr('data-favorite') || '0') === '1'; 25234 }); 25235 var $non = $rest.not($fav); 25236 25237 $list.append($all).append($fav).append($non); 25238 $list.children('li.dd-item').removeClass('fli-favorite fli-nonfavorite fli-group-divider'); 25239 $fav.addClass('fli-favorite'); 25240 $non.addClass('fli-nonfavorite'); 25241 if ($fav.length && $non.length) { 25242 $non.first().addClass('fli-group-divider'); 25243 } 25244 25245 var raw = $('#nestableFolder-output').val() || '[]'; 25246 var data = []; 25247 if (SFOLDER && Array.isArray(SFOLDER) && SFOLDER.length) { 25248 data = $.extend(true, [], SFOLDER); 25249 } else { 25250 try { data = JSON.parse(raw); } catch (e) { data = []; } 25251 } 25252 25253 if (!data.length) return raw; 25254 25255 var map = {}; 25256 for (var i = 0; i < data.length; i++) { 25257 map[String(data[i].id)] = data[i]; 25258 } 25259 25260 var order = []; 25261 $list.children('li.dd-item').each(function () { 25262 var fid = $(this).attr('data-fid'); 25263 if (fid !== undefined && fid !== null && String(fid).trim() !== '') { 25264 order.push(String(fid)); 25265 } 25266 }); 25267 25268 if (order.indexOf('0') === -1 && map['0']) order.unshift('0'); 25269 25270 var out = []; 25271 for (var j = 0; j < order.length; j++) { 25272 var key = order[j]; 25273 if (map[key]) out.push(map[key]); 25274 } 25275 25276 for (var k in map) { 25277 if (!map.hasOwnProperty(k)) continue; 25278 var exists = false;
25279 for (var t = 0; t < out.length; t++) { 25280 if (String(out[t].id) === String(k)) { exists = true; break; } 25281 } 25282 if (!exists) out.push(map[k]); 25283 } 25284 25285 var nextVal = JSON.stringify(out); 25286 $('#nestableFolder-output').val(nextVal); 25287 SFOLDER = out; 25288 25289 return nextVal; 25290} 25291 25292var setResourceSelectedBox = function(mode) { 25293 var setResourceTab = $('.modal-resourcebox #'+mode+'storage'), 25294 setResourceSelectedInfo = setResourceTab.find('.resource-ctrl-selectedinfo'), 25295 setResourceSelected = setResourceTab.find('.resource-selected-ul'); 25296 setResourceTab.find('.resource-ctrl-btns').removeClass('active'); 25297 setResourceSelected.find('.selected-hover').popover('destroy'); 25298 if(setResourceSelected.children('li').length > 0) { 25299 if(mode == 'my') { 25300 setResourceTab.find('.resource-ctrl-btns').addClass('active'); 25301 var size = 0; 25302 setResourceSelected.children('li').map(function() { return $(this).data('size')}).each(function(){ size += this;}); 25303 setResourceSelectedInfo.find('.size').text('('+formatFileSize(size,2,'str')+')'); 25304 25305 } 25306 setResourceTab.find('.resource-useit').addClass('active'); 25307 setResourceSelectedInfo.find('.count').text(setResourceSelected.children('li').length); 25308 setResourceSelectedInfo.find('label').show(); 25309 25310 setResourceSelected.find('.selected-hover').popover({ 25311 container: 'body', 25312 trigger: 'hover', 25313 html: true, 25314 content: $.lang[LANG]['editor.resource.selected.cancel'], 25315 placement: function(context, source) { 25316 $(context).addClass('resource-selected-cancel-popover'); 25317 return 'auto top'; 25318 } 25319 }); 25320 25321 } else { 25322 setResourceTab.find('.resource-useit').removeClass('active'); 25323 if(setResourceSelectedInfo.length > 0) { 25324 setResourceSelectedInfo.find('label').hide() 25325 setResourceSelectedInfo.find('.count').text('0'); 25326 } 25327 } 25328} 25329 25330var resourceGetPage = function(page,ffolder,fsort,fsearch) { 25331 if(typeof fsort == 'undefined') fsort = 'date_desc'; 25332 if(typeof fsearch == 'undefined') fsearch = ''; 25333 25334 var activeResourceTab = $('.modal.in .modal-resourcebox .tab-content > .tab-pane.active').last(), 25335 activeResourceTabId = activeResourceTab.attr('id') || '', 25336 iconStorageActive = ( 25337 activeResourceTabId == 'iconstorage' || 25338 $('#el-iconstorage').hasClass('in') || 25339 $('#el-iconstorage').is(':visible') || 25340 $('#el-iconstorage').attr('aria-hidden') == 'false' 25341 ), 25342 property = $('.resource-useit').eq(0).attr('data-property'), 25343 checkFileLink = (!iconStorageActive && property == 'flink-change') ? true : false, 25344 checkIconStorage = (iconStorageActive || (typeof property!='undefined' && property.indexOf('icon') > -1)) ? true : false, 25345 // checkGabia = (HOST.indexOf('gabia') > -1 || SERVICE.indexOf('gabia') > -1) ? true : false, 25346 checkGabia = (window.getServiceHost().indexOf('gabia') > -1) ? true : false, 25347 sfl = 'default'; 25348 25349 var thisResourceTab = (checkFileLink) ? $('#filestorage') : $('#mystorage'); 25350 thisResourceTab = (checkIconStorage) ? $('#iconstorage') : thisResourceTab; 25351 25352 var thisResourceFiles = thisResourceTab.find('ul.files'), 25353 thisResourceSelected = thisResourceTab.find('.resource-selected-ul'); 25354 25355 thisResourceFiles.removeClass('empty'); 25356 ffolder = (typeof ffolder == 'undefined') ? SFOLDER_ACTIVE : ffolder; 25357 if(checkFileLink) { 25358 ffolder = 'flink@'; 25359 if(thisResourceFiles.find('.fitem.selected').length == 0) thisResourceTab.find('.resource-useit').removeClass('active'); 25360 if(thisResourceTab.find('#flink-sfl').length > 0) sfl = thisResourceTab.find('#flink-sfl option:selected').val(); 25361 } else { 25362 if(thisResourceTab.find('#nestableFolder .fln-group').length > 0) thisResourceTab.find('#nestableFolder .fln-group .btn-fln-cancel').click(); 25363 } 25364 25365 if(checkIconStorage) { 25366 fsearch = (typeof fsearch == 'string') ? fsearch.trim() : ''; 25367 sfl = (typeof getIconStorageType == 'function') ? getIconStorageType() : ($('#iconstorage .icon_type.active').attr('data-icontype') || 'default'); 25368 if(typeof normalizeIconStorageType == 'function') sfl = normalizeIconStorageType(sfl); 25369 else if($.inArray(sfl, ['default', 'google', 'fontawesome']) < 0) sfl = 'default';
25370 fsort = (fsort && fsort != 'date_desc') ? fsort : (thisResourceTab.find('.fitem-category.active').attr('data-category') || 'total'); 25371 if(fsearch) { 25372 fsort = 'total'; 25373 sfl = 'all'; 25374 if(typeof setIconStorageSearchState == 'function') setIconStorageSearchState(true, true); 25375 } else { 25376 if(typeof setIconStorageMaterialState == 'function') setIconStorageMaterialState(sfl); 25377 if(typeof setIconStorageSearchState == 'function') setIconStorageSearchState(false, false); 25378 } 25379 } 25380 var iconstorage_url = (checkIconStorage) ? `/type/icon/category/${encodeURIComponent(fsort)}` : ''; 25381 25382 fsearch = (checkIconStorage && typeof fsearch == 'string') ? fsearch.trim() : fsearch; 25383 25384 if(checkIconStorage && !fsearch && typeof isIconStorageHybridType == 'function' && isIconStorageHybridType(sfl) && typeof loadIconStorageCategoryPage == 'function') { 25385 if(page == 1 && (!fsort || fsort == 'total') && typeof getIconImage == 'function') { 25386 getIconImage(fsort, sfl); 25387 cPage = page; 25388 setResourceSelectedBox('my'); 25389 thisResourceTab.find('.resource-search-btn').removeClass('clicked'); 25390 return; 25391 } 25392 25393 loadIconStorageCategoryPage(fsort, sfl, page, { render: true }) 25394 .always(function() { 25395 thisResourceTab.find('.resource-search-btn').removeClass('clicked'); 25396 thisResourceFiles.removeClass('ready'); 25397 thisResourceFiles.find('.listprogress:not([data-category])').remove(); 25398 if(thisResourceFiles.data('uiSelectableScroll')) thisResourceFiles.data('uiSelectableScroll').refresh(); 25399 fillResourceViewport(thisResourceTab, thisResourceFiles, page, ffolder, fsort, fsearch); 25400 }); 25401 25402 cPage = page; 25403 setResourceSelectedBox('my'); 25404 return; 25405 } 25406 25407 if(checkIconStorage && fsearch && typeof stopIconStoragePrefetch == 'function') stopIconStoragePrefetch(); 25408 25409 $.ajax({ 25410 type : 'post', 25411 url: '/template/resource/files/page/' + page + iconstorage_url +'/sfl/' + encodeURIComponent(sfl) + '/ffolder/' + ffolder, 25412 data: { fsort: fsort, fsearch: fsearch }, 25413 dataType: 'json', 25414 async: false, 25415 success: function (data) { 25416 if (typeof(data.error) != 'undefined' && data.error) { 25417 checkError(data); 25418 $.resource.modalFilesEmpty(thisResourceFiles, 'No files uploaded'); 25419 } else { 25420 if(page == 1) thisResourceFiles.empty(); 25421 25422 cTotal = (!checkFileLink) ? $.resource.getMystorageFlc() : data.total; 25423 if(cTotal <= 0) cTotal = data.total; 25424 var active_category = fsort; 25425 if(checkIconStorage) { 25426 active_category = (typeof getIconStorageActiveCategory == 'function') ? getIconStorageActiveCategory(data, fsort, sfl) : (data.active_category || fsort); 25427 cTotal = (typeof data.category_total != 'undefined') ? Number(data.category_total) : ((data.icon_count && typeof data.icon_count[active_category] != 'undefined') ? data.icon_count[active_category] : data.total); 25428 } 25429 var path = data.path; 25430 25431 if(checkFileLink) { 25432 var checkPlan = (typeof property.VALIDPLAN == 'undefined') ? ((typeof VALIDPLAN == 'undefined') ? $.gallery.valid_plan : VALIDPLAN) : property.VALIDPLAN, 25433 checkPType = (typeof property.VALIDTYPE == 'undefined') ? ((typeof VALIDTYPE == 'undefined') ? $.gallery.valid_type : VALIDTYPE) : property.VALIDTYPE, 25434 flink_max = (checkPlan) ? 15 : 0; 25435 25436 if(checkPType == 'BN') flink_max = 100; 25437 else if(checkPType == 'SM') flink_max = $.lang[LANG]['editor.link.file.unlimited']; 25438 25439 thisResourceTab.find('.flink-capacity .flink-cnt').text(cTotal); 25440 thisResourceTab.find('.flink-capacity .flink-max').text(flink_max); 25441 25442 if(cTotal >= flink_max) thisResourceTab.find('.flink-fileinput').addClass('flink-disabled'); 25443 else thisResourceTab.find('.flink-fileinput').removeClass('flink-disabled'); 25444 25445 if(cTotal > page * 100) { 25446 thisResourceTab.find('.resource-row.bottom').addClass('active'); 25447 thisResourceTab.find('.resource-loadmore').attr('onclick', 'resourceGetPage(' + (page+1) + ')'); 25448 } else { 25449 thisResourceTab.find('.resource-row.bottom').removeClass('active'); 25450 thisResourceTab.find('.resource-loadmore').removeAttr('onclick'); 25451 } 25452 25453 if(data.file.length == 0) $.resource.modalFilesEmpty(thisResourceFiles, $.lang[LANG]['editor.link.file.list.empty']); 25454 $.each(data.file, function (idx, val) { 25455 25456 var file_s = (/^[0-9.]*$/.test(val.filesize)) ? val.filesize * 1 : 0, 25457 fsize_obj = formatFileSize(file_s, 2, 'obj'), 25458 tag = '\ 25459 <li class="fitem">\ 25460 <div class="fitem-wrap">\ 25461 <p class="fitem-name" data-seq="' + val.seq + '" data-source="' + val.f
25461ilename + '">' + val.origname + '</p>\ 25462 <p class="fitem-size"><span class="size" data-size="' +file_s +'" data-unit="' + fsize_obj['unit'] + '">' + fsize_obj['val'] + '</span></p>\ 25463 <span class="fitem-ctrl-del" data-page="' + page + '"><svg viewBox="0 0 12 12" width="12" height="12"><path d="M11 2H9V0H3v2H1 0v1h1v7c0 1.1 0.9 2 2 2h6c1.1 0 2-0.9 2-2V3h1V2H11zM4 1H8v1H4V1zM10 10c0 0.6-0.4 1-1 1H3c-0.5 0-1-0.4-1-1V3h1H9h1V10z"></path><rect x="4" y="4" width="1" height="6"></rect><rect x="7" y="4" width="1" height="6"></rect></svg></span>\ 25464 </div>\ 25465 </li>\ 25466 '; 25467 25468 thisResourceFiles.append(tag); 25469 }); 25470 25471 } else if(checkIconStorage) { 25472 if(fsearch != thisResourceTab.find('.resource-search-stx').val()) thisResourceTab.find('.resource-search-stx').val(fsearch); 25473 if(typeof renderIconStorageCategories == 'function') renderIconStorageCategories(thisResourceTab, data, active_category, sfl); 25474 25475 if(data.total == 0 && fsearch) { 25476 var no_result_str = `<span class="no_result_data">${$.lang[LANG]['editor.resource.noresult']}</span>`; 25477 $('#iconstorage ul.files').html(no_result_str); 25478 } else { 25479 if(typeof renderIconStorageFiles == 'function') renderIconStorageFiles(thisResourceTab, data, sfl, page > 1); 25480 } 25481 thisResourceTab.find('.resource-search-btn').removeClass('clicked'); 25482 25483 } else { 25484 if(fsort != thisResourceTab.find('.resource-ctrl-sort select').val()) thisResourceTab.find('.resource-ctrl-sort select').val(fsort).change(); 25485 25486 if(thisResourceTab.find('#nestableFolder').hasClass('ready')) { 25487 $.resource.setMystorageFolder('set_fll'); 25488 if(ffolder && thisResourceTab.find('#nestableFolder .fli[data-id="' + ffolder + '"]').length > 0) thisResourceTab.find('#nestableFolder .fli[data-id="' + ffolder + '"]').addClass('active').siblings().removeClass('active'); 25489 else thisResourceTab.find('#nestableFolder .fli[data-id="all"]').addClass('active').siblings().removeClass('active'); 25490 } 25491 25492 var selected = new Array(); 25493 thisResourceSelected.children('li').each(function() { 25494 selected.push($(this).attr('data-seq')); 25495 }); 25496 25497 page = (data.file.length < 2) ? page-1 : page; 25498 page = (page) ? page : 1; 25499 25500 thisResourceFiles.removeClass('empty'); 25501 thisResourceFiles.find('.resource-empty-area').remove(); 25502 $.each(data.file, function (idx, val) { 25503 var tag = resourceFileTag(val.filename, val.seq, path, selected, val.ffolder, page, val.origname, val.filesize, val.w, val.h, val.magic, val.date); 25504 thisResourceFiles.append(tag); 25505 }); 25506 25507 if(cTotal==0) { 25508 var empty_msg = (fsearch) ? $.lang[LANG]['editor.resource.files.empty'] : $.lang[LANG]['editor.resource.notice.text.top'] + '<br>' + $.lang[LANG]['editor.resource.notice.text.bottom']; 25509 $.resource.modalFilesEmpty(thisResourceFiles, empty_msg); 25510 } else { 25511 var upgrade_link = (checkGabia) ? 'https://www.gabia.com/mygabia/service' : '/upgrade/site/' + SID, 25512 load_btn = '\ 25513 <img src="https://storage.googleapis.com/i.addblock.net/image-upload.gif"> \ 25514 <span class="resource-info"><span data-lang="config.file.browse">' + $.lang[LANG]["config.file.browse"] + '</span></span>\ 25515 <input id="mystorageUploadBtn" class="upload-resource-button" type="file" name="files[]" multiple>\ 25516 ', 25517 upgrade_btn = '\ 25518 <a href="' + upgrade_link + '" style="color: #fff; text-decoration:none;">\ 25519 <i class="fa fa-level-up" aria-hidden="true" style="margin-right: 5px;"></i>\
25520 <span class="resource-info">' + $.lang[LANG]["plan.upgrade"] + '</span>\ 25521 </a>\ 25522 '; 25523 25524 if(typeof thisResourceTab.find('.fileinput-button').attr('data-limit') == 'undefined') { 25525 var check_langs = (typeof SLANG != 'undefined' && !$.isEmptyObject(SLANG.lists) && SLANG.lists.length > 1) ? true : false; 25526 var str = (data.is_limit) ? upgrade_btn : load_btn, 25527 css_str = (data.is_limit) ? { 'background-color':'#4889e7', 'margin-left':'5px' } : {}, 25528 max_str = (data.is_limit) ? '<span class="error">' + $.lang[LANG]['plan.disk-space.limit.info'] + '</span> ' : ''; 25529 if(data.is_limit && check_langs) max_str = '<span class="error" style=" line-height: 1.4; display: inline-block; text-align: right;">' + $.lang[LANG]['plan.disk-space.limit.info.lang'] + '</span>'; 25530 25531 thisResourceTab.find('.fileinput-button').attr('data-limit',data.is_limit).html(str).css(css_str); 25532 thisResourceTab.find('.upload-max-size').html(max_str); 25533 } 25534 } 25535 thisResourceTab.find('.resource-search-btn').removeClass('clicked'); 25536 25537 } 25538 if(thisResourceFiles.data('uiSelectableScroll')) thisResourceFiles.data('uiSelectableScroll').refresh(); 25539 } 25540 thisResourceFiles.removeClass('ready'); 25541 thisResourceFiles.find('.listprogress').remove(); 25542 }, 25543 error: function() { 25544 $.resource.modalFilesEmpty(thisResourceFiles, 'No files uploaded'); 25545 }, 25546 complete: function() { 25547 thisResourceTab.find('.resource-search-btn').removeClass('clicked'); 25548 thisResourceFiles.removeClass('ready'); 25549 thisResourceFiles.find('.listprogress').remove(); 25550 } 25551 }); 25552 25553 cPage = page; 25554 setResourceSelectedBox('my'); 25555 if(!(checkIconStorage && fsearch)) fillResourceViewport(thisResourceTab, thisResourceFiles, page, ffolder, fsort, fsearch); 25556} 25557 25558var fillResourceViewport = function(thisResourceTab, thisResourceFiles, page, ffolder, fsort, fsearch) { 25559 if(!thisResourceTab.length || !thisResourceFiles.length) return; 25560 if(!thisResourceFiles.closest('.modal.in').length) return; 25561 if(thisResourceFiles.hasClass('empty') || thisResourceFiles.find('.resource-empty-area').length > 0) return; 25562 if(thisResourceFiles.find('.listprogress').length > 0 || thisResourceFiles.data('resourceAutoFill')) return; 25563 25564 var rmode = thisResourceTab.attr('id').replace(/storage$/gi,''); 25565 if($.inArray(rmode, ['my','icon']) < 0) return; 25566 if(rmode == 'icon' && typeof isIconStorageHybridMode == 'function' && isIconStorageHybridMode()) return; 25567 25568 var fitem_cnt = thisResourceFiles.find('.fitem').length, 25569 filesEl = thisResourceFiles.get(0); 25570 25571 if(!filesEl || fitem_cnt <= 0 || fitem_cnt >= cTotal) return; 25572 if(filesEl.scrollHeight > filesEl.clientHeight + 1) return; 25573 25574 thisResourceFiles.data('resourceAutoFill', true); 25575 setTimeout(function() { 25576 thisResourceFiles.removeData('resourceAutoFill'); 25577 25578 if(!thisResourceFiles.closest('.modal.in').length) return; 25579 if(thisResourceFiles.find('.listprogress').length > 0) return; 25580 25581 fitem_cnt = thisResourceFiles.find('.fitem').length; 25582 if(fitem_cnt >= cTotal) return; 25583 if(filesEl.scrollHeight > filesEl.clientHeight + 1) return; 25584 25585 thisResourceFiles.append('<li class="listprogress"><svg version="1.1" xmlns="http://www.w3.org/svg/2000" viewBox="0 0 30 30" width="60" style="width:30px; height: 30px;"><circle cy="15" cx="15" r="14" style="stroke:#00baff;"></circle></svg></li>'); 25586 resourceGetPage(page + 1, ffolder, fsort, fsearch); 25587 }, 0); 25588} 25589 25590var resourcePaging = function(page,total,ffolder) { 25591 view = RVIEW; 25592 $('.modal.in .modal-resourcebox .resource-paging').empty(); 25593 25594 page_view = 10; 25595 start = Math.floor((page-1) / page_view) * page_view; 25596 pages = Math.ceil(total/view); 25597 end = (Math.floor((page-1) / page_view) + 1) * page_view; 25598 end = (end>pages) ? pages : end; 25599 25600 prev = (start > 0) ? start : 1; 25601 next = ((end+1) > pages) ? pages : end+1; 25602 25603 ffolder = (ffolder) ? 'ffolder' : 'all'; 25604 25605 var str = '\ 25606 <ul class="pagination pagination-sm" data-pages="'+pages+'">\ 25607 <li><a href="javascript:;" onclick="resourceGetPage(' + prev + ')">«</a></li>\ 25608 '; 25609 for(i=start;i<end;i++) { 25610 active = ((i+1)==page) ? 'active' : ''; 25611 str = str + '\ 25612 <li class="' + active + '"><a href="javascript:;" onclick="resourceGetPage(' + (i+1) + ')">' + (i+1) + '</a></li>\ 25613 '; 25614 } 25615 str = str + '\ 25616 <li><a href="javascript:;" onclick="resourceGetPage(' + next+ ')">»</a></li>\ 25617 </ul>\ 25618 '; 25619 25620 if(total) $('.modal.in .modal-resourcebox .resource-paging').append(str); 25621} 25622 25623function formatFileSize(bytes,decimalPoint,return_style) { 25624 if(typeof return_style == 'undefined' || !return_style) return_style = 'str'; 25625 25626 var return_val = {'val': 0, 'unit': 'Bytes'}; 25627 25628 if(bytes == 0) { 25629 return (return_style == 'obj') ? return_val : '0 KB'; 25630 } 25631 25632 var k = 1024, 25633 dm = decimalPoint || 2, 25634 sizes = ['KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], 25635 i = Math.floor(Math.log(bytes) / Math.log(k)); 25636 25637 return_val['val'] = parseFloat((bytes / Math.pow(k, i)).toFixed(dm)); 25638 return_val['unit'] = sizes[i]; 25639 25640 if(return_style == 'obj') return return_val 25641 else return return_val['val'] + ' ' + return_val['unit']; 25642} 25643 25644var resourceFileTag = function (source, seq, path, selected, ffolder, page, origname, filesize, file_w, file_h, magic, date) { 25645 25646 filesize = (/^[0-9.]*$/.test(filesize)) ? filesize * 1 : 0; 25647 file_w = (/^[0-9.]*$/.test(file_w)) ? file_w * 1 : 0; 25648 file_h = (/^[0-9.]*$/.test(file_h)) ? file_h * 1 : 0; 25649 25650 var active = ($.inArray(seq,selected)>-1) ? ' ui-selected' : '', 25651 blank = (magic == '') ? path + '/' + source : getServeImage(magic,'0',''); 25652 image = (magic == '') ? path + '/800/' + source : magic, 25653 fsize_obj = formatFileSize(filesize, 2, 'obj'); 25654 25655 var ftag_str = '\ 25656 <li class="fitem' + active + '">\ 25657 <div class="fitem-wrap">\ 25658 <div class="fitem-visual">\ 25659 <div class="fitem-thumb">\ 25660 <div class="fitem-mold"><img src="https://storage.googleapis.com/i.addblock.net/sample/sns_cm_1.png"/></div>\
25661 <img class="fitem-img" src="' + image + '" alt="' + source + '">\ 25662 </div>\ 25663 <div class="fitem-name visible-layout-list"><span>'+origname+'</span></div>\ 25664 <div class="fitem-ctrl">\ 25665 <ul data-ffolder="'+ffolder+'" data-page="'+page+'" data-source="'+source+'" data-seq="'+seq+'" data-fsize="'+filesize+'">\ 25666 <li class="hover">\ 25667 <a class="fitem-ctrl-imgview" data-url="' + blank + '" data-img-original="ON">\ 25668 <svg viewBox="0 0 13 13" width="13" height="13"><path d="M5.14 1c2.28 0 4.14 1.86 4.14 4.14 0 2.28-1.86 4.14-4.14 4.14S1 7.43 1 5.14C1 2.86 2.86 1 5.14 1m0-1C2.3 0 0 2.3 0 5.14s2.3 5.14 5.14 5.14 5.14-2.3 5.14-5.14S7.98 0 5.14 0z"/><path d="M12.5 13a.47.47 0 0 1-.35-.15L8.22 8.92c-.2-.2-.2-.51 0-.71s.51-.2.71 0l3.93 3.93c.2.2.2.51 0 .71-.1.1-.23.15-.36.15z"/></svg>\ 25669 </a>\ 25670 </li>\ 25671 <li class="hover">\ 25672 <a class="fitem-ctrl-down" href="/down/fetchimg?s=' + blank + '" alt="' + source + '" download="' + origname + '" target="_self">\ 25673 <svg viewBox="0 0 13 13" width="13" height="13"><path d="M6.46 7.59 2.71 3.83 2 4.54l3.76 3.75.7.71.71-.71 3.76-3.75-.71-.71z"/><path d="M6 8V0h1v8z"/><path d="M12 12V7h1v5z"/><path d="M0 12V7h1v5z"/><path d="M13 13H0v-1h13z"/></svg>\ 25674 </a>\ 25675 </li>\ 25676 <li class="hover">\ 25677 <span class="fitem-ctrl-del">\ 25678 <svg viewBox="0 0 12 13" width="12" height="13"><path d="M12 2H9V0H3.02v2H0v1h1v8c0 1.1.9 2 2 2h6c1.1 0 2-.9 2-2V3h1V2zM4.02 1H8v1H4.02V1zM10 11c0 .55-.45 1-1 1H3c-.55 0-1-.45-1-1V3h8v8z"></path><path d="M4 4h1v7H4z"></path><path d="M7 4h1v7H7z"></path></svg>\ 25679 </span>\ 25680 </li>\ 25681 <li class="visible-layout-list w132"><span class="fitem-date">' + date + '</span></li>\ 25682 <li class="visible-layout-list w85"><span class="fitem-size2">' + file_w + 'x' + file_h + '</span></li>\ 25683 <li class="visible-layout-list w82"><span class="fitem-size3" data-unit="'+fsize_obj['unit']+'">'+fsize_obj['val']+'</span></li>\ 25684 </ul>\ 25685 </div>\ 25686 </div>\ 25687 <div class="fitem-content visible-layout-grid">\ 25688 <p class="fitem-name" data-seq="' + seq + '" data-source="' + source + '" data-magic="' + magic + '" data-toggle="tooltip" data-placement="top" data-original-title="' + origname + '">' + origname + '</p>\ 25689 <p class="fitem-size"><span class="size" data-size="'+filesize+'" data-unit="'+fsize_obj['unit']+'">'+fsize_obj['val']+'</span><span class="width">'+file_w+'</span><span class="height">'+file_h+'</span></p>\ 25690 <p class="visible-layout-grid fitem-date2">' + date + '</p>\ 25691 </div>\ 25692 </div>\ 25693 </li>\ 25694 '; 25695 25696 return $(ftag_str); 25697} 25698 25699 25700var myStorageActive = function() { 25701 return ($('#mystorage').hasClass('active')) ? true : false; 25702} 25703 25704var frStorageUpload = function(v,w,id) { 25705 var deferred = $.Deferred(), 25706 id = (typeof id != 'undefined' && id) ? id : $('li[data-source="' + v + '"]').attr('data-id'); 25707 25708 var ex = v.split("|"), 25709 s = []; 25710 if(ex.length>1) { 25711 $.each(ex, function(i,d) { 25712 s[i] = $('li[data-source="' + d + '"]').attr('data-id'); 25713 }); 25714 } else { 25715 s[0] = id; 25716 } 25717 var ids = s.join("|"); 25718 25719 setTimeout(function() { 25720 $.ajax({ 25721 type : 'post', 25722 url: '/template/frstorage/upload', 25723 data: { img : v, sid : SID, w : w, ids : ids }, 25724 dataType: 'json', 25725 async: false, 25726 success: function (data) { 25727 $.processOFF(); 25728 if(data.error) { 25729 alert(data.error); 25730 deferred.reject(data.error); 25731 return false;
25732 } 25733 deferred.resolve(data); 25734 }, 25735 error: function(xhr, status) { 25736 $.processOFF(); 25737 var msg = (status == 'parsererror') ? 'ì´ë¯¸ì§ ì ë¡ë ìëµì ì²ë¦¬íì§ ëª»íìµëë¤.' : 'ì´ë¯¸ì§ ì ë¡ë ì¤ ì¤ë¥ê° ë°ìíìµëë¤.'; 25738 alert(msg); 25739 deferred.reject(msg); 25740 } 25741 }); 25742 }); 25743 return deferred.promise(); 25744} 25745 25746var uploadReviewQnaImg = function (e) { 25747 var mode = e.data.mode; 25748 if(mode != 'qna' && mode != 'review'){ 25749 return false; 25750 } 25751 var imageCnt = $('.'+mode+'-files-list').children('li').length; 25752 if (imageCnt >= 5) { 25753 alert('ì´ë¯¸ì§ë ìµë 5ê°ê¹ì§ ë±ë¡ì´ ê°ë¥í©ëë¤.'); 25754 return false; 25755 } 25756 25757 var sid = $('#'+mode+'-file').attr('data-sid'), 25758 uid = $('#'+mode+'-file').attr('data-uid'); 25759 25760 $.uploadON(); 25761 $(this).fileupload({ 25762 url: '/_upload/type/'+mode+'/sid/'+sid+'/uid/'+uid, 25763 dataType: 'json', 25764 pasteZone: null, 25765 async: true, 25766 sequentialUploads: true, 25767 change: function(e, data) { 25768 var fileCount = $('.'+mode+'-files-list>li').length + data.files.length; 25769 if(fileCount > 5) { 25770 alert('ì´ë¯¸ì§ë ìµë 5ê°ê¹ì§ ë±ë¡ì´ ê°ë¥í©ëë¤.'); 25771 return false; 25772 } 25773 25774 var ext = ['gif', 'jpg', 'jpeg', 'png', 'webp']; 25775 var maxSize = 1024 * 1024 * 10; 25776 var flag = true; 25777 $.each(data.fileInput[0]['files'], function(idx, item){ 25778 var extAry = item['name'].toLowerCase().split('.'); 25779 if (ext.indexOf(extAry[extAry.length - 1]) == -1) { 25780 alert($.lang[LANG]['editor.upload.error.ext']); 25781 flag = false; 25782 return false; 25783 } 25784 25785 var fileSize = item['size']; 25786 if (fileSize > maxSize) { 25787 alert($.lang[LANG]['editor.upload.max.1'] + $.lang[LANG]['editor.upload.max.2']); 25788 flag = false; 25789 return false; 25790 } 25791 }); 25792 25793 if(flag === false) { 25794 return false; 25795 } 25796 25797 }, 25798 add: function(e, data) { 25799 var r = $.upload_add(e,data,'image'); 25800 25801 if(r.submit) { 25802 var jqXHR = data.submit(); 25803 UPLOAD++; 25804 } else { 25805 data.context.find('.loading').html('<i class="fa fa-times error"></i>'); 25806 data.context.find('.ing').addClass('error').text(r.err); 25807 } 25808 25809 $('.uploadModal .upload-cancel .btn, .uploadModal .upload-close').off('click').on('click', function(e) { 25810 if(jqXHR != undefined) jqXHR.abort(); 25811 data.context.fadeOut().remove(); 25812 $('.uploadModal #file-upload-progress').css('width','0%'); 25813 $.uploadOFF(); 25814 UPLOAD = 0; 25815 UPLOADED = 0; 25816 PROGRESS = 0; 25817 }); 25818 }, 25819 progress: function(e, data) { 25820 $.upload_progress(e,data); 25821 }, 25822 done: function(e, data) { 25823 $.upload_done(e,data); 25824 if(typeof data.result.error != 'undefined' && data.result.error) { 25825 $.processOFF(); 25826 return false; 25827 } 25828 25829 UPLOADED++; 25830 var src = (typeof data.result.magic != 'undefined') ? data.result.magic : data.result.src; 25831 var src_orig = (typeof data.result.magic != 'undefined') ? data.result.src_orig : ''; 25832 var uploadedImg = '\ 25833 <li id="'+mode+'-image-'+imageCnt+'">\ 25834 <img src="'+src+'" class="img-responsive" />\ 25835 <input type="hidden" name="'+mode+'_image[]" value="'+src+'" />\ 25836 <input type="hidden" name="'+mode+'_image_orig[]" value="'+src_orig+'" />\ 25837 <div class="cl-s-files-img-close '+mode+'-img-close"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 8 8" width="8" height="8"><path d="M4.71 4l3.15-3.15c0.2-0.2 0.2-0.51 0-0.71s-0.51-0.2-0.71 0L4 3.29 0.85 0.15c-0.2-0.2-0.51-0.2-0.71 0s-0.2 0.51 0 0.71L3.29 4 0.15 7.15c-0.2 0.2
25837-0.2 0.51 0 0.71C0.24 7.95 0.37 8 0.5 8s0.26-0.05 0.35-0.15L4 4.71l3.15 3.15C7.24 7.95 7.37 8 7.5 8s0.26-0.05 0.35-0.15c0.2-0.2 0.2-0.51 0-0.71L4.71 4z"/></svg></div>\ 25838 </li>\ 25839 '; 25840 25841 $('.'+mode+'-files-list').append(uploadedImg); 25842 imageCnt++; 25843 25844 if(UPLOADED) { 25845 if(UPLOAD==UPLOADED) { 25846 setTimeout(function() { 25847 $.uploadOFF(); 25848 UPLOAD = 0; 25849 UPLOADED = 0; 25850 PROGRESS = 0; 25851 },1000); 25852 } 25853 } 25854 }, 25855 progressall: function (e, data) { 25856 $.upload_progressall(e,data); 25857 }, 25858 start : function(e, data) { 25859 $.upload_start(e,data); 25860 progress1 = 0; progress2 = 0; PROGRESS = 0; 25861 }, 25862 dragover : function(e, data) { 25863 e.preventDefault(); 25864 }, 25865 }).prop('disabled', !$.support.fileInput) 25866 .parent().addClass($.support.fileInput ? undefined : 'disabled'); 25867} 25868 25869var deleteReviewQnaImg = function(e) { 25870 var mode = e.data.mode; 25871 if(mode != 'qna' && mode != 'review'){ 25872 return false; 25873 } 25874 var parent = $(this).closest('li'); 25875 var src_orig = parent.find('input[name="'+mode+'_image_orig[]"]').val(); 25876 var seq = $('#'+mode+'-file').data('seq'); 25877 var src_files = ''; 25878 var src_files_orig = ''; 25879 25880 if(seq) { 25881 if($('.'+mode+'-files-list').children('li').length > 0) { 25882 $('.'+mode+'-files-list').children('li').each(function() { 25883 if(src_orig != $(this).find('input[name="'+mode+'_image_orig[]"]').val()) { 25884 if(src_files != '') src_files +='||'; 25885 src_files += $(this).find('input[name="'+mode+'_image[]"]').val(); 25886 if(src_files_orig != '') src_files_orig +='||'; 25887 src_files_orig += $(this).find('input[name="'+mode+'_image_orig[]"]').val(); 25888 } 25889 }); 25890 } 25891 } 25892 25893 $.processON('Deleting File...'); 25894 $.ajax({ 25895 type: 'POST', 25896 url: '/_image_delete', 25897 data: { 25898 s: src_orig, 25899 seq: seq, 25900 src_files: src_files, 25901 src_files_orig: src_files_orig, 25902 mode: mode, 25903 }, 25904 async: true, 25905 success: function(data) { 25906 // console.log(data); 25907 checkError(data); 25908 parent.remove(); 25909 $.processOFF(); 25910 } 25911 }); 25912} 25913 25914var addrSearchModal = function(input_mode) { 25915 if(typeof input_mode == 'undefined' || input_mode.length == 0) input_mode = 'input'; 25916 25917 if($('script[src="https://t1.kakaocdn.net/mapjsapi/bundle/postcode/prod/postcode.v2.js"]').length === 0) { 25918 $.getScript('https://t1.kakaocdn.net/mapjsapi/bundle/postcode/prod/postcode.v2.js') 25919 .done(function() { 25920 $('head').append('<script src="https://t1.kakaocdn.net/mapjsapi/bundle/postcode/prod/postcode.v2.js"></script>'); 25921 setTimeout(function() { addrSearchModal(input_mode); }, 500); 25922 }).fail(function() { console.log('daum maps script fail'); }); 25923 } else { 25924 25925 if($('#addr-modal').length === 0) { 25926 var add_position = ($('.mall-mypage-wrap').length > 0) ? $('.mall-mypage-wrap') : $('body'), 25927 as_backdrop = '<div class="addr-modal-backdrop" style="display: none;"></div>'; 25928 as_modal = '<div id="addr-modal" style="display: none;">\ 25929 <div class="close">\ 25930 주ì 찾기\ 25931 <div id="btn-addr-close"><img src="https://storage.googleapis.com/i.addblock.net/fa-close-modal.png" alt="close"></div>\ 25932 </div>\ 25933 <div id="addr-body"></div>\ 25934 </div>'; 25935 25936 add_position.append(as_backdrop + as_modal); 25937 } else { 25938 $('#addr-body').html(''); 25939 } 25940 25941 25942 $(document).on('click','#btn-addr-close, .addr-modal-backdrop', function() { 25943 $('#addr-modal').fadeOut(300); 25944 $('.addr-modal-backdrop').fadeOut(300, function() { $(this).removeClass('in'); }); 25945 }); 25946 25947 25948 25949 // Internet Explorer 6-11 25950 var isIE = /*@cc_on!@*/false || !!document.documentMode; 25951 25952 if(isIE && input_mode == 'my-input') { 25953 25954 kakao.postcode.load(function(){ 25955 new kakao.Postcode({ 25956 oncomplete: function(data) { 25957 var addr = ''; // 주ì ë³ì 25958 var extraAddr = ''; // ì°¸ê³ í목 ë³ì 25959 25960 if (data.userSelectedType === 'R') { // ì¬ì©ìê° ëë¡ëª 주ì를 ì ííì ê²½ì° 25961 addr = data.roadAddress; 25962 } else { // ì¬ì©ìê° ì§ë² 주ì를 ì ííì ê²½ì°(J) 25963 addr = data.jibunAddress; 25964 } 25965 25966 if(data.userSelectedType === 'R'){ 25967 if(data.bname !== '' && /[ë|ë¡|ê°]$/g.test(data.bname)){ 25968 extraAddr += data.bname; 25969 } 25970 25971 if(data.buildingName !== '' && data.apartment === 'Y'){ 25972 extraAddr += (extraAddr !== '' ? ', ' + data.buildingName : data.buildingName); 25973 } 25974 25975 if(extraAddr !== ''){ 25976 extraAddr = ' (' + extraAddr + ')'; 25977 } 25978 } 25979 25980 $('#'+input_mode+"-postcode").attr('value',data.zonecode); 25981 $('#'+input_mode+"-addr1").attr('value',addr+extraAddr).addClass('has-value'); 25982 25983 setTimeout(function() { 25984 $('#'+input_mode+"-addr2").focus(); 25985 },200); 25986 25987 }, 25988 width : '100%', 25989 height : '100%', 25990 maxSuggestItems : 5 25991 }).open(); 25992 }); 25993 25994 } else if(input_mode =="addrPopup"){ 25995 kakao.postcode.load(function(){ 25996 new kakao.Postcode({ 25997 oncomplete: function(data) { 25998 var addr = ''; // 주ì ë³ì 25999 var extraAddr = ''; // ì°¸ê³ í목 ë³ì 26000 26001 if (data.userSelectedType === 'R') { // ì¬ì©ìê° ëë¡ëª 주ì를 ì ííì ê²½ì° 26002 addr = data.roadAddress; 26003 } else { // ì¬ì©ìê° ì§ë² 주ì를 ì ííì ê²½ì°(J) 26004 addr = data.jibunAddress; 26005 } 26006 26007 if(data.userSelectedType === 'R'){ 26008 if(data.bname !== '' && /[ë|ë¡|ê°]$/g.test(data.bname)){ 26009 extraAddr += data.bname; 26010 } 26011 26012 if(data.buildingName !== '' && data.apartment === 'Y'){ 26013 extraAddr += (extraAddr !== '' ? ', ' + data.buildingName : data.buildingName); 26014 } 26015 26016 if(extraAddr !== ''){ 26017 extraAddr = ' (' + extraAddr + ')'; 26018 } 26019 } 26020 $('#'+input_mode+"-postcode").attr('value',data.zonecode); 26021 $('#'+input_mode+"-addr1").attr('value',addr+extraAddr).addClass('has-value'); 26022 26023 $('#addr-modal').fadeOut(300); 26024 $('.addr-modal-backdrop').fadeOut(300, function() { $(this).removeClass('in'); }); 26025 26026 setTimeout(function() { 26027 $('#'+input_mode+"-addr2").focus(); 26028 },200); 26029 26030 }, 26031 width : '100%', 26032 height : '100%', 26033 maxSuggestItems : 5 26034 }).embed(document.getElementById('addr-body')); 26035 26036 $('#addr-modal').fadeIn(300); 26037 $('.addr-modal-backdrop').fadeIn(300, function() { $(this).addClass('in'); }); 26038 }); 26039 } else { 26040 kakao.postcode.load(function(){ 26041 new kakao.Postcode({ 26042 oncomplete: function(data) { 26043 var addr = ''; // 주ì ë³ì 26044 var extraAddr = ''; // ì°¸ê³ í목 ë³ì 26045 26046 if (data.userSelectedType === 'R') { // ì¬ì©ìê° ëë¡ëª 주ì를 ì ííì ê²½ì° 26047 addr = data.roadAddress; 26048 } else { // ì¬ì©ìê° ì§ë² 주ì를 ì ííì ê²½ì°(J) 26049 addr = data.jibunAddress; 26050 } 26051 26052 if(data.userSelectedType === 'R'){ 26053 if(data.bname !== '' && /[ë|ë¡|ê°]$/g.test(data.bname)){ 26054 extraAddr += data.bname; 26055 } 26056 26057 if(data.buildingName !== '' && data.apartment === 'Y'){ 26058 extraAddr += (extraAddr !== '' ? ', ' + data.buildingName : data.buildingName); 26059 } 26060 26061 if(extraAddr !== ''){ 26062 extraAddr = ' (' + extraAddr + ')'; 26063 } 26064 } 26065 $('#'+input_mode+"-postcode").attr('value',data.zonecode); 26066 $('#'+input_mode+"-addr1").attr('value',addr+extraAddr).addClass('has-value'); 26067 $('#addr-modal').fadeOut(300); 26068 $('.addr-modal-backdrop').fadeOut(300, function() { $(this).removeClass('in'); }); 26069 26070 setTimeout(function() { 26071 $('#'+input_mode+"-addr2").focus(); 26072 },200); 26073 26074 }, 26075 width : '100%', 26076 height : '100%', 26077 maxSuggestItems : 5 26078 }).embed(document.getElementById('addr-body')); 26079 26080 $('#addr-modal').fadeIn(300); 26081 $('.addr-modal-backdrop').fadeIn(300, function() { $(this).addClass('in'); }); 26082 }); 26083 26084 } 26085 } 26086} 26087var stickyToolbar = function() { 26088 if($('.gallery-header').length == 0) return; 26089 var sticky = $('.gallery-modal > .container').offset().top - 50, 26090 w = $('.gallery-items .table-item').width(); 26091 if($('.gallery-modal > .container').outerHeight() + sticky < 0) { 26092 $('.gallery-modal .toolbar, .gallery-modal .table-col').addClass('sticky'); 26093 $('.table-toolbar').css('width',w + 'px'); 26094 } else { 26095 $('.gallery-modal .toolbar, .gallery-modal .table-col').removeClass('sticky'); 26096 $('.table-toolbar').css('width','auto'); 26097 } 26098} 26099 26100var saveGalleryBlockName = function($this,blockname) { 26101 var blockID = $this.parents('.gallery-name').attr('data-gallery-id'); 26102 if(typeof blockID == "undefined" || !blockID) { 26103 $this.showModalFlat('ERROR',$.lang[LANG]['board.error-setting-value'],true,false,'','ok'); 26104 return false;
26105 } 26106 var settings = (typeof SETTINGS =='undefined') ? $.gallery.site_settings : SETTINGS; 26107 var bookmark_list = (typeof settings.blockBookmarkList != 'undefined' && settings.blockBookmarkList) ? settings.blockBookmarkList : {}, 26108 isBookmark = (typeof bookmark_list['bookmark'+blockID] != 'undefined' && bookmark_list['bookmark'+blockID]) ? true : false, 26109 before_bookmark_name_arr = [], 26110 blockname_list = (typeof settings.blocknameList != 'undefined' && settings.blocknameList) ? settings.blocknameList : {}, 26111 regex = /[\{\}\[\]\/!?.,;:|\)*~`^\-+<>@\#$%&\\\=\(\'\"]/gi, 26112 err_str = '', 26113 isUpdate = false; 26114 26115 if(!$.isEmptyObject(bookmark_list)) { // ì´ì bookmark name ì¤ì í ë¸ë ì´ë¦ í¬í¨ 26116 $.each(bookmark_list, function(k,v) { 26117 if(typeof blockname_list[k.replace('bookmark','blockname')] == 'undefined') { 26118 before_bookmark_name_arr.push(v); 26119 } 26120 }); 26121 } 26122 26123 var blockname_list_arr = (!$.isEmptyObject(blockname_list)) ? Object.keys(blockname_list).map(function(e) { return blockname_list[e]; }) : new Array(); 26124 26125 if(typeof blockname_list['blockname'+blockID] != 'undefined' && blockname_list['blockname'+blockID] == blockname) { 26126 $('.blockname-edit').remove(); 26127 return false; 26128 } else if (blockname.length == 0 || blockname.length > 20) { 26129 err_str = $.lang[LANG]['config.blockinfo.name.length']; 26130 } else if (regex.test(blockname)) { 26131 err_str = $.lang[LANG]['config.blockinfo.name.specialchar']; 26132 } else if ($.inArray(blockname,blockname_list_arr) > -1 || $.inArray(blockname,before_bookmark_name_arr) > -1) { 26133 err_str = $.lang[LANG]['config.blockinfo.name.overlap']; 26134 } else { 26135 $.post('/template/element/type/blockname/seq/'+blockID, { sid: SID, val: blockname }, function(data) { 26136 if(typeof data.error != 'undefined' && data.error) { 26137 err_str = data.error; 26138 } else { 26139 isUpdate = true; 26140 } 26141 }, 'json'); 26142 } 26143 26144 if(err_str.length > 0 ) { 26145 $this.showModalFlat($.lang[LANG]['config.information'],err_str,true,false,'','ok', '', 'cl-p130 cl-cmmodal cl-s-btn w560 cl-p0 cl-okbtn-pbt70'); 26146 } else { 26147 $this.parents('.gallery-name').find('.gallery-block-name').text(blockname); 26148 $this.parents('.gallery-name-edit-input').remove(); 26149 if($.gallery.block_id == blockID) { 26150 $('#gallery-name').text(blockname); 26151 } 26152 } 26153 26154 if(!isUpdate) return false; 26155 blocknameUpdate(SID,blockID,blockname); 26156 blocknameListUpdate('update',SID,blockID,blockname); 26157 if(isBookmark) blockBookmarkListUpdate('update',SID,blockID,blockname); 26158} 26159 26160var blocknameDelete = function(sid, seq) { 26161 var settings = (typeof SETTINGS =='undefined') ? $.gallery.site_settings : SETTINGS; 26162 if (typeof seq == 'undefined' || typeof sid == 'undefined' || !seq || !sid) return false; 26163 26164 var hasBookmark = (typeof settings.blockBookmarkList != 'undefined' && typeof settings.blockBookmarkList['bookmark' + seq] != 'undefined'); 26165 if (hasBookmark && $('#tpl-menu li a[href="@' + seq + '"][attr-bookmark]').length > 0) { 26166 resetLink($('#tpl-menu li a[href="@' + seq + '"][attr-bookmark]').text()); 26167 } 26168 26169 blocknameUpdate(sid, seq, ''); 26170 blocknameListUpdate('delete', sid, seq); 26171} 26172 26173var blocknameUpdate = function(sid, id, name) { 26174 var elsettings = { blockname: name }, 26175 delete_key = (typeof name == 'undefined' || !name) ? 'blockname' : ''; 26176 26177 $.post('/template/settings', { sid: sid, settings: JSON.stringify(elsettings), el: id, delete: delete_key }, function(data) { 26178 var isCheck = checkError(data); 26179 if (!isCheck) return false; 26180 26181 $('.property-blockname-wrap .blockname-txt').text(name); 26182 }, 'json'); 26183} 26184 26185var blocknameListUpdate = function(fn, sid, id, name) { 26186 var settings = (typeof SETTINGS =='undefined') ? $.gallery.site_settings : SETTINGS; 26187 26188 if (typeof settings.blocknameList == 'undefined') { settings.blocknameList = {}; } 26189 var blockname_list = {}; 26190 26191 if (fn == 'update') { 26192 var blockname_item = {}; 26193 blockname_item['blockname' + id] = name; 26194 blockname_list = $.extend({}, settings.blocknameList, blockname_item); 26195 } else if (fn == 'delete') { 26196 if (typeof settings.blocknameList['blockname' + id] == 'undefined') { return false; } 26197 delete settings.blocknameList['blockname' + id]; 26198 blockname_list = settings.blocknameList; 26199 } 26200 26201 var update = { blocknameList: blockname_list }, 26202 delete_key = ($.isEmptyObject(blockname_list)) ? 'blocknameList' : ''; 26203 26204 $.post('/template/settings', { sid: sid, settings: JSON.stringify(update), el: 'site_settings', delete: delete_key }, function(data) { 26205 var isCheck = checkError(data); 26206 if (!isCheck) return false;
26207 settings.blocknameList = blockname_list; 26208 }, 'json'); 26209} 26210 26211var blockBookmarkDelete = function(sid, seq) { 26212 var settings = (typeof SETTINGS =='undefined') ? $.gallery.site_settings : SETTINGS; 26213 if (typeof seq == 'undefined' || typeof sid == 'undefined' || !seq || !sid || typeof settings.blockBookmarkList == 'undefined' || typeof settings.blockBookmarkList['bookmark' + seq] == 'undefined') return false; 26214 if ($('#tpl-menu li a[href="@' + seq + '"][attr-bookmark]').length > 0) { 26215 resetLink($('#tpl-menu li a[href="@' + seq + '"][attr-bookmark]').text()); 26216 } 26217 blockBookmarkUpdate(sid, seq, false); 26218 blockBookmarkListUpdate('delete', sid, seq); 26219} 26220 26221var blockBookmarkUpdate = function(sid, id, onoff) { 26222 var elsettings = { bookmark: onoff }; 26223 var delete_key = (onoff) ? '' : 'bookmark'; 26224 26225 $.post('/template/settings', { sid: sid, settings: JSON.stringify(elsettings), el: id, delete: delete_key }, function(data) { 26226 var isCheck = checkError(data); 26227 if (!isCheck) return false; 26228 26229 if (onoff) $('.element[data-id="' + id + '"]').attr('data-bookmark', id); 26230 else $('.element[data-id="' + id + '"]').removeAttr('data-bookmark'); 26231 }, 'json'); 26232} 26233 26234var blockBookmarkListUpdate = function(fn, sid, id, name) { 26235 var settings = (typeof SETTINGS =='undefined') ? $.gallery.site_settings : SETTINGS; 26236 if (typeof settings.blockBookmarkList == 'undefined') { settings.blockBookmarkList = {}; } 26237 var bookmark_list = {}; 26238 26239 if (fn == 'update') { 26240 var bookmark_item = {}; 26241 bookmark_item['bookmark' + id] = name; 26242 bookmark_list = $.extend({}, settings.blockBookmarkList, bookmark_item); 26243 } else if (fn == 'delete') { 26244 if (typeof settings.blockBookmarkList['bookmark' + id] == 'undefined') { return false; } 26245 delete settings.blockBookmarkList['bookmark' + id]; 26246 bookmark_list = settings.blockBookmarkList; 26247 } 26248 26249 var update = { blockBookmarkList: bookmark_list }, 26250 delete_key = ($.isEmptyObject(bookmark_list)) ? 'blockBookmarkList' : ''; 26251 26252 $.post('/template/settings', { sid: sid, settings: JSON.stringify(update), el: 'site_settings', delete: delete_key }, function(data) { 26253 var isCheck = checkError(data); 26254 if (!isCheck) return false; 26255 settings.blockBookmarkList = bookmark_list; 26256 }, 'json'); 26257 26258 if (fn == 'delete') { //gallery item - link(attr-bookmark) unset 26259 $.post('/template/element/type/gitem-bookmarklink-delete/seq/' + id, { sid: SID }, function(data) { 26260 checkError(data); 26261 }, 'json'); 26262 } 26263} 26264 26265var makeBookmarkList = function(bookmarklist, type, id, link) { 26266 var str = '', 26267 isActive = ''; 26268 26269 if (typeof bookmarklist == 'undefined' || !bookmarklist) return str; 26270 if (bookmarklist == '{}') bookmarklist = {}; 26271 var hideArray = bookmarklist?.hide || []; 26272 26273 $.each(bookmarklist, function(k, v) { 26274 var n_k = k.replace('bookmark', ''); 26275 if (k != 'hide') { 26276 isActive = (k == link.replace(/^\@/g, 'bookmark')) ? 'active' : ''; 26277 if (hideArray.length > 0) { 26278 if (hideArray.includes(n_k)) { 26279 return true; 26280 } else { 26281 str = str + '<li class="' + isActive + '" data-bookmark="' + k + '" data-bookmark-name="' + v + '"><a href="javascript:;">' + v + '</a></li>'; 26282 } 26283 } else { 26284 str = str + '<li class="' + isActive + '" data-bookmark="' + k + '" data-bookmark-name="' + v + '"><a href="javascript:;">' + v + '</a></li>'; 26285 } 26286 } 26287 }); 26288 return str; 26289} 26290 26291var galleryStatusInit = function() { 26292 $('.gallery-items > div').removeClass('active ui-selected').find('input').prop('checked',''); 26293 // $('.table-toolbar > li').addClass('disabled').find('i[data-cmd="visible"]').text('ì¨ê¹'); 26294 $('.table-toolbar > li').find('i[data-cmd="visible"]').text('ì¨ê¹'); 26295 $('.gallery-toolbar .toolbar.mod-gallery').remove(); 26296} 26297 26298var shoppingGalleryResize = function() { 26299 var $list = $('.product-gallery-list'), 26300 $category = $('.gallery-category'), 26301 $more = $('.gallery-items-loadmore'), 26302 $items = $('.gallery-items'), 26303 $toggle = $('.product-gallery-list-toggle'), 26304 $pagination = $('.pagination-wrap'), 26305 $filter = $('.gallery-list-filter'), 26306 $name = $('.selected-gallery-name'), 26307 $lux_filter = $('.shop-filter-header'), 26308 svg_open = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-chevron-right" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z"/></svg>', 26309 svg_close = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-chevron-left" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M11.354 1.646a.5.5 0 0 1 0 .708L5.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0"/></svg>', 26310 status = window.localStorage.getItem('product-gallery-closed'); 26311 var w = $('.gallery-modal')[0]['clientWidth'], 26312 t = ($('.gallery-modal').hasClass('shopping')) ? true : false, 26313 g = (t) ? 1440 : 0, 26314 o = ($('.product-gallery-list').hasClass('open')) ? true : false;
26315 26316 if(g > 0 && w <= g && o == true) { 26317 $toggle.removeClass('open'); 26318 $list.removeClass('open'); 26319 $category.removeClass('open'); 26320 $more.removeClass('open'); 26321 $items.removeClass('open'); 26322 $pagination.removeClass('open'); 26323 $filter.removeClass('open'); 26324 $name.removeClass('open'); 26325 $lux_filter.removeClass('open'); 26326 if($toggle.hasClass('open')) { 26327 $toggle.html(svg_open); 26328 } else { 26329 $toggle.html(svg_close); 26330 } 26331 } 26332 if(w > g && status == 'false') { 26333 $toggle.addClass('open'); 26334 $list.addClass('open'); 26335 $category.addClass('open'); 26336 $more.addClass('open'); 26337 $items.addClass('open'); 26338 $pagination.addClass('open'); 26339 $filter.addClass('open'); 26340 $name.addClass('open'); 26341 $lux_filter.addClass('open'); 26342 if($toggle.hasClass('open')) { 26343 $toggle.html(svg_open); 26344 } else { 26345 $toggle.html(svg_close); 26346 } 26347 } 26348} 26349 26350var resizeGalleryModal = function() { 26351 var w = $('.gallery-modal')[0]['clientWidth'], 26352 $c_p = $('.gallery-modal > .gallery-header'), 26353 $c_m = $('.gallery-modal > .container, .gallery-modal > .gallery-items, .gallery-modal > .gallery-items-loadmore'), 26354 t = ($('.gallery-modal').hasClass('shopping')) ? true : false, 26355 g = (t) ? 1124 : 1146, 26356 p = ((w-g) > 0) ? (w-g)/2 : 0, 26357 scroll_bar = ($.browser.safari == undefined) ? 17 : 8; 26358 if(p < 50) p = 50; 26359 $c_p.css({'padding-left': p + 'px', 'padding-right': p + 'px'}); 26360 $c_m.css({'margin-left': p + 'px', 'margin-right': p + 'px', 'width': 'auto', 'max-width': '100%'}); 26361 document.querySelector('.gallery-modal').style.setProperty('--gallery-modal-pl', p+'px', null); 26362 document.querySelector('.gallery-modal').style.setProperty('--gallery-modal-pr', (p+scroll_bar)+'px', null); 26363} 26364 26365var switchDownload = function(option_onoff) { 26366 if($('#download-product').is(':checked') === true) { //ë¤ì´ë¡ë ìí 26367 var firstOption = $('.prod-option[data-option_mode="normal"] .prod-option-list > li').eq(1); 26368 var noneOption = $('.prod-option[data-option_mode="normal"] .prod-option-list > li').eq(0); 26369 26370 var downloadContent = ''; 26371 var state = false; 26372 26373 if ($('#none-option-file').length > 0 && option_onoff == 'on') { 26374 if ($('#none-option-file .file-name').length > 0) { 26375 // var optionSeq = (firstOption.find('.prod-option-title').attr('data-seq')!='')? firstOption.find('.prod-option-title').attr('data-seq') : ''; 26376 var fileUrl = $('#none-option-file .file-url').text(), 26377 fileSize = $('#none-option-file .file-size').text(), 26378 fileNameDetail = $('#none-option-file .file-name-detail').text(), 26379 realFileName = $('#none-option-file .real-file-name').text(); 26380 state = true; 26381 } else if($('#none-option-file .none-file-name').length > 0) { 26382 // var optionSeq = (firstOption.find('.prod-option-title').attr('data-seq')!='')? firstOption.find('.prod-option-title').attr('data-seq') : ''; 26383 var fileUrl = $('#none-option-file .none-file-url').text(), 26384 fileSize = $('#none-option-file .none-file-size').text(), 26385 fileNameDetail = $('#none-option-file .none-file-name-detail').text(), 26386 realFileName = $('#none-option-file .none-real-file-name').text(); 26387 26388 state = true; 26389 } 26390 26391 var dataPn = $('#none-option-file .cl_icon_close').attr('data-pn'), 26392 dataFile = $('#none-option-file .cl_icon_close').attr('data-file'); 26393 var fileCnt = 2; 26394 var optionSeq = $('#none-option-file .cl_icon_close').attr('data-seq'); 26395 } 26396 if(firstOption.find('.file-name').length > 0 && option_onoff == 'off'){ 26397 var optionSeq = (noneOption.find('.prod-option-title').attr('data-seq')!='')? noneOption.find('.prod-option-title').attr('data-seq') : ''; 26398 var fileUrl = firstOption.find('.file-url').text(), 26399 fileSize = firstOption.find('.file-size').text(), 26400 fileNameDetail = firstOption.find('.file-name-detail').text(), 26401 realFileName = firstOption.find('.real-file-name').text(), 26402 dataPn = firstOption.find('.cl_icon_close').attr('data-pn'), 26403 dataFile = firstOption.find('.cl_icon_close').attr('data-file'); 26404 var fileCnt = 1; 26405 state = true; 26406 } 26407 // console.log(state); 26408 if(state === true) { 26409 downloadContent = '\ 26410 <div class="file-name file-name-'+fileCnt+'">\
26411 <span class="real-file-name">'+realFileName+'</span>\ 26412 <span class="file-name-detail" title="'+realFileName+'">'+fileNameDetail+'</span>\ 26413 <span class="file-size">'+fileSize+'</span>\ 26414 <span class="cl-icon cl_icon_close" data-cnt="1" data-pn="'+dataPn+'" data-file="'+dataFile+'" data-seq="'+optionSeq+'"></span>\ 26415 <span class="file-url">'+fileUrl+'</span>\ 26416 </div>\ 26417 '; 26418 } 26419 // console.log(downloadContent); 26420 if ($('#normal-option').is(':checked') === true) { 26421 // console.log(firstOption.find('.file-box-list')); 26422 firstOption.find('.file-box-list').html(downloadContent); 26423 firstOption.find('.prod-option-status').text('í매').attr('data-val', 'S'); 26424 26425 $('#add-upload-check .product-upload').remove(); 26426 noneOption.find('.file-name').remove(); 26427 } else { 26428 var html = '\ 26429 <div class="product-upload">\ 26430 <div class="title">íì¼ ì ë¡ë</div>\ 26431 <div class="download-contents">\ 26432 <span class="cl_icon_upload02" data-cnt="0">ì ë¡ë</span>\ 26433 <div id="none-option-file">'+downloadContent+'</div>\ 26434 </div>\ 26435 </div>'; 26436 26437 $('#add-upload-check').prepend(html); 26438 noneOption.find('.file-box-list').html(downloadContent); 26439 if ($('#none-option-file').length == 0) { 26440 $('.switch-product[value="off"]').prop('checked', true); 26441 $('#status-append').fadeOut(0); 26442 $('#sale-calendar').hide(); 26443 } 26444 // firstOption.find('.file-name').remove();; 26445 } 26446 } 26447} 26448 26449var prodOptionMoveSvg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path d="M8 6c0-.83.67-1.5 1.5-1.5S11 5.17 11 6s-.67 1.5-1.5 1.5S8 6.83 8 6m5 0c0-.83.67-1.5 1.5-1.5S16 5.17 16 6s-.67 1.5-1.5 1.5S13 6.83 13 6m-5 6c0-.83.67-1.5 1.5-1.5s1.5.67 1.5 1.5-.67 1.5-1.5 1.5S8 12.83 8 12m5 0c0-.83.67-1.5 1.5-1.5s1.5.67 1.5 1.5-.67 1.5-1.5 1.5S13 12.83 13 12m-5 6c0-.83.67-1.5 1.5-1.5s1.5.67 1.5 1.5-.67 1.5-1.5 1.5S8 18.83 8 18m5 0c0-.83.67-1.5 1.5-1.5s1.5.67 1.5 1.5-.67 1.5-1.5 1.5S13 18.83 13 18"/></svg>'; 26450 26451var addProductOption = function(optionMode) { 26452 var $parent; 26453 var option_mode; //ì¼ë°, ì ë ¥, ì¶ê° 26454 26455 if(optionMode=='normal' || optionMode=='text' || optionMode=='additional'){ 26456 $parent = $('.prod-option[data-option_mode="'+optionMode+'"]'); 26457 option_mode = optionMode; //ì¼ë°, ì ë ¥, ì¶ê° 26458 } else { 26459 $parent = $(this).parent(); 26460 option_mode = $parent.data('option_mode'); //ì¼ë°, ì ë ¥, ì¶ê° 26461 } 26462 26463 if($parent.find('.prod-option-item.hide').length) { 26464 $parent.find('.prod-option-item.hide').closest('li').addClass('err').find('.edit-option-title input').focus(); 26465 r = shoppingSetOption($parent.find('.prod-option-item.hide')); 26466 if(r == false) return r; 26467 } 26468 26469 var state = 'normal-product'; 26470 $('.cl_product_state_check').each(function () { 26471 if ($(this).hasClass('active') === true) { 26472 state = $(this).attr('for'); 26473 } 26474 }); 26475 var status = true; 26476 var productNumber = $('#prod-no').val(); 26477 26478 // if (option_mode == "normal" && productNumber) { 26479 // if($('.prod-option[data-option_mode="normal"] .prod-option-list>li').length <= 1) { 26480 // $.ajax({ 26481 // url: '/shopping/download_list_check', 26482 // type: 'post', 26483 // dataType: 'json', 26484 // data: {'product_number': productNumber}, 26485 // success: function (data) { 26486 // if (data.code == 'fail') { 26487 // alert(data.message); 26488 // status = false; 26489 // return false; 26490 // } 26491 // } 26492 // }); 26493 // } 26494 // } 26495 26496 // if (status == false) return false; 26497 26498 var tax = $('#tax').attr('data-total-tax'), 26499 check_quantity = $('.prod-detail-wrap .switch-quantity').prop('checked'); 26500 26501 var item = ''; 26502 if(option_mode == "text") { 26503 if($parent.find('li').length >= 6) { 26504 $('.prod-option[data-option_mode="text"] > .prod-option-add').addClass('disabled'); 26505 } 26506 if($parent.find('li').length >= 7) { 26507 alert('ì ë ¥í ìµì ì ìµë 7ê°ê¹ì§ ì¶ê°í ì ììµëë¤.'); 26508 return false;
26509 } 26510 item = '\ 26511 <li>\ 26512 <div class="prod-option-item hide">\ 26513 <span class="prod-option-title"></span>\ 26514 <span class="prod-option-require"></span>\ 26515 </div>\ 26516 <div class="prod-option-edit">\ 26517 <div class="form-wrap">\ 26518 <div class="form-group edit-option-title">\ 26519 <input type="text" maxlength="20" placeholder="ìë´ë¬¸êµ¬ ì ë ¥ (ì:ëê»ë¥¼ mmë¨ìë¡ ì ë ¥í´ì£¼ì¸ì.)"/>\ 26520 </div>\ 26521 <div class="edit-option-delete"><svg viewBox="0 0 12 13" width="12" height="13"><path d="M12 2h-1H9V0H3.02v2H1 0v1h1v8c0 1.1 0.9 2 2 2h6c1.1 0 2-0.9 2-2V3h1V2zM4.02 1H8v1H4.02V1zM10 11c0 0.55-0.45 1-1 1H3c-0.55 0-1-0.45-1-1V3h1.02H9h1V11z"/><rect x="4" y="4" width="1" height="7"/><rect x="7" y="4" width="1" height="7"/></svg></div>\ 26522 </div>\ 26523 </div>'; 26524 } else { 26525 item = '\ 26526 <li>\ 26527 <div class="prod-option-item hide">\
26528 <span class="prod-option-move cl-sort-handle">' + clSVG('move_handle', 20, 20) + '</span>\ 26529 <span class="prod-option-title"></span>\ 26530 <span class="prod-option-price"></span>\ 26531 <span class="prod-option-quantity"></span>\ 26532 <span class="prod-option-status"></span>\ 26533 <div class="edit-option-delete"><svg viewBox="0 0 12 13" width="12" height="13"><path d="M12 2h-1H9V0H3.02v2H1 0v1h1v8c0 1.1 0.9 2 2 2h6c1.1 0 2-0.9 2-2V3h1V2zM4.02 1H8v1H4.02V1zM10 11c0 0.55-0.45 1-1 1H3c-0.55 0-1-0.45-1-1V3h1.02H9h1V11z"/><rect x="4" y="4" width="1" height="7"/><rect x="7" y="4" width="1" height="7"/></svg></div>\ 26534 </div>\ 26535 <div class="prod-option-edit">\ 26536 <div class="form-wrap">\ 26537 <span class="prod-option-move cl-sort-handle">' + clSVG('move_handle', 20, 20) + '</span>\ 26538 <div class="form-group edit-option-title">\ 26539 <input type="text" maxlength="60" placeholder="ìµì ê°"/>\ 26540 </div>\ 26541 <div class="form-group edit-option-price">\ 26542 <input type="text" class="option-price-number sign" placeholder="0" numberonly/>\ 26543 </div>\ 26544 <div class="form-group edit-option-quantity" ' + ((check_quantity) ? '' : 'style="display:none"') + '>\ 26545 <input type="text" class="option-price-quantity" maxlength="5" placeholder="0" numberonly/>\ 26546 </div>\ 26547 <div class="form-group edit-option-select">'; 26548 if (state == 'download-product' && $parent.attr('data-option_mode') == "normal") item += '<div class="option-price-status-str hand" data-val="O">íì </div>'; 26549 else item += '<div class="option-price-status-str hand" data-val="S">í매</div>'; 26550 item += '<ul class="option-price-status-select">\ 26551 <li data-val="S">í매</li>\ 26552 <li data-val="O">íì </li>\ 26553 <li data-val="H">ì¨ê¹</li>\ 26554 </ul>\ 26555 </div>\ 26556 <div class="edit-option-delete"><svg viewBox="0 0 12 13" width="12" height="13"><path d="M12 2h-1H9V0H3.02v2H1 0v1h1v8c0 1.1 0.9 2 2 2h6c1.1 0 2-0.9 2-2V3h1V2zM4.02 1H8v1H4.02V1zM10 11c0 0.55-0.45 1-1 1H3c-0.55 0-1-0.45-1-1V3h1.02H9h1V11z"/><rect x="4" y="4" width="1" height="7"/><rect x="7" y="4" width="1" height="7"/></svg></div>\ 26557 </div>\ 26558 </div>'; 26559 if (state == 'download-product' && $parent.attr('data-option_mode') == "normal") { 26560 item += '\ 26561 <div class="form-group product-status">\ 26562 <div class="product-state-box">\ 26563 <div class="product-upload">\ 26564 <div class="title">íì¼ ì ë¡ë</div>\ 26565 <div class="download-contents">\ 26566 <span class="cl_icon_upload02" data-cnt="'+fileUpdateCnt+'">ì ë¡ë</span>\ 26567 <div class="file-box-list" id="file-box-'+fileUpdateCnt+'"></div>\ 26568 </div>\ 26569 </div>\ 26570 </div>\ 26571 </div>'; 26572 fileUpdateCnt++; 26573 } 26574 } 26575 26576 26577 item += '</li>'; 26578 var $item = $(item); 26579 26580 $parent.find('.prod-option-list').append($item); 26581 $('.prod-option[data-option_mode="'+option_mode+'"] .prod-option-list>li:last-child').find('.edit-option-title input').focus(); 26582 26583 $('.plus-price').removeClass('hide'); 26584 // $('.plus-quantity').removeClass('hide'); 26585 $('.plus-status').removeClass('hide'); 26586 26587 // if(option_mode == "normal") { 26588 // $('.plus-price').text('ì¶ê°ê¸ì¡'); 26589 // $('.plus-quantity').text('ìë'); 26590 // $('.plus-status').text('ìí'); 26591 // } else if(option_mode == "additional") { 26592 // $('#plus-addt-price').text('ê¸ì¡'); 26593 // $('#plus-addt-quantity').text('ìë'); 26594 // $('#plus-addt-status').text('ìí'); 26595 // } else if (option_mode == "text") { 26596 // $('#check-require').text('íìì¬ë¶'); 26597 // } 26598 26599 if($('.switch-quantity').is(":checked") == true) { 26600 if($('#normal-option').is(':checked') === true) { 26601 // $('#prod-quantity').attr('readonly','true').removeClass('hide').attr('placeholder','ìµì ìì ì¬ê³ ê´ë¦¬'); 26602 $('.quantity-label').addClass('on'); 26603 $('.plus-quantity').removeClass('hide'); 26604 } else if($('#normal-option').is(':checked') === false && $('#additional-option').is(':checked') === true) { 26605 $('.quantity-label').removeClass('on'); 26606 $('#prod-quantity').removeAttr('readonly').removeClass('hide'); 26607 $('.plus-quantity').removeClass('hide'); 26608 } else { 26609 $('.quantity-label').removeClass('on'); 26610 $('#prod-quantity').removeAttr('readonly').removeClass('hide'); 26611 $('.plus-quantity').addClass('hide'); 26612 } 26613 } else { 26614 $('.quantity-label').removeClass('on'); 26615 $('.switch-quantity').parents('.form-wrap').addClass('disabled'); 26616 $('#prod-quantity').addClass('hide'); 26617 $('.prod-option-quantity, .prod-plus-quantity, .edit-option-quantity').hide(); 26618 $('.plus-quantity').addClass('hide'); 26619 } 26620 26621 return true; 26622} 26623 26624var shoppingSetOption = function(optionItem) { 26625 26626 if($('.prod-option-item.hide').length) { 26627 var $o = (optionItem)? optionItem : $('.prod-option-item.hide'); 26628 var ret = true; 26629 26630 $o.each(function(){ 26631 var $t = $(this).parent().find('.prod-option-edit input'); 26632 // console.log($t); 26633 26634 var $title = $t.closest('.form-wrap').find('.edit-option-title input'), 26635 $desc = $t.closest('.form-wrap').find('.edit-option-desc input'), 26636 $price = $t.closest('.form-wrap').find('.edit-option-price input'), 26637 $quantity = $t.closest('.form-wrap').find('.edit-option-quantity input'), 26638 $status = $t.closest('.form-wrap').find('.option-price-status-str'), 26639 $text_require = $t.closest('.form-wrap').find('.option-require-str'); 26640 26641 var price = removeCommas($price.val()), quantity = removeCommas($quantity.val()); 26642 if (!price) price = 0; 26643 if (!quantity) quantity = 0; 26644 26645 if(typeof quantity == 'string') { 26646 quantity = quantity.replace(/,/gi,'') ; 26647 } 26648 26649 quantity = Number(quantity); 26650 26651 price = parseInt(price); 26652 quantity = (quantity * 1); 26653 if(String(price) == "NaN") price = 0; 26654 var abs_price = Math.abs(price), 26655 str_price = abs_price.toString(), 26656 str_quantity = quantity.toString(); 26657 26658 if(isNaN(price) === true) { 26659 $price.val(0); 26660 price = 0; 26661 $t.closest('li').find('.prod-option-price').attr('data-option-price', price); 26662 } 26663 26664 $t.closest('li').find('.prod-option-title').text($title.val()); 26665 $t.closest('li').find('.prod-option-desc').text($desc.val()); 26666 $t.closest('li').find('.prod-option-price').text(addCommas(str_price)); 26667 $t.closest('li').find('.prod-option-quantity').text(addCommas(str_quantity)); 26668 $t.closest('li').find('.prod-option-status').text($status.text()); 26669 26670 if(price < 0) { 26671 $t.closest('li').find('.prod-option-price').addClass('minus'); 26672 } else { 26673 $t.closest('li').find('.prod-option-price').removeClass('minus'); 26674 } 26675 // if($text_require.find('input').is(':checked') == true) { 26676 // var checkbox = "\ 26677 // <span>íì</span>\ 26678 // <svg class='active' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' width='16' height='16'>\ 26679 // <path d='M13 0H3C1.34 0 0 1.34 0 3v10c0 1.66 1.34 3 3 3h10c1.66 0 3-1.34 3-3V3C16 1.34 14.66 0 13 0zM13.03 6.03l-5.5 5.5C7.38 11.68 7.19 11.75 7 11.75s-0.38-0.07-0.53-0.22l-3.5-3.5c-0.29-0.29-0.29-0.77 0-1.06s0.77-0.29 1.06 0L7 9.94l4.97-4.97c0.29-0.29 0.77-0.29 1.06 0S13.32 5.74 13.03 6.03z'/>\ 26680 // </svg>"; 26681 // $t.parents('li').find('.prod-option-require').html(checkbox); 26682 // } else { 26683 // var checkbox = "\ 26684 // <span>íì</span>\ 26685 // <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' width='16' height='16'>\ 26686 // <path d='M13 0H3C1.3 0 0 1.3 0 3v10c0 1.7 1.3 3 3 3h10c1.7 0 3-1.3 3-3V3C16 1.3 14.7 0 13 0zM15 13c0 1.1-0.9 2-2 2H3c-1.1 0-2-0.9-2-2V3c0-1.1 0.9-2 2-2h10c1.1 0 2 0.9 2 2V13z'/>\ 26687 // </svg>"; 26688 // $t.parents('li').find('.prod-option-require').html(checkbox); 26689 // } 26690 var option_type = $t.closest('.prod-option').attr('data-option_mode'); 26691 26692 if(product_options.advanced == 'false') { 26693 if($title.val() === undefined || $title.val().trim().length == 0 || (option_type == 'text' && $title.val().trim().length > 20)) { 26694 $t.closest('li').addClass('err'); 26695 if($title.val().trim().length > 20) {
26696 alert('ìµì ëª ì 20ìê¹ì§ ì ë ¥ì´ ê°ë¥í©ëë¤.'); 26697 } 26698 ret = false; 26699 return false; 26700 } 26701 } 26702 if($quantity.val() == '') $t.closest('li').find('.prod-option-quantity').text('0'); 26703 if($('.switch-quantity').is(':checked') == true && $t.closest('li').find('.prod-option-quantity').text() == '0') { 26704 $t.closest('li').find('.option-price-status-str').attr('data-val','O').text('íì '); 26705 $t.closest('li').find('.prod-option-status').attr('data-val','O').text('íì '); 26706 } 26707 26708 $t.closest('.prod-option-edit').addClass('hide'); 26709 $t.closest('li').find('.prod-option-item').removeClass('hide'); 26710 $t.closest('li').removeClass('err'); 26711 26712 ret = true; 26713 }); 26714 26715 return ret; 26716 } 26717} 26718 26719var checkDuplicateOptionName = function(el) { 26720 var titles = $('.prod-option-title').map(function(idx, v) { 26721 var str = $(v).text().trim(); 26722 if(str.length > 0) return str; 26723 }).get(); 26724 var input = el.val().trim(); 26725 var cnt = titles.filter(function(el){ 26726 return el == input; 26727 }).length; 26728 var flag = false; 26729 26730 if(input.length > 0 && cnt > 1) { 26731 el.parents('li').find('.prod-option-title').text(''); 26732 el.val(''); 26733 el.focus(); 26734 flag = true; 26735 alert('ìµì ëª ì¤ë³µ ì¤ë¥ì ëë¤.'); 26736 } else { 26737 el.parents('li').find('.prod-option-title').removeClass('now-input'); 26738 } 26739 26740 return flag; 26741} 26742 26743var siteConfigOthersCheckModal = function(sid,check_id,check_uadmin,success_callback,cancel_callback) { 26744 26745 var config_url = (check_uadmin) ? '/_config' : '/config', 26746 check_data = { 26747 'id': check_id, 26748 'edit': check_uadmin, 26749 'step': 'check' 26750 }; 26751 26752 $.post('/umember/login/others', { 26753 'sid': sid, 26754 'data': JSON.stringify(check_data) 26755 }, function(data) { 26756 26757 if(typeof data.error != 'undefined' && data.error) { 26758 $(this).showModalFlat('ERROR', data.error, true, false, '', 'close'); 26759 return false; 26760 } 26761 26762 if(typeof success_callback == 'undefined' || !success_callback) { 26763 success_callback = function() { 26764 setSiteLogs('config','enter','','dashboard'); 26765 location.href = config_url; 26766 }; 26767 } 26768 26769 if(!data.result) { 26770 success_callback(); 26771 } else { 26772 var o_id = data.others_id, 26773 str = $.lang[LANG]['config.modal.others-login.3'] + o_id + $.lang[LANG]['config.modal.others-login.1'] + o_id + $.lang[LANG]['config.modal.others-login.2'], 26774 checkOtherLoginModal = $(this).showModalFlat($.lang[LANG]['config.information'], str, true, true, function() { 26775 $.processON('Other Login Disconnecting...'); 26776 26777 var set_data = check_data; 26778 set_data['step'] = 'set'; 26779 26780 $.ajax({ 26781 type: 'POST', 26782 url: '/umember/login/others', 26783 data: { sid: SID, data: JSON.stringify(set_data) }, 26784 dataType: 'json', 26785 async: true, 26786 success: function(data) { 26787 setTimeout(function() { 26788 $.processOFF(); 26789 success_callback(); 26790 }, 400); 26791 } 26792 }); 26793 26794 }, 'cancel', 'ok', 'cl-p70 cl-cmmodal cl-s-btn w560 cl-p0 login-modal', '', '', '', cancel_callback); 26795 } 26796 26797 }, 'json'); 26798} 26799 26800var changeBrokenImages = function(el) { 26801 if($(el).length == 0) return; 26802 // if($(el).find('.hideBlockWrap').length > 0) return; 26803 var broken_icon = '//storage.googleapis.com/i.addblock.net/icon_broken_img.png', 26804 broken_image = '//storage.googleapis.com/i.addblock.net/img_broken.png', 26805 broken_popup = '//storage.googleapis.com/i.addblock.net/img_broken_fill_500.png'; 26806 26807 var checkBlockConfig = $(el).is('#el-blockConfig'), 26808 checkSiteConfig = $(el).is('#el-siteConfig'), 26809 checkElement = $(el).is('.element'), 26810 checkMenu = $(el).is('header'), 26811 // broken_img = (checkBlockConfig || checkMenu) ? '//storage.googleapis.com/i.addblock.net/icon_broken_img.png' : '//storage.googleapis.com/i.addblock.net/img_broken.png', 26812 broken_img = (checkBlockConfig) ? broken_icon : broken_image, 26813 broken_bg = (checkBlockConfig) ? 'none' : 'url(' + broken_img + ')'; 26814 26815 if(checkElement || checkMenu) { 26816 var el_bg = $(el).css('background-image').replace(/^url\(['"]?([^'"]+)['"]?\)/, '$1'); 26817 26818 el_bg = el_bg.replace(/^(http)?(s)?(:)?\/\/i\.addblock\.net\//g,'//storage.googleapis.com/i.addblock.net/'); 26819 if(el_bg.match(/(http)?(s)?(\:)?\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/) != null) { 26820 $('<img>', { src : el_bg }).on('error', function(e) { 26821 console.log('block bg img error: '+el_bg); 26822 26823 $(el).css('background-image',broken_bg); 26824 e.target.remove(); 26825 }.bind(this)); 26826 } 26827 } 26828 26829 $(el).find('[data-attach="true"]:not(img), #preview-image').each(function() { 26830 var this_attach = $(this), 26831 attch_bg = this_attach.css('background-image').replace(/^url\(['"]?([^'"]+)['"]?\)/, '$1'), 26832 this_el = this_attach.closest('.element').attr('data-el'); 26833 26834 attch_bg = attch_bg.replace(/^(http)?(s)?(:)?\/\/i\.addblock\.net\//g,'//storage.googleapis.com/i.addblock.net/'); 26835 if(attch_bg.match(/(http)?(s)?(\:)?\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/) != null) { 26836 $('<img>', { src : attch_bg }).on('error', function(e) { 26837 console.log('attach bg img error: '+attch_bg); 26838 26839 if(this_attach.is('[data-target]')) { 26840 // img_broken background-image inline css reset 26841 var attach_html = this_attach.outerHTML(); 26842 this_attach.replaceWith(attach_html.replace(/style\=\"(.+)?background\-image\:([^\;]+)\;\"(\=\"\")?/gi,'')); 26843 26844 var this_selector = '.' + $('.'+this_el).attr('data-name') + ' ' + this_attach.attr('data-target'), 26845 this_css = $('#'+this_el+'css').html(); 26846 $('#'+this_el+'css').html( this_css + this_selector + ' { background-image: ' + broken_bg + '; }'); 26847 } else { 26848 this_attach.css('background-image',broken_bg); 26849 } 26850 e.target.remove(); 26851 }.bind(this)); 26852 } 26853 }); 26854 26855 $(el).find('img').each(function() { 26856 var el_img = $(this); 26857 var this_img = el_img.attr('src'); 26858 if(typeof this_img == 'undefined' || this_img == '') return; 26859 26860 if(this_img.match(/^\/\/i\.addblock\.net\//gi) !== null) { 26861 this_img = this_img.replace(/^\/\/i\.addblock\.net\//gi,'//storage.googleapis.com/i.addblock.net/'); 26862 $(this).attr('src',this_img); 26863 } 26864 26865 $(this).error(function() { 26866 // console.log('img error: '+this_img); 26867 $(this).attr('data-orgimg',this_img); 26868 26869 if(checkSiteConfig) { 26870 if($(this).closest('.sc-banner-img-thumb').length > 0) { 26871 var e_b_type = $(this).closest('.tab-panel').attr('data-type'), 26872 e_b_id = $(this).closest('.panel-banner-item').attr('data-id'), 26873 e_b_device = $(this).closest('.sc-banner-img').attr('data-device'); 26874 26875 $(this).unbind('error').attr('src', broken_icon); 26876 if(e_b_device == 'p') $(this).closest('.panel-banner-item').find('.pt-thumb img').unbind('error').attr('src', broken_icon); 26877 if(e_b_type == 'band') { 26878 var e_b_root = (e_b_device == 'p') ? '--scbandBanner-img-pc' : '--scbandBanner-img-mobile'; 26879 document.querySelector('#el-siteConfig .sc-siteBanner .banner-box[data-id="'+e_b_id+'"][data-type="'+e_b_type+'"] .banner-img').style.setProperty(e_b_root, 'url('+broken_popup+')', null); 26880 } 26881 } 26882 } else { 26883 $(this).unbind('error').attr('src', broken_img) 26884 .removeAttr('data-storage') 26885 .removeAttr('data-photo-id') 26886 .removeAttr('data-img-val') 26887 .removeAttr('data-width'); 26888 if(checkBlockConfig) { 26889 if($(this).closest('.attach-thumb').length > 0) $(this).closest('.attach-thumb').eq(0).css('background-image', broken_bg); 26890 } else { 26891 if($(this).closest('.img-wrapper').find('.g-img').length > 0) $(this).closest('.img-wrapper').find('.g-img').css('background-image', broken_bg); 26892 } 26893 } 26894 }); 26895 26896 if(checkBlockConfig) { 26897 this_img = replaceBrokenImages(this_img, 'icon'); 26898 if(this_img.match(/^(http)?(s)?(:)?\/\/storage\.googleapis\.com\/i\.addblock\.net\/icon_broken_img\.png/gi) !== null) $(this).closest('.attach-thumb').eq(0).css('background-image', broken_bg); 26899 } 26900 26901 el_img.attr('src', this_img); 26902 }); 26903 26904 if($(el).attr('data-type') == 'video' && $(el).attr('data-mode') == 'zoom') { 26905 $(el).find('.video-gallery-url').each(function(idx, v) { 26906 if($(v).attr('href').indexOf('youtu') > -1) { 26907 let poster = $(v).attr('data-poster'); 26908 const testImg = new Image(); 26909 testImg.onload = function () { 26910 if (this.width <= 120 && this.height <= 90) { 26911 const thumb = poster.replace('maxresdefault', '0'); 26912 $(v).attr('data-poster', thumb); 26913 $(v).find('.ly-img').css('background-image', 'url(' + thumb + ')'); 26914 } 26915 }; 26916 testImg.src = poster; 26917 } 26918 }); 26919 } 26920} 26921 26922var replaceBrokenImages = function(path,return_type) { 26923 var check_broken_icon = /^(http)?(s)?(:)?\/\/storage\.googleapis\.com\/i\.addblock\.net\/icon_broken_img\.png/gi, 26924 check_broken_img = /^(http)?(s)?(:)?\/\/storage\.googleapis\.com\/i\.addblock\.net\/img_broken\.png/gi, 26925 v = path; 26926 26927 if(return_type == 'img') return v.replace(check_broken_icon, '//storage.googleapis.com/i.addblock.net/img_broken.png'); 26928 else return v.replace(check_broken_img, '//storage.googleapis.com/i.addblock.net/icon_broken_img.png'); 26929} 26930 26931var getServeImage = function(f,w,path) { 26932 if(f == undefined) return; 26933 var r = ''; 26934 if(typeof w === 'number') w = String(w); 26935 if(f.indexOf('googleusercontent') > -1) { 26936 var magic_type = (typeof SETTINGS != 'undefined') ? SETTINGS.magic_type : property.SETTINGS.magic_type, 26937 check_magic_type = (typeof magic_type != 'undefined' && magic_type == 'webp') ? true : false;
26938 t = (check_magic_type) ? '-rw' : ''; 26939 26940 var n = f.indexOf('='); 26941 f = f.substring(0, n != -1 ? n : f.length); 26942 switch(w) { 26943 case "0" : r = f + '=s0'+t; break; 26944 case "30" : r = f + '=w30'+t; break; 26945 case "60" : r = f + '=w60-h60-n'+t; break; 26946 case "250" : r = f + '=w250-h250-n'+t; break; 26947 case "300" : r = f + '=w300-h300-n'+t; break; 26948 case "500" : r = f + '=w500-h700-n'+t; break; //5:7 26949 case "600" : r = f + '=w600-h600-n'+t; break; //1:1 26950 case "650" : r = f + '=w650-h366-n'+t; break; //16:9 26951 case "670" : r = f + '=w670-h1005-n'+t; break; //6:9 26952 case "700" : r = f + '=w700-h500-n'+t; break; //7:5 26953 case "800" : r = f + '=w800'+t; break; 26954 26955 case "540" : r = f + '=w600-h480-n'+t; break; //5:4 26956 case "430" : r = f + '=w600-h450-n'+t; break; //4:3 26957 case "320" : r = f + '=w600-h400-n'+t; break; //3:2 26958 case "169" : r = f + '=w650-h366-n'+t; break; //16:9 26959 case "450" : r = f + '=w480-h600-n'+t; break; //4:5 26960 case "340" : r = f + '=w450-h600-n'+t; break; //3:4 26961 case "230" : r = f + '=w400-h600-n'+t; break; //2:3 26962 case "916" : r = f + '=w450-h800-n'+t; break; //9:16 26963 26964 case "1920" : 26965 $.ajax({ 26966 type: 'POST', 26967 url: '/template/image', 26968 data: { url : f, width : w }, 26969 dataType: 'json', 26970 async: false, 26971 success: function(data) { 26972 if(typeof data.s800 != 'undefined') { 26973 if(w == "800") 26974 r = (Number(data.s800) > 2560) ? f + '=s0' : f + '=w800-h' + data.s800 + '-n'; 26975 if(w == "1920") 26976 r = (Number(data.s1920) > 2560) ? f + '=s0' : f + '=w1920-h' + data.s1920 + '-n'; 26977 r+=t; 26978 } else { 26979 r = (check_magic_type) ? f+'=-rw' : f; 26980 } 26981 } 26982 }); 26983 break; 26984 case "map-info" : r = f + '=w640-h550-n'+t; break; 26985 default : r = (check_magic_type) ? f+'=-rw' : f; break; 26986 } 26987 } else { 26988 if(f.indexOf('matcheslux.com') > -1 || f.indexOf('bullanseo.com') > -1 || f.indexOf('bullanseon.com') > -1 || f.indexOf('eccla.co.kr') > -1 || f.indexOf('bullanseo.cafe24.com') > -1) { 26989 r = f; 26990 } else { 26991 path = (path.slice(-1) == '/') ? path : path + '/'; 26992 // r = (f.indexOf('http:') > -1) ? f : (w == "0" || w == "") ? path + f : path + w + '/' + f; 26993 if(f.indexOf('//') > -1) { 26994 if(w == "0" || w == "") { 26995 file_name = f.split('/').pop(); 26996 r = path + file_name; 26997 } 26998 } else { 26999 r = (w == "0" || w == "") ? path + f : path + w + '/' + f; 27000 } 27001 // r = (f.indexOf('//') > -1) ? f : (w == "0" || w == "") ? path + f : path + w + '/' + f; 27002 } 27003 } 27004 return r; 27005} 27006 27007Date.prototype.format = function (f) { 27008 if (!this.valueOf()) return " "; 27009 27010 var weekName = ["ì¼ìì¼", "ììì¼", "íìì¼", "ììì¼", "목ìì¼", "ê¸ìì¼", "í ìì¼"]; 27011 var d = this; 27012 27013 return f.replace(/(yyyy|yy|MM|dd|E|hh|mm|ss|a\/p)/gi, function(da) { 27014 switch (da) { 27015 case "yyyy": return d.getFullYear(); 27016 case "yy": return (d.getFullYear() % 1000).zf(2); 27017 case "MM": return (d.getMonth() + 1).zf(2); 27018 case "dd": return d.getDate().zf(2); 27019 case "E": return weekName[d.getDay()]; 27020 case "HH": return d.getHours().zf(2); 27021 case "hh": return ((h = d.getHours() % 12) ? h : 12).zf(2); 27022 case "mm": return d.getMinutes().zf(2); 27023 case "ss": return d.getSeconds().zf(2); 27024 case "a/p": return d.getHours() < 12 ? "ì¤ì " : "ì¤í"; 27025 default: return da; 27026 } 27027 }); 27028}; 27029 27030String.prototype.string = function(len){var s = '', i = 0; while (i++ < len) { s += this; } return s;}; 27031String.prototype.zf = function(len){return "0".string(len - this.length) + this;}; 27032Number.prototype.zf = function(len){return this.toString().zf(len);}; 27033 27034var galleryDeleteItem = function(seq,callback) { 27035 if(CANCEL) return true; 27036 var item_page = $('.gallery-items div[data-seq="' + seq + '"]').attr('data-page'); 27037 $.ajax({ 27038 url: '/template/element/type/get-projectPage-bookmarkBlock/seq/' + seq, 27039 data: {sid: SID, page: item_page}, 27040 dataType: 'json', 27041 type: 'POST', 27042 async: true, 27043 cache: false, 27044 success: function (data) { 27045 checkError(data); 27046 if(typeof callback == 'function') { 27047 callback(data); 27048 } 27049 } 27050 }, 'json'); 27051} 27052 27053var glItemDelete = function(ids, page) { 27054 $.post('/template/gallery/delete', { sid: SID, s: ids, page: page }, function(data) { 27055 checkError(data); 27056 }, 'json'); 27057} 27058function removeOptionModal(optionList, optionMode) { 27059 // console.log(optionList); 27060 var sid = (typeof SID == 'undefined') ? property.SID : SID; 27061 if(optionList.length > 0) { 27062 var modal = $(this).showModalFlat($.lang[LANG]['config.information'], 'ì íí ìµì ì ìì íìê² ìµëê¹?', true, true, function() { 27063 optionList.each(function(){ 27064 var seq = $(this).find('.prod-option-title').attr('data-seq'); 27065 27066 if(typeof seq != "undefined" || seq) { 27067 $.post('/template/products', { seq : seq, sid : sid, type : 'delete', mode: 'option' }, function(data) { 27068 if(typeof data.error != "undefined" || data.error) { 27069 alert(data.error); 27070 return false;
27071 } 27072 27073 var liTotal = 0; 27074 $('.prod-option-list > li').each(function () { liTotal++; }); 27075 if (liTotal < 2) $('.prod-option .plus-price').addClass('hide'); 27076 }, 'json'); 27077 } else { 27078 var liTotal = 0; 27079 $('.prod-option-list > li').each(function () { liTotal++; }); 27080 if (liTotal < 2) $('.prod-str-price').text(''); 27081 } 27082 }); 27083 27084 optionList.remove(); 27085 $('.prod-option[data-option_mode="'+optionMode+'"]').addClass('hide'); 27086 27087 var cnt = $('.prod-option[data-option_mode="normal"] .prod-option-list > li').length; 27088 if (cnt <= 1) { 27089 var html = '<div class="download-contents">\ 27090 <span class="cl_icon_upload02" data-cnt="0">ì ë¡ë</span>\ 27091 <div id="none-option-file"></div>\ 27092 </div>'; 27093 fileUpdateCnt++; 27094 27095 $('#add-upload-check').prepend(html); 27096 if ($('#none-option-file').length > 0) { 27097 $('.switch-product[value="off"]').prop('checked', true); 27098 $('#status-append').fadeOut(0); 27099 $('#sale-calendar').hide(); 27100 } 27101 } 27102 27103 modal.modal('hide'); 27104 }, 'cancel', 'ok', 'cl-p130 cl-cmmodal cl-s-btn w560 cl-p0', false, function(){ 27105 $('#'+optionMode+'-option').prop('checked', true); 27106 }, '', function(){ 27107 if(optionMode == 'normal') { 27108 if($('.prod-option[data-option_mode="normal"] .prod-option-list > li').length > 1) { 27109 $('#'+optionMode+'-option').prop('checked', true); 27110 } 27111 } else { 27112 if($('.prod-option[data-option_mode="'+optionMode+'"] .prod-option-list > li').length > 0) { 27113 $('#'+optionMode+'-option').prop('checked', true); 27114 } 27115 } 27116 }); 27117 } else { 27118 $('.prod-option[data-option_mode="'+optionMode+'"]').addClass('hide'); 27119 } 27120} 27121 27122$(function () { 27123 $(document).on('change', '.review-checkbox-check', function () { 27124 if ($(this).is(':checked') === true) { 27125 $(this).closest('.form-wrap').removeClass('disabled'); 27126 $('.photo-review-tab').removeClass('hide'); 27127 } else { 27128 $(this).closest('.form-wrap').addClass('disabled'); 27129 $('.photo-review-tab').addClass('hide'); 27130 $('.photo-review-top-view').addClass('hide'); 27131 $('.photo-review-tab #use-review-img-upload').prop('checked',false); 27132 $('.photo-review-tab #photo-review').prop('checked',false); 27133 } 27134 }); 27135 27136 $(document).on('change', '#use-review-img-upload', function () { 27137 if ($(this).is(':checked') === true) { 27138 $('.photo-review-top-view').removeClass('hide'); 27139 } else { 27140 $('.photo-review-top-view').addClass('hide'); 27141 $('.photo-review-tab #photo-review').prop('checked',false); 27142 } 27143 }); 27144 27145 $(document).on('change', '.qna-checkbox-check', function () { 27146 if ($(this).is(':checked') === true) { 27147 $(this).closest('.form-wrap').removeClass('disabled'); 27148 } else { 27149 $(this).closest('.form-wrap').addClass('disabled'); 27150 } 27151 }); 27152 27153 $(document).on('change', '.option-state-box .status-checkbox', function (e) { 27154 if($(this).attr('id') == 'normal-option') { 27155 var li = $('.prod-option[data-option_mode="normal"] .prod-option-list > li').slice(1); 27156 if(product_options.advanced == 'true' && li.length == 0) { 27157 $(this).prop('checked',false); 27158 // alert('ê³ ê¸ ì¤ì ì´ ì ì©ëì´ ìì´ ì ë ¥í ìµì ê³¼ ì¶ê° ìµì ì ê³ ê¸ ì¤ì ì°½ìì ì¤ì ì´ ê°ë¥í©ëë¤'); 27159 var modal = $(this).showModalFlat('','ê³ ê¸ ì¤ì ì´ ì ì©ëì´ ìì´ ì ë ¥í ìµì ê³¼ ì¶ê° ìµì ì ê³ ê¸ ì¤ì ì°½ìì ì¤ì ì´ ê°ë¥í©ëë¤',true,false,'','ok','','cl-cmmodal cl-s-btn w560 cl-p130 cl-t80 cl-modal cl-none-title cl-close-btn','','',function() { 27160 $(document).on('keydown', function(e) { 27161 if(e.keyCode == 27) modal.modal('hide'); 27162 }); 27163 }); 27164 return false;
27165 } 27166 if ($(this).is(':checked') === true) { 27167 if(li.length == 0) { 27168 var r = addProductOption('normal'); 27169 if(r == false) { 27170 $('#normal-option').prop('checked', false); 27171 return false; 27172 } 27173 } 27174 $('.prod-option-tab').removeClass('hide'); 27175 $('.prod-option[data-option_mode="normal"]').removeClass('hide'); 27176 $('.prod-option[data-option_mode="normal"] .plus-price').removeClass('hide'); 27177 $('.prod-option[data-option_mode="normal"] .plus-status').removeClass('hide'); 27178 switchDownload('on'); //ë¤ì´ë¡ë íì¼ 27179 } else { 27180 switchDownload('off'); //ë¤ì´ë¡ë íì¼ 27181 // removeOptionModal(li, 'normal'); 27182 if(li.length == 1 && li.find('.prod-option-item .prod-option-title').text() == '') { 27183 li.remove(); 27184 } 27185 $('.prod-option[data-option_mode="normal"]').addClass('hide'); 27186 } 27187 } else if($(this).attr('id') == 'text-option') { 27188 if($('#download-product').is(':checked') === true) { //ë¤ì´ë¡ë ìí 27189 alert('ë¤ì´ë¡ë ìíì ì ë ¥ìµì ì ì§ìíì§ ììµëë¤.'); 27190 $(this).prop('checked', false); 27191 return false; 27192 } 27193 var li = $('.prod-option[data-option_mode="text"] .prod-option-list > li'); 27194 if(product_options.advanced == 'true' && li.length == 0) { 27195 $(this).prop('checked',false); 27196 // alert('ê³ ê¸ ì¤ì ì´ ì ì©ëì´ ìì´ ì ë ¥í ìµì ê³¼ ì¶ê° ìµì ì ê³ ê¸ ì¤ì ì°½ìì ì¤ì ì´ ê°ë¥í©ëë¤'); 27197 var modal = $(this).showModalFlat('','ê³ ê¸ ì¤ì ì´ ì ì©ëì´ ìì´ ì ë ¥í ìµì ê³¼ ì¶ê° ìµì ì ê³ ê¸ ì¤ì ì°½ìì ì¤ì ì´ ê°ë¥í©ëë¤',true,false,'','ok','','cl-cmmodal cl-s-btn w560 cl-p130 cl-t80 cl-modal cl-none-title cl-close-btn','','',function() { 27198 $(document).on('keydown', function(e) { 27199 if(e.keyCode == 27) modal.modal('hide'); 27200 }); 27201 }); 27202 return false; 27203 } 27204 if ($(this).is(':checked') === true) { 27205 $('.prod-option-tab').removeClass('hide'); 27206 $('.prod-option[data-option_mode="text"]').removeClass('hide'); 27207 27208 if(li.length == 0) addProductOption('text'); 27209 if(li.length >= 7) { 27210 $('.prod-option[data-option_mode="text"] > .prod-option-add').addClass('disabled'); 27211 } else { 27212 $('.prod-option[data-option_mode="text"] > .prod-option-add').removeClass('disabled'); 27213 } 27214 } else { 27215 // removeOptionModal(li, 'text'); 27216 if(li.length == 1 && li.find('.prod-option-item .prod-option-title').text() == '') { 27217 li.remove(); 27218 } 27219 $('.prod-option[data-option_mode="text"]').addClass('hide'); 27220 } 27221 } else if($(this).attr('id') == 'additional-option') { 27222 if($('#download-product').is(':checked') === true) { //ë¤ì´ë¡ë ìí 27223 alert('ë¤ì´ë¡ë ìíì ì¶ê°ìµì ì ì§ìíì§ ììµëë¤.'); 27224 $(this).prop('checked', false); 27225 return false; 27226 } 27227 var li = $('.prod-option[data-option_mode="additional"] .prod-option-list > li'); 27228 if(product_options.advanced == 'true' && li.length == 0) { 27229 $(this).prop('checked',false); 27230 // alert('ê³ ê¸ ì¤ì ì´ ì ì©ëì´ ìì´ ì ë ¥í ìµì ê³¼ ì¶ê° ìµì ì ê³ ê¸ ì¤ì ì°½ìì ì¤ì ì´ ê°ë¥í©ëë¤.'); 27231 var modal = $(this).showModalFlat('','ê³ ê¸ ì¤ì ì´ ì ì©ëì´ ìì´ ì ë ¥í ìµì ê³¼ ì¶ê° ìµì ì ê³ ê¸ ì¤ì ì°½ìì ì¤ì ì´ ê°ë¥í©ëë¤',true,false,'','ok','','cl-cmmodal cl-s-btn w560 cl-p130 cl-t80 cl-modal cl-none-title cl-close-btn','','',function() { 27232 $(document).on('keydown', function(e) { 27233 if(e.keyCode == 27) modal.modal('hide'); 27234 }); 27235 }); 27236 return false;
27237 } 27238 27239 if ($(this).is(':checked') === true) { 27240 $('.prod-option-tab').removeClass('hide'); 27241 $('.prod-option[data-option_mode="additional"]').removeClass('hide'); 27242 $('.prod-option[data-option_mode="additional"] .plus-price').removeClass('hide'); 27243 $('.prod-option[data-option_mode="additional"] .plus-status').removeClass('hide'); 27244 27245 if(li.length == 0) addProductOption('additional'); 27246 } else { 27247 // removeOptionModal(li, 'additional'); 27248 if(li.length == 1 && li.find('.prod-option-item .prod-option-title').text() == '') { 27249 li.remove(); 27250 } 27251 27252 $('.prod-option[data-option_mode="additional"]').addClass('hide'); 27253 } 27254 } 27255 27256 if($('.switch-quantity').is(":checked") == true) { 27257 if($('#normal-option').is(':checked') === true) { 27258 // $('#prod-quantity').attr('readonly','true').removeClass('hide').attr('placeholder','ìµì ìì ì¬ê³ ê´ë¦¬'); 27259 $('.quantity-label').addClass('on'); 27260 $('.plus-quantity').removeClass('hide'); 27261 } else if($('#normal-option').is(':checked') === false && $('#additional-option').is(':checked') === true) { 27262 $('.quantity-label').removeClass('on'); 27263 $('#prod-quantity').removeAttr('readonly').removeClass('hide'); 27264 $('.plus-quantity').removeClass('hide'); 27265 } else { 27266 $('.quantity-label').removeClass('on'); 27267 $('#prod-quantity').removeAttr('readonly').removeClass('hide'); 27268 $('.plus-quantity').addClass('hide'); 27269 } 27270 27271 // $parent.find('.prod-option-quantity, .edit-option-quantity').show(); 27272 // $parent.find('.plus-quantity').removeClass('hide'); 27273 } else { 27274 $('.quantity-label').removeClass('on'); 27275 $('#prod-quantity').addClass('hide'); 27276 $('.prod-option-quantity, .prod-plus-quantity, .edit-option-quantity').hide(); 27277 $('.plus-quantity').addClass('hide'); 27278 } 27279 27280 if($('.prod-option-tab .prod-option.hide').length == 3) { //í 모ë ë¹íì±íì¼ë 27281 $('.prod-option-tab').addClass('hide'); 27282 if(product_options.advanced == 'true') 27283 $('.reset-wrap').addClass('hide'); 27284 if($('.switch-quantity').is(":checked") == true) { 27285 $('.quantity-label').removeClass('on'); 27286 } 27287 } else { 27288 if(product_options.advanced == 'true') 27289 $('.reset-wrap').removeClass('hide'); 27290 } 27291 }); 27292 27293 $(document).on('click','.btn-fblogin.btn-warning', function(e) { 27294 var facebook_disabled_str = '\ 27295 <div class="text-left" style="padding: 20px 15px;"><br>\ 27296 ' + $.lang[LANG]['config.modal.fblogin.error.1'] + '\ 27297 <ol style="padding-inline-start: 15px; margin-top: 10px; line-height: 2;">\ 27298 ' + $.lang[LANG]['config.modal.fblogin.error.2'] + '\ 27299 </ol>\ 27300 ' + $.lang[LANG]['config.modal.fblogin.error.3'] + '\ 27301 </div>'; 27302 27303 $(this).showModalFlat('INFORMATION',facebook_disabled_str,true,false,'','ok','','w555'); 27304 }); 27305 27306 //$(document).off('click', '#etc-start-date.etc_date'); 27307 // $(document).on('click', '#etc-start-date-txt', function (e) { 27308 // $('.cl_etc_date_time').each(function () { 27309 // $(this).removeClass('active'); 27310 // }); 27311 27312 // if($('#etc-start-date-picker').css('display') == 'block') { 27313 // $(this).removeClass('active'); 27314 // $('#etc-start-date-picker').hide(); 27315 // } else { 27316 // $('.etc-date').removeClass('active'); 27317 // $(this).addClass('active'); 27318 // $('#etc-start-date-picker').show(); 27319 // } 27320 // $('#etc-end-date-picker').hide(); 27321 // $('#etc-except-date-picker').hide(); 27322 27323 // $('#select-calendar').val('etc-start-date'); 27324 // startPicker.generateDates(); 27325 // var i = 0; 27326 // var width = 0; 27327 // $('#etc-end-date-picker .Datepickk .d-table input + label').each(function () { 27328 // if (i == 0) width = $(this).width(); 27329 // $(this).css('height', width+'px'); 27330 // i++; 27331 // }); 27332 // var i = 0; 27333 // var width = 0; 27334 // $('#etc-start-date-picker .Datepickk .d-table input + label').each(function () { 27335 // if (i == 0) width = $(this).width(); 27336 // $(this).css('height', width+'px'); 27337 // i++; 27338 // }); 27339 // }); 27340
27341 // $(document).on('click', '#etc-end-date-txt', function () { 27342 // $('.cl_etc_date_time').each(function () { 27343 // $(this).removeClass('active'); 27344 // }); 27345 27346 // if($('#etc-end-date-picker').css('display') == 'block') { 27347 // $(this).removeClass('active'); 27348 // $('#etc-end-date-picker').hide(); 27349 // } else { 27350 // $('.etc-date').removeClass('active'); 27351 // $(this).addClass('active'); 27352 // $('#etc-end-date-picker').show(); 27353 // } 27354 27355 // $('#etc-start-date-picker').hide(); 27356 // $('#etc-except-date-picker').hide(); 27357 27358 // $('#select-calendar').val('etc-end-date'); 27359 // endPicker.generateDates(); 27360 // var i = 0; 27361 // var width = 0; 27362 // $('#etc-end-date-picker .Datepickk .d-table input + label').each(function () { 27363 // if (i == 0) width = $(this).width(); 27364 // $(this).css('height', width+'px'); 27365 // i++; 27366 // }); 27367 // var i = 0; 27368 // var width = 0; 27369 // $('#etc-start-date-picker .Datepickk .d-table input + label').each(function () { 27370 // if (i == 0) width = $(this).width(); 27371 // $(this).css('height', width+'px'); 27372 // i++; 27373 // }); 27374 // }); 27375 27376 // $(document).on('click', '#etc-except-date', function () { 27377 // $('.unselect-all').remove(); 27378 27379 // if($('#etc-except-date-picker').css('display') == 'block') { 27380 // $(this).removeClass('active'); 27381 // $('#etc-except-date-picker').hide(); 27382 // } else { 27383 // $('.etc-date').removeClass('active'); 27384 // $(this).addClass('active'); 27385 // $('#etc-except-date-picker').show(); 27386 // $('#etc-except-date-picker').append('<div class="unselect-all"><svg viewBox="0 0 24 24" width="24" height="24"><path d="M12 5c-3.64 0-6.63 2.78-6.97 6.33L3.35 9.65l-0.71 0.71 2.85 2.85 2.85-2.85L7.65 9.65l-1.59 1.59C6.43 8.29 8.95 6 12 6c3.31 0 6 2.69 6 6s-2.69 6-6 6c-1.66 0-3.17-0.68-4.26-1.78l-0.71 0.71C8.3 18.21 10.06 19 12 19c3.87 0 7-3.13 7-7S15.87 5 12 5z"/></svg> ì´ê¸°í</div>'); 27387 // displaySelectedDates(); 27388 // } 27389 27390 // $('#etc-start-date-picker').hide(); 27391 // $('#etc-end-date-picker').hide(); 27392 27393 // setExceptPicker(); 27394 // // exceptPicker.generateDates(true); 27395 // var i = 0; 27396 // var width = 0; 27397 // $('#etc-except-date-picker .Datepickk .d-table input + label').each(function () { 27398 // if (i == 0) width = $(this).width(); 27399 // $(this).css('height', width+'px'); 27400 // i++; 27401 // }); 27402 27403 27404 // }); 27405 27406 // $(document).on('click', '#etc-except-date-picker .unselect-all', function (e) { 27407 // e.preventDefault(); 27408 // exceptPicker.unselectExceptAll(); 27409 // //exceptPicker.generateDates(true); 27410 // setExceptPicker(); 27411 // $('#etc-except-date').val('-'); 27412 // $('.etc-except-date-status').text(''); 27413 // $(this).addClass('disabled'); 27414 // }); 27415 27416 27417 27418 $(document).on('click', '.email-add-box:not(.disabled)', function(e){ 27419 27420 if (!$(e.target).is('.email-box')) { 27421 $('#email-add-input').focus(); 27422 } 27423 }); 27424 27425 $(document).on('keydown', '.email-add-box:not(.disabled) #email-add-input', function (e) { 27426 var keyCode = e.keyCode || e.which; 27427 if (keyCode == 9 || keyCode == 13) { 27428 e.preventDefault(); 27429 enterEmailBox($(this), 'add'); 27430 } 27431 }); 27432 27433 $(document).on('click', function(e) { 27434 if($('#email-add-input').length > 0 && !$(e.target).is('#email-add-input')) { 27435 e.stopPropagation(); 27436 enterEmailBox($('#email-add-input'), 'add'); 27437 } 27438 }); 27439 27440 $(document).on('click', '.email-add-box:not(.disabled) .email-box-delt', function (e) { 27441 e.stopPropagation(); 27442 enterEmailBox($(this), 'delete'); 27443 }); 27444 27445 $(document).on('click', '.email-add-box:not(.disabled) .email-box', function (e) { 27446 27447 e.stopPropagation(); 27448 27449 var textWidth = $(this).find('.email-text').width(); 27450 var emailTextInput = $(this).find('.email-text-input'); 27451 var otherBox = $('.email-box').not(this); //ì íí ë°ì¤ ì¸ ë¤ë¥¸ ë°ì¤ 27452 var emailBox = enterEmailBox(otherBox.find('.email-text-input.active input'), 'modify'); 27453 if (emailBox) { 27454 otherBox.find('.email-text').removeClass('hidden'); 27455 otherBox.find('.email-text-input').addClass('hidden'); 27456 otherBox.find('.email-text-input').removeClass('active'); 27457 } 27458 if(emailTextInput.hasClass('hidden')) { 27459 $(this).find('.email-text').addClass('hidden'); 27460 emailTextInput.removeClass('hidden'); 27461 emailTextInput.addClass('active'); 27462 emailTextInput.find('input').css('width', textWidth+'px'); 27463 emailTextInput.find('input').focus(); 27464 } 27465 }); 27466 27467 $(document).on('keydown', '.email-box', function (e) { 27468 var keyCode = e.keyCode || e.which;
27469 if (keyCode == 9 || keyCode == 13) { 27470 var emailBox = enterEmailBox($('.email-text-input').not('.hidden').find('input'), 'modify'); 27471 27472 if (emailBox) { 27473 $(this).find('.email-text').removeClass('hidden'); 27474 $(this).find('.email-text-input').addClass('hidden'); 27475 } 27476 } 27477 }); 27478 27479 $(document).on('click', function (e) { 27480 if (!$(e.target).is('.email-box')) { 27481 e.stopPropagation(); 27482 var emailBox = enterEmailBox($('.email-text-input.active input'), 'modify'); 27483 27484 if (emailBox) { 27485 $(this).find('.email-text').removeClass('hidden'); 27486 $(this).find('.email-text-input').addClass('hidden'); 27487 $(this).find('.email-text-input').removeClass('active'); 27488 } 27489 } 27490 }); 27491 // if ($('#email-line-box').length > 0) { 27492 // var name = $('#email-line-box').attr('name'); 27493 // var className = $('#email-line-box').attr('class'); 27494 // var value = $('#email-line-box').val(); 27495 27496 // var emailList = value.split(','); 27497 27498 // var html = '\ 27499 // <input type="hidden" id="email-line-box" name="'+name+'" class="'+className+'" value="'+value+'">\ 27500 // <div class="email-add-box">\ 27501 // <input type="text" id="email-add-input">\ 27502 // </div>\ 27503 // '; 27504 // $('#email-line-box').before(html); 27505 27506 // var html = ''; 27507 // if (emailList.length >= 1) { 27508 // if (emailList[0] != '') { 27509 // for (var i=0;i<emailList.length;i++) { 27510 // html += '<div class="email-box">'+emailList[i]+'<span class="email-box-delt"><svg viewBox="0 0 8 8"><polygon points="8 0.71 7.29 0 4 3.29 0.71 0 0 0.71 3.29 4 0 7.29 0.71 8 4 4.71 7.29 8 8 7.29 4.71 4 "/></svg></span></div>' 27511 // } 27512 27513 // $('#email-add-input').before(html); 27514 // var boxWidth = 0; 27515 // $('.email-add-box .email-box').each(function () { 27516 // boxWidth += $(this).innerWidth() + 10; 27517 // }); 27518 // var textWidth = $('#email-add-input').parent().innerWidth() - 20, 27519 // uni = 'px'; 27520 27521 // var totalWidth = textWidth - boxWidth; 27522 27523 // if (totalWidth <= 40) { 27524 // totalWidth = 100; 27525 // uni = '%' 27526 // } 27527 27528 // $('#email-add-input').css('width', totalWidth+uni); 27529 // } 27530 // } 27531 // $('#email-line-box').remove(); 27532 // } L.20211008. 27533 27534 $(document).on('click', '.fitem-category', function (e) { 27535 if(typeof handleIconStorageCategoryClick == 'function') { 27536 handleIconStorageCategoryClick($(this)); 27537 return; 27538 } 27539 27540 var quick_category = $(this).attr('data-category'); 27541 $(this).addClass('active').siblings('.fitem-category').removeClass('active'); 27542 getIconImage(quick_category); 27543 }); 27544}); 27545 27546function enterEmailBox (el, mode) { 27547 var regExp = /^[0-9a-zA-Z]([-_\.]?[0-9a-zA-Z])*@[0-9a-zA-Z]([-_\.]?[0-9a-zA-Z])*\.[a-zA-Z]{2,3}$/i; 27548 if(mode == 'add' || mode == 'modify') { 27549 var val = (typeof el.val() !== 'undefined')? el.val().trim() : ''; 27550 if (val == '') return true; 27551 if(!regExp.test(val)) { 27552 // alert('ì´ë©ì¼ íìì´ ì¬ë°ë¥´ì§ ììµëë¤.'); 27553 var modal = $(this).showModalFlat('','ì´ë©ì¼ íìì´ ì¬ë°ë¥´ì§ ììµëë¤.',true,false,function() { 27554 modal.modal('hide'); 27555 },'ok','','cl-cmmodal cl-s-btn w560 cl-p130 cl-t80 cl-modal cl-none-title cl-close-btn','','',function() { 27556 $(document).on('keydown', function(e) { 27557 if(e.keyCode == 27) modal.modal('hide'); 27558 }); 27559 }); 27560 el.val(''); 27561 el.focus(); 27562 return false; 27563 } 27564 var flag = true; 27565 $('.email-text').not('.hidden').each(function(idx, v) { 27566 if($(v).text() == val) { 27567 // alert('ì´ë¯¸ ë±ë¡ë ì´ë©ì¼ì ëë¤.'); 27568 var modal = $(this).showModalFlat('','ì´ë¯¸ ë±ë¡ë ì´ë©ì¼ì ëë¤.',true,false,function() { 27569 modal.modal('hide'); 27570 },'ok','','cl-cmmodal cl-s-btn w560 cl-p130 cl-t80 cl-modal cl-none-title cl-close-btn','','',function() { 27571 $(document).on('keydown', function(e) { 27572 if(e.keyCode == 27) modal.modal('hide'); 27573 }); 27574 }); 27575 el.val(''); 27576 el.focus(); 27577 flag = false;
27578 return false; 27579 } 27580 }); 27581 27582 if(flag === false) { 27583 return false; 27584 } 27585 } 27586 27587 if(mode == 'add') { 27588 var html = '<div class="email-box">\ 27589 <div class="email-text">'+val+'</div>\ 27590 <div class="email-text-input hidden"><input type="text" value="'+val+'"></div>\ 27591 <span class="email-box-delt"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path d="M4.06 3 3 4.06 6.94 8 3 11.94 4.06 13 8 9.06 11.94 13 13 11.94 9.06 8 13 4.06 11.94 3 8 6.94z"/></svg></span>\ 27592 </div>'; 27593 27594 if($('.email-box').length < 5) { //ì´ë©ì¼ ìµë 5ê°ê¹ì§ 27595 el.before(html); 27596 } 27597 el.val(''); 27598 } else if (mode == 'delete') { 27599 if($('.email-box').length <= 1) { 27600 alert('ê´ë¦¬ì ìì ë©ì¼ì ìµì 1ê° ì´ì ë±ë¡ëì´ ìì´ì¼ í©ëë¤.'); 27601 return false; 27602 } 27603 el.parent().remove(); 27604 } else if (mode == 'modify') { 27605 var emailBox = el.closest('.email-box').find('.email-text'); 27606 emailBox.text(val); 27607 } else { 27608 return false; 27609 } 27610 27611 var emailArr = new Array(); 27612 $('.email-add-box .email-box .email-text').each(function () { 27613 emailArr.push($(this).text()); 27614 }); 27615 console.log(emailArr); 27616 $('#email-line-box').val(emailArr.join(',')) 27617 27618 if($('.email-box').length >= 5) { 27619 $('#email-add-input').remove(); 27620 } else { 27621 if($('#email-add-input').length == 0) { 27622 $('.email-add-box').append('<input type="text" id="email-add-input">'); 27623 } 27624 if (mode != 'modify') { 27625 $('#email-add-input').focus(); 27626 } 27627 } 27628 27629 return true; 27630} 27631 27632function enterGeneralBox (el, mode){ 27633 var regExp = /^[0-9+]+$/; 27634 if(mode == 'add' || mode == 'modify') { 27635 27636 var val = (typeof el.val() !== 'undefined')? el.val().trim() : '';//value ì²´í¬ 27637 val = val.replace(/ /g,""); 27638 if (val == '') return true; //ì ë ¥ë´ì© ë¹ì´ìì¼ë©´ ì¢ ë£ 27639 27640 // console.log(val.replace('+','')); 27641 // console.log(val.replace('+','').length); 27642 if ( val.replace('+','').length < 10 || val.replace('+','').length > 15) { 27643 27644 siteNotice('kakao_number_length'); 27645 el.val(''); 27646 el.focus(); 27647 return false; 27648 } 27649 if(!regExp.test(val)) { 27650 siteNotice('kakao_onlynumber'); 27651 el.val(''); 27652 el.focus(); 27653 return false; 27654 } 27655 var flag = true; 27656 27657 $('.generalnum-text').not('.hidden').each(function(idx, v) { 27658 27659 if($(v).text().replace('+','') == val.replace('+','')) { 27660 // alert('ì´ë¯¸ ë±ë¡ ë ì´ë©ì¼ì ëë¤.'); 27661 siteNotice('kakao_dupnumber'); 27662 el.val(''); 27663 el.focus(); 27664 flag = false; 27665 return false; 27666 } 27667 }); 27668 27669 if(flag === false) { 27670 return false; 27671 } 27672 } 27673 if(mode == 'add') { 27674 27675 //0206 18:00 working.. 27676 if(val.substring(0, 1) == '0'){ 27677 var firststring_delete = val.substring(1); 27678 var sliceValue =''; 27679 var text_array = new Array(); 27680 firststring_delete = '+82'+firststring_delete; 27681 27682 $('.generalnum-text').each(function(idx, v) { 27683 sliceValue = text_array.push($(v).text()); 27684 }); 27685 } else if(val.slice(0,2) =='82' || val.slice(0,3) =='+82'){ 27686 if(val.slice(0,1) == '+') val = val.substring(1); 27687 27688 var firststring_delete = val.substring(2); 27689 var sliceValue =''; 27690 firststring_delete = '0'+firststring_delete; 27691 27692 var text_array = new Array(); 27693 $('.generalnum-text').each(function(idx, v) { 27694 sliceValue = text_array.push($(v).text()); 27695 }); 27696 } else { 27697 var firststring_delete = val; 27698 var text_array = new Array(); 27699 27700 } 27701 if(text_array.includes(firststring_delete)){ 27702 var modal = $(this).showModalFlat('',$.lang[LANG]['shopping.dashboard.kakaoNotice.dupnumber'],true,false,function() { 27703 modal.modal('hide'); 27704 },'ok','','cl-cmmodal cl-s-btn w560 cl-p130 cl-t80 cl-modal cl-none-title cl-close-btn','','',function() { 27705 $(document).on('keydown', function(e) { 27706 if(e.keyCode == 27) modal.modal('hide'); 27707 }); 27708 }); 27709 el.val(''); 27710 el.focus(); 27711 return false ; 27712 } 27713 27714 //0206 18:00 working.. 27715 27716
27717 let val_chk = val.substring(0, 1); 27718 if(val_chk !== '0' && val_chk !=='+'){ 27719 val = '+'+val; 27720 } 27721 var html = '<div class="generalnum-box">\ 27722 <div class="generalnum-text">'+val+'</div>\ 27723 <div class="generalnum-text-input hidden"><input type="text" value="'+val+'"></div>\ 27724 <span class="generalnum-box-delt"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path d="M4.06 3 3 4.06 6.94 8 3 11.94 4.06 13 8 9.06 11.94 13 13 11.94 9.06 8 13 4.06 11.94 3 8 6.94z"/></svg></span>\ 27725 </div>'; 27726 27727 27728 el.before(html); 27729 27730 el.val(''); 27731 } else if (mode == 'delete') { 27732 27733 // if($('.generalnum-box').length <= 1) { 27734 // $(this).siblings(input); 27735 // } 27736 el.parent().remove(); 27737 } 27738 else if (mode == 'modify') { 27739 // if(val.substring(0, 1) == '0'){ 27740 // var firststring_delete = val.substring(1); 27741 // var sliceValue =''; 27742 // var text_array = new Array(); 27743 // firststring_delete = '+82'+firststring_delete; 27744 // $('.generalnum-text').each(function(idx, v) { 27745 // sliceValue = text_array.push($(v).text()); 27746 // }); 27747 // } 27748 27749 if(val.substring(0, 1) == '0'){ 27750 var firststring_delete = val.substring(1); 27751 var sliceValue =''; 27752 var text_array = new Array(); 27753 firststring_delete = '+82'+firststring_delete; 27754 27755 $('.generalnum-text').each(function(idx, v) { 27756 sliceValue = text_array.push($(v).text()); 27757 }); 27758 } else if(val.slice(0,2) =='82' || val.slice(0,3) =='+82'){ 27759 if(val.slice(0,1) == '+') val = val.substring(1); 27760 var firststring_delete = val.substring(2); 27761 var sliceValue =''; 27762 firststring_delete = '0'+firststring_delete; 27763 27764 var text_array = new Array(); 27765 $('.generalnum-text').each(function(idx, v) { 27766 sliceValue = text_array.push($(v).text()); 27767 }); 27768 } else { 27769 var firststring_delete = val; 27770 var text_array = new Array(); 27771 27772 } 27773 if(text_array.includes(firststring_delete)){ 27774 var modal = $(this).showModalFlat('',$.lang[LANG]['shopping.dashboard.kakaoNotice.dupnumber'],true,false,function() { 27775 modal.modal('hide'); 27776 },'ok','','cl-cmmodal cl-s-btn w560 cl-p130 cl-t80 cl-modal cl-none-title cl-close-btn','','',function() { 27777 $(document).on('keydown', function(e) { 27778 if(e.keyCode == 27) modal.modal('hide'); 27779 }); 27780 }); 27781 el.val(''); 27782 el.focus(); 27783 return false ; 27784 } 27785 27786 27787
27788 let val_chk = val.substring(0, 1); 27789 if(val_chk !== '0' && val_chk !=='+'){ 27790 val = '+'+val; 27791 } 27792 var emailBox = el.closest('.generalnum-box').find('.generalnum-text'); 27793 emailBox.text(val); 27794 27795 } else { 27796 return false; 27797 } 27798 27799 27800 var emailArr = new Array(); 27801 $('.generalnum-add-box .generalnum-box .generalnum-text').each(function () { 27802 emailArr.push($(this).text()); 27803 }); 27804 27805 $('#generalnum-line-box').val(emailArr.join(',')) 27806 $('#generalnum-add-input').remove(); 27807 27808 (LANG =='ko') ? LangPlaceholderNumber = 'ë²í¸ë¥¼ ì ë ¥í´ì£¼ì¸ì.' : LangPlaceholderNumber = 'Please enter the Number.'; 27809 27810 if($('#generalnum-add-input').length == 0) { 27811 $('.generalnum-add-box').append('<input type="text" id="generalnum-add-input">'); 27812 if ($('.generalnum-box').length == 0) { 27813 $('#generalnum-add-input').attr('placeholder',LangPlaceholderNumber) 27814 } 27815 } 27816 if (mode != 'modify') { 27817 $('#generalnum-add-input').focus(); 27818 } 27819 27820 27821 return true; 27822} 27823 27824 $(document).on('click', function(e) { 27825 if($('#generalnum-add-input').length > 0 && !$(e.target).is('#generalnum-add-input')) { 27826 e.stopPropagation(); 27827 enterGeneralBox($('#generalnum-add-input'), 'add'); 27828 27829 } 27830 }); 27831 27832 $(document).on('keydown', '#generalnum-add-input', function (e) { 27833 var keyCode = e.keyCode || e.which; 27834 if (keyCode == 9 || keyCode == 13) { 27835 e.preventDefault(); 27836 enterGeneralBox($(this), 'add'); 27837 } 27838 }); 27839 27840 $(document).on('click', '.generalnum-box', function (e) { 27841 e.stopPropagation(); 27842 var textWidth = $(this).find('.generalnum-text').width(); 27843 var emailTextInput = $(this).find('.generalnum-text-input'); 27844 var otherBox = $('.generalnum-box').not(this); //ì íí ë°ì¤ ì¸ ë¤ë¥¸ ë°ì¤ 27845 var emailBox = enterGeneralBox(otherBox.find('.generalnum-text-input.active input'), 'modify'); 27846 if (emailBox) { 27847 otherBox.find('.generalnum-text').removeClass('hidden'); 27848 otherBox.find('.generalnum-text-input').addClass('hidden'); 27849 otherBox.find('.generalnum-text-input').removeClass('active'); 27850 } 27851 if(emailTextInput.hasClass('hidden')) { 27852 $(this).find('.generalnum-text').addClass('hidden'); 27853 emailTextInput.removeClass('hidden'); 27854 emailTextInput.addClass('active'); 27855 emailTextInput.find('input').css('width', textWidth+'px'); 27856 emailTextInput.find('input').focus(); 27857 } 27858 }); 27859 27860 $(document).on('click', '.generalnum-add-box', function(e){ 27861 if (!$(e.target).is('.generalnum-box')) { 27862 27863 $('#generalnum-add-input').focus(); 27864 } 27865 }); 27866 27867 $(document).on('keydown', '.generalnum-box', function (e) { 27868 var keyCode = e.keyCode || e.which; 27869 if (keyCode == 9 || keyCode == 13) { 27870 $(this).find('.generalnum-text-input').removeClass('active'); 27871 var emailBox = enterGeneralBox($('.generalnum-text-input').not('.hidden').find('input').not(this), 'modify'); 27872 27873 if (emailBox) { 27874 $(this).find('.generalnum-text-input').addClass('hidden'); 27875 $(this).find('.generalnum-text').removeClass('hidden'); 27876 27877 } 27878 } 27879 }); 27880 27881 $(document).on('click', function (e) { 27882 if (!$(e.target).is('.generalnum-box')) { 27883 e.stopPropagation(); 27884 var emailBox = enterGeneralBox($('.generalnum-text-input.active input'), 'modify'); 27885 27886 27887 if (emailBox) { 27888 $(this).find('.generalnum-text').removeClass('hidden'); 27889 $(this).find('.generalnum-text-input').addClass('hidden'); 27890 $(this).find('.generalnum-text-input').removeClass('active'); 27891 } 27892 } 27893 }); 27894 27895 $(document).on('click', '.generalnum-box-delt', function (e) { 27896 e.stopPropagation(); 27897 enterGeneralBox($(this), 'delete'); 27898 }); 27899 27900 27901function emailLineFunc () { 27902 var emailBox = enterEmailBox($('#email-add-input'), 'add'); 27903 27904 if ($('.email-box.none').length > 0) { 27905 alert('ì³ë°ë¥´ì§ ìì ì´ë©ì¼ 주ìê° í¬í¨ëì´ììµëë¤.'); 27906 return false;
27907 } 27908 27909 if (emailBox === false) { 27910 $('#email-add-input').focus(); 27911 return false; 27912 } 27913 27914 return true; 27915} 27916 27917function division (option, n) { 27918 var arr = option; 27919 var len = arr.length; 27920 var cnt = Math.floor(len / n) + (Math.floor(len % n) > 0 ? 1 : 0); 27921 var tmp = []; 27922 27923 for (var i=0;i<cnt;i++) { 27924 tmp.push(arr.splice(0, n)); 27925 } 27926 27927 return tmp; 27928} 27929 27930function truncateReviewTitle (reviewArr) { //ìíí기 ì 목 ì르기 27931 $('.s-table-review .review-content>div').each(function(idx, item){ 27932 var reviewContent = reviewArr[idx]; 27933 27934 if(reviewContent !== undefined) { 27935 $(this).html(reviewContent); 27936 27937 for(var i = reviewContent.length; i > 0; i--){ 27938 if($(this).height() > 60) { 27939 $(this).html(reviewContent.substr(0, i)); 27940 $(this).append('...'); 27941 } 27942 else { 27943 break; 27944 } 27945 } 27946 } 27947 }); 27948} 27949 27950function nl2br (str, is_xhtml) { 27951 if (typeof str === 'undefined' || str === null) { 27952 return ''; 27953 } 27954 var breakTag = (is_xhtml || typeof is_xhtml === 'undefined') ? '<br />' : '<br>'; 27955 return (str + '').replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1' + breakTag + '$2'); 27956} 27957 27958function extra_charge_info($obj, status, free_flag, change_flag) { 27959 $(".order-cancel-content.extra-info").remove(); 27960 var s = '\ 27961 <div class="order-cancel-content extra-info">\ 27962 <div class="cancel-info-box">\ 27963 <p class="error">\ 27964 ' + (free_flag ? '- ê²°ì ë¹ì 무ë£ë°°ì¡ ì¡°ê±´ì 충족íì§ ëª»í´ ë°°ì¡ë£ê° ë°ì í ì ììµëë¤.<br>' : '' ) + '\ 27965 ' + (change_flag ? '- 주문 ìí ' + (status == 'C' ? 'ì·¨ì' : 'ë°í') + ' ì ë°°ì¡ë¹ ì¡°ê±´ì ë°ë¼ ë°°ì¡ë¹ê° ë¬ë¼ì§ ì ììµëë¤.<br>' : '') + '\ 27966 - ìì¸í ì¬íì í매ìì ìë´ë¥¼ ë°ë¼ì£¼ì¸ì.\ 27967 </p>\ 27968 </div>\ 27969 </div>\ 27970 '; 27971 if(free_flag || change_flag) { 27972 if($obj.find(".modal-comment.point-used-desc").length) { 27973 $obj.find(".modal-comment.point-used-desc").before(s); 27974 } else { 27975 $obj.append(s); 27976 } 27977 } 27978} 27979 27980function setCLEscrowFooter(sid,plantype,obj) { 27981 if(typeof sid == 'undefined') return false; 27982 27983 if( typeof plantype == 'undefined' || plantype != 'SM' || 27984 typeof obj == 'undefined' || 27985 typeof obj.onoff == 'undefined' || !obj.onoff || obj.onoff === false || 27986 typeof obj.key == 'undefined' || !obj.key || obj.key == '' 27987 ) { 27988 $('.el-footer').find('.escrow-image-wrap-box').remove(); 27989 return false; 27990 } 27991 27992 var escrow_img = (typeof obj.type != 'undefined' && obj.type) ? obj.type : 1, 27993 escrow_key = obj.key, 27994 checkCLEscrowFooter = ($('.el-footer').find('.escrow-image-wrap-box').length > 0) ? true : false, 27995 checkCLFooter = ($('.el-footer').find('.cl-footer-site-element').length > 0) ? true : false; 27996 27997 var escrow_link = ''; 27998 if(obj.pg_company == 'KCP') { 27999 escrow_img = '<img src="//storage.googleapis.com/i.addblock.net/shopping_mall/escrow_site/escrow_site0' + escrow_img + '.png" />'; 28000 escrow_link = '//admin.kcp.co.kr/Modules/escrow/kcp_pop.jsp?site_cd=' + escrow_key; 28001 } else if(obj.pg_company == 'NICEPAY') { 28002 escrow_img = '<img src="//storage.googleapis.com/i.addblock.net/shopping_mall/escrow_setting/nicepay_escrow_setting0' + escrow_img + '.png" />'; 28003 escrow_link = 'https://npg.nicepay.co.kr/issue/issueEscrow.do?Mid=' + escrow_key + '&CoNo=' + obj.b_number.replace(/-/g,''); 28004 } 28005 28006 var clef_str = '\ 28007 <div class="escrow-image-wrap">\ 28008 <a href="' + escrow_link + '" target="_blank">\ 28009 ' + escrow_img + '\ 28010 </a>\ 28011 </div>\ 28012 '; 28013 28014 if(checkCLEscrowFooter) { 28015 $('.el-footer').find('.escrow-image-wrap-box').html('<br>'+clef_str); 28016 } else if(checkCLFooter) { 28017 $('.el-footer').find('.escrow-image-wrap').remove(); 28018 $('.el-footer').find('.cl-footer-site-element').last().append('<br><div class="escrow-image-wrap-box">'+clef_str+'</div>'); 28019 } else { 28020 $('.el-footer').find('.container .row').last().append('<div class="col-xs-12 col-sm-12 col-md-12 clearfix clear escrow-image-wrap-box"><br>' + clef_str + '</div>'); 28021 } 28022} 28023 28024 28025function setConfigLogs(action,v,obj,page) { 28026 $.post('/adm/clog/set', { action : action, v : v , obj : (typeof obj == 'object' && Object.keys(obj).length > 0) ? JSON.stringify(obj) : obj, page : page }, function(data) { 28027 if(typeof data.error != 'undefined' && data.error) { 28028 console.log(data.error); 28029 return false;
28030 } 28031 },'json'); 28032} 28033 28034function setSiteLogs(action,v,obj,page,ref) { 28035 $.post('/slog/set', { action : action, v : v , obj : (typeof obj == 'object' && Object.keys(obj).length > 0) ? JSON.stringify(obj) : obj, page : page, ref : ref }, function(data) { 28036 if(typeof data.error != 'undefined' && data.error) { 28037 console.log(data.error); 28038 return false; 28039 } 28040 },'json'); 28041} 28042 28043function getProductInfoList() { 28044 var input_empty = false, 28045 cate_null = false, 28046 idx = 0, 28047 prod_info_cate = $('.prod-select-title').text().trim(), 28048 $prod_info_lists = $('.prod-lists > div'), 28049 prod_info = { 28050 'title' : prod_info_cate, 28051 'content' : [] 28052 }; 28053 prod_null = new Array(); 28054 28055 if(prod_info_cate=='ì ííì¸ì') { 28056 cate_null = true; 28057 } 28058 28059 $.each($prod_info_lists, function(i,v) { 28060 if($(this).hasClass('prod-info-list-save')) return true; 28061 28062 var info_list_title = $(this).find('label').text(), 28063 info_list_content = ($(this).find('.prod-input-value').length > 0) ? $(this).find('.prod-input-value').html().trim() : ''; 28064 if(info_list_content.length > 0) info_list_content = info_list_content.replace(/ /gi, ''); 28065 28066 if(info_list_content.length==0) { 28067 idx = i; 28068 input_empty = true; 28069 prod_null.push(idx); 28070 } 28071 var s = { 28072 'title' : info_list_title, 28073 'content' : info_list_content 28074 } 28075 prod_info.content.push(s); 28076 }); 28077 prod_info.input_empty = input_empty; 28078 prod_info.input_idx = idx; 28079 prod_info.cate_null = cate_null; 28080 return prod_info; 28081} 28082 28083function setOptionlist($data, func) { 28084 var check_quantity = $('.prod-detail-wrap .switch-quantity').prop('checked'), 28085 normal_options_count = 0; 28086 28087 $.each($data, function(idx,o) { //ìíìµì ë¡ë 28088 switch(o.option_status) { 28089 case "S" : str = 'í매'; break; 28090 case "O" : str = 'íì '; break; 28091 case "H" : str = 'ì¨ê¹'; break; 28092 default : str = 'í매'; o.option_status = 'S'; break; 28093 } 28094 28095 if(typeof o.option_quantity == 'undefined' || o.option_quantity == null) o.option_quantity = 0; 28096 if(typeof o.option_price == 'undefined' || o.option_price == null) o.option_price = 0; 28097 28098 var s = ""; 28099 if(typeof o.option_type !='undefined' && o.option_type.indexOf('T') > -1) { 28100 s = '\ 28101 <li>\ 28102 <div class="prod-option-item">\ 28103 <span class="prod-option-title" data-seq="' + o.seq + '">' + o.option_name + '</span>\ 28104 <span class="prod-option-require" data-val="' + o.option_type + '">'; 28105 s += '</span>\ 28106 </div>\ 28107 <div class="prod-option-edit hide">\ 28108 <div class="form-wrap">\ 28109 <div class="form-group edit-option-title">\ 28110 <input type="text" maxlength="20" placeholder="ìë´ë¬¸êµ¬ ì ë ¥ (ì:ëê»ë¥¼ mmë¨ìë¡ ì ë ¥í´ì£¼ì¸ì.)"/>\ 28111 </div>\ 28112 <div class="edit-option-delete" data-seq="' + o.seq + '"><svg viewBox="0 0 12 13" width="12" height="13"><path d="M12 2h-1H9V0H3.02v2H1 0v1h1v8c0 1.1 0.9 2 2 2h6c1.1 0 2-0.9 2-2V3h1V2zM4.02 1H8v1H4.02V1zM10 11c0 0.55-0.45 1-1 1H3c-0.55 0-1-0.45-1-1V3h1.02H9h1V11z"/><rect x="4" y="4" width="1" height="7"/><rect x="7" y="4" width="1" height="7"/></svg></div>\ 28113 </div>\ 28114 </div>'; 28115 } else { 28116 var option_price = Number(o.option_price), 28117 only_price = Math.abs(option_price), 28118 str_price = only_price.toString(), 28119 str_quantity = (o.option_quantity).toString(), 28120 minus = (option_price < 0)? 'minus':'', 28121 option_name = o.option_name; 28122 28123 if(o.option_mix3) { 28124 option_name = '<label class="owidth ow1">' + o.option_mix2 + '</label><label class="owidth ow2">' + o.option_mix3 + '</label><label class="owidth ow3">' + option_name + '</label>'; 28125 } else { 28126 if(o.option_mix2) { 28127 option_name = '<label class="owidth ow1">' + o.option_mix2 + '</label><label class="owidth ow2">' + option_name + '</label>'; 28128 } else if(o.option_group) { 28129 option_name = '<label class="owidth ow1">' + o.option_group + '</label><label class="owidth ow2">' + option_name + '</label>'; 28130 } 28131 } 28132 s = '\ 28133 <li>\ 28134 <div class="prod-option-item">\
28135 <span class="prod-option-move cl-sort-handle">' + clSVG('move_handle', 20, 20) + '</span>\ 28136 <span class="prod-option-title" data-seq="' + o.seq + '">' + option_name + '</span>\ 28137 <span class="prod-option-price '+minus+'" data-option-price="'+o.option_price+'">' + addCommas(str_price) + '</span>\ 28138 <span class="prod-option-quantity" ' + ((check_quantity) ? '' : 'style="display:none"') + '>' + addCommas(str_quantity) + '</span>\ 28139 <span class="prod-option-status" data-val="' + o.option_status + '">' + str + '</span>\ 28140 <div class="edit-option-delete" data-seq="' + o.seq + '"><svg viewBox="0 0 12 13" width="12" height="13"><path d="M12 2h-1H9V0H3.02v2H1 0v1h1v8c0 1.1 0.9 2 2 2h6c1.1 0 2-0.9 2-2V3h1V2zM4.02 1H8v1H4.02V1zM10 11c0 0.55-0.45 1-1 1H3c-0.55 0-1-0.45-1-1V3h1.02H9h1V11z"/><rect x="4" y="4" width="1" height="7"/><rect x="7" y="4" width="1" height="7"/></svg></div>\ 28141 </div>\ 28142 <div class="prod-option-edit hide">\ 28143 <div class="form-wrap">\
28144 <span class="prod-option-move cl-sort-handle">' + clSVG('move_handle', 20, 20) + '</span>\ 28145 <div class="form-group edit-option-title">\ 28146 <input type="text" maxlength="60" placeholder="ìµì ê°"/>\ 28147 </div>\ 28148 <div class="form-group edit-option-price">\ 28149 <input type="text" class="option-price-number sign" placeholder="0" numberOnly/>\ 28150 </div>\ 28151 <div class="form-group edit-option-quantity" ' + ((check_quantity) ? '' : 'style="display:none"') + '>\ 28152 <input type="text" class="option-price-quantity" maxlength="5" placeholder="0" numberonly/>\ 28153 </div>\ 28154 <div class="form-group edit-option-select">\ 28155 <div class="option-price-status-str hand" data-val="' + o.option_status + '">' + str + '</div>\ 28156 <ul class="option-price-status-select">\ 28157 <li data-val="S">í매</li>\ 28158 <li data-val="O">íì </li>\ 28159 <li data-val="H">ì¨ê¹</li>\ 28160 </ul>\ 28161 </div>\ 28162 <div class="edit-option-delete" data-seq="' + o.seq + '"><svg viewBox="0 0 12 13" width="12" height="13"><path d="M12 2h-1H9V0H3.02v2H1 0v1h1v8c0 1.1 0.9 2 2 2h6c1.1 0 2-0.9 2-2V3h1V2zM4.02 1H8v1H4.02V1zM10 11c0 0.55-0.45 1-1 1H3c-0.55 0-1-0.45-1-1V3h1.02H9h1V11z"/><rect x="4" y="4" width="1" height="7"/><rect x="7" y="4" width="1" height="7"/></svg></div>\ 28163 </div>\ 28164 </div>'; 28165 // console.log('option_type:'+o.option_type); 28166 if (o.product_state && o.option_type!='A' && o.option_type!='T') { 28167 var p_s_data = JSON.parse(o.product_state); 28168 28169 if (p_s_data.file_name) { 28170 if (fileUpdateCnt == 0) fileUpdateCnt++; 28171 if (loadFile == 0) loadFile++; 28172 s += '<div class="form-group product-status">\ 28173 <div class="product-state-box">\ 28174 <div class="product-upload">\ 28175 <div class="title">íì¼ ì ë¡ë</div>\ 28176 <div class="download-contents">\ 28177 <span class="cl_icon_upload02" data-cnt="'+fileUpdateCnt+'">ì ë¡ë</span>\ 28178 <div class="file-box-list" id="file-box-'+fileUpdateCnt+'">'; 28179 28180 var serverName = p_s_data.file_url.split('/'); 28181 s += '<div class="file-name file-name-'+loadFile+'">\ 28182 <span class="real-file-name">'+p_s_data.file_name+'</span>\ 28183 <span class="file-name-detail" title="'+p_s_data.file_name+'">'+p_s_data.file_str_name+'</span>\ 28184 <span class="file-size">'+p_s_data.file_size+'</span>\ 28185 <span class="cl-icon cl_icon_close" data-cnt="'+loadFile+'" data-pn="'+o.product_number+'" data-file="'+serverName[8]+'" data-seq="'+o.seq+'"></span>\ 28186 <span class="file-url">'+p_s_data.file_url+'</span>\ 28187 </div>'; 28188 loadFile++; 28189 28190 s += ' </div>\ 28191 </div>\ 28192 </div>\ 28193 </div>\ 28194 </div>'; 28195 } 28196 } 28197 fileUpdateCnt++; 28198 } 28199 s += "</li>"; 28200 28201 optionLength = Object.keys($data).length; 28202 if($data.length == 1 && o.option_name=='noneOption') { 28203 $('.prod-option[data-option_mode="normal"] .prod-option-list').append(s); 28204 } else { 28205 if(o.option_type !== undefined && o.option_type.indexOf('T') > -1) { 28206 if($data.length > 0) { 28207 $('.prod-option[data-option_mode="text"] .prod-option-list').append(s); 28208 $('.option-state-box .newcheckbox').eq(1).find('#text-option').prop('checked',true); 28209 $('.prod-option-tab').removeClass('hide'); 28210 $('.prod-option[data-option_mode="text"]').removeClass('hide'); 28211 } 28212 } else if(o.option_type == 'A') { 28213 if($data.length > 0) { 28214 $('.prod-option[data-option_mode="additional"] .prod-option-list').append(s); 28215 $('.option-state-box .newcheckbox').eq(2).find('#additional-option').prop('checked',true); 28216 $('.prod-option-tab').removeClass('hide'); 28217 $('.prod-option[data-option_mode="additional"]').removeClass('hide'); 28218 $('.prod-option[data-option_mode="additional"] .plus-price').removeClass('hide'); 28219 $('.prod-option[data-option_mode="additional"] .plus-status').removeClass('hide'); 28220 28221 } 28222 } else { 28223 $('.prod-option[data-option_mode="normal"] .prod-option-list').append(s); 28224 normal_options_count++; 28225 if(normal_options_count > 1) { 28226 $('.option-state-box .newcheckbox').eq(0).find('#normal-option').prop('checked',true); 28227 $('.prod-option-tab').removeClass('hide'); 28228 $('.prod-option[data-option_mode="normal"]').removeClass('hide'); 28229 $('.prod-option[data-option_mode="normal"] .plus-price').removeClass('hide'); 28230 $('.prod-option[data-option_mode="normal"] .plus-status').removeClass('hide'); 28231 } 28232 } 28233 } 28234 28235 if($('.prod-option[data-option_mode="normal"] .prod-option-list > li').length == 1) { 28236 $('.prod-option[data-option_mode="normal"]').addClass('hide'); 28237 $('.option-state-box .newcheckbox').eq(0).find('#normal-option').prop('checked',fal
28237se); 28238 } 28239 if($('.prod-option[data-option_mode="text"] .prod-option-list > li').length == 0) { 28240 $('.prod-option[data-option_mode="text"]').addClass('hide'); 28241 $('.option-state-box .newcheckbox').eq(1).find('#text-option').prop('checked',false); 28242 } 28243 if($('.prod-option[data-option_mode="additional"] .prod-option-list > li').length == 0) { 28244 $('.prod-option[data-option_mode="additional"]').addClass('hide'); 28245 $('.option-state-box .newcheckbox').eq(2).find('#additional-option').prop('checked',false); 28246 } 28247 28248 $('#product-state').find('input[type="file"]').attr('data-cnt', loadFile).click(); 28249 }); 28250 28251 if(typeof func == 'function') { 28252 func(); 28253 } 28254} 28255 28256var setAdvancedMode = function(r) { 28257 if(r == "true") { // ê³ ê¸ëª¨ë 28258 $('.option-type-title.tp2, .option-type-title.tp3').removeClass('hide'); 28259 $('.option-type-title3.tp2, .option-type-title3.tp3').removeClass('hide'); 28260 $('.options-config').addClass('active'); 28261 $('.prod-option-list').sortable('disable'); 28262 $('.edit-option-title input').prop('disabled', true); 28263 $('.prod-option-move').addClass('invisible'); 28264 $('.edit-option-delete').addClass('invisible'); 28265 $('.prod-option-add').addClass('hide'); 28266 $('.reset-wrap').removeClass('hide'); 28267 $('.option-type-title.tp1').removeClass('editable'); 28268 $('.prod-option[data-option_mode="text"] > .text-option-info').removeClass('editable'); 28269 $('.prod-option[data-option_mode="text"] > .option-head').removeClass('editable'); 28270 $('.option-type-title3.tp1').removeClass('editable'); 28271 } else { 28272 $('.option-type-title.tp2, .option-type-title.tp3').addClass('hide'); 28273 $('.option-type-title3.tp2, .option-type-title3.tp3').addClass('hide'); 28274 $('.options-config').removeClass('active'); 28275 $('.prod-option-list').sortable('enable'); 28276 $('.edit-option-title input').prop('disabled', false); 28277 $('.prod-option-move').removeClass('invisible'); 28278 $('.edit-option-delete').removeClass('invisible'); 28279 $('.prod-option-add').removeClass('hide'); 28280 $('.reset-wrap').addClass('hide'); 28281 $('.option-type-title.tp1').addClass('editable'); 28282 $('.prod-option[data-option_mode="text"] > .text-option-info').addClass('editable'); 28283 $('.prod-option[data-option_mode="text"] > .option-head').addClass('editable'); 28284 $('.option-type-title3.tp1').addClass('editable'); 28285 } 28286 if($('.prod-option-tab .prod-option.hide').length == 3) { //í 모ë ë¹íì±íì¼ë 28287 $('.reset-wrap').addClass('hide'); 28288 } 28289 28290 switch(product_options.type) { 28291 case "1": 28292 $('.option-head-str').text('ë¨ì¼í'); 28293 $('.option-type-title.tp1').text('ìµì ëª '); 28294 $('.option-type-title.tp2').text('ìµì ê°'); 28295 $('.option-type-title.tp3').text(''); 28296 break; 28297 case "2": 28298 $('.option-head-str').text('2ê° ì¡°í©í'); 28299 if(product_options['config1'][0] !== undefined) 28300 $('.option-type-title.tp1').text(product_options['config1'][0]['title']).removeClass('editable'); 28301 if(product_options['config1'][0] !== undefined) 28302 $('.option-type-title.tp2').text(product_options['config1'][0]['value']); 28303 $('.option-type-title.tp3').text(''); 28304 break; 28305 case "3": 28306 $('.option-head-str').text('3ê° ì¡°í©í'); 28307 if(product_options['config1'][0] !== undefined) 28308 $('.option-type-title.tp1').text(product_options['config1'][0]['title']).removeClass('editable'); 28309 if(product_options['config1'][0] !== undefined) 28310 $('.option-type-title.tp2').text(product_options['config1'][0]['value']); 28311 if(product_options['config1'][0] !== undefined) 28312 $('.option-type-title.tp3').text(product_options['config1'][0]['value2']); 28313 break; 28314 default: 28315 $('.option-head-str').text('기본í'); 28316 $('.option-type-title.tp1').text('ìµì ëª '); 28317 $('.option-type-title.tp2').text('ìµì ê°'); 28318 $('.option-type-title.tp3').text(''); 28319 break; 28320 } 28321} 28322var switchQuantity = function() { 28323 if($('.switch-quantity').is(':checked')) { 28324 $('.switch-quantity').parents('.form-wrap').removeClass('disabled'); 28325 $('.prod-option-quantity, .prod-plus-quantity, .edit-option-quantity').show(); 28326 28327 if($('#normal-option').is(':checked') === true) { 28328 // $('#prod-quantity').attr('readonly','true').removeClass('hide').attr('placeholder','ìµì ìì ì¬ê³ ê´ë¦¬'); 28329 $('.quantity-label').addClass('on'); 28330 $('.plus-quantity').removeClass('hide'); 28331 } else if($('#normal-option').is(':checked') === false && $('#additional-option').is(':checked') === true) { 28332 $('.quantity-label').removeClass('on'); 28333 $('#prod-quantity').removeAttr('readonly').removeClass('hide'); 28334 $('.plus-quantity').removeClass('hide'); 28335 } else { 28336 $('.quantity-label').removeClass('on'); 28337 $('#prod-quantity').removeAttr('readonly').removeClass('hide'); 28338 $('.plus-quantity').addClass('hide'); 28339 } 28340 } else { 28341 $('.quantity-label').removeClass('on'); 28342 $('.switch-quantity').parents('.form-wrap').addClass('disabled'); 28343 $('#prod-quantity').addClass('hide'); 28344 $('.prod-option-quantity, .prod-plus-quantity, .edit-option-quantity').hide(); 28345 $('.plus-quantity').addClass('hide'); 28346 } 28347} 28348 28349function getMapURL(map_url, return_type) { 28350 /* 28351 https://www.google.co.kr/maps/@37.4817147,127.0069527,14z 28352 https://www.google.co.kr/maps/place/%EB%82%B4%EB%B0%A9%EC%97%AD/@37.4817147,127.0069527,14z/data=!4m5!3m4!1s0x357ca1a63a309789:0xb47e374059d4245b!8m2!3d37.487707!4d126.993598 28353 <iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3163.016222643161!2d126.96939075969449!3d37.554681575448!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x357ca266e3947003%3A0xe7be97c172b7af6a!2z7ISc7Jq47Jet!5e0!3m2!1sko!2skr!4v1628745599351!5m2!1sko!2skr" width="600" height="450" style="border:0;" allowfullscreen="" loading="lazy"></iframe> 28354 28355 28356 https://www.google.com/maps/place/%EC%9D%B4%EC%88%98%EC%97%AD/@37.4857251,126.9797283,17z/data=!4m9!1m2!2m1!1z7J207IiY7Jet!3m5!1s0x357ca1b3e26dcf3d:0xa16abe6619550e35!8m2!3d37.486491!4d126.981876!15sCgnsnbTsiJjsl62SAQtidXNfc3RhdGlvbg?hl=ko 28357 https://www.google.com/maps/search/%EC%9D%B4%EC%88%98%EC%97%AD/@37.4857251,126.9797283,17z/data=!3m1!4b1?hl=ko 28358 */ 28359 28360 28361 var checkGoogle = (map_url.match(/^(https|http)\:\/\/www\.google(\.co\.kr|\.com)\/maps\//g) !== null) ? true : false;
28362 if(checkGoogle) { 28363 var checkEmbed = (map_url.match(/^(https|http)\:\/\/www\.google(\.co\.kr|\.com)\/maps\/embed\?/g) !== null) ? true : false, 28364 checkPlace = (map_url.match(/^(https|http)\:\/\/www\.google(\.co\.kr|\.com)\/maps\/(place|search)/g) !== null) ? true : false; 28365 if(checkEmbed) { 28366 var map_src = map_url; 28367 } else { 28368 var map_arr = map_url.replace(/^(https|http)\:\/\/www\.google(\.co\.kr|\.com)\/maps\//g,'').split('/'), 28369 map_tmp = (checkPlace) ? map_arr[2].split(',') : map_arr[0].split(','), 28370 map_unit = (typeof map_tmp[2] != 'undefined' && map_tmp[2]) ? map_tmp[2].replace(/[0-9.]/g,'') : '', 28371 map_place = (checkPlace) ? map_arr[1] : '', 28372 map_xy = map_tmp[0].replace(/^@/,'') + ' ' + map_tmp[1], 28373 map_zoom = (map_unit == 'z') ? parseInt(map_tmp[2].replace('z','')) : 17, 28374 // ìì±ì§ë map_miter = (map_unit == 'm') ? map_tmp[2].replace('m','') : '', 28375 map_query = (checkPlace) ? map_place : map_xy; 28376 28377 28378 if(map_unit == 'z') map_query += '&z='+map_zoom; 28379 // ìì±ì§ë if(map_unit == 'm') map_query += '&t=k'; 28380 28381 // ì¸ì´ 28382 var check_lang = map_arr[map_arr.length-1]; 28383 if(typeof check_lang != 'undefined' && check_lang) { 28384 var lang_arr = check_lang.split('?'), 28385 lang_str = ''; 28386 $.each(lang_arr, function(i,tmp) { 28387 if(tmp.match(/^hl\=(ko|en|eu|ca|hr|cs|da|nl}fi|fr|de|gl|el|hi|id|it|ja|no|nn|pt|rm|ru|sr|sk|sl|es|sv|th|tr|uk|vi)/g) !== null) { 28388 map_query += '&hl=' + tmp.replace(/^hl=/g,''); 28389 } 28390 }); 28391 } 28392 28393 var map_src = '//www.google.com/maps?q=' + map_query + '&ll=' + map_xy.replace(/ /,',') + '&output=embed'; 28394 } 28395 28396 var map_iframe = '\ 28397 <iframe class="google-map" src="' + map_src + '" data-map="true" data-url="' + map_url + '" allowfullscreen="" loading="lazy"></iframe>\ 28398 '; 28399 if(return_type == 'html') return map_iframe; 28400 else if(return_type == 'src') return map_src; 28401 // else if(return_type == 'obj') { 28402 // return { 28403 // 'url' : map_url, 28404 // 'src' : map_src, 28405 // 'html' : map_iframe.trim(), 28406 // 'place' : (checkPlace) ? map_place : '', 28407 // 'xy' : (checkPlace) ? map_xy : '', 28408 // 'unit' : (checkPlace) ? map_unit : '', 28409 // 'zoom' : (checkPlace) ? map_zoom : '', 28410 // }; 28411 // } 28412 } else { 28413 var map_src = '//www.google.com/maps?q=ìì¸í¹ë³ì&z=10&output=embed', 28414 map_iframe = '\ 28415 <iframe class="google-map disabled" src="' + map_src + '" data-map="true" data-url="' + map_src + '" allowfullscreen="" loading="lazy"></iframe>\ 28416 <div class="map-undefined"><span>ì§ë URLì ë¤ì ì¤ì í´ì£¼ì¸ì</span></div>\ 28417 '; 28418 28419 if(return_type == 'html') return map_iframe; 28420 else if(return_type == 'src') return map_src; 28421 } 28422} 28423 28424var deliveryTemplateListModal = function(shopping_url, close_func) { 28425$.processON(); 28426 var html = ''; 28427 28428 html += '\ 28429 <div class="setting-sub-content setting-delivery-template">\ 28430 <div class="setting-sub-content-desc">ì¬ë¬ ì íì ë°°ì¡ ì¡°ê±´ì ì¤ì íê³ , ìí ë±ë¡ ì 미리 ì¤ì í´ë ë°°ì¡ ì¡°ê±´ì<br>ê°í¸íê² ì ì©í ì ììµëë¤.</div>\ 28431 <button type="button" class="btn-add-template btn btn-sm f-right"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 10" width="10" height="10"><path d="M10 4H6V0H4v4H0v2h4v4h2V6h4z"/></svg>ë°°ì¡ì¤ì ì¶ê°</button>\ 28432 <div class="delivery-template-area"></div>\ 28433 </div>\ 28434 ' 28435 28436 var modal = $(this).showModalFlat($.lang[LANG]['shopping.delivery.template.title'],html,true,false, function() { 28437 modal.modal('hide'); 28438 }, 'close','','cl-cmmodal cl-s-btn w680 cl-p70 cover delivery-template-modal', true, function() { 28439 if(typeof close_func == 'function') { 28440 close_func(); 28441 } 28442 }, function() { 28443 28444 var getDeliveryTemplateList = function() { 28445 $.ajax({ 28446 url: shopping_url + '/getDeliveryTemplateList', 28447 type: 'post', 28448 dataType: 'json', 28449 data:{'sid' : SID}, 28450 async: false, 28451 success:function(data) { 28452 console.log(data); 28453 var html = ''; 28454 if(data.length) { 28455 $(data).each(function(idx) { 28456 var row = this; 28457 28458 html += '<div class="template-row-box" data-seq="' + row.seq + '">'; 28459 html += '<div class="template-row-title-box">'; 28460 html += '<div class="template-row-title">' + row.name + '</div>'; 28461 28462 if(LUX) { 28463 if(idx > 0) { 28464 html += '<div class="template-row-buttons">\
28465 <span class="btn-edit-template"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 12" width="12" height="12"><path d="m11.56.57-.13-.13C11.14.15 10.76 0 10.37 0c-.38 0-.77.15-1.06.44L.75 9 0 12l3-.75 8.56-8.56c.59-.59.59-1.54 0-2.12zm-9.07 9.78-1.11.28.28-1.11 6.58-6.58.84.84-6.59 6.57zm8.36-8.37L9.77 3.06l-.83-.83 1.08-1.08a.487.487 0 0 1 .7 0l.13.13c.2.19.2.51 0 .7z"></path></svg></span>\ 28466 <span class="btn-copy-template"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 13" width="12" height="13"><path d="M10.5 0h-6C3.67 0 3 .67 3 1.5V2H1.5C.67 2 0 2.67 0 3.5v8c0 .83.67 1.5 1.5 1.5h6c.83 0 1.5-.67 1.5-1.5V11h1.5c.83 0 1.5-.67 1.5-1.5v-8c0-.83-.67-1.5-1.5-1.5zM8 11.5c0 .28-.22.5-.5.5h-6c-.28 0-.5-.22-.5-.5v-8c0-.28.22-.5.5-.5H3v6.5c0 .83.67 1.5 1.5 1.5H8v.5zm3-2c0 .28-.22.5-.5.5h-6c-.28 0-.5-.22-.5-.5v-8c0-.28.22-.5.5-.5h6c.28 0 .5.22.5.5v8z"></path></svg></span>\ 28467 '; 28468 if(idx > 1) { 28469 html += '\ 28470 <span class="btn-delete-template"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 13" width="12" height="13"><path d="M11 2H9V0H3.02v2H1 0v1h1v8c0 1.1 0.9 2 2 2h6c1.1 0 2-0.9 2-2V3h1V2H11zM4.02 1H8v1H4.02V1zM10 11c0 0.55-0.45 1-1 1H3c-0.55 0-1-0.45-1-1V3h1.02H9h1V11z"></path><rect x="4" y="4" width="1" height="7"></rect><rect x="7" y="4" width="1" height="7"></rect></svg></span>\ 28471 '; 28472 } 28473 html += '\ 28474 </div>'; 28475 } 28476 } else { 28477 html += '<div class="template-row-buttons">\ 28478 <span class="btn-edit-template"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 12" width="12" height="12"><path d="m11.56.57-.13-.13C11.14.15 10.76 0 10.37 0c-.38 0-.77.15-1.06.44L.75 9 0 12l3-.75 8.56-8.56c.59-.59.59-1.54 0-2.12zm-9.07 9.78-1.11.28.28-1.11 6.58-6.58.84.84-6.59 6.57zm8.36-8.37L9.77 3.06l-.83-.83 1.08-1.08a.487.487 0 0 1 .7 0l.13.13c.2.19.2.51 0 .7z"></path></svg></span>\ 28479 <span class="btn-copy-template"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 13" width="12" height="13"><path d="M10.5 0h-6C3.67 0 3 .67 3 1.5V2H1.5C.67 2 0 2.67 0 3.5v8c0 .83.67 1.5 1.5 1.5h6c.83 0 1.5-.67 1.5-1.5V11h1.5c.83 0 1.5-.67 1.5-1.5v-8c0-.83-.67-1.5-1.5-1.5zM8 11.5c0 .28-.22.5-.5.5h-6c-.28 0-.5-.22-.5-.5v-8c0-.28.22-.5.5-.5H3v6.5c0 .83.67 1.5 1.5 1.5H8v.5zm3-2c0 .28-.22.5-.5.5h-6c-.28 0-.5-.22-.5-.5v-8c0-.28.22-.5.5-.5h6c.28 0 .5.22.5.5v8z"></path></svg></span>\ 28480 '; 28481 if(idx > 0) { 28482 html += '\ 28483 <span class="btn-delete-template"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 13" width="12" height="13"><path d="M11 2H9V0H3.02v2H1 0v1h1v8c0 1.1 0.9 2 2 2h6c1.1 0 2-0.9 2-2V3h1V2H11zM4.02 1H8v1H4.02V1zM10 11c0 0.55-0.45 1-1 1H3c-0.55 0-1-0.45-1-1V3h1.02H9h1V11z"></path><rect x="4" y="4" width="1" height="7"></rect><rect x="7" y="4" width="1" height="7"></rect></svg></span>\ 28484 '; 28485 } 28486 html += '\ 28487 </div>'; 28488 } 28489 html += '</div>'; 28490 28491 html += '<div class="template-row-content">'; 28492 html += (row.mix_yn == 'Y' ? '묶ìë°°ì¡' : 'ê°ë³ë°°ì¡') + ' / '; 28493 28494 var delivery_type_arr = row.delivery_type.split(','); 28495 var delivery_type_str = ''; 28496 $(delivery_type_arr).each(function(k,v) { 28497 if(delivery_type_str) delivery_type_str += ', '; 28498 delivery_type_str += $.lang[LANG]['shopping.delivery.template.delivery_type.' + v.toLowerCase()]; 28499 }); 28500 28501 28502 if(delivery_type_str) html += delivery_type_str + ' / '; 28503 if(delivery_type_arr.indexOf('DELIVERY') > -1) 28504 html += $.lang[LANG]['shopping.delivery.' + row.delivery_company.toLowerCase()] + ' / '; 28505 html += $.lang[LANG]['shopping.delivery.template.price_type.' + row.price_type.toLowerCase()]; 28506 28507 if(row.price_type == 'FIX') { 28508 html += '(' + number_format(row.delivery_fee) + 'ì)'; 28509 } else if(row.price_type == 'QUANTITY' || row.price_type == 'WEIGHT') { 28510 var price_type_detail = row.price_type_detail ? JSON.parse(row.price_type_detail) : {}; 28511 28512 if(price_type_detail.method == 'DIFFERENTIAL') { 28513 var detail = ''; 28514 var popup_content = ''; 28515 if(price_type_detail.detail) { 28516 $.each(price_type_detail.detail, function(k, v) { 28517 var value = Object.keys(v); 28518 var price = Object.values(v); 28519 28520 if(row.price_type == 'QUANTITY') { 28521 if(k < 2) { 28522 if(detail) detail += ', '; 28523 detail += value + 'ê° ì´ì(' + number_format(price) + 'ì)'; 28524 } 28525 popup_content += value + 'ê° ì´ì ' + number_format(price) + 'ì' + '<br>'; 28526 } else if(row.price_type == 'WEIGHT') { 28527 if(k < 2) { 28528 if(detail) detail += ', '; 28529 detail += value + 'Kg ì´ì(' + number_format(price) + 'ì)'; 28530 } 28531 popup_content += value + 'Kg ì´ì ' + number_format(price) + 'ì' + '<br>'; 28532 } 28533 }); 28534 28535 if(price_type_detail.detail.length > 2) { 28536 popup_content = $.lang[LANG]['shopping.delivery.template.price_type.' + row.price_type.toLowerCase()] + '<br>' + popup_content; 28537 if(!LUX) popup_content += '<br>â» ì¶ê° ìíì ë°°ì¡ë¹ ì¡°ê±´ì ë°ìëì§ ììµëë¤.'; 28538 detail += '<span class="cm-popover-info" data-toggle="popover" tabindex="0" data-trigger="hover" data-html="true" data-placement="bottom" data-content="' + popup_content + '"> ë보기 </span>'; 28539 } 28540 } 28541 if(detail) { 28542 detail = '(ì°¨ë± / ' + detail + ')'; 28543 html += detail; 28544 } 28545 } else if(price_type_detail.method == 'REPEAT') { 28546 var detail = ''; 28547 var value = Object.keys(price_type_detail.detail); 28548 var price = Object.values(price_type_detail.detail); 28549 28550 if(row.price_type == 'QUANTITY') { 28551 detail += value + 'ê° êµ¬ë§¤ìë§ë¤ ' + number_format(price) + 'ì ë°ë³µ ë¶ê³¼'; 28552 } else if(row.price_type == 'WEIGHT') { 28553 detail += value + 'Kgë§ë¤ ' + number_format(price) + 'ì ë°ë³µ ë¶ê³¼'; 28554 } 28555 28556 if(detail) { 28557 detail = '(ë°ë³µ / ' + detail + ')'; 28558 html += detail; 28559 } 28560 } 28561 } 28562 28563 if(row.additional_yn == 'Y') { 28564 html += ' / ëìì°ê° ì§ì ì¶ê° ë°°ì¡ë¹ (ì 주 ' + number_format(row.additional_jeju_price) + 'ì, ì 주 ì¸ ëìì°ê° ' + number_format(row.additional_land_price) + 'ì'; 28565 } 28566 28567 html += ' / ' + $.lang[LANG]['shopping.delivery.template.pay_type.' + row.pay_type.toLowerCase()]; 28568 28569 if(row.free_condition_yn == 'Y') { 28570 html += ' / ' + number_format(row.free_condition) + 'ì ì´ì ë¬´ë£ ë°°ì¡'; 28571 } 28572 28573 if(row.make_to_order_yn == 'Y') { 28574 html += ' / 주문 íì¸ í ' + row.due_date + 'ì¼ í ë°°ì¡ ìì '; 28575 } 28576 28577 if(row.install_fee_yn == 'Y') { 28578 html += ' / ë³ë ì¤ì¹ë¹ ìì'; 28579 } 28580 28581 html += '</div>'; 28582 html += '</div>'; 28583 }); 28584 } else { 28585 html += '<div>ë°°ì¡ í íë¦¿ì´ ììµëë¤.</div>'; 28586 } 28587 html += '</div>'; 28588 $('.delivery-template-area').html(html); 28589 $('.delivery-template-area').find('[data-toggle="popover"]').popover(); 28590 }, complete: function() { 28591 $.processOFF(); 28592 } 28593 }); 28594 } 28595
28596 getDeliveryTemplateList(); 28597 28598 $('.btn-add-template').on('click', function() { 28599 deliveryTemplateEditModal(shopping_url, '', getDeliveryTemplateList); 28600 }); 28601 28602 modal.on('click', '.btn-edit-template', function() { 28603 var seq = $(this).closest('.template-row-box').data('seq'); 28604 deliveryTemplateEditModal(shopping_url, seq, getDeliveryTemplateList); 28605 }); 28606 28607 modal.on('click', '.btn-copy-template', function() { 28608 var seq = $(this).closest('.template-row-box').data('seq'); 28609 var copy_modal = $(this).showModalFlat('ë°°ì¡ì¤ì ë³µì ', 'ì íí ë°°ì¡ì¤ì ì ë³µì íìê² ìµëê¹?', true, true, function() { 28610 $.processON(); 28611 setTimeout(function() { 28612 $.ajax({ 28613 url: shopping_url + '/copyDeliveryTemplate', 28614 type:'post', 28615 dataType:'json', 28616 async: false, 28617 data:{'sid' : SID, 'seq' : seq}, 28618 success:function(data) { 28619 getDeliveryTemplateList(); 28620 }, complete: function() { 28621 $.processOFF(); 28622 } 28623 }); 28624 }); 28625 28626 copy_modal.modal('hide'); 28627 }, 'cancel', 'ok', 'cl-cmmodal cl-s-btn w560 cl-p130'); 28628 var backdrop_z_index = Number(copy_modal.css('zIndex')); 28629 backdrop_z_index+=2; 28630 copy_modal.css('zIndex', backdrop_z_index + 1); 28631 copy_modal.parent().next('.modal-backdrop').css('zIndex', backdrop_z_index); 28632 }); 28633 28634 modal.on('click', '.btn-delete-template', function() { 28635 var seq = $(this).closest('.template-row-box').data('seq'); 28636 var delete_modal = $(this).showModalFlat('ë°°ì¡ì¤ì ìì ', 'ì íí ë°°ì¡ì¤ì ì´ ì ì©ëìë ìíë¤ì 기본 ë°°ì¡ì¤ì ì¼ë¡ ë³ê²½ë©ëë¤.<br><br>ì íí ë°°ì¡ì¤ì ì ìì íìê² ìµëê¹?', true, true, function() { 28637 $.processON(); 28638 setTimeout(function() { 28639 $.ajax({ 28640 url: shopping_url + '/deleteDeliveryTemplate', 28641 type:'post', 28642 dataType:'json', 28643 async: false, 28644 data: { 28645 'sid' : SID, 28646 'seq' : seq 28647 }, 28648 success:function(data) { 28649 getDeliveryTemplateList(); 28650 }, 28651 complete: function() { 28652 $.processOFF(); 28653 } 28654 }); 28655 }); 28656 delete_modal.modal('hide'); 28657 }, 'cancel', 'ok', 'cl-cmmodal cl-s-btn w560 cl-p130',true); 28658 28659 var backdrop_z_index = Number(delete_modal.css('zIndex')); 28660 backdrop_z_index+=2; 28661 delete_modal.css('zIndex', backdrop_z_index + 1); 28662 delete_modal.parent().next('.modal-backdrop').css('zIndex', backdrop_z_index); 28663 }); 28664 }, function() { 28665 // if(typeof close_func == 'function') { 28666 // close_func(); 28667 // } 28668 }); 28669} 28670 28671var deliveryTemplateEditModal = function(shopping_url, template_seq, callback_func) { 28672 28673 var seq = template_seq ? template_seq : ''; 28674 28675 var opts = { 28676 'seq' : '', 28677 'name':'', 28678 'mix_yn' : 'Y', 28679 'delivery_type' : 'DELIVERY', 28680 'price_type' : 'FIX', 28681 'delivery_fee' : 2500, 28682 'additional_yn' : 'N', 28683 'pay_type' : 'PREPAY', 28684 'free_condition_yn' : 'N', 28685 'make_to_order_yn' : 'N', 28686 'install_fee_yn' : 'N', 28687 'additional_jeju_price' : 0, 28688 'additional_land_price' : 0, 28689 'due_date' : '', 28690 'free_condition' : 0, 28691 'delivery_company' : 'pt', 28692 'price_type_detail' : {} 28693 }; 28694 28695 if(seq) { 28696 $.ajax({ 28697 url:shopping_url + '/getDeliveryTemplate', 28698 type:'post', 28699 dataType:'json', 28700 async: false, 28701 data:{ 28702 'seq' : seq, 28703 'sid' : SID, 28704 }, 28705 success:function(data) { 28706 $.extend(opts, data); 28707 } 28708 }); 28709 } 28710 28711 opts.delivery_type = opts.delivery_type.split(','); 28712 if(opts.price_type == 'QUANTITY' || opts.price_type == 'WEIGHT') { 28713 opts.price_type_detail = opts.price_type_detail ? JSON.parse(opts.price_type_detail) : {}; 28714 28715 if(!opts.price_type_detail.detail) { 28716 opts.price_type_detail.detail = {}; 28717 } 28718 28719 if(opts.price_type_detail.method && opts.price_type_detail.method == 'REPEAT') { 28720 if(opts.price_type == 'QUANTITY') { 28721 opts.quantity_repeat_value = Object.keys(opts.price_type_detail.detail)[0]; 28722 opts.quantity_repeat_price = Object.values(opts.price_type_detail.detail)[0]; 28723 } else if(opts.price_type == 'WEIGHT') { 28724 opts.weight_repeat_value = Object.keys(opts.price_type_detail.detail)[0]; 28725 opts.weight_repeat_price = Object.values(opts.price_type_detail.detail)[0]; 28726 } 28727 } else { 28728 opts.price_type_detail.method = 'DIFFERENTIAL'; 28729 } 28730 } 28731 28732 if(opts.delivery_company == '') opts.delivery_company = 'pt'; 28733 28734 var tracking_delivery_company_arr = ['cj','pt','hj','lg','lt','post']; 28735 28736 var delivery_company_arr = [ 28737 'etc', 28738 'cj', 28739 'pt', 28740 'hj', 28741 'lg', 28742 'lt', 28743 'post', 28744 'koryo', 28745 'wevill', 28746 'daesin', 28747 'ilyang', 28748 'kdexp', 28749 'chunil', 28750 'cv', 28751 'cu', 28752 'hdexp', 28753 'dhl', 28754 'dhlglobalmail', 28755 'dhlde', 28756 'fedex', 28757 'gsmnton', 28758 'warpex', 28759 'ems', 28760 'ace', 28761 'qxpress', 28762 'aciexpress', 28763 'lineexp', 28764 'pantos', 28765 'smartlogis', 28766 'hlcglobal', 28767 'ups', 28768 'korexg', 28769 'tnt', 28770 'swgexp', 28771 'daewoon', 28772 'usps', 28773 'iparcel', 28774 'kunyoung', 28775 'hpl', 28776 'gnetwork', 28777 'slx', 28778 'daelim', 28779 'honam', 28780 'gsiexpress', 28781 'eunha', 28782 'homeinno', 28783 'hybrid', 28784 'airway', 28785 'woorihb', 28786 'yjsworld', 28787 'yjs', 28788 'crlx', 28789 'homepick', 28790 'cwayexpress', 28791 'anytrack', 28792 'bridge', 28793 'gpslogix', 28794 'esther', 28795 'lotos', 28796 'ufreight', 28797 'ik', 28798 'lslogis', 28799 'sebang', 28800 'nonghyup', 28801 'yongma', 28802 'europarcel', 28803 'kgsl', 28804 'sunghun', 28805 'forever', 28806 'airboy', 28807 'ecmsexpress', 28808 'efs', 28809 'handex', 28810 'kglnet', 28811 'twofastexpress', 28812 'gos', 28813 'gspostbox', 28814 'adcair', 28815 'donggang', 28816 'kin', 28817 'hanwoori', 28818 'lglogistics', 28819 'generalpost', 28820 'ezusa', 28821 'handalum', 28822 'howser', 28823 'dpd', 28824 'gop', 28825 'wizwa', 28826 'selc', 28827 'sfex', 28828 'wihtyou', 28829 'roadsunexpress', 28830 'dongjin', 28831 'ilshin', 28832 'ky', 28833 'tpmlogis', 28834 'zeniel', 28835 'fresh', 28836 'jlogist', 28837 'chainlogis', 28838 'hivecity', 28839 'hanssem', 28840 'todaypickup', 28841 'qrun', 28842 'nogok', 28843 'spasys1', 28844 'freshmates', 28845 'etomars', 28846 'shipnergy', 28847 'geniego', 28848 'dodoflex', 28849 'ltl',
28850 'vendorpia', 28851 'coship', 28852 'gdakorea', 28853 'lge', 28854 'teamfresh', 28855 'yunda', 28856 'alltakorea', 28857 'lottechilsung', 28858 'valex', 28859 'bababa', 28860 'ch1', 28861 'apex', 28862 'homeplus', 28863 'gsfresh', 28864 'hanaromart', 28865 'choroc', 28866 'vroong', 28867 'dcommerce', 28868 'aboutpet', 28869 '1004home', 28870 'gtslogis', 28871 'sbgls', 28872 'ssg', 28873 'kokusai', 28874 'goodtoluck', 28875 'ekdp', 28876 'woongji', 28877 'xinpatek', 28878 'herewego', 28879 'panasia', 28880 'pingpong', 28881 'cargoplease', 28882 'kjt', // ì¼ì´ì ì´í° 28883 'rush', // ì¤ëíë¬ì¬ 28884 'ntlps', // ìí°ìí¼ì¤ 28885 'actcore', // ìì´ì¨í°ì¤ì½ì 28886 'logisvalley', // ë¡ì§ì¤ë°¸ë¦¬ 28887 'drabbit', // ë리ëë¹ 28888 'naeun', // ëìë¬¼ë¥ 28889 'logispartner', // UFO ë¡ì§ì¤ 28890 'ndexkorea', // NDEX KOREA 28891 ]; 28892 28893 // console.log(new_delivery_company_arr) 28894 var tmp_delivery_company_arr = {}, new_delivery_company_arr = {}; 28895 var delivery_company_options = ''; 28896 $(delivery_company_arr).each(function(k, v) { 28897 tmp_delivery_company_arr[$.lang[LANG]['shopping.delivery.' + v]] = v; 28898 }); 28899 28900 $(Object.keys(tmp_delivery_company_arr).sort()).each(function(k, v) { 28901 new_delivery_company_arr[v] = tmp_delivery_company_arr[v]; 28902 }); 28903 28904 delivery_company_options = ''; 28905 $.each(new_delivery_company_arr, function(k, v) { 28906 var data_content = ''; 28907 if(tracking_delivery_company_arr.indexOf(v) > -1) { 28908 data_content = '<span class="tracking-delivery-icon"></span>'; 28909 } 28910 delivery_company_options += '<option value="' + v + '" ' + (opts.delivery_company == v ? ' selected ' : '') + (data_content ? ' data-content=\'' + k + data_content + '\'' : '') + '>' + k + '</option>'; 28911 }); 28912 28913 var html = '\ 28914 <div class="delivery-template-layer">\ 28915 <form id="deliveryTemplateForm">\ 28916 <div class="item-row">\ 28917 <div class="">' + $.lang[LANG]['shopping.delivery.template.name'] + '</div>\ 28918 <div class=""><input type="hidden" name="sid" value="' + SID + '" /><input type="text" name="name" class="form-control" value="' + opts.name + '" maxlength="50" autocomplete="off" /><input type="hidden" name="seq" value="' + opts.seq + '" /></div>\ 28919 </div>\ 28920 <div class="item-row">\ 28921 <div class="">' + $.lang[LANG]['shopping.delivery.template.mix_yn'] + '<svg class="cm-popover-info" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 13" width="13" height="13" tabindex="0" data-trigger="hover" data-toggle="popover" fill="#4789e7" data-html="true" data-placement="top" data-content="<ul><li class=\'item\'>묶ì ë°°ì¡ : ì¬ë¬ ìíì ê°ì´ 구매í ê²½ì°, ëì¼í ë°°ì¡ì¤ì ì´ ì ì©ëì´ ìë¤ë©´ 구매ììê² ë°°ì¡ë¹ê° í ë²ë§ ë¶ê³¼ë©ëë¤.</li><li class=\'item\'>ê°ë³ ë°°ì¡ : ì¬ë¬ ìíì 구매íëë¼ë, ìí ë³ë¡ ì¤ì í ë°°ì¡ë¹ê° ë¶ê³¼ë©ëë¤.</li></ul>" data-original-title="" title=""><path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"></path><path d="M6.66 3.01C5.61 3.01 4.58 3.5 4.5 4.8c0 0.06-0.01 0.12 0 0.2h1.02c0-0.07 0.01-0.15 0.02-0.23 0.08-0.62 0.52-0.76 1.08-0.76 0.63 0 1.02 0.37 1.02 0.95 -0.01 0.48-0.3 0.87-0.76 1.34C6.21 6.97 6.02 7.37 6 8h0.99C7 7.66 7.04 7.37 7.67 6.75 8.17 6.27 8.7 5.68 8.7 4.87 8.7 3.85 7.89 3.01 6.66 3.01z"></path><rect x="6" y="9" width="1" height="1"></rect></svg></div>\ 28922 <div class="mix-yn-row"><label><input type="radio" name="mix_yn" value="Y" ' + (opts.mix_yn == 'Y' ? ' checked ' : '') + ' /><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18" width="18" height="18"><path d="M9 0a9 9 0 1 0 .001 18.001A9 9 0 0 0 9 0zm0 17c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"/></svg><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18" width="18" height="18"><path d="M9 0a9 9 0 1 0 .001 18.001A9 9 0 0 0 9 0zm0 17c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"/><circle cx="9" cy="9" r="6"/></svg>
28922' + $.lang[LANG]['shopping.delivery.template.mix_yn.y'] + '</label> <label><input type="radio" name="mix_yn" value="N" ' + (opts.mix_yn == 'N' ? ' checked ' : '') + ' /><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18" width="18" height="18"><path d="M9 0a9 9 0 1 0 .001 18.001A9 9 0 0 0 9 0zm0 17c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"/></svg><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18" width="18" height="18"><path d="M9 0a9 9 0 1 0 .001 18.001A9 9 0 0 0 9 0zm0 17c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"/><circle cx="9" cy="9" r="6"/></svg>' + $.lang[LANG]['shopping.delivery.template.mix_yn.n'] + '</label></div>\ 28923 </div>\ 28924 <div class="item-row">\ 28925 <div class="">' + $.lang[LANG]['shopping.delivery.template.delivery_type'] + '<svg class="cm-popover-info" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 13" width="13" height="13" tabindex="0" data-trigger="hover" data-toggle="popover" fill="#4789e7" data-html="true" data-placement="top" data-content="<ul><li class=\'title\'>ìíì ë°°ì¡íë ìë¨ì ì íí©ëë¤.</li><li class=\'item\'>íë°° : íë°°ì¬ë¥¼ ì´ì©íì¬ ìíì ë°ì¡í©ëë¤.</li><li class=\'item\'>ì§ì ë°°ì¡(í물배ë¬) : í매ìê° ì§ì ë°°ì¡ì íê±°ë íë¬¼ë¡ ë°ì¡í©ëë¤.</li><li class=\'item\'>íµìë¹ì¤ : íµìë¹ì¤ë¥¼ ì´ì©íì¬ ìíì ë°ì¡í©ëë¤. ë°°ì¡ë¹ë ë³ë ìë´ë¡ ì¤ì ëê³ ê²°ì ë°©ìì ì°©ë¶ë§ ì§ìí©ëë¤.<div class=\'desc\'>* íµìë¹ì¤ ê°ë¥ ì¬ë¶ ë° ë°°ì¡ë¹ì ëí´ ìì¸íì´ì§ì ë´ì©ì ì ë ¥íê±°ë 구매ìì íìí´ ì£¼ì¸ì.</div></li><li class=\'item\'>방문ìë ¹ : 구매ìê° í매ììê² ë°©ë¬¸íì¬ ì§ì ìíì ë°ì ê°ëë¤. ë°°ì¡ë¹ë ë¬´ë£ ë°°ì¡ì¼ë¡ ì¤ì ëê³ ê²°ì ë°©ìì ì§ìíì§ ììµëë¤.</li></ul>" data-original-title="" title=""><path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"></path><path d="M6.66 3.01C5.61 3.01 4.58 3.5 4.5 4.8c0 0.06-0.01 0.12 0 0.2h1.02c0-0.07 0.01-0.15 0.02-0.23 0.08-0.62 0.52-0.76 1.08-0.76 0.63 0 1.02 0.37 1.02 0.95 -0.01 0.48-0.3 0.87-0.76 1.34C6.21 6.97 6.02 7.37 6 8h0.99C7 7.66 7.04 7.37 7.67 6.75 8.17 6.27 8.7 5.68 8.7 4.87 8.7 3.85 7.89 3.01 6.66 3.01z"></path><rect x="6" y="9" width="1" height="1"></rect></svg></div>\ 28926 <div class="delivery-type-row"><label class="btn-delivery-type"><input type="radio" name="delivery_type[]" value="DELIVERY" ' + (opts.delivery_type.indexOf('DELIVERY') > -1 ? ' checked ' : '') + ' /><div>' + $.lang[LANG]['shopping.delivery.template.delivery_type.delivery'] + '</div></label> <label class="btn-delivery-type"><input type="radio" name="delivery_type[]" value="DIRECT" ' + (opts.delivery_type.indexOf('DIRECT') > -1 ? ' checked ' : '') + ' /><div>' + $.lang[LANG]['shopping.delivery.template.delivery_type.direct'] + '</div></label> <label><input type="checkbox" name="delivery_type[]" value="QUICK" ' + (opts.delivery_type.indexOf('QUICK') > -1 ? ' checked ' : '') + ' /><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path d="M13 0H3C1.3 0 0 1.3 0 3v10c0 1.7 1.3 3 3 3h10c1.7 0 3-1.3 3-3V3C16 1.3 14.7 0 13 0zM15 13c0 1.1-0.9 2-2 2H3c-1.1 0-2-0.9-2-2V3c0-1.1 0.9-2 2-2h10c1.1 0 2 0.9 2 2V13z"></path></svg><svg class="active" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path d="M13 0H3C1.34 0 0 1.34 0 3v10c0 1.66 1.34 3 3 3h10c1.66 0 3-1.34 3-3V3C16 1.34 14.66 0 13 0zM13.03 6.03l-5.5 5.5C7.38 11.68 7.19 11.75 7 11.75s-0.38-0.07-0.53-0.22l-3.5-3.5c-0.29-0.29-0.29-0.77 0-1.06s0.77-0.29 1.06 0L7 9.94l4.97-4.97c0.29-0.29 0.77-0.29 1.06 0S13.32 5.74 13.03 6.03z"></path></svg>' + $.lang[LANG]['shopping.delivery.template.delivery_type.quick'] + '</label> <label><input type="checkbox" name="delivery_type[]" value="VISIT" ' + (opts.delivery_type.indexOf('VISIT') > -1 ? ' checked ' : '') + ' /><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path d="M13 0H3C1.3 0 0 1.3 0 3v10c0 1.7 1.3 3 3 3h10c1.7 0 3-1.3 3-3V3C16 1.3 14.7 0 13 0zM15 13c0 1.1-0.9 2-2 2H3c-1.1 0-2-0.9-2-2V3c0-1.1 0.9-2 2-2h10c1.1 0 2 0.9 2 2V13z"></path></svg><svg class="active" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path d="M13 0H3C1.34 0 0 1.34 0 3v10c0 1.66 1.34 3 3 3h10c1.66 0 3-1.34 3-3V3C16 1.34 14.66 0 13 0zM13.03 6.03l-5.5 5.5C7.38 11.68 7.19 11.75 7 11.75s-0.38-0.07-0.53-0.22l-3.5-3.5c-0.29-0.29-0.29-0.77 0-1.06s0.77-0.29 1.06 0L7 9.94l4.97-4.97c0.29-0.29 0.77-0.29 1.06 0S13.32 5.74 13.03 6.03z"></path></svg>
28926' + $.lang[LANG]['shopping.delivery.template.delivery_type.visit'] + '</label>\ 28927 <div class="delivery-company-row" style="' + (opts.delivery_type.indexOf('DELIVERY') > -1 ? '' : ' display: none; ') + '">\ 28928 <div class="row-sub-title">' + $.lang[LANG]['shopping.delivery.template.delivery_company'] + '</div>\ 28929 <select name="delivery_company" class="form-control">\ 28930 ' + delivery_company_options + '\ 28931 </select>\ 28932 </div>\ 28933 </div>\ 28934 </div>\ 28935 <div class="item-row">\ 28936 <div class="">' + $.lang[LANG]['shopping.delivery.template.price_type'] + '<svg class="cm-popover-info" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 13" width="13" height="13" tabindex="0" data-trigger="hover" data-toggle="popover" fill="#4789e7" data-html="true" data-placement="top" data-content="<ul><li class=\'title\'>ë°°ì¡ë¹ ê³ì° ë°©ë²ì ì íí©ëë¤.</li><li class=\'item\'>ê³ ì ë°°ì¡ë¹(기본ì¤ì ) : ì¤ì í ë°°ì¡ë¹ë¡ ë¶ê³¼í©ëë¤. (ë¤ì´ë² íì´ ê²°ì ê°ë¥)</li><li class=\'item\'>ìëë³ ë°°ì¡ë¹ : ìëì ë°ë¼ì ë°°ì¡ë¹ë¥¼ ì°¨ë±/ë°ë³µ ìµì ì¼ë¡ ë¶ê³¼í©ëë¤.<div class=\'desc\'>* ë¤ì´ë² íì´ ê²°ì ê°ë¥ (ë¨, ìëë³ ë°°ì¡ë¹ ì°¨ë± íëª©ì´ 4ê° ì´ìì¸ ê²½ì° ë¤ì´ë² íì´ ê²°ì ë¶ê°ë¥)</div></li><li class=\'item\'>무ê²ë³ ë°°ì¡ë¹ : 무ê²ì ë°ë¼ì ë°°ì¡ë¹ë¥¼ ì°¨ë±/ë°ë³µ ìµì ì¼ë¡ ë¶ê³¼í©ëë¤. (ë¤ì´ë² íì´ ê²°ì ë¶ê°ë¥)</li><li class=\'item\'>ë¬´ë£ ë°°ì¡ : ë°°ì¡ë¹ê° 무ë£ì ëë¤. (ë¤ì´ë² íì´ ê²°ì ê°ë¥)</li><li class=\'item\'>ë³ë ìë´ : ê²°ì ì ë°°ì¡ë¹ê° ë¶ê³¼íì§ ìê³ í매ìì ë³ëë¡ íìíì¬ ë°°ì¡ë¹ë¥¼ ë³ëë¡ ì¸¡ì ë° ê³ì°í©ëë¤. (ë¤ì´ë² íì´ ê²°ì ê°ë¥)</li></ul>" data-original-title="" title=""><path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"></path><path d="M6.66 3.01C5.61 3.01 4.58 3.5 4.5 4.8c0 0.06-0.01 0.12 0 0.2h1.02c0-0.07 0.01-0.15 0.02-0.23 0.08-0.62 0.52-0.76 1.08-0.76 0.63 0 1.02 0.37 1.02 0.95 -0.01 0.48-0.3 0.87-0.76 1.34C6.21 6.97 6.02 7.37 6 8h0.99C7 7.66 7.04 7.37 7.67 6.75 8.17 6.27 8.7 5.68 8.7 4.87 8.7 3.85 7.89 3.01 6.66 3.01z"></path><rect x="6" y="9" width="1" height="1"></rect></svg></div>\ 28937 <div class=""><select name="price_type" class="form-control"><option value="FIX" ' + (opts.price_type == 'FIX' ? ' selected ' : '') + '>' + $.lang[LANG]['shopping.delivery.template.price_type.fix'] + '</option><option value="FREE_CONDITION" ' + (opts.price_type == 'FREE_CONDITION' ? ' selected ' : '') + '>' + $.lang[LANG]['shopping.delivery.template.price_type.free_condition'] + '</option><option value="QUANTITY" ' + (opts.price_type == 'QUANTITY' ? ' selected ' : '') + '>' + $.lang[LANG]['shopping.delivery.template.price_type.quantity'] + '</option><option value="WEIGHT" ' + (opts.price_type == 'WEIGHT' ? ' selected ' : '') + '>' + $.lang[LANG]['shopping.delivery.template.price_type.weight'] + '</option><option value="FREE" ' + (opts.price_type == 'FREE' ? ' selected ' : '') + '>' + $.lang[LANG]['shopping.delivery.template.price_type.free'] + '</option><option value="ETC" ' + (opts.price_type == 'ETC' ? ' selected ' : '') + '>' + $.lang[LANG]['shopping.delivery.template.price_type.etc'] + '</option></select>\ 28938 <div class="fix-row free-condition-row m15t" style="' + (opts.price_type == 'FIX' || opts.price_type == 'FREE_CONDITION' ? '' : ' display: none; ') + '">\ 28939 <div class="row-sub-title">기본 ë°°ì¡ë¹</div>\ 28940 <div class="m5t"><input type="text" name="delivery_fee" class="form-control" value="' + (opts.delivery_fee ? number_format(opts.delivery_fee) : 0) + '" numberonly maxlength="13" />ì</div>\ 28941 </div>\ 28942 <div class="free-condition-row m15t" style="' + (opts.price_type == 'FREE_CONDITION' ? '' : ' display: none; ') + '">\ 28943 <div class="row-sub-title">ë¬´ë£ ë°°ì¡ ì¡°ê±´</div>\ 28944 <div class="m5t">\
28945 <input type="text" name="free_condition" class="form-control" value="' + (number_format(opts.free_condition)) + '" numberonly maxlength="13" />ì ì´ì 구매 ì ë¬´ë£ ë°°ì¡\ 28946 </div>\ 28947 <div class="row-sub-title m10t"><svg class="cm-popover-info m5r" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 13" width="13" height="13" tabindex="0"><path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12.13c-3.11 0-5.63-2.53-5.63-5.63S3.39 0.87 6.5 0.87s5.63 2.53 5.63 5.63S9.61 12.13 6.5 12.13z"></path><path d="M7.44 9.58c-0.1-0.02-0.18-0.05-0.25-0.1C7.12 9.44 7.07 9.37 7.03 9.28 6.98 9.19 6.96 9.07 6.96 8.92V5h-1.7v0.4h0.03c0.11 0 0.21 0.01 0.3 0.02 0.09 0.02 0.18 0.05 0.25 0.09 0.07 0.05 0.13 0.11 0.17 0.2 0.04 0.09 0.06 0.2 0.06 0.34v2.91c0 0.14-0.02 0.25-0.06 0.34C5.97 9.39 5.91 9.45 5.84 9.5 5.77 9.54 5.68 9.57 5.59 9.58 5.49 9.6 5.39 9.6 5.29 9.6H5.16v0.4h2.71V9.6H7.75C7.64 9.6 7.54 9.6 7.44 9.58z"></path><rect x="6" y="3" width="1" height="1"></rect></svg>ë°°ì¡ë¹ë¥¼ ì ì¸í ìí 주문ê¸ì¡ í©ê³ê° ì¡°ê±´ ê¸ì¡ ì´ìì¸ ê²½ì° ë¬´ë£ ë°°ì¡ì¼ë¡ ì ì©ë©ëë¤.</div>\ 28948 </div>\ 28949 <div class="price-type-detail-method-row quantity-row weight-row" style="' + (opts.price_type == 'QUANTITY' || opts.price_type == 'WEIGHT' ? '' : ' display: none;') + '">\ 28950 <label><input type="radio" id="price_type_detail_method_D" name="price_type_detail_method" value="DIFFERENTIAL" ' + (opts.price_type_detail.method == 'DIFFERENTIAL' ? ' checked ' : '') + ' /><div>ì°¨ë±</div></label>\ 28951 <label><input type="radio" id="price_type_detail_method_R" name="price_type_detail_method" value="REPEAT" ' + (opts.price_type_detail.method == 'REPEAT' ? ' checked ' : '') + ' /><div>ë°ë³µ</div></label>\ 28952 </div>\ 28953 <div class="quantity-row" style="' + (opts.price_type == 'QUANTITY' ? '' : ' display: none; ') + '">\ 28954 <div class="quantity-differential" style="' + (opts.price_type_detail.method == 'DIFFERENTIAL' ? '' : ' display: none;') + '">\ 28955 <table>\ 28956 <colgroup><col width="45%" /><col width="40%" /><col width="20%" /></colgroup>\ 28957 '; 28958 28959 if(opts.price_type == 'QUANTITY' && opts.price_type_detail.method == 'DIFFERENTIAL' && opts.price_type_detail.detail.length) { 28960 $.each(opts.price_type_detail.detail, function(k, v) { 28961 var value = Object.keys(v); 28962 var price = Object.values(v); 28963 if(k == 0) value = 1; 28964 html += '<tr><td><input type="text" class="form-control" name="quantity_differential_value[]" value="' + (number_format(value)) + '" ' + (k == 0 ? ' readonly ' : '') + ' numberonly maxlength="13" /> ê° ì´ì</td><td><input type="text" class="form-control" name="quantity_differential_price[]" value="' + number_format(price) + '" numberonly maxlength="13" />ì</td><td>' + (k > 0 ? '<span class="btn-delete-condition-row"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 13" width="12" height="13"><path d="M11 2H9V0H3.02v2H1 0v1h1v8c0 1.1 0.9 2 2 2h6c1.1 0 2-0.9 2-2V3h1V2H11zM4.02 1H8v1H4.02V1zM10 11c0 0.55-0.45 1-1 1H3c-0.55 0-1-0.45-1-1V3h1.02H9h1V11z"/><rect x="4" y="4" width="1" height="7"/><rect x="7" y="4" width="1" height="7"/></svg></span>' : '') + '</td></tr>'; 28965 }); 28966 } else { 28967 html += '<tr><td><input type="text" class="form-control" name="quantity_differential_value[]" value="1" readonly numberonly maxlength="13" /> ê° ì´ì</td><td><input type="text" class="form-control" name="quantity_differential_price[]" numberonly maxlength="13" />ì</td><td></td></tr>'; 28968 } 28969 28970 html += '\ 28971 </table>\ 28972 <div><button type="button" class="btn btn-quantity-diff">+ ì¡°ê±´ ì¶ê°</button></div>\ 28973 </div>\ 28974 <div class="quantity-repeat" style="' + (opts.price_type_detail.method == 'REPEAT' ? '' : ' display: none;') + '">\ 28975 <div class="row-sub-title">기본 ë°°ì¡ë¹</div>\ 28976 <div class="m5t"><input type="text" class="form-control m5r" name="quantity_repeat_price" value="' + (opts.quantity_repeat_price ? opts.quantity_repeat_price : 0) + '" numberonly maxlength="13" />ì</div>\ 28977 <div class="m10t"><input type="text" class="form-control m5r" name="quantity_repeat_value" value="' + (opts.quantity_repeat_value ? opts.quantity_repeat_value : 0) + '" numberonly maxlength="13" />ê°ë§ë¤ 기본 ë°°ì¡ë¹ ë°ë³µ ë¶ê³¼</div>\ 28978 </div>\ 28979 </div>\ 28980 <div class="weight-row" style="' + (opts.price_type == 'WEIGHT' ? '' : ' display: none;') + '">\ 28981 <div class="weight-differential" style="' + (opts.price_type_detail.method == 'DIFFERENTIAL' ? '' : ' display: none;') + '">\ 28982 <table>\ 28983 <colgroup><col width="45%" /><col width="40%" /><col width="20%" /></colgroup>\ 28984 '; 28985 28986 if(opts.price_type == 'WEIGHT' && opts.price_type_detail.method == 'DIFFERENTIAL' && opts.price_type_detail.detail.length) { 28987 $(opts.price_type_detail.detail).each(function(k, v) { 28988 var value = Object.keys(v); 28989 var price = Object.values(v); 28990 if(k == 0) value = 0; 28991 html += '<tr><td><input type="text" class="form-control isFloat" name="weight_differential_value[]" value="' + (number_format(value)) + '" ' + (k == 0 ? ' readonly ' : '') + ' numberonly maxlength="13" /> Kg ì´ì</td><td><input type="text" class="form-control" name="weight_differential_price[]" value="' + (number_format(price)) + '" numberonly maxlength="13" />ì</td><td>' + (k > 0 ? '<span class="btn-delete-condition-row"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 13" width="12" height="13">
28991<path d="M11 2H9V0H3.02v2H1 0v1h1v8c0 1.1 0.9 2 2 2h6c1.1 0 2-0.9 2-2V3h1V2H11zM4.02 1H8v1H4.02V1zM10 11c0 0.55-0.45 1-1 1H3c-0.55 0-1-0.45-1-1V3h1.02H9h1V11z"/><rect x="4" y="4" width="1" height="7"/><rect x="7" y="4" width="1" height="7"/></svg></span>' : '') + '</td></tr>'; 28992 }); 28993 } else { 28994 html += '<tr><td><input type="text" class="form-control isFloat" name="weight_differential_value[]" value="0" readonly numberonly maxlength="13" /> Kg ì´ì</td><td><input type="text" class="form-control" name="weight_differential_price[]" numberonly maxlength="13" />ì</td><td></td></tr>'; 28995 } 28996 html += '\ 28997 </table>\ 28998 <div><button type="button" class="btn btn-weight-diff">+ ì¡°ê±´ ì¶ê°</button></div>\ 28999 </div>\ 29000 <div class="weight-repeat" style="' + (opts.price_type_detail.method == 'REPEAT' ? '' : ' display: none; ') + '">\ 29001 <div>기본 ë°°ì¡ë¹</div>\ 29002 <div class="m5t"><input type="text" class="form-control" name="weight_repeat_price" value="' + (opts.weight_repeat_price ? opts.weight_repeat_price : 0) + '" numberonly maxlength="13" />ì</div>\ 29003 <div class="m10t"><input type="text" class="form-control isFloat" name="weight_repeat_value" value="' + (opts.weight_repeat_value ? opts.weight_repeat_value : 0) + '" numberonly maxlength="13" />Kgë§ë¤ 기본 ë°°ì¡ë¹ ë°ë³µ ë¶ê³¼</div>\ 29004 </div>\ 29005 </div>\ 29006 '; 29007 if(!LUX) { 29008 html += '\ 29009 <div class="quantity-row weight-row" style="' + (opts.price_type == 'QUANTITY' || opts.price_type == 'WEIGHT' ? '' : ' display: none;') + '">\ 29010 <div class="row-sub-title m10t"><svg class="cm-popover-info" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 13" width="13" height="13" tabindex="0"><path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12.13c-3.11 0-5.63-2.53-5.63-5.63S3.39 0.87 6.5 0.87s5.63 2.53 5.63 5.63S9.61 12.13 6.5 12.13z"></path><path d="M7.44 9.58c-0.1-0.02-0.18-0.05-0.25-0.1C7.12 9.44 7.07 9.37 7.03 9.28 6.98 9.19 6.96 9.07 6.96 8.92V5h-1.7v0.4h0.03c0.11 0 0.21 0.01 0.3 0.02 0.09 0.02 0.18 0.05 0.25 0.09 0.07 0.05 0.13 0.11 0.17 0.2 0.04 0.09 0.06 0.2 0.06 0.34v2.91c0 0.14-0.02 0.25-0.06 0.34C5.97 9.39 5.91 9.45 5.84 9.5 5.77 9.54 5.68 9.57 5.59 9.58 5.49 9.6 5.39 9.6 5.29 9.6H5.16v0.4h2.71V9.6H7.75C7.64 9.6 7.54 9.6 7.44 9.58z"></path><rect x="6" y="3" width="1" height="1"></rect></svg> ì¶ê° ìíì ë°°ì¡ë¹ ì¡°ê±´ì ë°ìëì§ ììµëë¤. </div>\ 29011 </div>\ 29012 '; 29013 } 29014 html += '\ 29015 </div>\ 29016 </div>\ 29017 <div class="item-row">\ 29018 <div class="">' + $.lang[LANG]['shopping.delivery.template.additional_yn'] + '<svg class="cm-popover-info" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 13" width="13" height="13" tabindex="0" data-trigger="hover" data-toggle="popover" fill="#4789e7" data-html="true" data-placement="top" data-content="주ìì§ê° ì 주 ë° ëìì°ê° ì§ìì´ë©´ 기본 ë°°ì¡ë¹ì ì 주/ì 주 ì¸ ëìì°ê° ì§ì ë°°ì¡ë¹ê° ì¶ê°ë¡ ë¶ê³¼ë©ëë¤." data-original-title="" title=""><path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"></path><path d="M6.66 3.01C5.61 3.01 4.58 3.5 4.5 4.8c0 0.06-0.01 0.12 0 0.2h1.02c0-0.07 0.01-0.15 0.02-0.23 0.08-0.62 0.52-0.76 1.08-0.76 0.63 0 1.02 0.37 1.02 0.95 -0.01 0.48-0.3 0.87-0.76 1.34C6.21 6.97 6.02 7.37 6 8h0.99C7 7.66 7.04 7.37 7.67 6.75 8.17 6.27 8.7 5.68 8.7 4.87 8.7 3.85 7.89 3.01 6.66 3.01z"></path><rect x="6" y="9" width="1" height="1"></rect></svg></div>\ 29019 <div class="additional-yn-row"><label><input type="radio" name="additional_yn" value="N" ' + (opts.additional_yn == 'N' ? ' checked ' : '') + ' /><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18" width="18" height="18"><path d="M9 0a9 9 0 1 0 .001 18.001A9 9 0 0 0 9 0zm0 17c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"/></svg><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18" width="18" height="18"><path d="M9 0a9 9 0 1 0 .001 18.001A9 9 0 0 0 9 0zm0 17c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"/><circle cx="9" cy="9" r="6"/></svg>
29019' + $.lang[LANG]['shopping.delivery.template.additional_yn.n'] + '</label> <label><input type="radio" name="additional_yn" value="Y" ' + (opts.additional_yn == 'Y' ? ' checked ' : '') + ' /><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18" width="18" height="18"><path d="M9 0a9 9 0 1 0 .001 18.001A9 9 0 0 0 9 0zm0 17c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"/></svg><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18" width="18" height="18"><path d="M9 0a9 9 0 1 0 .001 18.001A9 9 0 0 0 9 0zm0 17c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"/><circle cx="9" cy="9" r="6"/></svg>' + $.lang[LANG]['shopping.delivery.template.additional_yn.y'] + '</label>\ 29020 <div class="additional-row m15t" style="' + (opts.additional_yn == 'Y' ? '' : ' display: none; ') + '">\ 29021 <div class="row-sub-title">ì 주</div>\ 29022 <div class="m5t"><input type="text" name="additional_jeju_price" class="form-control m5r" value="' + number_format(opts.additional_jeju_price) + '" numberonly maxlength="13" />ì</div>\ 29023 <div class="row-sub-title m15t">ì 주 ì¸ ëìì°ê°</div>\ 29024 <div class="m5t"><input type="text" name="additional_land_price" class="form-control m5r" value="' + number_format(opts.additional_land_price) + '" numberonly maxlength="13" />ì</div>\ 29025 </div>\ 29026 </div>\ 29027 </div>\ 29028 <div class="item-row">\ 29029 <div class="">' + $.lang[LANG]['shopping.delivery.template.pay_type'] + '<svg class="cm-popover-info" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 13" width="13" height="13" tabindex="0" data-trigger="hover" data-toggle="popover" fill="#4789e7" data-html="true" data-placement="top" data-content="<ul><li class=\'title\'>ë°°ì¡ë¹ ê²°ì ë°©ìì ì íí ì ììµëë¤.</li><li class=\'item\'>ì ê²°ì : ìí ê²°ì ì ë°°ì¡ë¹ë¥¼ ê°ì´ ê²°ì í©ëë¤.</li><li class=\'item\'>ì°©ë¶ : ìí ê²°ì ì ë°°ì¡ë¹ê° í¬í¨ëì§ ìê³ êµ¬ë§¤ìê° ìíì ë°ì ë ë°°ì¡ë¹ë¥¼ ë°ë¡ ê²°ì í©ëë¤.</li><li class=\'item\'>ì ê²°ì ëë ì°©ë¶ : 구매ìê° ì ê²°ì ëë ì°©ë¶ë¡ ê²°ì í ì§ ì íí ì ììµëë¤.</li></ul>" data-original-title="" title=""><path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"></path><path d="M6.66 3.01C5.61 3.01 4.58 3.5 4.5 4.8c0 0.06-0.01 0.12 0 0.2h1.02c0-0.07 0.01-0.15 0.02-0.23 0.08-0.62 0.52-0.76 1.08-0.76 0.63 0 1.02 0.37 1.02 0.95 -0.01 0.48-0.3 0.87-0.76 1.34C6.21 6.97 6.02 7.37 6 8h0.99C7 7.66 7.04 7.37 7.67 6.75 8.17 6.27 8.7 5.68 8.7 4.87 8.7 3.85 7.89 3.01 6.66 3.01z"></path><rect x="6" y="9" width="1" height="1"></rect></svg></div>\ 29030 <div class="pay-type-row"><label><input type="radio" name="pay_type" value="PREPAY" ' + (opts.pay_type == 'PREPAY' ? ' checked ' : '') + ' /><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18" width="18" height="18"><path d="M9 0a9 9 0 1 0 .001 18.001A9 9 0 0 0 9 0zm0 17c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"/></svg><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18" width="18" height="18"><path d="M9 0a9 9 0 1 0 .001 18.001A9 9 0 0 0 9 0zm0 17c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"/><circle cx="9" cy="9" r="6"/></svg>' + $.lang[LANG]['shopping.delivery.template.pay_type.prepay'] + '</label> <label><input type="radio" name="pay_type" value="DELIVERED" ' + (opts.pay_type == 'DELIVERED' ? ' checked ' : '') + ' /><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18" width="18" height="18"><path d="M9 0a9 9 0 1 0 .001 18.001A9 9 0 0 0 9 0zm0 17c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"/></svg><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18" width="18" height="18"><path d="M9 0a9 9 0 1 0 .001 18.001A9 9 0 0 0 9 0zm0 17c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"/><circle cx="9" cy="9" r="6"/></svg>
29030' + $.lang[LANG]['shopping.delivery.template.pay_type.delivered'] + '</label> <label><input type="radio" name="pay_type" value="BOTH" ' + (opts.pay_type == 'BOTH' ? ' checked ' : '') + ' /><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18" width="18" height="18"><path d="M9 0a9 9 0 1 0 .001 18.001A9 9 0 0 0 9 0zm0 17c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"/></svg><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18" width="18" height="18"><path d="M9 0a9 9 0 1 0 .001 18.001A9 9 0 0 0 9 0zm0 17c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"/><circle cx="9" cy="9" r="6"/></svg>' + $.lang[LANG]['shopping.delivery.template.pay_type.both'] + '</label></div>\ 29031 </div>\ 29032 <div class="item-row">\ 29033 <div class="">' + $.lang[LANG]['shopping.delivery.template.make_to_order_yn'] + '<svg class="cm-popover-info" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 13" width="13" height="13" tabindex="0" data-trigger="hover" data-toggle="popover" fill="#4789e7" data-html="true" data-placement="top" data-content="í매 ìíì´ ì£¼ë¬¸ ì ì í ì ìì ë¤ì´ê°ë¤ë©´, 구매ììê² ìí ì ì í ë°°ì¡ëë 기ê°ì ìë ¤ì¤ ì ììµëë¤." data-original-title="" title=""><path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"></path><path d="M6.66 3.01C5.61 3.01 4.58 3.5 4.5 4.8c0 0.06-0.01 0.12 0 0.2h1.02c0-0.07 0.01-0.15 0.02-0.23 0.08-0.62 0.52-0.76 1.08-0.76 0.63 0 1.02 0.37 1.02 0.95 -0.01 0.48-0.3 0.87-0.76 1.34C6.21 6.97 6.02 7.37 6 8h0.99C7 7.66 7.04 7.37 7.67 6.75 8.17 6.27 8.7 5.68 8.7 4.87 8.7 3.85 7.89 3.01 6.66 3.01z"></path><rect x="6" y="9" width="1" height="1"></rect></svg></div>\ 29034 <div class="make-to-order-yn-row"><label><input type="radio" name="make_to_order_yn" value="N" ' + (opts.make_to_order_yn == 'N' ? ' checked ' : '') + ' /><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18" width="18" height="18"><path d="M9 0a9 9 0 1 0 .001 18.001A9 9 0 0 0 9 0zm0 17c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"/></svg><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18" width="18" height="18"><path d="M9 0a9 9 0 1 0 .001 18.001A9 9 0 0 0 9 0zm0 17c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"/><circle cx="9" cy="9" r="6"/></svg>' + $.lang[LANG]['shopping.delivery.template.make_to_order_yn.n'] + '</label> <label><input type="radio" name="make_to_order_yn" value="Y" ' + (opts.make_to_order_yn == 'Y' ? ' checked ' : '') + ' /><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18" width="18" height="18"><path d="M9 0a9 9 0 1 0 .001 18.001A9 9 0 0 0 9 0zm0 17c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"/></svg><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18" width="18" height="18"><path d="M9 0a9 9 0 1 0 .001 18.001A9 9 0 0 0 9 0zm0 17c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"/><circle cx="9" cy="9" r="6"/></svg>' + $.lang[LANG]['shopping.delivery.template.make_to_order_yn.y'] + '</label>\ 29035 <div class="make-to-order-row" style="' + (opts.make_to_order_yn == 'Y' ? '' : ' display : none; ') + '">\ 29036 <div class="row-sub-title m15t">ë°ì¡ ìì ì¼</div>\ 29037 <div class="m5t">\ 29038 <select name="due_date" class="form-control">\ 29039 <option value="">ì í</option>\ 29040 '; 29041 29042 for(var i=2; i<=14; i++) { 29043 html += '<option value="' + i + '" ' + (opts.due_date == i ? ' selected ' : '') + '>' + i + '</option>'; 29044 } 29045 29046 html += ' </select> ì¼ ì´ë´ ë°ì¡ ìì \ 29047 </div>\ 29048 <div class="row-sub-title m10t"><svg class="cm-popover-info" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 13" width="13" height="13" tabindex="0"><path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12.13c-3.11 0-5.63-2.53-5.63-5.63S3.39 0.87 6.5 0.87s5.63 2.53 5.63 5.63S9.61 12.13 6.5 12.13z"></path><path d="M7.44 9.58c-0.1-0.02-0.18-0.05-0.25-0.1C7.12 9.44 7.07 9.37 7.03 9.28 6.98 9.19 6.96 9.07 6.9
290486 8.92V5h-1.7v0.4h0.03c0.11 0 0.21 0.01 0.3 0.02 0.09 0.02 0.18 0.05 0.25 0.09 0.07 0.05 0.13 0.11 0.17 0.2 0.04 0.09 0.06 0.2 0.06 0.34v2.91c0 0.14-0.02 0.25-0.06 0.34C5.97 9.39 5.91 9.45 5.84 9.5 5.77 9.54 5.68 9.57 5.59 9.58 5.49 9.6 5.39 9.6 5.29 9.6H5.16v0.4h2.71V9.6H7.75C7.64 9.6 7.54 9.6 7.44 9.58z"></path><rect x="6" y="3" width="1" height="1"></rect></svg>주ë§/ê³µí´ì¼ì ì ì¸í ìì ì¼ ê¸°ì¤ì¼ë¡ ì ë ¥</div>\ 29049 </div>\ 29050 </div>\ 29051 </div>\ 29052 <div class="item-row">\ 29053 <div class="">' + $.lang[LANG]['shopping.delivery.template.install_fee_yn'] + '<svg class="cm-popover-info" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 13" width="13" height="13" tabindex="0" data-trigger="hover" data-toggle="popover" fill="#4789e7" data-html="true" data-placement="top" data-content="<ul><li class=\'title\'>ìí ë°°ì¡ ì¸ì ë³ë ì¤ì¹ë¹ê° ë°ìëë¤ë©´, ì¬ì©ììê² ë³ë ì¤ì¹ë¹ê° ë°ìíë¤ê³ ìë´í ì ììµëë¤.</li><li class=\'item\'>ë³ë ì¤ì¹ë¹ì ê´í ìì¸í ë´ì©ì ìì¸ íì´ì§ì ë³ëë¡ íê¸°í´ ì£¼ì¸ì.</li><li class=\'item\'>ë³ë ì¤ì¹ë¹ ì¤ì ì ë¤ì´ë² ì¼íìë ë°ìë©ëë¤.</li></ul>" data-original-title="" title=""><path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"></path><path d="M6.66 3.01C5.61 3.01 4.58 3.5 4.5 4.8c0 0.06-0.01 0.12 0 0.2h1.02c0-0.07 0.01-0.15 0.02-0.23 0.08-0.62 0.52-0.76 1.08-0.76 0.63 0 1.02 0.37 1.02 0.95 -0.01 0.48-0.3 0.87-0.76 1.34C6.21 6.97 6.02 7.37 6 8h0.99C7 7.66 7.04 7.37 7.67 6.75 8.17 6.27 8.7 5.68 8.7 4.87 8.7 3.85 7.89 3.01 6.66 3.01z"></path><rect x="6" y="9" width="1" height="1"></rect></svg></div>\ 29054 <div class="install-fee-yn-row"><label><input type="radio" name="install_fee_yn" value="N" ' + (opts.install_fee_yn == 'N' ? ' checked ' : '') + ' /><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18" width="18" height="18"><path d="M9 0a9 9 0 1 0 .001 18.001A9 9 0 0 0 9 0zm0 17c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"/></svg><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18" width="18" height="18"><path d="M9 0a9 9 0 1 0 .001 18.001A9 9 0 0 0 9 0zm0 17c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"/><circle cx="9" cy="9" r="6"/></svg>' + $.lang[LANG]['shopping.delivery.template.install_fee_yn.n'] + '</label> <label><input type="radio" name="install_fee_yn" value="Y" ' + (opts.install_fee_yn == 'Y' ? ' checked ' : '') + ' /><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18" width="18" height="18"><path d="M9 0a9 9 0 1 0 .001 18.001A9 9 0 0 0 9 0zm0 17c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"/></svg><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18" width="18" height="18"><path d="M9 0a9 9 0 1 0 .001 18.001A9 9 0 0 0 9 0zm0 17c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"/><circle cx="9" cy="9" r="6"/></svg>' + $.lang[LANG]['shopping.delivery.template.install_fee_yn.y'] + '</label></div>\ 29055 </div>\ 29056 </form>\ 29057 </div>\ 29058 '; 29059 29060 var modal = $(this).showModalFlat($.lang[LANG]['shopping.delivery.template.title.' + (seq != '' ? 'm' : 'n')],html,true,true, function() { 29061 modal.find('.error').remove(); 29062 modal.find('.error-box').removeClass('error-box'); 29063 29064 var result = true; 29065 29066 if($.trim(modal.find('input[name="name"]').val()) == '') { 29067 modal.find('input[name="name"]').after('<div class="error name-error m5t"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 13" width="13" height="13"><path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"/><rect x="6" y="3" width="1" height="5"/><rect x="6" y="9" width="1" height="1"/></svg>í í릿 ì´ë¦ì ì ë ¥í´ ì£¼ì¸ì.</div>'); 29068 modal.find('input[name="name"]').addClass('error-box').focus(); 29069 result = false;
29070 } 29071 29072 if(checkEmojis(modal.find('input[name="name"]').val())) { 29073 modal.find('input[name="name"]').after('<div class="error name-error m5t"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 13" width="13" height="13"><path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"/><rect x="6" y="3" width="1" height="5"/><rect x="6" y="9" width="1" height="1"/></svg>ì´ëª¨ì§ë ì¬ì©í ì ììµëë¤.</div>'); 29074 modal.find('input[name="name"]').addClass('error-box').focus(); 29075 result = false; 29076 } 29077 29078 $.ajax({ 29079 url: shopping_url + '/deliveryTemplateNameCheck', 29080 type: 'post', 29081 dataType: 'json', 29082 async: false, 29083 data: { 29084 'sid' : SID, 29085 'seq' : modal.find('input[name="seq"]').val(), 29086 'name' : $.trim(modal.find('input[name="name"]').val()) 29087 }, 29088 success:function(data) { 29089 if(data.result != 'N') { 29090 modal.find('input[name="name"]').after('<div class="error name-error m5t"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 13" width="13" height="13"><path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"/><rect x="6" y="3" width="1" height="5"/><rect x="6" y="9" width="1" height="1"/></svg>ì´ë¯¸ ì¬ì© ì¤ì¸ ì´ë¦ì ëë¤.</div>'); 29091 modal.find('input[name="name"]').focus(); 29092 result = false;
29093 } 29094 } 29095 }); 29096 29097 if((modal.find('select[name="price_type"]').val() == 'FIX' || modal.find('select[name="price_type"]').val() == 'FREE_CONDITION') && (!modal.find('input[name="delivery_fee"]').val() || modal.find('input[name="delivery_fee"]').val() < 10)) { 29098 modal.find('input[name="delivery_fee"]').parent().after('<div class="error m5t"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 13" width="13" height="13"><path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"/><rect x="6" y="3" width="1" height="5"/><rect x="6" y="9" width="1" height="1"/></svg>ë°°ì¡ë¹ë¥¼ 10ì ì´ì ì ë ¥í´ ì£¼ì¸ì.</div>'); 29099 modal.find('input[name="delivery_fee"]').addClass('error-box').focus(); 29100 result = false; 29101 } 29102 29103 if(modal.find('select[name="price_type"]').val() == 'FREE_CONDITION') { 29104 if(!modal.find('input[name="free_condition"]').val() || modal.find('input[name="free_condition"]').val() < 10) { 29105 modal.find('input[name="free_condition"]').parent().after('<div class="error m5t"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 13" width="13" height="13"><path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"/><rect x="6" y="3" width="1" height="5"/><rect x="6" y="9" width="1" height="1"/></svg>ë¬´ë£ ë°°ì¡ ì¡°ê±´ ê¸ì¡ì 10ì ì´ì ì ë ¥í´ ì£¼ì¸ì.</div>'); 29106 modal.find('input[name="free_condition"]').addClass('error-box').focus();; 29107 result = false;
29108 } 29109 } else if(modal.find('select[name="price_type"] option:selected').val() == 'QUANTITY') { // ìëë³ 29110 if(modal.find('input[name="price_type_detail_method"]:checked').val() == 'DIFFERENTIAL') { // ì°¨ë± ë¶ê³¼ 29111 modal.find('input[name="quantity_differential_value[]"]:not([readonly]), input[name="quantity_differential_price[]"]').each(function() { 29112 if($(this).attr('name') == 'quantity_differential_value[]') { 29113 if($.trim($(this).val()) == '' || $(this).val() == 0) { 29114 $(this).closest('tr').after('<tr class="error m5t"><td colspan="2"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 13" width="13" height="13"><path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"/><rect x="6" y="3" width="1" height="5"/><rect x="6" y="9" width="1" height="1"/></svg>ìëì ì ë ¥í´ ì£¼ì¸ì. </td></tr>'); 29115 result = false;
29116 $(this).addClass('error-box'); 29117 } else { 29118 var val = $(this).val(); 29119 var cur_elem = this; 29120 var dup_elem = modal.find('input[name="quantity_differential_value[]"]').filter(function() { return cur_elem != this && $(this).val() == val;}); 29121 if(dup_elem.length) { 29122 dup_elem.addClass('error-box'); 29123 result = false; 29124 $(dup_elem).closest('tr').after('<tr class="error dup-value m5t"><td colspan="2"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 13" width="13" height="13"><path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"/><rect x="6" y="3" width="1" height="5"/><rect x="6" y="9" width="1" height="1"/></svg>ëì¼í ê°ì´ ì¡´ì¬í©ëë¤.</td></tr>'); 29125 } 29126 } 29127 } 29128 29129 if($(this).attr('name') == 'quantity_differential_price[]') { 29130 if($.trim($(this).val()) == '' || $.trim($(this).val()) < 10) { 29131 if(!$(this).closest('tr').next('tr.error').length) 29132 $(this).closest('tr').after('<tr class="error m5t"><td colspan="2"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 13" width="13" height="13"><path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"/><rect x="6" y="3" width="1" height="5"/><rect x="6" y="9" width="1" height="1"/></svg>ë°°ì¡ë¹ë¥¼ 10ì ì´ì ì ë ¥í´ ì£¼ì¸ì.</td></tr>') 29133 $(this).addClass('error-box'); 29134 result = false;
29135 } 29136 } 29137 }); 29138 } else if(modal.find('input[name="price_type_detail_method"]:checked').val() == 'REPEAT') { 29139 if(modal.find('input[name="quantity_repeat_value"]').val() == 0 || modal.find('input[name="quantity_repeat_value"]').val() == '') { // ë°ë³µ ë¶ê³¼ 29140 modal.find('.quantity-repeat').append('<div class="error m5t"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 13" width="13" height="13"><path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"/><rect x="6" y="3" width="1" height="5"/><rect x="6" y="9" width="1" height="1"/></svg>ìëì ì ë ¥í´ ì£¼ì¸ì.</div>'); 29141 modal.find('input[name="quantity_repeat_value"]').addClass('error-box'); 29142 modal.find('input[name="quantity_repeat_value"]').focus(); 29143 result = false; 29144 } 29145 29146 if(!modal.find('input[name="quantity_repeat_price"]').val() || modal.find('input[name="quantity_repeat_price"]').val() < 10) { 29147 modal.find('input[name="quantity_repeat_price"]').parent().after('<div class="error m5t"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 13" width="13" height="13"><path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"/><rect x="6" y="3" width="1" height="5"/><rect x="6" y="9" width="1" height="1"/></svg>ë°°ì¡ë¹ë¥¼ 10ì ì´ì ì ë ¥í´ ì£¼ì¸ì.</div>'); 29148 modal.find('input[name="quantity_repeat_price"]').addClass('error-box'); 29149 modal.find('input[name="quantity_repeat_price"]').focus(); 29150 result = false;
29151 } 29152 } 29153 } else if(modal.find('select[name="price_type"] option:selected').val() == 'WEIGHT') { // 무ê²ë³ 29154 if(modal.find('input[name="price_type_detail_method"]:checked').val() == 'DIFFERENTIAL') { // ì°¨ë± ë¶ê³¼ 29155 29156 modal.find('input[name="weight_differential_value[]"], input[name="weight_differential_price[]"]').not('[readonly]').each(function() { 29157 if($(this).attr('name') == 'weight_differential_value[]') { 29158 if($.trim($(this).val()) == '' || $.trim($(this).val()) == 0) { 29159 result = false; 29160 $(this).addClass('error-box'); 29161 $(this).focus(); 29162 $(this).closest('tr').after('<tr class="error m5t"><td colspan="2"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 13" width="13" height="13"><path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"/><rect x="6" y="3" width="1" height="5"/><rect x="6" y="9" width="1" height="1"/></svg>무ê²ë¥¼ 0 ì´ì ì ë ¥í´ ì£¼ì¸ì. </td></tr>'); 29163 29164 } else { 29165 var val = $(this).val(); 29166 var cur_elem = this; 29167 var dup_elem = modal.find('input[name="weight_differential_value[]"]').filter(function() { return cur_elem != this && $(this).val() == val;}); 29168 if(dup_elem.length) { 29169 dup_elem.addClass('error-box'); 29170 dup_elem.eq(0).focus(); 29171 result = false;
29172 $(dup_elem).closest('tr').after('<tr class="error dup-value m5t"><td colspan="2"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 13" width="13" height="13"><path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"/><rect x="6" y="3" width="1" height="5"/><rect x="6" y="9" width="1" height="1"/></svg>ëì¼í ê°ì´ ì¡´ì¬í©ëë¤.</td></tr>'); 29173 29174 } 29175 } 29176 } 29177 29178 if($(this).attr('name') == 'weight_differential_price[]') { 29179 if(!$(this).val() || $(this).val() < 10) { 29180 if(!$(this).closest('tr').next('tr.error').length) 29181 $(this).closest('tr').after('<tr class="error m5t"><td colspan="2"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 13" width="13" height="13"><path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"/><rect x="6" y="3" width="1" height="5"/><rect x="6" y="9" width="1" height="1"/></svg>ë°°ì¡ë¹ë¥¼ 10ì ì´ì ì ë ¥í´ ì£¼ì¸ì.</td></tr>') 29182 $(this).addClass('error-box'); 29183 $(this).focus(); 29184 result = false;
29185 } 29186 } 29187 }); 29188 } else if(modal.find('input[name="price_type_detail_method"]:checked').val() == 'REPEAT') { // ë°ë³µ ë¶ê³¼ 29189 if(modal.find('input[name="weight_repeat_value"]').val() == 0 || modal.find('input[name="weight_repeat_value"]').val() == '') { 29190 modal.find('.weight-repeat').append('<div class="error m5t"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 13" width="13" height="13"><path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"/><rect x="6" y="3" width="1" height="5"/><rect x="6" y="9" width="1" height="1"/></svg>무ê²ë¥¼ 0 ì´ì ì ë ¥í´ ì£¼ì¸ì.</div>'); 29191 modal.find('input[name="weight_repeat_value"]').addClass('error-box'); 29192 modal.find('input[name="weight_repeat_value"]').focus(); 29193 result = false; 29194 } 29195 29196 if(!modal.find('input[name="weight_repeat_price"]').val() || modal.find('input[name="weight_repeat_price"]').val() < 10) { 29197 modal.find('input[name="weight_repeat_price"]').parent().after('<div class="error m5t"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 13" width="13" height="13"><path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"/><rect x="6" y="3" width="1" height="5"/><rect x="6" y="9" width="1" height="1"/></svg>ë°°ì¡ë¹ë¥¼ 10ì ì´ì ì ë ¥í´ ì£¼ì¸ì.</div>'); 29198 modal.find('input[name="weight_repeat_price"]').addClass('error-box'); 29199 modal.find('input[name="weight_repeat_price"]').focus(); 29200 result = false;
29201 } 29202 } 29203 } 29204 29205 if(modal.find('input[name="additional_yn"]:checked').val() == 'Y') { 29206 modal.find('input[name="additional_jeju_price"]').parent().next('.error').remove(); 29207 if($.trim(modal.find('input[name="additional_jeju_price"]').val()) == '' || $.trim(modal.find('input[name="additional_jeju_price"]').val()) < 10) { 29208 modal.find('input[name="additional_jeju_price"]').parent().after('<div class="error m5t"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 13" width="13" height="13"><path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"/><rect x="6" y="3" width="1" height="5"/><rect x="6" y="9" width="1" height="1"/></svg>ë°°ì¡ë¹ë¥¼ 10ì ì´ì ì ë ¥í´ ì£¼ì¸ì.</div>'); 29209 modal.find('input[name="additional_jeju_price"]').addClass('error-box'); 29210 result = false; 29211 } 29212 29213 modal.find('input[name="additional_land_price"]').parent().next('.error').remove(); 29214 if($.trim(modal.find('input[name="additional_land_price"]').val()) == '' || $.trim(modal.find('input[name="additional_jeju_price"]').val()) < 10) { 29215 modal.find('input[name="additional_land_price"]').parent().after('<div class="error m5t"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 13" width="13" height="13"><path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"/><rect x="6" y="3" width="1" height="5"/><rect x="6" y="9" width="1" height="1"/></svg>ë°°ì¡ë¹ë¥¼ 10ì ì´ì ì ë ¥í´ ì£¼ì¸ì.</div>'); 29216 modal.find('input[name="additional_land_price"]').addClass('error-box'); 29217 result = false;
29218 } 29219 } 29220 29221 if(modal.find('input[name="make_to_order_yn"]:checked').val() == 'Y' && modal.find('select[name="due_date"]').val() == '') { 29222 modal.find('select[name="due_date"]').parent().parent().append('<div class="error due-date-error m5t"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 13" width="13" height="13"><path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"/><rect x="6" y="3" width="1" height="5"/><rect x="6" y="9" width="1" height="1"/></svg>ë°ì¡ ìì ì¼ì ì íí´ ì£¼ì¸ì.</div>'); 29223 modal.find('.make-to-order-row button').addClass('error-box'); 29224 result = false; 29225 } 29226 29227 if(!result) return false; 29228 29229 $.processON(); 29230 setTimeout(function() { 29231 $.ajax({ 29232 url: shopping_url + '/insertDeliveryTemplate', 29233 type:'post', 29234 dataType:'json', 29235 async:false, 29236 data: $('#deliveryTemplateForm').serialize(), 29237 success:function(data) { 29238 29239 }, 29240 complete: function() { 29241 $.processOFF(); 29242 if(typeof callback_func == 'function') callback_func(); 29243 } 29244 }); 29245 }); 29246 29247 modal.modal('hide'); 29248 }, 'cancel','save','cl-cmmodal cover delivery-template-modal cl-s-btn w620 cl-p80', true, '', function() { 29249 modal.find('#deliveryTemplateForm input[name="name"]').on('blur', function() { 29250 modal.find('.name-error').remove(); 29251 $(this).removeClass('error-box'); 29252 29253 if($.trim($(this).val()) == '') { 29254 $(this).addClass('error-box'); 29255 modal.find('input[name="name"]').after('<div class="error name-error m5t"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 13" width="13" height="13"><path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"/><rect x="6" y="3" width="1" height="5"/><rect x="6" y="9" width="1" height="1"/></svg>í í릿 ì´ë¦ì ì ë ¥í´ ì£¼ì¸ì.</div>'); 29256 return; 29257 } 29258 29259 if(checkEmojis($(this).val())) { 29260 $(this).addClass('error-box'); 29261 modal.find('input[name="name"]').after('<div class="error name-error m5t"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 13" width="13" height="13"><path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"/><rect x="6" y="3" width="1" height="5"/><rect x="6" y="9" width="1" height="1"/></svg>ì´ëª¨ì§ë ì¬ì©í ì ììµëë¤.</div>'); 29262 return false; 29263 } 29264 29265 $.ajax({ 29266 url: shopping_url + '/deliveryTemplateNameCheck', 29267 type: 'post', 29268 dataType: 'json', 29269 data: { 29270 'sid' : SID, 29271 'seq' : modal.find('input[name="seq"]').val(), 29272 'name' : $.trim($(this).val()) 29273 }, 29274 success:function(data) { 29275 if(data.result != 'N') { 29276 $(this).addClass('error-box'); 29277 modal.find('input[name="name"]').after('<div class="error name-error m5t"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 13" width="13" height="13"><path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"/><rect x="6" y="3" width="1" height="5"/><rect x="6" y="9" width="1" height="1"/></svg>ì´ë¯¸ ì¬ì© ì¤ì¸ ì´ë¦ì ëë¤.</div>'); 29278 } else { 29279 modal.find('.name-error').remove(); 29280 modal.find('#deliveryTemplateForm input[name="name"]').removeClass('error-box'); 29281 } 29282 } 29283 }); 29284 }).on('input', function() { 29285 var regexp = /^[ã±-ã ã -ã £ê°-í£a-zA-Z0-9\(\)\[\]\_\- ]+$/; 29286 if(!regexp.test($.trim($(this).val()))) { 29287 $(this).val($.trim($(this).val()).replace(/[^ã±-ã ã -ã £ê°-í£a-zA-Z0-9\(\)\[\]\_\- ]/gi, '')); 29288 } 29289 }); 29290 29291 modal.find('input[name="mix_yn"]').on('change', function() { 29292 if($('input[name="mix_yn"]:checked').val() == 'Y') { 29293 modal.find('.mix-price-type-row').show(); 29294 } else { 29295 modal.find('.mix-price-type-row').hide(); 29296 } 29297 }); 29298 29299 modal.find('select[name="price_type"]').on('change', function() { 29300 if($(this).find('option:selected').val() == 'QUANTITY') { 29301 modal.find('input[name="price_type_detail_method"]:first').prop('checked', true).change(); 29302 modal.find('.weight-row').hide(); 29303 modal.find('.fix-row').hide(); 29304 modal.find('.free-condition-row').hide(); 29305 modal.find('.quantity-row').show(); 29306 } else if($(this).find('option:selected').val() == 'WEIGHT') { 29307 modal.find('input[name="price_type_detail_method"]:first').prop('checked', true).change(); 29308 modal.find('.quantity-row').hide(); 29309 modal.find('.fix-row').hide(); 29310 modal.find('.free-condition-row').hide(); 29311 modal.find('.weight-row').show(); 29312 } else if($(this).find('option:selected').val() == 'FIX') { 29313 modal.find('.quantity-row').hide(); 29314 modal.find('.weight-row').hide(); 29315 modal.find('.free-condition-row').hide(); 29316 modal.find('.fix-row').show(); 29317 } else if($(this).find('option:selected').val() == 'FREE_CONDITION') { 29318 modal.find('.quantity-row').hide(); 29319 modal.find('.weight-row').hide(); 29320 modal.find('.fix-row').hide(); 29321 modal.find('.free-condition-row').show(); 29322 } else { 29323 modal.find('.fix-row').hide(); 29324 modal.find('.quantity-row').hide(); 29325 modal.find('.weight-row').hide(); 29326 modal.find('.free-condition-row').hide(); 29327 } 29328 }); 29329 29330 modal.find('.btn-quantity-diff').on('click', function() { 29331 var html = '<tr><td><input type="text" class="form-control" name="quantity_differential_value[]" numberonly /> ê° ì´ì</td><td><input type="text" class="form-control" name="quantity_differential_price[]" numberonly /> ì</td><td>
29331<span class="btn-delete-condition-row"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 13" width="12" height="13"><path d="M11 2H9V0H3.02v2H1 0v1h1v8c0 1.1 0.9 2 2 2h6c1.1 0 2-0.9 2-2V3h1V2H11zM4.02 1H8v1H4.02V1zM10 11c0 0.55-0.45 1-1 1H3c-0.55 0-1-0.45-1-1V3h1.02H9h1V11z"/><rect x="4" y="4" width="1" height="7"/><rect x="7" y="4" width="1" height="7"/></svg></span></td></tr>'; 29332 modal.find('.quantity-differential table').append(html); 29333 }); 29334 29335 modal.find('.btn-weight-diff').on('click', function() { 29336 var html = '<tr><td><input type="text" class="form-control isFloat" name="weight_differential_value[]" numberonly> Kg ì´ì</td><td><input type="text" class="form-control" name="weight_differential_price[]" numberonly /> ì</td><td><span class="btn-delete-condition-row"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 13" width="12" height="13"><path d="M11 2H9V0H3.02v2H1 0v1h1v8c0 1.1 0.9 2 2 2h6c1.1 0 2-0.9 2-2V3h1V2H11zM4.02 1H8v1H4.02V1zM10 11c0 0.55-0.45 1-1 1H3c-0.55 0-1-0.45-1-1V3h1.02H9h1V11z"/><rect x="4" y="4" width="1" height="7"/><rect x="7" y="4" width="1" height="7"/></svg></span></td></tr>'; 29337 modal.find('.weight-differential table').append(html); 29338 }); 29339 29340 modal.find('input[name="delivery_type[]"]').on('change', function() { 29341 if(modal.find('input[name="delivery_type[]"][value="DELIVERY"]:checked').length) { 29342 modal.find('.delivery-company-row').show(); 29343 } else { 29344 modal.find('.delivery-company-row').hide(); 29345 } 29346 29347 modal.find('select[name="price_type"]').prop('disabled', false); 29348 29349 // modal.find('input[name="additional_yn"]').prop('disabled', false); 29350 modal.find('.additional-yn-row').removeClass('disabled-area'); 29351 29352 // modal.find('input[name="pay_type"]').prop('disabled', false); 29353 modal.find('.pay-type-row').removeClass('disabled-area'); 29354 29355 if(modal.find('input[name="delivery_type[]"]:checked').length == 1 && modal.find('input[name="delivery_type[]"]:checked').val() == 'VISIT') { 29356 modal.find('select[name="price_type"]').val('FREE').change().prop('disabled', true); 29357 modal.find('input[name="delivery_fee"]').val(0); 29358 modal.find('input[name="additional_yn"][value="N"]').prop('checked', true).change(); 29359 // modal.find('input[name="additional_yn"]').prop('disabled', true); 29360 modal.find('.additional-yn-row').addClass('disabled-area'); 29361 modal.find('input[name="pay_type"][value="PREPAY"]').prop('checked', true).change(); 29362 // modal.find('input[name="pay_type"]').prop('disabled', true); 29363 modal.find('.pay-type-row').addClass('disabled-area'); 29364 } else if(modal.find('input[name="delivery_type[]"]:checked').length == 1 && modal.find('input[name="delivery_type[]"]:checked').val() == 'QUICK') { 29365 modal.find('select[name="price_type"]').val('ETC').change().prop('disabled', true); 29366 modal.find('input[name="additional_yn"][value="N"]').prop('checked', true).change(); 29367 // modal.find('input[name="additional_yn"]').prop('disabled', true); 29368 modal.find('.additional-yn-row').addClass('disabled-area'); 29369 modal.find('input[name="pay_type"][value="DELIVERED"]').prop('checked', true).change(); 29370 modal.find('input[name="pay_type"]').prop('disabled', true); 29371 modal.find('.pay-type-row').addClass('disabled-area'); 29372 } else if(modal.find('input[name="delivery_type[]"][value="DELIVERY"]:checked').length == 0 && modal.find('input[name="delivery_type[]"][value="DIRECT"]:checked').length == 0) { 29373 modal.find('select[name="price_type"]').val('ETC').prop('disabled', true).change(); 29374 modal.find('input[name="additional_yn"][value="N"]').prop('checked', true).change() 29375 // modal.find('input[name="additional_yn"]').prop('disabled', true); 29376 modal.find('.additional-yn-row').removeClass('disabled-area'); 29377 modal.find('input[name="pay_type"][value="DELIVERED"]').prop('checked', true).change(); 29378 // modal.find('input[name="pay_type"]').prop('disabled', true); 29379 modal.find('.pay-type-row').addClass('disabled-area'); 29380 } 29381 modal.find('select[name="price_type"]').selectpicker('refresh'); 29382 }); 29383 29384 modal.on('input', 'input[numberonly]', function(){ 29385 var max_num = 1000000000; //10ìµ 29386 if(Number($(this).val().replace(/,/g, '')) > max_num) { 29387 $(this).val(number_format(max_num)); 29388 } 29389 }); 29390 29391 modal.on('input', 'input[name="weight_repeat_value"], input[name="weight_differential_value[]"]', function(){ 29392 var max_num = 100; 29393 29394 var val = $(this).val().replace(/,/g, ''); 29395 if(val.indexOf('.') > -1 && val.indexOf('.') < val.length-4) { 29396 val = Number((Math.floor(Number(val) * 1000) / 1000).toFixed(3)); 29397 } 29398 29399 if(Number(val) > max_num) { 29400 val = max_num; 29401 } 29402 $(this).val(number_format(val)); 29403 }); 29404 29405 modal.find('input[name="price_type_detail_method"]').on('change', function() { 29406 if(modal.find('select[name="price_type"] option:selected').val() == 'QUANTITY') { 29407 if(modal.find('input[name="price_type_detail_method"]:checked').val() == 'DIFFERENTIAL') { 29408 $('.quantity-differential').show(); 29409 $('.quantity-repeat').hide(); 29410 } else if(modal.find('input[name="price_type_detail_method"]:checked').val() == 'REPEAT') { 29411 $('.quantity-repeat').show(); 29412 $('.quantity-differential').hide(); 29413 } 29414 } else if(modal.find('select[name="price_type"] option:selected').val() == 'WEIGHT') { 29415 if(modal.find('input[name="price_type_detail_method"]:checked').val() == 'DIFFERENTIAL') { 29416 $('.weight-differential').show(); 29417 $('.weight-repeat').hide(); 29418 } else if(modal.find('input[name="price_type_detail_method"]:checked').val() == 'REPEAT') { 29419 $('.weight-repeat').show(); 29420 $('.weight-differential').hide(); 29421 } 29422 } 29423 }); 29424 29425 modal.find('input[name="delivery_fee"]').on('blur', function() { 29426 $(this).removeClass('error-box'); 29427 $(this).parent().next('.error').remove(); 29428 if($.trim($(this).val()) == '' || $(this).val() < 10) { 29429 $(this).addClass('error-box'); 29430 modal.find('input[name="delivery_fee"]').parent().after('<div class="error m5t"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 13" width="13" height="13">
29430<path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"/><rect x="6" y="3" width="1" height="5"/><rect x="6" y="9" width="1" height="1"/></svg>ë°°ì¡ë¹ë¥¼ 10ì ì´ì ì ë ¥í´ ì£¼ì¸ì.</div>'); 29431 } 29432 }); 29433 29434 modal.find('input[name="additional_yn"]').on('change', function() { 29435 if(modal.find('input[name="additional_yn"]:checked').val() == 'Y') { 29436 modal.find('.additional-row').show(); 29437 } else { 29438 modal.find('.additional-row').hide(); 29439 } 29440 }); 29441 29442 modal.find('input[name="free_condition_yn"]').on('change', function() { 29443 if(modal.find('input[name="free_condition_yn"]:checked').val() == 'Y') { 29444 modal.find('.free-condition-row').show(); 29445 } else { 29446 modal.find('.free-condition-row').hide(); 29447 } 29448 }); 29449 29450 modal.find('input[name="free_condition"]').on('blur', function() { 29451 $(this).removeClass('error-box'); 29452 $(this).parent().next('.error').remove(); 29453 if($.trim($(this).val()) == '' || $(this).val() < 10) { 29454 $(this).addClass('error-box'); 29455 $(this).parent().after('<div class="error m5t"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 13" width="13" height="13"><path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"/><rect x="6" y="3" width="1" height="5"/><rect x="6" y="9" width="1" height="1"/></svg>ë¬´ë£ ë°°ì¡ ì¡°ê±´ ê¸ì¡ì 10ì ì´ì ì ë ¥í´ ì£¼ì¸ì.</div>'); 29456 } 29457 }); 29458 29459 modal.find('input[name="make_to_order_yn"]').on('change', function() { 29460 if(modal.find('input[name="make_to_order_yn"]:checked').val() == 'Y') { 29461 modal.find('.make-to-order-row').show(); 29462 } else { 29463 modal.find('.make-to-order-row').hide(); 29464 } 29465 }); 29466 29467 modal.on('blur', 'input[name="quantity_repeat_price"], input[name="weight_repeat_price"], input[name="additional_jeju_price"], input[name="additional_land_price"]', function() { 29468 $(this).removeClass('error-box'); 29469 $(this).parent().next('.error').remove(); 29470 if($.trim($(this).val()) == '' || $.trim($(this).val()) < 10) { 29471 $(this).parent().after('<div class="error m5t"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 13" width="13" height="13"><path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"/><rect x="6" y="3" width="1" height="5"/><rect x="6" y="9" width="1" height="1"/></svg>ë°°ì¡ë¹ë¥¼ 10ì ì´ì ì ë ¥í´ ì£¼ì¸ì.</div>'); 29472 $(this).addClass('error-box'); 29473 } 29474 }) 29475 29476 modal.on('blur', 'input[name="quantity_repeat_value"]', function() { 29477 $(this).removeClass('error-box'); 29478 $(this).parent().next('.error').remove(); 29479 if($.trim($(this).val()) == '' || $.trim($(this).val()) == 0) { 29480 $(this).parent().after('<div class="error m5t"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 13" width="13" height="13"><path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"/><rect x="6" y="3" width="1" height="5"/><rect x="6" y="9" width="1" height="1"/></svg>ìëì ì ë ¥í´ ì£¼ì¸ì.</div>'); 29481 $(this).addClass('error-box'); 29482 } 29483 }); 29484 29485 modal.on('blur', 'input[name="weight_repeat_value"]', function() { 29486 $(this).removeClass('error-box'); 29487 $(this).parent().next('.error').remove(); 29488 if($.trim($(this).val()) == '' || $.trim($(this).val()) == 0) { 29489 $(this).parent().after('<div class="error m5t"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 13" width="13" height="13">
29489<path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"/><rect x="6" y="3" width="1" height="5"/><rect x="6" y="9" width="1" height="1"/></svg>무ê²ë¥¼ 0 ì´ì ì ë ¥í´ ì£¼ì¸ì.</div>'); 29490 $(this).addClass('error-box'); 29491 } 29492 }); 29493 29494 modal.on('blur', 'input[name="quantity_differential_value[]"]', function() { 29495 $(this).removeClass('error-box'); 29496 $(this).closest('tr').next('tr.error').remove(); 29497 if($.trim($(this).val()) == '' || $(this).val() == 0) { 29498 $(this).closest('tr').after('<tr class="error m5t"><td colspan="2"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 13" width="13" height="13"><path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"/><rect x="6" y="3" width="1" height="5"/><rect x="6" y="9" width="1" height="1"/></svg>ìëì ì ë ¥í´ ì£¼ì¸ì.</td></tr>') 29499 $(this).addClass('error-box'); 29500 return false; 29501 } 29502 modal.find('input[name="quantity_differential_value[]"]').removeClass('error-box'); 29503 modal.find('.error.dup-value').remove(); 29504 modal.find('input[name="quantity_differential_value[]"]').each(function() { 29505 var val = $(this).val(); 29506 var cur_elem = this; 29507 var dup_elem = modal.find('input[name="quantity_differential_value[]"]').filter(function() { return cur_elem != this && $(this).val() == val;}); 29508 if(dup_elem.length) { 29509 dup_elem.addClass('error-box'); 29510 $(dup_elem).closest('tr').after('<tr class="error dup-value m5t"><td colspan="2"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 13" width="13" height="13"><path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"/><rect x="6" y="3" width="1" height="5"/><rect x="6" y="9" width="1" height="1"/></svg>ëì¼í ê°ì´ ì¡´ì¬í©ëë¤.</td></tr>'); 29511 return false; 29512 } 29513 }); 29514 }); 29515 29516 modal.on('blur', 'input[name="weight_differential_value[]"]', function() { 29517 $(this).removeClass('error-box'); 29518 $(this).closest('tr').next('tr.error').remove(); 29519 if(!$('input[name="weight_differential_value[]"]').is('[readonly]') && ($.trim($(this).val()) == '' || $(this).val() == 0)) { 29520 $(this).closest('tr').after('<tr class="error m5t"><td colspan="2"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 13" width="13" height="13"><path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"/><rect x="6" y="3" width="1" height="5"/><rect x="6" y="9" width="1" height="1"/></svg>무ê²ë¥¼ 0 ì´ì ì ë ¥í´ ì£¼ì¸ì.</td></tr>') 29521 $(this).addClass('error-box'); 29522 return false; 29523 } 29524 modal.find('input[name="weight_differential_value[]"]').removeClass('error-box'); 29525 modal.find('.error.dup-value').remove(); 29526 modal.find('input[name="weight_differential_value[]"]').each(function() { 29527 var val = $(this).val(); 29528 var cur_elem = this; 29529 var dup_elem = modal.find('input[name="weight_differential_value[]"]').filter(function() { return cur_elem != this && $(this).val() == val;}); 29530 if(dup_elem.length) { 29531 dup_elem.addClass('error-box'); 29532 $(dup_elem).closest('tr').after('<tr class="error dup-value m5t"><td colspan="2"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 13" width="13" height="13"><path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"/><rect x="6" y="3" width="1" height="5"/><rect x="6" y="9" width="1" height="1"/></svg>ëì¼í ê°ì´ ì¡´ì¬í©ëë¤.</td></tr>'); 29533 return false;
29534 } 29535 }); 29536 }); 29537 29538 modal.on('blur', 'input[name="quantity_differential_price[]"], input[name="weight_differential_price[]"]', function() { 29539 $(this).removeClass('error-box'); 29540 $(this).closest('tr').next('tr.error').remove(); 29541 if($.trim($(this).val()) == '' || $(this).val() < 10) { 29542 $(this).closest('tr').after('<tr class="error m5t"><td colspan="2"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 13" width="13" height="13"><path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"/><rect x="6" y="3" width="1" height="5"/><rect x="6" y="9" width="1" height="1"/></svg>ë°°ì¡ë¹ë¥¼ 10ì ì´ì ì ë ¥í´ ì£¼ì¸ì.</td></tr>') 29543 $(this).addClass('error-box'); 29544 } 29545 }); 29546 29547 modal.on('change', 'select[name="due_date"]', function() { 29548 modal.find('select[name="due_date"]').parent().parent().find('.due-date-error').remove(); 29549 modal.find('.make-to-order-row button').removeClass('error-box'); 29550 if($(this).val() == '') { 29551 modal.find('select[name="due_date"]').parent().parent().append('<div class="error due-date-error m5t"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 13" width="13" height="13"><path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"/><rect x="6" y="3" width="1" height="5"/><rect x="6" y="9" width="1" height="1"/></svg>
29551ë°ì¡ ìì ì¼ì ì íí´ ì£¼ì¸ì.</div>'); 29552 modal.find('.make-to-order-row button').addClass('error-box'); 29553 } 29554 }); 29555 29556 modal.on('click', '.btn-delete-condition-row', function() { 29557 var btn = this; 29558 var modal = $(this).showModalFlat('ë°°ì¡ë¹ ì¡°ê±´ êµ¬ê° ìì ', 'ì íí ë°°ì¡ë¹ ì¡°ê±´ 구ê°ì ìì íìê² ìµëê¹?', true, true, function() { 29559 $(btn).closest('tr').remove(); 29560 modal.modal('hide'); 29561 }, 'cancel', 'ok', 'cl-cmmodal cl-s-btn w560 cl-p130'); 29562 var backdrop_z_index = Number(modal.css('zIndex')); 29563 modal.css('zIndex', backdrop_z_index + 1); 29564 modal.parent().next('.modal-backdrop').css('zIndex', backdrop_z_index); 29565 }); 29566 29567 modal.find('[data-toggle="popover"]').popover(); 29568 29569 modal.find('select').selectpicker(); 29570 29571 modal.find('.delivery-company-row').find('.tracking-delivery-icon').replaceWith('<svg data-toggle="popover" data-content="ë°°ì¡ ì¶ì ê°ë¥" data-trigger="hover" data-placement="top" data-html="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path d="m11.6 17.72-.98.61v-5.37l5.2-3.25v.76c.39-.08.79-.13 1.2-.13V8.62c0-.01-.01-.02-.01-.03 0-.06-.02-.12-.04-.17a.625.625 0 0 0-.23-.3l-6.4-4a.614.614 0 0 0-.64 0l-6.4 4c-.11.07-.18.18-.23.3-.02.05-.03.11-.04.17 0 .01-.01.02-.01.03v6.8c0 .21.11.4.28.51l6.4 4a.62.62 0 0 0 .64 0l1.75-1.1c-.2-.34-.36-.71-.49-1.11zM10.02 5.33l2.11 1.32-5.28 3.3-2.1-1.32 5.27-3.3zm-.6 13.01-5.2-3.25V9.72l5.2 3.25v5.37zm.6-6.41-2.04-1.27 5.28-3.3 2.04 1.27-5.28 3.3z"/><path d="m22.85 21-2.61-2.61c.49-.66.79-1.48.79-2.36 0-2.21-1.79-4-4-4s-4 1.79-4 4 1.79 4 4 4c.89 0 1.7-.3 2.36-.79L22 21.85c.12.12.27.18.42.18s.31-.06.42-.18a.6.6 0 0 0 .01-.85zm-8.63-4.98c0-1.54 1.26-2.8 2.8-2.8s2.8 1.26 2.8 2.8c0 .77-.31 1.46-.81 1.97 0 0-.01 0-.01.01s0 .01-.01.01a2.799 2.799 0 0 1-4.77-1.99z"/></svg>'); 29572 modal.find('.delivery-company-row').find('[data-toggle="popover"]').popover(); 29573 modal.find('select[name="delivery_company"]').on('shown.bs.select changed.bs.select', function(select_event, dropdown_event) { 29574 modal.find('.delivery-company-row').find('.tracking-delivery-icon').replaceWith('<svg data-toggle="popover" data-content="ë°°ì¡ ì¶ì ê°ë¥" data-trigger="hover" data-placement="top" data-html="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path d="m11.6 17.72-.98.61v-5.37l5.2-3.25v.76c.39-.08.79-.13 1.2-.13V8.62c0-.01-.01-.02-.01-.03 0-.06-.02-.12-.04-.17a.625.625 0 0 0-.23-.3l-6.4-4a.614.614 0 0 0-.64 0l-6.4 4c-.11.07-.18.18-.23.3-.02.05-.03.11-.04.17 0 .01-.01.02-.01.03v6.8c0 .21.11.4.28.51l6.4 4a.62.62 0 0 0 .64 0l1.75-1.1c-.2-.34-.36-.71-.49-1.11zM10.02 5.33l2.11 1.32-5.28 3.3-2.1-1.32 5.27-3.3zm-.6 13.01-5.2-3.25V9.72l5.2 3.25v5.37zm.6-6.41-2.04-1.27 5.28-3.3 2.04 1.27-5.28 3.3z"/><path d="m22.85 21-2.61-2.61c.49-.66.79-1.48.79-2.36 0-2.21-1.79-4-4-4s-4 1.79-4 4 1.79 4 4 4c.89 0 1.7-.3 2.36-.79L22 21.85c.12.12.27.18.42.18s.31-.06.42-.18a.6.6 0 0 0 .01-.85zm-8.63-4.98c0-1.54 1.26-2.8 2.8-2.8s2.8 1.26 2.8 2.8c0 .77-.31 1.46-.81 1.97 0 0-.01 0-.01.01s0 .01-.01.01a2.799 2.799 0 0 1-4.77-1.99z"/></svg>'); 29575 modal.find('.delivery-company-row').find('[data-toggle="popover"]').popover(); 29576 // if(select_event.type == 'shown') { 29577 // var select = select_event.target; 29578 // var dropdown = dropdown_event.target; 29579 // var selected_text = $(select).find('option:selected').text(); 29580 // // console.log(dropdown); 29581 // var target = $(dropdown).find('li').filter(function() { return $(this).find('span.text').text() == selected_text}); 29582 // var pos = $(target).offset().top; 29583 // $(dropdown).find('.inner').scrollTop($(dropdown).find('.inner').scrollTop() + pos); 29584 // } 29585 }); 29586 29587 }); 29588} 29589 29590function convertDateString(input) { 29591 const regex = /(\d{4})ë (\d{2})ì (\d{2})ì¼ (ì¤ì |ì¤í) (\d{2}):(\d{2})/; 29592 const match = input.match(regex); 29593 if (!match) return ""; 29594 29595 let [_, year, month, day, period, hour, minute] = match; 29596 return `${year}-${month}-${day} ${hour}:${minute}`; 29597} 29598 29599// var calendarDateTimePicker = function(id, type, se, fulltime) { 29600// console.log('id: ' + id +', type: ' + type + ', se: ' + se + ', fulltime: ' + fulltime); 29601// // if(typeof id === undefined || !id) { 29602// // return false;
29603// // } 29604// var sid = (typeof property != 'undefined') ? property.SID : SID; 29605// var blocklang = LANG; 29606// var field_setting = {}; 29607// var etcDateState = 'N'; 29608 29609// //ê¸°ë³¸ê° 29610// $default_term = { 29611// 'select_terms' : 'N', 29612// 'start_date' : '', 29613// 'end_date' : '', 29614// 'date_week' : 'A', 29615// 'days' : 'sun|mon|tue|wed|thu|fri|sat', 29616// }; 29617// $default_excludeDate = {'date' : ''}; 29618// $default_time = { 29619// 'interval' : '30', 29620// 'am' : '0000|0030|0100|0130|0200|0230|0300|0330|0400|0430|0500|0530|0600|0630|0700|0730|0800|0830|0900|0930|1000|1030|1100|1130', 29621// 'pm' : '1200|1230|1300|1330|1400|1430|1500|1530|1600|1630|1700|1730|1800|1830|1900|1930|2000|2030|2100|2130|2200|2230|2300|2330' 29622// }; 29623// $default_color = {'highlight' : '4789e7'}; 29624 29625// field_setting = { 29626// 'term' : $default_term, 29627// 'excludeDate' : $default_excludeDate, 29628// 'time' : $default_time, 29629// 'color' : $default_color, 29630// }; 29631 29632// var term = (field_setting.term)? field_setting.term:{}; 29633// var excludeDate = (field_setting.excludeDate)? field_setting.excludeDate:{}; 29634// var time = (type != 'date' && field_setting.time)? field_setting.time:{}; 29635// var color = (field_setting.color)? field_setting.color:{}; 29636 29637// var startDate = (term.start_date !== undefined)? term.start_date:''; 29638// var endDate = (term.end_date !== undefined)? term.end_date:''; 29639// var dateWeek = (term.date_week !== undefined)? term.date_week:''; 29640// var days = (term.days !== undefined)? term.days.split('|'):[]; 29641// var daysObj = { 29642// 'sun': 0, 29643// 'mon': 1, 29644// 'tue': 2, 29645// 'wed': 3, 29646// 'thu': 4, 29647// 'fri': 5, 29648// 'sat': 6, 29649// } 29650 29651// //excludeDate 29652// var exceptDate = (excludeDate.date !== undefined)? excludeDate.date.split(','):[]; 29653 29654// //time 29655// var interval = (time.interval!==undefined)? time.interval:'30'; 29656// var am = (time.am!==undefined && time.am)? time.am.split('|'):[]; 29657// var pm = (time.pm!==undefined && time.pm)? time.pm.split('|'):[]; 29658 29659// var disabled = null; 29660// if(term.select_terms == 'Y') { 29661// if(dateWeek == 'W') { 29662// disabled = [0, 6]; 29663// } else if(dateWeek == 'K') { 29664// disabled = [1, 2, 3, 4, 5]; 29665// } 29666// if(days.length > 0) { 29667// disabled = [0, 1, 2, 3, 4, 5, 6]; 29668// $.each(days, function(i, v){ 29669// enableIdx = disabled.indexOf(daysObj[v]); 29670// if(enableIdx > -1) { 29671// disabled.splice(enableIdx, 1); 29672// } 29673// }); 29674// } 29675// } 29676// var modal_title = (!fulltime) ? $.lang[blocklang]['config.form.date2.select'] : $.lang[blocklang]['config.form.date.select']; 29677// var modal_str = '\ 29678// <div class="term-calendar-box form-calendar-box" data-type="'+type+'">\ 29679// <input type="hidden" id="select-calendar" value="term-datepicker">\ 29680// <input type="hidden" id="etc-start-date-txt" value="'+startDate+'">\ 29681// <input type="hidden" id="etc-end-date-txt" value="'+endDate+'">\ 29682// <input type="hidden" id="etc-date-week" value="'+dateWeek+'">\ 29683// <input type="hidden" id="etc-except-date" value="'+exceptDate+'">\ 29684// <input type="hidden" id="select-date-ymd">\ 29685// <div id="form-date2-datepicker-'+id+'"></div>\ 29686// </div>'; 29687// if(!fulltime) { 29688// modal_str+='\ 29689// <div class="setting-row">\ 29690// <div class="setting-label am">'+$.lang[blocklang]['config.form.date2.time.am']+'</div>\ 29691// <div class="display-flex time-interval" data-time="am"></div>\ 29692// </div>\ 29693// <div class="setting-row">\ 29694// <div class="setting-label pm">'+$.lang[blocklang]['config.form.date2.time.pm']+'</div>\ 29695// <div class="display-flex time-interval" data-time="pm"></div>\ 29696// </div>'; 29697// } 29698 29699// if($('#etc-status').val() == 'P') { 29700// modal_str+='\ 29701// <div class="term-setting hide" data-blocklang="'+blocklang+'">\
29702// <span class="start-date"></span> ~ <span class="end-date"></span><span class="time"></span>\ 29703// </div>'; 29704// } else { 29705// modal_str+='\ 29706// <div class="term-setting hide" data-blocklang="'+blocklang+'"></div>'; 29707// } 29708 29709 29710// var modal_class = 'modal-dialog cl-cmmodal cl-s-btn form-date2 cl-close-btn cover'; 29711// var etcText = ''; 29712// var dateTimeModal = $(this).showModalFlat(modal_title, modal_str, true, true, function () { //confirm 29713// var datePick = $('.term-setting').text(); 29714// if(!fulltime) { 29715// if(datePick == '') { 29716// alert('ë ì§ì ìê°ì ì íí´ ì£¼ì¸ì'); 29717// return false; 29718// } else { 29719// $('.userEL'+id).find('.calendar-modal-body .modal-field.'+se+' input').val(convertDateString(datePick)); 29720// } 29721// } else { 29722// var d = $('#select-date-ymd').val(); 29723// if(d == '') { 29724// alert('ë ì§ë¥¼ ì íí´ ì£¼ì¸ì'); 29725// return false; 29726// } 29727// var dp = d.replaceAll('.', '-'); 29728// $('.userEL'+id).find('.calendar-modal-body .modal-field.'+se+' input').val(dp); 29729// } 29730 29731// var $body = $('.userEL'+id).find('.calendar-modal-body'); 29732// var sVal = $body.find('.modal-field.sdate input').val() || ''; 29733// var eVal = $body.find('.modal-field.edate input').val() || ''; 29734// var pass = 'N'; 29735 29736// var rx = /^\d{4}-\d{2}-\d{2}( \d{2}:\d{2})?$/; 29737 29738// var sOk = rx.test(sVal), eOk = rx.test(eVal); 29739// if (sOk && eOk) { 29740// var sStr = (sVal.length === 10) ? (sVal + ' 00:00') : sVal; 29741// var eStr = (eVal.length === 10) ? (eVal + ' 00:00') : eVal; 29742// var sDate = new Date(sStr.replace(' ', 'T')); 29743// var eDate = new Date(eStr.replace(' ', 'T')); 29744 29745// if (isFinite(sDate) && isFinite(eDate) && sDate <= eDate) { 29746// pass = 'Y'; 29747// } 29748// } 29749 29750// $body.find('.pass').val(pass).trigger('change'); 29751 29752// dateTimeModal.modal('hide'); 29753// },$.lang[blocklang]['config.cancel'],$.lang[blocklang]['config.ok'], modal_class, true, '', function() { //show 29754// var currentYear = new Date().getFullYear(); 29755// var termPicker = new Datepickk({ 29756// container: document.querySelector('#form-date2-datepicker-'+id), 29757// inline:true, 29758// today:true, 29759// range: ((type == 'etc-product-date' || type == 'etc-product-datetime') && $('#etc-status').val() == 'P')? true : false, 29760// disabledDays: disabled, 29761// lang: blocklang, 29762// minDate: new Date(1900, 0, 1), 29763// maxDate: new Date(currentYear + 15, 11, 31), 29764// }); 29765 29766// if(type.indexOf('etc-product-date') > -1) { 29767// startDate = $('#etc-min-date').val(); 29768// endDate = $('#etc-max-date').val(); 29769// } 29770 29771// if(exceptDate) { 29772// var disabledDateArr = new Array(); 29773// $.each(exceptDate, function(idx, item){ 29774// item = item.replace(/\./g,'/'); //date for firefox 29775// disabledDateArr.push(new Date(item)); 29776// }); 29777// termPicker.disabledDates = disabledDateArr; 29778// } 29779 29780// if(startDate && endDate) { 29781// var checkStartDate = startDate.split('.'); 29782// var checkEndDate = endDate.split('.'); 29783// termPicker.minDate = new Date(checkStartDate[0], (checkStartDate[1] * 1) - 1, checkStartDate[2]); 29784// termPicker.maxDate = new Date(checkEndDate[0], (checkEndDate[1] * 1) - 1, checkEndDate[2]); 29785// } 29786 29787// $(document).off('click', '.d-year, .d-month'); 29788// $(document).on('click', '.d-year, .d-month', function(){ 29789// $('.d-month-year-picker').toggleClass('d-show'); 29790// scrollToCurrentYearMonth(); 29791// }); 29792 29793// $('#datetime-style-'+id).remove(); 29794// var highlight = '#'+color.highlight; 29795// var h_rgba = hexToRgba(highlight); 29796// var rgba_str = h_rgba.r+','+h_rgba.g+','+h_rgba.b; 29797// var style = '\ 29798// <style id="datetime-style-'+id+'">\
29799// .form-date2 .Datepickk .d-table input:not(:disabled):not(:checked) + label:hover:before{border: 1px solid '+highlight+'; background-color: transparent;}\ 29800// .form-date2 .Datepickk .d-table input:not(:disabled) + label:hover:before{border: 1px solid '+highlight+'; background-color: transparent;}\ 29801// .form-date2 .Datepickk .d-table input:checked + label:before, .form-date2 .Datepickk .d-table input:checked + label:hover:before {background-color: '+highlight+'; border: 1px solid '+highlight+';}\ 29802// .form-date2 .time-interval input:checked + label {color: '+highlight+'; border: 1px solid '+highlight+';}\ 29803// .form-date2 .time-interval label{background-color: rgba('+rgba_str+', 0.05); border: 1px solid rgba('+rgba_str+', 0.1);}\ 29804// .form-date2 .term-setting{background-color: rgba('+rgba_str+', 0.05);}\ 29805// </style>\ 29806// '; 29807// $('.cl-cmmodal.form-date2').append(style); 29808 29809// dateTimeModal.find('.time-interval').each(function(i, v){ 29810// var mna = $(v).data('time'); 29811// var times = ''; 29812 29813// if(mna === 'am') { 29814// for(let t = 0; t <= 11; t++) { 29815// let hstr = t.toString().padStart(2, '0'); 29816// times += '\ 29817// <input type="checkbox" id="'+mna+'-'+t+'-00" class="o-time hide" name="'+mna+'" value="'+mna+' '+hstr+':00" data-setting_time="'+hstr+'00">\ 29818// <label for="'+mna+'-'+t+'-00" class="o-time">'+hstr+':00</label>\ 29819// <input type="checkbox" id="'+mna+'-'+t+'-30" class="ten-time half-time hide" name="'+mna+'" value="'+mna+' '+hstr+':30" data-setting_time="'+hstr+'30">\ 29820// <label for="'+mna+'-'+t+'-30" class="ten-time half-time">'+hstr+':30</label>\ 29821// '; 29822// } 29823// } 29824 29825// if(mna === 'pm') { 29826// for(let t = 12; t <= 23; t++) { 29827// let hstr = t.toString(); 29828// times += '\ 29829// <input type="checkbox" id="'+mna+'-'+t+'-00" class="o-time hide" name="'+mna+'" value="'+mna+' '+hstr+':00" data-setting_time="'+hstr+'00">\ 29830// <label for="'+mna+'-'+t+'-00" class="o-time">'+hstr+':00</label>\ 29831// <input type="checkbox" id="'+mna+'-'+t+'-30" class="ten-time half-time hide" name="'+mna+'" value="'+mna+' '+hstr+':30" data-setting_time="'+hstr+'30">\ 29832// <label for="'+mna+'-'+t+'-30" class="ten-time half-time">'+hstr+':30</label>\ 29833// '; 29834// } 29835// } 29836 29837// $(v).html(times); 29838// }); 29839 29840// dateTimeModal.find('.time-interval input').prop('disabled', true); 29841 29842// if(am.length > 0) { 29843// $.each(am, function(i, v){ 29844// dateTimeModal.find('.time-interval[data-time="am"] input[data-setting_time="'+v+'"]').prop('disabled', false); 29845// }); 29846// } 29847 29848// if(pm.length > 0) { 29849// $.each(pm, function(i, v){ 29850// dateTimeModal.find('.time-interval[data-time="pm"] input[data-setting_time="'+v+'"]').prop('disabled', false); 29851// }); 29852// } 29853 29854// dateTimeModal.find('.time-interval label:not(.o-time)').addClass('hide'); 29855 29856// switch (interval) { 29857// case '10': 29858// dateTimeModal.find('.time-interval label').removeClass('hide'); 29859// break; 29860// case '20': 29861// dateTimeModal.find('.time-interval label.twt-time').removeClass('hide'); 29862// break; 29863// case '30': 29864// dateTimeModal.find('.time-interval label.half-time').removeClass('hide'); 29865// break; 29866// } 29867 29868// let $enableTimes = dateTimeModal.find('.time-interval[data-time] input:not(:disabled) + label').not('.hide'); 29869// let $enableTimesAM = dateTimeModal.find('.time-interval[data-time="am"] input:not(:disabled) + label').not('.hide'); 29870// let $enableTimesPM = dateTimeModal.find('.time-interval[data-time="pm"] input:not(:disabled) + label').not('.hide'); 29871 29872// $enableTimes.first().prevAll('label').addClass('hide');
29873// $enableTimes.last().nextAll('label').addClass('hide'); 29874 29875// if($enableTimesAM.length == 0) { 29876// $('.setting-label.am').addClass('hide'); 29877// $('.time-interval[data-time="am"]').addClass('hide'); 29878// } 29879// if($enableTimesPM.length == 0) { 29880// $('.setting-label.pm').addClass('hide'); 29881// $('.time-interval[data-time="pm"]').addClass('hide'); 29882// } 29883 29884// dateTimeModal.find('.time-interval input').on('change', function(){ 29885// $('.time-interval input').prop('checked', false); 29886// $(this).prop('checked', true); 29887 29888// if(type == 'etc-product-datetime') { 29889// if($('#etc-status').val() == 'P') { 29890// if(!$('#etc-start-date-txt').val() || !$('#etc-end-date-txt').val()) return false; 29891// } else { 29892// if(!$('#etc-start-date-txt').val()) return false; 29893// } 29894// } 29895 29896// getDateTimeStr(blocklang); 29897// }); 29898 29899// if(type.indexOf('etc-product-date') > -1 && $('#etc-start-date-option').val()) { //etc product 29900// if($('#etc-status').val() == 'P') { //ê¸°ê° 29901// document.querySelector('#etc-start-date-txt').value = document.querySelector('#etc-start-date-option').value; 29902// document.querySelector('#etc-end-date-txt').value = document.querySelector('#etc-end-date').value; 29903// document.querySelector('#select-date-ymd').value = document.querySelector('#etc-start-date-option').value + '|' + document.querySelector('#etc-end-date').value 29904// termPicker.startDate = $('#etc-start-date-option').val(); 29905// termPicker.endDate = $('#etc-end-date').val(); 29906// } else { 29907// document.querySelector('#etc-start-date-txt').value = document.querySelector('#etc-start-date-option').value; 29908// document.querySelector('#select-date-ymd').value = document.querySelector('#etc-start-date-option').value; 29909// var sDate = $('#etc-start-date-option').val(); 29910// var sDateObj = new Date(sDate); 29911// termPicker.selectDate(sDateObj); 29912// } 29913 29914// if($('#etc-time').val()) { 29915// var sTime = $('#etc-time').val(); 29916// $('.time-interval input[value="'+sTime+'"]').prop('checked', true); 29917// } 29918 29919// setTimeout(function(){ 29920// getDateTimeStr('ko') 29921// }, 500); 29922// } 29923// }); 29924// } 29925 29926var formDateTimePicker = function(id, type) { 29927 if(typeof id === undefined || !id) { 29928 return false; 29929 } 29930 var sid = (typeof property != 'undefined') ? property.SID : SID; 29931 var blocklang = ($('[form-seq="'+id+'"]').closest('.element').attr('data-blocklang'))? $('[form-seq="'+id+'"]').closest('.element').attr('data-blocklang'):LANG; 29932 var field_setting = {}; 29933 var etcDateState = 'N'; 29934 29935 if(type == 'etc-product-date' || type == 'etc-product-datetime') { 29936 blocklang = LANG; 29937 etcDateState = $('#etc-state').val(); 29938 field_setting.term = JSON.parse($('#etc-term-setting').val()); 29939 field_setting.excludeDate = {'date': $('#etc-exclude-date').val()}; 29940 if(type == 'etc-product-datetime') field_setting.time = JSON.parse($('#etc-time-setting').val()); 29941 } else { 29942 $.ajax({ 29943 url: '/template/forms/field_config', 29944 dataType: 'json', 29945 type: 'POST', 29946 data: { sid: sid, id : id }, 29947 async: false, 29948 cache: false, 29949 success: function(data) { 29950 checkError(data); 29951 field_setting = data; 29952 } 29953 }); 29954 } 29955 29956 var term = (field_setting.term)? field_setting.term:{}; 29957 var excludeDate = (field_setting.excludeDate)? field_setting.excludeDate:{}; 29958 var time = (type != 'date' && field_setting.time)? field_setting.time:{}; 29959 var color = (field_setting.color)? field_setting.color:{}; 29960 29961 var startDate = (term.start_date !== undefined)? term.start_date:''; 29962 var endDate = (term.end_date !== undefined)? term.end_date:''; 29963 var dateWeek = (term.date_week !== undefined)? term.date_week:''; 29964 var days = (term.days !== undefined)? term.days.split('|'):[]; 29965 var daysObj = { 29966 'sun': 0, 29967 'mon': 1, 29968 'tue': 2, 29969 'wed': 3, 29970 'thu': 4, 29971 'fri': 5,
29972 'sat': 6, 29973 } 29974 29975 //excludeDate 29976 var exceptDate = (excludeDate.date !== undefined)? excludeDate.date.split(','):[]; 29977 29978 //time 29979 if(type == 'date2' || type == 'etc-product-datetime') { 29980 var interval = (time.interval!==undefined)? time.interval:'30'; 29981 var am = (time.am!==undefined && time.am)? time.am.split('|'):[]; 29982 var pm = (time.pm!==undefined && time.pm)? time.pm.split('|'):[]; 29983 } 29984 29985 var disabled = null; 29986 if(term.select_terms == 'Y') { 29987 if(dateWeek == 'W') { 29988 disabled = [0, 6]; 29989 } else if(dateWeek == 'K') { 29990 disabled = [1, 2, 3, 4, 5]; 29991 } 29992 if(days.length > 0) { 29993 disabled = [0, 1, 2, 3, 4, 5, 6]; 29994 $.each(days, function(i, v){ 29995 enableIdx = disabled.indexOf(daysObj[v]); 29996 if(enableIdx > -1) { 29997 disabled.splice(enableIdx, 1); 29998 } 29999 }); 30000 } 30001 } 30002 var modal_title = (type == 'date2' || type == 'etc-product-datetime')? $.lang[blocklang]['config.form.date2.select'] : $.lang[blocklang]['config.form.date.select']; 30003 var modal_str = '\ 30004 <div class="term-calendar-box form-calendar-box" data-type="'+type+'">\ 30005 <input type="hidden" id="select-calendar" value="term-datepicker">\ 30006 <input type="hidden" id="etc-start-date-txt" value="'+startDate+'">\ 30007 <input type="hidden" id="etc-end-date-txt" value="'+endDate+'">\ 30008 <input type="hidden" id="etc-date-week" value="'+dateWeek+'">\ 30009 <input type="hidden" id="etc-except-date" value="'+exceptDate+'">\ 30010 <input type="hidden" id="select-date-ymd">\ 30011 <div id="form-date2-datepicker-'+id+'"></div>\ 30012 </div>'; 30013 if(type == 'etc-product-date' || type == 'etc-product-datetime') { 30014 modal_str = '\ 30015 <div class="term-calendar-box form-calendar-box" data-type="'+type+'">\ 30016 <input type="hidden" id="select-calendar" value="term-datepicker">\ 30017 <input type="hidden" id="etc-start-date-txt" value="">\ 30018 <input type="hidden" id="etc-end-date-txt" value="">\ 30019 <input type="hidden" id="etc-date-week" value="'+dateWeek+'">\ 30020 <input type="hidden" id="etc-except-date" value="'+exceptDate+'">\ 30021 <input type="hidden" id="select-date-ymd">\ 30022 <div id="form-date2-datepicker-'+id+'"></div>\ 30023 </div>'; 30024 } 30025 if(type == 'date2' || type == 'etc-product-datetime') { 30026 modal_str+='\ 30027 <div class="setting-row">\ 30028 <div class="setting-label am">'+$.lang[blocklang]['config.form.date2.time.am']+'</div>\ 30029 <div class="display-flex time-interval" data-time="am"></div>\ 30030 </div>\ 30031 <div class="setting-row">\ 30032 <div class="setting-label pm">'+$.lang[blocklang]['config.form.date2.time.pm']+'</div>\ 30033 <div class="display-flex time-interval" data-time="pm"></div>\ 30034 </div>'; 30035 30036 } 30037 if($('#etc-status').val() == 'P') { 30038 modal_str+='\ 30039 <div class="term-setting hide" data-blocklang="'+blocklang+'">\ 30040 <span class="start-date"></span> ~ <span class="end-date"></span><span class="time"></span>\ 30041 </div>'; 30042 } else { 30043 modal_str+='\ 30044 <div class="term-setting hide" data-blocklang="'+blocklang+'"></div>'; 30045 } 30046 30047 30048 var modal_class = 'modal-dialog cl-cmmodal cl-s-btn form-date2
30048cl-close-btn cover'; 30049 if(type == 'etc-product-date' || type == 'etc-product-datetime') modal_class = 'modal-dialog cl-cmmodal cl-s-btn form-date2 etc-product-date cl-close-btn cover'; 30050 var etcText = ''; 30051 var dateTimeModal = $(this).showModalFlat(modal_title, modal_str, true, true, function () { //confirm 30052 //input value 30053 var $formDateYmd = $('[form-seq="'+id+'"] .date-ymd'); 30054 var isFranchiseBar = ($formDateYmd.closest('[data-type="contact"][data-type2="franchise bar"]').length > 0); 30055 $formDateYmd.attr('data-select_date', $('#select-date-ymd').val()); 30056 var dateVal = ($('#select-date-ymd').val() && $('.term-setting').text())? true : false; 30057 switch(type) { 30058 case 'date2': 30059 if(dateVal) { 30060 $formDateYmd.attr('data-select_time', $('.time-interval input:checked').attr('id')); 30061 $formDateYmd.val($('.term-setting').text()); 30062 if(isFranchiseBar) { 30063 $formDateYmd.removeAttr('style'); 30064 } else { 30065 $formDateYmd.css('width', '240px'); 30066 } 30067 } else { 30068 alert($.lang[blocklang]['config.form.date2.notSelected']); 30069 return false; 30070 } 30071 break; 30072 case 'etc-product-date': 30073 if(dateVal) { 30074 if($('#etc-status').val() == 'P') { 30075 var selectedDate = $('#select-date-ymd').val().split('|'); 30076 30077 $('.option-body #etc-start-date-option').val(selectedDate[0]); 30078 $('.modal-cart-option-change #etc-start-date-option').val(selectedDate[0]); 30079 $('input[name="change_option_start_date"]').val(selectedDate[0]); 30080 30081 $('.option-body #etc-end-date').val(selectedDate[1]); 30082 $('.modal-cart-option-change #etc-end-date').val(selectedDate[1]); 30083 $('input[name="change_option_end_date"]').val(selectedDate[1]); 30084 30085 etcText = selectedDate[0] + ' - ' + selectedDate[1]; 30086 } else { 30087 var selectedDate = $('#select-date-ymd').val(); 30088 $('.option-body #etc-start-date-option').val(selectedDate); 30089 $('.modal-cart-option-change #etc-start-date-option').val(selectedDate); 30090 $('input[name="change_option_start_date"]').val(selectedDate); 30091 etcText = selectedDate; 30092 } 30093 30094 $('#etc-date-text').text(etcText); 30095 console.log(etcText); 30096 } else { 30097 alert('ë ì§ë¥¼ ì íí´ ì£¼ì¸ì.'); 30098 return false; 30099 } 30100 break; 30101 case 'etc-product-datetime': 30102 if(!dateTimeModal.find('.time-interval input:checked').val() || !dateVal) { 30103 alert('ë ì§ì ìê°ì ì íí´ ì£¼ì¸ì.'); 30104 return false; 30105 } 30106 if(dateVal) { 30107 $('.option-body #etc-time').val($('.time-interval input:checked').val()); 30108 $('.modal-cart-option-change #etc-time').val($('.time-interval input:checked').val()); 30109 if($('#etc-status').val() == 'P') { 30110 var selectedDate = $('#select-date-ymd').val().split('|'); 30111 30112 $('.option-body #etc-start-date-option').val(selectedDate[0]); 30113 $('.modal-cart-option-change #etc-start-date-option').val(selectedDate[0]); 30114 $('input[name="change_option_start_date"]').val(selectedDate[0]); 30115 30116 $('.option-body #etc-end-date').val(selectedDate[1]); 30117 $('.modal-cart-option-change #etc-end-date').val(selectedDate[1]); 30118 $('input[name="change_option_end_date"]').val(selectedDate[1]); 30119 30120 etcText = selectedDate[0] + ' - ' + selectedDate[1]; 30121 } else { 30122 var selectedDate = $('#select-date-ymd').val(); 30123 $('.option-body #etc-start-date-option').val(selectedDate); 30124 $('.modal-cart-option-change #etc-start-date-option').val(selectedDate); 30125 $('input[name="change_option_start_date"]').val(selectedDate); 30126 etcText = selectedDate; 30127 } 30128 30129 if($('#etc-time').val()) { 30130 var etcTime = $('#etc-time').val().split(' '); 30131 if(etcTime[0] == 'am') { 30132 etcText += (' ì¤ì ' + etcTime[1]); 30133 } else { 30134 etcText += (' ì¤í ' + etcTime[1]); 30135 } 30136 } 30137 30138 $('#etc-date-text').text(etcText); 30139 } 30140 break; 30141 default: 30142 if(dateVal) { 30143 $formDateYmd.val($('.term-setting').text()); 30144 } else { 30145 alert($.lang[blocklang]['config.form.date.notSelected']); 30146 return false;
30147 } 30148 break; 30149 } 30150 30151 if(type == 'etc-product-date' || type == 'etc-product-datetime') { 30152 if ($('.cl-s-normal-option-selector').length <= 0) { 30153 var quantity = $('#product-quantity').val(); 30154 var price = $('#product_c_price').val(); 30155 var option = document.createElement('div'); 30156 console.log(etcText + '||0||' + quantity); 30157 $(option).attr('data-val', etcText + '||0||' + quantity); 30158 productOptionPick(option, price, 'etc_none_option'); 30159 } 30160 } 30161 30162 //old 30163 if($('[form-seq="'+id+'"] .date-yyyy').length > 0) { 30164 var selectedDate = $('#select-date-ymd').val(); 30165 var dateArr = selectedDate.split('.'); 30166 $('[form-seq="'+id+'"] .date-yyyy').val(dateArr[0]); 30167 $('[form-seq="'+id+'"] .date-mm').val(dateArr[1]); 30168 $('[form-seq="'+id+'"] .date-dd').val(dateArr[2]); 30169 30170 if($('[form-seq="'+id+'"] .date-hh').length > 0) { 30171 var checkedTime = $('.time-interval input:checked').val(); 30172 var timeArr = checkedTime.replace(/am |pm /g, '').split(':'); 30173 var hh = timeArr[0]; 30174 var ii = timeArr[1]; 30175 30176 if(checkedTime.indexOf('pm') > -1) { 30177 hh = (timeArr[0] == '12')? timeArr[0] : Number(timeArr[0])+12; 30178 } 30179 30180 $('[form-seq="'+id+'"] .date-hh').val(hh); 30181 $('[form-seq="'+id+'"] .date-ii').val(ii); 30182 } 30183 } 30184 dateTimeModal.modal('hide'); 30185 },$.lang[blocklang]['config.cancel'],$.lang[blocklang]['config.ok'], modal_class, true, '', function() { //show 30186 var currentYear = new Date().getFullYear(); 30187 var termPicker = new Datepickk({ 30188 container: document.querySelector('#form-date2-datepicker-'+id), 30189 inline:true, 30190 today:true, 30191 range: ((type == 'etc-product-date' || type == 'etc-product-datetime') && $('#etc-status').val() == 'P')? true : false, 30192 disabledDays: disabled, 30193 lang: blocklang, 30194 minDate: new Date(1900, 0, 1), 30195 maxDate: new Date(currentYear + 15, 11, 31), 30196 }); 30197 30198 if(type.indexOf('etc-product-date') > -1) { 30199 startDate = $('#etc-min-date').val(); 30200 endDate = $('#etc-max-date').val(); 30201 } 30202 30203 if(exceptDate) { 30204 var disabledDateArr = new Array(); 30205 $.each(exceptDate, function(idx, item){ 30206 item = item.replace(/\./g,'/'); //date for firefox 30207 disabledDateArr.push(new Date(item)); 30208 }); 30209 termPicker.disabledDates = disabledDateArr; 30210 } 30211 30212 if(startDate && endDate) { 30213 var checkStartDate = startDate.split('.'); 30214 var checkEndDate = endDate.split('.'); 30215 termPicker.minDate = new Date(checkStartDate[0], (checkStartDate[1] * 1) - 1, checkStartDate[2]); 30216 termPicker.maxDate = new Date(checkEndDate[0], (checkEndDate[1] * 1) - 1, checkEndDate[2]); 30217 } 30218 30219 $(document).off('click', '.d-year, .d-month'); 30220 $(document).on('click', '.d-year, .d-month', function(){ 30221 $('.d-month-year-picker').toggleClass('d-show'); 30222 scrollToCurrentYearMonth(); 30223 }); 30224 30225 if((type=='date'||type=='date2') && color) { 30226 $('#datetime-style-'+id).remove(); 30227 var highlight = '#'+color.highlight; 30228 var h_rgba = hexToRgba(highlight); 30229 var rgba_str = h_rgba.r+','+h_rgba.g+','+h_rgba.b; 30230 var style = '\ 30231 <style id="datetime-style-'+id+'">\ 30232 .form-date2 .Datepickk .d-table input:not(:disabled):not(:checked) + label:hover:before{border: 1px solid '+highlight+'; background-color: transparent;}\ 30233 .form-date2 .Datepickk .d-table input:not(:disabled) + label:hover:before{border: 1px solid '+highlight+'; background-color: transparent;}\ 30234 .form-date2 .Datepickk .d-table input:checked + label:before, .form-date2 .Datepickk .d-table input:checked + label:hover:before {background-color: '+highlight+'; border: 1px solid '+highlight+';}\ 30235 .form-date2 .time-interval input:checked + label {color: '+highlight+'; border: 1px solid '+highlight+';}\ 30236 .form-date2 .time-interval label{background-color: rgba('+rgba_
30236str+', 0.05); border: 1px solid rgba('+rgba_str+', 0.1);}\ 30237 .form-date2 .term-setting{background-color: rgba('+rgba_str+', 0.05);}\ 30238 </style>\ 30239 '; 30240 $('.cl-cmmodal.form-date2').append(style); 30241 } 30242 if(type == 'date2' || type == 'etc-product-datetime') { 30243 dateTimeModal.find('.time-interval').each(function(i, v){ 30244 var mna = $(v).data('time'); 30245 var times = '\ 30246 <input type="checkbox" id="'+mna+'-12-00" class="o-time hide" name="'+mna+'" value="'+mna+' 12:00" data-setting_time="1200">\ 30247 <label for="'+mna+'-12-00" class="o-time">12:00</label>\ 30248 <input type="checkbox" id="'+mna+'-12-10" class="ten-time hide" name="'+mna+'" value="'+mna+' 12:10" data-setting_time="1210">\ 30249 <label for="'+mna+'-12-10" class="ten-time">12:10</label>\ 30250 <input type="checkbox" id="'+mna+'-12-20" class="ten-time twt-time hide" name="'+mna+'" value="'+mna+' 12:20" data-setting_time="1220">\ 30251 <label for="'+mna+'-12-20" class="ten-time twt-time">12:20</label>\ 30252 <input type="checkbox" id="'+mna+'-12-30" class="ten-time half-time hide" name="'+mna+'" value="'+mna+' 12:30" data-setting_time="1230">\ 30253 <label for="'+mna+'-12-30" class="ten-time half-time">12:30</label>\ 30254 <input type="checkbox" id="'+mna+'-12-40" class="ten-time twt-time hide" name="'+mna+'" value="'+mna+' 12:40" data-setting_time="1240">\ 30255 <label for="'+mna+'-12-40" class="ten-time twt-time">12:40</label>\ 30256 <input type="checkbox" id="'+mna+'-12-50" class="ten-time hide" name="'+mna+'" value="'+mna+' 12:50" data-setting_time="1250">\ 30257 <label for="'+mna+'-12-50" class="ten-time">12:50</label>\ 30258 \ 30259 '; 30260 for(let t = 1; t <= 11; t++) { 30261 let hstr = t.toString().padStart(2, '0'); 30262 times += '\ 30263 <input type="checkbox" id="'+mna+'-'+t+'-00" class="o-time hide" name="'+mna+'" value="'+mna+' '+hstr+':00" data-setting_time="'+hstr+'00">\ 30264 <label for="'+mna+'-'+t+'-00" class="o-time">'+t+':00</label>\ 30265 <input type="checkbox" id="'+mna+'-'+t+'-10" class="ten-time hide" name="'+mna+'" value="'+mna+' '+hstr+':10" data-setting_time="'+hstr+'10">\ 30266 <label for="'+mna+'-'+t+'-10" class="ten-time">'+t+':10</label>\ 30267 <input type="checkbox" id="'+mna+'-'+t+'-20" class="ten-time twt-time hide" name="'+mna+'" value="'+mna+' '+hstr+':20" data-setting_time="'+hstr+'20">\ 30268 <label for="'+mna+'-'+t+'-20" class="ten-time twt-time">'+t+':20</label>\ 30269 <input type="checkbox" id="'+mna+'-'+t+'-30" class="ten-time half-time hide" name="'+mna+'" value="'+mna+' '+hstr+':30" data-setting_time="'+hstr+'30">\ 30270 <label for="'+mna+'-'+t+'-30" class="ten-time half-time">'+t+':30</label>\ 30271 <input type="checkbox" id="'+mna+'-'+t+'-40" class="ten-time twt-time hide" name="'+mna+'" value="'+mna+' '+hstr+':40" data-setting_time="'+hstr+'40">\ 30272 <label for="'+mna+'-'+t+'-40" class="ten-time twt-time">'+t+':40</label>\ 30273 <input type="checkbox" id="'+mna+'-'+t+'-50" class="ten-time hide" name="'+mna+'" value="'+mna+' '+hstr+':50" data-setting_time="'+hstr+'50">\ 30274 <label for="'+mna+'-'+t+'-50" class="ten-time">'+t+':50</label>\ 30275 '; 30276 } 30277 // times += '\ 30278 // <input type="checkbox" id="'+mna+'-1-00" class="hide" name="'+mna+'" value="'+mna+' 01:00" data-setting_time="0100">\ 30279 // <label for="'+mna+'-1-00">1:00</label>\ 30280 // <input type="checkbox" id="'+mna+'-1-30" class="half-time hide" name="'+mna+'" value="'+mna+' 01:30" data-setting_time="0130">\ 30281 // <label for="'+mna+'-1-30" class="half-time">1:30</label>\ 30282 // \ 30283 // <input type="checkbox" id="'+mna+'-2-00" class="hide" name="'+mna+'" value="'+mna+' 02:00" data-setting_time="0200">\ 30284 // <label for="'+mna+'-2-00">2:00</label>\ 30285 // <input type="checkbox" id="'+mna+'-2-30" class="half-time hide" name="'+mna+'" value="'+mna+' 02:30" data-setting_time="0230">\ 30286 // <label for="'+mna+'-2-30" class="half-time">2:30</label>\ 30287 // \ 30288 // <input type="checkbox" id="'+mna+'-3-00" class="hide" name="'+mna+'" value="'+mna+' 03:00" data-setting_time="0300">\ 30289 // <label for="'+mna+'-3-00">3:00</label>\ 30290 // <input type="checkbox" id="'+mna+'-3-30" class="half-time hide" name="'+mna+'" value="'+mna+' 03:30" data-setting_time="0330">\ 30291 // <label for="'+mna+'-3-30" class="half-time">3:30</label>\ 30292 // \ 30293 // <input type="checkbox" id="'+mna+'-4-00" class="hide" name="'+mna+'" value="'+mna+' 04:00" data-setting_time="0400">\ 30294 // <label for="'+mna+'-4-00">4:00</label>\ 30295 // <input type="checkbox" id="'+mna+'-4-30" class="half-time hide" name="'+mna+'" value="'+mna+' 04:30" data-setting_time="0430">\ 30296 // <label for="'+mna+'-4-30" class="half-time">4:30</label>\ 30297 // \ 30298 // <input type="checkbox" id="'+mna+'-5-00" class="hide" name="'+mna+'" value="'+mna+' 05:00" data-setting_time="0500">\ 30299 // <label for="'+mna+'-5-00">5:00</label>\ 30300 // <input type="checkbox" id="'+mna+'-5-30" class="half-time hide" name="'+mna+'" value="'+mna+' 05:30" data-setting_time="0530">\ 30301 // <label for="'+mna+'-5-30" class="half-time">5:30</label>\ 30302 // \ 30303 // <input type="checkbox" id="'+mna+'-6-00" class="hide" name="'+mna+'" value="'+mna+' 06:00" data-setting_time="0600">\ 30304 // <label for="'+mna+'-6-00">6:00</label>\ 30305 // <input type="checkbox" id="'+mna+'-6-30" class="half-time hide" name="'+mna+'" value="'+mna+' 06:30" data-setting_time="0630">\ 30306 // <label for="'+mna+'-6-30" class="half-time">6:30</label>\ 30307 // \ 30308 // <input type="checkbox" id="'+mna+'-7-00" class="hide" name="'+mna+'" value="'+mna+' 07:00" data-setting_time="0700">\ 30309 // <label for="'+mna+'-7-00">7:00</label>\ 30310 // <input type="checkbox" id="'+mna+'-7-30" class="half-time hide" name="'+mna+'" value="'+mna+' 07:30" data-setting_time="0730">\ 30311 // <label for="'+mna+'-7-30" class="half-time">7:30</label>\ 30312 // \ 30313 // <input type="checkbox" id="'+mna+'-8-00" class="hide" name="'+mna+'" value="'+mna+' 08:00" data-setting_time="0800">\ 30314 // <label for="'+mna+'-8-00">8:00</label>\ 30315 // <input type="checkbox" id="'+mna+'-8-30" class="half-time hide" name="'+mna+'" value="'+mna+' 08:30" data-setting_time="0830">\ 30316 // <label for="'+mna+'-8-30" class="half-time">8:30</label>\ 30317 // \ 30318 // <input type="checkbox" id="'+mna+'-9-00" class="hide" name="'+mna+'" value="'+mna+' 09:00" data-setting_time="0900">\ 30319 // <label for="'+mna+'-9-00">9:00</label>\ 30320 // <input type="checkbox" id="'+mna+'-9-30" class="half-time hide" name="'+mna+'" value="'+mna+' 09:30" data-setting_time="0930">\ 30321 // <label for="'+mna+'-9-30" class="half-time">9:30</label>\ 30322 // \ 30323 // <input type="checkbox" id="'+mna+'-10-00" class="hide" name="'+mna+'" value="'+mna+' 10:00" data-setting_time="1000">\ 30324 // <label for="'+mna+'-10-00">10:00</label>\ 30325 // <input type="checkbox" id="'+mna+'-10-30" class="half-time hide" name="'+mna+'" value="'+mna+' 10:30" data-setting_time="1030">\ 30326 // <label for="'+mna+'-10-30" class="half-time">10:30</label>\ 30327 // \ 30328 // <input type="checkbox" id="'+mna+'-11-00" class="hide" name="'+mna+'" value="'+mna+' 11:00" data-setting_time="1100">\ 30329 // <label for="'+mna+'-11-00">11:00</label>\ 30330 // <input type="checkbox" id="'+mna+'-11-30" class="half-time hide" name="'+mna+'" value="'+mna+' 11:30" data-setting_time="1130">\ 30331 // <label for="'+mna+'-11-30" class="half-time">11:30</label>\ 30332 // '; 30333 $(v).html(times); 30334 }); //end each 30335 30336 dateTimeModal.find('.time-interval input').prop('disabled', true); 30337 30338 if(am.length > 0) { 30339 $.each(am, function(i, v){ 30340 dateTimeModal.find('.time-interval[data-time="am"] input[data-setting_time="'+v+'"]').prop('disabled', false); 30341 }); 30342 } 30343 30344 if(pm.length > 0) { 30345 $.each(pm, function(i, v){ 30346 dateTimeModal.find('.time-interval[data-time="pm"] input[data-setting_time="'+v+'"]').prop('disabled', false); 30347 }); 30348 } 30349 30350 dateTimeModal.find('.time-interval label:not(.o-time)').addClass('hide'); 30351 console.log('interval', interval); 30352 switch (interval) { 30353 case '10': 30354 dateTimeModal.find('.time-interval label').removeClass('hide'); 30355 break; 30356 case '20': 30357 dateTimeModal.find('.time-interval label.twt-time').removeClass('hide'); 30358 break; 30359 case '30': 30360 dateTimeModal.find('.time-interval label.half-time').removeClass('hide'); 30361 break; 30362 } 30363 30364 let $enableTimes = dateTimeModal.find('.time-interval[data-time] input:not(:disabled) + label').not('.hide'); 30365 let $enableTimesAM = dateTimeModal.find('.time-interval[data-time="am"] input:not(:disabled) + label').not('.hide'); 30366 let $enableTimesPM = dateTimeModal.find('.time-interval[data-time="pm"] input:not(:disabled) + label').not('.hide'); 30367 30368 $enableTimes.first().prevAll('label').addClass('hide');
30369 $enableTimes.last().nextAll('label').addClass('hide'); 30370 30371 if($enableTimesAM.length == 0) { 30372 $('.setting-label.am').addClass('hide'); 30373 $('.time-interval[data-time="am"]').addClass('hide'); 30374 } 30375 if($enableTimesPM.length == 0) { 30376 $('.setting-label.pm').addClass('hide'); 30377 $('.time-interval[data-time="pm"]').addClass('hide'); 30378 } 30379 30380 // var num = 1; 30381 // var length = 0; 30382 // dateTimeModal.find('.time-interval label').not('.hide').each(function(i, v){ 30383 // $(v).prev('input').addClass('row-'+num); 30384 // if($(v).prev('input').prop('disabled')) { 30385 // length++; 30386 // } 30387 30388 // if((i+1)%4 == 0) { 30389 // if(length == 4) $('input.row-'+num+' + label').addClass('hide'); 30390 // length = 0; 30391 // num ++; 30392 // } 30393 // }); 30394 30395 dateTimeModal.find('.time-interval input').on('change', function(){ 30396 $('.time-interval input').prop('checked', false); 30397 $(this).prop('checked', true); 30398 30399 if(type == 'etc-product-datetime') { 30400 if($('#etc-status').val() == 'P') { 30401 if(!$('#etc-start-date-txt').val() || !$('#etc-end-date-txt').val()) return false; 30402 } else { 30403 if(!$('#etc-start-date-txt').val()) return false; 30404 } 30405 } 30406 30407 getDateTimeStr(blocklang); 30408 }); 30409 } //date2 30410 30411 if($('[form-seq="'+id+'"] .date-ymd').val()) { //form 30412 var sDate = $('[form-seq="'+id+'"] .date-ymd').attr('data-select_date'); 30413 var sDateObj = new Date(sDate); 30414 termPicker.currentDate = sDateObj; 30415 termPicker.selectDate(sDateObj); 30416 $('#select-date-ymd').val(sDate); 30417 30418 if(type == 'date2') { 30419 var sTime = $('[form-seq="'+id+'"] .date-ymd').attr('data-select_time'); 30420 $('#'+sTime).prop('checked', true); 30421 } 30422 getDateTimeStr(blocklang); 30423 } 30424 30425 if(type.indexOf('etc-product-date') > -1 && $('#etc-start-date-option').val()) { //etc product 30426 if($('#etc-status').val() == 'P') { //ê¸°ê° 30427 document.querySelector('#etc-start-date-txt').value = document.querySelector('#etc-start-date-option').value; 30428 document.querySelector('#etc-end-date-txt').value = document.querySelector('#etc-end-date').value; 30429 document.querySelector('#select-date-ymd').value = document.querySelector('#etc-start-date-option').value + '|' + document.querySelector('#etc-end-date').value 30430 termPicker.startDate = $('#etc-start-date-option').val(); 30431 termPicker.endDate = $('#etc-end-date').val(); 30432 } else { 30433 document.querySelector('#etc-start-date-txt').value = document.querySelector('#etc-start-date-option').value; 30434 document.querySelector('#select-date-ymd').value = document.querySelector('#etc-start-date-option').value; 30435 var sDate = $('#etc-start-date-option').val(); 30436 var sDateObj = new Date(sDate); 30437 termPicker.selectDate(sDateObj); 30438 } 30439 30440 if($('#etc-time').val()) { 30441 var sTime = $('#etc-time').val(); 30442 $('.time-interval input[value="'+sTime+'"]').prop('checked', true); 30443 } 30444 30445 setTimeout(function(){ 30446 getDateTimeStr('ko') 30447 }, 500); 30448 } 30449 }); 30450} 30451 30452function getDateTimeStr(blocklang, w, c) { 30453 // console.log(c) 30454 if(typeof w == 'undefined') w = ''; 30455 if(typeof c == 'undefined') c = ''; 30456 var lang = (blocklang)? blocklang:LANG 30457 var selectedDate = $('#select-date-ymd').val(); 30458 var checkSelectedDate = selectedDate.split('.'); 30459 var inputType = ($('.setting-datetime-input').length > 0)? $('.setting-datetime-input').attr('data-type') : $('.form-calendar-box').attr('data-type'); 30460 var selectedTime = $('.time-interval input:checked'); 30461 30462 switch (inputType) { 30463 case 'date2': 30464 if(selectedDate && selectedTime.length > 0) { 30465 $('.term-setting').removeClass('hide'); 30466 var selectedTimeTxt = ' '+$.lang[lang]['config.form.date2.time.'+selectedTime.attr('name')]+' '+selectedTime.next('label').text(); 30467 if(lang == 'ko') { 30468 $('.term-setting').text(checkSelectedDate[0]+'ë '+checkSelectedDate[1]+'ì '+checkSelectedDate[2]+'ì¼'+selectedTimeTxt); 30469 } else { 30470 $('.term-setting').text(checkSelectedDate[1]+'/'+checkSelectedDate[2]+'/'+checkSelectedDate[0]+selectedTimeTxt); 30471 } 30472 } 30473 break; 30474 case 'etc-product-date': 30475 case 'etc-product-datetime': 30476 lang = 'ko'; 30477 blocklang = 'ko'; 30478 30479 var selectedTimeTxt = ''; 30480 selectedDate = $('#etc-start-date-txt').val(); 30481 checkSelectedDate = selectedDate.split('.'); 30482 30483 var startDate = $('#etc-start-date-txt').val(); 30484 var endDate = $('#etc-end-date-txt').val(); 30485 if(selectedDate) { 30486 $('.term-setting').removeClass('hide'); 30487 if($('#etc-status').val() == 'P') { //ê¸°ê° 30488 var checkStartDate = startDate.split('.'); 30489 var checkEndDate = endDate.split('.'); 30490 if (selectedTime.length > 0) selectedTimeTxt = '<br>'+$.lang[lang]['config.form.date2.time.'+selectedTime.attr('name')]+' '+selectedTime.next('label').text(); 30491 if(blocklang == 'ko') {
30492 $('.term-setting .start-date').html(checkStartDate[0]+'ë '+checkStartDate[1]+'ì '+checkStartDate[2]+' ì¼'); 30493 $('.term-setting .end-date').html(checkEndDate[0]+'ë '+checkEndDate[1]+'ì '+checkEndDate[2]+' ì¼'+selectedTimeTxt); 30494 } else { 30495 $('.term-setting .start-date').html(checkStartDate[1]+'/'+checkStartDate[2]+'/'+checkStartDate[0]); 30496 $('.term-setting .end-date').html(checkEndDate[1]+'/'+checkEndDate[2]+'/'+checkEndDate[0]+selectedTimeTxt); 30497 } 30498 } else { 30499 if (selectedTime.length > 0) selectedTimeTxt = ' '+$.lang[lang]['config.form.date2.time.'+selectedTime.attr('name')]+' '+selectedTime.next('label').text(); 30500 if(lang == 'ko') { 30501 $('.term-setting').html(checkSelectedDate[0]+'ë '+checkSelectedDate[1]+'ì '+checkSelectedDate[2]+'ì¼'+selectedTimeTxt); 30502 } else { 30503 $('.term-setting').html(checkSelectedDate[1]+'/'+checkSelectedDate[2]+'/'+checkSelectedDate[0]+selectedTimeTxt); 30504 } 30505 } 30506 } 30507 break; 30508 case 'saleStartDateTime': 30509 if(c == '') { 30510 lang = 'ko'; 30511 blocklang = 'ko'; 30512 } else { 30513 lang = c; 30514 blocklang = c; 30515 } 30516 // console.log('w', w); 30517 var selectedTimeTxt = ''; 30518 checkSelectedDate = selectedDate.split('.'); 30519 30520 if(selectedDate) { 30521 if(lang == 'ko') { 30522 $('.sale-calendar-box .start-date').html(checkSelectedDate[0]+'ë '+checkSelectedDate[1]+'ì '+checkSelectedDate[2]+'ì¼'); 30523 } else { 30524 $('.sale-calendar-box .start-date').html(checkSelectedDate[1]+'/'+checkSelectedDate[2]+'/'+checkSelectedDate[0]); 30525 } 30526 30527 var saleStartDateTime = $('#sale-start-datetime').val(); 30528 30529 if (w == 'calendar') { 30530 $('.setting-sale-date .setting-datetime-input').slideUp(400, function(){ 30531 $('.setting-sale-date').removeClass('open'); 30532 }); 30533 30534 $('.setting-sale-time .setting-datetime-input').slideDown(400, function(){ 30535 $('.setting-sale-time').addClass('open'); 30536 }); 30537 } else { 30538 if(!w && saleStartDateTime) { 30539 $('.setting-sale-date').removeClass('open'); 30540 $('.setting-sale-date .setting-datetime-input').css('display', 'none'); 30541 30542 $('.setting-sale-time').removeClass('open'); 30543 $('.setting-sale-time .setting-datetime-input').css('display', 'none'); 30544 } 30545 } 30546 } 30547 30548 if (selectedTime.length > 0) { 30549 var timeArr = selectedTime.next('label').text().split(':'); 30550 if(c == 'en') selectedTimeTxt = $.lang[c]['config.form.date2.time.'+selectedTime.closest('.time-interval').attr('data-time')]+' '+timeArr[0]+' : '+timeArr[1]; 30551 else selectedTimeTxt = $.lang[lang]['config.form.date2.time.'+selectedTime.closest('.time-interval').attr('data-time')]+' '+timeArr[0]+'ì '+timeArr[1]+'ë¶'; 30552 $('.sale-calendar-box .start-time').html(selectedTimeTxt); 30553 30554 if (w == 'time') { 30555 $('.setting-sale-time .setting-datetime-input').slideUp(400, function(){ 30556 $('.setting-sale-time').removeClass('open'); 30557 }); 30558 } 30559 } 30560 break; 30561 case 'saleEndDateTime': 30562 if(c == '') { 30563 lang = 'ko'; 30564 blocklang = 'ko'; 30565 } else { 30566 lang = c; 30567 blocklang = c; 30568 } 30569 30570 var selectedTimeTxt = ''; 30571 checkSelectedDate = selectedDate.split('.'); 30572 30573 if(selectedDate) { 30574 if(lang == 'ko') { 30575 $('.sale-calendar-box .end-date').html(checkSelectedDate[0]+'ë '+checkSelectedDate[1]+'ì '+checkSelectedDate[2]+'ì¼'); 30576 } else { 30577 $('.sale-calendar-box .end-date').html(checkSelectedDate[1]+'/'+checkSelectedDate[2]+'/'+checkSelectedDate[0]); 30578 } 30579 30580 var saleStartDateTime = $('#sale-start-datetime').val(); 30581 var saleEndDateTime = $('#sale-end-datetime').val(); 30582 30583 var startDate = saleStartDateTime.split(' ')[0]; 30584 var startTime = saleStartDateTime.split(' ')[1]; 30585 30586 if (w == 'calendar') { 30587 $('.setting-sale-date .setting-datetime-input').slideUp(400, function(){ 30588 $('.setting-sale-date').removeClass('open'); 30589 }); 30590 30591 $('.setting-sale-time .setting-datetime-input').slideDown(400, function(){ 30592 $('.setting-sale-time').addClass('open'); 30593 }); 30594 } else { 30595 if(!w && saleStartDateTime) { 30596 $('.setting-sale-date').removeClass('open'); 30597 $('.setting-sale-date .setting-datetime-input').css('display', 'none'); 30598 30599 $('.setting-sale-time').removeClass('open'); 30600 $('.setting-sale-time .setting-datetime-input').css('display', 'none'); 30601 } 30602 } 30603 30604 $('.time-interval input').prop('disabled', false); 30605 if(saleStartDateTime && startDate == selectedDate.replace(/\./g,'-')) { 30606 var hour = parseInt(startTime.split(':')[0]); 30607 var minute = parseInt(startTime.split(':')[1]); 30608 var mna = (hour >= 12)? 'pm' : 'am'; 30609 30610 if(hour >= 12) { 30611 if (hour > 12) hour -= 12; 30612 } else if (hour == 0) hour += 12 30613 30614 var formattedStartTime = hour.toString().padStart(2, '0') + minute.toString().padStart(2, '0'); 30615 $('.time-interval[data-time="' + mna + '"] input[value="' + formattedStartTime + '"]').prop('disabled', true); 30616 if(mna == 'pm') { 30617 $('.time-interval[data-time="am"] input').prop('disabled', true); 30618 $('.time-interval[data-time="pm"] input[value="' + formattedStartTime + '"]').prevAll('input').prop('disabled', true); 30619 } else { 30620 $('.time-interval[data-time="am"] input[value="' + formattedStartTime + '"]').prevAll('input').prop('disabled', true); 30621 } 30622 if($('.time-interval input:checked').is(':disabled')) { 30623 $('.time-interval input:checked').prop('checked', false); 30624 $('.sale-calendar-box .end-time').html(''); 30625 selectedTime = ''; 30626 } 30627 } 30628 } 30629 30630 if (selectedTime.length > 0) { 30631 var timeArr = selectedTime.next('label').text().split(':'); 30632 if(c == 'en') selectedTimeTxt = $.lang[c]['config.form.date2.time.'+selectedTime.closest('.time-interval').attr('data-time')]+' '+timeArr[0]+' : '+timeArr[1]; 30633 else selectedTimeTxt = $.lang[lang]['config.form.date2.time.'+selectedTime.closest('.time-interval').attr('data-time')]+' '+timeArr[0]+'ì '+timeArr[1]+'ë¶'; 30634 $('.sale-calendar-box .end-time').html(selectedTimeTxt); 30635 30636 if (w == 'time') { 30637 $('.setting-sale-time .setting-datetime-input').slideUp(400, function(){ 30638 $('.setting-sale-time').removeClass('open'); 30639 }); 30640 } 30641 } 30642 break; 30643 default: 30644 if(selectedDate) { 30645 $('.term-setting').removeClass('hide'); 30646 if(lang == 'ko') { 30647 $('.term-setting').text(checkSelectedDate[0]+'ë '+checkSelectedDate[1]+'ì '+checkSelectedDate[2]+'ì¼'); 30648 } else { 30649 $('.term-setting').text(checkSelectedDate[1]+'/'+checkSelectedDate[2]+'/'+checkSelectedDate[0]); 30650 } 30651 } 30652 break; 30653 } 30654 // if(selectedDate && startTime.length > 0 && endTime.length > 0) { 30655 // var startTimeTxt = (startTime.attr('name') == 'am') ? 'ì¤ì '+startTime.next('label').text():'ì¤í '+startTime.next('label').text(); 30656 // var endTimeTxt = (endTime.attr('name') == 'am') ? 'ì¤ì '+endTime.next('label').text() :'ì¤í '+endTime.next('label').text(); 30657 30658 // var s = startTime.val(); 30659 // var e = endTime.val(); 30660 // var sHour = (startTime.attr('name') == 'pm')? Number(s.substr(0, 2))+12 : Number(s.substr(0, 2)); 30661 // var sMinute = Number(s.substr(2)); 30662 // var eHour = (endTime.attr('name') == 'pm')? Number(e.substr(0, 2))+12 : Number(e.substr(0, 2)); 30663 // var eMinute = Number(e.substr(2)); 30664 30665 // if(sHour == 24) sHour = 12; 30666 // else if(sHour == 12) sHour = 0; 30667 // if(eHour == 24) eHour = 12; 30668 // else if(eHour == 12) eHour = 0; 30669 30670 // var startDateTime = new Date(checkSelectedDate[0], checkSelectedDate[1], checkSelectedDate[2], sHour, sMinute); 30671 // var endDateTime = new Date(checkSelectedDate[0], checkSelectedDate[1], checkSelectedDate[2], eHour, eMinute); 30672 // var elapsedMSec = endDateTime.getTime()-startDateTime.getTime(); 30673 // var elapsedHour = elapsedMSec/1000/60/60; 30674 // console.log(sHour, sMinute, startDateTime, endDateTime, elapsedMSec, elapsedHour); 30675 // var totalTimesTxt = (elapsedMSec%3600000 == 0)? ' ('+elapsedHour+'ìê°)' : ' ('+Math.floor(elapsedHour)+'ìê° 30ë¶)'; 30676 // $('.term-setting').removeClass('hide'); 30677 // $('.term-setting').text(checkSelectedDate[0]+'ë '+checkSelectedDate[1]+'ì '+checkSelectedDate[2]+' ì¼ '+startTimeTxt+' ~ '+ endTimeTxt + totalTimesTxt); 30678 // } 30679} 30680 30681// function calendarDateTimeStr(blocklang, w) { 30682// if(typeof w == 'undefined') w = ''; 30683// var lang = (blocklang)? blocklang:LANG
30684// var selectedDate = $('#select-date-ymd').val(); 30685// var checkSelectedDate = selectedDate.split('.'); 30686// var inputType = ($('.setting-datetime-input').length > 0)? $('.setting-datetime-input').attr('data-type') : $('.form-calendar-box').attr('data-type'); 30687// var selectedTime = $('.time-interval input:checked'); 30688 30689// switch (inputType) { 30690// case 'date2': 30691// if(selectedDate && selectedTime.length > 0) { 30692// $('.term-setting').removeClass('hide'); 30693// var selectedTimeTxt = ' '+$.lang[lang]['config.form.date2.time.'+selectedTime.attr('name')]+' '+selectedTime.next('label').text(); 30694// if(lang == 'ko') { 30695// $('.term-setting').text(checkSelectedDate[0]+'ë '+checkSelectedDate[1]+'ì '+checkSelectedDate[2]+'ì¼'+selectedTimeTxt); 30696// } else { 30697// $('.term-setting').text(checkSelectedDate[1]+'/'+checkSelectedDate[2]+'/'+checkSelectedDate[0]+selectedTimeTxt); 30698// } 30699// } 30700// break; 30701// case 'etc-product-date': 30702// case 'etc-product-datetime': 30703// lang = 'ko'; 30704// blocklang = 'ko'; 30705 30706// var selectedTimeTxt = ''; 30707// selectedDate = $('#etc-start-date-txt').val(); 30708// checkSelectedDate = selectedDate.split('.'); 30709 30710// var startDate = $('#etc-start-date-txt').val(); 30711// var endDate = $('#etc-end-date-txt').val(); 30712// if(selectedDate) { 30713// $('.term-setting').removeClass('hide'); 30714// if($('#etc-status').val() == 'P') { //ê¸°ê° 30715// var checkStartDate = startDate.split('.'); 30716// var checkEndDate = endDate.split('.'); 30717// if (selectedTime.length > 0) selectedTimeTxt = '<br>'+$.lang[lang]['config.form.date2.time.'+selectedTime.attr('name')]+' '+selectedTime.next('label').text(); 30718// if(blocklang == 'ko') { 30719// $('.term-setting .start-date').html(checkStartDate[0]+'ë '+checkStartDate[1]+'ì '+checkStartDate[2]+' ì¼'); 30720// $('.term-setting .end-date').html(checkEndDate[0]+'ë '+checkEndDate[1]+'ì '+checkEndDate[2]+' ì¼'+selectedTimeTxt); 30721// } else { 30722// $('.term-setting .start-date').html(checkStartDate[1]+'/'+checkStartDate[2]+'/'+checkStartDate[0]); 30723// $('.term-setting .end-date').html(checkEndDate[1]+'/'+checkEndDate[2]+'/'+checkEndDate[0]+selectedTimeTxt); 30724// } 30725// } else { 30726// if (selectedTime.length > 0) selectedTimeTxt = ' '+$.lang[lang]['config.form.date2.time.'+selectedTime.attr('name')]+' '+selectedTime.next('label').text(); 30727// if(lang == 'ko') { 30728// $('.term-setting').html(checkSelectedDate[0]+'ë '+checkSelectedDate[1]+'ì '+checkSelectedDate[2]+'ì¼'+selectedTimeTxt); 30729// } else { 30730// $('.term-setting').html(checkSelectedDate[1]+'/'+checkSelectedDate[2]+'/'+checkSelectedDate[0]+selectedTimeTxt); 30731// } 30732// } 30733// } 30734// break; 30735// case 'saleStartDateTime': 30736// lang = 'ko'; 30737// blocklang = 'ko'; 30738// console.log('w', w); 30739// var selectedTimeTxt = ''; 30740// checkSelectedDate = selectedDate.split('.'); 30741 30742// if(selectedDate) { 30743// if(lang == 'ko') { 30744// $('.sale-calendar-box .start-date').html(checkSelectedDate[0]+'ë '+checkSelectedDate[1]+'ì '+checkSelectedDate[2]+'ì¼'); 30745// } else { 30746// $('.sale-calendar-box .start-date').html(checkSelectedDate[1]+'/'+checkSelectedDate[2]+'/'+checkSelectedDate[0]); 30747// } 30748 30749// var saleStartDateTime = $('#sale-start-datetime').val(); 30750 30751// if (w == 'calendar') { 30752// $('.setting-sale-date .setting-datetime-input').slideUp(400, function(){ 30753// $('.setting-sale-date').removeClass('open'); 30754// }); 30755 30756// $('.setting-sale-time .setting-datetime-input').slideDown(400, function(){ 30757// $('.setting-sale-time').addClass('open'); 30758// }); 30759// } else { 30760// if(!w && saleStartDateTime) { 30761// $('.setting-sale-date').removeClass('open'); 30762// $('.setting-sale-date .setting-datetime-input').css('display', 'none'); 30763 30764// $('.setting-sale-time').removeClass('open'); 30765// $('.setting-sale-time .setting-datetime-input').css('display', 'none'); 30766// } 30767// } 30768// } 30769 30770// if (selectedTime.length > 0) { 30771// var timeArr = selectedTime.next('label').text().split(':'); 30772// selectedTimeTxt = $.lang[lang]['config.form.date2.time.'+selectedTime.closest('.time-interval').attr('data-time')]+' '+timeArr[0]+'ì '+timeArr[1]+'ë¶'; 30773// $('.sale-calendar-box .start-time').html(selectedTimeTxt); 30774 30775// if (w == 'time') { 30776// $('.setting-sale-time .setting-datetime-input').slideUp(400, function(){ 30777// $('.setting-sale-time').removeClass('open'); 30778// }); 30779// } 30780// } 30781// break; 30782// case 'saleEndDateTime': 30783// lang = 'ko'; 30784// blocklang = 'ko'; 30785 30786// var selectedTimeTxt = ''; 30787// checkSelectedDate = selectedDate.split('.'); 30788 30789// if(selectedDate) { 30790// if(lang == 'ko') { 30791// $('.sale-calendar-box .end-date').html(checkSelectedDate[0]+'ë '+checkSelectedDate[1]+'ì '+checkSelectedDate[2]+'ì¼'); 30792// } else { 30793// $('.sale-calendar-box .end-date').html(checkSelectedDate[1]+'/'+checkSelectedDate[2]+'/'+checkSelectedDate[0]); 30794// } 30795 30796// var saleStartDateTime = $('.'+selectEL).find('.calendar-modal-container .sdate .start').val(); 30797// var saleEndDateTime = $('.'+selectEL).find('.calendar-modal-container .edate .end').val(); 30798 30799// var selectedDate = ($('#select-date-ymd').val() || '').trim(); 30800// var checkSelectedDate = selectedDate ? selectedDate.split('.') : []; 30801 30802// if (w == 'calendar') { 30803// $('.setting-sale-date .setting-datetime-input').slideUp(400, function(){ 30804// $('.setting-sale-date').removeClass('open'); 30805// }); 30806 30807// $('.setting-sale-time .setting-datetime-input').slideDown(400, function(){ 30808// $('.setting-sale-time').addClass('open'); 30809// }); 30810// } else { 30811// if(!w && saleStartDateTime) { 30812// $('.setting-sale-date').removeClass('open'); 30813// $('.setting-sale-date .setting-datetime-input').css('display', 'none'); 30814 30815// $('.setting-sale-time').removeClass('open'); 30816// $('.setting-sale-time .setting-datetime-input').css('display', 'none'); 30817// } 30818// } 30819 30820// $('.time-interval input').prop('disabled', false); 30821// if(saleStartDateTime && startDate == selectedDate.replace(/\./g,'-')) { 30822// var hour = parseInt(startTime.split(':')[0]); 30823// var minute = parseInt(startTime.split(':')[1]); 30824// var mna = (hour >= 12)? 'pm' : 'am'; 30825 30826// if(hour >= 12) { 30827// if (hour > 12) hour -= 12; 30828// } else if (hour == 0) hour += 12 30829 30830// var formattedStartTime = hour.toString().padStart(2, '0') + minute.toString().padStart(2, '0'); 30831// $('.time-interval[data-time="' + mna + '"] input[value="' + formattedStartTime + '"]').prop('disabled', true); 30832// if(mna == 'pm') { 30833// $('.time-interval[data-time="am"] input').prop('disabled', true); 30834// $('.time-interval[data-time="pm"] input[value="' + formattedStartTime + '"]').prevAll('input').prop('disabled', true); 30835// } else { 30836// $('.time-interval[data-time="am"] input[value="' + formattedStartTime + '"]').prevAll('input').prop('disabled', true); 30837// } 30838// if($('.time-interval input:checked').is(':disabled')) { 30839// $('.time-interval input:checked').prop('checked', false); 30840// $('.sale-calendar-box .end-time').html(''); 30841// selectedTime = ''; 30842// } 30843// } 30844// } 30845 30846// if (selectedTime.length > 0) { 30847// var timeArr = selectedTime.next('label').text().split(':'); 30848// selectedTimeTxt = $.lang[lang]['config.form.date2.time.'+selectedTime.closest('.time-interval').attr('data-time')]+' '+timeArr[0]+'ì '+timeArr[1]+'ë¶'; 30849// $('.sale-calendar-box .end-time').html(selectedTimeTxt); 30850 30851// if (w == 'time') { 30852// $('.setting-sale-time .setting-datetime-input').slideUp(400, function(){ 30853// $('.setting-sale-time').removeClass('open'); 30854// }); 30855// } 30856// } 30857// break; 30858// default: 30859// if(selectedDate) { 30860// $('.term-setting').removeClass('hide'); 30861// if(lang == 'ko') { 30862// $('.term-setting').text(checkSelectedDate[0]+'ë '+checkSelectedDate[1]+'ì '+checkSelectedDate[2]+'ì¼'); 30863// } else { 30864// $('.term-setting').text(checkSelectedDate[1]+'/'+checkSelectedDate[2]+'/'+checkSelectedDate[0]); 30865// } 30866// } 30867// break; 30868// } 30869// } 30870 30871function scrollToCurrentYearMonth() { 30872 $('.year-picker').scrollTop(0); 30873 $('.month-picker').scrollTop(0); 30874 var offsetYear = $('.year-picker .current').position().top - 30; 30875 var offsetMonth = $('.month-picker .current').position().top - 30; 30876 $('.year-picker').scrollTop(offsetYear); 30877 $('.month-picker').scrollTop(offsetMonth); 30878} 30879 30880function calInputWidth(inputObj) { 30881 let inputTxt = inputObj.val().replace(/[\u3131-\u318E\uAC00-\uD7A3]/g, '');
30882 let Num = Number(removeCommas(inputTxt)); 30883 30884 let $tempSpan = $('<span>').css({ 30885 'font-size': inputObj.css('font-size'), 30886 'font-family': inputObj.css('font-family'), 30887 'visibility': 'hidden', 30888 'white-space': 'pre' 30889 }).text(inputTxt); 30890 30891 $('body').append($tempSpan); 30892 30893 let inputWidth = Math.floor($tempSpan.width()) + 5; 30894 if(inputWidth < 13 || Num == 0) inputWidth = 13; 30895 inputObj.width(inputWidth); 30896 $tempSpan.remove(); 30897} 30898 30899function calDiscount(inputObj) { 30900 var orgPrice = Number(removeCommas($('#prod-sale').text())), 30901 discountRate = inputObj.val(), 30902 discountUnit = $('#prod-discount-unit').attr('data-value'), 30903 price = 0; 30904 30905 discountRate = Number(discountRate.replace(/[^0-9]/g, '')); 30906 if($('.form-group.discount-append').hasClass('discount-multi')) { 30907 switch(discountUnit) { 30908 case 'W': 30909 inputObj.val(number_format(discountRate)); 30910 break; 30911 case 'P': 30912 if(discountRate >= 100) { 30913 discountRate = 100; 30914 } 30915 inputObj.val(discountRate); 30916 30917 break; 30918 } 30919 } else { 30920 switch(discountUnit) { 30921 case 'W': 30922 price = orgPrice - discountRate; 30923 if(price < 0) { 30924 price = 0; 30925 inputObj.val(number_format(orgPrice)); 30926 } else { 30927 inputObj.val(number_format(discountRate)); 30928 } 30929 break; 30930 case 'P': 30931 if(discountRate >= 100) { 30932 price = 0; 30933 discountRate = 100; 30934 } else { 30935 var discountPrice = orgPrice * (discountRate / 100); 30936 price = Math.round(orgPrice - discountPrice); 30937 // if($('#price-cut-btn').is(':checked')) price = Math.floor(price / 10) * 10; 30938 } 30939 30940 // if (price % 10 == 0 || price == 0) $('#price-cut-btn').addClass('disabled'); 30941 // else $('#price-cut-btn').removeClass('disabled'); 30942 inputObj.val(discountRate); 30943 30944 break; 30945 } //end switch 30946 console.log('price', price); 30947 30948 $('#prod-price').val(number_format(price)); 30949 calInputWidth($('#prod-price')); 30950 } 30951 30952} 30953 30954$(document).on('click', '.element[data-type="review"] a[data-review]', function(e){ 30955 e.preventDefault(); 30956 if ($(this).closest('.element').hasClass('review-sample-block')) return false; 30957 30958 if (PAGE_MODE != 'c') { 30959 var seq = $(this).attr('data-review'); 30960 $.shoppingmall.viewReviewModal(property.SID, seq); 30961 } 30962}); 30963 30964 30965var configDateTime = function(el) { 30966 var field_type = $(el).attr('data-type'); 30967 var id = (field_type.indexOf('etc-product-date') > -1) ? $('#prod-no').val() : $(el).closest('.form-sort-item').attr('data-id'); 30968 var func = $(el).attr('data-setting'); 30969 var field_setting = {}; 30970 // console.log('field_type', field_type, el); 30971 30972 if (field_type.indexOf('etc-product-date') > -1) { 30973 field_setting.term = ($('#etc-term').val()) ? JSON.parse($('#etc-term').val()) : {}; 30974 field_setting.excludeDate = { 'date': $('#etc-exclude-date').val() }; 30975 field_setting.time = ($('#etc-time').val()) ? JSON.parse($('#etc-time').val()) : {}; 30976 } else if (field_type.indexOf('sale-product-datetime') > -1) { 30977 field_setting.term = ($('#etc-term').val()) ? JSON.parse($('#etc-term').val()) : {}; 30978 } else { 30979 $.ajax({ 30980 url: '/template/forms/field_config', 30981 dataType: 'json', 30982 type: 'POST', 30983 data: { sid: SID, id: id }, 30984 async: false, 30985 cache: false, 30986 success: function(data) { 30987 checkError(data); 30988 field_setting = data; 30989 } 30990 }); 30991 } 30992 // console.log(field_setting); 30993 30994 var term = (field_setting.term) ? field_setting.term : {}; 30995 var excludeDate = (field_setting.excludeDate) ? field_setting.excludeDate : {}; 30996 var time = (field_setting.time) ? field_setting.time : {}; 30997 30998 //term 30999 var startDate = (term.start_date !== undefined && term.start_date != '') ? term.start_date : ''; 31000 var endDate = (term.end_date !== undefined && term.end_date != '') ? term.end_date : ''; 31001 var dateWeek = (term.date_week !== undefined && term.date_week != '') ? term.date_week : 'A'; 31002 var days = (term.days !== undefined && term.days != '') ? term.days.split('|') : []; 31003 var daysObj = { 31004 'sun': 0, 31005 'mon': 1, 31006 'tue': 2, 31007 'wed': 3, 31008 'thu': 4, 31009 'fri': 5,
31010 'sat': 6, 31011 } 31012 31013 //excludeDate 31014 var exceptDate = (excludeDate.date !== undefined) ? excludeDate.date : ''; 31015 31016 //time 31017 var interval = (time.interval !== undefined) ? time.interval : '30'; 31018 var am = (time.am !== undefined) ? time.am.split('|') : []; 31019 var pm = (time.pm !== undefined) ? time.pm.split('|') : []; 31020 var timeCnt = am.length + pm.length; 31021 // var disabled = null; 31022 31023 // var allTimeChecked = ''; 31024 // if (interval == '10' && timeCnt == 144) allTimeChecked = 'checked'; 31025 // if (interval == '20' && timeCnt == 72) allTimeChecked = 'checked'; 31026 // if (interval == '30' && timeCnt == 48) allTimeChecked = 'checked'; 31027 // if (interval == '60' && timeCnt == 24) allTimeChecked = 'checked'; 31028 31029 var language = (LANG != 'ko') ? 'en' : 'ko'; 31030 var blocklang = ($('[form-seq="' + id + '"]').closest('.element').attr('data-blocklang')) ? $('[form-seq="' + id + '"]').closest('.element').attr('data-blocklang') : LANG; 31031 31032 var modal_title = ''; 31033 var modal_str = ''; 31034 var modal_class = 'modal-dialog cl-cmmodal cl-s-btn setting-form-option-date2 cl-close-btn cover'; 31035 switch (func) { 31036 case 'term': 31037 modal_title = $.lang[LANG]['config.form.date.title']; 31038 modal_str = '\ 31039 <input type="hidden" id="etc-date-week" value="' + dateWeek + '">\ 31040 <div class="display-flex align-items-center setting-row">\ 31041 <div class="setting-label">' + $.lang[LANG]['config.form.date.dateWeek.label'] + '</div>\ 31042 <div class="btn-group btn-group-justified week">\ 31043 <label class="btn checked">' + $.lang[LANG]['config.form.date.dateWeek.entire'] + '<input type="radio" name="week" value="A" checked></label>\ 31044 <label class="btn">' + $.lang[LANG]['config.form.date.dateWeek.weekday'] + '<input type="radio" name="week" value="W"></label>\ 31045 <label class="btn">' + $.lang[LANG]['config.form.date.dateWeek.weekend'] + '<input type="radio" name="week" value="K"></label>\ 31046 </div>\ 31047 </div>\ 31048 <div class="display-flex align-items-center setting-row">\ 31049 <div class="setting-label">' + $.lang[LANG]['config.form.date.day.label'] + '</div>\ 31050 <div class="btn-group btn-group-justified day">\ 31051 <label class="btn checked">' + $.lang[LANG]['config.form.date.day.sun'] + '<input type="checkbox" name="day" value="sun" checked></label>\ 31052 <label class="btn checked">' + $.lang[LANG]['config.form.date.day.mon'] + '<input type="checkbox" name="day" value="mon" checked></label>\ 31053 <label class="btn checked">' + $.lang[LANG]['config.form.date.day.tue'] + '<input type="checkbox" name="day" value="tue" checked></label>\ 31054 <label class="btn checked">' + $.lang[LANG]['config.form.date.day.wed'] + '<input type="checkbox" name="day" value="wed" checked></label>\ 31055 <label class="btn checked">' + $.lang[LANG]['config.form.date.day.thu'] + '<input type="checkbox" name="day" value="thu" checked></label>\ 31056 <label class="btn checked">' + $.lang[LANG]['config.form.date.day.fri'] + '<input type="checkbox" name="day" value="fri" checked></label>\ 31057 <label class="btn checked">' + $.lang[LANG]['config.form.date.day.sat'] + '<input type="checkbox" name="day" value="sat" checked></label>\ 31058 </div>\ 31059 </div>\ 31060 <div class="term-calendar-box">\ 31061 <input type="hidden" id="select-calendar" value="term-datepicker">\ 31062 <input type="hidden" id="etc-start-date-prev" value="' + startDate + '">\ 31063 <input type="hidden" id="etc-end-date-prev" value="' + endDate + '">\ 31064 <input type="hidden" id="etc-start-date-txt" value="' + startDate + '">\ 31065 <input type="hidden" id="etc-end-date-txt" value="' + endDate + '">\ 31066 <input type="hidden" id="select-except-date">\ 31067 <div id="term-datepicker"></div>\ 31068 </div>\ 31069 <div class="term-setting hide" data-blocklang="' + blocklang + '">\
31070 <span class="start-date"></span> ~ <span class="end-date"></span>\ 31071 </div>\ 31072 '; 31073 break; 31074 case 'saleStartDateTime': 31075 case 'saleEndDateTime': 31076 modal_class = 'modal-dialog cl-cmmodal cl-s-btn setting-form-option-date2 setting-product-sale-datetime cl-close-btn cover'; 31077 var timeClass = 'start-time'; 31078 if(func == 'saleStartDateTime') { 31079 modal_title = 'ìì ë ì§/ìê° ì í'; 31080 modal_str = '\ 31081 <div class="term-calendar-box sale-calendar-box setting-sale-date">\ 31082 <div class="setting-label display-flex align-items-center space-between">\ 31083 <div class="display-flex align-items-center">\ 31084 <span>ë ì§ ì í</span>\ 31085 <span class="start-date datetime-txt" data-blocklang="' + blocklang + '"></span>\ 31086 </div>\ 31087 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path d="M8 12.5a.47.47 0 0 1-.35-.15l-7.5-7.5c-.2-.2-.2-.51 0-.71.2-.2.51-.2.71 0L8 11.29l7.15-7.15c.2-.2.51-.2.71 0 .2.2.2.51 0 .71l-7.5 7.5c-.1.1-.23.15-.36.15z"></path></svg>\ 31088 </div>\ 31089 <div class="setting-datetime-input" data-type="' + func + '">\ 31090 <input type="hidden" id="select-calendar" value="term-datepicker">\ 31091 <input type="hidden" id="select-date-ymd" value="">\ 31092 <input type="hidden" id="etc-start-date-prev" value="">\ 31093 <input type="hidden" id="etc-start-date-txt" value="">\ 31094 <div id="sale-datepicker"></div>\ 31095 </div>\ 31096 </div>\ 31097 '; 31098 } else { 31099 modal_title = 'ì¢ ë£ ë ì§/ìê° ì í'; 31100 modal_str = '\ 31101 <div class="term-calendar-box sale-calendar-box setting-sale-date">\ 31102 <div class="setting-label display-flex align-items-center space-between">\ 31103 <div class="display-flex align-items-center">\ 31104 <span>ë ì§ ì í</span>\ 31105 <span class="end-date datetime-txt" data-blocklang="' + blocklang + '"></span>\ 31106 </div>\ 31107 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path d="M8 12.5a.47.47 0 0 1-.35-.15l-7.5-7.5c-.2-.2-.2-.51 0-.71.2-.2.51-.2.71 0L8 11.29l7.15-7.15c.2-.2.51-.2.71 0 .2.2.2.51 0 .71l-7.5 7.5c-.1.1-.23.15-.36.15z"></path></svg>\ 31108 </div>\ 31109 <div class="setting-datetime-input" data-type="' + func + '">\ 31110 <input type="hidden" id="select-calendar" value="term-datepicker">\ 31111 <input type="hidden" id="select-date-ymd" value="">\ 31112 <input type="hidden" id="etc-start-date-prev" value="">\ 31113 <input type="hidden" id="etc-start-date-txt" value="">\ 31114 <input type="hidden" id="etc-end-date-prev" value="">\ 31115 <input type="hidden" id="etc-end-date-txt" value="">\ 31116 <div id="sale-datepicker"></div>\ 31117 </div>\ 31118 </div>\ 31119 '; 31120 timeClass = 'end-time'; 31121 } 31122 31123 modal_str += '\ 31124 <div class="term-calendar-box sale-calendar-box setting-sale-time">\ 31125 <div class="setting-label display-flex align-items-center space-between">\ 31126 <div class="display-flex align-items-center">\ 31127 <span>ìê° ì í</span>\ 31128 <span class="'+timeClass+' datetime-txt" data-blocklang="' + blocklang + '"></span>\ 31129 </div>\ 31130 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">
31130<path d="M8 12.5a.47.47 0 0 1-.35-.15l-7.5-7.5c-.2-.2-.2-.51 0-.71.2-.2.51-.2.71 0L8 11.29l7.15-7.15c.2-.2.51-.2.71 0 .2.2.2.51 0 .71l-7.5 7.5c-.1.1-.23.15-.36.15z"></path></svg>\ 31131 </div>\ 31132 <div class="setting-datetime-input" data-type="' + func + '" style="display:none;">\ 31133 <div class="display-flex align-items-center setting-row">\ 31134 <div class="setting-label">' + $.lang[LANG]['config.form.date2.time.interval.label'] + '</div>\ 31135 <div class="newcheckbox hand">\ 31136 <label>\ 31137 <div class="newcheckboxSvgRadio">\ 31138 <input type="radio" class="cl-common-form-radio-hide" name="time_interval" value="30" checked>\ 31139 <svg viewBox="0 0 18 18" width="18" height="18">\ 31140 <path d="M9 0C4.03 0 0 4.03 0 9c0 4.97 4.03 9 9 9s9-4.03 9-9C18 4.03 13.97 0 9 0zM9 17c-4.41 0-8-3.59-8-8 0-4.41 3.59-8 8-8s8 3.59 8 8C17 13.41 13.41 17 9 17z"></path>\ 31141 </svg>\ 31142 <svg class="active" viewBox="0 0 18 18" width="18" height="18">\ 31143 <path d="M9 0C4.03 0 0 4.03 0 9c0 4.97 4.03 9 9 9s9-4.03 9-9C18 4.03 13.97 0 9 0zM9 17c-4.41 0-8-3.59-8-8 0-4.41 3.59-8 8-8s8 3.59 8 8C17 13.41 13.41 17 9 17z"></path>\ 31144 <circle cx="9" cy="9" r="6"></circle>\ 31145 </svg>\ 31146 </div>\ 31147 <span>' + $.lang[LANG]['config.form.date2.time.interval.30'] + '</span>\ 31148 </label>\ 31149 </div>\ 31150 <div class="newcheckbox hand">\ 31151 <label>\ 31152 <div class="newcheckboxSvgRadio">\ 31153 <input type="radio" class="cl-common-form-radio-hide" name="time_interval" value="60">\ 31154 <svg viewBox="0 0 18 18" width="18" height="18">\ 31155 <path d="M9 0C4.03 0 0 4.03 0 9c0 4.97 4.03 9 9 9s9-4.03 9-9C18 4.03 13.97 0 9 0zM9 17c-4.41 0-8-3.59-8-8 0-4.41 3.59-8 8-8s8 3.59 8 8C17 13.41 13.41 17 9 17z"></path>\ 31156 </svg>\ 31157 <svg class="active" viewBox="0 0 18 18" width="18" height="18">\ 31158 <path d="M9 0C4.03 0 0 4.03 0 9c0 4.97 4.03 9 9 9s9-4.03 9-9C18 4.03 13.97 0 9 0zM9 17c-4.41 0-8-3.59-8-8 0-4.41 3.59-8 8-8s8 3.59 8 8C17 13.41 13.41 17 9 17z"></path>\ 31159 <circle cx="9" cy="9" r="6"></circle>\ 31160 </svg>\ 31161 </div>\ 31162 <span>' + $.lang[LANG]['config.form.date2.time.interval.60'] + '</span>\ 31163 </label>\ 31164 </div>\ 31165 </div>\ 31166 <div class="setting-row am">\ 31167 <div class="setting-label">' + $.lang[LANG]['config.form.date2.time.am'] + '</div>\ 31168 <div class="display-flex time-interval" data-time="am"></div>\ 31169 </div>\ 31170 <div class="setting-row">\ 31171 <div class="setting-label">' + $.lang[LANG]['config.form.date2.time.pm'] + '</div>\ 31172 <div class="display-flex time-interval" data-time="pm"></div>\ 31173 </div>\ 31174 </div>\ 31175 </div>\ 31176 '; 31177 break; 31178 case 'excludeDate': 31179 modal_title = $.lang[LANG]['config.form.date.excludeDate']; 31180 modal_str = '\ 31181 <div class="except-calendar-box">\ 31182 <div class="unselect-all hand"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path d="m15.29 7-1.32 1.32c.01-.11.03-.21.03-.32 0-3.31-2.69-6-6-6-1.66 0-3.16.67-4.24 1.76l.71.71C5.37 3.56 6.62 3 8 3c2.76 0 5 2.24 5 5 0 .09-.02.18-.03.27L11.71 7l-.71.71 2.5 2.5 2.5-2.5-.71-.71z"/><path d="M8 13c-2.76 0-5-2.24-5-5 0-.09.02-.18.03-.27L4.29 9 5 8.29l-2.5-2.5L0 8.29.71 9l1.32-1.32C2.02 7.79 2 7.89 2 8c0 3.31 2.69 6 6 6 1.66 0 3.16-.67 4.24-1.76l-.71-.71C10.63 12.44 9.38 13 8 13z"/></svg> ' + $.lang[LANG]['config.form.date.excludeDate.clear'] + '</div>\ 31183 <input type="hidden" id="select-calendar" value="etc-except-date-picker">\ 31184 <input type="hidden" class="etc-date" id="etc-except-date" value="">\ 31185 <input type="hidden" id="etc-start-date-txt" value="' + startDate + '">\ 31186 <input type="hidden" id="etc-end-date-txt" value="' + endDate + '">\ 31187 <input type="hidden" id="etc-date-week" value="' + dateWeek + '">\ 31188 <input type="hidden" id="select-except-date" value="' + exceptDate + '">\ 31189 <input type="hidden" id="term-days" value="' + term.days + '">\ 31190 <div id="etc-except-date-picker"></div>\ 31191 </div>\ 31192 <div class="term-setting hide" data-blocklang="' + blocklang + '">\
31193 <span class="start-date"></span> ~ <span class="end-date"></span>\ 31194 </div>\ 31195 '; 31196 break; 31197 case 'time': 31198 modal_title = $.lang[LANG]['config.form.date2.time']; 31199 modal_class += ' setting-times'; 31200 modal_str = '\ 31201 <div class="guide-wrap">\ 31202 <div class="display-flex align-items-center setting-row">\ 31203 <div class="setting-label">' + $.lang[LANG]['config.form.date2.time.interval.label'] + '</div>\ 31204 <div class="newcheckbox hand">\ 31205 <label>\ 31206 <div class="newcheckboxSvgRadio">\ 31207 <input type="radio" class="cl-common-form-radio-hide" name="time_interval" value="60">\ 31208 <svg viewBox="0 0 18 18" width="18" height="18">\ 31209 <path d="M9 0C4.03 0 0 4.03 0 9c0 4.97 4.03 9 9 9s9-4.03 9-9C18 4.03 13.97 0 9 0zM9 17c-4.41 0-8-3.59-8-8 0-4.41 3.59-8 8-8s8 3.59 8 8C17 13.41 13.41 17 9 17z"></path>\ 31210 </svg>\ 31211 <svg class="active" viewBox="0 0 18 18" width="18" height="18">\ 31212 <path d="M9 0C4.03 0 0 4.03 0 9c0 4.97 4.03 9 9 9s9-4.03 9-9C18 4.03 13.97 0 9 0zM9 17c-4.41 0-8-3.59-8-8 0-4.41 3.59-8 8-8s8 3.59 8 8C17 13.41 13.41 17 9 17z"></path>\ 31213 <circle cx="9" cy="9" r="6"></circle>\ 31214 </svg>\ 31215 </div>\ 31216 <span>' + $.lang[LANG]['config.form.date2.time.interval.60'] + '</span>\ 31217 </label>\ 31218 </div>\ 31219 <div class="newcheckbox hand">\ 31220 <label>\ 31221 <div class="newcheckboxSvgRadio">\ 31222 <input type="radio" class="cl-common-form-radio-hide" name="time_interval" value="30" checked>\ 31223 <svg viewBox="0 0 18 18" width="18" height="18">\ 31224 <path d="M9 0C4.03 0 0 4.03 0 9c0 4.97 4.03 9 9 9s9-4.03 9-9C18 4.03 13.97 0 9 0zM9 17c-4.41 0-8-3.59-8-8 0-4.41 3.59-8 8-8s8 3.59 8 8C17 13.41 13.41 17 9 17z"></path>\ 31225 </svg>\ 31226 <svg class="active" viewBox="0 0 18 18" width="18" height="18">\ 31227 <path d="M9 0C4.03 0 0 4.03 0 9c0 4.97 4.03 9 9 9s9-4.03 9-9C18 4.03 13.97 0 9 0zM9 17c-4.41 0-8-3.59-8-8 0-4.41 3.59-8 8-8s8 3.59 8 8C17 13.41 13.41 17 9 17z"></path>\ 31228 <circle cx="9" cy="9" r="6"></circle>\ 31229 </svg>\ 31230 </div>\ 31231 <span>' + $.lang[LANG]['config.form.date2.time.interval.30'] + '</span>\ 31232 </label>\ 31233 </div>\ 31234 <div class="newcheckbox hand">\ 31235 <label>\ 31236 <div class="newcheckboxSvgRadio">\ 31237 <input type="radio" class="cl-common-form-radio-hide" name="time_interval" value="20">\ 31238 <svg viewBox="0 0 18 18" width="18" height="18">\ 31239 <path d="M9 0C4.03 0 0 4.03 0 9c0 4.97 4.03 9 9 9s9-4.03 9-9C18 4.03 13.97 0 9 0zM9 17c-4.41 0-8-3.59-8-8 0-4.41 3.59-8 8-8s8 3.59 8 8C17 13.41 13.41 17 9 17z"></path>\ 31240 </svg>\ 31241 <svg class="active" viewBox="0 0 18 18" width="18" height="18">\ 31242 <path d="M9 0C4.03 0 0 4.03 0 9c0 4.97 4.03 9 9 9s9-4.03 9-9C18 4.03 13.97 0 9 0zM9 17c-4.41 0-8-3.59-8-8 0-4.41 3.59-8 8-8s8 3.59 8 8C17 13.41 13.41 17 9 17z"></path>\ 31243 <circle cx="9" cy="9" r="6"></circle>\ 31244 </svg>\ 31245 </div>\ 31246 <span>' + $.lang[LANG]['config.form.date2.time.interval.20'] + '</span>\ 31247 </label>\ 31248 </div>\ 31249 <div class="newcheckbox hand">\ 31250 <label>\ 31251 <div class="newcheckboxSvgRadio">\ 31252 <input type="radio" class="cl-common-form-radio-hide" name="time_interval" value="10">\ 31253 <svg viewBox="0 0 18 18" width="18" height="18">\ 31254 <path d="M9 0C4.03 0 0 4.03 0 9c0 4.97 4.03 9 9 9s9-4.03 9-9C18 4.03 13.97 0 9 0zM9 17c-4.41 0-8-3.59-8-8
312540-4.41 3.59-8 8-8s8 3.59 8 8C17 13.41 13.41 17 9 17z"></path>\ 31255 </svg>\ 31256 <svg class="active" viewBox="0 0 18 18" width="18" height="18">\ 31257 <path d="M9 0C4.03 0 0 4.03 0 9c0 4.97 4.03 9 9 9s9-4.03 9-9C18 4.03 13.97 0 9 0zM9 17c-4.41 0-8-3.59-8-8 0-4.41 3.59-8 8-8s8 3.59 8 8C17 13.41 13.41 17 9 17z"></path>\ 31258 <circle cx="9" cy="9" r="6"></circle>\ 31259 </svg>\ 31260 </div>\ 31261 <span>' + $.lang[LANG]['config.form.date2.time.interval.10'] + '</span>\ 31262 </label>\ 31263 </div>\ 31264 </div>\ 31265 <div class="setting-row am">\ 31266 <label for="all-time-select" class="all-time display-flex align-items-center">\ 31267 <div class="newcheckbox hand">\ 31268 <input id="all-time-select" class="hide" type="checkbox">\ 31269 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\ 31270 <path d="M13 0H3C1.3 0 0 1.3 0 3v10c0 1.7 1.3 3 3 3h10c1.7 0 3-1.3 3-3V3C16 1.3 14.7 0 13 0zM15 13c0 1.1-0.9 2-2 2H3c-1.1 0-2-0.9-2-2V3c0-1.1 0.9-2 2-2h10c1.1 0 2 0.9 2 2V13z"/>\ 31271 </svg>\ 31272 <svg class="active" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\ 31273 <path d="M13 0H3C1.34 0 0 1.34 0 3v10c0 1.66 1.34 3 3 3h10c1.66 0 3-1.34 3-3V3C16 1.34 14.66 0 13 0zM13.03 6.03l-5.5 5.5C7.38 11.68 7.19 11.75 7 11.75s-0.38-0.07-0.53-0.22l-3.5-3.5c-0.29-0.29-0.29-0.77 0-1.06s0.77-0.29 1.06 0L7 9.94l4.97-4.97c0.29-0.29 0.77-0.29 1.06 0S13.32 5.74 13.03 6.03z"/>\ 31274 </svg>\ 31275 </div>\ 31276 <span>' + $.lang[LANG]['config.form.date2.time.selectAll'] + '</span>\ 31277 </label>\ 31278 <div class="setting-label">' + $.lang[LANG]['config.form.date2.time.am'] + '</div>\ 31279 <div class="display-flex time-interval" data-time="am"></div>\ 31280 </div>\ 31281 <div class="setting-row">\ 31282 <div class="setting-label">' + $.lang[LANG]['config.form.date2.time.pm'] + '</div>\ 31283 <div class="display-flex time-interval" data-time="pm"></div>\ 31284 </div>\ 31285 </div>\ 31286 '; 31287 break; 31288 } 31289 31290 var settingModal = $(el).showModalFlat(modal_title, modal_str, true, true, function() { //confirm 31291 var postData = {}; 31292 switch (func) { 31293 case 'term': 31294 if (!$('#etc-start-date-txt').val() || !$('#etc-end-date-txt').val()) { 31295 alert('ë ì§ ê¸°ê°ì ì íí´ì£¼ì¸ì.'); 31296 return false; 31297 } 31298 var days = new Array(); 31299 $('input[name="day"]:checked').each(function(i, v) { 31300 days.push($(v).val()); 31301 }); 31302 postData = { 31303 'term': { 31304 'select_terms': 'Y', 31305 'date_week': $('#etc-date-week').val(), 31306 'start_date': $('#etc-start-date-txt').val(), 31307 'end_date': $('#etc-end-date-txt').val(), 31308 'days': (days.length > 0) ? days.join('|') : '' 31309 } 31310 }; 31311 31312 startDate = $('#etc-start-date-txt').val(); 31313 endDate = $('#etc-end-date-txt').val(); 31314 31315 if (field_type.indexOf('etc-product-date') > -1 && startDate && endDate) { //etc product 31316 $('#etc-week').val($('#etc-date-week').val()); 31317 $('#etc-start-date').val(startDate); 31318 $('#etc-end-date').val(endDate); 31319 $('#etc-term').val(JSON.stringify(postData.term)); 31320 $('.term-setting .setting-text .content').text(startDate + ' ~ ' + endDate); 31321 } 31322 31323 break; 31324 case 'saleStartDateTime': 31325 case 'saleEndDateTime': 31326 var selectedDate = $('#select-date-ymd').val(); 31327 31328 if (!selectedDate || $('.time-interval input:checked').length == 0) { 31329 alert('ë ì§ì ìê°ì ì íí´ì£¼ì¸ì.'); 31330 return false;
31331 } 31332 31333 if (!selectedDate || $('.time-interval input:checked').length == 0) { 31334 alert('ë ì§ì ìê°ì ì íí´ì£¼ì¸ì.'); 31335 return false; 31336 } 31337 31338 var mna = $('.time-interval input:checked').parent().attr('data-time'); 31339 var selectedTime = convertTime24(mna, $('.time-interval input:checked').val()); 31340 var saleDateTime = selectedDate + '. ' + convertTime12(selectedTime); 31341 var saleDateTimeVal = selectedDate.replace(/\./g, '-') + ' ' + selectedTime + ':00'; 31342 console.log(selectedTime); 31343 if(func == 'saleStartDateTime') { 31344 var startDateTime = new Date(saleDateTimeVal); 31345 var currentDateTime = new Date(); 31346 31347 if($('#sale-end-datetime').val()) { 31348 var endDateTime = new Date($('#sale-end-datetime').val()); 31349 if(endDateTime <= startDateTime) { 31350 startDateTime.setHours(startDateTime.getHours() + 1); 31351 console.log(startDateTime); 31352 var endDateTimeVal = convertDateObjToStr(startDateTime); 31353 var endDateTime = endDateTimeVal.split(' '); 31354 31355 $('#sale-end-datetime').val(endDateTimeVal); 31356 $('.sale-setting .setting-text .content-end').text(endDateTime[0] + '. ' + convertTime12(endDateTime[1])); 31357 } 31358 } 31359 31360 $('.sale-setting .setting-text .content-start').text(saleDateTime); 31361 $('#sale-start-datetime').val(saleDateTimeVal); 31362 } else { 31363 var endDateTime = new Date(saleDateTimeVal); 31364 31365 if($('#sale-start-datetime').val()) { 31366 var startDateTime = new Date($('#sale-start-datetime').val()); 31367 if(startDateTime >
31367= endDateTime) { 31368 alert('í매 ìì ìê°ë³´ë¤ ëì¤ ìê°ì ì íí´ ì£¼ì¸ì.'); 31369 return false; 31370 } 31371 } 31372 31373 $('.sale-setting .setting-text .content-end').text(saleDateTime); 31374 $('#sale-end-datetime').val(saleDateTimeVal); 31375 } 31376 31377 break; 31378 case 'excludeDate': 31379 postData = { 31380 'excludeDate': { 31381 'date': $('#select-except-date').val(), 31382 } 31383 }; 31384 31385 if (field_type.indexOf('etc-product-date') > -1) { //etc product 31386 if ($('#select-except-date').val()) { 31387 $('#etc-exclude-date').val($('#select-except-date').val()); 31388 $('.exclude-setting .setting-text .content').text($('#select-except-date').val()); 31389 $('.exclude-setting .setting-text').attr('data-toggle', 'tooltip'); 31390 $('.exclude-setting .setting-text').attr('data-original-title', "<div class='except-date-tooltip'>" + $('#select-except-date').val() + "</div>"); 31391 } else { 31392 $('#etc-exclude-date').val(''); 31393 $('.exclude-setting .setting-text .content').text(''); 31394 $('.exclude-setting .setting-text').removeAttr('data-toggle'); 31395 $('.exclude-setting .setting-text').removeAttr('data-original-title'); 31396 } 31397 } 31398 break; 31399 case 'time': 31400 if ($('.time-interval input:checked').length == 0) { 31401 alert($.lang[LANG]['config.form.date2.time.excludeAll']); 31402 return false; 31403 } 31404 31405 var interval = $('input[name="time_interval"]:checked').val(); 31406 var am = new Array(); 31407 var pm = new Array(); 31408 $('input[name="am"]:checked').each(function(i, v) { 31409 // if ($(v).next('label').hasClass('hide')) { 31410 // return true; 31411 // } 31412 am.push($(v).val()); 31413 }); 31414 $('input[name="pm"]:checked').each(function(i, v) { 31415 // if ($(v).next('label').hasClass('hide')) { 31416 // return true; 31417 // } 31418 pm.push($(v).val()); 31419 }); 31420 postData = { 31421 'time': { 31422 'interval': interval, 31423 'am': (am.length > 0) ? am.join('|') : '', 31424 'pm': (pm.length > 0) ? pm.join('|') : '', 31425 } 31426 }; 31427 31428 if (field_type.indexOf('etc-product-date') > -1) { 31429 $('#etc-time').val(JSON.stringify(postData.time)); 31430 } 31431 break; 31432 } 31433 // console.log(id, postData); 31434 // console.log('field_type', field_type); 31435 if (field_type.indexOf('etc-product-date') == -1 && field_type.indexOf('sale-product-datetime') == -1) { //form date 31436 var settings = { 31437 'type': 'val', 31438 'value': JSON.stringify(postData), 31439 } 31440 31441 if (itemsAjax) itemsAjax.abort(); 31442 itemsAjax = $.ajax({ 31443 url: "/template/forms/items", 31444 async: true, 31445 type: "post", 31446 dataType: "json", 31447 data: { 31448 sid: SID, 31449 id: id, 31450 field: field_type, 31451 val_type: func, 31452 settings: settings 31453 }, 31454 success: function(data) { 31455 checkError(data); 31456 initDateTimeConf(SID, id, field_type); 31457 } 31458 }); 31459 } 31460 31461 31462 // saveFormElement(); 31463 settingModal.modal('hide'); 31464 }, 'cancel', 'ok', modal_class, true, function() { //close 31465 if (func == 'term' && (!$('#etc-start-date-txt').val() || !$('#etc-end-date-txt').val())) { 31466 if (!$('#etc-start-date-prev').val() && !$('#etc-end-date-prev').val()) { 31467 $('input[name="select_terms-' + id + '"][value="N"]').prop('checked', true); 31468 $('.form-sort-item[data-id="' + id + '"] .setting-date2[data-setting="term"]').addClass('disabled'); 31469 } 31470 } 31471 settingModal.modal('hide'); 31472 }, function() { //show 31473 if (field_type.indexOf('etc-product-date') > -1) { 31474 startDate = $('#etc-start-date').val(); 31475 endDate = $('#etc-end-date').val(); 31476 lang = 'ko'; 31477 $('#etc-start-date-txt').val(startDate); 31478 $('#etc-end-date-txt').val(endDate); 31479 } 31480 31481 if (startDate && endDate) { 31482 var checkStartDate = startDate.split('.'); 31483 var checkEndDate = endDate.split('.'); 31484 31485 $('.term-setting').removeClass('hide'); 31486 if (blocklang == 'ko') {
31487 $('.term-setting .start-date').text(checkStartDate[0] + 'ë ' + checkStartDate[1] + 'ì ' + checkStartDate[2] + ' ì¼'); 31488 $('.term-setting .end-date').text(checkEndDate[0] + 'ë ' + checkEndDate[1] + 'ì ' + checkEndDate[2] + ' ì¼'); 31489 } else { 31490 $('.term-setting .start-date').text(checkStartDate[1] + '/' + checkStartDate[2] + '/' + checkStartDate[0]); 31491 $('.term-setting .end-date').text(checkEndDate[1] + '/' + checkEndDate[2] + '/' + checkEndDate[0]); 31492 } 31493 } 31494 // console.log(language); 31495 $('#term-datepicker').html(''); 31496 var currentYear = new Date().getFullYear(); 31497 switch (func) { 31498 case 'term': 31499 var termPicker = new Datepickk({ 31500 container: document.querySelector('#term-datepicker'), 31501 inline: true, 31502 range: true, 31503 exp: false, 31504 lang: language, 31505 startDate: (startDate.replace(/\./g, '/')) ? new Date(startDate.replace(/\./g, '/')) : new Date(), 31506 minDate: new Date(1900, 0, 1), 31507 maxDate: new Date(currentYear + 15, 11, 31), 31508 }); 31509 31510 if (dateWeek) { 31511 $('.btn-group.week label').removeClass('checked'); 31512 $('input[value="' + dateWeek + '"]').prop('checked', true); 31513 $('input[value="' + dateWeek + '"]').closest('label').addClass('checked'); 31514 disabled = (days.length > 0) ? getDisabledDays(days) : []; 31515 termPicker.disabledDays = (disabled.length > 0) ? disabled : null; 31516 } 31517 31518 if (startDate && endDate) { 31519 $('input[name="day"]').prop('checked', false); 31520 $('input[name="day"]').closest('label').removeClass('checked'); 31521 termPicker.setSelectedDates(startDate, 'start'); 31522 termPicker.setSelectedDates(endDate, 'end'); 31523 } 31524 31525 if (days) { 31526 $.each(days, function(i, v) { 31527 $('input[value="' + v + '"]').prop('checked', true); 31528 $('input[value="' + v + '"]').closest('label').addClass('checked'); 31529 }); 31530 } 31531 $('input[name="week"]').on('change', function() { 31532 var value = $(this).val(); 31533 $('#etc-date-week').val(value); 31534 $('.btn-group.week label').removeClass('checked'); 31535 if ($(this).is(':checked')) $(this).closest('label').addClass('checked'); 31536 termPicker.disabledDays = null; 31537 $('#etc-start-date-txt').val(''); 31538 $('#etc-end-date-txt').val(''); 31539 if (field_type.indexOf('etc-product-date') == -1) $('.term-setting').addClass('hide'); 31540 switch (value) { 31541 case 'A': 31542 $('input[name="day"]').prop('checked', true); 31543 $('input[name="day"]').closest('label').addClass('checked'); 31544 termPicker.disabledDays = null; 31545 break; 31546 case 'W': 31547 $('input[name="day"][value="sat"], input[name="day"][value="sun"]').prop('checked', false) 31548 $('input[name="day"][value="sat"], input[name="day"][value="sun"]').closest('label').removeClass('checked'); 31549 $('input[name="day"]').not('[value="sat"],[value="sun"]').prop('checked', true); 31550 $('input[name="day"]').not('[value="sat"],[value="sun"]').closest('label').addClass('checked'); 31551 termPicker.disabledDays = [0, 6]; 31552 break; 31553 case 'K': 31554 $('input[name="day"][value="sat"], input[name="day"][value="sun"]').prop('checked', true); 31555 $('input[name="day"][value="sat"], input[name="day"][value="sun"]').closest('label').addClass('checked'); 31556 $('input[name="day"]').not('[value="sat"],[value="sun"]').prop('checked', false); 31557 $('input[name="day"]').not('[value="sat"],[value="sun"]').closest('label').removeClass('checked'); 31558 termPicker.disabledDays = [1, 2, 3, 4, 5]; 31559 break; 31560 } 31561 31562 termPicker.setSelectedDates($('#etc-start-date-txt').val(), 'start'); 31563 termPicker.setSelectedDates($('#etc-end-date-txt').val(), 'end'); 31564 }); 31565 31566 $('input[name="day"]').on('change', function() { 31567 if ($(this).is(':checked')) $(this).closest('label').addClass('checked'); 31568 else $(this).closest('label').removeClass('checked'); 31569 31570 if ($('input[name="day"]:checked').length == 0) { 31571 alert($.lang[LANG]['config.form.date.day.excludeAll']); 31572 $(this).prop('checked', true); 31573 $(this).closest('label').addClass('checked'); 31574 return false;
31575 } 31576 31577 termPicker.disabledDays = null; 31578 disabled = getDisabledDays(); 31579 31580 termPicker.disabledDays = disabled; 31581 termPicker.setSelectedDates($('#etc-start-date-txt').val(), 'start'); 31582 termPicker.setSelectedDates($('#etc-end-date-txt').val(), 'end'); 31583 }); 31584 break; 31585 case 'excludeDate': 31586 var disabled = null; 31587 if (dateWeek == 'W') { 31588 disabled = [0, 6]; 31589 } else if (dateWeek == 'K') { 31590 disabled = [1, 2, 3, 4, 5]; 31591 } 31592 if (days.length > 0) { 31593 disabled = [0, 1, 2, 3, 4, 5, 6]; 31594 $.each(days, function(i, v) { 31595 enableIdx = disabled.indexOf(daysObj[v]); 31596 if (enableIdx > -1) { 31597 disabled.splice(enableIdx, 1); 31598 } 31599 }); 31600 } 31601 31602 var exceptPicker = new Datepickk({ 31603 container: document.querySelector('#etc-except-date-picker'), 31604 inline: true, 31605 exp: true, 31606 disabledDays: disabled, 31607 lang: language, 31608 minDate: new Date(1900, 0, 1), 31609 maxDate: new Date(currentYear + 15, 11, 31), 31610 }); 31611 31612 exceptPicker.disabledDays = (disabled.length > 0) ? disabled : null; 31613 31614 if (startDate && endDate) { 31615 var checkStartDate = startDate.split('.'); 31616 var checkEndDate = endDate.split('.'); 31617 31618 exceptPicker.minDate = new Date(Number(checkStartDate[0]), Number(checkStartDate[1]) - 1, Number(checkStartDate[2])); 31619 exceptPicker.maxDate = new Date(Number(checkEndDate[0]), Number(checkEndDate[1]) - 1, Number(checkEndDate[2])); 31620 } 31621 31622 displaySelectedDates(); 31623 31624 $('.unselect-all').on('click', function() { 31625 $('#select-except-date').val(''); 31626 $('#etc-except-date-picker input').prop('checked', false); 31627 $('#etc-except-date-picker input').removeClass('active'); 31628 }); 31629 31630 break; 31631 case 'saleStartDateTime': 31632 case 'saleEndDateTime': 31633 var saleStartDateTime = $('#sale-start-datetime').val(); 31634 var saleEndDateTime = $('#sale-end-datetime').val(); 31635 startDate = saleStartDateTime.split(' ')[0]; 31636 endDate = saleEndDateTime.split(' ')[0]; 31637 var startTime = saleStartDateTime.split(' ')[1]; 31638 var endTime = saleEndDateTime.split(' ')[1]; 31639 31640 var currentDateTime = new Date(); 31641 currentDateTime.setDate(currentDateTime.getDate() - 1); 31642 // console.log('currentDateTime', currentDateTime, new Date()); 31643 31644 var datepickkObj = { 31645 container: document.querySelector('#sale-datepicker'), 31646 inline: true, 31647 range: false, 31648 exp: false, 31649 lang: language, 31650 startDate: (startDate)? startDate : currentDateTime, 31651 minDate: currentDateTime, 31652 maxDate: new Date(currentYear + 15, 11, 31), 31653 }; 31654 31655 if(func == 'saleStartDateTime') { 31656 if(saleStartDateTime) { 31657 $('#select-date-ymd').val(startDate.replace(/-/g, '.')); 31658 } else { 31659 $('.setting-sale-date').addClass('open'); 31660 } 31661 } 31662 console.log('currentDateTime', currentDateTime); 31663 if(func == 'saleEndDateTime') { 31664 var datepickk_startDate = currentDateTime; 31665 31666 if(saleStartDateTime) { 31667 datepickk_startDate = (new Date() > new Date(saleStartDateTime))? new Date() : new Date(saleStartDateTime.replace(/-/g, '/')); 31668 console.log('datepickk_startDate', datepickk_startDate); 31669 datepickk_startDate.setDate(datepickk_startDate.getDate() - 1); 31670 } 31671 if(saleEndDateTime) { 31672 $('#select-date-ymd').val(endDate.replace(/-/g, '.')); 31673 if(new Date() > new Date(saleEndDateTime)) { 31674 datepickk_startDate = new Date(); 31675 datepickk_startDate.setDate(datepickk_startDate.getDate() - 1); 31676 } 31677 } else { 31678 $('.setting-sale-date').addClass('open'); 31679 } 31680 31681 datepickkObj = { 31682 container: document.querySelector('#sale-datepicker'), 31683 inline: true, 31684 range: false, 31685 exp: false, 31686 lang: language, 31687 startDate: (endDate)? endDate : datepickk_startDate, 31688 minDate: datepickk_startDate, 31689 maxDate: new Date(currentYear + 15, 11, 31), 31690 }; 31691 } 31692 var termPicker = new Datepickk(datepickkObj); 31693 displaySelectedDates(); 31694 31695 $('.time-interval').each(function(i, v) { 31696 var mna = $(v).data('time'); 31697 var times = '\ 31698 <input type="radio" id="' + mna + '-12-00" class="hide" name="sale_time" value="1200">\ 31699 <label for="' + mna + '-12-00">12:00</label>\ 31700 <input type="radio" id="' + mna + '-12-30" class="half-time hide" name="sale_time" value="1230">\ 31701 <label for="' + mna + '-12-30" class="half-time">12:30</label>\ 31702 \ 31703 <input type="radio" id="' + mna + '-1-00" class="hide" name="sale_time" value="
317030100">\ 31704 <label for="' + mna + '-1-00">1:00</label>\ 31705 <input type="radio" id="' + mna + '-1-30" class="half-time hide" name="sale_time" value="0130">\ 31706 <label for="' + mna + '-1-30" class="half-time">1:30</label>\ 31707 \ 31708 <input type="radio" id="' + mna + '-2-00" class="hide" name="sale_time" value="0200">\ 31709 <label for="' + mna + '-2-00">2:00</label>\ 31710 <input type="radio" id="' + mna + '-2-30" class="half-time hide" name="sale_time" value="0230">\ 31711 <label for="' + mna + '-2-30" class="half-time">2:30</label>\ 31712 \ 31713 <input type="radio" id="' + mna + '-3-00" class="hide" name="sale_time" value="0300">\ 31714 <label for="' + mna + '-3-00">3:00</label>\ 31715 <input type="radio" id="' + mna + '-3-30" class="half-time hide" name="sale_time" value="0330">\ 31716 <label for="' + mna + '-3-30" class="half-time">3:30</label>\ 31717 \ 31718 <input type="radio" id="' + mna + '-4-00" class="hide" name="sale_time" value="
317180400">\ 31719 <label for="' + mna + '-4-00">4:00</label>\ 31720 <input type="radio" id="' + mna + '-4-30" class="half-time hide" name="sale_time" value="0430">\ 31721 <label for="' + mna + '-4-30" class="half-time">4:30</label>\ 31722 \ 31723 <input type="radio" id="' + mna + '-5-00" class="hide" name="sale_time" value="0500">\ 31724 <label for="' + mna + '-5-00">5:00</label>\ 31725 <input type="radio" id="' + mna + '-5-30" class="half-time hide" name="sale_time" value="0530">\ 31726 <label for="' + mna + '-5-30" class="half-time">5:30</label>\ 31727 \ 31728 <input type="radio" id="' + mna + '-6-00" class="hide" name="sale_time" value="0600">\ 31729 <label for="' + mna + '-6-00">6:00</label>\ 31730 <input type="radio" id="' + mna + '-6-30" class="half-time hide" name="sale_time" value="0630">\ 31731 <label for="' + mna + '-6-30" class="half-time">6:30</label>\ 31732 \ 31733 <input type="radio" id="' + mna + '-7-00" class="hide" name="sale_time" value="
317330700">\ 31734 <label for="' + mna + '-7-00">7:00</label>\ 31735 <input type="radio" id="' + mna + '-7-30" class="half-time hide" name="sale_time" value="0730">\ 31736 <label for="' + mna + '-7-30" class="half-time">7:30</label>\ 31737 \ 31738 <input type="radio" id="' + mna + '-8-00" class="hide" name="sale_time" value="0800">\ 31739 <label for="' + mna + '-8-00">8:00</label>\ 31740 <input type="radio" id="' + mna + '-8-30" class="half-time hide" name="sale_time" value="0830">\ 31741 <label for="' + mna + '-8-30" class="half-time">8:30</label>\ 31742 \ 31743 <input type="radio" id="' + mna + '-9-00" class="hide" name="sale_time" value="0900">\ 31744 <label for="' + mna + '-9-00">9:00</label>\ 31745 <input type="radio" id="' + mna + '-9-30" class="half-time hide" name="sale_time" value="0930">\ 31746 <label for="' + mna + '-9-30" class="half-time">9:30</label>\ 31747 \ 31748 <input type="radio" id="' + mna + '-10-00" class="hide" name="sale_time" value="1000">\ 31749 <label for="' + mna + '-10-00">10:00</label>\ 31750 <input type="radio" id="' + mna + '-10-30" class="half-time hide" name="sale_time" value="1030">\ 31751 <label for="' + mna + '-10-30" class="half-time">10:30</label>\ 31752 \ 31753 <input type="radio" id="' + mna + '-11-00" class="hide" name="sale_time" value="1100">\ 31754 <label for="' + mna + '-11-00">11:00</label>\ 31755 <input type="radio" id="' + mna + '-11-30" class="half-time hide" name="sale_time" value="1130">\ 31756 <label for="' + mna + '-11-30" class="half-time">11:30</label>\ 31757 '; 31758 $(v).html(times); 31759 }); //end each 31760 31761 $('input[name="time_interval"][value="' + interval + '"]').prop('checked', true); 31762 31763 if(func == 'saleStartDateTime' && saleStartDateTime) { 31764 var hour = parseInt(startTime.split(':')[0]); 31765 var minute = parseInt(startTime.split(':')[1]); 31766 var mna = 'am'; 31767 if(hour >= 12) { 31768 if (hour > 12) hour -= 12; 31769 mna = 'pm'; 31770 } else if (hour == 0) hour += 12 31771 var formattedTime = hour.toString().padStart(2, '0') + minute.toString().padStart(2, '0'); 31772 $('.time-interval[data-time="' + mna + '"] input[value="' + formattedTime + '"]').prop('checked', true); 31773 getDateTimeStr(language); 31774 } 31775 31776 if(func == 'saleEndDateTime') { 31777 if(saleStartDateTime && startDate == endDate) { 31778 var hour = parseInt(startTime.split(':')[0]); 31779 var minute = parseInt(startTime.split(':')[1]); 31780 var mna = (hour >= 12)? 'pm' : 'am'; 31781 31782 if(hour >= 12) { 31783 if (hour > 12) hour -= 12; 31784 } else if (hour == 0) hour += 12 31785 31786 var formattedStartTime = hour.toString().padStart(2, '0') + minute.toString().padStart(2, '0'); 31787 $('.time-interval[data-time="' + mna + '"] input[value="' + formattedStartTime + '"]').prop('disabled', true); 31788 if(mna == 'pm') { 31789 $('.time-interval[data-time="am"] input').prop('disabled', true); 31790 $('.time-interval[data-time="pm"] input[value="' + formattedStartTime + '"]').prevAll('input').prop('disabled', true); 31791 } else { 31792 $('.time-interval[data-time="am"] input[value="' + formattedStartTime + '"]').prevAll('input').prop('disabled', true); 31793 } 31794 } 31795 if(saleEndDateTime) { 31796 var hour = parseInt(endTime.split(':')[0]); 31797 var minute = parseInt(endTime.split(':')[1]); 31798 var mna = 'am'; 31799 if(hour >= 12) { 31800 if (hour > 12) hour -= 12; 31801 mna = 'pm'; 31802 } else if (hour == 0) hour += 12 31803 var formattedTime = hour.toString().padStart(2, '0') + minute.toString().padStart(2, '0'); 31804 $('.time-interval[data-time="' + mna + '"] input[value="' + formattedTime + '"]').prop('checked', true); 31805 getDateTimeStr(language); 31806 } 31807 } 31808 31809 var time_interval = $('input[name="time_interval"]:checked').val(); 31810 31811 switch (time_interval) { 31812 case 10: 31813 dateTimeModal.find('.time-interval label.ten-time').removeClass('hide'); 31814 break; 31815 case 20: 31816 dateTimeModal.find('.time-interval label.twt-time').removeClass('hide'); 31817 break; 31818 case 30: 31819 dateTimeModal.find('.time-interval label.half-time').removeClass('hide'); 31820 break; 31821 case 60: 31822 dateTimeModal.find('.time-interval label').removeClass('hide'); 31823 break; 31824 } 31825 31826 $('input[name="time_interval"]').on('change', function() { 31827 if ($(this).val() == 60) { 31828 $('.time-interval label.half-time').addClass('hide'); 31829 if ($('#all-time-select').is(':checked')) { 31830 $('.time-interval input.o-time').prop('checked', true); 31831 } 31832 } else { //30 31833 $('.time-interval label.half-time').removeClass('hide'); 31834 if ($('#all-time-select').is(':checked')) { 31835 $('.time-interval input').prop('checked', true); 31836 } 31837 } 31838 }); 31839 31840 $('.time-interval input').on('change', function(){ 31841 getDateTimeStr(language, 'time'); 31842 }); 31843 31844 $('.sale-calendar-box .setting-label').on('click', function(){ 31845 var $saleCalendarBox = $(this).closest('.sale-calendar-box'); 31846
31847 if($saleCalendarBox.hasClass('open')) { 31848 $('.sale-calendar-box .setting-datetime-input').slideUp(400, function(){ 31849 $('.sale-calendar-box').removeClass('open'); 31850 }); 31851 } else{ 31852 $('.sale-calendar-box .setting-datetime-input').slideUp(400, function(){ 31853 $('.sale-calendar-box').removeClass('open'); 31854 }); 31855 31856 $saleCalendarBox.find('.setting-datetime-input').slideDown(400, function(){ 31857 $saleCalendarBox.addClass('open'); 31858 }); 31859 } 31860 }); 31861 31862 break; 31863 case 'time': 31864 $('.time-interval').each(function(i, v) { 31865 var mna = $(v).data('time'); 31866 var times = '\ 31867 <input type="checkbox" id="'+mna+'-12-00" class="o-time hide" name="'+mna+'" value="1200">\ 31868 <label for="'+mna+'-12-00" class="o-time">12:00</label>\ 31869 \ 31870 <input type="checkbox" id="'+mna+'-12-10" class="ten-time hide" name="'+mna+'" value="1210">\ 31871 <label for="'+mna+'-12-10" class="ten-time">12:10</label>\ 31872 \ 31873 <input type="checkbox" id="'+mna+'-12-20" class="ten-time twt-time hide" name="'+mna+'" value="1220">\ 31874 <label for="'+mna+'-12-20" class="ten-time twt-time">12:20</label>\ 31875 \ 31876 <input type="checkbox" id="'+mna+'-12-30" class="ten-time half-time hide" name="'+mna+'" value="1230">\ 31877 <label for="'+mna+'-12-30" class="ten-time half-time">12:30</label>\ 31878 \ 31879 <input type="checkbox" id="'+mna+'-12-40" class="ten-time twt-time hide" name="'+mna+'" value="1240">\ 31880 <label for="'+mna+'-12-40" class="ten-time twt-time">12:40</label>\ 31881 \ 31882 <input type="checkbox" id="'+mna+'-12-50" class="ten-time hide" name="'+mna+'" value="1250">\ 31883 <label for="'+mna+'-12-50" class="ten-time">12:50</label>\ 31884 '; 31885 31886 for(let t = 1; t <= 11; t++) { 31887 let hstr = t.toString().padStart(2, '0'); 31888 times += '\ 31889 <input type="checkbox" id="'+mna+'-'+t+'-00" class="o-time hide" name="'+mna+'" value="'+hstr+'00">\ 31890 <label for="'+mna+'-'+t+'-00" class="o-time">'+t+':00</label>\ 31891 \ 31892 <input type="checkbox" id="'+mna+'-'+t+'-10" class="ten-time hide" name="'+mna+'" value="'+hstr+'10">\ 31893 <label for="'+mna+'-'+t+'-10" class="ten-time">'+t+':10</label>\ 31894 \ 31895 <input type="checkbox" id="'+mna+'-'+t+'-20" class="ten-time twt-time hide" name="'+mna+'" value="'+hstr+'20">\ 31896 <label for="'+mna+'-'+t+'-20" class="ten-time twt-time">'+t+':20</label>\ 31897 \ 31898 <input type="checkbox" id="'+mna+'-'+t+'-30" class="ten-time half-time hide" name="'+mna+'" value="'+hstr+'30">\ 31899 <label for="'+mna+'-'+t+'-30" class="ten-time half-time">'+t+':30</label>\ 31900 \ 31901 <input type="checkbox" id="'+mna+'-'+t+'-40" class="ten-time twt-time hide" name="'+mna+'" value="'+hstr+'40">\ 31902 <label for="'+mna+'-'+t+'-40" class="ten-time twt-time">'+t+':40</label>\ 31903 \ 31904 <input type="checkbox" id="'+mna+'-'+t+'-50" class="ten-time hide" name="'+mna+'" value="'+hstr+'50">\ 31905 <label for="'+mna+'-'+t+'-50" class="ten-time">'+t+':50</label>\ 31906 '; 31907 } 31908 // var times = '\ 31909 // <input type="checkbox" id="' + mna + '-12-00" class="hide" name="' + mna + '" value="1200">\ 31910 // <label for="' + mna + '-12-00">12:00</label>\ 31911 // <input type="checkbox" id="' + mna + '-12-30" class="half-time hide" name="' + mna + '" value="1230">\ 31912 // <label for="' + mna + '-12-30" class="half-time">12:30</label>\ 31913 // \ 31914 // <input type="checkbox" id="' + mna + '-1-00" class="hide" name="' + mna + '" value="
319140100">\ 31915 // <label for="' + mna + '-1-00">1:00</label>\ 31916 // <input type="checkbox" id="' + mna + '-1-30" class="half-time hide" name="' + mna + '" value="0130">\ 31917 // <label for="' + mna + '-1-30" class="half-time">1:30</label>\ 31918 // \ 31919 // <input type="checkbox" id="' + mna + '-2-00" class="hide" name="' + mna + '" value="0200">\ 31920 // <label for="' + mna + '-2-00">2:00</label>\ 31921 // <input type="checkbox" id="' + mna + '-2-30" class="half-time hide" name="' + mna + '" value="0230">\ 31922 // <label for="' + mna + '-2-30" class="half-time">2:30</label>\ 31923 // \ 31924 // <input type="checkbox" id="' + mna + '-3-00" class="hide" name="' + mna + '" value="0300">\ 31925 // <label for="' + mna + '-3-00">3:00</label>\ 31926 // <input type="checkbox" id="' + mna + '-3-30" class="half-time hide" name="' + mna + '" value="0330">\ 31927 // <label for="' + mna + '-3-30" class="half-time">3:30</label>\ 31928 // \ 31929 // <input type="checkbox" id="' + mna + '-4-00" class="hide" name="' + mna + '" value="0400">\ 31930 // <label for="' + mna + '-4-00">4:00</label>\ 31931 // <input type="checkbox" id="' + mna + '-4-30" class="half-time hide" name="' + mna + '" value="0430">\ 31932 // <label for="' + mna + '-4-30" class="half-time">4:30</label>\ 31933 // \ 31934 // <input type="checkbox" id="' + mna + '-5-00" class="hide" name="' + mna + '" value="0500">\ 31935 // <label for="' + mna + '-5-00">5:00</label>\ 31936 // <input type="checkbox" id="' + mna + '-5-30" class="half-time hide" name="' + mna + '" value="0530">\ 31937 // <label for="' + mna + '-5-30" class="half-time">5:30</label>\ 31938 // \ 31939 // <input type="checkbox" id="' + mna + '-6-00" class="hide" name="' + mna + '" value="0600">\ 31940 // <label for="' + mna + '-6-00">6:00</label>\ 31941 // <input type="checkbox" id="' + mna + '-6-30" class="half-time hide" name="' + mna + '" value="0630">\ 31942 // <label for="' + mna + '-6-30" class="half-time">6:30</label>\ 31943 // \ 31944 // <input type="checkbox" id="' + mna + '-7-00" class="hide" name="' + mna + '" value="0700">\ 31945 // <label for="' + mna + '-7-00">7:00</label>\ 31946 // <input type="checkbox" id="' + mna + '-7-30" class="half-time hide" name="' + mna + '" value="0730">\ 31947 // <label for="' + mna + '-7-30" class="half-time">7:30</label>\ 31948 // \ 31949 // <input type="checkbox" id="' + mna + '-8-00" class="hide" name="' + mna + '" value="0800">\ 31950 // <label for="' + mna + '-8-00">8:00</label>\ 31951 // <input type="checkbox" id="' + mna + '-8-30" class="half-time hide" name="' + mna + '" value="0830">\ 31952 // <label for="' + mna + '-8-30" class="half-time">8:30</label>\ 31953 // \ 31954 // <input type="checkbox" id="' + mna + '-9-00" class="hide" name="' + mna + '" value="0900">\ 31955 // <label for="' + mna + '-9-00">9:00</label>\ 31956 // <input type="checkbox" id="' + mna + '-9-30" class="half-time hide" name="' + mna + '" value="0930">\ 31957 // <label for="' + mna + '-9-30" class="half-time">9:30</label>\ 31958 // \ 31959 // <input type="checkbox" id="' + mna + '-10-00" class="hide" name="' + mna + '" value="1000">\ 31960 // <label for="' + mna + '-10-00">10:00</label>\ 31961 // <input type="checkbox" id="' + mna + '-10-30" class="half-time hide" name="' + mna + '" value="1030">\ 31962 // <label for="' + mna + '-10-30" class="half-time">10:30</label>\ 31963 // \ 31964 // <input type="checkbox" id="' + mna + '-11-00" class="hide" name="' + mna + '" value="1100">\ 31965 // <label for="' + mna + '-11-00">11:00</label>\ 31966 // <input type="checkbox" id="' + mna + '-11-30" class="half-time hide" name="' + mna + '" value="1130">\ 31967 // <label for="' + mna + '-11-30" class="half-time">11:30</label>\ 31968 // '; 31969 $(v).html(times); 31970 }); //end each 31971 31972 $('input[name="time_interval"][value="' + interval + '"]').prop('checked', true); 31973 if (am) { 31974 $.each(am, function(i, v) { 31975 $('.time-interval[data-time="am"] input[value="' + v + '"]').prop('checked', true); 31976 $('.time-interval[data-time="am"] input[value="' + v + '"] + label').addClass('ui-selected'); 31977 }); 31978 } 31979 if (pm) { 31980 $.each(pm, function(i, v) { 31981 $('.time-interval[data-time="pm"] input[value="' + v + '"]').prop('checked', true); 31982 $('.time-interval[data-time="pm"] input[value="' + v + '"] + label').addClass('ui-selected'); 31983 }); 31984 } 31985 31986 var time_interval = $('input[name="time_interval"]:checked').val(); 31987 // if (time_interval == 60) { 31988 // $('.time-interval label.half-time').addClass('hide'); 31989 // } else { //30 31990 // $('.time-interval label.half-time').removeClass('hide'); 31991 // } 31992 // console.log('time_interval', time_interval); 31993 $('.time-interval label:not(.o-time)').addClass('hide'); 31994 switch (time_interval) { 31995 case '10': 31996 $('.time-interval label').removeClass('hide'); 31997 break; 31998 case '20': 31999 $('.time-interval label.twt-time').removeClass('hide'); 32000 break; 32001 case '30': 32002 $('.time-interval label.half-time').removeClass('hide'); 32003 break; 32004 } 32005 32006 $('input[name="time_interval"]').on('change', function() { 32007 let time_interval = $(this).val(); 32008 // if ($(this).val() == 60) { 32009 // $('.time-interval label.half-time').addClass('hide'); 32010 // if ($('#all-time-select').is(':checked')) { 32011 // $('.time-interval input:not(.half-time)').prop('checked', true); 32012 // } 32013 // } else { //30 32014 // $('.time-interval label.half-time').removeClass('hide'); 32015 // if ($('#all-time-select').is(':checked')) { 32016 // $('.time-interval input').prop('checked', true); 32017 // } 32018 // } 32019 $('.time-interval label:not(.o-time)').addClass('hide'); 32020 32021 switch (time_interval) { 32022 case '10': 32023 $('.time-interval label').removeClass('hide'); 32024 if ($('#all-time-select').is(':checked')) { 32025 $('.time-interval input').prop('checked', true); 32026 $('.time-interval input + label').addClass('ui-selected'); 32027 } 32028 break; 32029 case '20': 32030 $('.time-interval label.twt-time').removeClass('hide'); 32031 if ($('#all-time-select').is(':checked')) { 32032 $('.time-interval input.twt-time').prop('checked', true); 32033 $('.time-interval input.twt-time + label').addClass('ui-selected'); 32034 32035 } 32036 break; 32037 case '30': 32038 $('.time-interval label.half-time').removeClass('hide'); 32039 if ($('#all-time-select').is(':checked')) { 32040 $('.time-interval input.half-time').prop('checked', true); 32041 } 32042 break; 32043 case '60': 32044 if ($('#all-time-select').is(':checked')) { 32045 $('.time-interval input.o-time').prop('checked', true); 32046 } 32047 break; 32048 } 32049 }); 32050 32051 isSelectedAllTimes(); 32052 32053 $('#all-time-select').change(function() { 32054 var time_interval = $('input[name="time_interval"]:checked').val(); 32055 if ($(this).is(':checked')) { 32056 $('.time-interval label').prev('input').prop('checked', true); 32057 $('.time-interval label').addClass('ui-selected'); 32058 } else { 32059 $('.time-interval input').prop('checked', false); 32060 $('.time-interval label').removeClass('ui-selected'); 32061 } 32062 }); 32063 32064 $('.time-interval[data-time] input[type=checkbox]').on('change', function(){ 32065 timeSelect($(this).next('label'), 'click'); 32066 isSelectedAllTimes(); 32067 }); 32068 32069 $('.setting-form-option-date2').closest('.modal').mousedown(function(e) { 32070 e.metaKey = true; // Macììë Command í¤, Windowsììë Ctrl í¤ ìí 32071 }).selectableScroll({ 32072 filter: 'label',
32073 cancel: 'input[type=radio], .newcheckbox label, #all-time-select, label.all-time, button', 32074 delay: 100, 32075 selected: function(e, ui) { 32076 timeSelect(ui.selected); 32077 }, 32078 stop: function(e, ui) { 32079 $('.time-interval[data-time] label').each(function(idx, v) { 32080 if($(v).hasClass('.all-time')) return true; 32081 let chk = $("#" + $(v).attr("for")); 32082 // console.log('chk', chk); 32083 if(chk.is(':checked')) { 32084 $(v).addClass('ui-selected'); 32085 } else { 32086 $(v).removeClass('ui-selected'); 32087 } 32088 }); 32089 32090 isSelectedAllTimes(); 32091 }, 32092 }); 32093 break; 32094 } 32095 32096 $(document).off('click', '.d-year, .d-month'); 32097 $(document).on('click', '.d-year, .d-month', function() { 32098 $('.d-month-year-picker').toggleClass('d-show'); 32099 scrollToCurrentYearMonth(); 32100 }); 32101 32102 function timeSelect(label, action) { 32103 if(typeof action == 'undefined') action = ''; 32104 // console.log(label); 32105 let interval = $('input[name=time_interval]:checked').val(); 32106 let chk = $("#" + $(label).attr('for')); 32107 let t = chk.prevAll('input.ten-time'); 32108 // console.log('chk', chk); 32109 if(action == 'click') { 32110 if(chk.is(':checked')) { 32111 label.addClass('ui-selected'); // ì²´í¬ë°ì¤ ì í 32112 } else { 32113 label.removeClass('ui-selected'); // ì²´í¬ë°ì¤ ì í 32114 } 32115 } else { 32116 if(chk.is(':checked')) { 32117 chk.prop("checked", false); // ì²´í¬ë°ì¤ ì í 32118 } else { 32119 chk.prop("checked", true); // ì²´í¬ë°ì¤ ì í 32120 } 32121 } 32122 32123 switch (interval) { 32124 case '20': 32125 if(chk.is(':checked') && $(t[0]).prevAll('input.o-time, input.twt-time').first().is(':checked')) { 32126 $(t[0]).prop('checked', true); 32127 if(action == 'click') $(t[0]).next('label').addClass('ui-selected'); 32128 } else { 32129 $(t[0]).prop('checked', false); 32130 if(action == 'click') $(t[0]).next('label').removeClass('ui-selected'); 32131 } 32132 break; 32133 case '30': 32134 if(chk.is(':checked') && $(t[0]).prevAll('input.o-time, input.half-time').first().is(':checked')) { 32135 $(t[0]).prop('checked', true); 32136 $(t[1]).prop('checked', true); 32137 if(action == 'click') { 32138 $(t[0]).next('label').addClass('ui-selected'); 32139 $(t[1]).next('label').addClass('ui-selected'); 32140 } 32141 } else { 32142 $(t[0]).prop('checked', false); 32143 $(t[1]).prop('checked', false); 32144 if(action == 'click') { 32145 $(t[0]).next('label').removeClass('ui-selected'); 32146 $(t[1]).next('label').removeClass('ui-selected'); 32147 } 32148 } 32149 32150 break; 32151 case '60': 32152 if(chk.is(':checked') && $(t[0]).prevAll('input.o-time').first().is(':checked')) { 32153 $(t[0]).prop('checked', true); 32154 $(t[1]).prop('checked', true); 32155 $(t[2]).prop('checked', true); 32156 $(t[3]).prop('checked', true); 32157 $(t[4]).prop('checked', true); 32158 if(action == 'click') { 32159 $(t[0]).next('label').addClass('ui-selected'); 32160 $(t[1]).next('label').addClass('ui-selected'); 32161 $(t[2]).next('label').addClass('ui-selected'); 32162 $(t[3]).next('label').addClass('ui-selected'); 32163 $(t[4]).next('label').addClass('ui-selected'); 32164 } 32165 } else { 32166 $(t[0]).prop('checked', false); 32167 $(t[1]).prop('checked', false); 32168 $(t[2]).prop('checked', false); 32169 $(t[3]).prop('checked', false); 32170 $(t[4]).prop('checked', false); 32171 if(action == 'click') { 32172 $(t[0]).next('label').removeClass('ui-selected'); 32173 $(t[1]).next('label').removeClass('ui-selected'); 32174 $(t[2]).next('label').removeClass('ui-selected'); 32175 $(t[3]).next('label').removeClass('ui-selected'); 32176 $(t[4]).next('label').removeClass('ui-selected'); 32177 } 32178 } 32179 32180 break; 32181 } 32182 } 32183 32184 function isSelectedAllTimes() { 32185 let interval = $('input[name=time_interval]:checked').val(); 32186 let am = $('.time-interval[data-time="am"] label:not(.hide)').prev('input[type="checkbox"]:checked'); 32187 let pm = $('.time-interval[data-time="pm"] label:not(.hide)').prev('input[type="checkbox"]:checked'); 32188 let timeCnt = am.length + pm.length; 32189 // console.log('timeCnt', timeCnt); 32190 let allTimeChecked = ''; 32191 if (interval == '10' && timeCnt == 144) allTimeChecked = 'checked'; 32192 if (interval == '20' && timeCnt == 72) allTimeChecked = 'checked'; 32193 if (interval == '30' && timeCnt == 48) allTimeChecked = 'checked'; 32194 if (interval == '60' && timeCnt == 24) allTimeChecked = 'checked'; 32195 32196 if(allTimeChecked) { 32197 $('#all-time-select').prop('checked', true); 32198 } else { 32199 $('#all-time-select').prop('checked', false); 32200 } 32201 } 32202 }, function() { //hide 32203 if (func == 'term' && (!$('#etc-start-date-txt').val() || !$('#etc-end-date-txt').val())) { 32204 if (!$('#etc-start-date-prev').val() && !$('#etc-end-date-prev').val()) { 32205 $('input[name="select_terms-' + id + '"][value="N"]').prop('checked', true); 32206 $('.form-sort-item[data-id="' + id + '"] .setting-date2[data-setting="term"]').addClass('disabled'); 32207 } 32208 } 32209 settingModal.modal('hide'); 32210 }); 32211} 32212 32213var calendarDateTime = function(el, id, type, se, fulltime, locale) { 32214 var field_type = 'sale-product-datetime'; 32215 var func = (se == 'sdate') ? 'saleStartDateTime' : 'saleEndDateTime'; 32216 32217 var sid = (typeof property != 'undefined') ? property.SID : SID; 32218 var blocklang = locale; 32219 var field_setting = {}; 32220 var etcDateState = 'N'; 32221 var $scopeCtx = (typeof selectEL !== 'undefined') ? $('.' + el) : $('.calendar-modal-container'); 32222 var isAllDay = $scopeCtx.find('input.all-day').is(':checked'); 32223 32224 //ê¸°ë³¸ê° 32225 $default_term = { 32226 'select_terms' : 'N', 32227 'start_date' : '', 32228 'end_date' : '', 32229 'date_week' : 'A', 32230 'days' : 'sun|mon|tue|wed|thu|fri|sat', 32231 }; 32232 $default_excludeDate = {'date' : ''}; 32233 $default_time = { 32234 'interval' : '30', 32235 'am' : '0000|0030|0100|0130|0200|0230|0300|0330|0400|0430|0500|0530|0600|0630|0700|0730|0800|0830|0900|0930|1000|1030|1100|1130', 32236 'pm' : '1200|1230|1300|1330|1400|1430|1500|1530|1600|1630|1700|1730|1800|1830|1900|1930|2000|2030|2100|2130|2200|2230|2300|2330' 32237 }; 32238 $default_color = {'highlight' : '4789e7'}; 32239 32240 field_setting = { 32241 'term' : $default_term, 32242 'excludeDate' : $default_excludeDate, 32243 'time' : $default_time, 32244 'color' : $default_color, 32245 }; 32246 32247 var term = (field_setting.term)? field_setting.term:{}; 32248 var excludeDate = (field_setting.excludeDate)? field_setting.excludeDate:{}; 32249 var time = (type != 'date' && field_setting.time)? field_setting.time:{}; 32250 var color = (field_setting.color)? field_setting.color:{}; 32251 32252 var startDate = (term.start_date !== undefined)? term.start_date:''; 32253 var endDate = (term.end_date !== undefined)? term.end_date:''; 32254 var dateWeek = (term.date_week !== undefined)? term.date_week:''; 32255 var days = (term.days !== undefined)? term.days.split('|'):[]; 32256 var daysObj = { 32257 'sun': 0, 'mon': 1, 'tue': 2, 'wed': 3, 'thu': 4, 'fri': 5, 'sat': 6, 32258 } 32259 32260 var exceptDate = (excludeDate.date !== undefined) ? excludeDate.date : ''; 32261 32262 var interval = (time.interval !== undefined) ? time.interval : '30'; 32263 var am = (time.am !== undefined) ? time.am.split('|') : []; 32264 var pm = (time.pm !== undefined) ? time.pm.split('|') : []; 32265 var timeCnt = am.length + pm.length; 32266 var language = (locale != 'ko') ? 'en' : 'ko'; 32267 var blocklang = ($('[form-seq="' + id + '"]').closest('.element').attr('data-blocklang')) ? $('[form-seq="' + id + '"]').closest('.element').attr('data-blocklang') : locale; 32268 32269 var modal_title = ''; 32270 var modal_str = ''; 32271 var modal_class = 'modal-dialog cl-cmmodal cl-s-btn setting-form-option-date2 cl-close-btn cover'; 32272 32273 modal_class = 'modal-dialog cl-cmmodal cl-s-btn setting-form-option-date2 setting-product-sale-datetime cl-close-btn cover'; 32274 var timeClass = 'start-time'; 32275 if(func == 'saleStartDateTime') { 32276 // modal_title = 'ìì ë ì§/ìê° ì í'; 32277 modal_title = $.lang[locale]['config.calendar.sdate']; 32278 modal_str = '\ 32279 <div class="term-calendar-box sale-calendar-box setting-sale-date">\ 32280 <div class="setting-label display-flex align-items-center space-between">\ 32281 <div class="display-flex align-items-center">\
32282 <span>'+ $.lang[locale]['config.calendar.date'] +'</span>\ 32283 <span class="start-date datetime-txt" data-blocklang="' + blocklang + '"></span>\ 32284 </div>\ 32285 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path d="M8 12.5a.47.47 0 0 1-.35-.15l-7.5-7.5c-.2-.2-.2-.51 0-.71.2-.2.51-.2.71 0L8 11.29l7.15-7.15c.2-.2.51-.2.71 0 .2.2.2.51 0 .71l-7.5 7.5c-.1.1-.23.15-.36.15z"></path></svg>\ 32286 </div>\ 32287 <div class="setting-datetime-input" data-type="' + func + '">\ 32288 <input type="hidden" id="select-calendar" value="term-datepicker">\ 32289 <input type="hidden" id="select-date-ymd" value="">\ 32290 <input type="hidden" id="etc-start-date-prev" value="">\ 32291 <input type="hidden" id="etc-start-date-txt" value="">\ 32292 <input type="hidden" id="clang" value="'+ locale +'">\ 32293 <div id="sale-datepicker"></div>\ 32294 </div>\ 32295 </div>\ 32296 '; 32297 } else { 32298 // modal_title = 'ì¢ ë£ ë ì§/ìê° ì í'; 32299 modal_title = $.lang[locale]['config.calendar.edate']; 32300 modal_str = '\ 32301 <div class="term-calendar-box sale-calendar-box setting-sale-date">\ 32302 <div class="setting-label display-flex align-items-center space-between">\ 32303 <div class="display-flex align-items-center">\ 32304 <span>'+ $.lang[locale]['config.calendar.date'] +'</span>\ 32305 <span class="end-date datetime-txt" data-blocklang="' + blocklang + '"></span>\ 32306 </div>\ 32307 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path d="M8 12.5a.47.47 0 0 1-.35-.15l-7.5-7.5c-.2-.2-.2-.51 0-.71.2-.2.51-.2.71 0L8 11.29l7.15-7.15c.2-.2.51-.2.71 0 .2.2.2.51 0 .71l-7.5 7.5c-.1.1-.23.15-.36.15z"></path></svg>\ 32308 </div>\ 32309 <div class="setting-datetime-input" data-type="' + func + '">\ 32310 <input type="hidden" id="select-calendar" value="term-datepicker">\ 32311 <input type="hidden" id="select-date-ymd" value="">\ 32312 <input type="hidden" id="etc-start-date-prev" value="">\ 32313 <input type="hidden" id="etc-start-date-txt" value="">\ 32314 <input type="hidden" id="etc-end-date-prev" value="">\ 32315 <input type="hidden" id="etc-end-date-txt" value="">\ 32316 <input type="hidden" id="clang" value="'+ locale +'">\ 32317 <div id="sale-datepicker"></div>\ 32318 </div>\ 32319 </div>\ 32320 '; 32321 timeClass = 'end-time'; 32322 } 32323 32324 modal_str += '\ 32325 <div class="term-calendar-box sale-calendar-box setting-sale-time">\ 32326 <div class="setting-label display-flex align-items-center space-between">\ 32327 <div class="display-flex align-items-center">\ 32328 <span>'+ $.lang[locale]['config.calendar.time'] +'</span>\ 32329 <span class="'+timeClass+' datetime-txt" data-blocklang="' + blocklang + '"></span>\ 32330 </div>\ 32331 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path d="M8 12.5a.47.47 0 0 1-.35-.15l-7.5-7.5c-.2-.2-.2-.51 0-.71.2-.2.51-.2.71 0L8 11.29l7.15-7.15c.2-.2.51-.2.71 0 .2.2.2.51 0 .71l-7.5 7.5c-.1.1-.23.15-.36.15z"></path></svg>\ 32332 </div>\ 32333 <div class="setting-datetime-input" data-type="' + func + '" style="display:none;">\ 32334 <div class="display-flex align-items-center setting-row">\ 32335 <div class="setting-label">' + $.lang[locale]['config.form.date2.time.interval.label'] + '</div>\ 32336 <div class="newcheckbox hand">\ 32337 <label>\ 32338 <div class="newcheckboxSvgRadio">\ 32339 <input type="radio" class="cl-common-form-radio-hide" name="time_interval" value="30" checked>\ 32340 <svg viewBox="0 0 18 18" width="18" height="18">\ 32341 <path d="M9 0C4.03 0 0 4.03 0 9c0 4.97 4.03 9 9 9s9-4.03 9-9C18 4.03 13.97 0 9 0zM9 17c-4.41 0-8-3.59-8-8
323410-4.41 3.59-8 8-8s8 3.59 8 8C17 13.41 13.41 17 9 17z"></path>\ 32342 </svg>\ 32343 <svg class="active" viewBox="0 0 18 18" width="18" height="18">\ 32344 <path d="M9 0C4.03 0 0 4.03 0 9c0 4.97 4.03 9 9 9s9-4.03 9-9C18 4.03 13.97 0 9 0zM9 17c-4.41 0-8-3.59-8-8 0-4.41 3.59-8 8-8s8 3.59 8 8C17 13.41 13.41 17 9 17z"></path>\ 32345 <circle cx="9" cy="9" r="6"></circle>\ 32346 </svg>\ 32347 </div>\ 32348 <span>' + $.lang[locale]['config.form.date2.time.interval.30'] + '</span>\ 32349 </label>\ 32350 </div>\ 32351 <div class="newcheckbox hand">\ 32352 <label>\ 32353 <div class="newcheckboxSvgRadio">\ 32354 <input type="radio" class="cl-common-form-radio-hide" name="time_interval" value="60">\ 32355 <svg viewBox="0 0 18 18" width="18" height="18">\ 32356 <path d="M9 0C4.03 0 0 4.03 0 9c0 4.97 4.03 9 9 9s9-4.03 9-9C18 4.03 13.97 0 9 0zM9 17c-4.41 0-8-3.59-8-8 0-4.41 3.59-8 8-8s8 3.59 8 8C17 13.41 13.41 17 9 17z"></path>\ 32357 </svg>\ 32358 <svg class="active" viewBox="0 0 18 18" width="18" height="18">\ 32359 <path d="M9 0C4.03 0 0 4.03 0 9c0 4.97 4.03 9 9 9s9-4.03 9-9C18 4.03 13.97 0 9 0zM9 17c-4.41 0-8-3.59-8-8 0-4.41 3.59-8 8-8s8 3.59 8 8C17 13.41 13.41 17 9 17z"></path>\ 32360 <circle cx="9" cy="9" r="6"></circle>\ 32361 </svg>\ 32362 </div>\ 32363 <span>' + $.lang[locale]['config.form.date2.time.interval.60'] + '</span>\ 32364 </label>\ 32365 </div>\ 32366 </div>\ 32367 <div class="setting-row am">\ 32368 <div class="setting-label">' + $.lang[locale]['config.form.date2.time.am'] + '</div>\ 32369 <div class="display-flex time-interval" data-time="am"></div>\ 32370 </div>\ 32371 <div class="setting-row">\ 32372 <div class="setting-label">' + $.lang[locale]['config.form.date2.time.pm'] + '</div>\ 32373 <div class="display-flex time-interval" data-time="pm"></div>\ 32374 </div>\ 32375 </div>\ 32376 </div>\ 32377 '; 32378 32379 var settingModal = $(el).showModalFlat(modal_title, modal_str, true, true, function() { //confirm 32380 function splitHHmm(hmRaw) { 32381 var hm = String(hmRaw).replace(/[^0-9]/g, '').padStart(4, '0'); 32382 return { hh: hm.slice(0, 2), mm: hm.slice(2, 4) }; 32383 } 32384 switch (func) { 32385 case 'saleStartDateTime': { 32386 const selectedDate = $('#select-date-ymd').val(); 32387 const $timeChecked = $('.time-interval input:checked'); 32388 if (!selectedDate || (!isAllDay && $timeChecked.length === 0)) { 32389 alert($.lang[locale]['config.calendar.enter-date']); 32390 return false; 32391 } 32392 32393 let hh = '00', mm = '00'; 32394 if (!isAllDay) { 32395 const mna = $timeChecked.closest('.time-interval').data('time'); 32396 const hmRaw = convertTime24(mna, $timeChecked.val()); 32397 ({ hh, mm } = splitHHmm(hmRaw)); 32398 } 32399 32400 const dateDash = selectedDate.replace(/\./g, '-'); 32401 const saleDateTimeVal = `${dateDash} ${hh}:${mm}:00`; 32402 const saleDateTimeUI = `${dateDash} ${hh}:${mm}`; 32403 32404 $('.sale-setting .setting-text .content-start').text(isAllDay ? selectedDate : (selectedDate + '. ' + convertTime12(hh + mm))); 32405 $('#sale-start-datetime').val(saleDateTimeVal); 32406 32407 (function setStartInput(){ 32408 const $scope = (typeof selectEL !== 'undefined') ? $('.' + el) : $('.calendar-modal-container'); 32409 const saleDateUI = isAllDay ? dateDash : `${dateDash} ${hh}:${mm}`;
32410 $scope.find('.sdate .start').val(saleDateUI); 32411 })(); 32412 32413 (function fixEndAfterStart() { 32414 function parseLocal(str) { 32415 if (!str) return null; 32416 var p = str.trim().split(' '); 32417 if (p.length < 2) return null; 32418 var d = p[0].split('-').map(Number); 32419 var t = p[1].split(':').map(Number); 32420 return new Date(d[0], (d[1]||1)-1, d[2]||1, t[0]||0, t[1]||0, 0, 0); 32421 } 32422 function pad2(n){ return String(n).padStart(2,'0'); } 32423 32424 const $scope = (typeof selectEL !== 'undefined') ? $('.' + el) : $('.calendar-modal-container'); 32425 const endInput = ($scope.find('.edate .end').val() || '').trim(); 32426 const endHidden = ($('#sale-end-datetime').val() || '').trim(); 32427 const endStr = endInput || endHidden; 32428 32429 const startDT = parseLocal(saleDateTimeVal); 32430 const endDT = parseLocal(endStr); 32431 32432 if (!endDT || startDT >= endDT) { 32433 let fixed = new Date(startDT.getTime()); 32434 if (isAllDay) { 32435 fixed.setHours(23, 59, 0, 0); 32436 } else { 32437 fixed.setHours(fixed.getHours() + 1); 32438 } 32439 32440 const y = fixed.getFullYear(); 32441 const m = pad2(fixed.getMonth() + 1); 32442 const d = pad2(fixed.getDate()); 32443 const H = pad2(fixed.getHours()); 32444 const M = pad2(fixed.getMinutes()); 32445 32446 $('#sale-end-datetime').val(`${y}-${m}-${d} ${H}:${M}:00`); 32447 32448 if (isAllDay) { 32449 $('.sale-setting .setting-text .content-end').text(`${y}-${m}-${d}`); 32450 } else { 32451 $('.sale-setting .setting-text .content-end').text(`${y}-${m}-${d}. ` + convertTime12(H + M)); 32452 } 32453 32454 $scope.find('.edate .end').val(isAllDay ? `${y}-${m}-${d}` : `${y}-${m}-${d} ${H}:${M}`); 32455 } 32456 })(); 32457 32458 break; 32459 } 32460 32461 case 'saleEndDateTime': { 32462 const selectedDate = $('#select-date-ymd').val(); 32463 const $timeChecked = $('.time-interval input:checked'); 32464 32465 if (!selectedDate || (!isAllDay && $timeChecked.length === 0)) { 32466 alert($.lang[locale]['config.calendar.enter-date']); 32467 return false; 32468 } 32469 32470 let hh = '23', mm = '59'; 32471 if (!isAllDay) { 32472 const mna = $timeChecked.closest('.time-interval').data('time'); 32473 const hmRaw = convertTime24(mna, $timeChecked.val()); 32474 ({ hh, mm } = splitHHmm(hmRaw)); 32475 } 32476 32477 const dateDash = selectedDate.replace(/\./g, '-'); 32478 const saleDateTimeVal = `${dateDash} ${hh}:${mm}:00`; 32479 const saleDateTimeUI = `${dateDash} ${hh}:${mm}`; 32480 32481 const startHidden = $('#sale-start-datetime').val(); 32482 if (startHidden) { 32483 const startDT = new Date(startHidden.replace(/-/g,'/')); 32484 const endDT = new Date(saleDateTimeVal.replace(/-/g,'/')); 32485 if (startDT >= endDT) { 32486 alert('ìì ìê°ë³´ë¤ ëì¤ ë ì§' + (isAllDay ? '' : '/ìê°') + 'ì ì íí´ ì£¼ì¸ì.'); 32487 return false; 32488 } 32489 } 32490 32491 if (isAllDay) { 32492 $('.sale-setting .setting-text .content-end').text(selectedDate); 32493 } else { 32494 $('.sale-setting .setting-text .content-end').text(selectedDate + '. ' + convertTime12(hh + mm)); 32495 } 32496 $('#sale-end-datetime').val(saleDateTimeVal); 32497 32498 (function setEndInput(){ 32499 const $scope = (typeof selectEL !== 'undefined') ? $('.' + el) : $('.calendar-modal-container'); 32500 const saleDateUI = isAllDay ? dateDash : `${dateDash} ${hh}:${mm}`; 32501 $scope.find('.edate .end').val(saleDateUI); 32502 })(); 32503 break; 32504 } 32505 } 32506 32507 // saveFormElement(); 32508 settingModal.modal('hide'); 32509 }, $.lang[locale]['config.cancel'], $.lang[locale]['config.ok'], modal_class, true, function() { //close 32510 32511 settingModal.modal('hide'); 32512 }, function() { //show 32513 32514 if (startDate && endDate) { 32515 var checkStartDate = startDate.split('.'); 32516 var checkEndDate = endDate.split('.'); 32517 32518 $('.term-setting').removeClass('hide'); 32519 if (locale == 'ko') {
32520 $('.term-setting .start-date').text(checkStartDate[0] + 'ë ' + checkStartDate[1] + 'ì ' + checkStartDate[2] + ' ì¼'); 32521 $('.term-setting .end-date').text(checkEndDate[0] + 'ë ' + checkEndDate[1] + 'ì ' + checkEndDate[2] + ' ì¼'); 32522 } else { 32523 $('.term-setting .start-date').text(checkStartDate[1] + '/' + checkStartDate[2] + '/' + checkStartDate[0]); 32524 $('.term-setting .end-date').text(checkEndDate[1] + '/' + checkEndDate[2] + '/' + checkEndDate[0]); 32525 } 32526 } 32527 32528 $('#term-datepicker').html(''); 32529 var currentYear = new Date().getFullYear(); 32530 switch (func) { 32531 case 'saleStartDateTime': 32532 case 'saleEndDateTime': { 32533 var saleStartDateTime = 32534 ($('.' + el).find('.calendar-modal-container .sdate .start').val() || '').trim() || 32535 ($('#sale-start-datetime').val() || '').trim(); 32536 var saleEndDateTime = 32537 ($('.' + el).find('.calendar-modal-container .edate .end').val() || '').trim() || 32538 ($('#sale-end-datetime').val() || '').trim(); 32539 32540 function splitDateTime(str) { 32541 if (!str) return { date: '', time: '' }; 32542 var date = str.slice(0, 10); 32543 var time = (str.length >= 16) ? str.slice(11, 16) : ''; 32544 return { date: date, time: time }; 32545 } 32546 var s = splitDateTime(saleStartDateTime); 32547 var e = splitDateTime(saleEndDateTime); 32548 var selStartDate = s.date; 32549 var selEndDate = e.date; 32550 var selStartTime = s.time; 32551 var selEndTime = e.time; 32552 32553 function toDateOnly(ymd) { 32554 if (!ymd) return null; 32555 var y = +ymd.slice(0, 4), m = +ymd.slice(5, 7) - 1, d = +ymd.slice(8, 10); 32556 return new Date(y, m, d, 0, 0, 0, 0); 32557 } 32558 var selStartDateOnly = toDateOnly(selStartDate); 32559 var selEndDateOnly = toDateOnly(selEndDate); 32560 32561 const MIN_DATE = new Date(1900, 0, 1); 32562 const MAX_DATE = new Date(currentYear + 15, 11, 31); 32563 32564 var datepickkObj = { 32565 container: document.querySelector('#sale-datepicker'), 32566 inline: true, 32567 range: false, 32568 exp: false, 32569 lang: language, 32570 startDate: new Date(), 32571 minDate: MIN_DATE, 32572 maxDate: MAX_DATE 32573 }; 32574 32575 if (func == 'saleStartDateTime') { 32576 $('.time-interval input').prop('disabled', false).removeAttr('disabled'); 32577 datepickkObj.minDate = MIN_DATE; 32578 datepickkObj.maxDate = MAX_DATE; 32579 if (selStartDateOnly) datepickkObj.startDate = selStartDateOnly; 32580 32581 if (selStartDate) $('#select-date-ymd').val(selStartDate.replace(/-/g, '.')); 32582 // else $('.setting-sale-date').addClass('open'); 32583 $('.setting-sale-date').addClass('open'); 32584 32585 } else { // saleEndDateTime 32586 datepickkObj.minDate = selStartDateOnly || MIN_DATE; 32587 datepickkObj.startDate = selEndDateOnly || selStartDateOnly || new Date(); 32588 32589 if (selEndDate) { 32590 $('#select-date-ymd').val(selEndDate.replace(/-/g, '.')); 32591 } else if (selStartDate) { 32592 $('#select-date-ymd').val(selStartDate.replace(/-/g, '.')); 32593 } else { 32594 var today = new Date(); 32595 var y = today.getFullYear(), m = String(today.getMonth()+1).padStart(2,'0'), d = String(today.getDate()).padStart(2,'0'); 32596 $('#select-date-ymd').val(`${y}.${m}.${d}`); 32597 // $('.setting-sale-date').addClass('open'); 32598 } 32599 $('.setting-sale-date').addClass('open'); 32600 } 32601 32602 var termPicker = new Datepickk(datepickkObj); 32603 32604 if (isAllDay) { 32605 $('.setting-sale-time').hide(); 32606 } else { 32607 $('.setting-sale-time').show(); 32608 } 32609 if (func === 'saleEndDateTime' && !isAllDay) { 32610 const $endScope = $('.sale-calendar-box.setting-sale-date .setting-datetime-input[data-type="saleEndDateTime"]').closest('.modal-dialog'); 32611 32612 function minutesFromInput($input) { 32613 var v = String($input.val() || '').padStart(4,'0'); 32614 var h = parseInt(v.slice(0,2), 10); 32615 var m = parseInt(v.slice(2,4), 10); 32616 var period = $input.closest('.time-interval').data('time'); 32617 if (period === 'am') { 32618 if (h === 12) h = 0; 32619 } else { 32620 if (h !== 12) h += 12; 32621 } 32622 return (h * 60) + m; 32623 } 32624 32625 function minutesFromStart(str) { 32626 if (!str) return null; 32627 var hh = parseInt(str.slice(11,13), 10); 32628 var mm = parseInt(str.slice(14,16), 10); 32629 if (isNaN(hh) || isNaN(mm)) return null; 32630 return hh*60 + mm; 32631 } 32632 32633 function refreshEndTimeDisables() {
32634 const $inputs = $endScope.find('.time-interval input'); 32635 32636 $inputs.prop('disabled', false).removeAttr('disabled'); 32637 32638 const selectedDot = ($('#select-date-ymd').val() || '').trim(); 32639 const $scope = (typeof selectEL !== 'undefined') ? $('.' + el) : $('.calendar-modal-container'); 32640 const startInput = ($scope.find('.sdate .start').val() || '').trim(); 32641 const startHidden = ($('#sale-start-datetime').val() || '').trim(); 32642 const startStr = startInput || startHidden; 32643 32644 if (!selectedDot || !startStr) return; 32645 32646 const endYmd = selectedDot.replace(/\./g, '-').slice(0, 10); 32647 const startYmd = startStr.slice(0, 10); 32648 if (endYmd !== startYmd) return; 32649 32650 const startMin = minutesFromStart(startStr); 32651 if (startMin == null) return; 32652 32653 $inputs.each(function(){ 32654 const $it = $(this); 32655 const m = minutesFromInput($it); 32656 if (m < startMin) $it.prop('disabled', true).attr('disabled','disabled'); 32657 }); 32658 32659 const $checked = $endScope.find('.time-interval input:checked'); 32660 if ($checked.length && $checked.is(':disabled')) { 32661 $checked.prop('checked', false); 32662 $('.sale-calendar-box .end-time').html(''); 32663 } 32664 } 32665 32666 window.__refreshEndTimeDisables = refreshEndTimeDisables; 32667 32668 if (termPicker && typeof termPicker.onSelect !== 'undefined') { 32669 const prev = termPicker.onSelect; 32670 termPicker.onSelect = function(date){ 32671 if (typeof prev === 'function') prev.call(this, date); 32672 if (date instanceof Date && !isNaN(date.getTime())) { 32673 const y = date.getFullYear(), m = String(date.getMonth()+1).padStart(2,'0'), d = String(date.getDate()).padStart(2,'0'); 32674 $('#select-date-ymd').val(`${y}.${m}.${d}`); 32675 } 32676 refreshEndTimeDisables(); 32677 }; 32678 } else { 32679 $('#sale-datepicker').off('click.updateEndTime') 32680 .on('click.updateEndTime', '.d-day', function(){ setTimeout(refreshEndTimeDisables, 0); }); 32681 } 32682 } 32683 32684 if (typeof displaySelectedDates === 'function') displaySelectedDates(); 32685 32686 $('.time-interval').each(function(i, v) { 32687 var mna = $(v).data('time'); 32688 var times = '\ 32689 <input type="radio" id="' + mna + '-12-00" class="hide" name="sale_time" value="1200">\ 32690 <label for="' + mna + '-12-00">12:00</label>\ 32691 <input type="radio" id="' + mna + '-12-30" class="half-time hide" name="sale_time" value="1230">\ 32692 <label for="' + mna + '-12-30" class="half-time">12:30</label>\ 32693 \ 32694 <input type="radio" id="' + mna + '-1-00" class="hide" name="sale_time" value="
326940100">\ 32695 <label for="' + mna + '-1-00">1:00</label>\ 32696 <input type="radio" id="' + mna + '-1-30" class="half-time hide" name="sale_time" value="0130">\ 32697 <label for="' + mna + '-1-30" class="half-time">1:30</label>\ 32698 \ 32699 <input type="radio" id="' + mna + '-2-00" class="hide" name="sale_time" value="0200">\ 32700 <label for="' + mna + '-2-00">2:00</label>\ 32701 <input type="radio" id="' + mna + '-2-30" class="half-time hide" name="sale_time" value="0230">\ 32702 <label for="' + mna + '-2-30" class="half-time">2:30</label>\ 32703 \ 32704 <input type="radio" id="' + mna + '-3-00" class="hide" name="sale_time" value="0300">\ 32705 <label for="' + mna + '-3-00">3:00</label>\ 32706 <input type="radio" id="' + mna + '-3-30" class="half-time hide" name="sale_time" value="0330">\ 32707 <label for="' + mna + '-3-30" class="half-time">3:30</label>\ 32708 \ 32709 <input type="radio" id="' + mna + '-4-00" class="hide" name="sale_time" value="
327090400">\ 32710 <label for="' + mna + '-4-00">4:00</label>\ 32711 <input type="radio" id="' + mna + '-4-30" class="half-time hide" name="sale_time" value="0430">\ 32712 <label for="' + mna + '-4-30" class="half-time">4:30</label>\ 32713 \ 32714 <input type="radio" id="' + mna + '-5-00" class="hide" name="sale_time" value="0500">\ 32715 <label for="' + mna + '-5-00">5:00</label>\ 32716 <input type="radio" id="' + mna + '-5-30" class="half-time hide" name="sale_time" value="0530">\ 32717 <label for="' + mna + '-5-30" class="half-time">5:30</label>\ 32718 \ 32719 <input type="radio" id="' + mna + '-6-00" class="hide" name="sale_time" value="0600">\ 32720 <label for="' + mna + '-6-00">6:00</label>\ 32721 <input type="radio" id="' + mna + '-6-30" class="half-time hide" name="sale_time" value="0630">\ 32722 <label for="' + mna + '-6-30" class="half-time">6:30</label>\ 32723 \ 32724 <input type="radio" id="' + mna + '-7-00" class="hide" name="sale_time" value="
327240700">\ 32725 <label for="' + mna + '-7-00">7:00</label>\ 32726 <input type="radio" id="' + mna + '-7-30" class="half-time hide" name="sale_time" value="0730">\ 32727 <label for="' + mna + '-7-30" class="half-time">7:30</label>\ 32728 \ 32729 <input type="radio" id="' + mna + '-8-00" class="hide" name="sale_time" value="0800">\ 32730 <label for="' + mna + '-8-00">8:00</label>\ 32731 <input type="radio" id="' + mna + '-8-30" class="half-time hide" name="sale_time" value="0830">\ 32732 <label for="' + mna + '-8-30" class="half-time">8:30</label>\ 32733 \ 32734 <input type="radio" id="' + mna + '-9-00" class="hide" name="sale_time" value="0900">\ 32735 <label for="' + mna + '-9-00">9:00</label>\ 32736 <input type="radio" id="' + mna + '-9-30" class="half-time hide" name="sale_time" value="0930">\ 32737 <label for="' + mna + '-9-30" class="half-time">9:30</label>\ 32738 \ 32739 <input type="radio" id="' + mna + '-10-00" class="hide" name="sale_time" value="1000">\ 32740 <label for="' + mna + '-10-00">10:00</label>\ 32741 <input type="radio" id="' + mna + '-10-30" class="half-time hide" name="sale_time" value="1030">\ 32742 <label for="' + mna + '-10-30" class="half-time">10:30</label>\ 32743 \ 32744 <input type="radio" id="' + mna + '-11-00" class="hide" name="sale_time" value="1100">\ 32745 <label for="' + mna + '-11-00">11:00</label>\ 32746 <input type="radio" id="' + mna + '-11-30" class="half-time hide" name="sale_time" value="1130">\ 32747 <label for="' + mna + '-11-30" class="half-time">11:30</label>\ 32748 '; 32749 $(v).html(times); 32750 }); 32751 32752 if (func === 'saleEndDateTime' && typeof window.__refreshEndTimeDisables === 'function') { 32753 window.__refreshEndTimeDisables(); 32754 } 32755 32756 $('input[name="time_interval"][value="' + interval + '"]').prop('checked', true); 32757 32758 if (func == 'saleStartDateTime' && selStartDate && selStartTime) { 32759 var hour = parseInt(selStartTime.split(':')[0], 10); 32760 var minute = parseInt(selStartTime.split(':')[1], 10); 32761 var mna = 'am'; 32762 if (hour >= 12) { if (hour > 12) hour -= 12; mna = 'pm'; } 32763 else if (hour === 0) { hour = 12; } 32764 var formattedTime = String(hour).padStart(2, '0') + String(minute).padStart(2, '0'); 32765 $('.time-interval[data-time="' + mna + '"] input[value="' + formattedTime + '"]').prop('checked', true); 32766 if (typeof getDateTimeStr === 'function') getDateTimeStr(language, '', locale); 32767 } 32768 32769 var time_interval = $('input[name="time_interval"]:checked').val(); 32770 if (typeof dateTimeModal !== 'undefined' && dateTimeModal && dateTimeModal.find) { 32771 switch (time_interval) { 32772 case 10: dateTimeModal.find('.time-interval label.ten-time').removeClass('hide'); break; 32773 case 20: dateTimeModal.find('.time-interval label.twt-time').removeClass('hide'); break; 32774 case 30: dateTimeModal.find('.time-interval label.half-time').removeClass('hide'); break; 32775 case 60: dateTimeModal.find('.time-interval label').removeClass('hide'); break; 32776 } 32777 } 32778 32779 $('input[name="time_interval"]').on('change', function() { 32780 if ($(this).val() == 60) { 32781 $('.time-interval label.half-time').addClass('hide'); 32782 if ($('#all-time-select').is(':checked')) { 32783 $('.time-interval input.o-time').prop('checked', true); 32784 } 32785 } else { 32786 $('.time-interval label.half-time').removeClass('hide'); 32787 if ($('#all-time-select').is(':checked')) { 32788 $('.time-interval input').prop('checked', true); 32789 } 32790 } 32791 if (func === 'saleEndDateTime' && typeof window.__refreshEndTimeDisables === 'function') { 32792 setTimeout(window.__refreshEndTimeDisables, 0); 32793 } 32794 }); 32795 32796 $('.time-interval input').on('change', function(){ 32797 if (typeof getDateTimeStr === 'function') getDateTimeStr(language, 'time', locale); 32798 if (func === 'saleEndDateTime' && typeof window.__refreshEndTimeDisables === 'function') { 32799 setTimeout(window.__refreshEndTimeDisables, 0); 32800 } 32801 }); 32802 32803 $('.sale-calendar-box .setting-label').on('click', function(){ 32804 var $saleCalendarBox = $(this).closest('.sale-calendar-box');
32805 if($saleCalendarBox.hasClass('open')) { 32806 $('.sale-calendar-box .setting-datetime-input').slideUp(400, function(){ 32807 $('.sale-calendar-box').removeClass('open'); 32808 }); 32809 } else{ 32810 $('.sale-calendar-box .setting-datetime-input').slideUp(400, function(){ 32811 $('.sale-calendar-box').removeClass('open'); 32812 }); 32813 $saleCalendarBox.find('.setting-datetime-input').slideDown(400, function(){ 32814 $saleCalendarBox.addClass('open'); 32815 }); 32816 } 32817 }); 32818 32819 break; 32820 } 32821 } 32822 32823 $(document).off('click', '.d-year, .d-month'); 32824 $(document).on('click', '.d-year, .d-month', function() { 32825 $('.d-month-year-picker').toggleClass('d-show'); 32826 scrollToCurrentYearMonth(); 32827 }); 32828 32829 function timeSelect(label, action) { 32830 if(typeof action == 'undefined') action = ''; 32831 let interval = $('input[name=time_interval]:checked').val(); 32832 let chk = $("#" + $(label).attr('for')); 32833 let t = chk.prevAll('input.ten-time'); 32834 32835 if(action == 'click') { 32836 if(chk.is(':checked')) { 32837 label.addClass('ui-selected'); 32838 } else { 32839 label.removeClass('ui-selected'); 32840 } 32841 } else { 32842 if(chk.is(':checked')) { 32843 chk.prop("checked", false); 32844 } else { 32845 chk.prop("checked", true); 32846 } 32847 } 32848 32849 switch (interval) { 32850 case '20': 32851 if(chk.is(':checked') && $(t[0]).prevAll('input.o-time, input.twt-time').first().is(':checked')) { 32852 $(t[0]).prop('checked', true); 32853 if(action == 'click') $(t[0]).next('label').addClass('ui-selected'); 32854 } else { 32855 $(t[0]).prop('checked', false); 32856 if(action == 'click') $(t[0]).next('label').removeClass('ui-selected'); 32857 } 32858 break; 32859 case '30': 32860 if(chk.is(':checked') && $(t[0]).prevAll('input.o-time, input.half-time').first().is(':checked')) { 32861 $(t[0]).prop('checked', true); 32862 $(t[1]).prop('checked', true); 32863 if(action == 'click') { 32864 $(t[0]).next('label').addClass('ui-selected'); 32865 $(t[1]).next('label').addClass('ui-selected'); 32866 } 32867 } else { 32868 $(t[0]).prop('checked', false); 32869 $(t[1]).prop('checked', false); 32870 if(action == 'click') { 32871 $(t[0]).next('label').removeClass('ui-selected'); 32872 $(t[1]).next('label').removeClass('ui-selected'); 32873 } 32874 } 32875 32876 break; 32877 case '60': 32878 if(chk.is(':checked') && $(t[0]).prevAll('input.o-time').first().is(':checked')) { 32879 $(t[0]).prop('checked', true); 32880 $(t[1]).prop('checked', true); 32881 $(t[2]).prop('checked', true); 32882 $(t[3]).prop('checked', true); 32883 $(t[4]).prop('checked', true); 32884 if(action == 'click') { 32885 $(t[0]).next('label').addClass('ui-selected'); 32886 $(t[1]).next('label').addClass('ui-selected'); 32887 $(t[2]).next('label').addClass('ui-selected'); 32888 $(t[3]).next('label').addClass('ui-selected'); 32889 $(t[4]).next('label').addClass('ui-selected'); 32890 } 32891 } else { 32892 $(t[0]).prop('checked', false); 32893 $(t[1]).prop('checked', false); 32894 $(t[2]).prop('checked', false); 32895 $(t[3]).prop('checked', false); 32896 $(t[4]).prop('checked', false); 32897 if(action == 'click') { 32898 $(t[0]).next('label').removeClass('ui-selected'); 32899 $(t[1]).next('label').removeClass('ui-selected'); 32900 $(t[2]).next('label').removeClass('ui-selected'); 32901 $(t[3]).next('label').removeClass('ui-selected'); 32902 $(t[4]).next('label').removeClass('ui-selected'); 32903 } 32904 } 32905 32906 break; 32907 } 32908 } 32909 32910 function isSelectedAllTimes() { 32911 let interval = $('input[name=time_interval]:checked').val(); 32912 let am = $('.time-interval[data-time="am"] label:not(.hide)').prev('input[type="checkbox"]:checked'); 32913 let pm = $('.time-interval[data-time="pm"] label:not(.hide)').prev('input[type="checkbox"]:checked'); 32914 let timeCnt = am.length + pm.length; 32915 let allTimeChecked = ''; 32916 if (interval == '10' && timeCnt == 144) allTimeChecked = 'checked'; 32917 if (interval == '20' && timeCnt == 72) allTimeChecked = 'checked'; 32918 if (interval == '30' && timeCnt == 48) allTimeChecked = 'checked'; 32919 if (interval == '60' && timeCnt == 24) allTimeChecked = 'checked'; 32920 32921 if(allTimeChecked) { 32922 $('#all-time-select').prop('checked', true); 32923 } else { 32924 $('#all-time-select').prop('checked', false); 32925 } 32926 } 32927 }, function() { //hide 32928 32929 settingModal.modal('hide'); 32930 }); 32931} 32932 32933function convertTime24(mna, timeString) { 32934 var hour = parseInt(timeString.substring(0, 2));
32935 var minute = timeString.substring(2); 32936 // console.log(timeString, minute); 32937 if (mna == 'am' && hour == 12) { 32938 hour -= 12; 32939 } 32940 if (mna == 'pm' && hour !== 12) { 32941 hour += 12; 32942 } 32943 32944 var formattedHour = hour.toString().padStart(2, '0'); 32945 32946 return formattedHour + ':' + minute; 32947} 32948 32949function convertTime12(timeString) { 32950 var hour = parseInt(timeString.split(':')[0]); 32951 var minute = parseInt(timeString.split(':')[1]); 32952 var mna = 'am'; 32953 if(hour >= 12) { 32954 if (hour > 12) hour -= 12; 32955 mna = 'pm'; 32956 } else if (hour == 0) hour += 12; 32957 var formattedTime = $.lang[LANG]['config.form.date2.time.' + mna] + ' ' + hour.toString().padStart(2, '0') + ':' + minute.toString().padStart(2, '0'); 32958 32959 return formattedTime; 32960} 32961 32962function convertDateObjToStr(dateObj) { 32963 var year = dateObj.getFullYear(); 32964 var month = ("0" + (dateObj.getMonth() + 1)).slice(-2); 32965 var day = ("0" + dateObj.getDate()).slice(-2); 32966 var hours = ("0" + dateObj.getHours()).slice(-2); 32967 var minutes = ("0" + dateObj.getMinutes()).slice(-2); 32968 var seconds = ("0" + dateObj.getSeconds()).slice(-2); 32969 var formattedDate = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds; 32970 return formattedDate; 32971} 32972 32973var changeStatus = function(status,seq) { 32974 if(status == 'lim') return ''; 32975 var s = '\ 32976 <span class="status-change"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-caret-down-fill" viewBox="0 0 16 16"><path d="M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z"/></svg></span>\ 32977 <ul class="table-item-status" data-seq="' + seq + '">\ 32978 <li class="' + ((status == 'on') ? 'active' : '') + '" data-val="on">í매ì¤</li>\ 32979 <li class="' + ((status == 'off' || status == '') ? 'active' : '') + '" data-val="off">í매ì¤ì§</li>\ 32980 </ul>\ 32981 '; 32982 return s; 32983} 32984 32985var makeLinkUrl = function(link, one, view) { 32986 var link_url = ''; 32987 var link_val = ''; 32988 var is_menu = ($.inArray(link.replace(/^\//g, '').replace(/ /g, '-'), MENULIST) > -1) ? true : false; 32989 var regex = /^(((http(s?))\:\/\/)?)([0-9a-zA-Z\-]+\.)+[a-zA-Z]{2,7}(\:[0-9]+)?(\/\S[^\{\}]*)?$/; 32990 var regex2 = /^((http(s?))\:\/\/)([0-9a-zA-Z\-]+\.)+[a-zA-Z]{2,7}(\:[0-9]+)?(\/\S[^\{\}]*)?$/; 32991 32992 if (one) { 32993 link_url = (view) ? '/' + CONFIG_URL + 'config/page/view/index#' : '#'; 32994 if (is_menu) link_url = '/'; 32995 } else { 32996 link_url = (is_menu) ? '/' : '/' + CONFIG_URL + 'config/page/'; 32997 } 32998 32999 if (link) { 33000 if (link.match(/^\@/g) !== null) { // link-type: link-bookmark ==> a[attr-bookmark] 33001 var bookmark_seq = link.replace(/^\@/g, ''); 33002 if (typeof SETTINGS.blockBookmarkList == 'undefined' || typeof SETTINGS.blockBookmarkList['bookmark' + bookmark_seq] == 'undefined') { 33003 return ''; 33004 } 33005 } else if (link.match(/^flink\@[0-9]/gi) !== null) { // link-type: link-file ==> a[attr-flink] 33006 return link; 33007 } else if ($.inArray(link.replace(/^\//g, '').replace(/ /g, '-'), MENULIST) > -1) { // link-type: link-menu ==> a[data-user-link] 33008 link_val = link_url + link.replace(/ /g, '-'); 33009 } else { // link-type: link-out ==> a[attr-link] 33010 if(checkBase64Encode(decodeURIComponent(link))) link = Base64.decode(decodeURIComponent(link)); 33011 else if (checkBase64Encode(link)) link = Base64.decode(link); 33012 33013 if(!regex2.test(link) && regex.test(link)) link_val = '//' + link; 33014 } 33015 33016 if(link_val == '') link_val = link; 33017 } 33018 return link_val; 33019} 33020 33021var makeLinkList = function(e, type, id, prev_link, add_arr) { 33022 // type: editor - id : text, button, image 33023 var valid_plan = (typeof VALIDPLAN == 'undefined') ? $.gallery.valid_plan : VALIDPLAN; 33024 var valid_type = (typeof VALIDTYPE == 'undefined') ? $.gallery.valid_type : VALIDTYPE; 33025 33026 var link_content = ((type == 'gallery')) ? '' : '<ul class="link-content edit-link-Content" data-type="' + type + '" data-name="' + id + '">'; 33027 var link_icon = { 'menu': 'active', 'bookmark': 'active', 'flink': (valid_plan && valid_type != 'PK') ? 'active' : 'inactive', 'imagePopup': (valid_plan && valid_type != 'PK') ? 'active' : 'inactive' }; 33028 var link_disabled = { 'submenu': '', 'bookmark': '', 'flink': (valid_plan && valid_type != 'PK') ? '' : 'disabled', 'imagePopup': (valid_plan && valid_type != 'PK') ? '' : 'disabled' }; 33029 var isDefault = ''; 33030 var isOut = ''; 33031 var isFolder = ''; 33032 var isInner = ''; 33033 var isBookmark = ''; 33034 var isFlink = ''; 33035 var isTel_link = ''; 33036 var isSms_link = ''; 33037 var isPopup = ''; 33038 var out_link = ''; 33039 var flink_link = {}; 33040 var popup_link = {}; 33041 var org_prev_link = (prev_link) ? prev_link : ''; 33042 var add_arr = (typeof add_arr!='undefined') ? add_arr : []; 33043 var check_tel = ($.inArray('tel', add_arr) > -1) ? true : false;
33044 var check_sms = ($.inArray('sms', add_arr) > -1) ? true : false; 33045 var telsms_link = ''; 33046 33047 if (prev_link.match(/^\@/g) !== null) { 33048 isBookmark = 'active'; 33049 } else if (prev_link.match(/^flink\@[0-9]/gi) !== null) { 33050 if (valid_plan) { 33051 $.getJSON('/down/flink/get/id/' + prev_link.replace(/^flink\@/gi, ''), {}, function(data) { 33052 checkError(data); 33053 33054 if (typeof data.data == 'object' && !$.isEmptyObject(data.data)) { 33055 isFlink = 'active'; 33056 flink_link = data.data; 33057 } else { 33058 prev_link = ''; 33059 } 33060 }, 'json'); 33061 } else { 33062 prev_link = ''; 33063 } 33064 } else if (prev_link.indexOf('googleusercontent') !== -1 || prev_link.indexOf('storage.googleapis.com/cr-resource/image') !== -1){ 33065 isPopup = (valid_plan)? 'active':''; 33066 } else if((check_tel || check_sms) && (prev_link.indexOf('tel')>-1 || prev_link.indexOf('sms')>-1)) { 33067 isTel_link = (prev_link.indexOf('tel') > -1 ) ? 'active' : isTel_link; 33068 isSms_link = (prev_link.indexOf('sms') > -1 ) ? 'active' : isSms_link; 33069 telsms_link = prev_link; 33070 } else { 33071 if (type == 'menu') { 33072 if (prev_link == id) { isDefault = 'active'; } else if (MENULIST.includes(prev_link.replace(/ /g, '-'))) { isInner = 'active'; } else if (prev_link == 'folder-menu') { isFolder = 'active'; } else { 33073 isOut = 'active'; 33074 if(checkBase64Encode(decodeURIComponent(prev_link))) out_link = Base64.decode(decodeURIComponent(prev_link)); 33075 else out_link = decodeURI(prev_link.replace(/%27/g, ''')).replace(/\"/g, '"'); 33076 } 33077 } 33078 33079 if ($.inArray(type, ['image', 'gallery', 'popup', 'popupbanner', 'bandbanner', 'quickmenu','fnav', 'showcase', 'editor']) > -1) { 33080 var check_menu_str = (type == 'editor') ? prev_link.replace(/^\//g, '') : prev_link; 33081 if (prev_link == '') { 33082 if (type == 'fnav' || (type == 'editor' && id == 'text')) { 33083 isOut = 'active'; 33084 } else { 33085 isDefault = 'active'; 33086 } 33087 } else if (MENULIST.includes(check_menu_str.replace(/ /g, '-'))) { 33088 console.log('MENU LINK'); 33089 isInner = 'active'; 33090 } else { 33091 isOut = 'active'; 33092 if(checkBase64Encode(decodeURIComponent(prev_link))) out_link = Base64.decode(decodeURIComponent(prev_link)); 33093 else out_link = decodeURI(prev_link.replace(/%27/g, ''')).replace(/\"/g, '"'); 33094 } 33095 } 33096 } 33097 var one = (typeof ONE == 'undefined') ? $.gallery.one : ONE; 33098 var temp = (type == 'menu') ? 'editor.link.inner.select.menu' : (one) ? 'editor.link.inner.select.page.1' : 'editor.link.inner.select.page.0'; 33099 var select_menu_str = (isInner) ? prev_link : $.lang[LANG][temp]; 33100 var select_menu_selected = ''; 33101 33102 var site_smenu = (typeof SMENU == 'undefined') ? $.gallery.SMENU : SMENU; 33103 var menulist_val = makeMenuLinkList(site_smenu, type, id, prev_link); 33104 var isList = true; 33105 if (menulist_val.length == 0) { 33106 select_menu_str = $.lang[LANG]['editor.link.inner.empty']; 33107 isList = false; 33108 link_disabled['submenu'] = 'disabled'; 33109 if (type == 'menu') { 33110 isInner = (isInner == 'active') ? '' : isInner; 33111 isFolder = (isFolder == 'active') ? '' : isFolder; 33112 link_icon['menu'] = 'inactive'; 33113 } 33114 } 33115 33116 var isBookmarkList = true; 33117 var select_bookmark_str = $.lang[LANG]['editor.link.bookmark.select']; 33118 var select_bookmark_selected = ''; 33119 var bookmarklist_val = makeBookmarkList(SETTINGS.blockBookmarkList, type, id, org_prev_link); 33120 33121 var blockBookmarkList = (typeof SETTINGS.blockBookmarkList != 'undefined' && SETTINGS.blockBookmarkList) ? SETTINGS.blockBookmarkList : {}; 33122 var hideArray = blockBookmarkList?.hide || []; 33123 var bookmark_orgprev_link = org_prev_link.replace('@', ''); 33124 33125 if (bookmarklist_val.length == 0) { 33126 if (isBookmark == 'active') { 33127 isBookmark = ''; 33128 isDefault = 'active'; 33129 select_menu_str = $.lang[LANG][temp]; 33130 } 33131 isBookmarkList = false;
33132 link_disabled['bookmark'] = 'disabled'; 33133 link_icon['bookmark'] = 'inactive'; 33134 select_bookmark_str = $.lang[LANG]['editor.link.bookmark.empty']; 33135 } else { 33136 if (typeof SETTINGS.blockBookmarkList[org_prev_link.replace(/^\@/g, 'bookmark')] != 'undefined' && SETTINGS.blockBookmarkList[org_prev_link.replace(/^\@/g, 'bookmark')]) { 33137 select_bookmark_str = SETTINGS.blockBookmarkList['bookmark' + org_prev_link.replace(/^\@/g, '')]; 33138 select_bookmark_selected = ' data-link-seq="' + org_prev_link.replace(/^\@/g, '') + '"'; 33139 } else { 33140 if (isBookmark == 'active') { 33141 isBookmark = ''; 33142 isDefault = 'active'; 33143 prev_link = $.lang[LANG][temp]; 33144 } 33145 } 33146 } 33147 33148 if (hideArray.length > 0) { 33149 if (hideArray.includes(bookmark_orgprev_link)) { 33150 isBookmark = ''; 33151 isDefault = 'active'; 33152 } 33153 } 33154 33155 // if($('.' + selectEL).attr('data-img-parallax') == 'true') { 33156 // link_disabled['imagePopup'] = 'disabled'; 33157 // link_icon['imagePopup'] = 'inactive'; 33158 // if(isPopup == 'active') { 33159 // isPopup = ''; 33160 // isDefault = 'active'; 33161 // } 33162 // } 33163 33164 if (type == 'menu') { 33165 if (isDefault == '' && isOut == '' && isInner == '' && isBookmark == '' && isFlink == '' && isFolder == '') { isDefault = 'active'; } 33166 } 33167 if (type == 'showcase') { 33168 if (isDefault == '' && isOut == '' && isInner == '' && isBookmark == '') { isDefault = 'active'; } 33169 } 33170 if ($.inArray(type, ['gallery', 'popup', 'popupbanner', 'bandbanner', 'quickmenu']) > -1) { 33171 if (isDefault == '' && isOut == '' && isInner == '' && isBookmark == '' && isFlink == '' && isTel_link == '' && isSms_link == '') { isDefault = 'active'; } 33172 } 33173 if (type == 'image') { 33174 if (isDefault == '' && isOut == '' && isInner == '' && isBookmark == '' && isFlink == '' && isPopup == '') { isDefault = 'active'; } 33175 } 33176 if (type == 'fnav') { 33177 if (isOut == '' && isInner == '' && isBookmark == '') { isOut = 'active'; } 33178 } 33179 if (type == 'editor') { 33180 if (isOut == '' && isInner == '' && isBookmark == '' && isFlink == '') { 33181 if (id == 'text') { isOut = 'active'; } else if (id == 'button' || id == 'image') { isDefault = 'active'; } 33182 } 33183 } 33184 33185 var link_deafult_text = { 33186 'menu': $.lang[LANG]['editor.link.default'], 33187 'gallery': $.lang[LANG]['editor.link.default'], 33188 'image': $.lang[LANG]['editor.link.default.image'], 33189 'popup': $.lang[LANG]['editor.link.default.popup'], 33190 'popupbanner': $.lang[LANG]['editor.link.default.popupbanner'], 33191 'bandbanner': $.lang[LANG]['editor.link.default.bandbanner'], 33192 'quickmenu': $.lang[LANG]['editor.link.default.quickmenu'], 33193 'showcase': $.lang[LANG]['editor.link.default.showcase'], 33194 'editor': $.lang[LANG]['editor.link.default.editor'], 33195 }; 33196 33197 link_content += (type == 'fnav' || (type == 'editor' && id == 'text')) ? '' : '\ 33198 <li class="link-type ' + isDefault + '">\ 33199 <div class="link-default">\ 33200 ' + clSVG('checkbox_active',20,20,false) + '\ 33201 <h5>' + link_deafult_text[type] + '</h5>\ 33202 </div>\ 33203 </li>\ 33204 '; 33205 33206 link_content += '\ 33207 <li class="link-type ' + isOut + '">\ 33208 <div class="link-out">\ 33209 ' + clSVG('checkbox_active',20,20,false) + '\ 33210 <h5>' + $.lang[LANG]['editor.link.out'] + '</h5>\ 33211 <div class="cl-common-form-wrap nonplace-holder">\ 33212 <div class="cl-common-form-group">\ 33213 <input type="text" class="link-input" placeholder="' + $.lang[LANG]['editor.link.input.info'] + '" value="' + out_link + '">\ 33214 </div>\ 33215 </div>\ 33216 </div>\ 33217 </li>\ 33218 '; 33219 33220 if (type == 'menu') { 33221 link_content += '\ 33222 <li class="link-type ' + isInner + ' ' + link_disabled['submenu'] + '">\ 33223 <div class="link-inner">\ 33224 ' + clSVG('checkbox_'+link_icon['menu'],20,20,false) + '\ 33225 <h5>' + $.lang[LANG]['editor.link.inner'] + '</h5>\ 33226 <div class="group-wrap">\ 33227 <div class="input-group">\ 33228 <div class="inner-toggle btn btn-sm dropdown-toggle ' + link_disabled['submenu'] + '" data-toggle="dropdown">\
33229 <span class="select-link">' + select_menu_str + '</span>'; 33230 if (isList) link_content += '<svg viewBox="0 0 8 4" width="8" height="4" class="hand"><polygon points="0 0 4 4 8 0 "/></svg>'; 33231 link_content += '\ 33232 </div>\ 33233 <ul class="dropdown-menu link-innerlist" role="menu">\ 33234 ' + menulist_val + '\ 33235 </ul>\ 33236 </div>\ 33237 <div>\ 33238 </div>\ 33239 </li>\ 33240 '; 33241 } 33242 33243 if ($.inArray(type, ['image', 'gallery', 'popup', 'popupbanner', 'bandbanner', 'quickmenu', 'fnav', 'showcase', 'editor']) > -1) { 33244 var lang_text = 'editor.link.inner.menu'; 33245 if (isInner && type == 'image' && $('<ul>' + menulist_val + '</ul>').children('li[data-userlink="' + prev_link + '"]').length == 0) { 33246 $('<ul>' + menulist_val + '</ul>').children().each(function() { 33247 if ($(this).attr('data-userlink').replace(/ /g, '-') == prev_link.replace(/ /g, '-')) { 33248 prev_link = $(this).attr('data-userlink'); 33249 } 33250 }); 33251 } 33252 33253 33254 var select_inner_str = (isInner && type == 'editor') ? prev_link.replace(/\//g, '')
33254: select_menu_str; 33255 var select_inner_selected = (isInner) ? ' data-link-val="' + prev_link.replace(/\//g, '') + '"' : ''; 33256 33257 link_content += '\ 33258 <li class="link-type ' + isInner + ' ' + link_disabled['submenu'] + '">\ 33259 <div class="link-menu">\ 33260 ' + clSVG('checkbox_active',20,20,false) + '\ 33261 <h5>' + $.lang[LANG][lang_text] + '</h5>\ 33262 <svg class="cm-popover-info" viewBox="0 0 13 13" width="13" height="13" tabindex="0" data-toggle="popover" data-trigger="hover" data-html="true" data-placement="top" data-content="' + $.lang[LANG]['editor.link.inner.menu.info'] + '">\ 33263 <path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"/>\ 33264 <rect x="6" y="9" width="1" height="1"/>\ 33265 <path d="M6.66 3.01C5.61 3.01 4.58 3.5 4.5 4.8c0 0.06-0.01 0.12 0 0.2h1.02c0-0.07 0.01-0.15 0.02-0.23 0.08-0.62 0.52-0.76 1.08-0.76 0.63 0 1.02 0.37 1.02 0.95 -0.01 0.48-0.3 0.87-0.76 1.34C6.21 6.97 6.02 7.37 6 8h0.99C7 7.66 7.04 7.37 7.67 6.75 8.17 6.27 8.7 5.68 8.7 4.87 8.7 3.85 7.89 3.01 6.66 3.01z"/>\ 33266 </svg>\ 33267 <div class="group-wrap">\ 33268 <div class="btn-group">\ 33269 <div class="inner-toggle btn btn-sm dropdown-toggle ' + link_disabled['submenu'] + '" data-toggle="dropdown">\ 33270 <span class="select-link" ' + select_inner_selected + '>' + select_inner_str + '</span>'; 33271 if (isList) link_content += '<svg viewBox="0 0 8 4" width="8" height="4" class="hand"><polygon points="0 0 4 4 8 0 "/></svg>'; 33272 link_content += '\ 33273 </div>\ 33274 <ul class="dropdown-menu link-innerlist" role="menu">\ 33275 ' + menulist_val + '\ 33276 </ul>\ 33277 </div>\ 33278 </div>\ 33279 </div>\ 33280 </li>\ 33281 '; 33282 } 33283 33284 link_content += '\ 33285 <li class="link-type ' + isBookmark + ' ' + link_disabled['bookmark'] + '">\ 33286 <div class="link-bookmark">\ 33287 ' + clSVG('checkbox_'+link_icon['bookmark'],20,20,false) + '\ 33288 <h5>' + $.lang[LANG]['editor.link.bookmark'] + '</h5>\ 33289 <svg class="cm-popover-info" viewBox="0 0 13 13" width="13" height="13" tabindex="0" data-toggle="popover" data-trigger="hover" data-html="true" data-placement="top" data-content="' + $.lang[LANG]['editor.link.bookmark.info'] + '">\ 33290 <path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"/>\ 33291 <rect x="6" y="9" width="1" height="1"/>\ 33292 <path d="M6.66 3.01C5.61 3.01 4.58 3.5 4.5 4.8c0 0.06-0.01 0.12 0 0.2h1.02c0-0.07 0.01-0.15 0.02-0.23 0.08-0.62 0.52-0.76 1.08-0.76 0.63 0 1.02 0.37 1.02 0.95 -0.01 0.48-0.3 0.87-0.76 1.34C6.21 6.97 6.02 7.37 6 8h0.99C7 7.66 7.04 7.37 7.67 6.75 8.17 6.27 8.7 5.68 8.7 4.87 8.7 3.85 7.89 3.01 6.66 3.01z"/>\ 33293 </svg>\ 33294 <div class="group-wrap">\ 33295 <div class="btn-group">\ 33296 <div class="bookmark-toggle btn btn-sm dropdown-toggle inner-toggle ' + link_disabled['bookmark'] + '" data-toggle="dropdown">\ 33297 <span class="select-bookmark" ' + select_bookmark_selected + '>' + select_bookmark_str + '</span>\ 33298 '; 33299 33300 if (isBookmarkList) link_content += '<svg viewBox="0 0 8 4" width="8" height="4" class="hand"><polygon points="0 0 4 4 8 0 "/></svg>'; 33301 link_content += '\ 33302 </div>\ 33303 <ul class="dropdown-menu link-bookmarklist" role="bookmark">\ 33304 ' + bookmarklist_val + '\ 33305 </ul>\ 33306 </div>\ 33307 </div>\ 33308 </div>\ 33309 </li>\ 33310 '; 33311 33312 if ($.inArray(type, ['menu', 'image', 'gallery', 'popup', 'popupbanner', 'bandbanner', 'quickmenu', 'editor']) > -1) { 33313 var service = (typeof SERVICE == 'undefined') ? $.gallery.service : SERVICE; 33314 var flink_popover_str = (service.indexOf('gabia') > -1) ? $.lang[LANG]['editor.link.file.info.gabia'] : $.lang[LANG]['editor.link.file.info']; 33315 var flink_s = Number(flink_link.size); 33316 var flink_unit = (flink_s > 1024) ? 'unit_m' : ''; 33317 var flink_size = (flink_s > 1024) ? flink_s / 1024 : flink_s; 33318 33319 if(LUX) flink_popover_str = $.lang[LANG]['editor.link.file.info.lux']; 33320 33321 link_content += '\ 33322 <li class="link-type ' + isFlink + ' ' + link_disabled['flink'] + ' flink">\ 33323 <div class="link-file">\ 33324 ' + clSVG('checkbox_'+link_icon['flink'],20,20,false) + '\ 33325 <h5>' + $.lang[LANG]['editor.link.file'] + '<svg class="cm-popover-info ' + LANG + '" viewBox="0 0 13 13" width="13" height="13" tabindex="0" data-toggle="popover" data-trigger="hover" data-html="true" data-placement="top" data-content="' + flink_popover_str + '">\ 33326 <path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"/>\ 33327 <rect x="6" y="9" width="1" height="1"/>\ 33328 <path d="M6.66 3.01C5.61 3.01 4.58 3.5 4.5 4.8c0 0.06-0.01 0.12 0 0.2h1.02c0-0.07 0.01-0.15 0.02-0.23 0.08-0.62 0.52-0.76 1.08-0.76 0.63 0 1.02 0.37 1.02 0.95 -0.01 0.48-0.3 0.87-0.76 1.34C6.21 6.97 6.02 7.37 6 8h0.99C7 7.
3332866 7.04 7.37 7.67 6.75 8.17 6.27 8.7 5.68 8.7 4.87 8.7 3.85 7.89 3.01 6.66 3.01z"/>\ 33329 </svg></h5>\ 33330 <div class="group-wrap">\ 33331 '; 33332 33333 link_content += (valid_plan && valid_type != 'PK') ? '\ 33334 <div class="btn-group">\ 33335 <span class="btn btn-sm fileinput-button flink-add">\ 33336 ' + clSVG('paperclip', '16', '16', false, '') + '\ 33337 <span> ' + $.lang[LANG]['editor.link.file.btn'] + '</span>\ 33338 </span>\ 33339 </div>\ 33340 <span class="prop-flink-ctrl ' + isFlink + '">\ 33341 <span class="flink-info" ' + ((isFlink) ? 'data-id="' + flink_link.seq + '"' : '') + '>\ 33342 <span class="flink-name">' + ((isFlink) ? flink_link.name : '') + '</span>\ 33343 <span class="flink-size ' + flink_unit + '">' + ((isFlink) ? flink_size.toFixed(0) : '') + '</span>\ 33344 </span>\ 33345 <span class="hand flink-cancel"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="10" height="10"><path d="M8.71 8l7.15-7.15c0.2-0.2 0.2-0.51 0-0.71s-0.51-0.2-0.71 0L8 7.29 0.85 0.15c-0.2-0.2-0.51-0.2-0.71 0s-0.2 0.51 0 0.71L7.29 8l-7.15 7.15c-0.2 0.2-0.2 0.51 0 0.71C0.24 15.95 0.37 16 0.5 16s0.26-0.05 0.35-0.15L8 8.71l7.15 7.15c0.1 0.1 0.23 0.15 0.35 0.15s0.26-0.05 0.35-0.15c0.2-0.2 0.2-0.51 0-0.71L8.71 8z"></path></svg></span>\ 33346 </span>\ 33347 ' : '\ 33348 <div class="btn-group">\ 33349 <span class="btn btn-sm btn-flink-upgrade">\ 33350 ' + clSVG('paperclip', '16', '16', false, '') + '\ 33351 <span> ' + $.lang[LANG]['editor.link.file.btn'] + '</span>\ 33352 </span>\ 33353 </div>\ 33354 <!--<div class="btn-group">\ 33355 <a class="btn btn-sm btn-flink-upgrade" href="' + ((SERVICE.indexOf('gabia') > -1) ? '//www.gabia.com/mygabia/service" target="_blank' : '/upgrade/site/') + '">\ 33356 ' + clSVG('planupgrade',18,18) + '<span>' + $.lang[LANG]['dashbord.toolbar.upgrade-site'] + '</span>\ 33357 </a>\ 33358 </div>-->\ 33359 '; 33360 link_content += '\ 33361 </div>\ 33362 </div>\ 33363 </li>\ 33364 '; 33365 } 33366 33367 var telsms_link_2 = telsms_link.replace(/(tel|sms)\:/gi,''); 33368 var telsms_link_array = []; 33369 var tel_link_array = []; 33370 var sms_link_array = []; 33371 33372 if(check_tel || check_sms) { 33373 if(telsms_link_2.indexOf('-') > -1) { 33374 if(prev_link.indexOf('tel')>-1) tel_link_array = telsms_link_2.split('-'); 33375 else if(prev_link.indexOf('sms')>-1) sms_link_array = telsms_link_2.split('-'); 33376 } 33377 33378 if(tel_link_array.length === 2) tel_link_array = ['', tel_link_array[0], tel_link_array[1]]; 33379 if(sms_link_array.length === 2) sms_link_array = ['', sms_link_array[0], sms_link_array[1]]; 33380 33381 link_content += ` 33382 <li class="link-type ${isTel_link} tel"> 33383 <div class="link-tel"> 33384 ${clSVG('checkbox_active',20,20,false)} 33385 <h5>${$.lang[LANG]['editor.link.tel']}</h5> 33386 <div class="cl-common-form-wrap nonplace-holder"> 33387 <div class="cl-common-form-group"> 33388 <input type="number" class="link-input" placeholder="000" value="${tel_link_array[0] || ''}"> 33389 </div> 33390 <span class="text">-</span> 33391 <div class="cl-common-form-group"> 33392 <input type="number" class="link-input" placeholder="0000" value="${tel_link_array[1] || ''}"> 33393 </div> 33394 <span class="text">-</span> 33395 <div class="cl-common-form-group"> 33396 <input type="number" class="link-input" placeholder="0000" value="${tel_link_array[2] || ''}"> 33397 </div> 33398 </div> 33399 </div> 33400 </li> 33401 <li class="link-type ${isSms_link} sms"> 33402 <div class="link-sms"> 33403 ${clSVG('checkbox_active',20,20,false)} 33404 <h5>${$.lang[LANG]['editor.link.sms']}</h5> 33405 <div class="cl-common-form-wrap nonplace-holder"> 33406 <div class="cl-common-form-group"> 33407 <input type="number" class="link-input" placeholder="000" value="${sms_link_array[0] || ''}"> 33408 </div>
33409 <span class="text">-</span> 33410 <div class="cl-common-form-group"> 33411 <input type="number" class="link-input" placeholder="0000" value="${sms_link_array[1] || ''}"> 33412 </div> 33413 <span class="text">-</span> 33414 <div class="cl-common-form-group"> 33415 <input type="number" class="link-input" placeholder="0000" value="${sms_link_array[2] || ''}"> 33416 </div> 33417 </div> 33418 </div> 33419 </li> 33420 `; 33421 } 33422 33423 if (type == 'image') { 33424 var popup_popover_str = (SERVICE.indexOf('gabia') > -1) ? $.lang[LANG]['editor.link.imagePopup.info.gabia'] : $.lang[LANG]['editor.link.imagePopup.info']; 33425 var popup_info = prev_link.split('||'); 33426 var popupLink = popup_info[0]; 33427 var popupName = popup_info[1]; 33428 33429 link_content += '\ 33430 <li class="link-type ' + isPopup + ' ' + link_disabled['imagePopup'] + ' imagePopup">\ 33431 <div class="link-popup">\ 33432 ' + clSVG('checkbox_'+link_icon['imagePopup'],20,20,false) + '\ 33433 <h5>' + $.lang[LANG]['editor.link.imagePopup'] + '<svg class="cm-popover-info hand ' + LANG + '" viewBox="0 0 13 13" width="13" height="13" tabindex="0" data-toggle="popover" data-trigger="focus" data-html="true" data-placement="top" data-content="' + popup_popover_str + '">\ 33434 <path d="M6.5 0C2.91 0 0 2.91 0 6.5S2.91 13 6.5 13 13 10.09 13 6.5 10.09 0 6.5 0zM6.5 12C3.47 12 1 9.53 1 6.5S3.47 1 6.5 1 12 3.47 12 6.5 9.53 12 6.5 12z"/>\ 33435 <rect x="6" y="9" width="1" height="1"/>\ 33436 <path d="M6.66 3.01C5.61 3.01 4.58 3.5 4.5 4.8c0 0.06-0.01 0.12 0 0.2h1.02c0-0.07 0.01-0.15 0.02-0.23 0.08-0.62 0.52-0.76 1.08-0.76 0.63 0 1.02 0.37 1.02 0.95 -0.01 0.48-0.3 0.87-0.76 1.34C6.21 6.97 6.02 7.37 6 8h0.99C7 7.66 7.04 7.37 7.67 6.75 8.17 6.27 8.7 5.68 8.7 4.87 8.7 3.85 7.89 3.01 6.66 3.01z"/>\ 33437 </svg></h5>\ 33438 <div class="group-wrap">\ 33439 '; 33440 33441 link_content += (VALIDPLAN && VALIDTYPE != 'PK') ? '\ 33442 <div class="btn-group">\ 33443 <span class="btn btn-sm fileinput-button popupImage-add">\ 33444 ' + clSVG('file-image', '13', '13', false, '') + '\ 33445 <span> ' + $.lang[LANG]['editor.link.imagePopup.btn'] + '</span>\ 33446 </span>\ 33447 </div>\ 33448 <span class="prop-popup-ctrl ' + isPopup + '">\ 33449 <span class="popup-info" ' + ((isPopup) ? 'data-popup="' + prev_link + '"' : '') + '>\ 33450 <span class="popup-name">' + ((isPopup) ? popupName : '') + '</span>\ 33451 </span>\ 33452 <span class="hand popup-cancel"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="10" height="10"><path d="M8.71 8l7.15-7.15c0.2-0.2 0.2-0.51 0-0.71s-0.51-0.2-0.71 0L8 7.29 0.85 0.15c-0.2-0.2-0.51-0.2-0.71 0s-0.2 0.51 0 0.71L7.29 8l-7.15 7.15c-0.2 0.2-0.2 0.51 0 0.71C0.24 15.95 0.37 16 0.5 16s0.26-0.05 0.35-0.15L8 8.71l7.15 7.15c0.1 0.1 0.23 0.15 0.35 0.15s0.26-0.05 0.35-0.15c0.2-0.2 0.2-0.51 0-0.71L8.71 8z"></path></svg></span>\ 33453 </span>\ 33454 ' : '\ 33455 <div class="btn-group">\ 33456 <span class="btn btn-sm btn-popup-upgrade">\ 33457 ' + clSVG('file-image', '13', '13', false, '') + '\ 33458 <span> ' + $.lang[LANG]['editor.link.imagePopup.btn'] + '</span>\ 33459 </span>\ 33460 </div>\ 33461 '; 33462 link_content += '\ 33463 </div>\ 33464 </div>\ 33465 </li>\ 33466 '; 33467 } 33468 33469 if (type == 'menu') { 33470 link_content += '\ 33471 <li class="link-type ' + isFolder + ' ' + link_disabled['submenu'] + '">\ 33472 <div class="link-folder">' + clSVG('checkbox_'+link_icon['menu'],20,20,false) + '\ 33473 <h5>' + $.lang[LANG]['editor.link.folder'] + '</h5>\ 33474 </div>\ 33475 </li>\ 33476 '; 33477 } 33478 if (type == 'editor') return { 'str': link_content, 'display': select_menu_str }; 33479 else return link_content; 33480} 33481 33482var makeMenuLinkList = function(s, type, id, prev_link) { 33483 // console.log(s); 33484 // console.log('type: '+type+', id: '+id+', prev_link: '+prev_link); 33485 var depth = 0; 33486 var str = ''; 33487 var isActive = ''; 33488 if (type == 'menu') { 33489 menu = function(level, depth) { 33490 $.each(level, function(idx, obj) { 33491 if (obj.name == id && obj.children.length > 0) menu(obj.children, depth + 1); 33492 if (depth != 0) { 33493 isActive = (prev_link == obj.name) ? 'active' : ''; 33494 str = str + '<li data-userlink="' + obj.name + '" class="' + isActive + '"><a href="javascript:;">' + obj.name + '</a></li>'; 33495 } 33496 }); 33497 return str; 33498 } 33499 return menu(s, depth); 33500 } 33501 33502 if ($.inArray(type, ['image', 'gallery', 'popup', 'popupbanner', 'bandbanner', 'quickmenu','fnav', 'showcase', 'editor']) > -1) { 33503 menu = function(level, depth) { 33504 $.each(level, function(idx, obj) { 33505 var check_menu_str = (type == 'editor') ? prev_link.replace(/^\//g, '')
33505: prev_link; 33506 isActive = (check_menu_str.replace(/ /g, '-') == obj.name.replace(/ /g, '-')) ? 'active' : ''; 33507 var onoff = (obj.display == 'on') ? '' : ' off'; 33508 if (depth == 0) { 33509 str = str + '<li data-userlink="' + obj.name + '" class="' + isActive + onoff + '"><a href="javascript:;">' + obj.name + '</a></li>'; 33510 } else { 33511 str = str + '\ 33512 <li data-userlink="' + obj.name + '" class="' + isActive + '">\ 33513 <a href="javascript:;"><i class="fa fa-level-up"></i>' + obj.name + '</a>\ 33514 </li>'; 33515 } 33516 33517 if (obj.children) menu(obj.children, depth + 1); 33518 }); 33519 return str; 33520 } 33521 33522 return menu(s, depth); 33523 } 33524}; 33525$('.menu-edit-cancel').live('click', function() { 33526 menuEdit = false; 33527 menu_edit_cancel(); 33528}); 33529 33530var menu_edit_cancel = function() { 33531 if ($('#nestable > .dd-list').children().last().prev().attr('data-id') == 'menu-added') { 33532 $('#nestable > .dd-list').children().last().prev().remove(); 33533 } else { 33534 $('.menu-edit-cancel').parents('.menu-edit-text').hide(); 33535 } 33536 $('#menu-add').show(); 33537} 33538 33539$(document) 33540 .on('click', '.flink-cancel', function(e) { 33541 var flinkConfig = $(this).closest('.prop-flink-ctrl'); 33542 flinkConfig.removeClass('active'); 33543 flinkConfig.find('.flink-info').removeAttr('data-id'); 33544 flinkConfig.find('.flink-name,.flink-size').empty(); 33545 }) 33546 .on('click', '.flink-add', function(e) { 33547 var block_el = (typeof editEL == 'undefined') ? $.gallery.block_el : editEL; 33548 33549 if(typeof editEL != 'undefined') { 33550 menuConfigToggle('close'); 33551 siteConfigToggle('close'); 33552 } 33553 var block_el = (typeof editEL == 'undefined') ? $.gallery.block_el : editEL; 33554 $('.g-body .text-menu').removeClass('active').addClass('hide'); 33555 if (typeof fr_editor != 'undefined' && fr_editor != '') $(fr_editor.popups.get('link.insert')).addClass('allways'); 33556 setResourceBtn(true,{maxcount:1, property:'flink-change', element:`.${block_el}`}); 33557 }); 33558 33559var setFileLink = function() { 33560 var selectedFlink = $('#filestorage .fitem.selected'); 33561 var selected = (selectedFlink.length > 0) ? true : false; 33562 var selected_count = (selected) ? 1 : 0; 33563 var obj = (selected) ? { 33564 'name': selectedFlink.find('p.fitem-name').text(), 33565 'size': selectedFlink.find('p.fitem-size .size').attr('data-size'), 33566 'seq': selectedFlink.find('p.fitem-name').attr('data-seq'), 33567 'file': selectedFlink.find('p.fitem-name').attr('data-source'), 33568 } : {}; 33569 33570 var flinkConfig = $('.link-file .prop-flink-ctrl'); 33571 var flink_s = Number(obj.size.replace(',', '')); 33572 var flink_unit = (flink_s > 1024) ? 'unit_m' : ''; 33573 var flink_size = (flink_s > 1024) ? flink_s / 1024 : flink_s; 33574 33575 flinkConfig.find('.flink-info .flink-name').text(obj.name); 33576 flinkConfig.find('.flink-info .flink-size').text(flink_size.toFixed(0)); 33577 if (flink_unit) flinkConfig.find('.flink-info .flink-size').addClass('unit_m'); 33578 else flinkConfig.find('.flinkflink-info .flink-size').removeClass('unit_m'); 33579 flinkConfig.find('.flink-info').attr('data-id', obj.seq); 33580 flinkConfig.addClass('active'); 33581 selectCount = 0; 33582 $('#el-fileupload').modal('hide'); 33583} 33584 33585 33586$('.link-type').live({ 33587 click: function(e) { 33588 if ($(e.target).is('a') && $(e.target).hasClass('upgrade-link')) return; 33589 if ($(this).hasClass('disabled')) { 33590 $('.link-type').find('.linkguidetext').remove(); 33591 var link_type = $(this).children('div[class*="link-"]').attr('class').replace(/^link-/gi, ''); 33592 var guide_str = (link_type == 'inner' || link_type == 'folder') ? $.lang[LANG]['editor.link.inner.guide'] : $.lang[LANG]['editor.link.bookmark.guide']; 33593 if (link_type == 'file') { 33594 guide_str = (SERVICE.indexOf('gabia') > -1) ? $.lang[LANG]['editor.link.file.upgrade.gabia'] : $.lang[LANG]['editor.link.file.upgrade']; 33595 } else if (link_type == 'popup') { 33596 if(!VALIDPLAN || VALIDTYPE == 'PK') { 33597 guide_str = (SERVICE.indexOf('gabia') > -1) ? $.lang[LANG]['editor.link.imagePopup.upgrade.gabia'] : $.lang[LANG]['editor.link.imagePopup.upgrade']; 33598 } else { 33599 guide_str = '' ; 33600 return; 33601 } 33602 } 33603 33604 $(this).append('<p class="linkguidetext edit-link-error">' + clSVG('info', 13, 13) + guide_str + '</p>'); 33605 return; 33606 } 33607 33608 if ($(this).closest('.link-content[data-type="popup"]').length > 0 && $(this).children('.link-default').length > 0) $('#popup-linktarget-onoff').removeAttr('checked'); 33609 $('.link-type').find('.linkguidetext').remove(); 33610 $(this).parent().children().removeClass('active'); 33611 $(this).addClass('active'); 33612 33613 if($(this).children().attr('class') == 'link-default' || $(this).children().attr('class') == 'link-file' || $(this).children().attr('class') == 'link-popup') { 33614 $('#linktarget-onoff').prop('checked', false); 33615 $('#linktarget-onoff').closest('.newcheckbox').addClass('disabled'); 33616 } else { 33617 $('#linktarget-onoff').closest('.newcheckbox').removeClass('disabled'); 33618 } 33619 } 33620}); 33621 33622var getInputLink = function(type) { 33623 var link = ''; 33624 var isOkay = true; 33625 var isActive = true; 33626 // var regex = /([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w_\.-]*)/ig; 33627 var regex = /^(((http(s?))\:\/\/||\/\/)?)([0-9a-zA-Z\-]+\.)+[a-zA-Z]{2,7}(\:[0-9]+)?(\/\S[^\{\}]*)?$/; //http://do doesn't 33628 var regex2 = /^((http(s?))\:\/\/||\/\/)([0-9a-zA-Z\-\_]+\.)+[a-zA-Z]{2,7}(\:[0-9]+)?(\/\S[^\{\}]*)?$/; //http://do 33629 var regex3 = /^(https?:\/\/||\/\/)?(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]/; // add punycode 33630 var regexKR = /^(https?:\/\/||\/\/)?((([a-z\d](([a-z\d-]*[a-z\d]))|([ã±-í£])*)\.)+(([a-zã±-í£]{2,}))|((\d{1,3}\.){3}\d{1,3}))(\:\d+)?(\/[-a-z\d%_.~+]*)*(\?[;&a-z\d%_.~+=-]*)?(\#[-a-z\d_]*)?$/; 33631 var regexTel = /^tel\:[0-9-+]+$/; 33632 33633 function showInputLinkError(linktype, error) { 33634 $('.link-content').find('.linkguidetext').remove(); 33635 var activeLinkConfig = $('.link-content').find('.' + linktype); 33636 var error_class = 'linkguidetext edit-link-error'; 33637 var error_txt = ''; 33638 33639 if (error == 'empty') { 33640 error_txt = $.lang[LANG]['editor.link.empty.' + linktype.replace('link-', '')]; 33641 } else { 33642 if (linktype == 'link-out') { 33643 $('.link-input').focus(); 33644 if (error == 'config') error_class = 'linkguidetext modal-layout'; 33645 error_txt = (error == 'emoji') ? $.lang[LANG]['config.unable.emoji'] : $.lang[LANG]['editor.menu.input-link.' + error]; 33646 } 33647 } 33648 33649 if (typeof error_txt == 'undefined' || error_txt.length == 0) return false;
33650 else activeLinkConfig.after('<p class="' + error_class + '">' + clSVG('info', 13, 13) + error_txt + '</p>'); 33651 } 33652 33653 switch (type) { 33654 case 'link-default': 33655 link = ''; 33656 isActive = false; 33657 break; 33658 33659 case 'link-out': 33660 link = $('.link-input').val().trim(); 33661 isOkay = false; 33662 var error_str = ''; 33663 33664 if (link == '') { //input value empty 33665 showInputLinkError(type, 'info'); 33666 33667 // $('.link-input').focus(); 33668 // if($('.link-out').find('.linkguidetext').length == 0) $('.link-out').prepend('<span class="linkguidetext"><i class="fa fa-exclamation-circle"></i>' + $.lang[LANG]['editor.menu.input-link.info'] + '</span>'); 33669 } else if (link != '') { 33670 if (checkEmojis(link)) { 33671 showInputLinkError(type, 'emoji'); 33672 } else if (link.match('^(tel:|mailto:|sms:)') !== null) { 33673 isOkay = true; 33674 } else if (!regex2.test(link)) { 33675 if (regex.test(link)) { 33676 isOkay = true; 33677 } else if (regex3.test(link) || regexKR.test(link)) { 33678 isOkay = true; 33679 var check_protocol = /^(http(s?)\:\/\/|\/\/?)/; 33680 if (!check_protocol.test(link)) link = '//' + link; 33681 } else if (regexTel.test(link)) { 33682 isOkay = true; 33683 } else { 33684 showInputLinkError(type, 'info'); 33685 // $('.link-input').focus(); 33686 // if($('.link-out').find('.linkguidetext').length == 0) $('.link-out').prepend('<span class="linkguidetext"><i class="fa fa-exclamation-circle"></i>' + $.lang[LANG]['editor.menu.input-link.info'] + '</span>'); 33687 } 33688 } else { 33689 // if($('.link-out').find('.linkguidetext').length > 0) $('.link-out').find('.linkguidetext').remove(); 33690 isOkay = true; 33691 } 33692 } 33693 33694 if (isOkay) { 33695 if (link.match(/\/config/gi) !== null && link.match(/creatorlink/gi) !== null) { 33696 isOkay = false; 33697 showInputLinkError(type, 'config'); 33698 } else { 33699 $('.linkguidetext').remove(); 33700 } 33701 33702 if(checkBase64Encode(decodeURIComponent(link))) link = Base64.decode(decodeURIComponent(link)); 33703 link = encodeURIComponent(Base64.encode(link)); 33704 33705 } 33706 break; 33707 33708 case 'link-inner': 33709 case 'link-menu': 33710 var select_menu = $('.link-innerlist').find('.active'); 33711 isOkay = false; 33712 if (select_menu.length > 0) { 33713 link = select_menu.first().attr('data-userlink'); 33714 isOkay = true; 33715 33716 $('.linkguidetext').remove(); 33717 } else { 33718 showInputLinkError(type, 'empty'); 33719 } 33720 break; 33721 33722 case 'link-bookmark': 33723 var select_bookmark = $('.link-bookmarklist').find('.active'); 33724 isOkay = false; 33725 if (select_bookmark.length > 0) { 33726 link = select_bookmark.first().attr('data-bookmark').replace('bookmark', '\@'); 33727 isOkay = true; 33728 33729 $('.linkguidetext').remove(); 33730 } else { 33731 showInputLinkError(type, 'empty'); 33732 } 33733 break; 33734 33735 case 'link-folder': 33736 link = 'folder-menu'; 33737 break; 33738 33739 case 'link-file': 33740 var ctrl_flink = $('.link-file').find('.prop-flink-ctrl'); 33741 var select_flink = ctrl_flink.find('.flink-info'); 33742 isOkay = false; 33743 if (typeof select_flink.attr('data-id') != 'undefined' && select_flink.attr('data-id')) { 33744 link = 'flink@' + select_flink.attr('data-id'); 33745 isOkay = true; 33746 33747 $('.linkguidetext').remove(); 33748 } else { 33749 showInputLinkError(type, 'empty'); 33750 } 33751 break; 33752 case 'link-popup': 33753 var ctrl_popup = $('.link-popup').find('.prop-popup-ctrl'); 33754 var select_popup = ctrl_popup.find('.popup-info'); 33755 isOkay = false;
33756 if (typeof select_popup.attr('data-popup') != 'undefined' && select_popup.attr('data-popup')) { 33757 link = select_popup.attr('data-popup'); 33758 isOkay = true; 33759 33760 $('.linkguidetext').remove(); 33761 } else { 33762 showInputLinkError(type, 'empty'); 33763 } 33764 break; 33765 33766 case 'link-tel': 33767 case 'link-sms': 33768 var link = ''; 33769 var total = $(`.${type} .cl-common-form-wrap .link-input`).length; 33770 var link_type = `${type.replace(/link\-/gi,'')}:`; 33771 33772 $.each($(`.${type} .cl-common-form-wrap .link-input`), function(i,v){ 33773 if($(this).val().trim() == '') showInputLinkError(type, 'info'); 33774 else { 33775 var split_text = (i==(total-1)) ? '' : '-'; 33776 link += $(this).val().trim() + split_text; 33777 } 33778 }); 33779 33780 link = `${link_type}${link}`; 33781 33782 break; 33783 33784 default: 33785 break; 33786 } 33787 33788 var result = [link, isOkay, isActive]; 33789 return result; 33790} 33791 33792var getElementType = function() { 33793 var type = ''; 33794 var block_el = (typeof selectEL == 'undefined') ? $.gallery.block_el : selectEL; 33795 33796 if(typeof editEL != 'undefined' && editEL != '' && block_el != editEL) block_el = editEL; 33797 33798 switch (block_el) { 33799 case 'el-menu': 33800 type = 'MENU'; 33801 break; 33802 case 'el-footer': 33803 type = 'FOOT'; 33804 break; 33805 default: 33806 type = 'ELEM'; 33807 break; 33808 } 33809 return type; 33810} 33811 33812$('.link-innerlist li').live({ 33813 click: function(e) { 33814 $('.link-innerlist li').removeClass('active'); 33815 $(this).addClass('active'); 33816 var select_userlink = $(this).attr('data-userlink'); 33817 $('.link-content .dropdown-toggle .select-link').text(select_userlink).attr('data-link-val', select_userlink); 33818 } 33819}); 33820 33821 33822var fixedConfigBtn = function() { 33823 if($('html').hasClass('_scroll')) return; 33824 33825 var parentDocument = $(window.parent.document); 33826 var $detail_modal = parentDocument.find('.product-detail-modal'); 33827 if (typeof selectEL == 'undefined' || !selectEL || $('.el-menu header').length == 0 && $detail_modal.length == 0) return false; 33828 var $configEl = $('.' + selectEL + '_ctrl > .config-element'); 33829 var $configTmp = $('.' + selectEL + '_ctrl > .config-template'); 33830 var $galleryDetail = $('.' + selectEL + '_ctrl > .galleryDetail'); 33831 var $navbar = ($detail_modal.length) ? $('.dsgn-body') : $('.el-menu header'); 33832 var navbarOffsetTop = ($('.dsgn-body').hasClass('modoo'))? document.querySelector('.el-menu header').getBoundingClientRect().y : $navbar.offset().top; 33833 var checkSidebar = $('.dsgn-body').is('.sidebar'); 33834 var headerOffset = (!checkSidebar) ? $navbar.outerHeight() + Math.ceil(navbarOffsetTop) : Math.ceil(navbarOffsetTop) + 15; 33835 var btnOffset = (document.querySelector('.' + selectEL + '_ctrl'))? document.querySelector('.' + selectEL + '_ctrl').getBoundingClientRect().y : 0; 33836 var topPos = (!checkSidebar) ? headerOffset + 15 : Math.ceil(navbarOffsetTop) + 15; 33837 var distance = (headerOffset - btnOffset) / 2; 33838 var remain = $('.' + selectEL).height() + btnOffset - headerOffset; 33839 33840 $configEl.removeClass('fixed-ctrl').attr('style', ''); 33841 $configTmp.removeClass('fixed-ctrl').attr('style', ''); 33842 $galleryDetail.removeClass('fixed-ctrl').attr('style', ''); 33843 33844 if($detail_modal.length) { 33845 topPos = $('.openBandBanner').length ? 163 : 23; 33846 distance = 0; 33847 } 33848 // console.log('$navbar', $navbar); 33849 // console.log('headerOffset', headerOffset); 33850 // console.log('btnOffset', btnOffset); 33851 // console.log('distance', distance); 33852 // console.log('remain', remain); 33853 // console.log('topPos', topPos); 33854 33855 $('body').find(`.addElementButton, .config-element-section`).removeClass('zindex19'); 33856 if (selectEL != 'el-menu' && selectEL != 'el-footer') { 33857 var checkHTMLScroll = ($('body').is('.off-config[data-gjs="fixedscroll2"]')) ? true : false; 33858 if (distance > 0 && remain >= 37 || checkHTMLScroll) { 33859 var s_top = ($('body').hasClass('off-config')) ? $('html').scrollTop() : $('.dsgn-body').scrollTop(); 33860 var unset_top = (checkHTMLScroll) ? $('html').scrollTop() : 0; 33861 if (s_top == 0 && $navbar.hasClass('transparent') && selectEL == 'el_0') { 33862 var config_t = headerOffset + 10; 33863 config_t -= unset_top; 33864 $configEl.css('top', config_t + 'px'); 33865 $configTmp.css('top', config_t + 'px'); 33866 } else { 33867 topPos -= unset_top; 33868 $configEl.addClass('fixed-ctrl').css('top', topPos + 'px'); 33869 $configTmp.addClass('fixed-ctrl').css('top', topPos + 'px'); 33870 $galleryDetail.addClass('fixed-ctrl').css('top', topPos + 'px'); 33871 } 33872 33873 if($('.dsgn-body').hasClass('modoo') == false) {
33874 let rightPos = window.innerWidth - $('.' + selectEL).width(); 33875 if(checkSidebar) rightPos -= $('.el-menu header').width(); 33876 if(rightPos > 0) { 33877 $configEl.addClass('fixed-ctrl').css('right', `${rightPos + 8}px`); 33878 } 33879 } 33880 33881 } else { 33882 $configEl.removeClass('fixed-ctrl').attr('style', ''); 33883 $configTmp.removeClass('fixed-ctrl').attr('style', ''); 33884 $galleryDetail.removeClass('fixed-ctrl').attr('style', ''); 33885 33886 if( selectEL != 'el-menu' && 33887 $('html').scrollTop() == 0 && 33888 $('.el-menu .cl-menu-option[data-moption="ntoggle"]').hasClass('open') 33889 ) { 33890 $('body').find(`.addElementButton.add${selectEL}, .${selectEL}_ctrl.config-element-section`).addClass('zindex19'); 33891 } 33892 } 33893 } 33894} 33895 33896var educationModal = function(edu_seq,type,data='') { 33897 var row = '', temp_cont = '', temp_review = ''; 33898 var popup_svg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14 10" width="14" height="10"><path d="m5.77 9.49-5-5 1.42-1.41 3.58 3.59L12.36.08l1.41 1.41z"/></svg>'; 33899 33900 if(type=='list') { 33901 $.ajax({ 33902 url:'/main/eduData/type/getData', 33903 type:'post', 33904 dataType:'json', 33905 async: false, 33906 data:{ 'seq' : edu_seq,'type':'list' }, 33907 success:function(data) { 33908 row = data.data; 33909 temp_cont = JSON.parse(data.modal_data.replace('\\', '')); 33910 temp_review = JSON.parse(data.review_data.replace('\\', '')); 33911 } 33912 }); 33913 } else { 33914 $.ajax({ 33915 url:'/adm/edu/eduEvent/type/getData', 33916 type:'post', 33917 dataType:'json', 33918 async: false, 33919 data:{ 'seq' : data.edu_temp_idx,'type':'update',data:data }, 33920 success:function(data) { 33921 row = data.data; 33922 temp_cont = JSON.parse(data.modal_data.replace('\\', '')); 33923 temp_review = JSON.parse(data.review_data.replace('\\', '')); 33924 } 33925 }); 33926 } 33927 33928 var tp_review = (typeof temp_review == 'undefined' || !temp_review) ? false : true , 33929 tp_target = (typeof temp_cont.target_cont == 'undefined' || !temp_cont.target_cont) ? false : true , 33930 tp_curri = (typeof temp_cont.curri_cont == 'undefined' || !temp_cont.curri_cont) ? false : true; 33931 var edu_url = "", edu_btn_text = "", btn_active = "active"; 33932 if(row.edu_list_closed) { 33933 edu_url = ""; 33934 edu_btn_text = "ì ìë§ê°"; 33935 btn_active = "disabled"; 33936 } else { 33937 edu_url = "window.open('"+ row.edu_url +"')"; 33938 edu_btn_text = row.edu_btn_text; 33939 } 33940 33941 var help_url = 'https://www.creatorlink.net/help'; 33942 33943 var edu_level = ($.isNumeric(temp_cont.guide_level)) ? '<li class="level" data-level="'+temp_cont.guide_level+'">ëì´ë : <span><span class="level1">ì 문</span> - <span class="level2">ì´ê¸</span> - <span class="level3">ì¤ê¸</span> - <span class="level4">ê³ ê¸</span></span></li>' 33944 : '<li class="level" data-level="">ëì´ë : '+temp_cont.guide_level+'</li>'; 33945 var edu_date = row.edu_date, 33946 edu_new = (edu_date >= '2026-08-14 00:00:00') ? 'new' : 'old'; 33947 33948 var edu_header = '\ 33949 <div class="edu_head_wrap">\ 33950 <div class="edu_head_img only-pc" style="background-image: url(\''+temp_cont.head_pc+'\');"></div>\ 33951 <div class="edu_head_img not-pc" style="background-image: url(\''+temp_cont.head_m+'\');"></div>\ 33952 <div class="main-title">\ 33953 '+temp_cont.pc_title+'\ 33954 </div>\ 33955 <div class="edu_head_m not-pc">\ 33956 <div class="guide">\ 33957 <ul class="note">\ 33958 <li>ì¼ì : '+ row.edu_popupDate +'</li>\ 33959 <li>ê°ì ìê° : '+temp_cont.guide_time+'</li>\ 33960 '+edu_level+'\ 33961 <li>ê°ê²© : '+temp_cont.guide_pay+'</li>\ 33962 <li>ê°ì ì¢ ë¥ : '+temp_cont.guide_cate+'</li>\ 33963 <li>ìµì ì¸ì : 10ëª </li>\ 33964 </ul>\ 33965 <ul class="notice">'; 33966 edu_header += (edu_new == 'new') ? '\ 33967 <li>ê°ìì¤ ì ì¥ ë§í¬ë <span>êµ¬ê¸ í¼ ì ì¶ ìë£ íë©´ìì ë°ë¡ íì¸ ê°ë¥</span>íë©° ê°ì ê°ì¤ íì ì, êµì¡ ë¹ì¼ ì ì²íì <span>ë©ì¼ í¹ì ì림í¡ì¼ë¡ë ê°ë³ ìë´</span>ë©ëë¤.</li>\ 33968 ' : '\ 33969 <li>ì ì ë§í¬ë ì ì² ë©ì¼ ë° <span>êµì¡ 1ì¼ ì ê°ë³ ì림í¡</span> ì ë¬</li>\ 33970 <li>ê°ìì¤ ì ì¥ ë§í¬ë <span>ìê° ì ì² ì ì ë ¥íì ë©ì¼ 주ìë¡ ë°ì¡</span>ë©ëë¤.</li>'; 33971 edu_header += '\ 33972 <li>ìµì ì¸ìì´ ì¶©ì¡±ëì§ ìì¼ë©´ <span>ê°ìê° ì§íëì§ ììµëë¤.</span></li>\ 33973 </ul>\ 33974 </div>\ 33975 </div>\ 33976 </div>\ 33977 '; 33978 33979 var summary_list = ''; 33980 $.each(temp_cont.intro_summary,function(i,v) { 33981 summary_list += '<p>'+popup_svg+' '+v+'</p>'; 33982 }); 33983 33984 var edu_intro = '\ 33985 <section id="intro" class="">\ 33986 <div class="teacher">\ 33987 <div class="text not-pc">\ 33988 <p class="title">'+ temp_cont.intro_title +'</p>\ 33989 </div>\ 33990 <div class="photo">\ 33991 <img src="'+ temp_cont.intro_pc_img +'" class="img-responsive only-pc">\ 33992 <img src="'+ temp_cont.intro_m_img +'" class="img-responsive not-pc">\ 33993 </div>\ 33994 <div class="text">\ 33995 <p class="title small only-pc">'+ temp_cont.intro_title +'</i></p>\ 33996 <p class="text">'+ temp_cont.intro_text +'</p>\ 33997 <p class="text name">'+ temp_cont.intro_name +'</p>\ 33998 </div>\ 33999 </div>\ 34000 <div class="line">\ 34001 <p class="title">'+ temp_cont.intro_summary_title +'</p>\ 34002 <div class="content">\ 34003 '+summary_list+'\ 34004 </div>\ 34005 </div>\ 34006 </section>\ 34007 '; 34008 34009 var target_list = ''; 34010 34011 if(tp_target) { 34012 $.each(temp_cont.target_cont,function(i,v) { 34013 target_list += '<p>'+popup_svg+' '+v+'</p>'; 34014 }); 34015 } 34016 34017 var edu_target = (tp_target) ? '\ 34018 <section id="target" class="">\ 34019 <div class="">\ 34020 <p class="title">'+temp_cont.target_title+'</i></p>\ 34021 <div class="content">\ 34022 '+target_list+'\ 34023 </div>\ 34024 </div>\ 34025 </section>\ 34026 ' : '' ; 34027 34028 if(tp_curri) { 34029 var curri_list = ''; 34030 $.each(temp_cont.curri_cont,function(i,v) { 34031 var collapse = (i==0) ? '' : 'collapsed'; 34032 var col_in = (i==0) ? 'in' : ''; 34033 var col_toggle = 'collapse'; 34034 var curri_svg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path d="m14.3 5.21-.7-.71-5.3 5.3-5.29-5.3-.71.71 5.3 5.29.7.71.71-.71z"/></svg>'; 34035 var curri_cont_list = ''; 34036 $.each(v.content,function(i,v) { 34037 curri_cont_list += '<p>'+v+'</p>'; 34038 }); 34039 34040 if((temp_cont.curri_cont.length-1 == i)) { 34041 curri_svg =''; 34042 col_toggle = ''; 34043 } 34044
34045 curri_list += '\ 34046 <div class="panel-heading '+collapse+'" data-toggle="'+col_toggle+'" href="#collapse'+i+'" aria-expanded="false" aria-controls="collapse'+i+'">\ 34047 <h4 class="panel-title">\ 34048 '+v.title+'\ 34049 '+curri_svg+'\ 34050 </h4>\ 34051 </div>\ 34052 <div id="collapse'+i+'" class="panel-collapse collapse '+col_in+' multi-collapse">\ 34053 <div class="panel-body">\ 34054 '+curri_cont_list+'\ 34055 </div>\ 34056 </div>\ 34057 '; 34058 }); 34059 } 34060 34061 var edu_curri = (tp_curri) ? '\ 34062 <section id="curriculum" class="">\ 34063 <div class="">\ 34064 <p class="title">'+temp_cont.curri_title+'</p>\ 34065 <div class="panel-group" id="curriaccordion">\ 34066 <div class="panel panel-default">\ 34067 '+curri_list+'\ 34068 </div>\ 34069 </div>\ 34070 </div>\ 34071 </section>\ 34072 ' : '' ; 34073 34074 var edu_etc = '\ 34075 <section id="etc" class="">\ 34076 <div class="" id="info1">\ 34077 <p class="title">ê°ì를 ìí´ íìí <i>ì¤ë¹ë¬¼</i></p>\ 34078 <div class="content">\ 34079 <p>'+popup_svg+' ë°ì¤í¬í PC <span class="red">(ê¶ì¥)</span> / ë ¸í¸ë¶</p>\ 34080 <p>'+popup_svg+' í¬ë¡¬ ë¸ë¼ì°ì </p>\ 34081 <p>'+popup_svg+' í기ë구</p>\ 34082 </div>\ 34083 </div>\ 34084 <div class="line" id="info2">\ 34085 <p class="title">ì¨ë¼ì¸ êµì¡ ìë´ ì¬í</p>\ 34086 <div class="content">'; 34087 edu_etc += (edu_new == 'new') ? '\ 34088 <p>'+popup_svg+' ê°ìì¤ ì ì¥ ë§í¬ë <b>êµ¬ê¸ í¼ ì ì¶ ìë£ íë©´ìì ë°ë¡ íì¸ ê°ë¥</b>íë©°,<br>êµì¡ ë¹ì¼ ì ì²íì ë©ì¼ or ì림í¡ì¼ë¡ë ê°ë³ ë°ì¡ë©ëë¤.</p>\ 34089 <p>'+popup_svg+' êµì¡ ìê° <b>10ë¶ ì ë¶í° ì ì¥ì´ ê°ë¥</b>í©ëë¤.</p>\ 34090 <p>'+popup_svg+' ë³¸ì¸ íì¸ì ìí´ ë°ëì <b>ì ì²ìì ì ì´ì£¼ì ì´ë¦</b>ì¼ë¡ ì ì¥í´ 주ì기 ë°ëëë¤.</p>\ 34091 <p>'+popup_svg+' 1ê° ìì´ëë¡ <b>ì¤ë³µ ì°¸ì¬ë ë¶ê°ë¥</b>í©ëë¤.</p>\ 34092 ' : '\ 34093 <p>'+popup_svg+' ê°ìì¤ ì ì¥ ë§í¬ë ìê° ì ì²íë©° <b>ì ë ¥íì ë©ì¼ 주ìë¡ ë°ì¡</b>ë©ëë¤.</p>\ 34094 <p>'+popup_svg+' êµì¡ ìê° <b>20ë¶ ì ë¶í° ì ì¥ì´ ê°ë¥</b>í©ëë¤.</p>\ 34095 <p>'+popup_svg+' 1ê° ìì´ëë¡ <b>ì¤ë³µ ì°¸ì¬ë ë¶ê°ë¥</b>í©ëë¤.</p>\ 34096 <p>'+popup_svg+' ê°ì ê´ë ¨ 문ìë <a href="'+help_url+'"><u>1:1 문ì</u></a>ì ë¨ê²¨ì£¼ì¸ì.</p>'; 34097 edu_etc += '\ 34098 </div>\ 34099 </div>\ 34100 </section>\ 34101 '; 34102 var edu_review = (tp_review) ? '\ 34103 <section id="review" class="">\ 34104 <div class="">\ 34105 <p class="point">New</p>\ 34106 <p class="title">먼ì ìê°í ë¶ë¤ì<br><i>í기를 ë¤ì´ë³´ì¸ì!</i></p>\ 34107 <div class="review-list">\ 34108 </div>\ 34109 <div class="review-btn hand">\ 34110 <span>ìê°í ë보기</span>\ 34111 </div>\ 34112 </div>\ 34113 </section>\ 34114 ' : '' ; 34115 34116 var edu_sticky = '\ 34117 <div class="edu_content_right sticky">\ 34118 <div class="sticky">\ 34119 <div class="btn-order hand '+ btn_active +'" onclick="' + edu_url + '">'+ edu_btn_text +'</div>\ 34120 <div class="guide">\ 34121 <ul class="note">\ 34122 <li>ì¼ì : '+ row.edu_popupDate +'</li>\ 34123 <li>ê°ì ìê° : '+temp_cont.guide_time+'</li>\ 34124 '+edu_level+'\ 34125 <li>ê°ê²© : '+temp_cont.guide_pay+'</li>\ 34126 <li>ê°ì ì¢ ë¥ : '+temp_cont.guide_cate+'</li>\ 34127 <li>ìµì ì¸ì : 10ëª </li>\ 34128 </ul>\ 34129 <ul class="notice">'; 34130 edu_sticky += (edu_new == 'new') ? '\ 34131 <li>ê°ìì¤ ì ì¥ ë§í¬ë <span>êµ¬ê¸ í¼ ì ì¶ ìë£ íë©´ìì ë°ë¡ íì¸ ê°ë¥</span>íë©° ê°ì ê°ì¤ íì ì, êµì¡ ë¹ì¼ ì ì²íì <span>ë©ì¼ í¹ì ì림í¡ì¼ë¡ë ê°ë³ ìë´</span>ë©ëë¤.</li>\ 34132 ' : '\ 34133 <li>ì ì ë§í¬ë ì ì² ë©ì¼ ë° <span>êµì¡ 1ì¼ ì ê°ë³ ì림í¡</span> ì ë¬</li>\ 34134 <li>ê°ìì¤ ì ì¥ ë§í¬ë <span>ìê° ì ì² ì ì ë ¥íì ë©ì¼ 주ìë¡ ë°ì¡</span>ë©ëë¤.</li>'; 34135 edu_sticky += '\ 34136 <li>ìµì ì¸ìì´ ì¶©ì¡±ëì§ ìì¼ë©´ <span>ê°ìê° ì§íëì§ ììµëë¤.</span></li>\ 34137 </ul>\ 34138 </div>\ 34139 </div>\ 34140 </div>\ 34141 '; 34142 var edu_review_tab = (tp_review) ? '<li class="hand" data-menulink="review">í기<span class="point">New</span></li>' : ''; 34143 var edu_target_tab = (tp_target) ? '<li class="hand" data-menulink="target">ê°ì ëì</li>' : '<li class="hand" data-menulink="info1">ì¤ë¹ë¬¼</li>'; 34144 var edu_curri_tab = (tp_curri) ? '<li class="hand" data-menulink="curriculum">커리íë¼</li>' : '<li class="hand" data-menulink="info2">êµì¡ìë´</li>'; 34145 34146 34147 var edu_html = '\ 34148 <div class="education_detail">\ 34149 <div class="edu_wrap">\ 34150 '+edu_header+'\ 34151 <div class="edu_content">\ 34152 <div class="edu_content_left">\ 34153 <div class="edu_tab">\ 34154 <ul>\ 34155 <li class="hand active" data-menulink="intro">ê°ììê°</li>\ 34156 '+edu_target_tab+'\ 34157 '+edu_curri_tab+'\ 34158 '+edu_review_tab+'\ 34159 </ul>\ 34160 </div>\ 34161 <div class="edu_section">\ 34162 '+edu_intro+'\ 34163 '+edu_target+'\ 34164 '+edu_curri+'\ 34165 '+edu_etc+'\ 34166 '+edu_review+'\ 34167 </div>\ 34168 </div>\ 34169 '+edu_sticky+'\ 34170 </div>\ 34171 </div>\ 34172 </div>\ 34173 '; 34174 34175 var modal = $(this).showModalFlat('', edu_html, true, false, '', 'close', '', 'guidePopup cl-cmmodal cl-s-btn cover education-modal', false, '', function() { 34176 $.guidePopup.scrollevent(); 34177 34178 modal.find('.edu_tab li').off('click').on('click', function(e) { 34179 var target = $(this).attr('data-menulink'); 34180 34181 var top = ($(this).index())+1, 34182 hsize = (window.innerWidth <= 768) ? 34 : 55, 34183 tab_pos = (window.innerWidth <= 768) ? $('#'+target).position().top + $('.edu_head_wrap').outerHeight() : $('#'+target).position().top; 34184 move = tab_pos - hsize; 34185 34186 modal.find('.guidePopup .modal-content').animate({scrollTop: move},1000, 'easeInOutExpo'); 34187 }); 34188 34189 modal.find('.guidePopup .modal-content').bind('scroll', function () { 34190 var hsize = (window.innerWidth <= 768) ? 38 : 55, 34191 scrollValue = $('.guidePopup .modal-content').scrollTop() + hsize, 34192 tab_pos = (window.innerWidth <= 768) ? $('.edu_head_wrap').outerHeight() : 0; 34193 34194 if(tp_review) { 34195 if( scrollValue >= $("#target").position().top + tab_pos && scrollValue < $("#curriculum").position().top + tab_pos) { 34196 $('.edu_tab li').eq(1).addClass('active').siblings().removeClass('active'); 34197 } else if( scrollValue >= $("#curriculum").position().top + tab_pos && scrollValue < $("#review").position().top + tab_pos) { 34198 $('.edu_tab li').eq(2).addClass('active').siblings().removeClass('active'); 34199 } else if( scrollValue >= $("#review").position().top + tab_pos) { 34200 $('.edu_tab li').eq(3).addClass('active').siblings().removeClass('active'); 34201 } else { 34202 $('.edu_tab li').eq(0).addClass('active').siblings().removeClass('active'); 34203 } 34204 } else { 34205 if(tp_target) { 34206 if( scrollValue >= $("#target").position().top + tab_pos && scrollValue < $("#curriculum").position().top + tab_pos) { 34207 $('.edu_tab li').eq(1).addClass('active').siblings().removeClass('active'); 34208 } else if( scrollValue >= $("#curriculum").position().top + tab_pos) { 34209 $('.edu_tab li').eq(2).addClass('active').siblings().removeClass('active'); 34210 } else { 34211 $('.edu_tab li').eq(0).addClass('active').siblings().removeClass('active'); 34212 } 34213 } else { 34214 if( scrollValue >= $("#info1").position().top + tab_pos && scrollValue < $("#info2").position().top + tab_pos) { 34215 $('.edu_tab li').eq(1).addClass('active').siblings().removeClass('active'); 34216 } else if( scrollValue >= $("#info2").position().top + tab_pos) { 34217 $('.edu_tab li').eq(2).addClass('active').siblings().removeClass('active'); 34218 } else { 34219 $('.edu_tab li').eq(0).addClass('active').siblings().removeClass('active'); 34220 } 34221 } 34222 } 34223 }); 34224 if(tp_review) { 34225 $.each(temp_review,function(i,v) { 34226 modal.find('.review-list').append('<li><p class="review">'+v.review+'</p><p class="name">'+v.name+' ë</p></li>'); 34227 }); 34228 var targets = modal.find('.review-list').children(); 34229 for(var i=0; i<targets.length; i+=4){ 34230 $('<ul class="hide"></ul>').append(targets.slice(i, i+4)).appendTo('.review-list'); 34231 } 34232 modal.find('.review-list').find('ul:eq(0)').removeClass('hide'); 34233 modal.find('.review-list').find('ul:eq(1)').removeClass('hide'); 34234 34235 modal.find('.review-btn').off('click').on('click', function(e) { 34236 modal.find('.review-list').find('ul.hide:eq(0)').removeClass('hide'); 34237 if(modal.find('.review-list').find('ul.hide').length < 1) $(this).addClass('hide'); 34238 }); 34239 } 34240 }); 34241} 34242 34243 34244$(document).ready(function() { 34245 const icons = { 34246 'all': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" width="20" height="20"><path d="M13.68 12.41A6.5 6.5 0 0 0 15 8.5 6.5 6.5 0 1 0 8.5 15c1.47 0 2.82-.49 3.91-1.32L16.73 18 18 16.73zm-5.18.79c-2.59 0-4.7-2.11-4.7-4.7s2.11-4.7 4.7-4.7 4.7 2.11 4.7 4.7c0 .97-.3 1.87-.8 2.62-.34.5-.77.93-1.27 1.27-.75.51-1.65.8-2.62.8Z"/></svg>', 34247 'statistics': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" width="20" height="20"><rect width="3" height="6" x="2" y="10" rx=".4" ry=".4"/><rect width="3" height="8" x="10.67" y="8" rx=".4" ry=".4"/><rect width="3" height="10" x="6.33" y="6" rx=".4" ry=".4"/><rect width="3" height="12" x="15" y="4" rx=".4" ry=".4"/></svg>', 34248 'point': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" width="20" height="20"><path d="M6.44 7.01h.02c.32.1.67.18 1.03.25h.05c.36.07.74.12 1.14.16h.06c.41.04.84.06 1.27.06s.86-.02 1.27-.06h.06c.4-.04.77-.09 1.14-.16h.05c.36-.07.71-.16 1.03-.25h.02c.33-.1.63-.22.9-.34.95-.44 1.54-1.03 1.54-1.67 0-1.38-2.69-2.5-6-2.5s-6 1.12-6 2.5c0 .82.96 1.55 2.44 2.01ZM10 12.5c.44 0 .86-.02 1.27-.06h.06c.4-.04.78-.09 1.14-.16h.05c.37-.07.71-.16 1.03-.25h.02c1.48-.46 2.44-1.18 2.44-2.01V7.9c0-.31-.33-.49-.6-.34-.4.22-.89.43-1.49.62-.38.12-.77.21-1.17.29l-.05.01c-.4.08-.82.13-1.25.17h-.06c-.46.05-.93.07-1.38.07q-.69 0-1.38-.06h-.06c-.43-.05-.84-.11-1.25-.18h-.05v-.01c-.4-.08-.79-.17-1.17-.29a7 7 0 0 1-1.49-.62c-.27-.15-.6.04-.6.34v2.12c0 .82.96 1.55 2.44 2.01h.02c.32.1.67.18 1.03.25h.05c.36.07.74.12 1.14.16h.06c.41.04.84.06 1.27.06Z"/>
34248<path d="M10 17.5c.44 0 .86-.02 1.27-.06h.06c.4-.04.78-.09 1.14-.16h.05c.37-.07.71-.16 1.03-.25h.02c1.48-.46 2.44-1.18 2.44-2.01V12.9c0-.31-.33-.49-.6-.34-.4.22-.89.43-1.49.62-.38.12-.77.21-1.17.29l-.05.01c-.4.08-.82.13-1.25.17h-.06c-.46.05-.93.07-1.38.07q-.69 0-1.38-.06h-.06c-.43-.05-.84-.11-1.25-.18h-.05v-.01c-.4-.08-.79-.17-1.17-.29a7 7 0 0 1-1.49-.62c-.27-.15-.6.04-.6.34v2.12c0 .82.96 1.55 2.44 2.01h.02c.32.1.67.18 1.03.25h.05c.36.07.74.12 1.14.16h.06c.41.04.84.06 1.27.06Z"/></svg>', 34249 'coupon': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" width="20" height="20"><path d="M12.31 11.58c-.2 0-.39.08-.53.22-.29.29-.3.77 0 1.06a.75.75 0 1 0 .53-1.28M8.22 8.21c.29-.29.3-.77 0-1.06a.75.75 0 0 0-1.06 0c-.29.29-.3.77 0 1.06a.75.75 0 0 0 1.06 0"/><path d="m17.02 10 .6-1.86a.99.99 0 0 0-.36-1.11l-1.57-1.15-.61-1.85c-.13-.41-.52-.68-.95-.69h-1.95l-1.59-1.15c-.35-.25-.82-.25-1.17 0L7.83 3.33H5.88c-.43.01-.81.29-.95.7l-.61 1.85-1.57 1.15c-.35.25-.49.7-.36 1.11l.6 1.86-.6 1.86c-.13.41.01.86.36 1.11l1.57 1.15.61 1.85c.13.41.52.68.95.69h1.95l1.59 1.15c.35.25.82.25 1.17 0l1.59-1.14h1.95c.43-.01.81-.29.95-.7l.61-1.85 1.57-1.15c.35-.25.49-.7.36-1.11zM6.46 6.43c.34-.34.79-.51 1.23-.51.45 0 .9.17 1.24.52.68.69.68 1.79-.01 2.47a1.734 1.734 0 0 1-2.47-.01c-.68-.69-.68-1.79.01-2.47m1.51 6.35c-.23.23-.61.23-.85 0s-.23-.61 0-.85l4.81-4.81c.23-.23.61-.23.85 0s.23.61 0 .85zm5.57.79a1.734 1.734 0 0 1-2.47-.01c-.68-.69-.68-1.79.01-2.47a1.734 1.734 0 0 1 2.47.01c.68.69.68 1.79-.01 2.47"/></svg>' 34250 }; 34251 34252 $('#section-top-menu [data-menu-key]').each(function() { 34253 var key = $(this).data('menu-key'); 34254 34255 if (icons[key]) { 34256 $(this).find('.subnav-title').prepend(icons[key]); 34257 } 34258 }); 34259}); 34260 34261 34262var getColorisHtml = function(val,clr,input_options,input_layout,iswrap,class_obj,tooltip_title) { 34263 // console.log(`val: ${val}`,`val: ${clr}`,`input_options: `,input_options,`input_layout: ${input_layout}`,`iswrap: ${iswrap}`,`class_obj: `,class_obj,`tooltip_title: ${tooltip_title}`); 34264 if(typeof val == 'undefined' || val == '') val = 'transparent'; 34265 if(typeof mode == 'undefined') mode = ''; 34266 if(typeof layout == 'undefined') layout = ''; 34267 if(typeof iswrap == 'undefined') iswrap = true; 34268 if(typeof class_obj == 'undefined') class_obj = {'wrap':'', 'input':''}; 34269 if(typeof class_obj['element'] == 'undefined') class_obj['element'] = 'span'; 34270 if(typeof class_obj['wrap'] == 'undefined') class_obj['wrap'] = ''; 34271 if(typeof class_obj['wrap_attr'] == 'undefined') class_obj['wrap_attr'] = ''; 34272 if(typeof class_obj['input'] == 'undefined') class_obj['input'] = ''; 34273 34274 if(Array.isArray(val)) val = val[val.length - 1]; 34275 34276 var clr_options = ''; 34277 $.each(input_options, function(k,v) { 34278 if(v) clr_options += ` ${k}="${v}"`; 34279 }); 34280 34281 var clr_input_class = (class_obj['input']) ? class_obj['input'] + ' ' : ''; 34282 switch(input_layout) { 34283 case 'thumbnail': clr_input_class += 'clr-thumbnail '; break; 34284 default: break; 34285 } 34286 34287 var colorValueRegex = Coloris.getColorRegex(); 34288 var colorWithImportantRegex = /!important$/g; 34289 var checkWithImportant = (val.match(colorWithImportantRegex) !== null) ? true : false; 34290 if(checkWithImportant) { 34291 var tmp_match = val.match(colorValueRegex); 34292 val = (tmp_match) ? tmp_match[0] : 'transparent'; 34293 } 34294 34295 if(/(none|inherit|initial)\b/gi.exec(val)) val = val.replace(/(none|inherit|initial)\b/gi, 'transparent'); 34296 34297 if(class_obj['input'].indexOf('clr-alphaoff') > -1) val = Coloris.getChangeColorVal(val,'a',1); 34298 34299 var clr_tooltip_title = (tooltip_title) ? tooltip_title : 'editor.color'; 34300 34301 var clr_tooltip = (clr_input_class.indexOf('clr-tooltipoff') > -1) ? '' : `data-toggle="tooltip" data-placement="top" title="${$.lang[LANG][clr_tooltip_title]}"`; 34302 var clr_html = `<input type="text" value="${val}" class="coloris ${clr_input_class}" data-clr="${clr}" ${clr_options} ${clr_tooltip} readonly autocomplete="off" autocorrect="off" spellcheck="false">`; 34303 if(iswrap) { 34304 var clr_wrap_class = class_obj['wrap']; 34305 var clr_wrap_attr = class_obj['wrap_attr']; 34306 var element_type = class_obj['element']; 34307 34308 clr_html = `<${element_type} class="coloris-picker ${clr_wrap_class}" ${clr_wrap_attr}>${clr_html}</${element_type}>`; 34309 } 34310 34311 return clr_html; 34312}
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.