PageSourceSearch

https://dwvil.com/js/gallery.js?1781592562

js dwvil.com collected 2026-10-02 00:30:25 UTC 27,538 bytes, 930 lines download raw bytes

1var SLIDE_RESIZE = function(){
2	var $el, $container;
3	var data;
4	var max_width,ratio;
5	var slideWidgetResize =function (){
6		var width = $container.width();
7		if(width > max_width)
8			width = max_width;
9		var height = width*ratio;
10		if(height == 0)
11			height = 550;
12		$container.height(height);
13	};
14	var carouselResize = function(){
15		if(data.cnt>1){
16			var owl = $el.data('owlCarousel');
17			owl.onResize();
18		}
19	};
20	var setRatio = function (r){
21		ratio = r;
22	};
23	var init = function(d){
24		data = d;
25		$el = $('#gallery_'+data.code);
26		$container = $('#'+data.code+' ._gallery_wrap');
27		max_width = data.max_width;
28		ratio = data.ratio;
29		if(data.cnt>1){
30			$el.owlCarousel({
31				animateIn : data.animate_in,
32				animateOut : data.animate_out,
33				loop : true,
34				smartSpeed : 700,
35				autoplayTimeout : 4000,
36				nav : data.show_next_prev,
37				autoplay : true,
38				dots : data.show_paging,
39				navText : ["", ""],
40				items : 1
41			});
42		}
43
44		slideWidgetResize();
45
46		$(window).off('resize.'+data.code)
47			.on('resize.'+data.code,function(){
48				slideWidgetResize();
49			});
50	};
51	return {
52		'init' : function(d){
53			init(d);
54		},
55		'slideWidgetResize' : function(){
56			slideWidgetResize();
57		},
58		'carouselResize' : function(){
59			carouselResize();
60		},
61		'setRatio' : function(r){
62			setRatio(r);
63		}
64	}
65};
66
67
68var GALLERY2 = function(){
69	var code;
70	var $list_wrap;
71	var $container;
72	var $org_html;
73	var old_item_cnt = 0;
74	var change_timer = setTimeout(function(){},1);
75	var current_window_width;
76	var ratio;
77	var max_width;
78	var option = {
79	};
80	var type_data = {
81	};
82	var cm_data = {
83	};
84	var mobile_section;
85	var org_grid_gutter;
86	var thumb_line_cnt;
87	var thumb_item_cnt;
88	var thumb_ratio;
89	var thumb_margin;
90	var thumb_top_bottom_margin;
91	var show_more_status = false;
92	var show_text = false;
93	var is_site_page;
94	var is_modal = false;
95
96	var init = function(_c,data,_type_data,c_idx,st,_cm_data){
97		option = $.extend(option,data);
98		is_site_page = st;
99		org_grid_gutter = option.grid_gutter;
100		thumb_line_cnt = option.thumb_line_cnt;
101		thumb_item_cnt = option.thumb_item_cnt;
102		thumb_ratio = option.thumb_ratio;
103		thumb_margin = option.thumb_margin;
104		thumb_top_bottom_margin = option.thumb_top_bottom_margin;
105		type_data = $.extend(type_data,_type_data);
106		cm_data = $.extend(cm_data,_cm_data);
107		code = _c;
108		$list_wrap = $('#container_'+code);
109		$container = $('#'+code+' ._gallery_wrap');
110		if ( $list_wrap.closest('.modal_site_modal_menu').length > 0 ) is_modal = true;
111
112		var $section_obj = $list_wrap.closest('div[doz_type=section]');
113		var windowWidth = $(window).width();
114
115		mobile_section = $section_obj.attr('doz_mobile_section') == 'Y';
116		current_window_width = $(window).width();
117		$org_html = $list_wrap.clone(false);
118
119		//갤러리 로드시 텍스트는 가려진 상태로 시작(갤러리 완성후 출력)
120		if(type_data['type'] != 'masonry'){
121			$list_wrap.find('._text_wrap').hide();
122		}else{
123			show_text = true;
124		}
125		$list_wrap.imagesLoaded()
126			.always(function(){
127				runLightGallery(c_idx);
128				listResize();
129			});
130
131		if(type_data['sub_type']==='slide_03')
132			slideThumbsResize();
133
134		if(option['random_btn'] == 'Y' && type_data['sub_type'] != 'slide_03')
135			randomItem();
136
137		if(type_data['type'] != 'masonry'){
138			slideHeightResize();
139		}
140
141		if ( is_modal ){
142			if(type_data['type'] == 'masonry'){
143				setTimeout(function(){listResize()},100);
144			}
145			if(type_data['sub_type'] == 'slide_03'){
146				clearTimeout(change_timer);
147				change_timer = setTimeout(function(){
148					slideThumbsResize();
149					slideHeightResize();
150				}, 50);
151			}
152		};
153
154		$(window).off('resize.'+code)
155			.on('resize.'+code,function(){
156				//if(navigator.userAgent.match(/iPhone|iPad|iPod/i)){
157				if ($(window).width() != windowWidth) {
158					windowWidth = $(window).width();
159					show_more_status = false;
160				}else{
161					return;
162				}
163				//}
164				if(type_data['sub_type']==='slide_03')
165					slideThumbsResize();
166
167				if(type_data['type'] != 'masonry'){
168					slideHeightResize();
169				}
170
171				clearTimeout(change_timer);
172				change_timer = setTimeout(function(){
173					listResize();
174				},1000);
175			});
176
177		$('body').off('gridChange.'+code).on('gridChange.'+code,function(){
178			$(window).trigger('gallery_width.'+code);
179		});
180
181		$('#'+code +' ._more_btn').off('click').on('click', function(event){
182			var show_cnt = (data.type == 'grid')? data.grid_col_count * data.grid_row_count : data.masonry_count;
183			if(windowWidth <= 767){
184				// mobile section일 경우
185				if ($('#'+code +' ._more_btn').parents('.mobile_section').length > 0) show_cnt = (data.type === 'grid') ? data.grid_col_count * data.grid_row_count : data.masonry_mobile_count;
186				else show_cnt = (data.type === 'grid') ? data.grid_mobile_col_count * data.grid_row_count : data.masonry_mobile_count;
187			}
188			showMore(show_cnt);
189		});
190	};
191
192	var setRatio = function (r){
193		option.slide_ratio = r;
194	};
195	var slideHeightResize =function (){
196		if(type_data['use_height']!='Y'){
197			$list_wrap.height('auto');
198			return;
199		}
200		setTimeout(function(){slideHeightResizeSet();},40);
201	};
202
203	var slideThumbsResize = function(){
204
205		var container_width = $list_wrap.width(); // 컨테이너 넓이
206		var item_wrap = $container.find('.owl-thumbs');
207		var item = item_wrap.find('.owl-thumb-item');
208		var is_max_grid = $list_wrap.closest('div[doz_type="grid"]').hasClass('col-dz-12');
209		if(option.extend_thumbs == 'Y' && $list_wrap.closest('div[class="inside"]').length === 0 && is_max_grid)
210			container_width = item_wrap.width() - thumb_margin;
211		var item_width = (container_width - (thumb_item_cnt-1) * thumb_margin) / thumb_item_cnt;
212		var item_height =  item_width  / (thumb_ratio / 100);
213		var container_height = ((thumb_line_cnt-1) * thumb_top_bottom_margin) + (item_height * thumb_line_cnt);
214
215		item.outerHeight(item_height).outerWidth(item_width);
216		item_wrap.outerHeight(container_height);
217		if(option.thumb_line_cnt != 1)
218			item_wrap.outerHeight(container_height - (thumb_top_bottom_margin * (thumb_line_cnt-1)) + (thumb_margin * (thumb_line_cnt-1))
218);
219
220	};
221
222	var slideHeightResizeSet = function(){
223		var width = $list_wrap.width();
224		if(width > max_width)
225			width = max_width;
226
227		var height = width*option.slide_ratio;
228		if(height == 0)
229			height = 550;
230
231		if(type_data['sub_type']==='slide_03'){
232			var thumbs = $container.find('._owl_thumbs');
233			var thumbs_height = thumbs.height();
234			var thumbs_item = thumbs.find('.owl-thumb-item');
235			var thumbs_item_height = thumbs_item.height();
236
237			if(option.thumb_line_cnt == 1){
238				height = (width * option.slide_ratio) - Number(thumb_top_bottom_margin);
239				var total_height = Number(thumb_margin) + Number(thumbs_height);
240				$container.css('padding-bottom',total_height + Number(thumb_top_bottom_margin) - Number(thumb_margin) +'px');
241				$list_wrap.parent().height(height - thumbs_height);
242			}else{
243				height = ((width * option.slide_ratio) - Number(thumb_top_bottom_margin)) - ((option.thumb_line_cnt - 1) * thumbs_item_height);
244				var total_height = Number(thumb_top_bottom_margin) + Number(thumb_margin) + Number(thumbs_height);
245				$container.css('padding-bottom',total_height - Number(thumb_margin) +'px');
246				$list_wrap.parent().height((height - thumbs_height) + (thumbs_item_height * (option.thumb_line_cnt - 1)));
247			}
248		}else{
249			$list_wrap.parent().height(height);
250		}
251
252	};
253
254
255	var carouselResize = function(){
256		if($list_wrap.find('._item').length>1){
257			var owl = $list_wrap.data('owlCarousel');
258			owl.onResize();
259		}
260	};
261
262	var runLightGallery = function(c_idx){
263		// 비메오 자동재생 시 소리 겹침 문제로 자동재생 해제
264		$list_wrap.lightGallery({
265			selector: '._lightbox_item',
266			thumbnail: false,
267			animateThumb: false,
268			autoplayControls: false,
269			hash: true,
270			galleryId: code,		// 원래 galleryId는 number로 들어가야하나 widget_code 외에 구분할 ID가 적당하지 않아 widget_code 그대로 사용(갤러리 닫을 때마다 Document not active 에러 뜨는 이유)
271			swipeThreshold: 20,
272			showThumbByDefault: false,
273			mode: 'lg-fade',
274			speed: 200,
275			startClass: '',
276			scale: 0.5,
277			youtubePlayerParams: {
278				loop: 0,
279				autoplay: 1,
280				rel: 0,
281				showinfo: 0
282			},
283			vimeoPlayerParams: {
284				loop: 0,
285				autoplay: 0,
286				rel: 0,
287				title: 0
288			},
289			videoMaxWidth: 1140
290		});
291
292		if(history.replaceState && history.pushState){
293			// 라이트박스 hash 커스텀(IE 10 이상)
294			var current_url = location.href.indexOf('#') === -1 ? location.href : location.href.substr(0, location.href.indexOf('#'));
295			var back_url = document.referrer.indexOf('#') === -1 ? document.referrer : document.referrer.substr(0, document.referrer.indexOf('#'));
296			var history_push_flag = true;
297			$list_wrap.on('onBeforeOpen.lg', function(){
298				// URL에 해시를 입력해서(또는 링크로) 들어온 경우 onBeforeOpen.lg 이벤트 실행되지 않음
299				history_push_flag = true;
300			});
301			$list_wrap.on('onAfterSlide.lg', function(event, prevIndex, index){
302				if(history_push_flag){
303					history.replaceState(null, null, current_url);
304					history.pushState(null, null, current_url + '#lg=' + code + '&slide=' + index);		// 현재 페이지 히스토리 위에 슬라이드 히스토리를 추가
305					history_push_flag = false;
306				}
307				history.replaceState(null, null, current_url + '#lg=' + code + '&slide=' + index);		// 슬라이드 히스토리 교체
308			});
309			var history_back_flag = true;
310			$list_wrap.on('onBeforeClose.lg', function(e){
311				history_back_flag = true;
312				if(window.location.hash.indexOf('lg=' + code) !== -1){		// #lg가 남아있으면 뒤로 가기 처리
313					// 닫기 버튼을 눌렀을 때(뒤로 가기 버튼을 눌렀을 때는 lg 해시가 제거됨)
314					history.back();
315					history_back_flag = false;
316				}
317			});
318			$list_wrap.on('onCloseAfter.lg', function(){
319				if(history_back_flag || window.location.hash.indexOf('lg=' + code) !== -1){
320					// Safari에서 onBeforeClose.lg의 history.back()이 실행되지만 해시가 제거되지 않는 문제로 인해 추가 처리
321					// onBeforeClose.lg 이벤트에서 한 번 처리하지 않으면 라이트박스가 닫힌 이후 뒤로가기 시 해시가 다시 나타남(기본적으로 닫힐 때 추가 히스토리를 삽입하는 듯)
322					history.back();
323				}
324				history_back_flag = true;
325			})
326		}
327		var current_idx = parseInt(c_idx);
328		if(current_idx>0){
329			showLightGallery(current_idx);
330		}
331	};
332
333	var showLightGallery = function(idx){
334
335		$('#gal_item_'+idx).click();
336	};
337
338	var runMasonry = function(is_first){
339		var threshold = 9999999;
340
341		$list_wrap.on('layoutComplete', function() {
342			$list_wrap.css('visibility','visible');
343		});
344
345		$list_wrap.masonry({
346			'itemSelector': '._item'
347		});
348		if(is_first){
349			setTimeout(function(){
350				if(!is_modal){
351					$list_wrap.find('._lazy_img').lazyload({
352						effect : 'fadeIn',
353						effect_speed : 50 // fadeIn 시간 단축(기본 400ms→50ms)
354					});
355				}else{
356					$list_wrap.find('._lazy_img').lazyload({
357						threshold : threshold
358					});
359				}
360			}, 200);
361		}
362	};
363
364	var runSlide = function(item_cnt){
365		if(type_data['show_slide_wrap'] != 'Y')
366			return;
367
368		if(is_site_page){
369			var is_mobile = false;
370			if(MENU.getCurrentDeviceType() == 'm')
371				is_mobile = true;
372		};
373
374		var slide_dots = '';
375		if(type_data['sub_type']=='slide_03'){
376			if(!is_mobile){
377				slide_dots = false;
378			}else{
379				slide_dots = true;
380			}
381		}else{
382			slide_dots = option['show_paging']=='Y';
383		};
384
385		if(option['show_paging']=='Y') pagingStyle();
386
387		if(old_item_cnt == item_cnt){
388			imgHeight();
389			return;
390		}
391
392		if(typeof $list_wrap.data('owlCarousel') != 'undefined'){
393			$list_wrap.data('owlCarousel',false);
394			$list_wrap.empty();
395			$list_wrap.off();
396			$list_wrap.unbind();
397			$.each($org_html.find('._item'),function(e,$_item){
398				$list_wrap.append($_item);
399			});
400			$org_html = $list_wrap.clone(false);
401		}
402
403
404		old_item_cnt = item_cnt;
405		var mobile_cnt = item_cnt;
406		var pc_cnt = item_cnt;
407		mobile_cnt  = type_data['max_col'] <=1 ? 1 : mobile_cnt;
408		pc_cnt  = type_data['max_col'] <=1 ? 1 : pc_cnt;
409
410		if(type_data['sub_type']==='slide_01' || type_data['sub_type']==='slide_03'){
411			mobile_cnt =1;
412			pc_cnt =1;
413		}
414		if(type_data['max_col'] > 1){
415			$list_wrap.find('._item').css({'padding' : option.grid_gutter + 'px'});
416		}
417
418		var change_animate_list = {
419			'slide' : {
420				'name' : 'Slide',
421				'in' : false,
422				'out' : false
423			},
424			'fade' : {
425				'name' : 'Fade',
426				'in' : 'fadeIn',
427				'out' : 'fadeOut'
428			},
429			'fadedown' : {
430				'name' : 'Fade Down',
431				'in' : false,
432				'out' : 'fadeOutDown'
433			},
434			'slidedown' : {
435				'name' : 'Slide Down',
436				'in' : 'slideInDown',
437				'out' : 'slideOutDown'
438			},
439			'slidedown2' : {
440				'name' : 'Slide Down2',
441				'in' : false,
442				'out' : 'slideOutDown'
443			}
444		};
445
446		if(option['show_next_prev']=='Y'){
447			$list_wrap.toggleClass('custom_nav nav_type_'+cm_data.nav_style_type);
448			switch(cm_data.nav_style_type){
449				case 'st00':
450					switch(cm_data.nav_type_angle){
451						case 'normal':
452							$list_wrap.toggleClass('nav_normal');
453							break;
454						case 'round':
455							$list_wrap.toggleClass('nav_round');
456							break;
457						case 'square':
458							$list_wrap.toggleClass('nav_square');
459							break;
460					}
461					break;
462				case 'st01':
463					switch(cm_data.nav_type_arrow){
464						case 'normal':
465							$list_wrap.toggleClass('nav_normal');
466							break;
467						case 'round':
468							$list_wrap.toggleClass('nav_round');
469							break;
470						case 'square':
471							$list_wrap.toggleClass('nav_square');
472							break;
473					}
474					break;
475				case 'st02':
476					switch(cm_data.nav_type_long_arrow){
477						case 'normal':
478							$list_wrap.toggleClass('nav_normal');
479							break;
480						case 'round':
481							$list_wrap.toggleClass('nav_round');
482							break;
483						case 'square':
484							$list_wrap.toggleClass('nav_square');
485							break;
486					}
487					break;
488				case 'st03':
489					switch(cm_data.nav_type_caret){
490						case 'normal':
491							$list_wrap.toggleClass('nav_normal');
492							break;
493						case 'round':
494							$list_wrap.toggleClass('nav_round');
495							break;
496						case 'square':
497							$list_wrap.toggleClass('nav_square');
498							break;
499					}
500					break;
501				case 'st04':
502					$list_wrap.toggleClass('nav_text');
503					break;
504			}
505		};
506
507		var is_extend_grid = $list_wrap.closest('div[class="inside"]').length === 0;
508		var stagePadding = 0;
509
510		if ( option['sub_type']=='slide_05') {
511			if ( is_extend_grid ) { // 그리드 확장시
512				$list_wrap.addClass('extend_gallery');
513				stagePadding = 100;
514			} else {
515				$list_wrap.removeClass('extend_gallery');
516				stagePadding = 60;
517			}
518
519			// 디자인 모드일 경우 모바일 처럼 보여야함
520			const isDesignModeAtMobile = $('body').hasClass('device_type_m')
521				&& $list_wrap.closest('div[doz_type="section"]').hasClass('pc_section');
522
523			if ( isDesignModeAtMobile ) stagePadding = 40;
524		}
525
526		if ( option['sub_type']=='slide_05' )
527			$container.css('overflow', 'hidden');
528
529		if($list_wrap.find('._item').length > 1){
530			var owl = $list_wrap.owlCarousel({
531				'animateIn' : change_animate_list[option['effect']]['in'],
532				'test' : change_animate_list,
533				'animateOut' : change_animate_list[option['effect']]['out'],
534				'loop' : option['effect_loop']=='Y',
535				'smartSpeed' : option['effect_time']*1000,
536				'autoplayTimeout' : option['effect_wait'] == '0' ? '31' : option['effect_wait']*1000,
537				'nav' : option['show_next_prev']=='Y',
538				'autoplay' : option['auto_change']=='Y',
539				'dots' : slide_dots,
540				'navText' : ["", ""],
541				'items':pc_cnt,
542				'slideBy':(option['slide_by']=='Y' && (option['sub_type']=='slide_02' || option['sub_type']=='slide_05' )) ? 1 : pc_cnt,
543				'responsive':{
544					0:{
545						'items':mobile_cnt,
546						'slideBy': (option['slide_by']=='Y' && (option['sub_type']=='slide_02' || option['sub_type']=='slide_05' )) ? 1 : mobile_cnt,
547						'nav':(option['show_next_prev']=='Y' && option['show_mobile_next_prev']=='Y') ? true : false,
548						'dots' : type_data['sub_type']=='slide_03' ? true : option['show_paging']=='Y',
549						'stagePadding': option['sub_type']=='slide_05' ? 40 : 0
550					},
551					990:{
552						'items':pc_cnt,
553						'slideBy': (option['slide_by']=='Y' && (option['sub_type']=='slide_02' || option['sub_type']=='slide_05' )) ? 1 : pc_cnt,
554						'nav':option['show_next_prev']=='Y',
555						'stagePadding': stagePadding
556					}
557				},
558				'onInitialized': function(){
559					if ( option['type']=='slide' && option['show_next_prev']=='Y' && option['effect_loop'] != 'Y' ) {
560						$list_wrap.find('.owl-prev').hide();
561					}
562					if(option['effect_loop'] === 'Y'){
563						$list_wrap.find('.owl-item.cloned ._lightbox_item').on('click', function(){
564							// 슬라이드 반복 기능으로 생성된 복제 아이템은 원본 아이템으로 클릭 이벤트 연결
565							var slide_no = $(this).data('no');
566							var $org_item = $list_wrap.find('.owl-item:not(.cloned) ._lightbox_item[data-no=' + slide_no + ']');
567							if($org_item){
568								$org_item.trigger('click');
569							}
570						})
571					}
572				}
573			});
574
575
576			if(type_data['sub_type']  == 'slide_03'){
577				if(option.thumb_line_cnt != 1){
578					$container.find('._owl_thumbs button').each(function(eq){
579						$(this).on('click',function(){
580							owl.trigger('to.owl.carousel', [eq, 300 ,true]);
581							$container.find('._owl_thumbs button').filter('.active').removeClass('active');
582							$(this).addClass('active');
583						});
584					});
585				}else{
586					if(!is_mobile){
587						owl.on('changed.owl.carousel', syncPosition);
588						var syncedSecondary = true;
589						var thumbs = $container.find('._owl_thumbs');
590						thumbs.on('initialized.owl.carousel', function() {
591							thumbs.find('.owl-item').eq(0).addClass('current');
592						}).owlCarousel({
593							'items' : option.thumb_item_cnt,
594							'slideBy' : option.thumb_item_cnt,
595							'dots' : false,
596							'nav' : false,
597							'margin' : Number(option.thumb_margin)
598						}).on('changed.owl.carousel', syncPosition2);
599					}
600					function syncPosition(el) {
601						if(option['effect_loop'] !='Y'){
602							var current = el.item.index;
603						}else{
604							var current = el.item.index-2;
605						}
606						thumbs
607							.find('.owl-item')
608							.removeClass('current')
609							.eq(current)
610							.addClass('current');
611						var onscreen = thumbs.find(".owl-item.active").length;
612						var start = thumbs
613							.find('.owl-item.active')
614							.first()
615							.index();
616						var end = thumbs
617							.find('.owl-item.active')
618							.last()
619							.index();
620						if (current > end){
621							thumbs.trigger('to.owl.carousel', [current, 100, true]);
622						}
623						if (current < start){
624							thumbs.trigger('to.owl.carousel', [current - onscreen, 100, true]);
625						}
626					}
627					function syncPosition2(el) {
628						var start = el.item.index;
629						var end = el.item.index + parseInt(el.page.size) - 1;
630						if(option['effect_loop'] !='Y'){
631							var current = owl.find('.owl-item.active').index();
632						}else{
633							var current = owl.find('.owl-item.active').index() - 2;
634						}
635						if(current > end || current < start){
636							if(syncedSecondary){
637								syncedSecondary = false;
638								owl.trigger('to.owl.carousel', [start, 100, true]);
639								syncedSecondary = true;
640							}
641						}
642					}
643					if(!is_mobile){
644						thumbs.on('click', '.owl-item', function(e) {
645							e.preventDefault();
646							var number = $(this).index();
647							owl.trigger('to.owl.carousel', [number, 300, true]);
648						});
649					}
650				}
651			} else {
652				if ( option['show_next_prev'] == 'Y' && option['effect_loop'] != 'Y') {
653					owl.on('changed.owl.carousel', setNavBtn);
654					function setNavBtn(event){
655						var $nextBtn = $container.find('.owl-next');
656						var $prevBtn = $container.find('.owl-prev');
657						var index = event.item.index;
658						var items = event.item.count;
659						var size = event.page.size;
660
661						if ( index == 0 ) {
662							$prevBtn.hide();
663						} else {
664							$prevBtn.show();
665						}
666						if ( items-size == index ) {
667							$nextBtn.hide();
668						} else {
669							$nextBtn.show();
670						}
671					}
672				}
673			}
674
675		}
676		imgHeight();
677
678		setTimeout(function(){carouselResize();},1000);
679	};
680
681	var listResize = function(){
682		var window_width = $(window).width();
683		if($('body').hasClass('device_type_m')){
684			window_width = 370;
685		}
686		if(window_width <= 991)
687			option.grid_gutter = org_grid_gutter/2;
688
689		if ( type_data['sub_type'] !=='slide_01' )
690			$list_wrap.css({'margin':'0 -'+option.grid_gutter+'px'});
691
692		var cnt = parseInt(option.grid_col_count);
693		var inner_width = $list_wrap.width();
694
695		//var item_cnt = Math.floor(inner_width/option.grid_width);
696		//var width = Math.floor(inner_width / item_cnt);
697		if(window_width <= 991 && !mobile_section){
698			if(typeof option.grid_mobile_col_count == "undefined")
699				cnt = 2;
700			else
701				cnt = parseInt(option.grid_mobile_col_count);
702		}else{
703			if(type_data['type'] == 'slide'){
704				inner_width = $list_wrap.parent().width();
705			}else{
706				inner_width = $list_wrap.width();
707			}
708			if(option.grid_extend_fix != 'Y'){
709				var s_width = (option.max_width - (option.document_margin * 2)) + option.grid_gutter * 2;
710				var item_max = s_width - ((cnt - 1) * parseInt(option.grid_gutter));
711				var grid_width = Math.floor(item_max / cnt);
712				var current_width = Math.floor((inner_width - ((cnt - 1) * parseInt(option.grid_gutter))) / cnt);
713				if(current_width > grid_width){
714					cnt = Math.floor(inner_width / grid_width);
715				}
716			}
717		}
718		var width = Math.floor(inner_width / cnt);
719		if(type_data['type'] === 'grid'){
720			$list_wrap.find('._item').css({'padding' : option.grid_gutter + 'px'});
721			runColSize(cnt);
722		}else if(type_data['type'] === 'masonry'){
723			$list_wrap.find('._item').css({'width' : width, 'padding' : option.grid_gutter + 'px'});
724			runMasonry(true);
725		}else {
726			runSlide(cnt);
727		}
728		//한번 보여진 텍스트는 그다음부터 show 처리안하도록
729		if(!show_text){
730			$list_wrap.find('._text_wrap').show();
731			show_text = true;
732		}
733	};
734
735	var runColSize = function(col_cnt){
736		var i = 1;
737		var $_row = $('<div />').addClass('_gallery_row gallery_row tabled');
738		var is_append = false;
739		$list_wrap.find('._dummy_item').remove();
740		var $item = $list_wrap.find('._item');
741		var item_count = $item.length;
742		var max_count = col_cnt * parseInt(option['grid_row_count']);
743		if(parseInt(option['grid_row_count']) <= 0){
744			max_count = 99999999;
745		}
746		if(type_data['type'] == 'grid'){
747			$item.each(function(e,$_obj){
748				if(e < max_count || show_more_status){
749					showItem($(this));
750				}else
751					hideItem($(this));
752			});
753		}
754
755
756		$item.each(function(e,$_obj){
757			$_row.append($_obj);
758			is_append = false;
759			if(i % col_cnt == 0){
760				$list_wrap.append($_row);
761				is_append = true;
762				$_row = $('<div />').addClass('_gallery_row gallery_row tabled');
763			}
764			i++;
765		});
766
767		if(!is_append){
768			var $tmp_item = $_row.find('._item');
769			if($tmp_item.length >0 ){
770				if($tmp_item.length < col_cnt){
771					var remain_cnt = col_cnt - $tmp_item.length;
772					for(var i = 0; i <remain_cnt; i++){
773						var $dummy_col = $('<div/>').addClass('dummy_col item_gallary _item _dummy_item');
774						$_row.append($dummy_col);
775					}
776				}
777				$list_wrap.append($_row);
778			}
779		}
780		$list_wrap.find('._gallery_row').each(function(){
781			var $tmp_item = $(this).find('._item');
782			if($tmp_item.length ==0 ){
783				$(this).remove();
784			}
785		});
786
787		//$list_wrap.find('._item').css('width' , percent+'%');
788		imgHeight();
789	};
790
791
792	var imgHeight = function(){
793		if(type_data['show_ratio_wrap'] == 'Y'){
794			if (option.img_ratio != 'img_circle'){ // 이미지 비율이 원형이 아니면 기존대로 처리
795				var height = Math.ceil($list_wrap.find('._img_wrap').eq(0).width() / (option.img_ratio / 100));
796			}else{
797				var height = Math.ceil($list_wrap.find('._img_wrap').eq(0).width() / (100 / 100));
798				$list_wrap.find('._img_wrap').css({'border-radius':'50%'});
799				$list_wrap.find('._item_container').css({'border-radius':'50%'});
800				if(type_data['sub_type']=='grid_03' || type_data['sub_type']=='slide_02' || option['sub_type']=='slide_05' ){
801					$list_wrap.find('._item_container').css({'border-radius':''});
802				}
803			}
804			$list_wrap.find('._img_wrap').css({'min-height':height});
805			if(type_data['sub_type'] == 'slide_02' || option['sub_type']=='slide_05' ){
806				$list_wrap.find('._img_wrap').height(height);
807			}
808			if(type_data['is_hover_text'] == 'Y'){
809				$list_wrap.find('._text_wrap').height(height);
810			}
811		}
812		if(type_data['use_masonry'] == 'Y'){
813			runMasonry(true);
814		}
815	};
816
817
818	var showMore = function(show_cnt){
819		// Chrome에서 Scroll Anchoring 기능이 갤러리 다음 내용을 기준으로 동작하는 문제가 있어 잠시 기능 해제
820		$('body.doz_sys').css('overflow-anchor', 'none');
821		$list_wrap.find('._item_hide').each(function(index){
822			if(show_cnt-1 < index){
823				return ;
824			}
825			showItem($(this));
826		});
827		show_more_status = true;
828		// 섹션 크기가 변경되므로 resize 처리함
829		if(type_data['type'] == 'masonry'){
830			runMasonry(false);
831		}
832		$(window).trigger('resize');
833		$('body.doz_sys').css('overflow-anchor', '');
834	};
835	var showItem = function($_obj){
836		$_obj.show();
837		var _url = $_obj.find('._img_wrap').data('bg');
838		$_obj.find('._img_wrap').css('background-image',_url);
839		$_obj.removeClass('_item_hide');
840		if($list_wrap.find('._item_hide').length == 0)
841			$('#'+code +' ._more_btn').hide();
842	};
843	var hideItem = function($_obj){
844		$_obj.hide();
845		$_obj.addClass('_item_hide');
846		if($list_wrap.find('._item_hide').length > 0)
847			$('#'+code +' ._more_btn').show();
848	};
849
850	var randomItem = function(){
851		if(type_data['type'] == 'masonry'){
852			var list_cnt = $list_wrap.children().length;
853			var hide_cnt = $list_wrap.find('._item_hide').length;
854			$list_wrap.children().removeClass('_item_hide').css({'display' : '',});
855			$list_wrap.children().sort(function(){
856				return Math.round(Math.random()) - 0.5;
857			}).each(function(index){
858				$(this).appendTo($list_wrap);
859				if(index > (list_cnt - hide_cnt -1)){
860					$(this).addClass('_item_hide').css({'display' : 'none'});
861				}
862			});
863		}else{
864			$list_wrap.children().sort(function(){
865				return Math.round(Math.random()) - 0.5;
866			}).each(function(){
867				$(this).appendTo($list_wrap);
868			});
869		}
870	};
871
872	var pagingStyle = function(){
873		switch(cm_data.paging_style_type){
874			case 'st00':
875				switch(cm_data.paging_default_style_type){
876					case 'st00':
877						$list_wrap.toggleClass('paging_type_dot paging_type_dot01', true);
878						break;
879					case 'st01':
880						$list_wrap.toggleClass('paging_type_dot paging_type_dot02', true);
881						break;
882				}
883				break;
884			case 'st01':
885				$list_wrap.toggleClass('paging_type_big_dot', true);
886				break;
887			case 'st02':
888				$list_wrap.toggleClass('paging_type_line', true);
889				break;
890			case 'st03':
891				switch(cm_data.paging_active_style_type){
892					case 'st00':
893						$list_wrap.toggleClass('paging_type_count paging_type_count01', true);
894						break;
895					case 'st01':
896						$list_wrap.toggleClass('paging_type_count paging_type_count02', true);
897						break;
898					case 'st02':
899						$list_wrap.toggleClass('paging_type_count paging_type_count03', true);
900						break;
901				}
902				break;
903		}
904
905	};
906
907	return {
908		'init' : function(c,d,t,c_idx,st,_cm){
909			init(c,d,t,c_idx,st,_cm);
910		},
911		'listResize' : function(){
912			listResize();
913		},
914		'setRatio' : function(r){
915			setRatio(r);
916		},
917		'slideWidgetResize' : function(){
918			slideHeightResize();
919		},
920		'carouselResize' : function(){
921			carouselResize();
922		},
923		'showMore' : function(show_cnt){
924			showMore(show_cnt);
925		},
926		'showLightGallery' : function(idx){
927			showLightGallery(idx);
928		}
929	}
930};

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.