Comparing version 1.8.0 to 1.8.1
@@ -1,1 +0,1 @@ | ||
var slice=[].slice,hasProp={}.hasOwnProperty;null==this.Utils&&(this.Utils={modules:[]});var addClass=function(a,b){return removeClass(a,b),a.className+=" "+b+" "},removeClass=function(a,b){var c=new RegExp("(\\s|^)"+b+"(\\s|$)","gi");return a.className=a.className.replace(c,"")},hasClass=function(a,b){return new RegExp("(^| )"+b+"( |$)","gi").test(a.className)},merge=function(){var a,b,c,d,e=arguments[0],f=2<=arguments.length?slice.call(arguments,1):[];for(b=0,c=f.length;c>b;b++){a=f[b];for(d in a)hasProp.call(a,d)&&(e[d]=a[d])}return e},setOptions=function(a,b){return merge({},b,a)},deleteUndefined=function(a){var b,c,d=[];for(b in a)c=a[b],null===c||void 0===c?d.push(delete a[b]):d.push(void 0);return d},transformKey=function(){var a,b,c,d=document.createElement("div"),e=["transform","webkitTransform","OTransform","MozTransform","msTransform"];for(a=0,c=e.length;c>a;a++)if(b=e[a],void 0!==d.style[b])return b}(),requestAnimationFrame=function(a){var b,c,d,e=["ms","moz","webkit","o"];for(b=0,c=e.length;c>b&&(d=e[b],!a.requestAnimationFrame);b++)a.requestAnimationFrame=a[d+"RequestAnimationFrame"];return a.requestAnimationFrame||(a.requestAnimationFrame=function(a){return setTimeout(a,1e3/60)})}(window);this.Utils={addClass:addClass,removeClass:removeClass,hasClass:hasClass,merge:merge,setOptions:setOptions,deleteUndefined:deleteUndefined,transformKey:transformKey,requestAnimationFrame:requestAnimationFrame};var createContext,ref=this.Utils,merge=ref.merge,addClass=ref.addClass,hasClass=ref.hasClass,setOptions=ref.setOptions,removeClass=ref.removeClass,transformKey=ref.transformKey,indexOf=[].indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(b in this&&this[b]===a)return b;return-1};createContext=function(a){var b;return b=function(){function a(a){var b,c=this.options=setOptions(a,this.defaults);this.target=c.target,this.classPrefix=c.classPrefix,null!==this.target&&(this._boundEvents=[],this._closeTargets=[],b=this.create(),this.anchor=b.anchor,this.arrow=b.arrow,this.content=b.content,this.setEvents(this.anchor),this.watchWindow())}var b,c,d;return a.prototype.defaults={classPrefix:"us-anchor",openEvent:"click",showClose:!0,isAjax:!1},a.prototype.setEvents=function(a){var b=function(b){return function(c){return c.preventDefault(),c.stopPropagation(),b.isOpen()?b.hide(a):b.show(a)}}(this),c=function(b){return function(c){var d;if(b.isOpen()&&(d=c.target,indexOf.call(b._closeTargets,d)>=0&&(c.preventDefault(),c.stopPropagation(),b.hide(a)),c.target!==a&&!a.contains(c.target)&&c.target!==b.target&&!b.target.contains(c.target)))return b.hide(a)}}(this);return this._on(this.target,this.options.openEvent,b),this._on(document,this.options.openEvent,c)},a.prototype._on=function(a,b,c){return this._boundEvents.push({element:a,event:b,handler:c}),a.addEventListener(b,c,!1)},a.prototype.show=function(a){var b,c,d=function(b){return function(){return b.content.appendChild(b.options.content),a.parentNode||document.body.appendChild(a),addClass(a,b.classPrefix+"--open"),setTimeout(function(){return addClass(a,b.classPrefix+"--after-open")}),b.setPosition()}}(this);return this.options.isAjax?null!=(b=this.options.onOpen)?b.call().done(function(){return d()}):void 0:(d(),null!=(c=this.options.onOpen)?c.call():void 0)},a.prototype.hide=function(a){var b;return removeClass(a,this.classPrefix+"--open"),removeClass(a,this.classPrefix+"--after-open"),null!=(b=this.options.onClose)?b.call():void 0},a.prototype.isOpen=function(){return hasClass(this.anchor,this.classPrefix+"--open")},a.prototype.create=function(){var a,b,c,d=document.createElement("div"),e=document.createElement("div"),f=document.createElement("div");return addClass(e,this.classPrefix+"__content"),addClass(f,this.classPrefix+"__arrow-inner"),addClass(d,this.classPrefix+"__arrow"),d.appendChild(f),e.appendChild(d),this.options.showClose&&(c=document.createElement("a"),c.href="#",addClass(c,this.classPrefix+"__close-button"),e.appendChild(c),this._closeTargets.push(c)),a=document.createElement("div"),addClass(a,this.classPrefix),b=a.style,b.position="absolute",b.zIndex="9999",b.top="0px",b.left="0px",a.appendChild(e),addClass(document.documentElement,this.classPrefix+"--ready"),{anchor:a,arrow:d,content:e}},a.prototype.setPosition=function(){var a,e,f,g,h=c(this.target,this.anchor,this.arrow),i=this.target.getBoundingClientRect();return b(i,this.anchor)?(addClass(this.anchor,this.classPrefix+"--bottom"),removeClass(this.anchor,this.classPrefix+"--top"),g="calc(100% + 12px)",e=d(this.target,this.anchor,this.arrow)):(addClass(this.anchor,this.classPrefix+"--top"),removeClass(this.anchor,this.classPrefix+"--bottom"),g="-12px",e=d(this.target,this.anchor,this.arrow)),a="translateX("+Math.round(h)+"px) ",a+="translateY("+Math.round(e)+"px)","msTransform"!==transformKey&&(a+=" translateZ(0)"),this.anchor.style[transformKey]=a,f=i.left-this.anchor.getBoundingClientRect().left+this.target.offsetWidth/2,this.arrow.style.left=f+"px",this.content.style[transformKey+"Origin"]=f+"px "+g},c=function(a,b,c){var d=a.getBoundingClientRect(),e=d.left+b.offsetWidth/2+a.offsetWidth/2,f=d.left+a.offsetWidth/2;return document.body.offsetWidth<e?document.body.offsetWidth-b.offsetWidth:f-b.offsetWidth/2<0?0:d.left-b.offsetWidth/2+a.offsetWidth/2},d=function(a,c,d){var e=a.getBoundingClientRect();return b(e,c)?e.top-(c.offsetHeight-window.pageYOffset)+d.offsetHeight-a.offsetHeight:e.top+d.offsetHeight+a.offsetHeight+window.pageYOffset},b=function(a,b){return a.top<b.offsetHeight?void 0:window.innerHeight-a.top<b.offsetHeight},a.prototype.watchWindow=function(){var a,b,c,d=["resize","scroll","touchmove"],e=[];for(b=0,c=d.length;c>b;b++)a=d[b],e.push(window.addEventListener(a,function(a){return function(b){var c,d,e,f,g;return a.isOpen()?(e=+new Date,f=16,d=3*f,g?void 0:(e-c>d&&(a.setPosition(),c=e),g=setTimeout(function(b){return g=null,c=+new Date,a.setPosition()},f))):void 0}}(this),!1));return e},a}()},window.Anchor=createContext(),window.Backdrop=function(){function a(){d=document.querySelector(".us-backdrop"),null==d&&(d=b())}var b,c=0,d=null;return a.prototype.element=d,b=function(){return d=document.createElement("div"),Utils.addClass(d,"us-backdrop"),document.body.appendChild(d)},a.prototype.retain=function(){var a;return c++,1===c?(Utils.addClass(d,"us-backdrop--visible"),a=function(){return c>=1?Utils.addClass(d,"us-backdrop--active"):void 0},Utils.requestAnimationFrame.call(window,a)):void 0},a.prototype.release=function(){var a;return 1===c&&(Utils.removeClass(d,"us-backdrop--active"),a=function(){return setTimeout(function(){return 0===c?Utils.removeClass(d,"us-backdrop--visible"):void 0},300)},Utils.requestAnimationFrame.call(window,a)),c=Math.max(0,c-1)},a}(),window.Overlay=function(a){function b(a){if(this.overlay=(this.options=f(a,h)).overlay,null==this.overlay||"undefined"==typeof Backdrop||null===Backdrop)throw new Error("There's no overlay or you haven't included Backdrop");this.backdrop=new Backdrop,this.addEventListeners()}var c=a.addClass,d=a.hasClass,e=a.removeClass,f=a.setOptions,g=a.requestAnimationFrame,h={bodyActiveClass:"us-overlay--open",activeClass:"us-overlay-parent--active",visibleClass:"us-overlay-parent--visible",overlay:$(".us-overlay-parent"),openButton:".js-open-overlay",closeButton:".js-close-overlay",historyStatus:"#seedeal",history:!1,preventDefault:!0,animationSpeed:300};return b.prototype.addEventListeners=function(){return $(this.options.openButton).on("click.open-overlay",function(a){return function(b){return a.options.preventDefault&&b.preventDefault(),a.show(b)}}(this)),this.overlay.on("click.close-overlay",function(a){return function(b){for(var c=[],d=a.overlay.find(a.options.closeButton).toArray(),e=[a.overlay[0]].concat(d),f=e.length-1;f>=0;f--){var g=e[f];if(b.target===g){a.options.preventDefault&&b.preventDefault(),a.hide(b);break}c.push(void 0)}return c}}(this)),this.hasHistory()?window.onpopstate=function(a){return function(b){return a.isOpen()?a.hide(b):void 0}}(this):void 0},b.prototype.show=function(a){var b,d=this;return $(document.body).addClass(this.options.bodyActiveClass),this.backdrop.retain(),c(this.overlay[0],this.options.visibleClass),b=function(){return c(d.overlay[0],d.options.activeClass),setTimeout(function(){var b;return"function"==typeof(b=d.options).onOpen?b.onOpen(a):void 0},d.options.animationSpeed)},g.call(window,b),this.hasHistory()?history.pushState("open",window.document.title,this.options.historyStatus):void 0},b.prototype.hide=function(a){var b,c=this;return $(document.body).removeClass(this.options.bodyActiveClass),this.backdrop.release(),b=function(){return e(c.overlay[0],c.options.activeClass),setTimeout(function(){var b;return e(c.overlay[0],c.options.visibleClass),"function"==typeof(b=c.options).onClose?b.onClose(a):void 0},c.options.animationSpeed)},g.call(window,b),this.hasHistory()&&"open"===history.state?history.back():void 0},b.prototype.isOpen=function(){return d(this.overlay[0],this.options.activeClass)},b.prototype.hasHistory=function(){return this.options.history&&window.history&&window.history.pushState},b}(this.Utils);var setOptions=this.Utils.setOptions;window.Tabs=function(a){var b;return b=function(){function a(a){var b=this.options=setOptions(a,this.defaults),c=b.tabContainer,d=b.tabLinks;this.tabs=$(c).find(d),this.filter=this.tabs.data("target")?"data-target":"href",this.init(),this.tabs.on("click.ustyle.tab",function(a){return function(b){var c=$(b.currentTarget);return a.isAccordion()&&a.options.collapsible&&a.isActive(c)?(a.collapse(c),a.hashClear()):(a.navigateTo(c),a.scrollToTab(c),a.hashChange(c)),b.preventDefault()}}(this))}var b;return a.prototype.defaults={tabContainer:".us-tabs",tabLinks:".us-tabs-nav-mainlink",tabNav:".us-tabs-nav",changeUrls:!0,activeClass:"active",collapsible:!1,autoScroll:!0},a.prototype.init=function(){var a=this.activeTab(),b=this.tabFromHash();return b.length?this.navigateTo(b):a.length?this.navigateTo(a):this.options.collapsible&&this.isAccordion()?void 0:this.navigateTo(this.tabs.first())},a.prototype.hashChange=function(a){return this.options.changeUrls?location.replace("#!"+b(a).replace(/#/,"")):void 0},a.prototype.hashClear=function(){if(this.options.changeUrls){var a=window.location.pathname+window.location.search;return"function"==typeof history.replaceState?history.replaceState("",document.title,a):void 0}},a.prototype.navigateTo=function(a){var c=b(a),d=$(c);return this.tabs.removeClass(this.options.activeClass).end(),this.tabs.filter("["+this.filter+"='"+c+"']").addClass(this.options.activeClass),d.siblings("."+this.options.activeClass).removeClass(this.options.activeClass).end().addClass(this.options.activeClass),d.trigger("ustyle.tab.active")},a.prototype.collapse=function(a){var c=$(b(a));return this.tabs.removeClass(this.options.activeClass).end(),c.removeClass(this.options.activeClass)},a.prototype.scrollToTab=function(a){if(this.isAccordion()&&this.options.autoScroll){var c=$(b(a));return $("html,body").scrollTop(c.offset().top)}},a.prototype.activeTab=function(){return this.tabs.filter("."+this.options.activeClass)},a.prototype.tabFromHash=function(){var a=location.hash.replace("!","");return this.tabs.filter("["+this.filter+"='"+a+"']")},a.prototype.isActive=function(a){return b(a)===b(this.activeTab())},a.prototype.isAccordion=function(){return!$(this.options.tabNav).is(":visible")},b=function(a){return a.data("target")||a.attr("href")},a}()}(),window.ClassToggler=function(){function a(a){this.options=Utils.setOptions(a,b),this.options.$target?this.addEventListeners():console.trace("ClassToggle",this.options)}var b;return b={containerClass:null,$target:null,activeClass:"active",inactiveClass:null,toggleOn:"click"},a.prototype.addEventListeners=function(){return this.options.$target.on(this.options.toggleOn,function(a){return function(b){var c=a.options.containerClass?$(b.target).closest(a.options.containerClass):$(b.delegateTarget);return a.isActive(c)?a.hide(c,b):a.show(c,b)}}(this))},a.prototype.isActive=function(a){return a.hasClass(this.options.activeClass)},a.prototype.show=function(a,b){var c;return"function"==typeof(c=this.options).onShow&&c.onShow(a,b),a.addClass(this.options.activeClass)},a.prototype.hide=function(a,b){var c;return"function"==typeof(c=this.options).onHide&&c.onHide(a,b),a.removeClass(this.options.activeClass)},a}(),window.RadioToggle=function(){function a(a){if(this.options=Utils.setOptions(a,b),!this.options.$target)throw new Error("No target defined");this.addEventListeners()}var b={$target:$(".us-toggle")};return a.prototype.addEventListeners=function(){return this.options.$target.on("change","input:radio",function(a){return $("input[name='"+this.name+"']").removeClass("checked"),this.checked&&$(this).addClass("checked"),a.stopPropagation()})},a}(); | ||
var slice=[].slice,hasProp={}.hasOwnProperty;null==this.Utils&&(this.Utils={modules:[]});var addClass=function(a,b){return removeClass(a,b),a.className+=" "+b+" "},removeClass=function(a,b){var c=new RegExp("(\\s|^)"+b+"(\\s|$)","gi");return a.className=a.className.replace(c,"")},hasClass=function(a,b){return new RegExp("(^| )"+b+"( |$)","gi").test(a.className)},merge=function(){var a,b,c,d,e=arguments[0],f=2<=arguments.length?slice.call(arguments,1):[];for(b=0,c=f.length;b<c;b++){a=f[b];for(d in a)hasProp.call(a,d)&&(e[d]=a[d])}return e},setOptions=function(a,b){return merge({},b,a)},deleteUndefined=function(a){var b,c,d=[];for(b in a)c=a[b],null===c||void 0===c?d.push(delete a[b]):d.push(void 0);return d},transformKey=function(){var a,b,c,d=document.createElement("div"),e=["transform","webkitTransform","OTransform","MozTransform","msTransform"];for(a=0,c=e.length;a<c;a++)if(b=e[a],void 0!==d.style[b])return b}(),requestAnimationFrame=function(a){var b,c,d,e=["ms","moz","webkit","o"];for(b=0,c=e.length;b<c&&(d=e[b],!a.requestAnimationFrame);b++)a.requestAnimationFrame=a[d+"RequestAnimationFrame"];return a.requestAnimationFrame||(a.requestAnimationFrame=function(a){return setTimeout(a,1e3/60)})}(window);this.Utils={addClass:addClass,removeClass:removeClass,hasClass:hasClass,merge:merge,setOptions:setOptions,deleteUndefined:deleteUndefined,transformKey:transformKey,requestAnimationFrame:requestAnimationFrame};var createContext,ref=this.Utils,merge=ref.merge,addClass=ref.addClass,hasClass=ref.hasClass,setOptions=ref.setOptions,removeClass=ref.removeClass,transformKey=ref.transformKey,indexOf=[].indexOf||function(a){for(var b=0,c=this.length;b<c;b++)if(b in this&&this[b]===a)return b;return-1};createContext=function(a){var b;return b=function(){function a(a){var b,c=this.options=setOptions(a,this.defaults);this.target=c.target,this.classPrefix=c.classPrefix,null!==this.target&&(this._boundEvents=[],this._closeTargets=[],b=this.create(),this.anchor=b.anchor,this.arrow=b.arrow,this.content=b.content,this.setEvents(this.anchor),this.watchWindow())}var b,c,d;return a.prototype.defaults={classPrefix:"us-anchor",openEvent:"click",showClose:!0,isAjax:!1},a.prototype.setEvents=function(a){var b=function(b){return function(c){return c.preventDefault(),c.stopPropagation(),b.isOpen()?b.hide(a):b.show(a)}}(this),c=function(b){return function(c){var d;if(b.isOpen()&&(d=c.target,indexOf.call(b._closeTargets,d)>=0&&(c.preventDefault(),c.stopPropagation(),b.hide(a)),c.target!==a&&!a.contains(c.target)&&c.target!==b.target&&!b.target.contains(c.target)))return b.hide(a)}}(this);return this._on(this.target,this.options.openEvent,b),this._on(document,this.options.openEvent,c)},a.prototype._on=function(a,b,c){return this._boundEvents.push({element:a,event:b,handler:c}),a.addEventListener(b,c,!1)},a.prototype.show=function(a){var b,c,d=function(b){return function(){return b.content.appendChild(b.options.content),a.parentNode||document.body.appendChild(a),addClass(a,b.classPrefix+"--open"),setTimeout(function(){return addClass(a,b.classPrefix+"--after-open")}),b.setPosition()}}(this);return this.options.isAjax?null!=(b=this.options.onOpen)?b.call().done(function(){return d()}):void 0:(d(),null!=(c=this.options.onOpen)?c.call():void 0)},a.prototype.hide=function(a){var b;return removeClass(a,this.classPrefix+"--open"),removeClass(a,this.classPrefix+"--after-open"),null!=(b=this.options.onClose)?b.call():void 0},a.prototype.isOpen=function(){return hasClass(this.anchor,this.classPrefix+"--open")},a.prototype.create=function(){var a,b,c,d=document.createElement("div"),e=document.createElement("div"),f=document.createElement("div");return addClass(e,this.classPrefix+"__content"),addClass(f,this.classPrefix+"__arrow-inner"),addClass(d,this.classPrefix+"__arrow"),d.appendChild(f),e.appendChild(d),this.options.showClose&&(c=document.createElement("a"),c.href="#",addClass(c,this.classPrefix+"__close-button"),e.appendChild(c),this._closeTargets.push(c)),a=document.createElement("div"),addClass(a,this.classPrefix),b=a.style,b.position="absolute",b.zIndex="9999",b.top="0px",b.left="0px",a.appendChild(e),addClass(document.documentElement,this.classPrefix+"--ready"),{anchor:a,arrow:d,content:e}},a.prototype.setPosition=function(){var a,e,f,g,h=c(this.target,this.anchor,this.arrow),i=this.target.getBoundingClientRect();return b(i,this.anchor)?(addClass(this.anchor,this.classPrefix+"--bottom"),removeClass(this.anchor,this.classPrefix+"--top"),g="calc(100% + 12px)",e=d(this.target,this.anchor,this.arrow)):(addClass(this.anchor,this.classPrefix+"--top"),removeClass(this.anchor,this.classPrefix+"--bottom"),g="-12px",e=d(this.target,this.anchor,this.arrow)),a="translateX("+Math.round(h)+"px) ",a+="translateY("+Math.round(e)+"px)","msTransform"!==transformKey&&(a+=" translateZ(0)"),this.anchor.style[transformKey]=a,f=i.left-this.anchor.getBoundingClientRect().left+this.target.offsetWidth/2,this.arrow.style.left=f+"px",this.content.style[transformKey+"Origin"]=f+"px "+g},c=function(a,b,c){var d=a.getBoundingClientRect(),e=d.left+b.offsetWidth/2+a.offsetWidth/2,f=d.left+a.offsetWidth/2;return document.body.offsetWidth<e?document.body.offsetWidth-b.offsetWidth:f-b.offsetWidth/2<0?0:d.left-b.offsetWidth/2+a.offsetWidth/2},d=function(a,c,d){var e=a.getBoundingClientRect();return b(e,c)?e.top-(c.offsetHeight-window.pageYOffset)+d.offsetHeight-a.offsetHeight:e.top+d.offsetHeight+a.offsetHeight+window.pageYOffset},b=function(a,b){if(!(a.top<b.offsetHeight))return window.innerHeight-a.top<b.offsetHeight},a.prototype.watchWindow=function(){var a,b,c,d=["resize","scroll","touchmove"],e=[];for(b=0,c=d.length;b<c;b++)a=d[b],e.push(window.addEventListener(a,function(a){return function(b){var c,d,e,f,g;if(a.isOpen())return e=+new Date,f=16,d=3*f,g?void 0:(e-c>d&&(a.setPosition(),c=e),g=setTimeout(function(b){return g=null,c=+new Date,a.setPosition()},f))}}(this),!1));return e},a}()},window.Anchor=createContext(),window.Backdrop=function(){function a(){d=document.querySelector(".us-backdrop"),null==d&&(d=b())}var b,c=0,d=null;return a.prototype.element=d,b=function(){return d=document.createElement("div"),Utils.addClass(d,"us-backdrop"),document.body.appendChild(d)},a.prototype.retain=function(){var a;if(c++,1===c)return Utils.addClass(d,"us-backdrop--visible"),a=function(){if(c>=1)return Utils.addClass(d,"us-backdrop--active")},Utils.requestAnimationFrame.call(window,a)},a.prototype.release=function(){var a;return 1===c&&(Utils.removeClass(d,"us-backdrop--active"),a=function(){return setTimeout(function(){if(0===c)return Utils.removeClass(d,"us-backdrop--visible")},300)},Utils.requestAnimationFrame.call(window,a)),c=Math.max(0,c-1)},a}(),window.Overlay=function(a){function b(a){if(this.overlay=(this.options=f(a,h)).overlay,null==this.overlay||"undefined"==typeof Backdrop||null===Backdrop)throw new Error("There's no overlay or you haven't included Backdrop");this.backdrop=new Backdrop,this.addEventListeners()}var c=a.addClass,d=a.hasClass,e=a.removeClass,f=a.setOptions,g=a.requestAnimationFrame,h={bodyActiveClass:"us-overlay--open",activeClass:"us-overlay-parent--active",visibleClass:"us-overlay-parent--visible",overlay:$(".us-overlay-parent"),openButton:".js-open-overlay",closeButton:".js-close-overlay",historyStatus:"#seedeal",history:!1,preventDefault:!0,animationSpeed:300};return b.prototype.addEventListeners=function(){if($(this.options.openButton).on("click.open-overlay",function(a){return function(b){return a.options.preventDefault&&b.preventDefault(),a.show(b)}}(this)),this.overlay.on("click.close-overlay",function(a){return function(b){for(var c=[],d=a.overlay.find(a.options.closeButton).toArray(),e=[a.overlay[0]].concat(d),f=e.length-1;f>=0;f--){var g=e[f];if(b.target===g){a.options.preventDefault&&b.preventDefault(),a.hide(b);break}c.push(void 0)}return c}}(this)),this.hasHistory())return window.onpopstate=function(a){return function(b){if(a.isOpen())return a.hide(b)}}(this)},b.prototype.show=function(a){var b,d=this;if($(document.body).addClass(this.options.bodyActiveClass),this.backdrop.retain(),c(this.overlay[0],this.options.visibleClass),b=function(){return c(d.overlay[0],d.options.activeClass),setTimeout(function(){var b;return"function"==typeof(b=d.options).onOpen?b.onOpen(a):void 0},d.options.animationSpeed)},g.call(window,b),this.hasHistory())return history.pushState("open",window.document.title,this.options.historyStatus)},b.prototype.hide=function(a){var b,c=this;if($(document.body).removeClass(this.options.bodyActiveClass),this.backdrop.release(),b=function(){return e(c.overlay[0],c.options.activeClass),setTimeout(function(){var b;return e(c.overlay[0],c.options.visibleClass),"function"==typeof(b=c.options).onClose?b.onClose(a):void 0},c.options.animationSpeed)},g.call(window,b),this.hasHistory()&&"open"===history.state)return history.back()},b.prototype.isOpen=function(){return d(this.overlay[0],this.options.activeClass)},b.prototype.hasHistory=function(){return this.options.history&&window.history&&window.history.pushState},b}(this.Utils);var setOptions=this.Utils.setOptions;window.Tabs=function(a){var b;return b=function(){function a(a){var b=this.options=setOptions(a,this.defaults),c=b.tabContainer,d=b.tabLinks;this.tabs=$(c).find(d),this.filter=this.tabs.data("target")?"data-target":"href",this.init(),this.tabs.on("click.ustyle.tab",function(a){return function(b){var c=$(b.currentTarget);return a.isAccordion()&&a.options.collapsible&&a.isActive(c)?(a.collapse(c),a.hashClear()):(a.navigateTo(c),a.scrollToTab(c),a.hashChange(c)),b.preventDefault()}}(this))}var b;return a.prototype.defaults={tabContainer:".us-tabs",tabLinks:".us-tabs-nav-mainlink",tabNav:".us-tabs-nav",changeUrls:!0,activeClass:"active",collapsible:!1,autoScroll:!0},a.prototype.init=function(){var a=this.activeTab(),b=this.tabFromHash();return b.length?this.navigateTo(b):a.length?this.navigateTo(a):this.options.collapsible&&this.isAccordion()?void 0:this.navigateTo(this.tabs.first())},a.prototype.hashChange=function(a){if(this.options.changeUrls)return location.replace("#!"+b(a).replace(/#/,""))},a.prototype.hashClear=function(){if(this.options.changeUrls){var a=window.location.pathname+window.location.search;return"function"==typeof history.replaceState?history.replaceState("",document.title,a):void 0}},a.prototype.navigateTo=function(a){var c=b(a),d=$(c);return this.tabs.removeClass(this.options.activeClass).end(),this.tabs.filter("["+this.filter+"='"+c+"']").addClass(this.options.activeClass),d.siblings("."+this.options.activeClass).removeClass(this.options.activeClass).end().addClass(this.options.activeClass),d.trigger("ustyle.tab.active")},a.prototype.collapse=function(a){var c=$(b(a));return this.tabs.removeClass(this.options.activeClass).end(),c.removeClass(this.options.activeClass)},a.prototype.scrollToTab=function(a){if(this.isAccordion()&&this.options.autoScroll){var c=$(b(a));return $("html,body").scrollTop(c.offset().top)}},a.prototype.activeTab=function(){return this.tabs.filter("."+this.options.activeClass)},a.prototype.tabFromHash=function(){var a=location.hash.replace("!","");return this.tabs.filter("["+this.filter+"='"+a+"']")},a.prototype.isActive=function(a){return b(a)===b(this.activeTab())},a.prototype.isAccordion=function(){return!$(this.options.tabNav).is(":visible")},b=function(a){return a.data("target")||a.attr("href")},a}()}(),window.ClassToggler=function(){function a(a){this.options=Utils.setOptions(a,b),this.options.$target?this.addEventListeners():console.trace("ClassToggle",this.options)}var b;return b={containerClass:null,$target:null,activeClass:"active",inactiveClass:null,toggleOn:"click"},a.prototype.addEventListeners=function(){return this.options.$target.on(this.options.toggleOn,function(a){return function(b){var c=a.options.containerClass?$(b.target).closest(a.options.containerClass):$(b.delegateTarget);return a.isActive(c)?a.hide(c,b):a.show(c,b)}}(this))},a.prototype.isActive=function(a){return a.hasClass(this.options.activeClass)},a.prototype.show=function(a,b){var c;return"function"==typeof(c=this.options).onShow&&c.onShow(a,b),a.addClass(this.options.activeClass)},a.prototype.hide=function(a,b){var c;return"function"==typeof(c=this.options).onHide&&c.onHide(a,b),a.removeClass(this.options.activeClass)},a}(),window.RadioToggle=function(){function a(a){if(this.options=Utils.setOptions(a,b),!this.options.$target)throw new Error("No target defined");this.addEventListeners()}var b={$target:$(".us-toggle")};return a.prototype.addEventListeners=function(){return this.options.$target.on("change","input:radio",function(a){return $("input[name='"+this.name+"']").removeClass("checked"),this.checked&&$(this).addClass("checked"),a.stopPropagation()})},a}(); |
{ | ||
"name": "ustyle", | ||
"version": "1.8.0", | ||
"version": "1.8.1", | ||
"description": "A living styleguide and pattern library by uSwitch.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
902725
3140