1$(function(){ 2 /* 3 * floor map layer popup control 4 */ 5 var $floorMap = $('#layer_floor_map'), 6 $menu = $('#layer_menu'), 7 $locationMap = $('#layer_location_map'), 8 paths = location.pathname.split('/'), 9 lastpath = paths[paths.length - 1], 10 keys = { 11 'walkerhill' : 'w', 12 'busan': 'b', 13 'incheon': 'i', 14 'jeju-grand' : 'jg', 15 'jeju-lotte' : 'jl' 16 }, 17 key = ''; 18 if( lastpath.indexOf(';') !== -1 ) { 19 key = keys[lastpath.slice(0 , lastpath.indexOf(';') )]; 20 } else { 21 key = keys[lastpath]; 22 23 } 24 $('#btn_show_floor_map').on('click', function(e) { 25 $floorMap.addClass('active'); 26 27 var POPUP_HEIGHT = 713, 28 diff = ($(window).height() > POPUP_HEIGHT) ? ($(window).height() - POPUP_HEIGHT) / 2 : 0, 29 offset = $floorMap.offset().top - diff ; 30 31 $('html, body').animate({ scrollTop : offset }); 32 }); 33 34 $('#btn_hide_floor_map').on('click', function(e) { 35 $floorMap.removeClass('active'); 36 }); 37 38 39 40 $('#btn_show_menu').on('click', function(e) { 41 $menu.addClass('active'); 42 console.log(key); 43 var POPUP_HEIGHT = $menu.find('.barmenu-view-' + key).outerHeight(), 44 diff = ($(window).height() > POPUP_HEIGHT) ? ($(window).height() - POPUP_HEIGHT) / 2 : 0, 45 offset = $menu.offset().top - diff - 100; 46 47 $('html, body').animate({ scrollTop : offset }); 48 }); 49 50 $('#btn_hide_menu').on('click', function(e) { 51 $menu.removeClass('active'); 52 }); 53 54 55 $('#btn_show_location_map').on('click', function(e) { 56 $locationMap.addClass('active'); 57 58 var POPUP_HEIGHT = $locationMap.find('.vehicle-view-' + key).outerHeight(), 59 POPUP_WIDTH = $locationMap.find('.vehicle-view-' + key).outerWidth(), 60 top = ( POPUP_HEIGHT / 2 * -1) + 'px', 61 left = ( POPUP_WIDTH / 2 * -1) + 'px'; 62 diff = ($(window).height() > POPUP_HEIGHT) ? ($(window).height() - POPUP_HEIGHT) / 2 : 0, 63 offset = $locationMap.offset().top - diff; 64 65 $('html, body').animate({ scrollTop : offset }); 66 67 //$locationMap.css({ marginLeft: left, marginTop: top }); 68 }); 69 70 $('#btn_hide_location_map').on('click', function(e) { 71 $locationMap.removeClass('active'); 72 }); 73 74 75 $('#btn_show_pw_change').on('click', function(e) { 76 $locationMap.addClass('active'); 77 78 var POPUP_HEIGHT = $locationMap.find('.vehicle-view-' + key).outerHeight(), 79 POPUP_WIDTH = $locationMap.find('.vehicle-view-' + key).outerWidth(), 80 top = ( POPUP_HEIGHT / 2 * -1) + 'px', 81 left = ( POPUP_WIDTH / 2 * -1) + 'px'; 82 //diff = ($(window).height() > POPUP_HEIGHT) ? ($(window).height() - POPUP_HEIGHT) / 2 : 0, 83 //offset = $locationMap.offset().top - diff; 84 85 //$('html, body').animate({ scrollTop : offset }); 86 87 $locationMap.css({ marginLeft: left, marginTop: top }); 88 }); 89 90 $('#btn_hide_location_map').on('click', function(e) { 91 $locationMap.removeClass('active'); 92 }); 93 94 95 96 97 $('.dim-white').on('click', closeAllLayer); 98 $('.dim-black').on('click', closeAllLayer); 99 100 function closeAllLayer() { 101 $floorMap.removeClass('active'); 102 $menu.removeClass('active'); 103 $locationMap.removeClass('active'); 104 } 105 106 107 108 /* 109 * Floor map controller 110 */ 111 112 $.fn.mapIndicator = function(options) { 113 var defaults = {}, 114 config = $.extend(defaults, options); 115 116 return this.each(function(i, v) { 117 var $popup = $(v), 118 $links = $popup.find('.tab-list > a'); 119 120 $links.on('click', function(e) { 121 var $link = $(this), 122 $target = $($link.attr('href')); 123 124 $links.removeClass('active'); 125 $link.addClass('active'); 126 $target.addClass('active').siblings().removeClass('active'); 127 128 return false; 129 }); 130 }); 131 }; 132 $floorMap.mapIndicator(); 133 134 var $galleryThumbs = $('#gallery_list').find('a'), 135 $galleryViewer = $('#gallery_viewer'), 136 $viewerItems = $galleryViewer.find('div[id^=gallery]'), 137 $btns = $galleryViewer.find('button'), 138 moveFirst = false; 139 140 $galleryThumbs.on('click', openViewer); 141 $btns.filter('.prev, .next').on('click', moveViewerItem); 142 $btns.filter('.tmp-btn-close-black').on('click', closeViewer); 143 144 function moveViewerItem(){ 145 146 var move = 1; 147 148 if($(this).hasClass('prev')){ 149 move = -1; 150 } 151 $viewerItems.eq(getMoveIndex(move)).addClass('active').siblings().removeClass('active'); 152 153 return false; 154 } 155 156 function getMoveIndex(move) { 157 158 var len = $viewerItems.length, 159 mIndex = $viewerItems.index($viewerItems.filter('.active')) + move; 160 161 if(mIndex < 0){ 162 mIndex = len - 1; 163 } else if (mIndex >= len){ 164 mIndex = 0; 165 } 166 167 return mIndex; 168 } 169 function openViewer(){ 170 171 var $item = $(this), 172 index = $galleryThumbs.index(this); 173 174 $galleryViewer.addClass('active'); 175 $viewerItems.eq(index).addClass('active'); 176 177 $btns.on('keyup', focusHandler).on('keydown', focusHandler).first().focus(); 178 179 function focusHandler(e) { 180 var keyCode = e.keyCode; 181 if (keyCode == 9) { 182 if (moveFirst) { 183 $btns.first().focus(); 184 moveFirst = false; 185 return false; 186 } 187 if ($(this)[0] == $btns.last()[0]) { 188 moveFirst = true; 189 return false; 190 } 191 } 192 } 193 return false; 194 } 195 196 function closeViewer(){ 197 198 var $activeItem = $viewerItems.filter('.active'), 199 index = $viewerItems.index($activeItem); 200 201 $galleryViewer.removeClass('active'); 202 $activeItem.removeClass('active'); 203 $galleryThumbs.eq(index).focus(); 204 205 return false; 206 } 207}); 208 209 210 211
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.