1var cmsCommon = { 2 mobile: 767, /* surchargeable localement */ 3 tablette: 1024, /* surchargeable localement */ 4 5 forceSameHeightOnMobile: false, 6 7 focusable: null, 8 9 firstTimeMenuChangeBig: true, 10 firstTimeMenuChangeSmall: true, 11 12 initMenu: function(menuChange, $button) { 13 // Menu principal 14 $('#menu') 15 .on('focus', 'a.jump', function() { 16 // on ferme le niveau 2 17 $('.sousMenuFermer', $(this).closest('.sousMenu')).trigger('click', [true]); 18 }); 19 $(window).on('load resize orientationchange', function() { 20 if (cmsCommon.firstTimeMenuChangeBig && $(window).width() > menuChange) { 21 cmsCommon.firstTimeMenuChangeSmall = true; 22 cmsCommon.firstTimeMenuChangeBig = false; 23 $('#menu').removeAttr('aria-hidden').show().off('keydown.aria.' + $button.attr('id')); 24 $button.attr('aria-expanded', 'true'); 25 $('body').off('click.aria.' + $button.attr('id')); 26 if (typeof webpublic.triggerMenuBig === "function") { 27 webpublic.triggerMenuBig(); 28 } 29 } else if (cmsCommon.firstTimeMenuChangeSmall && $(window).width() <= menuChange) { 30 cmsCommon.firstTimeMenuChangeSmall = false; 31 cmsCommon.firstTimeMenuChangeBig = true; 32 if ($button.is('[aria-expanded="true"]')) { 33 $button.trigger('click', [true]); 34 } 35 if (typeof webpublic.triggerMenuSmall === "function") { 36 webpublic.triggerMenuSmall(); 37 } 38 } 39 }); 40 }, 41 isOnScreen: function($elem) { 42 const viewport = {}; 43 viewport.top = $(window).scrollTop(); 44 viewport.bottom = viewport.top + $(window).height(); 45 const bounds = {}; 46 bounds.top = $elem.offset().top; 47 bounds.bottom = bounds.top + $elem.outerHeight(); 48 return ((bounds.top <= viewport.bottom) && (bounds.bottom >= viewport.top)); 49 }, 50 friwall: { 51 gutterX: 20, 52 gutterY: 20, 53 init: function($root, _cellW) { 54 var cellW = _cellW ? _cellW : 280; 55 var _f = new freewall($root); 56 _f.reset({ 57 selector: '> li', 58 animate: false, 59 cellW: cellW, 60 cellH: 'auto', 61 gutterX: cmsCommon.friwall.gutterX, 62 gutterY: cmsCommon.friwall.gutterY, 63 onResize: function() { 64 this.fitWidth(); 65 }, 66 onComplete: function() { 67 if (cmsCommon.focusable) { 68 cmsCommon.focusable.focus(); 69 } 70 } 71 }); 72 $('img', $root).load(function() { 73 _f.fitWidth(); 74 }); 75 _f.fitWidth(); 76 return _f; 77 } 78 }, 79 initListe: function(module, gabarit, friwallOrSameHeight, complement) { 80 /* 81 * xxxYyButton : idtf du <a> 82 * xxxYyContent : idtf du <ul> 83 * ajax.xxx.php : fichier ajax 84 * ou xxx = module et Yy = complement (pour donner un nom unique si 2 fois le module sur une page, optionnel) 85 */ 86 var xxxYy = module; 87 if (complement) { 88 xxxYy += complement; 89 } 90 var $content = $('#' + xxxYy + 'Content'); 91 var $button = $('#' + xxxYy + 'Button'); 92 93 var sameHeight = false; 94 var friwall = false; 95 if (friwallOrSameHeight) { 96 if ($.isNumeric(friwallOrSameHeight)) { 97 friwall = cmsCommon.friwall.init($content, friwallOrSameHeight); 98 } else { 99 sameHeight = true; 100 cmsCommon.sameHeight($(friwallOrSameHeight)); 101 } 102 } 103 $content.attr('aria-live', 'assertive'); 104 $button.attr('aria-controls', xxxYy + 'Content').attr('role', 'button'); 105 $(document).on('click', '#' + xxxYy + 'Button', function(e) { 106 $(this).fadeOut(); 107 var url = SERVER_ROOT + 'include/tpl/' + gabarit + '/ajax.' + module + '.php'; 108 url += $(this).attr('href').substring($(this).attr('href').indexOf('?')); 109 url += '&idtf=' + $('#document').data('idtf'); 110 $.get(url, function(data) { 111 var $cLi = $('li', $(data)); 112 var nb = $('li', $content).length; 113 $content.append($cLi); 114 cmsCommon.focusable = $('li', $content).eq(nb).attr('tabindex', '-1'); 115 if (friwall) { 116 $('img', $cLi).load(function() { 117 friwall.fitWidth(); 118 }); 119 friwall.fitWidth(); 120 } else if (sameHeight) { 121 cmsCommon.sameHeight($content.find(friwallOrSameHeight).slice(nb)); 122 } 123 var $next = $('#' + xxxYy + 'Button', $(data)); 124 if ($next.length) { 125 $button.attr('href', $next.attr('href')).fadeIn(); 126 } else { 127 $button.remove(); 128 } 129 }); 130 e.preventDefault(); 131 }); 132 }, 133 sameHeight: function($selecteur, ignoreIMG) { 134 if (cmsCommon.forceSameHeightOnMobile || ($(window).width() > cmsCommon.mobile)) { 135 var $cIMG = $('img', $selecteur); 136 var _height = 0; 137 if (!ignoreIMG && $cIMG.length) { 138 var $lastImg = $cIMG.last(); 139 if ($lastImg[0].complete) { 140 cmsCommon.sameHeight($selecteur, true); 141 } else { 142 $lastImg.on('load', function() { 143 cmsCommon.sameHeight($selecteur, true); 144 }); 145 } 146 } else { 147 $selecteur.each(function() { 148 if ($(this).outerHeight() > _height) { 149 _height = $(this).outerHeight(); 150 } 151 }); 152 $selecteur.css('min-height', _height); 153 } 154 return _height; 155 } 156 return false;
157 }, 158 getURLParameter: function(sParam, defaultReturn) { 159 var sURLVariables = window.location.search.substring(1).split('&'); 160 for (var i = 0; i < sURLVariables.length; i++) { 161 var sParameterName = sURLVariables[i].split('='); 162 if (sParameterName[0] === sParam) { 163 return sParameterName[1]; 164 } 165 } 166 if (defaultReturn !== undefined) { 167 return defaultReturn; 168 } 169 return false; 170 }, 171 pagination: function (GAB_CODE) { 172 $('.js-ajax-content') 173 .on('click', '.o-pagination-reglette a', function () { 174 const $contenaire = $(this).closest('.js-ajax-content'); 175 const $reglette = $contenaire.find('.o-pagination-reglette'); 176 let url = $reglette.data('url'); 177 url = `${SERVER_ROOT}include/tpl/${GAB_CODE}/${url}`; 178 url += $(this).attr('href').substring($(this).attr('href').indexOf('?')); 179 if (! url.includes('idtf=')) { 180 url += url.includes('?')? '&' : '?'; 181 url += 'idtf=' + $('#document').data('idtf'); 182 } 183 if (! url.includes('mode=')) { 184 url += url.includes('?')? '&' : '?'; 185 url += 'mode=' + $('#document').data('mode'); 186 } 187 $reglette.empty(); 188 if ($contenaire.data(url)) { 189 $contenaire.empty().append($contenaire.data(url)); 190 } else { 191 $.get(url, function (data) { 192 const $html = $(data).html(); 193 $contenaire.data(url, $html); 194 $contenaire.empty().append($html); 195 }); 196 } 197 198 window.history.replaceState({}, '', $(this).attr('href')); 199 const $para = $contenaire.closest('div.paragraphe'); 200 cmsCore.scroll($para, 0, true); 201 $('.o-pagination-nb', $para).attr('tabindex', -1).focus(); 202 document.title = `${document.title.substring(0, document.title.lastIndexOf('- Page'))}- Page ${$(this).data('page')}`; 203 204 return false; 205 }); 206 }, 207};
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.