1(function ($) { 2 $(document).ready(function () { 3 var _jsMapStage = jQuery('.js-stagemap-container'); 4 if (_jsMapStage.length) { 5 $.each(_jsMapStage, function () { 6 var container = this; 7 8 new Waypoint.Inview({ 9 element: this, 10 enter: function (direction) { 11 this.destroy(); 12 $(container).stageMap({ 13 mapSettings: { 14 center: _jsMapStage.data('center'), 15 zoom: _jsMapStage.data('zoom') 16 } 17 }); 18 } 19 }) 20 }); 21 } 22 }); 23 24})(jQuery); 25 26(function ($) { 27 $.fn.stageMap = function (settings) { 28 var _stageMapContainer = jQuery(this), 29 _mapLoaded = false, 30 _marker = [], 31 _btnMaximize = $(this).find('.js-stagemap-maximize'), 32 _btnMinimize = $(this).find('.js-stagemap-minimize'), 33 _btnCatHide = $(this).find('.js-stagemap-cat-hide'), 34 _btnCatShow = $(this).find('.js-stagemap-cat-show'), 35 _loadingText = $(this).find('.js-stagemap-loading'), 36 _mapError = $(this).find('.js-stagemap-error'), 37 _city = $(this).find('.js-stagemap-city'), 38 _classSplit = '_is_split', 39 _classMaximize = (isPalm()) ? '_is_maximized ' : '_is_maximized ' + _classSplit, 40 _settings = $.extend({ 41 mapSettings: {} 42 }, settings); 43 44 var _initializeStageMap = function () { 45 if (!_mapLoaded) { 46 47 var activeCategories = []; 48 _stageMapContainer.find('.js-stagemap-categorycheck:checked').each(function () { 49 activeCategories.push(parseInt($(this).val())); 50 }); 51 var ajaxUrl = '/index.php?NeustaMaps=1'; 52 if(_city.val()) { 53 ajaxUrl = ajaxUrl += '&city=' + _city.val(); 54 } 55 $.ajax({ 56 url: ajaxUrl, 57 cache: false, 58 type: 'GET', 59 success: function (response) { 60 $.each(response.result, function (index, mapData) { 61 _marker.push({ 62 position: mapData.latitude + ',' + mapData.longitude, 63 title: mapData.title, 64 icon: getMarkerIcon( 65 response.icons, 66 mapData.mapcategories[0], 67 '/typo3conf/ext/skeleton/Resources/Public/Images/mapicons/mapicon_fallback.png' 68 ), 69 iwContentUrl: '/index.php?teaser=1&source=' + mapData.product + '&uid=' + mapData.uid + '&no_cache=1', 70 categories: mapData.mapcategories, 71 polyline: mapData.polyline 72 }); 73 }); 74 ndsmap.loadApi(ndsmap.createDynamicMap, _mapContainer, { 75 marker: _marker, 76 settings: _settings.mapSettings, 77 activeCategories: activeCategories, 78 kmlSources: _getKmlSources() 79 }); 80 81 _initCategoryTree(); 82 _initAreas(response.areas); 83 _mapLoaded = true; 84 _loadingText.addClass('hide'); 85 }, 86 error: function (response) { 87 console.log(response); 88 _loadingText.addClass('hide'); 89 _mapError.removeClass('hide'); 90 91 } 92 }); 93 } 94 }; 95 96 var getMarkerIcon = function(icons, category, fallback) { 97 return icons[category] ? icons[category] : fallback; 98 }; 99 100 var _initCategoryTree = function () { 101 _stageMapContainer.find('.js-stagemap-categorycheck').change(function () { 102 var activeCategories = []; 103 $('input[data-parent="' + $(this).data('uid') + '"]').prop('checked', $(this).is(':checked')); 104 $.each($('input[name="' + $(this).prop('name') + '"]:checked'), function (index, element) { 105 activeCategories.push(parseInt($(this).val())); 106 }); 107 $(_mapContainer).dynamicMap.filterMarker(activeCategories); 108 }); 109 }; 110 111 var _initAreas = function (areas) { 112 _stageMapContainer.find('.js-stagemap-areacheck').change(function (e) { 113 var tmpStat = $(this).is(':checked'); 114 $('input[name="' + $(this).prop('name') + '"]').prop('checked', false); 115 $(this).prop('checked', tmpStat); 116 117 if (tmpStat) { 118 $(_mapContainer).dynamicMap.addOutline(areas[$(this).val()]); 119 } else { 120 $(_mapContainer).dynamicMap.removeOutline(); 121 } 122 }); 123 }; 124 125 var _getKmlSources = function () { 126 var kmlSources = []; 127 var gpxTrack = _stageMapContainer.data('gpx-track'); 128 129 if (gpxTrack) { 130 kmlSources.push(gpxTrack); 131 } 132 133 return kmlSources; 134 }; 135 136 if (_stageMapContainer.find('.js-stagemap-map').length) { 137 var _mapContainer = _stageMapContainer.find('.js-stagemap-map')[0], 138 _quickbutons = _stageMapContainer.find('.js-mapstage-quickbutton'); 139 _initializeStageMap(); 140 141 $(_mapContainer).on('mapLoaded', function () { 142 143 _stageMapContainer.addClass('_is_initialized'); 144 145 _quickbutons.click(function (e) { 146 $(this).toggleClass('act'); 147 148 $.each($('input[data-uid="' + $(this).data('category') + '"]'), function (index, element) { 149 $(element).trigger('click'); 150 }); 151 }); 152 153 _btnMaximize.click(function () { 154 _stageMapContainer.addClass(_classMaximize); 155 window.setTimeout(function () { 156 $(_mapContainer).dynamicMap.resize(); 157 }, 500); 158 }); 159 160 _btnMinimize.click(function () { 161 _quickbutons.addClass('act'); 162 163 _stageMapContainer.find('.js-stagemap-categorycheck:checked').each(function () { 164 _stageMapContainer.find('.js-mapstage-quickbutton[data-category="' + $(this).data('uid') + '"]').removeClass('act'); 165 }); 166 167 _stageMapContainer.removeClass(_classMaximize); 168 _stageMapContainer.removeClass(_classSplit); 169 170 window.setTimeout(function () { 171 $(_mapContainer).dynamicMap.resize(); 172 }, 500); 173 }); 174 175 _btnCatShow.click(function () { 176 _stageMapContainer.addClass(_classSplit); 177 window.setTimeout(function () { 178 $(_mapContainer).dynamicMap.resize(); 179 }, 500); 180 }); 181 182 _btnCatHide.click(function () { 183 _stageMapContainer.removeClass(_classSplit); 184 window.setTimeout(function () { 185 $(_mapContainer).dynamicMap.resize(); 186 }, 500); 187 }); 188 189 }); 190 } 191 }; 192 193})(jQuery);
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.