/************************************************************************** GLOBAL VARIABLES **************************************************************************/ var cache = []; var dyn_search; var dim = { ww : $(window).width(), wh : $(window).height(), cacheww : $(window).width(), cachewh : $(window).height()}; window.cookieconsent_options = { message:'Questo sito NON utilizza cookie di profilazione. Sono utilizzati soltanto cookie tecnici e di terze parti legati all’uso di Google Analytics (IP anonimo) e all’eventuale presenza di "Social plugin". Proseguendo la navigazione del sito acconsenti all’uso dei cookie. Per maggiori informazioni leggi l’informativa estesa dove sono specificate le modalità per configurali o disattivarli.', learnMore: 'Informativa estesa', dismiss: 'Chiudi', link: 'http://www.comune.fe.it/index.phtml?id=3177', theme: 'http://www.comune.fe.it/style/cookiepolicy.css' }; (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-12225891-9', 'auto'); ga('set', 'anonymizeIp', true); ga('send', 'pageview'); /************************************************************************** GLOBAL EVENT LISTENERS FUNCTIONS **************************************************************************/ function ready() { dynsearch = new dynamic_search(); $('.slider').slick({ slide: 'li', dots: false, arrows: false, autoplay: true, autoplaySpeed: 10000, speed: 1000, draggable: false, infinite: true, fade: true, //responsive: [{ breakpoint : 520, settings : "unslick" }] }); navigathor(); asideNav(); $('header nav .search > a').click(function(){ $(this).parent().toggleClass('open'); }); /* $('header nav .search > .fields a.button').click(function(e){ e.preventDefault(); location.href = "index.php?id=729&keywords="+$('header nav .search > .fields input').val(); }); */ burgerNav('header nav', 'right'); $(window).scroll(function(){ if($(this).scrollTop() > 90) $('header p a').addClass('moveUp') else $('header p a').removeClass('moveUp') }); // Pulisci codice cataloghi priscilla if (!$('div.priscillaskin').length) { $('section.news article img').attr('style', ''); $('div.priscillacatalog img').attr('style', ''); $('div.priscillacatalog').next('div[style^="clear"]').remove(); $('div.priscillacatalog>div>a').remove(); $('div.priscillacatalog div[style^="clear"]').remove(); $('div.priscillacatalog>div').unwrap().children().unwrap(); $('div.priscillacatalog>div').unwrap().children().unwrap(); $('p.catalogo:contains("immagine non disponibile")').remove(); } $('.colorbox').colorbox({title: function(){return $('img', this).attr('alt');}}); } function load() { $('.card').height(calcHeight('.card .front .content', 0)); } function resize() { dim.cacheww = dim.ww; dim.cachewh = dim.wh; dim.ww = $(window).width(); dim.wh = $(window).height(); } /************************************************************************** ASIDE NAV **************************************************************************/ function asideNav(){ var _controller = $('Menu Associazione').prependTo('aside nav'); _controller.click(function(){ $(this).toggleClass('active').next('ul').slideToggle(); }); $(window).resize(function(){ if(dim.ww > 760) _controller.next('ul').show(); else _controller.removeClass('active').next('ul').hide(); }) } /************************************************************************** BURGER NAV - nav : element annidation (not as an object) - position: left or right **************************************************************************/ function burgerNav(nav, position){ var _nav = $(nav); var _burgerIcon = $('
').prependTo(_nav); var _overlay = $('
').appendTo(_nav); _burgerIcon.click(function(e){ e.preventDefault(); _nav.toggleClass('active'); _overlay.fadeToggle(); }); _overlay.click(close); $(window).resize(function(){ if(dim.ww != dim.cacheww) close(); }); function close(){ _nav.removeClass('active'); _overlay.fadeOut(); } //swipe var swipeEl = new Hammer(document.getElementsByTagName('html')[0],{ cssProps: {userSelect: true}}); swipeEl.on("swipeleft swiperight", function(ev) { if ( ev.type == ((position == 'right') ? 'swiperight' : 'swipeleft' ) && _nav.hasClass('active') || ev.type == ((position == 'right') ? 'swipeleft' : 'swiperight' ) && !_nav.hasClass('active') ) _burgerIcon.trigger('click') }); } /************************************************************************** FUNCTIONS **************************************************************************/ function navigathor(){ $('aside nav > ul > li > a').click(function(){ $(this).toggleClass('selected').siblings('ul').slideToggle(); $(this).parent().siblings().children('a').removeClass('selected').siblings('ul').slideUp(); }); } function dynamic_search(){ var input_name = $('input#nome'), input_select = $('select#categorie'), list = $('#list li.resultListElement'); this.checker = function(e){ var array_value_name = input_name.val().split(' '), value_cat = input_select.val(), match_nome, match_cat; $('.card').addClass('flipped'); list.each(function(){ var title = $(this).children('strong').text(); var categories = []; $(this).find('.aree .tareas li').each(function() { categories.push($(this).text()) }); match_nome = 0; match_cat = false; for( var i = 0; i < array_value_name.length; i++){ if( title.toLowerCase().indexOf( array_value_name[i].toLowerCase() ) > -1 ){ match_nome++; } } if( input_select[0].selectedIndex != 0 ){ for( var i = 0; i < categories.length; i++){ if( categories[i].toLowerCase() == value_cat.toLowerCase() ){ match_cat = true; } } }else{ match_cat = true; } if( match_nome == array_value_name.length && match_cat == true ) $(this).show(); else $(this).hide(); }); $('.card').height(calcHeight('.card .back .content', 0)); } input_select.on('change',function(){ $(this).next('span').text($(this).find(":selected").text()); }); $('.card .goBack').click(function(){ $('.card').removeClass('flipped').height(calcHeight('.card .front .content', 0)); input_name.val(''); input_select.val( input_select.find('option:first').val() ).next('span').text( input_select.find('option:first').val() ); }); list.click(function(){ $(this).siblings().find('.expandable').slideUp(); $(this).find('.expandable').slideToggle(function(){ $('.card').height(calcHeight('.card .back .content', 0)); }); }) input_name.focusin(function(){ $('.searchForm').addClass('focused'); }); input_name.focusout(function(){ $('.searchForm').removeClass('focused'); }); input_select.focusin(function(){ $('.searchForm').addClass('focused'); }); input_select.focusout(function(){ $('.searchForm').removeClass('focused'); }); input_name.keyup(this.checker); input_select.change(this.checker); input_name.on('keypress',function(e){ if(e.which == 13 ) $('html, body').stop().animate({scrollTop : $('.card').position().top }) }); $(window).on('resize',function(){ if ( $('.card').hasClass('flipped') ) $('.card').height(calcHeight('.card .back .content', 0)); else $('.card').height(calcHeight('.card .front .content', 0)); }); } function calcHeight(container, offset){ var h = 0; $(container).children().each(function(){ h += $(this).outerHeight(true) + offset; }) return h; } /************************************************************************** PLUGINS **************************************************************************/ /*! Hammer.JS - v2.0.4 - 2014-09-28 * http://hammerjs.github.io/ * * Copyright (c) 2014 Jorik Tangelder; * Licensed under the MIT license */ !function(a,b,c,d){"use strict";function e(a,b,c){return setTimeout(k(a,c),b)}function f(a,b,c){return Array.isArray(a)?(g(a,c[b],c),!0):!1}function g(a,b,c){var e;if(a)if(a.forEach)a.forEach(b,c);else if(a.length!==d)for(e=0;e-1}function r(a){return a.trim().split(/\s+/g)}function s(a,b,c){if(a.indexOf&&!c)return a.indexOf(b);for(var d=0;dc[b]}):d.sort()),d}function v(a,b){for(var c,e,f=b[0].toUpperCase()+b.slice(1),g=0;g1&&!c.firstMultiple?c.firstMultiple=E(b):1===e&&(c.firstMultiple=!1);var f=c.firstInput,g=c.firstMultiple,h=g?g.center:f.center,i=b.center=F(d);b.timeStamp=nb(),b.deltaTime=b.timeStamp-f.timeStamp,b.angle=J(h,i),b.distance=I(h,i),C(c,b),b.offsetDirection=H(b.deltaX,b.deltaY),b.scale=g?L(g.pointers,d):1,b.rotation=g?K(g.pointers,d):0,D(c,b);var j=a.element;p(b.srcEvent.target,j)&&(j=b.srcEvent.target),b.target=j}function C(a,b){var c=b.center,d=a.offsetDelta||{},e=a.prevDelta||{},f=a.prevInput||{};(b.eventType===yb||f.eventType===Ab)&&(e=a.prevDelta={x:f.deltaX||0,y:f.deltaY||0},d=a.offsetDelta={x:c.x,y:c.y}),b.deltaX=e.x+(c.x-d.x),b.deltaY=e.y+(c.y-d.y)}function D(a,b){var c,e,f,g,h=a.lastInterval||b,i=b.timeStamp-h.timeStamp;if(b.eventType!=Bb&&(i>xb||h.velocity===d)){var j=h.deltaX-b.deltaX,k=h.deltaY-b.deltaY,l=G(i,j,k);e=l.x,f=l.y,c=mb(l.x)>mb(l.y)?l.x:l.y,g=H(j,k),a.lastInterval=b}else c=h.velocity,e=h.velocityX,f=h.velocityY,g=h.direction;b.velocity=c,b.velocityX=e,b.velocityY=f,b.direction=g}function E(a){for(var b=[],c=0;ce;)c+=a[e].clientX,d+=a[e].clientY,e++;return{x:lb(c/b),y:lb(d/b)}}function G(a,b,c){return{x:b/a||0,y:c/a||0}}function H(a,b){return a===b?Cb:mb(a)>=mb(b)?a>0?Db:Eb:b>0?Fb:Gb}function I(a,b,c){c||(c=Kb);var d=b[c[0]]-a[c[0]],e=b[c[1]]-a[c[1]];return Math.sqrt(d*d+e*e)}function J(a,b,c){c||(c=Kb);var d=b[c[0]]-a[c[0]],e=b[c[1]]-a[c[1]];return 180*Math.atan2(e,d)/Math.PI}function K(a,b){return J(b[1],b[0],Lb)-J(a[1],a[0],Lb)}function L(a,b){return I(b[0],b[1],Lb)/I(a[0],a[1],Lb)}function M(){this.evEl=Nb,this.evWin=Ob,this.allow=!0,this.pressed=!1,y.apply(this,arguments)}function N(){this.evEl=Rb,this.evWin=Sb,y.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}function O(){this.evTarget=Ub,this.evWin=Vb,this.started=!1,y.apply(this,arguments)}function P(a,b){var c=t(a.touches),d=t(a.changedTouches);return b&(Ab|Bb)&&(c=u(c.concat(d),"identifier",!0)),[c,d]}function Q(){this.evTarget=Xb,this.targetIds={},y.apply(this,arguments)}function R(a,b){var c=t(a.touches),d=this.targetIds;if(b&(yb|zb)&&1===c.length)return d[c[0].identifier]=!0,[c,c];var e,f,g=t(a.changedTouches),h=[],i=this.target;if(f=c.filter(function(a){return p(a.target,i)}),b===yb)for(e=0;eh&&(b.push(a),h=b.length-1):e&(Ab|Bb)&&(c=!0),0>h||(b[h]=a,this.callback(this.manager,e,{pointers:b,changedPointers:[a],pointerType:f,srcEvent:a}),c&&b.splice(h,1))}});var Tb={touchstart:yb,touchmove:zb,touchend:Ab,touchcancel:Bb},Ub="touchstart",Vb="touchstart touchmove touchend touchcancel";j(O,y,{handler:function(a){var b=Tb[a.type];if(b===yb&&(this.started=!0),this.started){var c=P.call(this,a,b);b&(Ab|Bb)&&c[0].length-c[1].length===0&&(this.started=!1),this.callback(this.manager,b,{pointers:c[0],changedPointers:c[1],pointerType:tb,srcEvent:a})}}});var Wb={touchstart:yb,touchmove:zb,touchend:Ab,touchcancel:Bb},Xb="touchstart touchmove touchend touchcancel";j(Q,y,{handler:function(a){var b=Wb[a.type],c=R.call(this,a,b);c&&this.callback(this.manager,b,{pointers:c[0],changedPointers:c[1],pointerType:tb,srcEvent:a})}}),j(S,y,{handler:function(a,b,c){var d=c.pointerType==tb,e=c.pointerType==vb;if(d)this.mouse.allow=!1;else if(e&&!this.mouse.allow)return;b&(Ab|Bb)&&(this.mouse.allow=!0),this.callback(a,b,c)},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var Yb=v(jb.style,"touchAction"),Zb=Yb!==d,$b="compute",_b="auto",ac="manipulation",bc="none",cc="pan-x",dc="pan-y";T.prototype={set:function(a){a==$b&&(a=this.compute()),Zb&&(this.manager.element.style[Yb]=a),this.actions=a.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var a=[];return g(this.manager.recognizers,function(b){l(b.options.enable,[b])&&(a=a.concat(b.getTouchAction()))}),U(a.join(" "))},preventDefaults:function(a){if(!Zb){var b=a.srcEvent,c=a.offsetDirection;if(this.manager.session.prevented)return void b.preventDefault();var d=this.actions,e=q(d,bc),f=q(d,dc),g=q(d,cc);return e||f&&c&Hb||g&&c&Ib?this.preventSrc(b):void 0}},preventSrc:function(a){this.manager.session.prevented=!0,a.preventDefault()}};var ec=1,fc=2,gc=4,hc=8,ic=hc,jc=16,kc=32;V.prototype={defaults:{},set:function(a){return h(this.options,a),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(a){if(f(a,"recognizeWith",this))return this;var b=this.simultaneous;return a=Y(a,this),b[a.id]||(b[a.id]=a,a.recognizeWith(this)),this},dropRecognizeWith:function(a){return f(a,"dropRecognizeWith",this)?this:(a=Y(a,this),delete this.simultaneous[a.id],this)},requireFailure:function(a){if(f(a,"requireFailure",this))return this;var b=this.requireFail;return a=Y(a,this),-1===s(b,a)&&(b.push(a),a.requireFailure(this)),this},dropRequireFailure:function(a){if(f(a,"dropRequireFailure",this))return this;a=Y(a,this);var b=s(this.requireFail,a);return b>-1&&this.requireFail.splice(b,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(a){return!!this.simultaneous[a.id]},emit:function(a){function b(b){c.manager.emit(c.options.event+(b?W(d):""),a)}var c=this,d=this.state;hc>d&&b(!0),b(),d>=hc&&b(!0)},tryEmit:function(a){return this.canEmit()?this.emit(a):void(this.state=kc)},canEmit:function(){for(var a=0;af?Db:Eb,c=f!=this.pX,d=Math.abs(a.deltaX)):(e=0===g?Cb:0>g?Fb:Gb,c=g!=this.pY,d=Math.abs(a.deltaY))),a.direction=e,c&&d>b.threshold&&e&b.direction},attrTest:function(a){return Z.prototype.attrTest.call(this,a)&&(this.state&fc||!(this.state&fc)&&this.directionTest(a))},emit:function(a){this.pX=a.deltaX,this.pY=a.deltaY;var b=X(a.direction);b&&this.manager.emit(this.options.event+b,a),this._super.emit.call(this,a)}}),j(_,Z,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[bc]},attrTest:function(a){return this._super.attrTest.call(this,a)&&(Math.abs(a.scale-1)>this.options.threshold||this.state&fc)},emit:function(a){if(this._super.emit.call(this,a),1!==a.scale){var b=a.scale<1?"in":"out";this.manager.emit(this.options.event+b,a)}}}),j(ab,V,{defaults:{event:"press",pointers:1,time:500,threshold:5},getTouchAction:function(){return[_b]},process:function(a){var b=this.options,c=a.pointers.length===b.pointers,d=a.distanceb.time;if(this._input=a,!d||!c||a.eventType&(Ab|Bb)&&!f)this.reset();else if(a.eventType&yb)this.reset(),this._timer=e(function(){this.state=ic,this.tryEmit()},b.time,this);else if(a.eventType&Ab)return ic;return kc},reset:function(){clearTimeout(this._timer)},emit:function(a){this.state===ic&&(a&&a.eventType&Ab?this.manager.emit(this.options.event+"up",a):(this._input.timeStamp=nb(),this.manager.emit(this.options.event,this._input)))}}),j(bb,Z,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[bc]},attrTest:function(a){return this._super.attrTest.call(this,a)&&(Math.abs(a.rotation)>this.options.threshold||this.state&fc)}}),j(cb,Z,{defaults:{event:"swipe",threshold:10,velocity:.65,direction:Hb|Ib,pointers:1},getTouchAction:function(){return $.prototype.getTouchAction.call(this)},attrTest:function(a){var b,c=this.options.direction;return c&(Hb|Ib)?b=a.velocity:c&Hb?b=a.velocityX:c&Ib&&(b=a.velocityY),this._super.attrTest.call(this,a)&&c&a.direction&&a.distance>this.options.threshold&&mb(b)>this.options.velocity&&a.eventType&Ab},emit:function(a){var b=X(a.direction);b&&this.manager.emit(this.options.event+b,a),this.manager.emit(this.options.event,a)}}),j(db,V,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:2,posThreshold:10},getTouchAction:function(){return[ac]},process:function(a){var b=this.options,c=a.pointers.length===b.pointers,d=a.distance