PageSourceSearch

https://www.marcheauxhuitres-cancale.com/media/astroid/assets/vendor/astroid/js/script.js?v=2.5.4

js marcheauxhuitres-cancale.com collected 2026-10-02 20:57:34 UTC 10,724 bytes, 301 lines download raw bytes

1(function ($) {
2   // Functions
3   var lastScrollTop = 0;
4   var windowloaded = false;
5   var initLastScrollTop = function () {
6      var st = $(window).scrollTop();
7      lastScrollTop = st;
8   };
9   var isScrollDown = function () {
10      var st = $(window).scrollTop();
11      return (st > lastScrollTop);
12   };
13   var initMobileMenu = function () {
14      if (!$('.astroid-mobile-menu').length) {
15         return;
16      }
17      $('.astroid-mobile-menu').astroidMobileMenu();
18      $('.astroid-mobile-menu').removeClass('d-none');
19   };
20   var initOffcanvasMenu = function () {
21      if (!$('#astroid-offcanvas').length) {
22         return;
23      }
24      $('#astroid-offcanvas').find('ul.menu').astroidMobileMenu();
25   };
26   var initSidebarMenu = function () {
27      if (!$('.astroid-sidebar-menu').length) {
28         return;
29      }
30      $('.astroid-sidebar-menu .nav-item-caret').click(function () {
31         $(this).parent('li').siblings('li').children('ul').slideUp();
32         $(this).parent('li').siblings('li').children('.nav-item-caret').removeClass('open');
33         $(this).toggleClass('open');
34         $(this).siblings('ul').slideToggle();
35      });
36      $('.astroid-sidebar-collapsable').click(function () {
37         $('#astroid-header').toggleClass('expanded');
38      });
39   };
40   var initDisplay = function () {
41      setTimeout(function () {
42         $('.d-init').removeClass('d-none');
43      }, 100);
44   };
45   var initBackToTop = function () {
46      $(window).scroll(function () {
47         if ($(this).scrollTop() >= 200) { // If page is scrolled more than 200px
48            $('#astroid-backtotop').fadeIn(200); // Fade in the arrow
49         } else {
50            $('#astroid-backtotop').fadeOut(200); // Else fade out the arrow
51         }
52      });
53      $('#astroid-backtotop').click(function () { // When arrow is clicked
54         $('body,html').animate({
55            scrollTop: 0 // Scroll to top of body
56         }, 500);
57      });
58   };
59
60   var initHeader = function () {
61      var stickyHeader = $('#astroid-sticky-header');
62
63      var _header = $('header');
64      if (!_header.length) {
65         return false;
66      }
67
68      var _headerTop = _header.offset().top;
69      var _headerHeight = _header.height();
70      var _headerBottom = _headerTop + _headerHeight;
71
72      if (!stickyHeader.length) {
73         return;
74      }
75
76      var _winScroll = $(window).scrollTop();
77
78      var _breakpoint = deviceBreakpoint(true);
79
80      if (_breakpoint == 'xl' || _breakpoint == 'lg') {
81         if (stickyHeader.hasClass('header-sticky-desktop') && (_winScroll > _headerBottom)) {
82            stickyHeader.removeClass('d-none');
83            stickyHeader.addClass('d-flex');
84         } else if (stickyHeader.hasClass('header-stickyonscroll-desktop') && (_winScroll > _headerBottom) && !isScrollDown()) {
85            stickyHeader.removeClass('d-none');
86            stickyHeader.addClass('d-flex');
87         } else {
88            stickyHeader.removeClass('d-flex');
89            stickyHeader.addClass('d-none');
90         }
91      } else if (_breakpoint == 'sm' || _breakpoint == 'md') {
92         if (stickyHeader.hasClass('header-static-tablet')) {
93            return;
94         }
95         if (stickyHeader.hasClass('header-sticky-tablet') && (_winScroll > _headerBottom)) {
96            stickyHeader.removeClass('d-none');
97            stickyHeader.addClass('d-flex');
98         } else if (stickyHeader.hasClass('header-stickyonscroll-tablet') && (_winScroll > _headerBottom) && !isScrollDown()) {
99            stickyHeader.addClass('d-flex');
100            stickyHeader.removeClass('d-none');
101         } else {
102            stickyHeader.addClass('d-none');
103            stickyHeader.removeClass('d-flex');
104         }
105      } else {
106         if (stickyHeader.hasClass('header-static-mobile')) {
107            return;
108         }
109         if (stickyHeader.hasClass('header-sticky-mobile') && (_winScroll > _headerBottom)) {
110            stickyHeader.addClass('d-flex');
111            stickyHeader.removeClass('d-none');
112         } else if (stickyHeader.hasClass('header-stickyonscroll-mobile') && (_winScroll > _headerBottom) && !isScrollDown()) {
113            stickyHeader.addClass('d-flex');
114            stickyHeader.removeClass('d-none');
115         } else {
116            stickyHeader.addClass('d-none');
117            stickyHeader.removeClass('d-flex');
118         }
119      }
120   };
121
122   var initEmptyHeaderContent = function () {
123      $('.header-left-section:empty').each(function () {
124         if (!$.trim($(this).html())) {
125            $(this).prop('hidden', true);
126         }
127      });
128
129      $('.header-center-section:empty').each(function () {
130         if (!$.trim($(this).html())) {
131            $(this).prop('hidden', true);
132         }
133      });
134
135      $('.header-right-section:empty').each(function () {
136         if (!$.trim($(this).html())) {
137            $(this).prop('hidden', true);
138         }
139      });
140   };
141
142   var initTooltip = function () {
143      if ($('[data-toggle="tooltip"]').length) {
144         $('[data-toggle="tooltip"]').tooltip();
145      }
146   };
147
148   var initAnimations = function () {
149      var bindAnimation = function () {
150         $('[data-animation]').each(function () {
151            var _animation = $(this).data('animation');
152            var _delay = $(this).data('animation-delay');
153            var _duration = $(this).data('animation-duration');
154            if (_animation != '' && elementInViewport($(this)) && !$(this).hasClass('animation-done')) {
155               if (_delay != '' && _delay != 0 && _delay != '0' && _delay != undefined) {
156                  _delay = parseInt(_delay);
157               } else {
158                  _delay = 0;
159               }
160
161               if (_duration != '' && _duration != 0 && _duration != '0' && _duration != undefined) {
162                  _duration = parseInt(_duration) + 10;
163               } else {
164                  _duration = 1010;
165               }
166
167               var _this = this;
168               $(_this).css('animation-duration', _duration + 'ms');
169               setTimeout(function () {
170                  $(_this).css('visibility', 'visible');
171                  $(_this).addClass('animate');
172                  $(_this).addClass(_animation);
173                  $(_this).addClass('animation-done');
174                  setTimeout(function () {
175                     $(_this).removeClass('animate');
176                     $(_this).addClass('animated');
177                     $(_this).removeClass(_animation);
178                  }, (_duration + _delay));
179               }, _delay);
180            }
181         });
182      };
183
184      $(window).on("scroll", function () {
185         bindAnimation();
186      });
187      bindAnimation();
188   };
189
190   var initProgressBar = function () {
191      $('.progress-bar-viewport-animation').each(function () {
192         var _this = $(this);
193         if (!_this.hasClass('viewport-animation-done') && elementInViewport(_this)) {
194            var _width = _this.data('value');
195            _width = parseInt(_width);
196            _this.css('width', _width + '%');
197         }
198      });
199   }
200
201   var elementInViewport = function (element) {
202      var _this = element;
203      var _this_top = _this.offset().top;
204      return (_this_top <= window.pageYOffset + parseInt(window.innerHeight)) && (_this_top >= window.pageYOffset);
205   };
206
207   var deviceBreakpoint = function (_return) {
208      if ($('.astroid-breakpoints').length == 0) {
209         var _breakpoints = '<div class="astroid-breakpoints d-none"><div class="d-block d-sm-none device-xs"></div><div class="d-none d-sm-block d-md-none device-sm"></div><div class="d-none d-md-block d-lg-none device-md"></div><div class="d-none d-lg-block d-xl-none device-lg"></div><div class="d-none d-xl-block device-xl"></div></div>';
210         $('body').append(_breakpoints);
211      }
212      var _sizes = ['xs', 'sm', 'md', 'lg', 'xl'];
213      var _device = 'undefined';
214      _sizes.forEach(function (_size) {
215         var _visiblity = $('.astroid-breakpoints .device-' + _size).css('display');
216         if (_visiblity == 'block') {
217            _device = _size;
218            return false;
219         }
220      });
221      if (_return) {
222         return _device;
223      } else {
224         $('body').removeClass('astroid-device-xs').removeClass('astroid-device-sm').removeClass('astroid-device-md').removeClass('astroid-device-lg').removeClass('astroid-device-xl');
225         $('body').addClass('astroid-device-' + _device);
226      }
227   };
228
229   var initPreloader = function () {
230      $("#astroid-preloader").removeClass('d-flex').addClass('d-none');
231   };
232
233   // Events
234   var docReady = function () {
235      initDisplay();
236      initMobileMenu();
237      initOffcanvasMenu();
238      initSidebarMenu();
239      //initMegamenu();
240      //initSubmenu();
241      initBackToTop();
242      initHeader();
243      initEmptyHeaderContent();
244      initTooltip();
245      deviceBreakpoint(false);
246   };
247
248   var winLoad = function () {
249      initAnimations();
250      deviceBreakpoint(false);
251      initPreloader();
252      initProgressBar();
253      windowloaded = true;
254   };
255
256   var winResize = function () {
257      deviceBreakpoint(false);
258      initHeader();
259   };
260
261   var winScroll = function () {
262      initHeader();
263      initLastScrollTop();
264      if (windowloaded) {
265         initProgressBar();
266      }
267      deviceBreakpoint(false);
268   };
269
270   $(docReady);
271   $(window).on('load', winLoad);
272   $(window).on('resize', winResize);
273   $(window).on('scroll', winScroll);
274   window.addEventListener("orientationchange", winResize);
275})($ast);
276
277/* 
278 * Add missing Mootools when Bootstrap is loaded
279 * This fix creates dummy implementations for the missing Mootools functions.
280 * It requires that you have jQuery loaded and if you are dealing with Mootools + jQuery is a good idea to add the call just before this javascript code.
281 * This issue shouldn't affect Bootstrap 3 templates but the fix explained here should be compatible with both.
282 */
283(function ($) {
284   $(document).ready(function () {
285      var bootstrapLoaded = (typeof $().tooltip == 'function');
286      var mootoolsLoaded = (typeof MooTools != 'undefined');
287      if (bootstrapLoaded && mootoolsLoaded) {
288         Element.implement({
289            hide: function () {
290               return this;
291            },
292            show: function (v) {
293               return this;
294            },
295            slide: function (v) {
296               return this;
297            }
298         });
299      }
300   });
301})($ast);

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.