source: trunk/client/temi/realistic/layout/scripts/superfish/superfish.js@ 407

Last change on this file since 407 was 241, checked in by luc, 9 years ago

Aggiunta del widget Privacy e CookieLaw per l'informativa sui cookie - Aggiunto Tema Realistic - Aggiunto Tema Spectral

  • Property svn:executable set to *
File size: 4.3 KB
Line 
1/*
2 * jQuery Superfish Menu Plugin
3 * Copyright (c) 2013 Joel Birch
4 *
5 * Dual licensed under the MIT and GPL licenses:
6 * http://www.opensource.org/licenses/mit-license.php
7 * http://www.gnu.org/licenses/gpl.html
8 */
9
10(function(e,t){"use strict";var n=function(){var n={bcClass:"sf-breadcrumb",menuClass:"sf-js-enabled",anchorClass:"sf-with-ul",menuArrowClass:"sf-arrows"},r=function(){var n=/iPhone|iPad|iPod/i.test(navigator.userAgent);if(n){e(t).load(function(){e("body").children().on("click",e.noop)})}return n}(),i=function(){var e=document.documentElement.style;return"behavior"in e&&"fill"in e&&/iemobile/i.test(navigator.userAgent)}(),s=function(){return!!t.PointerEvent}(),o=function(e,t){var r=n.menuClass;if(t.cssArrows){r+=" "+n.menuArrowClass}e.toggleClass(r)},u=function(t,r){return t.find("li."+r.pathClass).slice(0,r.pathLevels).addClass(r.hoverClass+" "+n.bcClass).filter(function(){return e(this).children(r.popUpSelector).hide().show().length}).removeClass(r.pathClass)},a=function(e){e.children("a").toggleClass(n.anchorClass)},f=function(e){var t=e.css("ms-touch-action");var n=e.css("touch-action");n=n||t;n=n==="pan-y"?"auto":"pan-y";e.css({"ms-touch-action":n,"touch-action":n})},l=function(t,n){var o="li:has("+n.popUpSelector+")";if(e.fn.hoverIntent&&!n.disableHI){t.hoverIntent(h,p,o)}else{t.on("mouseenter.superfish",o,h).on("mouseleave.superfish",o,p)}var u="MSPointerDown.superfish";if(s){u="pointerdown.superfish"}if(!r){u+=" touchend.superfish"}if(i){u+=" mousedown.superfish"}t.on("focusin.superfish","li",h).on("focusout.superfish","li",p).on(u,"a",n,c)},c=function(t){var n=e(this),r=n.siblings(t.data.popUpSelector);if(r.length>0&&r.is(":hidden")){n.one("click.superfish",false);if(t.type==="MSPointerDown"||t.type==="pointerdown"){n.trigger("focus")}else{e.proxy(h,n.parent("li"))()}}},h=function(){var t=e(this),n=m(t);clearTimeout(n.sfTimer);t.siblings().superfish("hide").end().superfish("show")},p=function(){var t=e(this),n=m(t);if(r){e.proxy(d,t,n)()}else{clearTimeout(n.sfTimer);n.sfTimer=setTimeout(e.proxy(d,t,n),n.delay)}},d=function(t){t.retainPath=e.inArray(this[0],t.$path)>-1;this.superfish("hide");if(!this.parents("."+t.hoverClass).length){t.onIdle.call(v(this));if(t.$path.length){e.proxy(h,t.$path)()}}},v=function(e){return e.closest("."+n.menuClass)},m=function(e){return v(e).data("sf-options")};return{hide:function(t){if(this.length){var n=this,r=m(n);if(!r){return this}var i=r.retainPath===true?r.$path:"",s=n.find("li."+r.hoverClass).add(this).not(i).removeClass(r.hoverClass).children(r.popUpSelector),o=r.speedOut;if(t){s.show();o=0}r.retainPath=false;r.onBeforeHide.call(s);s.stop(true,true).animate(r.animationOut,o,function(){var t=e(this);r.onHide.call(t)})}return this},show:function(){var e=m(this);if(!e){return this}var t=this.addClass(e.hoverClass),n=t.children(e.popUpSelector);e.onBeforeShow.call(n);n.stop(true,true).animate(e.animation,e.speed,function(){e.onShow.call(n)});return this},destroy:function(){return this.each(function(){var t=e(this),r=t.data("sf-options"),i;if(!r){return false}i=t.find(r.popUpSelector).parent("li");clearTimeout(r.sfTimer);o(t,r);a(i);f(t);t.off(".superfish").off(".hoverIntent");i.children(r.popUpSelector).attr("style",function(e,t){return t.replace(/display[^;]+;?/g,"")});r.$path.removeClass(r.hoverClass+" "+n.bcClass).addClass(r.pathClass);t.find("."+r.hoverClass).removeClass(r.hoverClass);r.onDestroy.call(t);t.removeData("sf-options")})},init:function(t){return this.each(function(){var r=e(this);if(r.data("sf-options")){return false}var i=e.extend({},e.fn.superfish.defaults,t),s=r.find(i.popUpSelector).parent("li");i.$path=u(r,i);r.data("sf-options",i);o(r,i);a(s);f(r);l(r,i);s.not("."+n.bcClass).superfish("hide",true);i.onInit.call(this)})}}}();e.fn.superfish=function(t,r){if(n[t]){return n[t].apply(this,Array.prototype.slice.call(arguments,1))}else if(typeof t==="object"||!t){return n.init.apply(this,arguments)}else{return e.error("Method "+t+" does not exist on jQuery.fn.superfish")}};e.fn.superfish.defaults={popUpSelector:"ul,.sf-mega",hoverClass:"sfHover",pathClass:"overrideThisToUse",pathLevels:1,delay:800,animation:{opacity:"show"},animationOut:{opacity:"hide"},speed:"normal",speedOut:"fast",cssArrows:true,disableHI:false,onInit:e.noop,onBeforeShow:e.noop,onShow:e.noop,onBeforeHide:e.noop,onHide:e.noop,onIdle:e.noop,onDestroy:e.noop}})(jQuery,window)
Note: See TracBrowser for help on using the repository browser.