1(function ($) { 2 // Define breakpoints 3 const breakpoints = { 4 xlarge: '(max-width: 1680px)', 5 large: '(max-width: 1280px)', 6 medium: '(max-width: 1024px)', 7 small: '(max-width: 736px)', 8 xsmall: '(max-width: 480px)', 9 'xlarge-to-max': '(min-width: 1681px)', 10 'small-to-xlarge': '(min-width: 481px) and (max-width: 1680px)', 11 }; 12 13 14 skel.breakpoints({ 15 xlarge: '(max-width: 1680px)', 16 large: '(max-width: 1280px)', 17 medium: '(max-width: 1024px)', 18 small: '(max-width: 736px)', 19 xsmall: '(max-width: 480px)', 20 'xlarge-to-max': '(min-width: 1681px)', 21 'small-to-xlarge': '(min-width: 481px) and (max-width: 1680px)' 22 }); 23 24 // Cache DOM elements 25 const $window = $(window); 26 const $body = $('body'); 27 const $sidebar = $('#sidebar'); 28 const $sidebarInner = $sidebar.children('.inner'); 29 const $sidebarToggle = $('#wrapper .toggle, #sidebar-toggle'); 30 31 // Disable animations/transitions until the page has loaded 32 $body.addClass('is-loading'); 33 $window.on('load', () => { 34 setTimeout(() => $body.removeClass('is-loading'), 100); 35 }); 36 37 // Handle window resizing 38 let resizeTimeout; 39 $window.on('resize', () => { 40 $body.addClass('is-resizing'); 41 clearTimeout(resizeTimeout); 42 resizeTimeout = setTimeout(() => { 43 $body.removeClass('is-resizing'); 44 handleResponsiveSidebar(); 45 }, 100); 46 }); 47 48 // Gestion responsive de la sidebar - Version simplifiée pour Safari iPad 49 function handleResponsiveSidebar() { 50 try { 51 const windowWidth = window.innerWidth || $window.width() || document.documentElement.clientWidth || 1024; 52 53 if (windowWidth <= 799) { 54 $sidebar.removeClass('inactive').addClass('active'); 55 $body.addClass('sidebar-horizontal'); 56 } else { 57 $sidebar.removeClass('active inactive'); 58 $body.removeClass('sidebar-horizontal'); 59 } 60 } catch (error) { 61 // Fallback en cas d'erreur 62 console.log('Responsive sidebar fallback'); 63 } 64 } 65 66 // Sidebar toggle functionality 67 function toggleSidebar(side) { 68 if (side !== 'left' && side !== 'right') return false; 69 70 const $rightSidebar = $('#sidebar-right'); 71 const $leftSidebar = $('#sidebar'); 72 const $content = $('#content'); 73 let openSidebarsCount = 0; 74 75 // Toggle sidebar 76 if (side === 'left') { 77 $rightSidebar.toggleClass('i'); 78 } 79 80 if (!$rightSidebar.hasClass('collapsed')) { 81 openSidebarsCount += 1; 82 } 83 } 84 85 // Sidebar toggle simple pour mobile 86 function toggleSidebarMobile() { 87 if ($sidebar.hasClass('active')) { 88 $sidebar.removeClass('active'); 89 } else { 90 $sidebar.addClass('active'); 91 } 92 } 93 94 95 96 // Handle sidebar toggle clicks - Version simplifiée pour Safari iPad 97 $sidebarToggle.on('click', function(e) { 98 e.preventDefault(); 99 e.stopPropagation(); 100 101 try { 102 const windowWidth = window.innerWidth || $window.width() || document.documentElement.clientWidth || 1024; 103 104 if (windowWidth <= 799) { 105 // Mode horizontal : toggle simple 106 if ($sidebar.hasClass('active')) { 107 $sidebar.removeClass('active'); 108 } else { 109 $sidebar.addClass('active'); 110 } 111 } else { 112 // Desktop behavior 113 if ($sidebar.hasClass('inactive')) { 114 $sidebar.removeClass('inactive'); 115 } else { 116 $sidebar.addClass('inactive'); 117 } 118 } 119 } catch (error) { 120 // Fallback en cas d'erreur 121 if ($sidebar.hasClass('inactive')) { 122 $sidebar.removeClass('inactive'); 123 } else { 124 $sidebar.addClass('inactive'); 125 } 126 } 127 }); 128 129 // Close sidebar when clicking outside - Version simplifiée 130 $(document).on('click', function(e) { 131 try { 132 const windowWidth = window.innerWidth || $window.width() || document.documentElement.clientWidth || 1024; 133 134 if (windowWidth <= 799) { 135 // Mode horizontal : fermer si clic en dehors 136 if (!$(e.target).closest('#sidebar').length && 137 !$(e.target).closest('.toggle').length) { 138 $sidebar.removeClass('active'); 139 } 140 } 141 } catch (error) { 142 // Fallback en cas d'erreur 143 console.log('Click outside fallback'); 144 } 145 }); 146 147 // Initialisation responsive - Version simplifiée pour Safari iPad 148 function initResponsiveSidebar() { 149 try { 150 handleResponsiveSidebar(); 151 } catch (error) { 152 // Fallback en cas d'erreur 153 console.log('Init responsive fallback'); 154 } 155 } 156 157 // Initialize on document ready 158 $(document).ready(function() { 159 initResponsiveSidebar(); 160 }); 161 162 // Accessibilité simple pour Safari iPad 163 $sidebarToggle.attr('aria-label', 'Toggle Sidebar'); 164 165 // Bind sidebar toggle 166 $('.toggle-sidebar-right').on('click', () => { 167 toggleSidebar('right'); 168 return false;
169 }); 170 171 // Initialize modal if necessary 172 const intro = $.cookie('intro'); 173 if (intro !== '1') { 174 // const myModal = new bootstrap.Modal(document.getElementById('modantec'), { keyboard: true }); 175 // myModal.show(); 176 177 const date = new Date(); 178 date.setTime(date.getTime() + 500 * 60 * 1000); 179 $.cookie('intro', '1', { expires: date, path: '/' }); 180 } 181 182 // AJAX example for loading news 183 $.ajax({ 184 type: 'GET', 185 url: '/actu/news', 186 timeout: 3000, 187 success: (data) => $('#zone').html(data), 188 error: () => $('#zone').html('Cette requête AJAX n\'a pas abouti'), 189 }); 190 191 // Initialize tabs 192 $('#tabs').tabs(); 193 194 // Classe utilitaire (ex. sonore.phtml) â les sous-menus sont gérés par Bootstrap (data-bs-toggle), 195 // pas par jQuery : un handler manuel + preventDefault annulait ou doublait lâouverture (sous-menus invisibles). 196 function initMobileMenu() { 197 if ($window.width() <= 1280) { 198 $sidebar.addClass('mobile-sidebar'); 199 } else { 200 $sidebar.removeClass('mobile-sidebar'); 201 } 202 } 203 204 // Initialize mobile menu on load and resize 205 initMobileMenu(); 206 $window.on('resize', initMobileMenu); 207 208 // Add touch support for mobile devices 209 if ('ontouchstart' in window) { 210 $sidebar.addClass('touch-device'); 211 212 // Add touch feedback 213 $('.nav-item a, .dropdown-item').on('touchstart', function() { 214 $(this).addClass('touch-active'); 215 }).on('touchend touchcancel', function() { 216 $(this).removeClass('touch-active'); 217 }); 218 } 219 220 // Performance optimization: debounce scroll events 221 let scrollTimeout; 222 $window.on('scroll', function() { 223 clearTimeout(scrollTimeout); 224 scrollTimeout = setTimeout(() => { 225 // Handle scroll-based behaviors here 226 }, 100); 227 }); 228 229 // Accessibility improvements (WCAG 2.2 AA) 230 $sidebarToggle.attr('aria-label', 'Toggle navigation menu'); 231 $sidebarToggle.attr('aria-controls', 'sidebar'); 232 $sidebarToggle.attr('aria-expanded', 'false'); 233 234 $sidebarToggle.on('click', function() { 235 window.setTimeout(function () { 236 const width = window.innerWidth || $window.width() || 1024; 237 let isExpanded; 238 if (width <= 799) { 239 isExpanded = $sidebar.hasClass('active'); 240 } else { 241 isExpanded = !$sidebar.hasClass('inactive'); 242 } 243 $sidebarToggle.attr('aria-expanded', isExpanded.toString()); 244 }, 0); 245 }); 246 247 // Fermeture clavier du menu (mobile / tablette) 248 $(document).on('keydown', function (event) { 249 if (event.key !== 'Escape') { 250 return; 251 } 252 const width = window.innerWidth || $window.width() || 1024; 253 if (width <= 799 && $sidebar.hasClass('active')) { 254 $sidebar.removeClass('active'); 255 $sidebarToggle.attr('aria-expanded', 'false'); 256 if ($sidebarToggle.length) { 257 $sidebarToggle.trigger('focus'); 258 } 259 } 260 }); 261 262})(jQuery); 263
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.