PageSourceSearch

https://hautacam.com/bundles/redpill/js/main.js?v=20260924151103_v3.831.0

js hautacam.com collected 2026-09-25 03:45:50 UTC 12,532 bytes, 480 lines download raw bytes

1$(document).ready(function() {
2  /**
3   * Menu collapse on xsmall screen
4   * @param  {[type]} ){                     $(this).next().collapse('toggle');    } [description]
5   * @return {[type]}     [description]
6   */
7  $('.collapse')
8    .collapse({
9      toggle: false,
10    })
11    .prev()
12    .on('click', function() {
13      $(this)
14        .next()
15        .collapse();
16    });
17
18  /**
19   * Skiers count selector ;
20   * add or remove skier item
21   * @param  {[type]} ){ $(this).blur() })    $('.skiers .plus').on('click', function( [description]
22   * @return {[type]}     [description]
23   */
24  $('.nb-skiers').on('focus', function() {
25    $(this).blur();
26  });
27  $('.skiers .plus').on('click', function() {
28    changeNbSkiers('+');
29  });
30  $('.skiers .less').on('click', function() {
31    changeNbSkiers('-');
32  });
33
34  rpDialog();
35
36  $('.social-btn').on('click', function() {
37    var left = screen.width / 2 - 500 / 2;
38    var top = screen.height / 2 - 500 / 2;
39
40    open(
41      $(this).data('href'),
42      '',
43      'scrollbars=1,resizable=1, height=500, width=500, top=' + top + ', left=' + left,
44    );
45    return false;
46  });
47
48  /**
49   * MAIN MENU MULTI LEVEL
50   */
51  $('.main-menu .dropdown-menu')
52    .first()
53    .addClass('menu-forced');
54
55  $('[data-menu-toggle="true"]').each(function() {
56    $(this)
57      .next()
58      .collapse('hide');
59    $(this)
60      .find('i')
61      .removeClass('fa-chevron-circle-down')
62      .addClass('fa-chevron-circle-right');
63  });
64  $('[data-menu-toggle="true"]').on('click', function() {
65    $(this)
66      .parent()
67      .parent()
68      .find('li a[data-menu-toggle="true"]')
69      .not(this)
70      .next()
71      .collapse('hide');
72    $(this)
73      .parent()
74      .parent()
75      .find('li a[data-menu-toggle="true"]')
76      .not(this)
77      .find('i')
78      .removeClass('fa-chevron-circle-down')
79      .addClass('fa-chevron-circle-right');
80    $(this)
81      .next()
82      .collapse('toggle');
83    $(this)
84      .find('i')
85      .toggleClass('fa-chevron-circle-right fa-chevron-circle-down');
86  });
87
88  /**
89   * CAROUSEL CONTROLS
90   */
91  hideCarouselControlIfOneItem();
92
93  /**
94   * VIDEO CAROUSEL
95   */
96  if ($(document).width() > 767) {
97    var $carouselVideo = $('.carouselVideo');
98    if ($carouselVideo.length > 0) {
99      var players = [];
100      if (needCallYoutubeApi) {
101        getAPIYouTube();
102      }
103      window.onYouTubeIframeAPIReady = function() {
104        $carouselVideo.each(function() {
105          var $this = $(this);
106          var id = $this.data('id');
107          var start = $this.data('start');
108          $this.addClass('hide');
109          players[id] = new YT.Player('carouselVideo-player-' + id, {
110            height: '360',
111            width: '640',
112            playerVars: {
113              start: start,
114              controls: 0,
115              fs: 0,
116              iv_load_policy: 3,
117              rel: 0,
118              disablekb: 1,
119              showinfo: 0,
120              autoplay: 0,
121              mute: 1,
122              playlist: id,
123            },
124            videoId: id,
125            events: {
126              onReady: onPlayerReady,
127              onError: onPlayerError,
128            },
129          });
130        });
131      };
132      $('#hcar')
133        .on('slide.bs.carousel', function(e) {
134          var $player = $(e.target).find('.active .carouselVideo');
135          if ($player.length > 0) {
136            players[$player.data('id')].pauseVideo();
137          }
138        })
139        .on('slid.bs.carousel', function(e) {
140          var $player = $(e.target).find('.active .carouselVideo');
141
142          if ($player.length > 0) {
143            players[$player.data('id')].playVideo();
144          }
145        });
146    }
147  }
148
149  /**
150   * Show auto modal for cmsPage
151   */
152  $('.automodal').modal('show');
153  $('.automodal').on('hide.bs.modal', function() {
154    var href = $(this).data('cms-cook');
155    $.ajax({
156      type: 'GET',
157      url: href,
158      data: '',
159      cache: false,
160      success: function() {},
161      error: function() {},
162      complete: function() {},
163    });
164  });
165
166  /**
167   * Initialize all inputs value if not defined
168   */
169  initializeInputAttr();
170});
171
172function changeNbSkiers(operator) {
173  if (operator == '+') {
174    $nb = 1;
175    $action = 'addSkier($baseVal)';
176  } else if (operator == '-') {
177    $nb = -1;
178    $action = 'removeSkier()';
179  }
180  $baseVal = parseInt($('.nb-skiers').val());
181  if ($baseVal > 1 || $nb > 0) {
182    if ($baseVal == 6 && $nb > 0) {
183      $('.age-skiers')
184        .next()
185        .show();
186    } else {
187      $('.age-skiers')
188        .next()
189        .hide();
190      $('.nb-skiers').val($baseVal + $nb);
191      eval($action);
192    }
193  }
194}
195
196function removeSkier() {
197  $('.a-skier')
198    .last()
199    .remove();
200}
201
202function addSkier(baseVal) {
203  $('.a-skier')
204    .last()
205    .after(
206      $('.a-skier')
207        .first()
208        .clone(),
209    );
210  if (baseVal == 5) {
211    $('.age-skiers')
212      .next()
213      .show();
214  }
215}
216
217// Paiement accordion
218$('#paiement-accordion .panel .panel-collapse').on('show.bs.collapse', function() {
219  $('#paiement-accordion  .panel .panel-collapse')
220    .not(this)
221    .collapse('hide');
222});
223
224/**
225 * Used to manage and play with BootStrap Modal
226 *
227 * - Modal is initialized (HTML Created) in Views/Console/Layout [just after block content]
228 *
229 * - One modal is initialized :
230 *     To populate modal with remote url :
231 *         <a
232 *         class="rp-dialog"
233 *         rp-title="Titre de la modal"
234 *         rp-target="{{path('rp_console_translation_text',{ 'entityName':'pickup_site', 'entityId':pickupsite.
234id, 'entityField':'label'}) }}"
235 *         >Link</a>
236 *
237 *      To populate modal with present HTML object :
238 *         <a
239 *         class="rp-dialog"
240 *         rp-object=".rp-contract-addsubcontact"       // <-- Rp object is the jquery selector of the object to put in modal
241 *         rp-title="Nouveau Sous-Contact"
242 *         >Link</a>
243 *
244 *      To execute a function when modal is shown :
245 *         <a
246 *         class="rp-dialog"
247 *         rp-title="Titre de la modal"
248 *         rp-target="{{path('rp_console_translation_text',{ 'entityName':'pickup_site', 'entityId':pickupsite.id, 'entityField':'label'}) }}"
249 *         rp-callback="alertme"                        // <--  function alertme(){ alert('me')}
250 *         >Link</a>
251 *
252 */
253var dialogHref = '';
254var dialogObject = '';
255var dialogModaltitle = '';
256var dialogCallback = '';
257var dialogFooter = '';
258var dialogCallbackParam = '';
259function rpDialog() {
260  $('a.rp-dialog').each(function() {
261    $(this).unbind('click');
262    $(this).on('click', function(e) {
263      if ($(this).hasClass('rp-spinner')) {
264        $spin = $('<i></i>').addClass('fa fa-spin fa-spinner fa-4x');
265        $spinCon = $('<div></div>')
266          .addClass('rp-dialog-spinner text-center')
267          .css('height', $('body').height())
268          .append($spin);
269        $('body')
270          .addClass('blur')
271          .append($spinCon);
272      }
273
274      var dialogHref = $(this).attr('rp-target');
275      var dialogObject = $(this).attr('rp-object');
276      var dialogModaltitle = $(this).attr('rp-title');
277      var dialogCallback = $(this).attr('rp-callback');
278      var dialogCallbackParam = $(this).attr('rp-callback-param');
279      var dialogFooter = $(this).attr('rp-footer');
280      var dialogBackdrop = $(this).attr('rp-backdrop');
281      dialogBackdrop = typeof dialogBackdrop != 'undefined' ? JSON.parse(dialogBackdrop) : true;
282      var dialogMinHeight = $(this).attr('rp-minheight');
283
284      if (typeof dialogMinHeight != 'undefined') {
285        $('#modal .modal-content').css('min-height', dialogMinHeight);
286      }
287
288      if (typeof dialogFooter != 'undefined') {
289        $('#modal .modal-footer').html('');
290        $('#modal .modal-footer').append(
291          $(dialogFooter)
292            .clone()
293            .show(),
294        );
295        $('body').removeClass('blur');
296        $('.rp-dialog-spinner').remove();
297      }
298      if (typeof dialogObject != 'undefined') {
299        $('#modal .modal-body').html('');
300        $('#modal .modal-body').append(
301          $(dialogObject)
302            .clone()
303            .show(),
304        );
305        $('.modal-title').html(dialogModaltitle);
306        $('#modal').modal({ backdrop: dialogBackdrop });
307        if (typeof dialogCallback != 'undefined') {
308          eval(dialogCallback + '(' + dialogCallbackParam + ');');
309        }
310        $('body').removeClass('blur');
311        $('.rp-dialog-spinner').remove();
312      } else {
313        ajaxModal(
314          dialogHref,
315          dialogBackdrop,
316          dialogCallback,
317          dialogCallbackParam,
318          dialogModaltitle,
319        );
320      }
321    });
322  });
323}
324
325function ajaxModal(
326  dialogHref,
327  dialogBackdrop,
328  dialogCallback,
329  dialogCallbackParam,
330  dialogModaltitle,
331) {
332  $.ajax({
333    type: 'GET',
334    url: dialogHref,
335    data: '',
336    cache: false,
337    success: function(data) {
338      $('#modal .modal-body').empty();
339      $('#modal .modal-body').html(data);
340      $('.modal-title').html(dialogModaltitle);
341      $('#modal').modal({ backdrop: dialogBackdrop });
342    },
343    error: function() {},
344    complete: function() {
345      $('body').removeClass('blur');
346      $('.rp-dialog-spinner').remove();
347      if (typeof dialogCallback != 'undefined') {
348        eval(dialogCallback + '(' + dialogCallbackParam + ');');
349      }
350    },
351  });
352}
353
354function getQuery(q) {
355  return (
356    (window.location.search.match(new RegExp('[?&]' + q + '=([^&]+)')) || [, null])[1] !== null
357  );
358}
359
360$(document).ready(function() {
361  if (getQuery('modal')) {
362    ajaxModal(urlParams.get('modal'));
363  }
364});
365
366function hideCarouselControlIfOneItem() {
367  if ($('#home-carousel .item').length < 2) {
368    $('#home-carousel .carousel-control, #home-carousel .carousel-indicators').hide();
369  }
370}
371
372function getAPIYouTube() {
373  var tag = document.createElement('script');
374
375  tag.src = 'https://www.youtube.com/iframe_api';
376  var firstScriptTag = document.getElementsByTagName('script')[0];
377  firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
378}
379
380function onPlayerReady(event) {
381  event.target.setLoop(true);
382  event.target.playVideo();
383  setTimeout(function() {
384    event.target.getIframe().classList.remove('hide');
385  }, 1000);
386}
387function onPlayerError(event) {
388  var $target = $(event.target.getIframe());
389
390  $target.addClass('hidden');
391  console.error(
392    'youtube iframe API error for id ' + $target.data('id') + ' | code error : ',
393    event.data,
394  );
395}
396
397function targetizedToggle() {
398  $('[data-targetize]').unbind('click');
399  $('[data-targetize]').on('click', function() {
400    $('[data-scorcher="' + $(this).data('targetize') + '"]').toggle();
401    $(this).toggleClass('active');
402  });
403}
404
405/**
406 * Get the last sellable date from initial last period date
407 * according to product duration
408 *
409 * @param duration
410 * @param validTo
411 * @returns {*}
412 */
413function getLastSellableDateFromProductDuration(duration, validTo) {
414  // If duration is null or not defined
415  if (!duration) {
416    return validTo;
417  }
418
419  if (duration >= 1) {
420    duration = duration - 1;
421  }
422
423  // Remove x days to end period and return it
424  return validTo.add(-duration, 'days');
425}
426
427/**
428 *
429 * @param allInputs
430 */
431function settingAttrInputs(allInputs) {
432  $.each(allInputs, function() {
433    $(this).attr('onkeyup', "$(this).attr('value', $(this).val())");
434    if ($(this).val() === '') {
435      $(this).attr('value', '');
436    }
437
438    // if error add class for style input error
439    if ($(this).attr('id') !== undefined) {
440      if (
441        $(this)
442          .parent()
443          .hasClass('has-error') ||
444        $(this)
445          .parent()
446          .parent()
447          .hasClass('has-error')
448      ) {
449        $(this).addClass('input-error');
450      } else {
451        $(this).removeClass('input-error');
452      }
453    }
454  });
455}
456
457/**
458 * Initialize all inputs value if not defined
459 *
460 */
461function initializeInputAttr() {
462  //select all inputs of type text, password or hidden
463  var allInputs = $('input[type=text], input[type=password], input[type=email]');
464  // Initialize attributs onkeyup and value for inputs
465  settingAttrInputs(allInputs);
466
467  // Initialize attribut data-control for input type select
468  var allSelect = $('select');
469  $.each(allSelect, function() {
470    $(this).attr('data-control', 'true');
471  });
472
473  // Initialize attributs onkeyup and value for inputs on modal
474  $('.rp-dialog').click(function() {
475    $('#modal').on('shown.bs.modal', function() {
476      var allInputsModal = $('input[type=text], input[type=password], input[type=email]');
477      settingAttrInputs(allInputsModal);
478    });
479  });
480}

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.