1var HEADER_MEGA_DROPDOWN = function(){ 2 var uniq_id = ''; 3 var resize_time = {}; 4 var dropdown_state = 'closed'; // 'closed', 'opening', 'open', 'closing' 5 var $body; 6 var code; 7 var widget_offset_top = 0; 8 var widget_height = 0; 9 var widget_bottom = 0; 10 var section_offset_top = 0; 11 var section_height = 0; 12 var section_bottom = 0; 13 var org_row_size = 5; 14 var calculate_row_size = 5; 15 var row_size = 5; 16 var align = 'center'; 17 var menu_width = 0; 18 var gap = 0; 19 var event_type = 'mouseover'; 20 var menu_sync = false; 21 var $section; 22 var $widget; 23 var $drop_down; 24 var option; 25 var $has_child = false; // íì ë©ë´ ìì ì¬ë¶ 26 var is_header_config = false; // ëìì¸ëª¨ë ìë¨ì¤ì ì¬ë¶ true, false 27 var close_pending = false; // ì¬ë ëì¤ ìì½ëë close 를 ì´ë¦¼ ìë£ í ì¬íê°í기 ìí íëê·¸ 28 var last_leave_e = null; // ì¬íê° ì close ì ë길 ë§ì§ë§ mouseleave ì´ë²¤í¸ 29 var isHovering = function(){ 30 return $widget.is(':hover') || $widget.find(':hover').length > 0 31 || $drop_down.is(':hover') || $drop_down.find(':hover').length > 0; 32 }; 33 var getFullHeight = function(){ 34 var _h = 0; 35 var _style_h = $drop_down[0].style.height; 36 var _style_d = $drop_down.css('display'); 37 var _style_v = $drop_down.css('visibility'); 38 $drop_down.css({'height':'auto', 'display':'block', 'visibility':'hidden'}); 39 _h = $drop_down.height(); 40 $drop_down.css({'visibility':_style_v, 'display':_style_d}); 41 if(_style_h) $drop_down.css('height', _style_h); 42 else $drop_down.css('height', ''); 43 return _h; 44 }; 45 46 var init = function($w, $d, o){ 47 uniq_id = makeUniq(); 48 is_header_config = o.is_header_config; 49 $widget = $w; 50 $drop_down = $d; 51 option = o; 52 if(typeof $widget == 'undefined') 53 return; 54 if(typeof $drop_down == 'undefined') 55 return; 56 57 if($widget.length == 0) 58 return; 59 60 if($drop_down.length == 0) 61 return; 62 63 code = option.code; 64 event_type = typeof option.event_type == 'undefined'? 'mouseover' : option.event_type; 65 66 //ios ìì mouseover ì´ë²¤í¸ë¥¼ ëë¸ííì¬ í¨. ë¤ë¥¸ ë§í¬ë¤ì ìí¥ì ì¤ 67 if(IS_MOBILE){ 68 event_type = 'click'; 69 } 70 org_row_size = option.row_size; 71 menu_width = option.menu_width; 72 menu_sync = option.menu_sync; 73 align = option.align; 74 calculateRowSize(); 75 76 $has_child = $widget.find('.sub_menu').length > 0 ? true : false; // íì ë©ë´ ììê° 1ê° ì´ì ì¡´ì¬í ê²½ì° true 77 if($('#dropdown_' + code).attr('data-widget-type') === 'inline_menu_btn'){ 78 $has_child = true; 79 }; 80 81 $section = $widget.closest('div[data-type=section-wrap]'); 82 $section.find('._mega_dropdown_container_'+code).remove(); 83 $section.append($drop_down); 84 85 widget_offset_top = $widget.offset().top; 86 widget_height = $widget.outerHeight(); 87 widget_bottom = widget_offset_top+widget_height; 88 section_offset_top = $section.offset().top; 89 section_height = $section.outerHeight(); 90 section_bottom = section_offset_top+section_height; 91 $body = $('body'); 92 93 gap = (widget_offset_top - section_offset_top)+widget_height; 94 $drop_down.css({'top' : gap + 'px'}); 95 setDropDownTop(); 96 97 if(menu_sync){ 98 //setMenuSync(); 99 }else{ 100 $drop_down.find('._mega_dropdown_sync').css('visibility','visible'); 101 $(window).off('resize.'+uniq_id).on('resize.'+uniq_id,function(){ 102 if(resize_time) { 103 clearTimeout(resize_time); 104 } 105 resize_time = setTimeout(function() { 106 $(this).trigger('resizeEnd.'+uniq_id); 107 }, 500); 108 }); 109 $(window).off('resizeEnd.'+uniq_id).on('resizeEnd.'+uniq_id,function(){ 110 // resize ì íì¤ ë©ë´ ê°ì ì¬ê³ì° 111 calculateRowSize(); 112 }); 113 } 114 $widget.find('._inline_menu_container').on('more_menu_complete',function(){ 115 setMenuSync(); 116 }); 117 118 if (IS_MOBILE) { 119 $widget.off(event_type+".mega_dropdown_"+code).on(event_type+".mega_dropdown_"+code,function(e){ 120 if(dropdown_state === 'open' && event_type=='click'){ 121 close(e); 122 }else{ 123 open(e); 124 } 125 }); 126 127 $(document).off(event_type+".mega_dropdown_"+code).on(event_type+".mega_dropdown_"+code,function(e){ 128 if(($(e.target).closest("#"+code).length == 0 || (event_type=='click' && dropdown_state !== 'opening')) && $(e.target).closest("#dropdown_"+code).length == 0){ 129 close(e); 130 } 131 }); 132 } else { var close_timer = null; 133 $widget.add($drop_down).off('mouseenter.mega_dropdown_' + code).on('mouseenter.mega_dropdown_' + code, function(e) { 134 if (close_timer) { 135 clearTimeout(close_timer); 136 close_timer = null; 137 } 138 close_pending = false;
139 open(e); 140 }); 141 142 $widget.add($drop_down).off('mouseleave.mega_dropdown_' + code).on('mouseleave.mega_dropdown_' + code, function(e) { 143 last_leave_e = e; 144 close_timer = setTimeout(function() { 145 // ì¬ë ì¤ì´ë©´ 커ìê° ìì§ í¼ì³ì§ë í¨ë ë°(ìë쪽)ì ìì ì ìì´(sweep) mouseleave ê° ì¤íì¼ ì ìë¤. 146 // ì´ë close íë©´ slideUp ì´ ììëê³ ê³§ í¨ëì´ ì»¤ìì ë¿ì open ì´ stop(true,true) ë¡ ê°ë¡ì± ìë¨ì´ ë¨ë¦°ë¤. 147 // ê·¸ëì close íì ì 'ì´ë¦¼ ìë£' ìì ì¼ë¡ 미룬ë¤. ê·¸ ìì ì í¨ëì´ full í¬ê¸°ë¼ :hover íì ì´ ì ííë¤. (IMOPS-12866) 148 if(dropdown_state === 'opening'){ 149 close_pending = true; 150 return; 151 } 152 if(isHovering()){ 153 return; 154 } 155 close(e); 156 }, 50); 157 }); 158 } 159 160 // íì´ì§ ë¡ë ì§í ë§ì°ì¤ê° ì´ë¯¸ ë©ë´ ìì ìì ëë ìë¸ë©ë´ë¥¼ ì´ì´ì¤ë¤ 161 if (!IS_MOBILE) { 162 setTimeout(function() { 163 // ë§ì°ì¤ë¥¼ í ë²ë§ ê°ì§í´ ìì ìì ìì¼ë©´ ì´ê¸° 164 $(document).one('mousemove.mega_dropdown_init_' + code, function(e) { 165 var rect = $widget[0].getBoundingClientRect(); 166 if (e.clientX >= rect.left && e.clientX <= rect.right && 167 e.clientY >= rect.top && e.clientY <= rect.bottom) { 168 open(e); 169 } 170 }); 171 172 // ì´ë¯¸ í¸ë² ìíë¼ë©´ ì¦ì ì´ê¸° 173 if ($widget.is(':hover') || $widget.find(':hover').length > 0) { 174 var fakeEvent = { currentTarget: $widget[0] }; 175 open(fakeEvent); 176 } 177 }, 100); 178 } 179 }; 180 181 var setMenuSync = function(){ 182 if(menu_sync && $(window).width() > 768){ 183 setDropDownTop(); 184 var $mega_dropdown_sync = $drop_down.find('._mega_dropdown_sync'); 185 $mega_dropdown_sync.css('visibility','hidden'); 186 $mega_dropdown_sync.find('._title_anchor').css('visibility', 'hidden'); 187 $mega_dropdown_sync.find('._title_anchor').css('height', '1px'); 188 var $menu_items = $widget.find('._main_menu li'); 189 var $more_menu = $widget.find('._main_menu li._more_menu'); 190 var $drop_down_menu_items = $mega_dropdown_sync.find('._item'); 191 if($more_menu.length >0){ 192 var _last_code = ''; 193 $menu_items.each(function(){ 194 if(isBlank($(this).attr('data-code'))) 195 return false; 196 _last_code = $(this).attr('data-code'); 197 }); 198 var more_list = []; 199 var show_list = []; 200 var hit_more = false; 201 if(_last_code == '') 202 hit_more = true; 203 $drop_down_menu_items.each(function(){ 204 if(hit_more){ 205 more_list.push($(this)); 206 }else{ 207 show_list.push($(this)); 208 } 209 var _code = $(this).attr('data-code'); 210 if(_code == _last_code){ 211 hit_more = true; 212 } 213 }); 214 if(more_list.length > 0){ 215 // ê³µê°ì ë ¸ì¶ëì§ ìì ë©ë´ë¤ì ëë¡ë¤ì´ ë§ì§ë§ ë©ë´ ìëë¡ ë ¸ì¶ìí´ 216 var $more_ul = $('<ul class="sub_menu mega_more_list"/>'); 217 $.each(more_list, function(e, $_obj){ 218 $_obj.find('ul.mega_more_list').remove(); 219 $_obj.find('span').show(); 220 var $clone_title = $_obj.find('._title_anchor').clone().removeClass('_title_anchor'); 221 $clone_title.show(); 222 $more_ul.append($('<li class="mega_more"/>').append($clone_title)); 223 $_obj.find('._title_anchor').hide(); 224 $_obj.hide(); 225 }); 226 var $origin_ul = more_list[0].find('ul'); 227 $origin_ul.hide(); 228 more_list[0].append($more_ul); 229 more_list[0].show(); 230 $more_ul.show(); 231 } 232 if(show_list.length > 0){ 233 $.each(show_list, function(e, $_obj){ 234 $_obj.find('ul.mega_more_list').remove(); 235 $_obj.find('ul').show(); 236 $_obj.show(); 237 }); 238 } 239 }else{
240 // ë¸ë¼ì°ì í¬ê¸°ê° ëì´ì ¸ more_menuê° ì¬ë¼ì¡ì ë ì¨ê²¼ë ë©ë´ë¤ ë¤ì ë ¸ì¶ìí´ 241 $drop_down_menu_items.each(function(){ 242 var $show_item = $(this); 243 $show_item.find('ul.mega_more_list').remove(); 244 $show_item.find('ul').show(); 245 $show_item.show(); 246 }); 247 } 248 249 var left = $widget.offset().left; 250 if($body.hasClass('admin')) 251 left = left-$('#edit').offset().left; 252 $mega_dropdown_sync.css({ 253 'padding' : 0, 254 'position' : 'relative', 255 'left' : left, 256 'visibility' : 'visible' 257 }); 258 } 259 }; 260 261 var open = function(e){ 262 if($body.hasClass('admin') && is_header_config) 263 return; 264 if($('#dropdown_' + code).find('._item').length == 0) 265 return; 266 if(!$has_child && $(e.currentTarget).find('._main_menu ._more_menu').length == 0) // íì ë©ë´ê° ì¡´ì¬íì§ ìê±°ë ë©ë´ ë보기 ë²í¼ì´ ì¡´ì¬íì§ ìì ê²½ì° 267 return; 268 269 // ì´ë¯¸ ì´ë ¤ìê±°ë ì¬ë ì¤ì´ë©´ ì¬ì§ì no-op. ì¬ë ëì¤ mouseenter ê° stop(true,true) ë¡ full ëì´ê¹ì§ ìê° ì ííë ê²ì ë§ëë¤. (IMOPS-12866) 270 if(dropdown_state === 'opening' || dropdown_state === 'open') 271 return; 272 273 $drop_down.stop(true, true); 274 var current_h = $drop_down.height(); 275 if($drop_down.is(':hidden')) current_h = 0; 276 var full_h = getFullHeight(); 277 var duration = 400; 278 if(full_h > 0) duration = Math.round(400 * (Math.abs(full_h - current_h) / full_h)); 279 280 $drop_down.slideDown({ 281 'duration' : duration, 282 'easing' : 'swing', 283 'start' : function(animation){ 284 dropdown_state = 'opening'; 285 }, 286 'progress' : function(animation, progress, remainingMs){ 287 288 }, 289 'done' : function(animation,jumpedToEnd){ 290 dropdown_state = 'open'; 291 // ì´ë¦¬ë ëì¤ ìì½ëë close 를 ì§ê¸ ì¬íê°íë¤. í¨ëì´ full í¬ê¸°ë¼ :hover íì ì´ ì ííë¤. 292 if(close_pending){ 293 close_pending = false; 294 if(!isHovering()) 295 close(last_leave_e); 296 } 297 } 298 }); 299 }; 300 301 var close = function(e){ 302 if($body.hasClass('admin') && is_header_config) 303 return; 304 if($('#dropdown_' + code).find('._item').length == 0) 305 return; 306 if(!$has_child && $(e.currentTarget).find('._main_menu ._more_menu').length == 0) // íì ë©ë´ê° ì¡´ì¬íì§ ìê±°ë ë©ë´ ë보기 ë²í¼ì´ ì¡´ì¬íì§ ìì ê²½ì° 307 return; 308 309 // ì´ë¯¸ ë«íìê±°ë ë«íë ì¤ì´ë©´ ì¬ì§ì no-op (open ê³¼ ëì¹). (IMOPS-12866) 310 if(dropdown_state === 'closing' || dropdown_state === 'closed') 311 return; 312 313 // ì ëë©ì´ì ì¤ë¨ ì ëì´ê° ë¨ì í´ë¦ ììì ê°ë¦¬ë 문ì ìë°© 314 $drop_down.stop(true, true); 315 var current_h = $drop_down.height(); 316 if($drop_down.is(':hidden')) current_h = 0; 317 var full_h = getFullHeight(); 318 var duration = 400; 319 if(full_h > 0) duration = Math.round(400 * (current_h / full_h)); 320 321 $drop_down.slideUp({ 322 'duration' : duration, 323 'easing' : 'swing', 324 'start' : function(animation){ 325 dropdown_state = 'closing'; 326 }, 327 'progress' : function(animation, progress, remainingMs){ 328 329 }, 330 'done' : function(animation,jumpedToEnd){ 331 dropdown_state = 'closed'; 332 } 333 }); 334 }; 335 336 var setDropDownTop = function(){ 337 setTimeout(function(){ 338 widget_offset_top = $widget.offset().top; 339 widget_height = $widget.outerHeight(); 340 widget_bottom = widget_offset_top+widget_height; 341 section_offset_top = $section.offset().top; 342 section_height = $section.outerHeight(); 343 section_bottom = section_offset_top+section_height; 344 gap = (widget_offset_top - section_offset_top)+widget_height; 345 $drop_down.css({'top' : gap + 'px'}); 346 },1000); 347 }; 348 349 var calculateRowSize = function(){ 350 if(menu_width){ 351 calculate_row_size = align == 'center' ? Math.floor($(window).width() / menu_width) : Math.floor(($(window).width() - (menu_width / 2)) / menu_width); 352 if(calculate_row_size < 1) calculate_row_size = 1; 353 row_size = calculate_row_size > org_row_size ? org_row_size : calculate_row_size; 354 }else{ 355 row_size = option.row_size; 356 } 357 if(row_size <1 || row_size>20) row_size = 5; 358 if(!menu_sync){ 359 $('#dropdown_' + code).find('._item').each(function(e){ 360 if(e % row_size == 0){ 361 $(this).addClass('clear-both'); 362 }else{ 363 $(this).removeClass('clear-both'); 364 } 365 }); 366 } 367 }; 368 369 return { 370 'init' : function($widget, $drop_down, option){ 371 init($widget, $drop_down, option); 372 } 373 } 374 375};
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.