1/* ================================ 2 * DOCUMENT READY 3 */ 4$(document).ready(function() { 5 6/* ================================ 7 * SIDE MENU OPEN AND CLOSE 8 */ 9 $('#header div.trigger-menu-side, a.trigger-menu-close').on('click', function() { 10 var menu_el = $('div#sidemenu'); 11 12 if ( menu_el.hasClass('hidden') ) { 13 menu_el.removeClass('hidden'); 14 } else { 15 menu_el.addClass('hidden'); 16 } 17 }); 18 19 $('div#sidemenu div.menu-overlay').on('click', function() { 20 $('div#sidemenu').addClass('hidden'); 21 }); 22 23 24/* ================================ 25 * NAV MENU 26 */ 27 $('nav.nav-menu ul li.sub-menu > a').on('click', function(e) { 28 29 e.preventDefault(); 30 31 var li_el = $(this).parent('li'); 32 var ul_child = li_el.find('ul:first'); 33 34 if ( li_el.hasClass('active') ) { 35 ul_child.slideUp(); 36 li_el.removeClass('active'); 37 } else { 38 ul_child.slideDown(); 39 li_el.addClass('active'); 40 } 41 42 }); 43 44/* ================================ 45 * CUSTOM POPUP 46 */ 47 $('#my-popup .popup-content-block').on('click', function(e) { 48 e.stopPropagation(); 49 }); 50 51 $('.trigger-popup-close').on('click', function() { 52 processPopup('close'); 53 }); 54 55/* ================================ 56 * GAMME FILTER 57 */ 58 59 $(document).ready(function() { 60 61 $( ".carrosserrie-filter" ).click(function() { 62 $('.filter_tabs li').removeClass('active'); 63 $(this).parent().addClass('active'); 64 var filter_id = $(this).attr('data-carrosserie-filter-id'); 65 $('div[data-carrosserie-id]').each(function(index) { 66 var filter_val = $(this).attr('data-carrosserie-id'); 67 if(filter_val == filter_id){$(this).fadeIn();}else{$(this).hide();} 68 }); 69 }); 70 71 $( ".show_all" ).click(function() { 72 $('.filter_tabs li').removeClass('active'); 73 $(this).parent().addClass('active'); 74 $('div[data-carrosserie-id]').each(function(index) { 75 $(this).fadeIn(); 76 }); 77 }); 78 79 }); 80 81/* ================================ 82 * Youtube holder 83 */ 84 $('.youtube-youtube').each(function(index) { 85 var videoURL = $(this).attr('data-video-url'); 86 var videoId = getYutubeId(videoURL); 87 var iframeMarkup = '<iframe width="100%" height="auto" src="//www.youtube.com/embed/'+ videoId + '" frameborder="0" allowfullscreen></iframe>'; 88 $(this).append(iframeMarkup); 89 }); 90 91/* ================================ 92 * FOR PAGES WITH BACKGROUND - FIT THE BACKGROUND PHOTO 93 */ 94 fitPageWallpaper(); 95 96/* ================================ 97 * Footer up counter 98 */ 99 $('.cnt').each(function () { 100 $(this).prop('Counter',0).animate({ 101 Counter : $(this).text() 102 }, { 103 duration: 1000, 104 easing : 'swing', 105 step : function (now) { 106 $(this).text(Math.ceil(now)); 107 } 108 }); 109 }); 110 111 $('.magnificPopup').magnificPopup({ 112 delegate : 'a', 113 type : 'image', 114 tLoading : 'Loading image #%curr%...', 115 mainClass : 'mfp-img-mobile', 116 gallery : { 117 enabled : true, 118 navigateByImgClick : true, 119 preload : [0, 1] // Will preload 0 - before current, and 1 after the current image 120 }, 121 image : { 122 tError : '<a href="%url%">The image #%curr%</a> could not be loaded.', 123 titleSrc : function(item) { 124 return item.el.attr('title') + '<small>by CFAO</small>'; 125 } 126 } 127 }); 128 129 $('.mfp-pop').magnificPopup({ 130 type: 'iframe', 131 iframe: { 132 markup: '<div class="mfp-iframe-scaler">' + 133 '<div class="mfp-close"></div>' + 134 '<iframe class="mfp-iframe" frameborder="0" allow="autoplay" allowfullscreen></iframe>' + 135 '</div>', 136 patterns: { 137 youtube: { 138 index: 'youtube.com/', 139 id: 'v=', 140 src: 'https://www.youtube.com/embed/%id%?autoplay=1' 141 } 142 } 143 } 144 }); 145 146 147/* ================================ 148 * FLYING WORDS 149 */ 150 flying_words_holder = $('div.flying-words'); 151 flying_words = flying_words_holder.find('h2'); 152 flying_words_count = flying_words.length; 153 flying_word_current = 1; 154 155 if ( flying_words_count > 1 ) { 156 var interval = setInterval( 'changeFlyingWords()' , 5000 ); 157 } 158}); 159 160/* ================================ 161 * WINDOW RESIZE 162 */ 163$(window).on('resize', function() { 164 165 fixPopupPosition(); 166 fitPageWallpaper(); 167}); 168 169/* ================================ 170 * JQUERY EXTEND 171 */ 172jQuery.fn.extend({ 173 174 resetForm: function () { 175 176 var el_input_text = $(this).find( 'input[type=text]' ); 177 el_input_text.each(function(){ 178 $(this).val(''); 179 }); 180 181 var el_input_check = $(this).find( 'input[type=checkbox]' ); 182 el_input_check.each(function(){ 183 $(this).prop('checked', false); 184 }); 185 186 var el_select = $(this).find( 'select' ); 187 el_select.each(function(){ 188 $(this).val(""); 189 }); 190 191 var el_textarea = $(this).find( 'textarea' ); 192 el_textarea.each(function(){ 193 $(this).val(''); 194 }); 195 } 196 197}); 198 199/* separate - check resolution and under mobile rearrange */ 200 201$(document).ready(function() { 202 // Optimalisation: Store the references outside the event handler: 203 var $window = $(window); 204 var $pane = $('#pane1'); 205 206 function checkWidth() { 207 var windowsize = $window.width(); 208 209 if (windowsize < 768) { 210 $('.section_characteristics') 211 $('.section_characteristics').each(function() { 212 $(this).insertAfter($(this).parent().find('.gamme-modele-360')); 213 }); 214 }else{ 215 $('.gamme-modele-360') 216 $('.gamme-modele-360').each(function() { 217 $(this).insertAfter($(this).parent().find('.section_characteristics')); 218 }); 219 } 220 } 221 // Execute on load 222 checkWidth(); 223 // Bind event listener 224 $(window).resize(checkWidth); 225}); 226 227/* */ 228 229/* ================================ 230 * FUNCTIONS 231 */ 232 233function changeFlyingWords() { 234 235 flying_word_current = flying_word_current + 1; 236 if ( flying_word_current > flying_words_count ) { 237 flying_word_current = 1; 238 } 239 240 flying_words.hide(); 241 flying_words.eq( flying_word_current-1 ).show(); 242} 243 244function fitPageWallpaper() { 245 246 var el = $('section.wallpaper-content'); 247 var window_h = $(window).height(); 248 var header_h = $('div#header').height(); 249 250 251 if ( el.length > 0 ) { 252 253 el.css('height', (window_h - header_h) + 'px'); 254 $('#content').addClass('no-padding'); 255 $('div.backstretch').css('position', 'absolute').css('width', '100%'); 256 257 258 259 } 260} 261 262function processPopup( action ) { 263 264 var popup_holder = $('#my-popup'); 265 266 popup_holder.find('.popup-content').html(''); 267 268 if ( action == 'show' ) { 269 popup_holder.removeClass('hidden'); 270 }else{ 271 popup_holder.addClass('hidden'); 272 } 273 274 fixPopupPosition(); 275} 276 277function fixPopupPosition() { 278 279 var holder = $('#my-popup .popup-content-block'); 280 var holder_height = holder.height(); 281 var window_height = $(window).height(); 282 283 if ( window_height > holder_height ) { 284 var margin_top = ( window_height - holder_height ) / 2; 285 }else{ 286 var margin_top = 0; 287 } 288 289 holder.css('margin-top', margin_top + 'px'); 290} 291 292function getYutubeId(url) { 293 const regExp = /^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/; 294 const match = url.match(regExp); 295 296 return (match && match[2].length === 11) 297 ? match[2] 298 : null; 299} 300
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.