1/* Kienso - jQuery for co-marquage */ 2 3jQuery(function($) { 4 $(document).ready(function () { 5 6 // Create Map 7 var maps = []; 8 var createMap = function (map_div) { 9 10 if( typeof L === 'undefined') return; 11 12 // Define map style 13 var CartoDB_Voyager = L.tileLayer('https://{s}.basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}{r}.png', { 14 attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors © <a href="https://carto.com/attributions">CARTO</a>', 15 minZoom: 1, 16 maxZoom: 19 17 }); 18 19 var map_id = map_div.attr('id'); 20 var leafletMap = null; 21 var marker = null; 22 23 // Get map infos 24 var org_mark = [ parseFloat( map_div.attr('data-co-gmaps-lat') ), parseFloat( map_div.attr('data-co-gmaps-lon') ) ]; 25 26 // Create map 27 leafletMap = L.map(map_id, { 28 scrollWheelZoom: false 29 }).setView(org_mark, 15); 30 31 // Add marker to the map 32 marker = L.marker(org_mark).addTo(leafletMap); 33 leafletMap.addLayer(CartoDB_Voyager); 34 35 // Save map object in array 36 maps[map_id] = leafletMap; 37 } 38 39 // Init maps on document load 40 $(".co-org-maps").each(function() { 41 map_div = $(this); 42 createMap(map_div); 43 }); 44 45 // Resize Maps 46 var resizeMaps = function (el) { 47 48 el.each(function () { 49 50 var map_div = $(this); 51 52 // Wait animate end 53 setTimeout(function(map_div){ 54 55 var map_id = map_div.attr('id'); 56 57 // Destroy the Map 58 maps[map_id].remove(); 59 maps[map_id] = null; // Clear the array 60 61 // Create the Map 62 createMap(map_div); 63 64 }, 300, map_div); 65 }); 66 } 67 68 /* TABS */ 69 $('#comarquage [data-co-action="tab"]').click(function(event) { 70 71 // Change tab 72 $(this).closest('.tabs').find('> .nav-tabs > li').removeClass('active'); 73 $(this).addClass('active'); 74 75 // Change content 76 $(this).closest('.tabs').find('> .tab-content > .tab-pane').removeClass('active'); 77 var target = $(this).attr('data-co-target'); 78 $(target).addClass('active'); 79 80 resizeMaps($(target).find('.co-org-maps')); 81 }); 82 83 /* SLIDES / COLLAPSE */ 84 $('#comarquage [data-co-action="slide"]').click(function(event) { 85 $(this).toggleClass('active'); 86 var target = $(this).attr('data-co-target'); 87 $(target).slideToggle('200'); 88 }); 89 90 $('#comarquage [data-co-action="slideall-up"]').click(function(event) { 91 var target = $(this).attr('data-co-target'); 92 $(target + ' .co-btn-slide').removeClass('active'); 93 $(target + ' .fiche-item-content').slideUp('200'); 94 95 $(target + ' .co-btn[data-co-action="slide"]').removeClass('active'); 96 $(target + ' .co-collapse').addClass('co-hide').slideUp('200'); 97 }); 98 99 $('#comarquage [data-co-action="slideall-down"]').click(function(event) { 100 101 var target = $(this).attr('data-co-target'); 102 $(target + ' .co-btn-slide').addClass('active'); 103 $(target + ' .fiche-item-content').slideDown('200'); 104 105 $(target + ' .co-btn[data-co-action="slide"]').addClass('active'); 106 $(target + ' .co-collapse').removeClass('co-hide').slideDown('200'); 107 108 resizeMaps( $(this).closest('#comarquage').find('.co-org-maps') ); 109 110 }); 111 112 $('#comarquage [data-co-action="slide-bloccas-radio"]').click(function(event) { 113 var $el = $(this), 114 $thisChoice = $el.closest('.choice-tree-choice'), 115 $thisChoiceList = $el.closest('.choice-tree-choice-list'); 116 117 $thisChoice.toggleClass('choice-active'); 118 $thisChoiceList.children('.choice-tree-choice').not($thisChoice).toggleClass('choice-hide'); 119 120 $el.toggleClass('active'); 121 var target = $el.attr('data-co-target'); 122 $(target).slideToggle('200'); 123 124 //choice-tree-choice 125 resizeMaps( $(this).closest('.choice-tree-choice').find('.co-org-maps') ); 126 }); 127 128 /* Organismes */ 129 $('#comarquage [data-co-action="slide-org"]').click(function(event) { 130 $(this).toggleClass('active'); 131 var target = $(this).attr('data-co-target'); 132 $(target).slideToggle('200'); 133 if ( $(this).hasClass('active') ) resizeMaps($(this).closest('.fiche-item').find('.co-org-maps')); 134 }); 135 136 }); 137});
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.