1if(typeof isELVIEW == 'undefined') isELVIEW = false; 2var elDefaultClass = (isELVIEW) ? 'el_viewblock' : 'element'; 3var elGalleryJS = {}; 4 5// $('body').removeClass('off-config overflow-hidden'); 6 7var setGalleryJS = function(callPointStatus,gEL) { 8 // console.log('set gallery js') 9 /* 10 0. gjs00SetBody() - body 11 gjs01SetFixedscroll(gEL)- fixedscroll block 12 13 // REMOVE (2024-10-22) 14 1. gjs10Load(gEL,g_js,g_js_code) - Load CSS / Javacript File 15 16 2. gjs20Load(gEL,g_js,g_js_code) - Load gjs 17 */ 18 19 if(gEL && gEL instanceof jQuery) gEL = gEL.get(0); 20 var g_js = $(gEL).find('.gjs').attr('data-js'); 21 if(typeof g_js == 'undefined' || !g_js) return false; 22 23 var g_js_code = $(gEL).find('.gjs').attr('data-js-code'); 24 if(typeof g_js_code == 'undefined' || !g_js_code) return false; 25 26 if(g_js) $(gEL).attr('data-gjs',g_js+g_js_code); 27 gjs01SetFixedscroll(gEL); 28 29 var gjs = g_js+g_js_code, 30 // gjs_selector = $(gEL).find('.gjs').attr('data-js-selector'), 31 g_id = $(gEL).attr('data-id'), 32 // g_name = $(gEL).attr('data-name'), 33 // g_feature = $(gEL).attr('data-feature'), 34 isOnlySet = ($('#el-blockConfig').hasClass('open')) ? true : false, 35 isFirst = (typeof elGalleryJS[g_id] == 'undefined') ? true : false, 36 isStart = false, 37 isEmpty = ($(gEL).find('[data-loop="true"]').is('.empty') || $(gEL).find('[data-loop="true"] .grid.empty-txt').length > 0) ? true : false; 38 39 var move_gitem = '', 40 cookie_g = $.cookie('gallery'), 41 cookie_gitem = $.cookie('gallery-item'); 42 43 if( typeof cookie_g != 'undefined' && 44 $(gEL).attr('data-id') == cookie_g && 45 $(gEL).find('.gallery-item[data-seq='+cookie_gitem+']').length > 0 46 ) { 47 move_gitem = cookie_gitem; 48 $.removeCookie('gallery', { path: '/' }); 49 $.removeCookie('gallery-item', { path : '/' }); 50 } 51 52 if(typeof gEL == 'undefined' || $(gEL).length == 0 ) { 53 gjs00SetBody(); 54 return false; 55 } 56 if($(gEL).find('input.gjs').length == 0) { 57 $(gEL).removeAttr('data-gjs').removeAttr('data-fixedscroll'); 58 gjs00SetBody(); 59 return false; 60 } 61 // console.log('--[00: setGalleryJS(___'+callPointStatus+'____,' + $(gEL).attr('data-id') + ') ]-----------------------------------------------------------------------------------------------------'); 62 63 64 if(move_gitem != '') { 65 // console.log('gjs: '+gjs); 66 // console.log('g_id: '+g_id); 67 // console.log('move_gitem: '+move_gitem); 68 69 if($.inArray(gjs, ['touchslider1','fixedscroll3','fixedscroll4']) > -1) { 70 // console.log('moveGallery premium'); 71 setLoadmoreGalleryJS(gjs,g_id,true,move_gitem); 72 } else { 73 // console.log('moveGallery default'); 74 var mh = getMenuHeight(), 75 bh = $.siteBanner.getBandHeight(), 76 enh = getEditNavbarHeight(), 77 offset = ($('.dsgn-body').hasClass('sidebar')) ? ((bh > 0) ? -bh : 0) : -(mh+bh), 78 delay_time = 1000, 79 delay_time = 1000, 80 isAnimate = false; 81 $moveDiv = $('.dsgn-body'), 82 $moveGitem = $(gEL).find('.gallery-item[data-seq="'+move_gitem+'"]'); 83 84 if($moveGitem.length == 0) return false; 85 switch(gjs) { 86 case 'fixedscroll1': 87 $moveDiv = $(gEL); 88 offset = -parseInt($moveGitem.css('margin-top')); 89 break; 90 91 case 'fixedscroll2': 92 isAnimate = true; 93 delay_time = 1500; //body top ì리 ì¡ë ìê° ì¶ê° 94 $moveDiv = $('html'); 95 96 default: 97 break; 98 } 99 100 setTimeout(function() { 101 if(isAnimate) $moveDiv.animate({'scrollTop': $moveGitem.offset().top + offset}, 1000, 'easeInOutQuart'); 102 else $moveDiv.scrollTo($moveGitem, 1000,{offset: offset, easing: 'easeInOutQuart'}); 103 }, delay_time); 104 } 105 } 106 107 // console.log(elGalleryJS); 108 // console.log(elGalleryJS[g_id]); 109 110 // console.log('gjs: '+gjs); 111 // console.log('isOnlySet: '+isOnlySet); 112 // console.log('isFirst: '+isFirst); 113 // console.log('isEmpty: '+isEmpty); 114 115 if(isEmpty) { 116 if($.inArray(gjs, ['touchslider1','fixedscroll3']) > -1) { 117 if(typeof elGalleryJS[g_id] == 'object' && typeof elGalleryJS[g_id].gjs_destroy == 'function') elGalleryJS[g_id].gjs_destroy(); 118 } 119 if(gjs == 'fixedscroll1') isEmpty = false; 120 if(gjs == 'fixedscroll3') $(gEL).find('.ready').removeClass('ready'); 121 if(gjs == 'fixedscroll4') $(gEL).find('.fs-container').removeAttr('style'); 122 } 123 124 125 if(typeof callPointStatus == 'undefined') callPointStatus = ''; 126 switch(callPointStatus) { 127 case 'elview-block': 128 if(!isFirst) { 129 elGalleryJS[g_id] = false;
130 isOnlySet = true; 131 } 132 break; 133 case 'reorder-block': 134 // ModalPlugin.js - reorderModal 135 if($.inArray(gjs,['touchslider1','fixedscroll4']) > -1) elGalleryJS[g_id] = false; 136 if($.inArray(gjs,['fixedscroll1']) > -1) isOnlySet = true; 137 break; 138 139 case 'wait-block': 140 // gallery.js - gjs20Load() touchslider1 (íì´ì§ ë´ ê°ì ë¸ë ì¬ë¬ê° ììê²½ì°, ìì°¨ ì²ë¦¬) 141 case 'load-block': 142 // gallery.js - startGalleryJS() undefined 143 // config.js - elPush 144 if(!isFirst) { 145 if(isOnlySet) { 146 if($.inArray(gjs,['touchslider1','fixedscroll4']) > -1) elGalleryJS[g_id] = false; 147 if($.inArray(gjs,['touchslider1']) > -1) $(gEL).attr('data-gjs-status', 'wait'); 148 } 149 } 150 break; 151 152 case 'reload-block': 153 // gallery.js - startGalleryJS() boolean 154 // block_config.js - loadGalleryInitList 155 if($.inArray(gjs,['touchslider1','fixedscroll3','fixedscroll4']) > -1) elGalleryJS[g_id] = false; 156 if($.inArray(gjs,['touchslider1','fixedscroll3','fixedscroll4']) > -1) isOnlySet = false; 157 break; 158 159 case 'add-loop': 160 // config.js - gallery-loadmore click 161 // render.js - gallery-loadmore click 162 163 if(!isFirst) { 164 if($.inArray(gjs,['touchslider1','fixedscroll4']) > -1) elGalleryJS[g_id] = false; 165 } 166 if($.inArray(gjs,['fixedscroll1', 'fixedscroll2']) > -1) isOnlySet = true; 167 break; 168 169 case 'change-loop': 170 // config.js - cl-gcate-item, cl-gsort-item a click 171 // render.js - cl-gcate-item, cl-gsort-item a click 172 if(!isFirst) { 173 if($.inArray(gjs,['touchslider1','fixedscroll4']) > -1) elGalleryJS[g_id] = false; 174 if($.inArray(gjs,['fixedscroll1']) > -1) isOnlySet = true; 175 } 176 break; 177 178 case 'change-swiper': 179 if(gjs == 'fixedscroll3') isStart = true; 180 break; 181 182 default: 183 break; 184 } 185 186 // console.log('isFirst: '+isFirst); 187 // console.log('isEmpty: '+isEmpty); 188 // console.log('isStart: '+isStart); 189 // console.log('isOnlySet: '+isOnlySet); 190 191 // console.log('elGalleryJS: '); 192 // console.log(elGalleryJS); 193 194 if(isEmpty) return false; 195 if(isStart) { 196 startGalleryJS(gEL); 197 return false; 198 } 199 200 if(isOnlySet) { 201 // console.log('isOnlySet'); 202 } else { 203 gjs20Load(gEL,g_js,String(g_js_code)); 204 } 205} 206 207var gjs00SetBody = function(onclass,gjs) { 208 console.log('--[00: gjs00SetBody('+onclass+','+gjs+') ]----------------------'); 209 210 if(typeof gjs == 'undefined' && gjs != 'fixedscroll2') $('body').removeClass('off-config overflow-hidden'); 211 212 if( (typeof MODE != 'undefined' && $.inArray(MODE, ['config','demo']) > -1) && 213 (typeof onclass == 'string' && onclass) 214 ) { 215 $('body').addClass(onclass); 216 $('header.navbar').closest('.el-menu').css('z-index','126'); 217 if($('header.navbar').hasClass('sidebar')) { 218 } else { 219 $('header.navbar').css('width','100%'); 220 } 221 } 222 223 if(typeof gjs != 'undefined' && gjs) $('body').attr('data-gjs',gjs); 224 else $('body').removeAttr('data-gjs'); 225 226 if(isELVIEW) $('body').attr('data-viewer',true); 227 else $('body').removeAttr('data-viewer'); 228} 229 230var gjs01SetFixedscroll = function(gEL) { 231 // console.log('--[01: gjs01SetFixedscroll(gEL) ]----------------------'); 232 233 $('#goto-top').hide(); 234 235 if($(gEL).hasClass('reorderBlock')) elDefaultClass = 'reorderBlock'; 236 else elDefaultClass = (isELVIEW) ? 'el_viewblock' : 'element'; 237 238 var g_name = $(gEL).attr('data-name'), 239 g_js = ($(gEL).find('.gjs').length > 0) ? $(gEL).find('.gjs').attr('data-js') : '', 240 g_js_code = (g_js) ? $(gEL).find('.gjs').attr('data-js-code') : ''; 241 242 $(gEL).attr('data-fixedscroll',true); 243 244 if(g_js) $(gEL).attr('data-gjs',g_js+g_js_code); 245 246 if(isELVIEW) { 247 document.querySelector('.'+g_name).style.setProperty('--menu-height', '0px', null); 248 } else { 249 var __menu_height = getComputedStyle(document.querySelector('.'+g_name)).getPropertyValue('--menu-height'); 250 if(typeof __menu_height != 'undefined' && __menu_height) { 251 var mh = getMenuHeight(), 252 bh = $.siteBanner.getBandHeight(); 253 document.querySelector('.'+g_name).style.setProperty('--menu-height', (mh+bh)+'px', null); 254 } 255 } 256} 257 258var gjs20Load = function(gEL,g_js,g_js_code) { 259 if(typeof gEL == 'undefined' || $(gEL).length == 0) return false; 260 // console.log('--[02: gjs20Load(' + $(gEL).attr('data-id') + ','+g_js+','+g_js_code+') ]----------------------'); 261 262 var g_id = $(gEL).attr('data-id'), 263 g_name = $(gEL).attr('data-name'), 264 g_feature = $(gEL).attr('data-feature'), 265 selector = $(gEL).find('.gjs').attr('data-js-selector'); 266 267 if(typeof g_id == 'undefined' || $('.'+g_name).length == 0) return false;
268 269 var isFirst = (typeof elGalleryJS[g_id] == 'undefined') ? true : false, 270 isReruning = (typeof elGalleryJS[g_id] == 'boolean') ? true : false; 271 272 if(!isFirst) { 273 var checkReorderBlock = ($(gEL).is('.reorderBlock') || $(gEL).closest('.new-dsgn-body').length > 0 || $(gEL).closest('.reorderModal').length > 0) ? true : false, 274 checkReset = (isELVIEW && $.inArray(g_js+g_js_code, ['fixedscroll4']) > -1) ? true : false; 275 276 if(checkReorderBlock || checkReset || isReruning) { 277 isFirst = true; 278 delete elGalleryJS[g_id]; 279 } 280 } 281 282 switch(g_js) { 283 case 'touchslider': 284 if(g_js_code == '1') { 285 if($(gEL).is('[data-feature*=fixedscroll]')) { 286 gjs00SetBody(); 287 } 288 if(typeof Touchslider1 == 'undefined') $(gEL).attr('data-gjs-status', 'wait'); 289 else { 290 $(gEL).removeAttr('data-gjs-status'); 291 292 if(isFirst) { 293 elGalleryJS[g_id] = new Touchslider1(document.querySelector('.'+g_name+' '+selector)); 294 } else { 295 elGalleryJS[g_id].gjs_load(document.querySelector('.'+g_name+' '+selector)); 296 } 297 298 if($('.element[data-gjs][data-gjs-status="wait"]').length > 0) setGalleryJS('wait-block',$('.element[data-gjs][data-gjs-status="wait"]').eq(0)); 299 } 300 } 301 break; 302 303 case 'fixedscroll': 304 if(g_js_code == '1') { 305 if(typeof VisualImgShow == 'undefined' && typeof VisualVdoShow == 'undefined') return false; 306 307 if($(gEL).is('[data-feature*=fixedscroll]')) { 308 gjs00SetBody('',g_js+g_js_code); 309 } 310 311 if(isFirst) { 312 var visual_type = $(gEL).find('[data-visual="true"]').attr('data-visual-type'); 313 elGalleryJS[g_id] = (visual_type == 'image') ? new VisualImgShow(document.querySelector('.'+g_name)) : new VisualVdoShow(document.querySelector('.'+g_name)); 314 } else { 315 elGalleryJS[g_id].gjs_load(document.querySelector('.'+g_name)); 316 } 317 318 // ë´ë¶ ì¤í¬ë¡¤ì ê°ì§í ìì ì í 319 if($(gEL).find('.content-wrap').length) { 320 $(gEL).find('.content-wrap').get(0).addEventListener('wheel', function(event) { 321 event.stopPropagation(); 322 // ì¤í¬ë¡¤ì ìµìë¨ ëë ìµíë¨ì ëë¬íëì§ íì¸ 323 const atTop = this.scrollTop === 0; 324 const atBottom = this.scrollHeight - this.scrollTop === this.clientHeight; 325 326 var elem = typeof PAGE_MODE != 'undefined' && PAGE_MODE == 'c' ? document.querySelector('.dsgn-body') : window; 327 // ìµìë¨ ëë ìµíë¨ì ëë¬íì ë 328 if ((atTop && event.deltaY < 0) || (atBottom && event.deltaY > 0)) { 329 // HTMLë¡ ì¤í¬ë¡¤ ì´ë²¤í¸ ì ë¬ 330 event.preventDefault(); // 기본 ëìì ë§ì ë´ë¶ ììì ì¤í¬ë¡¤ì ë©ì¶¤ 331 elem.scrollBy({ 332 top: event.deltaY, // ì¤í¬ë¡¤ ë°©í¥ì ë°ë¼ ì¤í¬ë¡¤ ì´ë 333 // behavior: 'auto' // ë¶ëë¬ì´ ì¤í¬ë¡¤ í¨ê³¼ ì ì© 334 }); 335 } 336 }, {passive: false }); 337 } 338 } else if (g_js_code == '2') { 339 if(typeof Fixedscroll2 == 'undefined') return false; 340 341 if($(gEL).is('[data-feature*=fixedscroll]')) { 342 gjs00SetBody('off-config',g_js+g_js_code); 343 } 344 var scroll_target = (isELVIEW) ? $('.elviewwrap') : $(window); 345 if(isELVIEW) $('#element-display .elviewwrap').attr('data-addCSS','fixedscroll2'); 346 347 Fixedscroll2($(gEL)); 348 scroll_target.scroll(function(event) { 349 Fixedscroll2($(gEL)); 350 }); 351 scroll_target.resize(function(event) { 352 Fixedscroll2($(gEL)); 353 }); 354 355 // ë´ë¶ ì¤í¬ë¡¤ì ê°ì§í ìì ì í 356 if($(gEL).find('.content-wrap').length) { 357 $(gEL).find('.content-wrap').get(0).addEventListener('wheel', function(event) { 358 event.stopPropagation(); 359 // ì¤í¬ë¡¤ì ìµìë¨ ëë ìµíë¨ì ëë¬íëì§ íì¸ 360 const atTop = this.scrollTop === 0; 361 const atBottom = this.scrollHeight - this.scrollTop === this.clientHeight; 362 363 var elem = typeof PAGE_MODE != 'undefined' && PAGE_MODE == 'c' ? document.querySelector('.dsgn-body') : window; 364 // ìµìë¨ ëë ìµíë¨ì ëë¬íì ë 365 if ((atTop && event.deltaY < 0) || (atBottom && event.deltaY > 0)) { 366 // HTMLë¡ ì¤í¬ë¡¤ ì´ë²¤í¸ ì ë¬ 367 event.preventDefault(); // 기본 ëìì ë§ì ë´ë¶ ììì ì¤í¬ë¡¤ì ë©ì¶¤ 368 elem.scrollBy({ 369 top: event.deltaY, // ì¤í¬ë¡¤ ë°©í¥ì ë°ë¼ ì¤í¬ë¡¤ ì´ë 370 // behavior: 'auto' // ë¶ëë¬ì´ ì¤í¬ë¡¤ í¨ê³¼ ì ì©
371 }); 372 } 373 }, { passive: false }); 374 } 375 } else if(g_js_code == '3') { 376 if(typeof Fixedscroll3 == 'undefined') return false; 377 if($(gEL).is('[data-feature*=fixedscroll]')) { 378 gjs00SetBody('off-config overflow-hidden',g_js+g_js_code); 379 } 380 381 if(isFirst) { 382 elGalleryJS[g_id] = new Fixedscroll3(document.querySelector('.'+g_name+' '+selector)); 383 } else { 384 elGalleryJS[g_id].gjs_load(document.querySelector('.'+g_name+' '+selector)); 385 } 386 387 388 } else if(g_js_code == '4') { 389 if(typeof Fixedscroll4 == 'undefined') return false; 390 391 if($(gEL).is('[data-feature*=fixedscroll]')) { 392 gjs00SetBody('',g_js+g_js_code); 393 } 394 if(typeof elGalleryJS[g_id] == 'undefined') { 395 elGalleryJS[g_id] = new Fixedscroll4(document.querySelector('.'+g_name+' '+selector)); 396 } else { 397 elGalleryJS[g_id].gjs_load(document.querySelector('.'+g_name+' '+selector)); 398 } 399 400 401 } else { 402 gjs00SetBody(); 403 } 404 405 406 /* ë³´ë¥ */ 407 // if(g_js_code == 'hold1') { 408 // if(typeof Fixedscrollhold1 == 'undefined') return false; 409 410 // gjs00SetBody('off-config overflow-hidden'); 411 // var scroll_target = $(gEL).find(selector); 412 // Fixedscrollhold1($(gEL),selector); 413 // } 414 415 break; 416 417 default: 418 gjs00SetBody(); 419 break; 420 } 421 422} 423 424 425 426/* ---------------------------------------------------------------------------------------------------------------------------------------------- */ 427var stopGalleryJS = function(gEL) { 428 if(typeof gEL == 'undefined' || $(gEL).length == 0) return false; 429 // console.log('--[ stopGalleryJS(' + $(gEL).attr('data-id') + ') ]-----------------------------------------------------------------------------------------------------'); 430 431 var g_id = $(gEL).attr('data-id'), 432 g_name = $(gEL).attr('data-name'), 433 g_feature = $(gEL).attr('data-feature'), 434 selector = $(gEL).find('.gjs').attr('data-js-selector'); 435 436 if( typeof g_id == 'undefined' || typeof elGalleryJS[g_id] == 'undefined') return false; 437 438 if( typeof elGalleryJS[g_id].gjs_stop == 'function' && 439 typeof elGalleryJS[g_id].DOM != 'undefined' 440 ) { 441 elGalleryJS[g_id].gjs_stop(); 442 } else { 443 // console.log('gjs_stop none..........'+$(gEL).attr('data-gjs')); 444 } 445} 446 447var startGalleryJS = function(gEL) { 448 if(typeof gEL == 'undefined' || $(gEL).length == 0) return false; 449 450 // console.log('--[ startGalleryJS(' + $(gEL).attr('data-id') + ') ]-----------------------------------------------------------------------------------------------------'); 451 452 var g_id = $(gEL).attr('data-id'), 453 g_name = $(gEL).attr('data-name'), 454 g_feature = $(gEL).attr('data-feature'), 455 selector = $(gEL).find('.gjs').attr('data-js-selector'); 456 457 if(typeof g_id == 'undefined') return false; 458 459 if( typeof elGalleryJS[g_id] == 'undefined' || typeof elGalleryJS[g_id] == 'boolean') { 460 var gjs_status = (typeof elGalleryJS[g_id] == 'boolean') ? 'reload-block' : 'load-block'; 461 setGalleryJS(gjs_status,$(gEL)); 462 } else if(typeof elGalleryJS[g_id].gjs_start == 'function' && typeof elGalleryJS[g_id].DOM != 'undefined') { 463 elGalleryJS[g_id].gjs_start(); 464 } else { 465 } 466 // else if(typeof elGalleryJS[g_id].gjs_load == 'function' && typeof elGalleryJS[g_id].DOM != 'undefined') { 467 // loadGalleryJS(gEL); 468 // } 469 470} 471/* ---------------------------------------------------------------------------------------------------------------------------------------------- */ 472 473var setLoadmoreGalleryJS = function(gjs,id,onoff,move_gitem) { 474 // console.log('--[ setLoadmoreGalleryJS('+gjs+','+id+','+onoff+','+move_gitem+') ]-----------------------------------------------------------------------------------------------------'); 475 var isMove = (typeof move_gitem != 'undefined' && move_gitem) ? true : false; 476 477 if( typeof gjs != 'undefined' && gjs && typeof id != 'undefined' && id ) { 478 if(typeof onoff == 'undefined') onoff = false; 479 var cookie_val = onoff; 480 481 var checkLoadMore = ['touchslider1', 'fixedscroll3', 'fixedscroll4']; 482 if($.inArray(gjs,checkLoadMore) > -1) { 483 if(onoff) { 484 var $galleryEL = $('.element[data-id="' + id +'"]'), 485 $galleryItem = (isMove) ? $galleryEL.find('.gallery-item[data-seq="'+move_gitem+'"]') : null; 486 487 switch(gjs) { 488 case 'touchslider1' : 489 if(isMove) cookie_val = ($galleryItem.length > 0) ? -$galleryItem.position().left : null; 490 else cookie_val = $galleryEL.find('.draggable').css('left').replace('px',''); 491 break; 492 case 'fixedscroll3': 493 if(isMove) cookie_val = ($galleryItem.length > 0) ? Number($galleryItem.attr('data-index')) : null; 494 else cookie_val = null; // gallery-loadmore clickì 미ì ì©
495 break; 496 case 'fixedscroll4': 497 if(isMove) cookie_val = ($galleryItem.length > 0) ? Number($galleryItem.attr('data-index')) : null; 498 else cookie_val = Number($galleryEL.find('.grid.slide-left').attr('data-index')) + 1; 499 break; 500 501 default: 502 break; 503 } 504 505 if(cookie_val === null) return false; 506 else $.cookie('gallery-'+gjs+'-'+id, cookie_val, { path: '/', expires: 12 * 60 * 60 * 1000 }); 507 } else { 508 $.removeCookie('gallery-'+gjs+'-'+id, { path: '/' }); 509 } 510 } 511 } 512} 513 514var getEditNavbarHeight = function() { 515 if($('.editor-navbar').length == 0) return 0; 516 if(typeof MODE != 'undefined' && $.inArray(MODE, ['config','demo']) > -1) { 517 var en_h = document.querySelector('.editor-navbar').getBoundingClientRect().height; 518 return parseInt(en_h+0.5); 519 } else { 520 return 0; 521 } 522} 523var getMenuHeight = function() { 524 if($('.el-menu > header').length == 0) return 0; 525 526 var checkSidebar = $('.el-menu > header').hasClass('sidebar'); 527 if(checkSidebar && window.parent && window.parent != this && $('.el-menu').outerWidth() < 523) checkSidebar = false; 528 529 var m_c = getEditNavbarHeight(), 530 m_h = (checkSidebar) ? 0 : document.querySelector('.el-menu > header').getBoundingClientRect().height; 531 m_h = (typeof m_h == 'undefined') ? 60 : parseInt(m_h+0.5); 532 533 return m_h+m_c; 534} 535 536 537/* ---------------------------------------------------------------------------------------------------------------------------------------------- */ 538 539var galleryLikePosition = function(gid, slide, itemSeq) { 540 // console.log('galleryLikePosition'); 541 if($(slide).find('img').length > 0) { 542 var likeSvg = '\ 543 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28" width="28" height="28">\ 544 <path d="m22.76 14.7-8.74 8.97-8.75-8.97m0 0c-2.31-2.32-2.37-6.14-.13-8.53 2.24-2.4 5.93-2.46 8.24-.14.23.23.44.48.63.75 1.93-2.67 5.59-3.2 8.16-1.2s3.09 5.79 1.16 8.45c-.18.24-.37.47-.58.68"></path>\ 545 <path d="M14.01 24.57c-.24 0-.48-.1-.64-.27l-8.74-8.97c-2.64-2.66-2.71-7.04-.15-9.78a6.576 6.576 0 0 1 4.74-2.12c1.79-.01 3.5.67 4.8 1.96a6.576 6.576 0 0 1 3.74-1.86c1.77-.25 3.54.22 4.97 1.34 2.95 2.29 3.55 6.64 1.33 9.69-.2.28-.42.54-.66.78l-.06.06-8.68 8.9c-.17.17-.4.27-.65.27zm-8.1-10.51c0 .01.01.01 0 0l8.1 8.32 8.1-8.31.06-.06c.15-.16.3-.33.43-.52 1.65-2.27 1.21-5.51-.98-7.22a4.723 4.723 0 0 0-3.61-.97c-1.31.2-2.47.91-3.27 2a.91.91 0 0 1-.73.37c-.29 0-.56-.14-.73-.38-.16-.22-.34-.44-.54-.64a4.78 4.78 0 0 0-3.49-1.43A4.83 4.83 0 0 0 5.8 6.78c-1.91 2.04-1.86 5.31.11 7.28z"></path>\ 546 </svg>\ 547 '; 548 $(gid).find('a.gallery-like').removeClass('hide big-img fullscreen').removeAttr('style').attr('data-seq', itemSeq).html(likeSvg); 549 550 var screenSize = getScreen(); 551 if(screenSize >= 1200) { 552 var slideContent = $(slide).find('img.slide-content'); 553 var marginTop = Number(slideContent.css('margin-top').replace('px', '')); 554 var marginLeft = Number(slideContent.css('margin-left').replace('px', '')); 555 556 if(marginLeft >= 120) { 557 var positionTop = slideContent.height() + marginTop - 46; 558 var positionLeft = slideContent.width() + marginLeft + 20; 559 $(gid).find('a.gallery-like').css({ 560 'top': positionTop + 'px', 561 'left': positionLeft + 'px' 562 }); 563 } else { 564 $(gid).find('a.gallery-like').removeAttr('style').addClass('big-img'); 565 } 566 } 567 568 if(itemSeq !== undefined) { 569 var like = getLike(itemSeq); 570 like.done(function(data){ 571 if(typeof data.own != 'undefined' && data.own) { 572 like_id = data.view; 573 // console.log(like_id); 574 575 $(gid).find('a.gallery-like').addClass('active').attr('data-like', like_id); 576 } else { 577 $(gid).find('a.gallery-like').removeClass('active').removeAttr('data-like'); 578 } 579 }); 580 } 581 } 582} 583 584$('.gallery-item').die('click').live('click', function(e) { 585 if($(this).hasClass('noneShoppingGrade')) { 586 e.preventDefault(); 587 e.stopImmediatePropagation(); 588 var msg = $(this).attr('data-shopping-grade-msg') || 'í´ë¹ ë±ê¸ ê³ ê° ì ì© ìíì ëë¤.'; 589 var suffix = ' ê³ ê° ì ì© ìíì ëë¤.'; 590 if(msg.indexOf(',') > -1 && msg.indexOf(suffix) > -1) { 591 msg = $.trim(msg.split(',')[0]) + suffix; 592 } 593 alert(msg); 594 return false;
595 } 596 597 if($(this).find('[attr-flink]').length > 0 ) { 598 e.preventDefault(); 599 return false; 600 } 601 602 if($(e.target).hasClass('like') || $(e.target).closest('.figure').hasClass('like')) { 603 e.preventDefault(); 604 return false; 605 } 606 607 $('.gallery-frame .blueimp-gallery').addClass('blueimp-gallery-controls'); 608 $('.gallery-frame .blueimp-gallery a.zoom-in, .gallery-frame .blueimp-gallery a.zoom-out, .gallery-frame .blueimp-gallery a.view-original').remove(); 609 $('.gallery-frame .blueimp-gallery a.gallery-like').addClass('hide').removeClass('active').removeAttr('data-like'); 610 611 var $galleryItem = $(this); 612 var $el = $galleryItem.parents('.element'); 613 var pid = (PAGE_MODE == 'c')? selectID : $el.attr('data-id'); 614 var gid = $galleryItem.find('a').attr('data-gallery'); 615 var eid = $galleryItem.closest('.element').attr('data-id'); 616 var parent = (PAGE_MODE == 'c')? PARENT:property.PARENT; 617 var slideIndex = 0; 618 619 // gallery images 620 var gallerySeqArr = $('.element[data-id="'+eid+'"] .gallery-item, .galleryPL'+eid+'.gallery-popup .gallery-item').map(function() { 621 return $(this).attr('data-seq'); 622 }).get(); 623 624 var images = gallerySeqArr.reduce(function(acc, item) { 625 if (acc.indexOf(item) === -1) { 626 acc.push(item); 627 } 628 return acc; 629 }, []); 630 631 var totalSlide = (images.length == 2)? 2 : $(gid).find('.slide').length; 632 // console.log('totalSlide', totalSlide); 633 // console.log('images', images); 634 $('.gallery-frame .blueimp-gallery .slide-index .total-slide').text(totalSlide); 635 if($('#gframe-' + eid + ' .gallery-top-button').length == 0) $('#gframe-' + eid + ' a.close').wrap('<div class="gallery-top-button"></div>'); 636 637 if($galleryItem.find('a').attr('data-img-original') == 'ON') { 638 var viewOriginal = '<a class="zoom-in" data-id="' + pid + '" data-toggle="tooltip" data-placement="bottom" data-html="true" data-original-title="íë"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><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>\ 639 <a class="zoom-out disabled" data-id="' + pid + '" data-toggle="tooltip" data-placement="bottom" data-html="true" data-original-title="ì¶ì"><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 d="M5.75 8.86h7.67v1.44H5.75z"/></g></svg></a>\ 640 <a class="view-original disabled" data-id="' + pid + '" data-toggle="tooltip" data-placement="bottom" data-html="true" data-original-title="íë©´ í¬ê¸°ì ë§ì¶° íë">\ 641 <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>\ 642 <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>\ 643 </a>\ 644 '; 645 $('.gallery-frame .blueimp-gallery a.close').after(viewOriginal); 646 } 647 648 setSlideIconTooltip(gid); 649 650 $(gid).off('slide').off('slideend'); 651 $(gid).on('slide', function (event, index, slide) { 652 if(!$galleryItem.find('a').is('[data-gallery-like="N"]')) $('.gallery-frame .blueimp-gallery a.gallery-like').removeAttr('data-like').addClass('hide'); 653 $('.gallery-frame .blueimp-gallery a.zoom-out').addClass('disabled'); 654 $('.gallery-frame .blueimp-gallery a.view-original').removeClass('fullscreen'); 655 $(gid).find('.slide').removeClass('fullscreen'); 656 $(gid).find('h3.title').removeClass('long-title visible'); 657 $('.gallery-frame .zoomable').removeClass('visible').addClass('hide'); 658 $('.gallery-frame .zoomable').find('img').remove(); 659 }).on('slideend', function(event, index, slide){ 660 // console.log(index); 661 var itemSeq = $('.element[data-id="'+pid+'"] .gallery-item[data-index='+index+']').attr('data-seq'); 662 var slideNumber = index + 1; 663 664 if(itemSeq == undefined) { 665 itemSeq = $('.galleryPL'+pid+'.gallery-popup .gallery-item[data-index='+index+']').attr('data-seq'); 666 if(totalSlide == 2 && index >= 2) slideNumber = index - 1; 667 } 668 669 $('.gallery-frame .blueimp-gallery .slide-index .current-slide').text(slideNumber); 670 671 var setSlideIcon = function() { 672 var windowWidth = $(window).width(); 673 var $img = $(slide).find('.slide-content'); 674 675 var title = $img.attr('title'); 676 if(title) $img.attr('data-title', title); 677 678 $(gid).find('h3.title').html($img.attr('data-title')); 679 $img.removeAttr('title'); 680 681 if ($galleryItem.find('a').attr('data-img-original') === 'ON') { 682 var currentWidth = $img.width(); 683 if(currentWidth >= windowWidth) { 684 $(gid).find('.view-original').addClass('disabled'); 685 } else { 686 $(gid).find('.view-original').removeClass('disabled'); 687 } 688 } 689 690 if(!$galleryItem.find('a').is('[data-gallery-like="N"]')) { 691 galleryLikePosition(gid, slide, itemSeq); 692 } 693 694 if(windowWidth <= 480) { 695 var titleWidth = $(gid).find('h3.title').width(); 696 if(titleWidth >= (windowWidth - 207)) $(gid).find('h3.title').addClass('long-title'); 697 } 698 } 699 700 if(!$(slide).hasClass('slide-loading')) { 701 setSlideIcon(); 702 } else { 703 // ì´ë¯¸ì§ ë¡ë를 ë기íë ê²½ì° 704 var checkLoaded = function () { 705 if(!$(slide).hasClass('slide-loading')) { 706 setSlideIcon(); 707 } else { 708 // ì´ë¯¸ì§ê° ìì í ë¡ëëì§ ìì ê²½ì° ì¬ê· í¸ì¶ 709 setTimeout(checkLoaded, 100); 710 } 711 }; 712 setTimeout(checkLoaded, 100); 713 } 714 }); 715 716 $('.gallery-frame .blueimp-gallery').find('h3.title').html($galleryItem.find('a').attr('data-title')); 717 718 $.cookie('gallery-item', $galleryItem.attr('data-seq'), { path : '/', expires: 12 * 60 * 60 * 1000 });
719 if(parent.prev != null) $('.data-page-prev').addClass('active'); 720 if(parent.next != null) $('.data-page-next').addClass('active'); 721 e.stopPropagation(); 722 723 $('body').off('dblclick', '.gallery-frame .blueimp-gallery .slide-content').on('dblclick', '.gallery-frame .blueimp-gallery .slide-content', function(e) { 724 $('.gallery-frame .blueimp-gallery a.view-original').toggleClass('fullscreen'); 725 var idx = 0, 726 eid = $('.gallery-frame .blueimp-gallery a.view-original').attr('data-id'); 727 728 var gid = '#gframe-' + eid; 729 $(gid + ' .slide').each(function(i,v) { 730 var trans = $(v).attr('style'); 731 if(trans.indexOf('translate(0px, 0px)') > -1 || trans.indexOf('transform: translate(0px) translateZ(0px)') > -1) { 732 idx=i; 733 } 734 }); 735 736 var $slide = $(gid + ' .slide[data-index="' + idx + '"]'); 737 var $img = $slide.find('.slide-content'); 738 if($('.gallery-frame .blueimp-gallery a.view-original').hasClass('fullscreen')) { 739 var img = $img[0]; 740 741 var currentWidth = $img.width(); 742 var currentHeight = $img.height(); 743 var windowWidth = $(window).width()-8; 744 var windowHeight = $(window).height(); 745 var naturalWidth = img.naturalWidth, 746 naturalHeight = img.naturalHeight; 747 748 scale = (windowWidth / currentWidth).toFixed(15); 749 } else { 750 scale = 1; 751 } 752 753 setSlideIconTooltip(gid); 754 setSlideImgScale($slide, scale); 755 }); 756 757 $('body').off('click','.gallery-frame .blueimp-gallery a.view-original').on('click','.gallery-frame .blueimp-gallery a.view-original', function(e) { 758 e.preventDefault(); 759 e.stopPropagation(); 760 $(this).toggleClass('fullscreen'); 761 762 var idx = 0, 763 eid = $(this).attr('data-id'); 764 765 var gid = '#gframe-' + eid; 766 $(gid + ' .slide').each(function(i,v) { 767 var trans = $(v).attr('style'); 768 if(trans.indexOf('translate(0px, 0px)') > -1 || trans.indexOf('transform: translate(0px) translateZ(0px)') > -1) { 769 idx=i; 770 } 771 }); 772 setSlideIconTooltip(gid); 773 $(gid).find('.view-original[data-toggle="tooltip"]').tooltip('show'); 774 775 var $slide = $(gid + ' .slide[data-index="' + idx + '"]'); 776 var $img = $slide.find('.slide-content'); 777 if($(this).hasClass('fullscreen')) { 778 var img = $img[0]; 779 780 var currentWidth = $img.width(); 781 var currentHeight = $img.height(); 782 var windowWidth = $(window).width()-8; 783 var windowHeight = $(window).height(); 784 var naturalWidth = img.naturalWidth, 785 naturalHeight = img.naturalHeight; 786 787 scale = (windowWidth / currentWidth).toFixed(15); 788 } else { 789 scale = 1; 790 } 791 792 setSlideImgScale($slide, scale); 793 }); 794 795 $('body').on('click','.gallery-frame .blueimp-gallery a.zoom-in, .gallery-frame .blueimp-gallery a.zoom-out', function(e) { 796 var idx = 0, 797 eid = $(this).attr('data-id'); 798 799 var gid = '#gframe-' + eid; 800 $('#gframe-' + eid + ' .slide').each(function(i,v) { 801 var trans = $(v).attr('style'); 802 if(trans.indexOf('translate(0px, 0px)') > -1 || trans.indexOf('transform: translate(0px) translateZ(0px)') > -1) { 803 idx=i; 804 } 805 }); 806 807 var $slide = $(gid + ' .slide[data-index="' + idx + '"]'); 808 var scale = $('.gallery-frame .zoomable img').attr('data-scale'); 809 if(scale === undefined) scale = 1; 810 811 if($(this).hasClass('zoom-in')) { 812 $('.gallery-frame .blueimp-gallery a.gallery-like').addClass('fullscreen'); 813 $('.gallery-frame .blueimp-gallery a.view-original').removeClass('disabled').addClass('fullscreen'); 814 815 scale = Number(scale) + 0.5; 816 } else { 817 if(scale > 1) scale = Number(scale) - 0.5; 818 if(scale < 1) scale = 1; 819 if(scale == 1) { 820 $('.gallery-frame .blueimp-gallery a.gallery-like').removeClass('fullscreen'); 821 $('.gallery-frame .blueimp-gallery a.view-original').removeClass('fullscreen'); 822 } 823 } 824 825 setSlideIconTooltip(gid); 826 setSlideImgScale($slide, scale); 827 828 e.stopPropagation(); 829 }); 830 831 $('body').off('click','.gallery-frame .blueimp-gallery a.play-pause').on('click','.gallery-frame .blueimp-gallery a.play-pause', function(e) { 832 setSlideIconTooltip(gid); 833 $(this).tooltip(); 834 }); 835 836 $('body').off('click','.gallery-frame .blueimp-gallery .title.long-title').on('click','.gallery-frame .blueimp-gallery .title.long-title', function(e) { 837 $(this).toggleClass('visible'); 838 }); 839}); 840 841var setSlideImgScale = function($slide, scale) { 842 // used 01. gallery block gallery mode 843 // used 002. resourcebox image 844 845 var checkResourcebox = $slide.is('#rframe'), 846 $img = $slide.find('.slide-content'), 847 slideFrame = $slide.closest('.blueimp-gallery'), 848 slideZoomable = slideFrame.find('.zoomable'); 849 850 var currentWidth = $img.width(); 851 var currentHeight = $img.height(); 852 853 if(slideZoomable.find('img').length == 0 || checkResourcebox) { 854 if(checkResourcebox) slideZoomable.empty(); 855 856 var $cloneImg = $slide.find('.slide-content').clone(); 857 $cloneImg.addClass('clone').attr('data-width', currentWidth).attr('data-height', currentHeight); 858 slideZoomable.append($cloneImg); 859 } 860 861 var slideZoomableImg = slideZoomable.find('img'); 862 863 var windowWidth = $(window).width(); 864 var windowHeight = $(window).height(); 865 var scaledWidth = currentWidth * scale; 866 var scaledHeight = currentHeight * scale; 867 868 var offsetX = ((windowWidth - currentWidth) > 0) ? (windowWidth - currentWidth) * 0.5 : 0; 869 var offsetY = ((windowHeight - currentHeight) > 0) ? (windowHeight - currentHeight) * 0.5 : 0; 870 var scaledOffsetX = ((windowWidth - scaledWidth - 8) > 0) ? (windowWidth - scaledWidth - 8) * 0.5 : 0; 871 var scaledOffsetY = ((windowHeight - scaledHeight) > 0) ? (windowHeight - scaledHeight) * 0.5 : 0; 872 var offset = {top: scaledOffsetY + 'px', left: scaledOffsetX + 'px'}; 873 var isScroll = false;
874 var centerX = 0; 875 var centerY = 0; 876 var scrollPositionX = 0; 877 var scrollPositionY = 0; 878 879 slideZoomable.removeClass('scroll'); 880 881 if(scaledWidth > windowWidth) { 882 slideZoomable.css('width', scaledWidth); 883 isScroll = true; 884 offset = {top: scaledOffsetY+'px', left: 0}; 885 } 886 887 if(scaledHeight > windowHeight) { 888 slideZoomable.css('height', scaledHeight); 889 isScroll = true; 890 offset = {top: 0, left: scaledOffsetX+'px'}; 891 } 892 893 if(scaledWidth >= windowWidth && scaledHeight >= windowHeight) { 894 offset = {top: 0, left: 0}; 895 } 896 897 if(isScroll) { 898 slideZoomable.addClass('scroll'); 899 var scrollOffsetX = scaledWidth - windowWidth; 900 var scrollOffsetY = scaledHeight - windowHeight; 901 902 centerX = (scrollOffsetX - 8) * 0.5; 903 centerY = (scrollOffsetY - 8) * 0.5; 904 905 scrollPositionX = (slideZoomable.attr('data-scroll-left') !== undefined)? Number(slideZoomable.attr('data-scroll-left')) * scrollOffsetX : centerX; 906 scrollPositionY = (slideZoomable.attr('data-scroll-top') !== undefined)? Number(slideZoomable.attr('data-scroll-top')) * scrollOffsetY : centerY; 907 908 // console.log('scrollPosition', scrollPositionX, scrollPositionY); 909 // console.log('center', centerX, centerY); 910 } 911 912 if(slideFrame.hasClass('blueimp-gallery-playing')) { 913 slideFrame.find('.play-pause').click(); 914 } 915 916 var scaleAnimation = Object.assign({}, offset, {width: scaledWidth+'px', height: scaledHeight+'px', scrollLeft: scrollPositionX, scrollTop: scrollPositionY}); 917 918 if (scale > 1) { 919 slideFrame.find('.zoom-out').removeClass('disabled'); 920 slideFrame.find('.gallery-like').addClass('fullscreen'); 921 slideZoomable.removeClass('hide'); 922 var zoomWidth = slideZoomableImg.attr('data-width'); 923 // var zoomHeight = slideZoomableImg.attr('data-height'); 924 var initialWidth = slideZoomableImg.width(); 925 var initialHeight = slideZoomableImg.height(); 926 927 if(Number(zoomWidth) == currentWidth) { 928 slideZoomableImg.css({width: currentWidth+'px', height: currentHeight+'px', top: offsetY+'px', left: offsetX+'px'}); 929 } 930 931 slideZoomable.addClass('visible'); 932 setTimeout(function(){ 933 $slide.addClass('fullscreen'); 934 935 slideZoomableImg.animate(scaleAnimation, 200); 936 // console.log(initialWidth, scaledWidth); 937 if(initialWidth < windowWidth && scaledWidth > windowWidth) { 938 scrollPositionX = centerX; 939 var scrollLeft = centerX / (scaledWidth - windowWidth); 940 slideZoomable.attr({'data-scroll-left': scrollLeft}); 941 } 942 if(initialHeight < windowHeight && scaledHeight > windowHeight) { 943 scrollPositionY = centerY; 944 var scrollTop = centerY / (scaledHeight - windowHeight); 945 slideZoomable.attr({'data-scroll-top': scrollTop}); 946 } 947 948 slideZoomable.animate({scrollLeft: scrollPositionX, scrollTop: scrollPositionY}, 200); //scroll 949 950 // if(scaledWidth >= windowWidth && scaledHeight >= windowHeight) slideZoomable.animate({scrollLeft: scrollPositionX, scrollTop: scrollPositionY}, 500); 951 952 slideZoomableImg.attr('data-scale', scale).attr('data-width', scaledWidth).attr('data-height', scaledHeight); 953 954 var isDragging = false; 955 var lastX, lastY; 956 slideZoomable.off('mousedown mousemove mouseup scroll'); 957 slideZoomable.on("mousedown", function(e) { 958 isDragging = true; 959 lastX = e.clientX; 960 lastY = e.clientY; 961 $(this).addClass('dragging'); 962 e.preventDefault(); 963 e.stopPropagation(); 964 965 }).on("mousemove", function(e) { 966 if (isDragging) { 967 var deltaX = e.clientX - lastX; 968 var deltaY = e.clientY - lastY; 969 $(this).scrollLeft($(this).scrollLeft() - deltaX); 970 $(this).scrollTop($(this).scrollTop() - deltaY); 971 lastX = e.clientX; 972 lastY = e.clientY; 973 e.preventDefault(); 974 e.stopPropagation(); 975 } 976 }).on("mouseup", function() { 977 isDragging = false; 978 $(this).removeClass('dragging'); 979 var scrollLeft = (($(this)[0].scrollWidth - $(this)[0].clientWidth) >
979 0) ? $(this).scrollLeft() / ($(this)[0].scrollWidth - $(this)[0].clientWidth) : 0; // ê°ë¡ ì¤í¬ë¡¤ ì¢í 980 var scrollTop = (($(this)[0].scrollHeight - $(this)[0].clientHeight) > 0) ? $(this).scrollTop() / ($(this)[0].scrollHeight - $(this)[0].clientHeight) : 0; // ì¸ë¡ ì¤í¬ë¡¤ ì¢í 981 982 slideZoomable.attr({'data-scroll-top': scrollTop, 'data-scroll-left': scrollLeft}); 983 }); 984 985 slideZoomable.on('mousewheel', function(e){ 986 var scrollLeft = (($(this)[0].scrollWidth - $(this)[0].clientWidth) > 0) ? $(this).scrollLeft() / ($(this)[0].scrollWidth - $(this)[0].clientWidth) : 0; // ê°ë¡ ì¤í¬ë¡¤ ì¢í 987 var scrollTop = (($(this)[0].scrollHeight - $(this)[0].clientHeight) > 0) ? $(this).scrollTop() / ($(this)[0].scrollHeight - $(this)[0].clientHeight) : 0; // ì¸ë¡ ì¤í¬ë¡¤ ì¢í 988 989 slideZoomable.attr({'data-scroll-top': scrollTop, 'data-scroll-left': scrollLeft}); 990 }); 991 }, 100); 992 } else { //ì본 í¬ê¸° 993 slideZoomableImg.animate(scaleAnimation, 200); 994 slideZoomable.animate({scrollLeft: scrollPositionX, scrollTop: scrollPositionY}, 200); 995 996 slideFrame.find('.zoom-out').addClass('disabled'); 997 slideFrame.find('.view-original, .gallery-like').removeClass('fullscreen'); 998 999 if(scaledWidth == $(window).width()) { 1000 slideFrame.find('.view-original').addClass('disabled'); 1001 } 1002 1003 setTimeout(function(){ 1004 $slide.removeClass('fullscreen'); 1005 }, 100); 1006 setTimeout(function(){ 1007 slideZoomable.removeClass('visible').addClass('hide'); 1008 slideZoomable.removeAttr('data-scroll-top data-scroll-left') 1009 slideZoomableImg.remove(); 1010 }, 200); 1011 } 1012 1013} 1014 1015var setSlideIconTooltip = function(slideframe_selector){ 1016 // used 01. gallery block gallery mode 1017 // used 002. resourcebox image 1018 1019 $(slideframe_selector).find('.zoom-in, .zoom-out, .view-original, .view-original.fullscreen').attr({ 1020 'data-toggle': 'tooltip', 1021 'data-placement': 'bottom', 1022 'data-html': 'true', 1023 }); 1024 1025 $(slideframe_selector).find('.zoom-in').attr('data-original-title', $.lang[LANG]['gallery.slide.tooltip.zoom-in']); 1026 $(slideframe_selector).find('.zoom-out').attr('data-original-title', $.lang[LANG]['gallery.slide.tooltip.zoom-out']); 1027 1028 $(slideframe_selector).find('.view-original').attr('data-original-title', $.lang[LANG]['gallery.slide.view-fullscreen']); 1029 if($(slideframe_selector).find('.view-original').hasClass('fullscreen')) { 1030 $(slideframe_selector).find('.view-original').attr('data-original-title', $.lang[LANG]['gallery.slide.tooltip.view-original']); 1031 } else { 1032 $(slideframe_selector).find('.view-original').attr('data-original-title', $.lang[LANG]['gallery.slide.tooltip.view-fullscreen']); 1033 } 1034 1035 $(slideframe_selector).find('.play-pause').attr({ 1036 'data-toggle': 'tooltip', 1037 'data-placement': 'top', 1038 'data-html': 'true', 1039 'data-original-title': $.lang[LANG]['gallery.slide.tooltip.autoplay'] 1040 }); 1041 $(slideframe_selector+'.blueimp-gallery-playing').find('.play-pause').attr('data-original-title', $.lang[LANG]['gallery.slide.tooltip.pause']); 1042} 1043 1044$(function() { 1045 var elem = typeof PAGE_MODE != 'undefined' && PAGE_MODE == 'c' ? document.querySelector('.dsgn-body') : document.querySelector('html'); 1046 1047 elem.addEventListener('wheel', function(event) { 1048 // ë§ì°ì¤ ìì¹ë¥¼ 기ì¤ì¼ë¡ í´ë¹ ìì를 ì°¾ì 1049 const mouseX = event.clientX; 1050 const mouseY = event.clientY; 1051 const elementAtMouse = document.elementFromPoint(mouseX, mouseY); 1052 var target = elementAtMouse; 1053 1054 // í´ë¹ ìì¹ì ìë ììê° fixedscroll ë´ì content-wrapì¸ì§ë¥¼ íì¸ 1055 if ($(target).parents('[data-gjs*="fixedscroll"]').find('.content-wrap').length && $(target).closest('.content-wrap').length) { 1056 // í´ë¹ ìììì í ì´ë²¤í¸ê° ë°ìí ê²½ì° preventDefault í¸ì¶íì¬ ê¸°ë³¸ ì¤í¬ë¡¤ ì°¨ë¨ 1057 event.preventDefault(); 1058 1059 // í ì´ë²¤í¸ê° ë°ìí ìììì ìëì¼ë¡ ì¤í¬ë¡¤ ì²ë¦¬ 1060 var focus_elem = $(target).parents('[data-gjs*="fixedscroll"]').find('.content-wrap').get(0); 1061 const atTop = focus_elem.scrollTop === 0; 1062 const atBottom = focus_elem.scrollHeight - focus_elem.scrollTop === focus_elem.clientHeight; 1063 1064 // ìµìë¨ ëë ìµíë¨ì ëë¬íì§ ììì ëë§ ìë ì¤í¬ë¡¤ ì²ë¦¬ 1065 if ((!atBottom && event.deltaY > 0) || (!atTop && event.deltaY < 0)) { 1066 // ë´ë¶ ììììë§ ì¤í¬ë¡¤ ì´ë 1067 focus_elem.scrollBy({ 1068 top: event.deltaY, // ì¤í¬ë¡¤ ë°©í¥ì ë°ë¼ ì´ë 1069 behavior: 'auto' // ë¶ëë¬ì´ ì¤í¬ë¡¤ í¨ê³¼ ì ì© ê°ë¥, íìì 'smooth'ë¡ ë³ê²½ ê°ë¥ 1070 }); 1071 1072 // focus_elemì í¬ì»¤ì¤ ì¤ì 1073 focus_elem.focus(); 1074 } else { 1075 // ë´ë¶ìì ë ì´ì ì¤í¬ë¡¤ì´ ì§íëì§ ìì¼ë©´ elem ìììì ì¤í¬ë¡¤ì ì²ë¦¬ 1076 if(isELVIEW) elem = document.querySelector('.elviewwrap'); 1077 elem.scrollBy({ 1078 top: event.deltaY, 1079 behavior: 'auto' 1080 }); 1081 } 1082 } 1083 }, { passive: false, capture: true }); 1084 1085});
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.