PageSourceSearch

https://extrasupermercati.it/js/agrom.js

js extrasupermercati.it collected 2026-10-08 22:38:16 UTC 25,112 bytes, 856 lines download raw bytes

1jQuery(document).ready(function(){
2
3	"use strict";
4	
5	// here all ready functions
6	
7    
8	loader();
9	scroll_top();
10	magnific_popup();
11    counter_up();
12    
13    
14
15});
16
17//#############################
18// ---------- LOADER ----------
19//#############################
20
21function loader() {
22   "use strict";
23   setTimeout(function () {
24     $('#loader-wrapper').fadeOut();
25   }, 5000);
26};
27
28//####################################
29// ---------- SCROLLING TOP ----------
30//####################################
31
32function scroll_top(){
33    "use strict";
34	var offset = 300,
35		offset_opacity = 1200,
36		scroll_top_duration = 700,
37		$back_to_top = $('.cd-top');
38
39	$(window).scroll(function(){
40		( $(this).scrollTop() > offset ) ? $back_to_top.addClass('cd-is-visible') : $back_to_top.removeClass('cd-is-visible cd-fade-out');
41		if( $(this).scrollTop() > offset_opacity ) { 
42			$back_to_top.addClass('cd-fade-out');
43		}
44	});
45
46	$back_to_top.on('click', function(event){
47		event.preventDefault();
48		$('body,html').animate({
49			scrollTop: 0 ,
50		 	}, scroll_top_duration
51		);
52	});
53
54};
55
56//#############################
57// ---------- FILTER ----------
58//#############################
59
60"use strict";
61var $container = $('.portfolio-items').isotope('layout');
62
63// filter items on button click
64$('.portfolio-filter').on( 'click', 'a', function filter(e) {
65  e.preventDefault();
66  var filterValue = $(this).attr('data-filter');
67  $container.isotope({ filter: filterValue });
68
69
70  $('.portfolio-filter li').removeClass('active');
71  $(this).closest('li').addClass('active');
72
73});
74
75//#############################
76// ---------- SLIDER ----------
77//#############################
78
79$('.inner-screens').owlCarousel({
80    items: 1,
81    singleItem:true,
82    nav: true,
83    dots: false,
84    loop: true,
85    autoPlay: 3000
86});
87
88
89//#################################
90// ---------- ANIMATIONS ----------
91//#################################
92
93AOS.init({
94  duration: 1300,
95})
96
97//#####################################
98// ---------- GALLERY LOADER ----------
99//#####################################
100
101var $grid = $('.grid').masonry({
102  itemSelector: '.grid-item',
103  percentPosition: true,
104  columnWidth: '.grid-sizer'
105});
106$grid.imagesLoaded().progress( function() {
107  $grid.masonry();
108});
109
110//#####################################
111// ---------- MAGNIFIC POPUP ----------
112//#####################################
113
114function magnific_popup(){
115    
116};
117$('.image-popup-vertical-fit').magnificPopup({
118	type: 'image',
119  mainClass: 'mfp-with-zoom', 
120  gallery:{
121			enabled:true
122		},
123
124  zoom: {
125    enabled: true, 
126
127    duration: 300, // duration of the effect, in milliseconds
128    easing: 'ease-in-out', // CSS transition easing function
129
130    opener: function(openerElement) {
131
132      return openerElement.is('img') ? openerElement : openerElement.find('img');
133  }
134}
135
136});
137
138//##################################
139// ---------- VIDEO POPUP ----------
140//##################################
141
142function video_popup(){
143 };   
144    
145  var $btnLoadMore = $(
146    '<div class="btn-wrapper text-center"><a href="#" class="btn load-more">Load More</a></div>'
147  );
148  var items = $(".youtube-popup[data-listnum]");
149  var count = items.length;
150  var slice = 2;
151  var current = 0;
152
153  if (items.length > slice) {
154    //bind load more event
155    $btnLoadMore.on("click", function(e) {
156      e.preventDefault();
157      loadMoreNews();
158    });
159    //append load more button
160    items.closest(".salvattore-grid").after($btnLoadMore);
161  }
162
163  function getItem(listnum) {
164    return items
165        .filter(function(index) {
166          if ($(this).attr("data-listnum") == listnum) {
167            return true;
168          }
169        });
170  }
171  
172  function loadMoreNews() {
173    var end = current + slice;
174    if (end >= count) {
175      end = count;
176      $btnLoadMore.hide();
177    }
178    while (current < end) {
179      var listnum = current + 1; //data-listnum : 1-based
180      var item = getItem(listnum);
181      if (item) {
182        item.fadeIn();
183      }
184      current++;
185    }
186  }
187
188  //youtube popup
189  $(".popup-youtube").magnificPopup({
190    type: "iframe",
191    removalDelay: 160,
192    preloader: false,
193    fixedContentPos: false,
194    iframe: {
195      markup:
196        '<div class="mfp-iframe-scaler">' +
197          '<div class="mfp-close"></div>' +
198          '<iframe class="mfp-iframe" frameborder="0" allowfullscreen></iframe>' +
199          "</div>",
200      patterns: {
201        youtube: {
202          index: "youtube.com/",
203          id: "v=",
204          src: "//www.youtube.com/embed/%id%?autoplay=1&rel=0&showinfo=0"
205        }
206      },
207      srcAction: "iframe_src"
208    }
209  });
210
211  //init load
212  loadMoreNews();
213
214//################################
215// ---------- TEAM ----------
216//################################
217
218"use strict";
219$('.team-carousel').slick({
220  dots: true,
221	prevArrow: $('.prev'),
222	nextArrow: $('.next'),
223  infinite: false,
224  speed: 300,
225  slidesToShow: 3,
226  slidesToScroll: 1,
227  responsive: [
228    {
229      breakpoint: 1024,
230      settings: {
231        slidesToShow: 1,
232        slidesToScroll: 1,
233        infinite: true,
234        dots: true
235      }
236    },
237    {
238      breakpoint: 768,
239      settings: {
240        slidesToShow: 1,
241        slidesToScroll: 2
242      }
243    },
244    {
245      breakpoint: 480,
246      settings: {
247        slidesToShow: 1,
248        slidesToScroll: 1
249      }
250    }
251    // You can unslick at a given breakpoint now by adding:
252    // settings: "unslick"
253    // instead of a settings object
254  ]
255});
256
257//################################
258// ---------- CUSTOMERS ----------
259//################################
260
261$(document).ready(function(){
262    $('.customer-logos').slick({
263        slidesToShow: 6,
264        slidesToScroll: 1,
265        autoplay: true,
266        autoplaySpeed: 1500,
267        arrows: false,
268        dots: false,
269        pauseOnHover: false,
270        responsive: [{
271            breakpoint: 768,
272            settings: {
273                slidesToShow: 4
274            }
275        }, {
276            breakpoint: 520,
277            settings: {
278                slidesToShow: 3
279            }
280        }]
281    });
282});
283
284//################################
285// ---------- ACCORDION ----------
286//################################
287
288function accordion(){
289};
290    $('.accordion > li:eq(0) a').addClass('active').next().slideDown();
291
292    $('.accordion a').click(function(j) {
293        var dropDown = $(this).closest('li').find('p');
294
295        $(this).closest('.accordion').find('p').not(dropDown).slideUp();
296
297        if ($(this).hasClass('active')) {
298            $(this).removeClass('active');
299        } else {
300            $(this).closest('.accordion').find('a.active').removeClass('active');
301            $(this).addClass('active');
302        }
303
304        dropDown.stop(false, true).slideToggle();
305
306        j.preventDefault();
307    });
308(jQuery)
309
310
311//##############################
312// ---------- COUNTER ----------
313//##############################
314
315"use strict";
316jQuery(document).ready(function ($) {
317    $('.counter').counterUp({
318        delay: 10,
319        time: 1000
320    });
321});
322
323//#################################
324// ---------- COUNTER UP ----------
325//#################################
326
327function counter_up(){
328    
329};
330    "use strict";
331
332    $.fn.counterUp = function (options) {
333
334        // Defaults
335        var settings = $.extend({
336                'time': 400,
337                'delay': 10,
338                'offset': 100,
339                'beginAt': 0,
340                'formatter': false,
341                'context': 'window',
342                callback: function () {
343                }
344            }, options),
345            s;
346
347        return this.each(function () {
348
349            // Store the object
350            var $this = $(this),
351                counter = {
352                    time: $(this).data('counterup-time') || settings.time,
353                    delay: $(this).data('counterup-delay') || settings.delay,
354                    offset: $(this).data('counterup-offset') || settings.offset,
355                    beginAt: $(this).data('counterup-beginat') || settings.beginAt,
356                    context: $(this).data('counterup-context') || settings.context
357                };
358
359            var counterUpper = function () {
360                var nums = [];
361                var divisions = counter.time / counter.delay;
362                var num = $this.attr('data-num') ? $this.attr('data-num') : $this.text();
363                var isComma = /[0-9]+,[0-9]+/.test(num);
364                num = num.replace(/,/g, '');
365                var decimalPlaces = (num.split('.')[1] || []).length;
366                if (counter.beginAt > num)
367                    counter.beginAt = num;
368
369                var isTime = /[0-9]+:[0-9]+:[0-9]+/.test(num);
370
371                // Convert time to total seconds
372                if (isTime) {
373                    var times = num.split(':'),
374                        m = 1;
375                    s = 0;
376                    while (times.length > 0) {
377                        s += m * parseInt(times.pop(), 10);
378                        m *= 60;
379                    }
380                }
381
382                // Generate list of incremental numbers to display
383                for (var i = divisions; i >= counter.beginAt / num * divisions; i--) {
384
385                    var newNum = parseFloat(num / divisions * i).toFixed(decimalPlaces);
386
387                    // Add incremental seconds and convert back to time
388                    if (isTime) {
389                        newNum = parseInt(s / divisions * i);
390                        var hours = parseInt(newNum / 3600) % 24;
391                        var minutes = parseInt(newNum / 60) % 60;
392                        var seconds = parseInt(newNum % 60, 10);
393                        newNum = (hours < 10 ? "0" + hours : hours) + ":" + (minutes < 10 ? "0" + minutes : minutes) + ":" + (seconds < 10 ? "0" + seconds : seconds);
394                    }
395
396                    // Preserve commas if input had commas
397                    if (isComma) {
398                        while (/(\d+)(\d{3})/.test(newNum.toString())) {
399                            newNum = newNum.toString().replace(/(\d+)(\d{3})/, '$1' + ',' + '$2');
400                        }
401                    }
402                    if (settings.formatter) {
403                        newNum = settings.formatter.call(this, newNum);
404                    }
405                    nums.unshift(newNum);
406                }
407
408                $this.data('counterup-nums', nums);
409                $this.text(counter.beginAt);
410
411                // Updates the number until we're done
412                var f = function () {
413                    if (!$this.data('counterup-nums')) {
414                        settings.callback.call(this);
415                        return;
416                    }
417                    $this.html($this.data('counterup-nums').shift());
418                    if ($this.data('counterup-nums').length) {
419                        setTimeout($this.data('counterup-func'), counter.delay);
420                    } else {
421                        $this.data('counterup-nums', null);
422                        $this.data('counterup-func', null);
423                        settings.callback.call(this);
424                    }
425                };
426                $this.data('counterup-func', f);
427
428                // Start the count up
429                setTimeout($this.data('counterup-func'), counter.delay);
430            };
431
432            // Perform counts when the element gets into view
433            $this.waypoint(function (direction) {
434                counterUpper();
435                this.destroy(); //-- Waypoint 3.0 version of triggerOnce
436            }, {offset: counter.offset + "%", context: counter.context});
437        });
438
439    };
440
441(jQuery);
442
443
444//###################################
445// ---------- CONTACT FORM ----------
446//###################################
447
448"use strict";
449$(function () {
450
451    $('#contact-form').validator();
452
453    $('#contact-form').on('submit', function (e) {
454        if (!e.isDefaultPrevented()) {
455            var url = "contact.php";
456
457            $.ajax({
458                type: "POST",
459                url: url,
460                data: $(this).serialize(),
461                success: function (data)
462                {
463                    var messageAlert = 'alert-' + data.type;
464                    var messageText = data.message;
465
466                    var alertBox = '<div class="alert ' + messageAlert + ' alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + messageText + '</div>';
467                    if (messageAlert && messageText) {
468                        $('#contact-form').find('.messages').html(alertBox);
469                        $('#contact-form')[0].reset();
470                    }
471                }
472            });
473            return false;
474        }
475    })
476});
477
478
479"use strict";
480+function ($) {
481
482  // VALIDATOR CLASS DEFINITION
483  // ==========================
484
485  function getValue($el) {
486    return $el.is('[type="checkbox"]') ? $el.prop('checked')                                     :
487           $el.is('[type="radio"]')    ? !!$('[name="' + $el.attr('name') + '"]:checked').length :
488                                         $el.val()
489  }
490
491  var Validator = function (element, options) {
492    this.options    = options
493    this.validators = $.extend({}, Validator.VALIDATORS, options.custom)
494    this.$element   = $(element)
495    this.$btn       = $('button[type="submit"], input[type="submit"]')
496                        .filter('[form="' + this.$element.attr('id') + '"]')
497                        .add(this.$element.find('input[type="submit"], button[type="submit"]'))
498
499    this.update()
500
501    this.$element.on('input.bs.validator change.bs.validator focusout.bs.validator', $.proxy(this.onInput, this))
502    this.$element.on('submit.bs.validator', $.proxy(this.onSubmit, this))
503    this.$element.on('reset.bs.validator', $.proxy(this.reset, this))
504
505    this.$element.find('[data-match]').each(function () {
506      var $this  = $(this)
507      var target = $this.data('match')
508
509      $(target).on('input.bs.validator', function (e) {
510        getValue($this) && $this.trigger('input.bs.validator')
511      })
512    })
513
514    this.$inputs.filter(function () { return getValue($(this)) }).trigger('focusout')
515
516    this.$element.attr('novalidate', true) // disable automatic native validation
517    this.toggleSubmit()
518  }
519
520  Validator.VERSION = '0.11.5'
521
522  Validator.INPUT_SELECTOR = ':input:not([type="hidden"], [type="submit"], [type="reset"], button)'
523
524  Validator.FOCUS_OFFSET = 20
525
526  Validator.DEFAULTS = {
527    delay: 500,
528    html: false,
529    disable: true,
530    focus: true,
531    custom: {},
532    errors: {
533      match: 'Does not match',
534      minlength: 'Not long enough'
535    },
536    feedback: {
537      success: 'glyphicon-ok',
538      error: 'glyphicon-remove'
539    }
540  }
541
542  Validator.VALIDATORS = {
543    'native': function ($el) {
544      var el = $el[0]
545      if (el.checkValidity) {
546        return !el.checkValidity() && !el.validity.valid && (el.validationMessage || "error!")
547      }
548    },
549    'match': function ($el) {
550      var target = $el.data('match')
551      return $el.val() !== $(target).val() && Validator.DEFAULTS.errors.match
552    },
553    'minlength': function ($el) {
554      var minlength = $el.data('minlength')
555      return $el.val().length < minlength && Validator.DEFAULTS.errors.minlength
556    }
557  }
558
559  Validator.prototype.update = function () {
560    this.$inputs = this.$element.find(Validator.INPUT_SELECTOR)
561      .add(this.$element.find('[data-validate="true"]'))
562      .not(this.$element.find('[data-validate="false"]'))
563
564    return this
565  }
566
567  Validator.prototype.onInput = function (e) {
568    var self        = this
569    var $el         = $(e.target)
570    var deferErrors = e.type !== 'focusout'
571
572    if (!this.$inputs.is($el)) return
573
574    this.validateInput($el, deferErrors).done(function () {
575      self.toggleSubmit()
576    })
577  }
578
579  Validator.prototype.validateInput = function ($el, deferErrors) {
580    var value      = getValue($el)
581    var prevErrors = $el.data('bs.validator.errors')
582    var errors
583
vendor: 8,564 bytes, lines 584-856
584    if ($el.is('[type="radio"]')) $el = this.$element.find('input[name="' + $el.attr('name') + '"]')
585
586    var e = $.Event('validate.bs.validator', {relatedTarget: $el[0]})
587    this.$element.trigger(e)
588    if (e.isDefaultPrevented()) return
589
590    var self = this
591
592    return this.runValidators($el).done(function (errors) {
593      $el.data('bs.validator.errors', errors)
594
595      errors.length
596        ? deferErrors ? self.defer($el, self.showErrors) : self.showErrors($el)
597        : self.clearErrors($el)
598
599      if (!prevErrors || errors.toString() !== prevErrors.toString()) {
600        e = errors.length
601          ? $.Event('invalid.bs.validator', {relatedTarget: $el[0], detail: errors})
602          : $.Event('valid.bs.validator', {relatedTarget: $el[0], detail: prevErrors})
603
604        self.$element.trigger(e)
605      }
606
607      self.toggleSubmit()
608
609      self.$element.trigger($.Event('validated.bs.validator', {relatedTarget: $el[0]}))
610    })
611  }
612
613
614  Validator.prototype.runValidators = function ($el) {
615    var errors   = []
616    var deferred = $.Deferred()
617
618    $el.data('bs.validator.deferred') && $el.data('bs.validator.deferred').reject()
619    $el.data('bs.validator.deferred', deferred)
620
621    function getValidatorSpecificError(key) {
622      return $el.data(key + '-error')
623    }
624
625    function getValidityStateError() {
626      var validity = $el[0].validity
627      return validity.typeMismatch    ? $el.data('type-error')
628           : validity.patternMismatch ? $el.data('pattern-error')
629           : validity.stepMismatch    ? $el.data('step-error')
630           : validity.rangeOverflow   ? $el.data('max-error')
631           : validity.rangeUnderflow  ? $el.data('min-error')
632           : validity.valueMissing    ? $el.data('required-error')
633           :                            null
634    }
635
636    function getGenericError() {
637      return $el.data('error')
638    }
639
640    function getErrorMessage(key) {
641      return getValidatorSpecificError(key)
642          || getValidityStateError()
643          || getGenericError()
644    }
645
646    $.each(this.validators, $.proxy(function (key, validator) {
647      var error = null
648      if ((getValue($el) || $el.attr('required')) &&
649          ($el.data(key) || key == 'native') &&
650          (error = validator.call(this, $el))) {
651         error = getErrorMessage(key) || error
652        !~errors.indexOf(error) && errors.push(error)
653      }
654    }, this))
655
656    if (!errors.length && getValue($el) && $el.data('remote')) {
657      this.defer($el, function () {
658        var data = {}
659        data[$el.attr('name')] = getValue($el)
660        $.get($el.data('remote'), data)
661          .fail(function (jqXHR, textStatus, error) { errors.push(getErrorMessage('remote') || error) })
662          .always(function () { deferred.resolve(errors)})
663      })
664    } else deferred.resolve(errors)
665
666    return deferred.promise()
667  }
668
669  Validator.prototype.validate = function () {
670    var self = this
671
672    $.when(this.$inputs.map(function (el) {
673      return self.validateInput($(this), false)
674    })).then(function () {
675      self.toggleSubmit()
676      self.focusError()
677    })
678
679    return this
680  }
681
682  Validator.prototype.focusError = function () {
683    if (!this.options.focus) return
684
685    var $input = this.$element.find(".has-error:first :input")
686    if ($input.length === 0) return
687
688    $('html, body').animate({scrollTop: $input.offset().top - Validator.FOCUS_OFFSET}, 250)
689    $input.focus()
690  }
691
692  Validator.prototype.showErrors = function ($el) {
693    var method = this.options.html ? 'html' : 'text'
694    var errors = $el.data('bs.validator.errors')
695    var $group = $el.closest('.form-group')
696    var $block = $group.find('.help-block.with-errors')
697    var $feedback = $group.find('.form-control-feedback')
698
699    if (!errors.length) return
700
701    errors = $('<ul/>')
702      .addClass('list-unstyled')
703      .append($.map(errors, function (error) { return $('<li/>')[method](error) }))
704
705    $block.data('bs.validator.originalContent') === undefined && $block.data('bs.validator.originalContent', $block.html())
706    $block.empty().append(errors)
707    $group.addClass('has-error has-danger')
708
709    $group.hasClass('has-feedback')
710      && $feedback.removeClass(this.options.feedback.success)
711      && $feedback.addClass(this.options.feedback.error)
712      && $group.removeClass('has-success')
713  }
714
715  Validator.prototype.clearErrors = function ($el) {
716    var $group = $el.closest('.form-group')
717    var $block = $group.find('.help-block.with-errors')
718    var $feedback = $group.find('.form-control-feedback')
719
720    $block.html($block.data('bs.validator.originalContent'))
721    $group.removeClass('has-error has-danger has-success')
722
723    $group.hasClass('has-feedback')
724      && $feedback.removeClass(this.options.feedback.error)
725      && $feedback.removeClass(this.options.feedback.success)
726      && getValue($el)
727      && $feedback.addClass(this.options.feedback.success)
728      && $group.addClass('has-success')
729  }
730
731  Validator.prototype.hasErrors = function () {
732    function fieldErrors() {
733      return !!($(this).data('bs.validator.errors') || []).length
734    }
735
736    return !!this.$inputs.filter(fieldErrors).length
737  }
738
739  Validator.prototype.isIncomplete = function () {
740    function fieldIncomplete() {
741      var value = getValue($(this))
742      return !(typeof value == "string" ? $.trim(value) : value)
743    }
744
745    return !!this.$inputs.filter('[required]').filter(fieldIncomplete).length
746  }
747
748  Validator.prototype.onSubmit = function (e) {
749    this.validate()
750    if (this.isIncomplete() || this.hasErrors()) e.preventDefault()
751  }
752
753  Validator.prototype.toggleSubmit = function () {
754    if (!this.options.disable) return
755    this.$btn.toggleClass('disabled', this.isIncomplete() || this.hasErrors())
756  }
757
758  Validator.prototype.defer = function ($el, callback) {
759    callback = $.proxy(callback, this, $el)
760    if (!this.options.delay) return callback()
761    window.clearTimeout($el.data('bs.validator.timeout'))
762    $el.data('bs.validator.timeout', window.setTimeout(callback, this.options.delay))
763  }
764
765  Validator.prototype.reset = function () {
766    this.$element.find('.form-control-feedback')
767      .removeClass(this.options.feedback.error)
768      .removeClass(this.options.feedback.success)
769
770    this.$inputs
771      .removeData(['bs.validator.errors', 'bs.validator.deferred'])
772      .each(function () {
773        var $this = $(this)
774        var timeout = $this.data('bs.validator.timeout')
775        window.clearTimeout(timeout) && $this.removeData('bs.validator.timeout')
776      })
777
778    this.$element.find('.help-block.with-errors')
779      .each(function () {
780        var $this = $(this)
781        var originalContent = $this.data('bs.validator.originalContent')
782
783        $this
784          .removeData('bs.validator.originalContent')
785          .html(originalContent)
786      })
787
788    this.$btn.removeClass('disabled')
789
790    this.$element.find('.has-error, .has-danger, .has-success').removeClass('has-error has-danger has-success')
791
792    return this
793  }
794
795  Validator.prototype.destroy = function () {
796    this.reset()
797
798    this.$element
799      .removeAttr('novalidate')
800      .removeData('bs.validator')
801      .off('.bs.validator')
802
803    this.$inputs
804      .off('.bs.validator')
805
806    this.options    = null
807    this.validators = null
808    this.$element   = null
809    this.$btn       = null
810
811    return this
812  }
813
814  // VALIDATOR PLUGIN DEFINITION
815  // ===========================
816
817
818  function Plugin(option) {
819    return this.each(function () {
820      var $this   = $(this)
821      var options = $.extend({}, Validator.DEFAULTS, $this.data(), typeof option == 'object' && option)
822      var data    = $this.data('bs.validator')
823
824      if (!data && option == 'destroy') return
825      if (!data) $this.data('bs.validator', (data = new Validator(this, options)))
826      if (typeof option == 'string') data[option]()
827    })
828  }
829
830  var old = $.fn.validator
831
832  $.fn.validator             = Plugin
833  $.fn.validator.Constructor = Validator
834
835
836  // VALIDATOR NO CONFLICT
837  // =====================
838
839  $.fn.validator.noConflict = function () {
840    $.fn.validator = old
841    return this
842  }
843
844
845  // VALIDATOR DATA-API
846  // ==================
847
848  $(window).on('load', function () {
849    $('form[data-toggle="validator"]').each(function () {
850      var $form = $(this)
851      Plugin.call($form, $form.data())
852    })
853  })
854
855}(jQuery);
856

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.