From b0548c77ed935695089921c71dc95d9c0ce542c1 Mon Sep 17 00:00:00 2001 From: thednp Date: Wed, 15 Feb 2017 01:47:22 +0200 Subject: [PATCH] Fixed some bug with Carousel and `transitionEnd`. --- assets/css/theme.css | 2 +- bower.json | 2 +- dist/bootstrap-native-v4.js | 36 ++++++++++++++++++-------------- dist/bootstrap-native-v4.min.js | 4 ++-- dist/bootstrap-native.js | 37 +++++++++++++++++++-------------- dist/bootstrap-native.min.js | 4 ++-- lib/V3/carousel-native.js | 31 +++++++++++++++------------ lib/V3/utils.js | 4 ++-- lib/V4/carousel-native.js | 30 ++++++++++++++------------ lib/V4/utils.js | 4 ++-- package.json | 2 +- 11 files changed, 87 insertions(+), 69 deletions(-) diff --git a/assets/css/theme.css b/assets/css/theme.css index ebebd3e2..12e8f50a 100644 --- a/assets/css/theme.css +++ b/assets/css/theme.css @@ -188,7 +188,7 @@ p .btn-group {margin-bottom: 20px} -webkit-transform: translate3d( 0%, 0, 0); transform: translate3d(0%, 0, 0); opacity:1; - visibility: visible; + /*visibility: visible; */ } /* Declare heights because of positioning of img element */ diff --git a/bower.json b/bower.json index 38d40331..aa92649b 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "bootstrap.native", - "version": "2.0.4", + "version": "2.0.5", "homepage": "http://thednp.github.io/bootstrap.native/", "authors": [ "dnp_theme" diff --git a/dist/bootstrap-native-v4.js b/dist/bootstrap-native-v4.js index 17e26ac2..5380850c 100644 --- a/dist/bootstrap-native-v4.js +++ b/dist/bootstrap-native-v4.js @@ -1,4 +1,4 @@ -// Native Javascript for Bootstrap 4 v2.0.4 | © dnp_theme | MIT-License +// Native Javascript for Bootstrap 4 v2.0.5 | © dnp_theme | MIT-License (function (root, factory) { if (typeof define === 'function' && define.amd) { // AMD support: @@ -181,8 +181,8 @@ element.removeEventListener(event, handler, false); }, one = function (element, event, handler) { // one since 2.0.4 - on(element, event, function handlerWrapper(){ - handler(); + on(element, event, function handlerWrapper(e){ + handler(e); off(element, event, handlerWrapper); }); }, @@ -577,21 +577,25 @@ addClass(slides[next],carouselItem +'-'+ slideDirection); addClass(slides[activeItem],carouselItem +'-'+ slideDirection); - one(slides[next], transitionEndEvent, function(){ - isSliding = self.isSliding = false; + one(slides[activeItem], transitionEndEvent, function(e) { + var timeout = e[target] !== slides[activeItem] ? e.elapsedTime*1000 : 0; + setTimeout(function(){ + isSliding = self.isSliding = false; - addClass(slides[next],active); - removeClass(slides[activeItem],active); + addClass(slides[next],active); + removeClass(slides[activeItem],active); - removeClass(slides[next],carouselItem +'-'+ orientation); - removeClass(slides[next],carouselItem +'-'+ slideDirection); - removeClass(slides[activeItem],carouselItem +'-'+ slideDirection); + removeClass(slides[next],carouselItem +'-'+ orientation); + removeClass(slides[next],carouselItem +'-'+ slideDirection); + removeClass(slides[activeItem],carouselItem +'-'+ slideDirection); - if ( self[interval] && !hasClass(element,paused) ) { - self.cycle(); - } - bootstrapCustomEvent.call(element, slidEvent, component, slides[next]); // here we go with the slid event - }); + bootstrapCustomEvent.call(element, slidEvent, component, slides[next]); + + if ( !document.hidden && self[interval] && !hasClass(element,paused) ) { + self.cycle(); + } + },timeout); + }); } else { addClass(slides[next],active); @@ -602,7 +606,7 @@ if ( self[interval] && !hasClass(element,paused) ) { self.cycle(); } - bootstrapCustomEvent.call(element, slidEvent, component, slides[next]); // here we go with the slid event + bootstrapCustomEvent.call(element, slidEvent, component, slides[next]); }, 100 ); } }; diff --git a/dist/bootstrap-native-v4.min.js b/dist/bootstrap-native-v4.min.js index f32d6a18..fee467ff 100644 --- a/dist/bootstrap-native-v4.min.js +++ b/dist/bootstrap-native-v4.min.js @@ -1,2 +1,2 @@ -// Native Javascript for Bootstrap 4 v2.0.4 | © dnp_theme | MIT-License -!function(t,e){if("function"==typeof define&&define.amd)define([],e);else if("object"==typeof module&&module.exports)module.exports=e();else{var n=e();t.Alert=n.Alert,t.Button=n.Button,t.Carousel=n.Carousel,t.Collapse=n.Collapse,t.Dropdown=n.Dropdown,t.Modal=n.Modal,t.Popover=n.Popover,t.ScrollSpy=n.ScrollSpy,t.Tab=n.Tab,t.Tooltip=n.Tooltip}}(this,function(){var t="undefined"!=typeof global?global:this||window,e=document.documentElement,n=document.body,i="data-toggle",o="data-dismiss",a="data-spy",l="data-ride",r="Alert",c="Button",s="Carousel",u="Collapse",d="Dropdown",f="Modal",h="Popover",p="ScrollSpy",v="Tab",m="Tooltip",g="data-backdrop",T="data-keyboard",b="data-target",y="data-interval",w="data-height",x="data-pause",C="data-original-title",A="data-dismissible",I="data-trigger",L="data-animation",D="data-container",E="data-placement",S="data-delay",k="backdrop",M="keyboard",B="delay",H="content",N="target",W="interval",P="pause",$="animation",j="placement",O="container",z="offsetTop",R="offsetLeft",q="scrollTop",U="scrollLeft",X="clientWidth",Y="clientHeight",F="offsetWidth",G="offsetHeight",J="innerWidth",K="innerHeight",Q="scrollHeight",V="height",Z="aria-expanded",_="aria-hidden",tt="click",et="hover",nt="keydown",it="resize",ot="scroll",at="show",lt="shown",rt="hide",ct="hidden",st="close",ut="closed",dt="slid",ft="slide",ht="change",pt="getAttribute",vt="setAttribute",mt="hasAttribute",gt="getElementsByTagName",Tt="getBoundingClientRect",bt="getElementsByClassName",yt="indexOf",wt="parentNode",xt="length",Ct="toLowerCase",At="Transition",It="Webkit",Lt="style",Dt="active",Et="show",St="collapsing",kt="left",Mt="right",Bt="top",Ht="bottom",Nt="onmouseleave"in document?["mouseenter","mouseleave"]:["mouseover","mouseout"],Wt=/\b(top|bottom|left|top)+/,Pt=It+At in e[Lt]||At[Ct]()in e[Lt],$t=It+At in e[Lt]?It[Ct]()+At+"End":At[Ct]()+"end",jt=function(t){t.focus?t.focus():t.setActive()},Ot=function(t,e){t.classList.add(e)},zt=function(t,e){t.classList.remove(e)},Rt=function(t,e){return t.classList.contains(e)},qt=function(t,e){return[].slice.call(t[bt](e))},Ut=function(t,e){var n=e?e:document;return"object"==typeof t?t:n.querySelector(t)},Xt=function(t,e){for(var n=e.charAt(0);t&&t!==document;t=t[wt]){if(("."===n||"#"!==n)&&null!==Ut(e,t[wt]))return t;if("#"===n&&t.id===e.substr(1))return t}return!1},Yt=function(t,e,n){t.addEventListener(e,n,!1)},Ft=function(t,e,n){t.removeEventListener(e,n,!1)},Gt=function(t,e,n){Yt(t,e,function i(){n(),Ft(t,e,i)})},Jt=function(t,e){Pt?Gt(t,$t,e):e()},Kt=function(t,e,n){var i=new CustomEvent(t+".bs."+e);i.relatedTarget=n,this.dispatchEvent(i)},Qt=document[gt]("*"),Vt=function(t,e,n,i){for(var o=i&&i[xt]?i:Qt,a=0;a-1||l===r)&&new e(o[a])}},Zt=function(e){var n=e&&t.getComputedStyle(e),i=/px/.test(n.borderTopWidth)?Math.round(n.borderTopWidth.replace("px","")):0,o=/px/.test(n.borderBottomWidth)?Math.round(n.borderBottomWidth.replace("px","")):0,a=/px/.test(n.marginTop)?Math.round(n.marginTop.replace("px","")):0,l=/px/.test(n.marginBottom)?Math.round(n.marginBottom.replace("px","")):0;return e[Y]+parseInt(i)+parseInt(o)+parseInt(a)+parseInt(l)},_t=function(t){for(var e=0,n=0,i=t.children[xt];n=0&&i[kt]>=0&&i[Ht]<=(t[K]||e[Y])&&i[Mt]<=(t[J]||e[X])},ee=function(){return{y:t.pageYOffset||e[q],x:t.pageXOffset||e[U]}},ne=function(t,e,i,o){var a=t[Tt](),l=o===n?ee():{x:o[R]+o[U],y:o[z]+o[q]},r={w:a[Mt]-a[kt],h:a[Ht]-a[Bt]},c={w:e[F],h:e[G]};i===Bt?(e[Lt][Bt]=a[Bt]+l.y-c.h+"px",e[Lt][kt]=a[kt]+l.x-c.w/2+r.w/2+"px"):i===Ht?(e[Lt][Bt]=a[Bt]+l.y+r.h+"px",e[Lt][kt]=a[kt]+l.x-c.w/2+r.w/2+"px"):i===kt?(e[Lt][Bt]=a[Bt]+l.y-c.h/2+r.h/2+"px",e[Lt][kt]=a[kt]+l.x-c.w+"px"):i===Mt&&(e[Lt][Bt]=a[Bt]+l.y-c.h/2+r.h/2+"px",e[Lt][kt]=a[kt]+l.x+r.w+"px"),e.className[yt](i)===-1&&(e.className=e.className.replace(Wt,i))},ie=function(t){return t===Bt?Ht:t===Ht?Bt:t===kt?Mt:t===Mt?kt:t},oe=function(t){t=Ut(t);var e=this,n="alert",i=Xt(t,"."+n),a=function(a){var l=a[N];l=l[mt](o)?l:l[wt],l&&l[mt](o)&&(i=Xt(l,"."+n),t=Ut("["+o+'="'+n+'"]',i),(t===l||t===l[wt])&&i&&e.close())},l=function(){Kt.call(i,ut,n),Ft(t,tt,a),i[wt].removeChild(i)};this.close=function(){i&&t&&Rt(i,Et)&&(Kt.call(i,st,n),zt(i,Et),i&&Jt(i,l))},r in t||Yt(t,tt,a),t[r]=this};Vt(r,oe,o);var ae=function(t){t=Ut(t);var e=!1,n="button",i="checked",o="LABEL",a="INPUT",l=function(l){var r=l[N][wt],c=l[N].tagName===o?l[N]:r.tagName===o?r:null;if(c){var s=this,u=qt(s,"btn"),d=c[gt](a)[0];if(d){if("checkbox"===d.type&&(d[i]?(zt(c,Dt),d[pt](i),d.removeAttribute(i),d[i]=!1):(Ot(c,Dt),d[pt](i),d[vt](i,i),d[i]=!0),e||(e=!0,Kt.call(d,ht,n),Kt.call(t,ht,n))),"radio"===d.type&&!e&&!d[i]){Ot(c,Dt),d[vt](i,i),d[i]=!0,Kt.call(d,ht,n),Kt.call(t,ht,n),e=!0;for(var f=0,h=u[xt];fh||n===g-1&&0===h)&&(b=f[c]=Mt),f.slideTo(h)}},S=function(t){if(t.preventDefault(),!v){var e=t.currentTarget||t.srcElement;e===C?(h++,b=f[c]=kt,h===g-1?h=g-1:h===g&&(h=0)):e===w&&(h--,b=f[c]=Mt,0===h?h=0:h<0&&(h=g-1)),f.slideTo(h)}},k=function(t){if(!v){switch(t.which){case 39:h++,b=f[c]=kt,h==g-1?h=g-1:h==g&&(h=0);break;case 37:h--,b=f[c]=Mt,0==h?h=0:h<0&&(h=g-1);break;default:return}f.slideTo(h)}},B=function(t){for(var e=0,n=I[xt];e-1)&&(n.persist||l))return;r=null,p()}(/\#$/.test(u.href)||u[wt]&&/\#$/.test(u[wt].href))&&e.preventDefault()},h=function(){Kt.call(a,at,l,r),Ot(a,Et),c[vt](Z,!0),Kt.call(a,lt,l,r),Yt(document,nt,u),o=!0},p=function(){Kt.call(a,rt,l,r),zt(a,Et),c[vt](Z,!1),Kt.call(a,ct,l,r),Ft(document,nt,u),o=!1};this.toggle=function(){Rt(a,Et)&&o?p():h()},d in t||(c[vt]("tabindex","0"),Yt(document,tt,f)),t[d]=this};Vt(d,ce,i);var se=function(i,a){i=Ut(i);var l=i[pt](b)||i[pt]("href"),r=Ut(l),c=Rt(i,"modal")?i:r,s="modal",u="static",d="paddingLeft",h="paddingRight",p="modal-backdrop";if(Rt(i,"modal")&&(i=null),c){a=a||{},this[M]=a[M]!==!1&&"false"!==c[pt](T),this[k]=a[k]!==u&&c[pt](g)!==u||u,this[k]=a[k]!==!1&&"false"!==c[pt](g)&&this[k],this[H]=a[H];var v,m,y,w,x=this,C=this.open=!1,A=null,I=function(){var n=e[Tt]();return t[J]||n[Mt]-Math.abs(n[kt])},L=function(){var e=n.currentStyle||t.getComputedStyle(n),i=parseInt(e[h],10);v&&(n[Lt][h]=i+y+"px")},D=function(){n[Lt][h]=""},E=function(){var t,e=document.createElement("div");return e.className=s+"-scrollbar-measure",n.appendChild(e),t=e[F]-e[X],n.removeChild(e),t},S=function(){v=n[X]e[Y],y=E()},B=function(){c[Lt][d]=!v&&m?y+"px":"",c[Lt][h]=v&&!m?y+"px":""},W=function(){c[Lt][d]="",c[Lt][h]=""},P=function(){var t=document.createElement("div");w=Ut("."+p),null===w&&(t[vt]("class",p+" fade"),w=t,n.appendChild(w))},$=function(){w=Ut("."+p),w&&null!==w&&"object"==typeof w&&(n.removeChild(w),w=null)},j=function(){Rt(c,Et)?Ft(document,nt,q):Yt(document,nt,q)},O=function(){Rt(c,Et)?Ft(t,it,x.update):Yt(t,it,x.update)},z=function(){Rt(c,Et)?Ft(c,tt,U):Yt(c,tt,U)},R=function(t){var e=t[N];e=e[mt](b)||e[mt]("href")?e:e[wt],C||e!==i||Rt(c,Et)||(c.modalTrigger=i,A=i,x.show(),t.preventDefault())},q=function(t){var e=t.which||t.keyCode;x[M]&&27==e&&C&&x.hide()},U=function(t){var e=t[N];C&&(e[wt][pt](o)===s||e[pt](o)===s||e===c&&x[k]!==u)&&(x.hide(),A=null,t.preventDefault())};this.toggle=function(){C&&Rt(c,Et)?this.hide():this.show()},this.show=function(){Kt.call(c,at,s,A);var t=qt(document,s+" "+Et)[0];t&&t!==c&&t.modalTrigger[f].hide(),this[k]&&P(),w&&!Rt(w,Et)&&setTimeout(function(){Ot(w,Et)},0),setTimeout(function(){c[Lt].display="block",S(),L(),B(),O(),z(),j(),Ot(n,s+"-open"),Ot(c,Et),c[vt](_,!1)},0),Jt(c,function(){C=x.open=!0,jt(c),Kt.call(c,lt,s,A)})},this.hide=function(){Kt.call(c,rt,s),w=Ut("."+p),null!==w&&zt(w,Et),zt(c,Et),c[vt](_,!0),Jt(c,function(){zt(n,s+"-open"),O(),z(),j(),W(),D(),c[Lt].display="",qt(document,s+" "+Et)[0]||$(),C=x.open=!1,i&&jt(i),Kt.call(c,ct,s)})},this.setContent=function(t){Ut("."+s+"-content",c).innerHTML=t},this.update=function(){C&&(S(),L(),B())},!i||f in i||Yt(i,tt,R),this[H]&&this.setContent(this[H]),!!i&&(i[f]=this)}};Vt(f,se,i);var ue=function(e,i){e=Ut(e);var o=e[pt](I),a=e[pt](L),l=e[pt](E),r=e[pt](A),c=e[pt](S),s=e[pt](D),u="popover",d="template",f="trigger",p="class",v="div",m="fade",g="data-title",T="data-content",b="dismissible",y='';i=i||{},this[d]=i[d]?i[d]:null,this[f]=i[f]?i[f]:o||et,this[$]=i[$]&&i[$]!==m?i[$]:a||m,this[j]=i[j]?i[j]:l||Bt,this[B]=parseInt(i[B]||c)||200,this[b]=!(!i[b]&&"true"!==r),this[O]=Ut(i[O])||Ut(s)||n;var w=this,x=e[pt](g)||null,C=e[pt](T)||null;if(C||this[d]){var k=null,M=0,H=this[j],W=function(t){null!==k&&t[N]===Ut(".close",k)&&w.hide()},P=function(){w[O].removeChild(k),M=null,k=null},z=function(){if(x=e[pt](g),C=e[pt](T),k=document.createElement(v),null!==C&&null===w[d]){if(k[vt]("role","tooltip"),null!==x){var t=document.createElement("h3");t[vt](p,u+"-title"),t.innerHTML=w[b]?x+y:x,k.appendChild(t)}var n=document.createElement(v);n[vt](p,u+"-content"),n.innerHTML=w[b]&&null===x?C+y:C,k.appendChild(n)}else{var i=document.createElement(v);i.innerHTML=w[d],k.innerHTML=i.firstChild.innerHTML}w[O].appendChild(k),k[Lt].display="block",k[vt](p,u+" "+u+"-"+H+" "+w[$])},R=function(){!Rt(k,Et)&&Ot(k,Et)},q=function(){ne(e,k,H,w[O]),te(k)||(H=ie(H),ne(e,k,H,w[O]))};this.toggle=function(){null===k?w.show():w.hide()},this.show=function(){clearTimeout(M),M=setTimeout(function(){null===k&&(H=w[j],z(),q(),R(),Kt.call(e,at,u),Jt(k,function(){Kt.call(e,lt,u)}))},20)},this.hide=function(){clearTimeout(M),M=setTimeout(function(){k&&null!==k&&Rt(k,Et)&&(Kt.call(e,rt,u),zt(k,Et),Jt(k,function(){P(),Kt.call(e,ct,u)}))},w[B])},h in e||(w[f]===et?(Yt(e,Nt[0],w.show),w[b]||Yt(e,Nt[1],w.hide)):/^(click|focus)$/.test(w[f])&&(Yt(e,w[f],w.toggle),w[b]||Yt(e,"blur",w.hide)),w[b]&&Yt(document,tt,W),Yt(t,it,w.hide)),e[h]=w}};Vt(h,ue,i);var de=function(e,n){e=Ut(e);var i=Ut(e[pt](b));if(n=n||{},n[N]||i){for(var o,a=n[N]&&Ut(n[N])||i,l=a&&a[gt]("A"),r=[],c=[],s=e[G]=f&&h>o;if(!d&&p)Rt(n,Dt)||(Ot(n,Dt),d=!0,l&&!Rt(l,Dt)&&Ot(l,Dt),Kt.call(e,"activate","scrollspy",r[t]));else if(p){if(!p&&!d||d&&p)return}else Rt(n,Dt)&&(zt(n,Dt),d=!1,l&&Rt(l,Dt)&&!qt(n[wt],Dt).length&&zt(l,Dt))},g=function(){o=u?ee().y:e[q];for(var t=0,n=r[xt];t1&&(t=e[e[xt]-1]):t=e[0],t},f=function(){return Ut(d()[pt]("href"))},h=function(t){t.preventDefault(),l=t[N],c.show()};this.show=function(){var e=Ut(l[pt]("href")),n=d(),c=f();n[a]&&l[a]||Rt(l,Dt)||(n[a]=l[a]=!0,zt(n,Dt),Ot(l,Dt),u&&(Rt(t[wt],"dropdown-menu")?Rt(u,Dt)||Ot(u,Dt):Rt(u,Dt)&&zt(u,Dt)),r&&(r[Lt][o]=_t(c)+"px"),Kt.call(n,rt,i,l),setTimeout(function(){zt(c,Et)},0),Jt(c,function(){r&&Ot(r,St),zt(c,Dt),Ot(e,Dt),setTimeout(function(){Ot(e,Et),r&&(r[Lt][o]=_t(e)+"px")},0),Kt.call(l,at,i,n),Kt.call(n,ct,i,l)}),Jt(e,function(){Kt.call(l,lt,i,n),r?setTimeout(function(){Jt(r,function(){r[Lt][o]="",zt(r,St),n[a]=l[a]=!1})},0):n[a]=l[a]=!1}))},v in t||Yt(t,tt,h),this[o]&&(r=f()[wt]),t[v]=this};Vt(v,fe,i);var he=function(t,e){t=Ut(t);var i=t[pt](L);placementData=t[pt](E),delayData=t[pt](S),containerData=t[pt](D),component="tooltip",classString="class",title="title",fade="fade",div="div",e=e||{},this[$]=e[$]&&e[$]!==fade?e[$]:i||fade,this[j]=e[j]?e[j]:placementData||Bt,this[B]=parseInt(e[B]||delayData)||200,this[O]=Ut(e[O])||Ut(containerData)||n;var o=this,a=0,l=this[j],r=null,c=t[pt](title)||t[pt](C);if(c){var s=function(){o[O].removeChild(r),r=null,a=null},u=function(){c=t[pt](title)||t[pt](C),r=document.createElement(div),r[vt]("role",component);var e=document.createElement(div);e[vt](classString,component+"-inner"),r.appendChild(e),e.innerHTML=c,o[O].appendChild(r),r[vt](classString,component+" "+component+"-"+l+" "+o[$])},d=function(){ne(t,r,l,o[O]),te(r)||(l=ie(l),ne(t,r,l,o[O]))},f=function(){!Rt(r,Et)&&Ot(r,Et)};this.show=function(){clearTimeout(a),a=setTimeout(function(){null===r&&(l=o[j],u(),d(),f(),Kt.call(t,at,component),Jt(r,function(){Kt.call(t,lt,component)}))},20)},this.hide=function(){clearTimeout(a),a=setTimeout(function(){r&&null!==r&&Rt(r,Et)&&(Kt.call(t,rt,component),zt(r,Et),Jt(r,function(){s(),Kt.call(t,ct,component)}))},o[B])},this.toggle=function(){r?o.hide():o.show()},m in t||(t[vt](C,c),t.removeAttribute(title),Yt(t,Nt[0],this.show),Yt(t,Nt[1],this.hide)),t[m]=this}};return Vt(m,he,i),{Alert:oe,Button:ae,Carousel:le,Collapse:re,Dropdown:ce,Modal:se,Popover:ue,ScrollSpy:de,Tab:fe,Tooltip:he}}); +// Native Javascript for Bootstrap 4 v2.0.5 | © dnp_theme | MIT-License +!function(t,e){if("function"==typeof define&&define.amd)define([],e);else if("object"==typeof module&&module.exports)module.exports=e();else{var n=e();t.Alert=n.Alert,t.Button=n.Button,t.Carousel=n.Carousel,t.Collapse=n.Collapse,t.Dropdown=n.Dropdown,t.Modal=n.Modal,t.Popover=n.Popover,t.ScrollSpy=n.ScrollSpy,t.Tab=n.Tab,t.Tooltip=n.Tooltip}}(this,function(){var t="undefined"!=typeof global?global:this||window,e=document.documentElement,n=document.body,i="data-toggle",o="data-dismiss",a="data-spy",l="data-ride",r="Alert",c="Button",s="Carousel",u="Collapse",d="Dropdown",f="Modal",h="Popover",p="ScrollSpy",m="Tab",v="Tooltip",g="data-backdrop",T="data-keyboard",b="data-target",y="data-interval",w="data-height",x="data-pause",C="data-original-title",A="data-dismissible",I="data-trigger",L="data-animation",D="data-container",E="data-placement",S="data-delay",k="backdrop",M="keyboard",B="delay",H="content",N="target",W="interval",P="pause",$="animation",j="placement",O="container",z="offsetTop",R="offsetLeft",q="scrollTop",U="scrollLeft",X="clientWidth",Y="clientHeight",F="offsetWidth",G="offsetHeight",J="innerWidth",K="innerHeight",Q="scrollHeight",V="height",Z="aria-expanded",_="aria-hidden",tt="click",et="hover",nt="keydown",it="resize",ot="scroll",at="show",lt="shown",rt="hide",ct="hidden",st="close",ut="closed",dt="slid",ft="slide",ht="change",pt="getAttribute",mt="setAttribute",vt="hasAttribute",gt="getElementsByTagName",Tt="getBoundingClientRect",bt="getElementsByClassName",yt="indexOf",wt="parentNode",xt="length",Ct="toLowerCase",At="Transition",It="Webkit",Lt="style",Dt="active",Et="show",St="collapsing",kt="left",Mt="right",Bt="top",Ht="bottom",Nt="onmouseleave"in document?["mouseenter","mouseleave"]:["mouseover","mouseout"],Wt=/\b(top|bottom|left|top)+/,Pt=It+At in e[Lt]||At[Ct]()in e[Lt],$t=It+At in e[Lt]?It[Ct]()+At+"End":At[Ct]()+"end",jt=function(t){t.focus?t.focus():t.setActive()},Ot=function(t,e){t.classList.add(e)},zt=function(t,e){t.classList.remove(e)},Rt=function(t,e){return t.classList.contains(e)},qt=function(t,e){return[].slice.call(t[bt](e))},Ut=function(t,e){var n=e?e:document;return"object"==typeof t?t:n.querySelector(t)},Xt=function(t,e){for(var n=e.charAt(0);t&&t!==document;t=t[wt]){if(("."===n||"#"!==n)&&null!==Ut(e,t[wt]))return t;if("#"===n&&t.id===e.substr(1))return t}return!1},Yt=function(t,e,n){t.addEventListener(e,n,!1)},Ft=function(t,e,n){t.removeEventListener(e,n,!1)},Gt=function(t,e,n){Yt(t,e,function i(o){n(o),Ft(t,e,i)})},Jt=function(t,e){Pt?Gt(t,$t,e):e()},Kt=function(t,e,n){var i=new CustomEvent(t+".bs."+e);i.relatedTarget=n,this.dispatchEvent(i)},Qt=document[gt]("*"),Vt=function(t,e,n,i){for(var o=i&&i[xt]?i:Qt,a=0;a-1||l===r)&&new e(o[a])}},Zt=function(e){var n=e&&t.getComputedStyle(e),i=/px/.test(n.borderTopWidth)?Math.round(n.borderTopWidth.replace("px","")):0,o=/px/.test(n.borderBottomWidth)?Math.round(n.borderBottomWidth.replace("px","")):0,a=/px/.test(n.marginTop)?Math.round(n.marginTop.replace("px","")):0,l=/px/.test(n.marginBottom)?Math.round(n.marginBottom.replace("px","")):0;return e[Y]+parseInt(i)+parseInt(o)+parseInt(a)+parseInt(l)},_t=function(t){for(var e=0,n=0,i=t.children[xt];n=0&&i[kt]>=0&&i[Ht]<=(t[K]||e[Y])&&i[Mt]<=(t[J]||e[X])},ee=function(){return{y:t.pageYOffset||e[q],x:t.pageXOffset||e[U]}},ne=function(t,e,i,o){var a=t[Tt](),l=o===n?ee():{x:o[R]+o[U],y:o[z]+o[q]},r={w:a[Mt]-a[kt],h:a[Ht]-a[Bt]},c={w:e[F],h:e[G]};i===Bt?(e[Lt][Bt]=a[Bt]+l.y-c.h+"px",e[Lt][kt]=a[kt]+l.x-c.w/2+r.w/2+"px"):i===Ht?(e[Lt][Bt]=a[Bt]+l.y+r.h+"px",e[Lt][kt]=a[kt]+l.x-c.w/2+r.w/2+"px"):i===kt?(e[Lt][Bt]=a[Bt]+l.y-c.h/2+r.h/2+"px",e[Lt][kt]=a[kt]+l.x-c.w+"px"):i===Mt&&(e[Lt][Bt]=a[Bt]+l.y-c.h/2+r.h/2+"px",e[Lt][kt]=a[kt]+l.x+r.w+"px"),e.className[yt](i)===-1&&(e.className=e.className.replace(Wt,i))},ie=function(t){return t===Bt?Ht:t===Ht?Bt:t===kt?Mt:t===Mt?kt:t},oe=function(t){t=Ut(t);var e=this,n="alert",i=Xt(t,"."+n),a=function(a){var l=a[N];l=l[vt](o)?l:l[wt],l&&l[vt](o)&&(i=Xt(l,"."+n),t=Ut("["+o+'="'+n+'"]',i),(t===l||t===l[wt])&&i&&e.close())},l=function(){Kt.call(i,ut,n),Ft(t,tt,a),i[wt].removeChild(i)};this.close=function(){i&&t&&Rt(i,Et)&&(Kt.call(i,st,n),zt(i,Et),i&&Jt(i,l))},r in t||Yt(t,tt,a),t[r]=this};Vt(r,oe,o);var ae=function(t){t=Ut(t);var e=!1,n="button",i="checked",o="LABEL",a="INPUT",l=function(l){var r=l[N][wt],c=l[N].tagName===o?l[N]:r.tagName===o?r:null;if(c){var s=this,u=qt(s,"btn"),d=c[gt](a)[0];if(d){if("checkbox"===d.type&&(d[i]?(zt(c,Dt),d[pt](i),d.removeAttribute(i),d[i]=!1):(Ot(c,Dt),d[pt](i),d[mt](i,i),d[i]=!0),e||(e=!0,Kt.call(d,ht,n),Kt.call(t,ht,n))),"radio"===d.type&&!e&&!d[i]){Ot(c,Dt),d[mt](i,i),d[i]=!0,Kt.call(d,ht,n),Kt.call(t,ht,n),e=!0;for(var f=0,h=u[xt];fh||n===g-1&&0===h)&&(b=f[c]=Mt),f.slideTo(h)}},S=function(t){if(t.preventDefault(),!m){var e=t.currentTarget||t.srcElement;e===C?(h++,b=f[c]=kt,h===g-1?h=g-1:h===g&&(h=0)):e===w&&(h--,b=f[c]=Mt,0===h?h=0:h<0&&(h=g-1)),f.slideTo(h)}},k=function(t){if(!m){switch(t.which){case 39:h++,b=f[c]=kt,h==g-1?h=g-1:h==g&&(h=0);break;case 37:h--,b=f[c]=Mt,0==h?h=0:h<0&&(h=g-1);break;default:return}f.slideTo(h)}},B=function(t){for(var e=0,n=I[xt];e-1)&&(n.persist||l))return;r=null,p()}(/\#$/.test(u.href)||u[wt]&&/\#$/.test(u[wt].href))&&e.preventDefault()},h=function(){Kt.call(a,at,l,r),Ot(a,Et),c[mt](Z,!0),Kt.call(a,lt,l,r),Yt(document,nt,u),o=!0},p=function(){Kt.call(a,rt,l,r),zt(a,Et),c[mt](Z,!1),Kt.call(a,ct,l,r),Ft(document,nt,u),o=!1};this.toggle=function(){Rt(a,Et)&&o?p():h()},d in t||(c[mt]("tabindex","0"),Yt(document,tt,f)),t[d]=this};Vt(d,ce,i);var se=function(i,a){i=Ut(i);var l=i[pt](b)||i[pt]("href"),r=Ut(l),c=Rt(i,"modal")?i:r,s="modal",u="static",d="paddingLeft",h="paddingRight",p="modal-backdrop";if(Rt(i,"modal")&&(i=null),c){a=a||{},this[M]=a[M]!==!1&&"false"!==c[pt](T),this[k]=a[k]!==u&&c[pt](g)!==u||u,this[k]=a[k]!==!1&&"false"!==c[pt](g)&&this[k],this[H]=a[H];var m,v,y,w,x=this,C=this.open=!1,A=null,I=function(){var n=e[Tt]();return t[J]||n[Mt]-Math.abs(n[kt])},L=function(){var e=n.currentStyle||t.getComputedStyle(n),i=parseInt(e[h],10);m&&(n[Lt][h]=i+y+"px")},D=function(){n[Lt][h]=""},E=function(){var t,e=document.createElement("div");return e.className=s+"-scrollbar-measure",n.appendChild(e),t=e[F]-e[X],n.removeChild(e),t},S=function(){m=n[X]e[Y],y=E()},B=function(){c[Lt][d]=!m&&v?y+"px":"",c[Lt][h]=m&&!v?y+"px":""},W=function(){c[Lt][d]="",c[Lt][h]=""},P=function(){var t=document.createElement("div");w=Ut("."+p),null===w&&(t[mt]("class",p+" fade"),w=t,n.appendChild(w))},$=function(){w=Ut("."+p),w&&null!==w&&"object"==typeof w&&(n.removeChild(w),w=null)},j=function(){Rt(c,Et)?Ft(document,nt,q):Yt(document,nt,q)},O=function(){Rt(c,Et)?Ft(t,it,x.update):Yt(t,it,x.update)},z=function(){Rt(c,Et)?Ft(c,tt,U):Yt(c,tt,U)},R=function(t){var e=t[N];e=e[vt](b)||e[vt]("href")?e:e[wt],C||e!==i||Rt(c,Et)||(c.modalTrigger=i,A=i,x.show(),t.preventDefault())},q=function(t){var e=t.which||t.keyCode;x[M]&&27==e&&C&&x.hide()},U=function(t){var e=t[N];C&&(e[wt][pt](o)===s||e[pt](o)===s||e===c&&x[k]!==u)&&(x.hide(),A=null,t.preventDefault())};this.toggle=function(){C&&Rt(c,Et)?this.hide():this.show()},this.show=function(){Kt.call(c,at,s,A);var t=qt(document,s+" "+Et)[0];t&&t!==c&&t.modalTrigger[f].hide(),this[k]&&P(),w&&!Rt(w,Et)&&setTimeout(function(){Ot(w,Et)},0),setTimeout(function(){c[Lt].display="block",S(),L(),B(),O(),z(),j(),Ot(n,s+"-open"),Ot(c,Et),c[mt](_,!1)},0),Jt(c,function(){C=x.open=!0,jt(c),Kt.call(c,lt,s,A)})},this.hide=function(){Kt.call(c,rt,s),w=Ut("."+p),null!==w&&zt(w,Et),zt(c,Et),c[mt](_,!0),Jt(c,function(){zt(n,s+"-open"),O(),z(),j(),W(),D(),c[Lt].display="",qt(document,s+" "+Et)[0]||$(),C=x.open=!1,i&&jt(i),Kt.call(c,ct,s)})},this.setContent=function(t){Ut("."+s+"-content",c).innerHTML=t},this.update=function(){C&&(S(),L(),B())},!i||f in i||Yt(i,tt,R),this[H]&&this.setContent(this[H]),!!i&&(i[f]=this)}};Vt(f,se,i);var ue=function(e,i){e=Ut(e);var o=e[pt](I),a=e[pt](L),l=e[pt](E),r=e[pt](A),c=e[pt](S),s=e[pt](D),u="popover",d="template",f="trigger",p="class",m="div",v="fade",g="data-title",T="data-content",b="dismissible",y='';i=i||{},this[d]=i[d]?i[d]:null,this[f]=i[f]?i[f]:o||et,this[$]=i[$]&&i[$]!==v?i[$]:a||v,this[j]=i[j]?i[j]:l||Bt,this[B]=parseInt(i[B]||c)||200,this[b]=!(!i[b]&&"true"!==r),this[O]=Ut(i[O])||Ut(s)||n;var w=this,x=e[pt](g)||null,C=e[pt](T)||null;if(C||this[d]){var k=null,M=0,H=this[j],W=function(t){null!==k&&t[N]===Ut(".close",k)&&w.hide()},P=function(){w[O].removeChild(k),M=null,k=null},z=function(){if(x=e[pt](g),C=e[pt](T),k=document.createElement(m),null!==C&&null===w[d]){if(k[mt]("role","tooltip"),null!==x){var t=document.createElement("h3");t[mt](p,u+"-title"),t.innerHTML=w[b]?x+y:x,k.appendChild(t)}var n=document.createElement(m);n[mt](p,u+"-content"),n.innerHTML=w[b]&&null===x?C+y:C,k.appendChild(n)}else{var i=document.createElement(m);i.innerHTML=w[d],k.innerHTML=i.firstChild.innerHTML}w[O].appendChild(k),k[Lt].display="block",k[mt](p,u+" "+u+"-"+H+" "+w[$])},R=function(){!Rt(k,Et)&&Ot(k,Et)},q=function(){ne(e,k,H,w[O]),te(k)||(H=ie(H),ne(e,k,H,w[O]))};this.toggle=function(){null===k?w.show():w.hide()},this.show=function(){clearTimeout(M),M=setTimeout(function(){null===k&&(H=w[j],z(),q(),R(),Kt.call(e,at,u),Jt(k,function(){Kt.call(e,lt,u)}))},20)},this.hide=function(){clearTimeout(M),M=setTimeout(function(){k&&null!==k&&Rt(k,Et)&&(Kt.call(e,rt,u),zt(k,Et),Jt(k,function(){P(),Kt.call(e,ct,u)}))},w[B])},h in e||(w[f]===et?(Yt(e,Nt[0],w.show),w[b]||Yt(e,Nt[1],w.hide)):/^(click|focus)$/.test(w[f])&&(Yt(e,w[f],w.toggle),w[b]||Yt(e,"blur",w.hide)),w[b]&&Yt(document,tt,W),Yt(t,it,w.hide)),e[h]=w}};Vt(h,ue,i);var de=function(e,n){e=Ut(e);var i=Ut(e[pt](b));if(n=n||{},n[N]||i){for(var o,a=n[N]&&Ut(n[N])||i,l=a&&a[gt]("A"),r=[],c=[],s=e[G]=f&&h>o;if(!d&&p)Rt(n,Dt)||(Ot(n,Dt),d=!0,l&&!Rt(l,Dt)&&Ot(l,Dt),Kt.call(e,"activate","scrollspy",r[t]));else if(p){if(!p&&!d||d&&p)return}else Rt(n,Dt)&&(zt(n,Dt),d=!1,l&&Rt(l,Dt)&&!qt(n[wt],Dt).length&&zt(l,Dt))},g=function(){o=u?ee().y:e[q];for(var t=0,n=r[xt];t1&&(t=e[e[xt]-1]):t=e[0],t},f=function(){return Ut(d()[pt]("href"))},h=function(t){t.preventDefault(),l=t[N],c.show()};this.show=function(){var e=Ut(l[pt]("href")),n=d(),c=f();n[a]&&l[a]||Rt(l,Dt)||(n[a]=l[a]=!0,zt(n,Dt),Ot(l,Dt),u&&(Rt(t[wt],"dropdown-menu")?Rt(u,Dt)||Ot(u,Dt):Rt(u,Dt)&&zt(u,Dt)),r&&(r[Lt][o]=_t(c)+"px"),Kt.call(n,rt,i,l),setTimeout(function(){zt(c,Et)},0),Jt(c,function(){r&&Ot(r,St),zt(c,Dt),Ot(e,Dt),setTimeout(function(){Ot(e,Et),r&&(r[Lt][o]=_t(e)+"px")},0),Kt.call(l,at,i,n),Kt.call(n,ct,i,l)}),Jt(e,function(){Kt.call(l,lt,i,n),r?setTimeout(function(){Jt(r,function(){r[Lt][o]="",zt(r,St),n[a]=l[a]=!1})},0):n[a]=l[a]=!1}))},m in t||Yt(t,tt,h),this[o]&&(r=f()[wt]),t[m]=this};Vt(m,fe,i);var he=function(t,e){t=Ut(t);var i=t[pt](L);placementData=t[pt](E),delayData=t[pt](S),containerData=t[pt](D),component="tooltip",classString="class",title="title",fade="fade",div="div",e=e||{},this[$]=e[$]&&e[$]!==fade?e[$]:i||fade,this[j]=e[j]?e[j]:placementData||Bt,this[B]=parseInt(e[B]||delayData)||200,this[O]=Ut(e[O])||Ut(containerData)||n;var o=this,a=0,l=this[j],r=null,c=t[pt](title)||t[pt](C);if(c){var s=function(){o[O].removeChild(r),r=null,a=null},u=function(){c=t[pt](title)||t[pt](C),r=document.createElement(div),r[mt]("role",component);var e=document.createElement(div);e[mt](classString,component+"-inner"),r.appendChild(e),e.innerHTML=c,o[O].appendChild(r),r[mt](classString,component+" "+component+"-"+l+" "+o[$])},d=function(){ne(t,r,l,o[O]),te(r)||(l=ie(l),ne(t,r,l,o[O]))},f=function(){!Rt(r,Et)&&Ot(r,Et)};this.show=function(){clearTimeout(a),a=setTimeout(function(){null===r&&(l=o[j],u(),d(),f(),Kt.call(t,at,component),Jt(r,function(){Kt.call(t,lt,component)}))},20)},this.hide=function(){clearTimeout(a),a=setTimeout(function(){r&&null!==r&&Rt(r,Et)&&(Kt.call(t,rt,component),zt(r,Et),Jt(r,function(){s(),Kt.call(t,ct,component)}))},o[B])},this.toggle=function(){r?o.hide():o.show()},v in t||(t[mt](C,c),t.removeAttribute(title),Yt(t,Nt[0],this.show),Yt(t,Nt[1],this.hide)),t[v]=this}};return Vt(v,he,i),{Alert:oe,Button:ae,Carousel:le,Collapse:re,Dropdown:ce,Modal:se,Popover:ue,ScrollSpy:de,Tab:fe,Tooltip:he}}); diff --git a/dist/bootstrap-native.js b/dist/bootstrap-native.js index c876ddae..7c85c3e3 100644 --- a/dist/bootstrap-native.js +++ b/dist/bootstrap-native.js @@ -1,4 +1,4 @@ -// Native Javascript for Bootstrap 3 v2.0.4 | © dnp_theme | MIT-License +// Native Javascript for Bootstrap 3 v2.0.5 | © dnp_theme | MIT-License (function (root, factory) { if (typeof define === 'function' && define.amd) { // AMD support: @@ -193,8 +193,8 @@ element.removeEventListener(event, handler, false); }, one = function (element, event, handler) { // one since 2.0.4 - on(element, event, function handlerWrapper(){ - handler(); + on(element, event, function handlerWrapper(e){ + handler(e); off(element, event, handlerWrapper); }); }, @@ -737,27 +737,32 @@ setActivePage( next ); if ( supportTransitions && hasClass(element,'slide') ) { + addClass(slides[next],orientation); - slides[next][offsetWidth]; + slides[next][offsetWidth]; addClass(slides[next],slideDirection); addClass(slides[activeItem],slideDirection); - one(slides[next], transitionEndEvent, function() { //we're gonna fake waiting for the animation to finish, cleaner and better - isSliding = self.isSliding = false; + one(slides[activeItem], transitionEndEvent, function(e) { + var timeout = e[target] !== slides[activeItem] ? e.elapsedTime*1000 : 0; + setTimeout(function(){ + isSliding = self.isSliding = false; - addClass(slides[next],active); - removeClass(slides[activeItem],active); + addClass(slides[next],active); + removeClass(slides[activeItem],active); - removeClass(slides[next],orientation); - removeClass(slides[next],slideDirection); - removeClass(slides[activeItem],slideDirection); + removeClass(slides[next],orientation); + removeClass(slides[next],slideDirection); + removeClass(slides[activeItem],slideDirection); - if ( self[interval] && !hasClass(element,paused) ) { - self.cycle(); - } - bootstrapCustomEvent.call(element, slidEvent, component, slides[next]); // here we go with the slid event + bootstrapCustomEvent.call(element, slidEvent, component, slides[next]); + + if ( self[interval] && !hasClass(element,paused) ) { + self.cycle(); + } + },timeout); }); - + } else { addClass(slides[next],active); slides[next][offsetWidth]; diff --git a/dist/bootstrap-native.min.js b/dist/bootstrap-native.min.js index 2f060bde..65786b47 100644 --- a/dist/bootstrap-native.min.js +++ b/dist/bootstrap-native.min.js @@ -1,2 +1,2 @@ -// Native Javascript for Bootstrap 3 v2.0.4 | © dnp_theme | MIT-License -!function(t,e){if("function"==typeof define&&define.amd)define([],e);else if("object"==typeof module&&module.exports)module.exports=e();else{var n=e();t.Affix=n.Affix,t.Alert=n.Alert,t.Button=n.Button,t.Carousel=n.Carousel,t.Collapse=n.Collapse,t.Dropdown=n.Dropdown,t.Modal=n.Modal,t.Popover=n.Popover,t.ScrollSpy=n.ScrollSpy,t.Tab=n.Tab,t.Tooltip=n.Tooltip}}(this,function(){var t="undefined"!=typeof global?global:this||window,e=document.documentElement,n=document.body,i=null!=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})").exec(navigator.userAgent)&&parseFloat(RegExp.$1),o="data-toggle",a="data-dismiss",l="data-spy",r="data-ride",c="Affix",u="Alert",s="Button",f="Carousel",d="Collapse",h="Dropdown",p="Modal",m="Popover",v="ScrollSpy",g="Tab",x="Tooltip",T="data-backdrop",b="data-keyboard",y="data-target",w="data-interval",C="data-height",I="data-pause",A="data-original-title",L="data-original-text",E="data-dismissible",M="data-trigger",S="data-animation",D="data-container",k="data-placement",H="data-delay",B="data-offset-top",N="data-offset-bottom",W="backdrop",$="keyboard",P="delay",R="duration",j="content",z="target",O="interval",q="pause",F="animation",U="placement",X="container",Y="offsetTop",G="offsetBottom",J="offsetLeft",K="scrollTop",Q="scrollLeft",V="clientWidth",Z="clientHeight",_="offsetWidth",tt="offsetHeight",et="innerWidth",nt="innerHeight",it="scrollHeight",ot="height",at="aria-expanded",lt="aria-hidden",rt="click",ct="hover",ut="keydown",st="resize",ft="scroll",dt="show",ht="shown",pt="hide",mt="hidden",vt="close",gt="closed",xt="slid",Tt="slide",bt="change",yt="getAttribute",wt="setAttribute",Ct="hasAttribute",It="getElementsByTagName",At="getBoundingClientRect",Lt="querySelectorAll",Et="getElementsByClassName",Mt="indexOf",St="parentNode",Dt="length",kt="toLowerCase",Ht="Transition",Bt="Webkit",Nt="style",Wt="active",$t="in",Pt="collapsing",Rt="disabled",jt="loading",zt="left",Ot="right",qt="top",Ft="bottom",Ut="onmouseleave"in document?["mouseenter","mouseleave"]:["mouseover","mouseout"],Xt=/\b(top|bottom|left|top)+/,Yt=Bt+Ht in e[Nt]||Ht[kt]()in e[Nt],Gt=Bt+Ht in e[Nt]?Bt[kt]()+Ht+"End":Ht[kt]()+"end",Jt=function(t){t.focus?t.focus():t.setActive()},Kt=function(t,e){t.classList.add(e)},Qt=function(t,e){t.classList.remove(e)},Vt=function(t,e){return t.classList.contains(e)},Zt=function(t){for(var e=[],n=0,i=t[Dt];n-1||l===r)&&new e(o[a])}},ue=function(e){var n=e&&(e.currentStyle||t.getComputedStyle(e)),i=/px/.test(n.borderTopWidth)?Math.round(n.borderTopWidth.replace("px","")):0,o=/px/.test(n.borderBottomWidth)?Math.round(n.borderBottomWidth.replace("px","")):0,a=/px/.test(n.marginTop)?Math.round(n.marginTop.replace("px","")):0,l=/px/.test(n.marginBottom)?Math.round(n.marginBottom.replace("px","")):0;return e[Z]+parseInt(i)+parseInt(o)+parseInt(a)+parseInt(l)},se=function(t){for(var e=0,n=0,i=t.children[Dt];n=0&&i[zt]>=0&&i[Ft]<=(t[nt]||e[Z])&&i[Ot]<=(t[et]||e[V])},de=function(){return{y:t.pageYOffset||e[K],x:t.pageXOffset||e[Q]}},he=function(t,e,i,o){var a=t[At](),l=o===n?de():{x:o[J]+o[Q],y:o[Y]+o[K]},r={w:a[Ot]-a[zt],h:a[Ft]-a[qt]},c={w:e[_],h:e[tt]};i===qt?(e[Nt][qt]=a[qt]+l.y-c.h+"px",e[Nt][zt]=a[zt]+l.x-c.w/2+r.w/2+"px"):i===Ft?(e[Nt][qt]=a[qt]+l.y+r.h+"px",e[Nt][zt]=a[zt]+l.x-c.w/2+r.w/2+"px"):i===zt?(e[Nt][qt]=a[qt]+l.y-c.h/2+r.h/2+"px",e[Nt][zt]=a[zt]+l.x-c.w+"px"):i===Ot&&(e[Nt][qt]=a[qt]+l.y-c.h/2+r.h/2+"px",e[Nt][zt]=a[zt]+l.x+r.w+"px"),e.className[Mt](i)===-1&&(e.className=e.className.replace(Xt,i))},pe=function(t){return t===qt?Ft:t===Ft?qt:t===zt?Ot:t===Ot?zt:t},me=function(o,a){o=te(o),a=a||{};var l=o[yt](y),r=o[yt](B),u=o[yt](N),s="affix",f="affixed",d="function",h="update",p="affix-top",m="affixed-top",v="affix-bottom",g="affixed-bottom";if(this[z]=a[z]?te(a[z]):te(l)||null,this[Y]=a[Y]?a[Y]:parseInt(r)||0,this[G]=a[G]?a[G]:parseInt(u)||0,this[z]||this[Y]||this[G]){var x,T,b,w,C,I,A=this,L=i&&i<10?500:50,E=!1,M=!1,S=function(){return Math.max(n[it],n[tt],e[Z],e[it],e[tt])},D=function(){return null!==A[z]?A[z][At]()[qt]+w:A[Y]?parseInt(typeof A[Y]===d?A[Y]():A[Y]||0):void 0},k=function(){if(A[G])return b-o[tt]-parseInt(typeof A[G]===d?A[G]():A[G]||0)},H=function(){b=S(),w=parseInt(de().y,0),x=D(),T=k(),C=parseInt(x)-w<0&&w>parseInt(x),I=parseInt(T)-w<0&&w>parseInt(T)},W=function(){E||Vt(o,s)||(le.call(o,s,s),le.call(o,p,s),Kt(o,s),E=!0,le.call(o,f,s),le.call(o,m,s))},$=function(){E&&Vt(o,s)&&(Qt(o,s),E=!1)},P=function(){M||Vt(o,v)||(le.call(o,s,s),le.call(o,v,s),Kt(o,v),M=!0,le.call(o,f,s),le.call(o,g,s))},R=function(){M&&Vt(o,v)&&(Qt(o,v),M=!1)},j=function(){I?(C&&$(),P()):(R(),C?W():$())};this[h]=function(){H(),j()},c in o||(ne(t,ft,this[h]),ne(t,st,function(){setTimeout(function(){A[h]()},L)})),o[c]=this,this[h]()}};ce(c,me,l);var ve=function(t){t=te(t);var e=this,n="alert",i=ee(t,"."+n),o=function(o){var l=o[z];l=l[Ct](a)?l:l[St],l&&l[Ct](a)&&(i=ee(l,"."+n),t=te("["+a+'="'+n+'"]',i),(t===l||t===l[St])&&i&&e.close())},l=function(){le.call(i,gt,n),ie(t,rt,o),i[St].removeChild(i)};this.close=function(){i&&t&&Vt(i,$t)&&(le.call(i,vt,n),Qt(i,$t),setTimeout(function(){i&&ae(i,l)},R))},u in t||ne(t,rt,o),t[u]=this};ce(u,ve,a);var ge=function(t,e){t=te(t),e=e||null;var n=!1,i="button",o="checked",a="reset",l="LABEL",r="INPUT",c=function(){e&&e!==a&&(e===jt&&(Kt(t,Rt),t[wt](Rt,Rt)),t[wt](L,t.innerHTML.replace(/^\s+|\s+$/g,"")),t.innerHTML=t[yt]("data-"+e+"-text"))},u=function(){t[yt](L)&&((Vt(t,Rt)||t[yt](Rt)===Rt)&&(Qt(t,Rt),t.removeAttribute(Rt)),t.innerHTML=t[yt](L))},f=function(e){var a=e[z][St],c=e[z].tagName===l?e[z]:a.tagName===l?a:null;if(c){var u=this,s=_t(u,"btn"),f=c[It](r)[0];if(f){if("checkbox"===f.type&&(f[o]?(Qt(c,Wt),f[yt](o),f.removeAttribute(o),f[o]=!1):(Kt(c,Wt),f[yt](o),f[wt](o,o),f[o]=!0),n||(n=!0,le.call(f,bt,i),le.call(t,bt,i))),"radio"===f.type&&!n&&!f[o]){Kt(c,Wt),f[wt](o,o),f[o]=!0,le.call(f,bt,i),le.call(t,bt,i),n=!0;for(var d=0,h=s[Dt];dd||n===v-1&&0===d)&&(g=s[c]=Ot),s.slideTo(d)}},S=function(t){if(t.preventDefault(),!p){var e=t.currentTarget||t.srcElement;e===y?(d++,g=s[c]=zt,d===v-1?d=v-1:d===v&&(d=0)):e===T&&(d--,g=s[c]=Ot,0===d?d=0:d<0&&(d=v-1)),s.slideTo(d)}},D=function(t){if(!p){switch(t.which){case 39:d++,g=s[c]=zt,d==v-1?d=v-1:d==v&&(d=0);break;case 37:d--,g=s[c]=Ot,0==d?d=0:d<0&&(d=v-1);break;default:return}s.slideTo(d)}},k=function(t){for(var e=0,n=A[Dt];e-1)&&(n.persist||l))return;c=null,m()}(/\#$/.test(r.href)||r[St]&&/\#$/.test(r[St].href))&&e.preventDefault()},p=function(){le.call(a,dt,l,c),Kt(a,r),u[wt](at,!0),le.call(a,ht,l,c),ne(document,ut,f),i=!0},m=function(){le.call(a,pt,l,c),Qt(a,r),u[wt](at,!1),le.call(a,mt,l,c),ie(document,ut,f),i=!1};this.toggle=function(){Vt(a,r)&&i?m():p()},h in t||(u[wt]("tabindex","0"),ne(document,rt,d)),t[h]=this};ce(h,be,o);var ye=function(i,o){i=te(i);var l=i[yt](y)||i[yt]("href"),r=te(l),c=Vt(i,"modal")?i:r,u="modal",s="static",f="paddingLeft",d="paddingRight",h="modal-backdrop";if(Vt(i,"modal")&&(i=null),c){o=o||{},this[$]=o[$]!==!1&&"false"!==c[yt](b),this[W]=o[W]!==s&&c[yt](T)!==s||s,this[W]=o[W]!==!1&&"false"!==c[yt](T)&&this[W],this[j]=o[j];var m,v,g,x,w=this,C=this.open=!1,I=null,A=function(){var n=e[At]();return t[et]||n[Ot]-Math.abs(n[zt])},L=function(){var e=n.currentStyle||t.getComputedStyle(n),i=parseInt(e[d],10);m&&(n[Nt][d]=i+g+"px")},E=function(){n[Nt][d]=""},M=function(){var t,e=document.createElement("div");return e.className=u+"-scrollbar-measure",n.appendChild(e),t=e[_]-e[V],n.removeChild(e),t},S=function(){m=n[V]e[Z],g=M()},D=function(){c[Nt][f]=!m&&v?g+"px":"",c[Nt][d]=m&&!v?g+"px":""},k=function(){c[Nt][f]="",c[Nt][d]=""},H=function(){var t=document.createElement("div");x=te("."+h),null===x&&(t[wt]("class",h+" fade"),x=t,n.appendChild(x))},B=function(){x=te("."+h),x&&null!==x&&"object"==typeof x&&(n.removeChild(x),x=null)},N=function(){Vt(c,$t)?ie(document,ut,q):ne(document,ut,q)},P=function(){Vt(c,$t)?ie(t,st,w.update):ne(t,st,w.update)},R=function(){Vt(c,$t)?ie(c,rt,F):ne(c,rt,F)},O=function(t){var e=t[z];e=e[Ct](y)||e[Ct]("href")?e:e[St],C||e!==i||Vt(c,$t)||(c.modalTrigger=i,I=i,w.show(),t.preventDefault())},q=function(t){var e=t.which||t.keyCode;w[$]&&27==e&&C&&w.hide()},F=function(t){var e=t[z];C&&(e[St][yt](a)===u||e[yt](a)===u||e===c&&w[W]!==s)&&(w.hide(),I=null,t.preventDefault())};this.toggle=function(){C&&Vt(c,$t)?this.hide():this.show()},this.show=function(){le.call(c,dt,u,I);var t=_t(document,u+" in")[0];t&&t!==c&&t.modalTrigger[p].hide(),this[W]&&H(),x&&!Vt(x,$t)&&setTimeout(function(){Kt(x,$t)},0),setTimeout(function(){c[Nt].display="block",S(),L(),D(),P(),R(),N(),Kt(n,u+"-open"),Kt(c,$t),c[wt](lt,!1)},0),ae(c,function(){C=w.open=!0,Jt(c),le.call(c,ht,u,I)})},this.hide=function(){le.call(c,pt,u),x=te("."+h),null!==x&&Qt(x,$t),Qt(c,$t),c[wt](lt,!0),ae(c,function(){Qt(n,u+"-open"),P(),R(),N(),k(),E(),c[Nt].display="",_t(document,u+" "+$t)[0]||B(),C=w.open=!1,i&&Jt(i),le.call(c,mt,u)})},this.setContent=function(t){te("."+u+"-content",c).innerHTML=t},this.update=function(){C&&(S(),L(),D())},!i||p in i||ne(i,rt,O),this[j]&&this.setContent(this[j]),!!i&&(i[p]=this)}};ce(p,ye,o);var we=function(e,o){e=te(e);var a=e[yt](M),l=e[yt](S),r=e[yt](k),c=e[yt](E),u=e[yt](H),s=e[yt](D),f="popover",d="template",h="trigger",p="class",v="div",g="fade",x="data-title",T="data-content",b="dismissible",y='';o=o||{},this[d]=o[d]?o[d]:null,this[h]=o[h]?o[h]:a||ct,this[F]=o[F]&&o[F]!==g?o[F]:l||g,this[U]=o[U]?o[U]:r||qt,this[P]=parseInt(o[P]||u)||200,this[b]=!(!o[b]&&"true"!==c),this[X]=te(o[X])||te(s)||n;var w=this,C=e[yt](x)||null,I=e[yt](T)||null;if(I||this[d]){var A=null,L=0,B=this[U],N=function(t){null!==A&&t[z]===te(".close",A)&&w.hide()},W=function(){w[X].removeChild(A),L=null,A=null},$=function(){if(C=e[yt](x),I=e[yt](T),A=document.createElement(v),null!==I&&null===w[d]){if(A[wt]("role","tooltip"),null!==C){var t=document.createElement("h3");t[wt](p,f+"-title"),t.innerHTML=w[b]?C+y:C,A.appendChild(t)}var n=document.createElement(v),i=document.createElement(v);n[wt](p,"arrow"),i[wt](p,f+"-content"),A.appendChild(n),A.appendChild(i),i.innerHTML=w[b]&&null===C?I+y:I}else{var o=document.createElement(v);o.innerHTML=w[d],A.innerHTML=o.firstChild.innerHTML}w[X].appendChild(A),A[Nt].display="block",A[wt](p,f+" "+B+" "+w[F])},R=function(){!Vt(A,$t)&&Kt(A,$t)},j=function(){he(e,A,B,w[X]),fe(A)||(B=pe(B),he(e,A,B,w[X]))};this.toggle=function(){null===A?w.show():w.hide()},this.show=function(){clearTimeout(L),L=setTimeout(function(){null===A&&(B=w[U],$(),j(),R(),le.call(e,dt,f),ae(A,function(){le.call(e,ht,f)}))},20)},this.hide=function(){clearTimeout(L),L=setTimeout(function(){A&&null!==A&&Vt(A,$t)&&(le.call(e,pt,f),Qt(A,$t),ae(A,function(){W(),le.call(e,mt,f)}))},w[P])},m in e||(w[h]===ct?(ne(e,Ut[0],w.show),w[b]||ne(e,Ut[1],w.hide)):/^(click|focus)$/.test(w[h])&&(ne(e,w[h],w.toggle),w[b]||ne(e,"blur",w.hide)),w[b]&&ne(document,rt,N),i&&i<9||ne(t,st,w.hide)),e[m]=w}};ce(m,we,o);var Ce=function(e,n){e=te(e);var o=te(e[yt](y));if(n=n||{},n[z]||o){for(var a,l=n[z]&&te(n[z])||o,r=l&&l[It]("A"),c=[],u=[],s=e[tt]=s&&d>a;if(!r&&h)"LI"!==n.tagName||Vt(n,Wt)||(Kt(n,Wt),r=!0,o&&!Vt(o,Wt)&&Kt(o,Wt),le.call(e,"activate","scrollspy",c[t]));else if(h){if(!h&&!r||r&&h)return}else"LI"===n.tagName&&Vt(n,Wt)&&(Qt(n,Wt),r=!1,o&&Vt(o,Wt)&&!_t(n[St],Wt).length&&Qt(o,Wt))},x=function(){a=f?de().y:e[K];for(var t=0,n=c[Dt];t1&&(t=e[e[Dt]-1]):t=e[0],t[It]("A")[0]},d=function(){return te(f()[yt]("href"))},h=function(t){t.preventDefault(),l=t[z],c.show()};this.show=function(){var e=te(l[yt]("href")),n=f(),c=d();n[a]&&l[a]||Vt(l[St],Wt)||(n[a]=l[a]=!0,Qt(n[St],Wt),Kt(l[St],Wt),s&&(Vt(t[St][St],"dropdown-menu")?Vt(s,Wt)||Kt(s,Wt):Vt(s,Wt)&&Qt(s,Wt)),r&&(r[Nt][o]=se(c)+"px"),le.call(n,pt,i,l),setTimeout(function(){Qt(c,$t)},0),ae(c,function(){r&&Kt(r,Pt),Qt(c,Wt),Kt(e,Wt),setTimeout(function(){Kt(e,$t),r&&(r[Nt][o]=se(e)+"px")},0),le.call(l,dt,i,n),le.call(n,mt,i,l)}),ae(e,function(){le.call(l,ht,i,n),r?setTimeout(function(){ae(r,function(){r[Nt][o]="",Qt(r,Pt),n[a]=l[a]=!1})},0):n[a]=l[a]=!1}))},g in t||ne(t,rt,h),this[o]&&(r=d()[St]),t[g]=this};ce(g,Ie,o);var Ae=function(t,e){t=te(t);var i=t[yt](S);placementData=t[yt](k),delayData=t[yt](H),containerData=t[yt](D),component="tooltip",classString="class",title="title",fade="fade",div="div",e=e||{},this[F]=e[F]&&e[F]!==fade?e[F]:i||fade,this[U]=e[U]?e[U]:placementData||qt,this[P]=parseInt(e[P]||delayData)||200,this[X]=te(e[X])||te(containerData)||n;var o=this,a=0,l=this[U],r=null,c=t[yt](title)||t[yt](A);if(c){var u=function(){o[X].removeChild(r),r=null,a=null},s=function(){c=t[yt](title)||t[yt](A),r=document.createElement(div),r[wt]("role",component);var e=document.createElement(div),n=document.createElement(div);e[wt](classString,component+"-arrow"),n[wt](classString,component+"-inner"),r.appendChild(e),r.appendChild(n),n.innerHTML=c,o[X].appendChild(r),r[wt](classString,component+" "+l+" "+o[F])},f=function(){he(t,r,l,o[X]),fe(r)||(l=pe(l),he(t,r,l,o[X]))},d=function(){!Vt(r,$t)&&Kt(r,$t)};this.show=function(){clearTimeout(a),a=setTimeout(function(){null===r&&(l=o[U],s(),f(),d(),le.call(t,dt,component),ae(r,function(){le.call(t,ht,component)}))},20)},this.hide=function(){clearTimeout(a),a=setTimeout(function(){r&&null!==r&&Vt(r,$t)&&(le.call(t,pt,component),Qt(r,$t),ae(r,function(){u(),le.call(t,mt,component)}))},o[P])},this.toggle=function(){r?o.hide():o.show()},x in t||(t[wt](A,c),t.removeAttribute(title),ne(t,Ut[0],this.show),ne(t,Ut[1],this.hide)),t[x]=this}};return ce(x,Ae,o),{Affix:me,Alert:ve,Button:ge,Carousel:xe,Collapse:Te,Dropdown:be,Modal:ye,Popover:we,ScrollSpy:Ce,Tab:Ie,Tooltip:Ae}}); +// Native Javascript for Bootstrap 3 v2.0.5 | © dnp_theme | MIT-License +!function(t,e){if("function"==typeof define&&define.amd)define([],e);else if("object"==typeof module&&module.exports)module.exports=e();else{var n=e();t.Affix=n.Affix,t.Alert=n.Alert,t.Button=n.Button,t.Carousel=n.Carousel,t.Collapse=n.Collapse,t.Dropdown=n.Dropdown,t.Modal=n.Modal,t.Popover=n.Popover,t.ScrollSpy=n.ScrollSpy,t.Tab=n.Tab,t.Tooltip=n.Tooltip}}(this,function(){var t="undefined"!=typeof global?global:this||window,e=document.documentElement,n=document.body,i=null!=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})").exec(navigator.userAgent)&&parseFloat(RegExp.$1),o="data-toggle",a="data-dismiss",l="data-spy",r="data-ride",c="Affix",u="Alert",s="Button",f="Carousel",d="Collapse",h="Dropdown",p="Modal",m="Popover",v="ScrollSpy",g="Tab",x="Tooltip",T="data-backdrop",b="data-keyboard",y="data-target",w="data-interval",C="data-height",I="data-pause",A="data-original-title",L="data-original-text",E="data-dismissible",M="data-trigger",S="data-animation",D="data-container",k="data-placement",H="data-delay",B="data-offset-top",N="data-offset-bottom",W="backdrop",$="keyboard",P="delay",R="duration",j="content",z="target",O="interval",q="pause",F="animation",U="placement",X="container",Y="offsetTop",G="offsetBottom",J="offsetLeft",K="scrollTop",Q="scrollLeft",V="clientWidth",Z="clientHeight",_="offsetWidth",tt="offsetHeight",et="innerWidth",nt="innerHeight",it="scrollHeight",ot="height",at="aria-expanded",lt="aria-hidden",rt="click",ct="hover",ut="keydown",st="resize",ft="scroll",dt="show",ht="shown",pt="hide",mt="hidden",vt="close",gt="closed",xt="slid",Tt="slide",bt="change",yt="getAttribute",wt="setAttribute",Ct="hasAttribute",It="getElementsByTagName",At="getBoundingClientRect",Lt="querySelectorAll",Et="getElementsByClassName",Mt="indexOf",St="parentNode",Dt="length",kt="toLowerCase",Ht="Transition",Bt="Webkit",Nt="style",Wt="active",$t="in",Pt="collapsing",Rt="disabled",jt="loading",zt="left",Ot="right",qt="top",Ft="bottom",Ut="onmouseleave"in document?["mouseenter","mouseleave"]:["mouseover","mouseout"],Xt=/\b(top|bottom|left|top)+/,Yt=Bt+Ht in e[Nt]||Ht[kt]()in e[Nt],Gt=Bt+Ht in e[Nt]?Bt[kt]()+Ht+"End":Ht[kt]()+"end",Jt=function(t){t.focus?t.focus():t.setActive()},Kt=function(t,e){t.classList.add(e)},Qt=function(t,e){t.classList.remove(e)},Vt=function(t,e){return t.classList.contains(e)},Zt=function(t){for(var e=[],n=0,i=t[Dt];n-1||l===r)&&new e(o[a])}},ue=function(e){var n=e&&(e.currentStyle||t.getComputedStyle(e)),i=/px/.test(n.borderTopWidth)?Math.round(n.borderTopWidth.replace("px","")):0,o=/px/.test(n.borderBottomWidth)?Math.round(n.borderBottomWidth.replace("px","")):0,a=/px/.test(n.marginTop)?Math.round(n.marginTop.replace("px","")):0,l=/px/.test(n.marginBottom)?Math.round(n.marginBottom.replace("px","")):0;return e[Z]+parseInt(i)+parseInt(o)+parseInt(a)+parseInt(l)},se=function(t){for(var e=0,n=0,i=t.children[Dt];n=0&&i[zt]>=0&&i[Ft]<=(t[nt]||e[Z])&&i[Ot]<=(t[et]||e[V])},de=function(){return{y:t.pageYOffset||e[K],x:t.pageXOffset||e[Q]}},he=function(t,e,i,o){var a=t[At](),l=o===n?de():{x:o[J]+o[Q],y:o[Y]+o[K]},r={w:a[Ot]-a[zt],h:a[Ft]-a[qt]},c={w:e[_],h:e[tt]};i===qt?(e[Nt][qt]=a[qt]+l.y-c.h+"px",e[Nt][zt]=a[zt]+l.x-c.w/2+r.w/2+"px"):i===Ft?(e[Nt][qt]=a[qt]+l.y+r.h+"px",e[Nt][zt]=a[zt]+l.x-c.w/2+r.w/2+"px"):i===zt?(e[Nt][qt]=a[qt]+l.y-c.h/2+r.h/2+"px",e[Nt][zt]=a[zt]+l.x-c.w+"px"):i===Ot&&(e[Nt][qt]=a[qt]+l.y-c.h/2+r.h/2+"px",e[Nt][zt]=a[zt]+l.x+r.w+"px"),e.className[Mt](i)===-1&&(e.className=e.className.replace(Xt,i))},pe=function(t){return t===qt?Ft:t===Ft?qt:t===zt?Ot:t===Ot?zt:t},me=function(o,a){o=te(o),a=a||{};var l=o[yt](y),r=o[yt](B),u=o[yt](N),s="affix",f="affixed",d="function",h="update",p="affix-top",m="affixed-top",v="affix-bottom",g="affixed-bottom";if(this[z]=a[z]?te(a[z]):te(l)||null,this[Y]=a[Y]?a[Y]:parseInt(r)||0,this[G]=a[G]?a[G]:parseInt(u)||0,this[z]||this[Y]||this[G]){var x,T,b,w,C,I,A=this,L=i&&i<10?500:50,E=!1,M=!1,S=function(){return Math.max(n[it],n[tt],e[Z],e[it],e[tt])},D=function(){return null!==A[z]?A[z][At]()[qt]+w:A[Y]?parseInt(typeof A[Y]===d?A[Y]():A[Y]||0):void 0},k=function(){if(A[G])return b-o[tt]-parseInt(typeof A[G]===d?A[G]():A[G]||0)},H=function(){b=S(),w=parseInt(de().y,0),x=D(),T=k(),C=parseInt(x)-w<0&&w>parseInt(x),I=parseInt(T)-w<0&&w>parseInt(T)},W=function(){E||Vt(o,s)||(le.call(o,s,s),le.call(o,p,s),Kt(o,s),E=!0,le.call(o,f,s),le.call(o,m,s))},$=function(){E&&Vt(o,s)&&(Qt(o,s),E=!1)},P=function(){M||Vt(o,v)||(le.call(o,s,s),le.call(o,v,s),Kt(o,v),M=!0,le.call(o,f,s),le.call(o,g,s))},R=function(){M&&Vt(o,v)&&(Qt(o,v),M=!1)},j=function(){I?(C&&$(),P()):(R(),C?W():$())};this[h]=function(){H(),j()},c in o||(ne(t,ft,this[h]),ne(t,st,function(){setTimeout(function(){A[h]()},L)})),o[c]=this,this[h]()}};ce(c,me,l);var ve=function(t){t=te(t);var e=this,n="alert",i=ee(t,"."+n),o=function(o){var l=o[z];l=l[Ct](a)?l:l[St],l&&l[Ct](a)&&(i=ee(l,"."+n),t=te("["+a+'="'+n+'"]',i),(t===l||t===l[St])&&i&&e.close())},l=function(){le.call(i,gt,n),ie(t,rt,o),i[St].removeChild(i)};this.close=function(){i&&t&&Vt(i,$t)&&(le.call(i,vt,n),Qt(i,$t),setTimeout(function(){i&&ae(i,l)},R))},u in t||ne(t,rt,o),t[u]=this};ce(u,ve,a);var ge=function(t,e){t=te(t),e=e||null;var n=!1,i="button",o="checked",a="reset",l="LABEL",r="INPUT",c=function(){e&&e!==a&&(e===jt&&(Kt(t,Rt),t[wt](Rt,Rt)),t[wt](L,t.innerHTML.replace(/^\s+|\s+$/g,"")),t.innerHTML=t[yt]("data-"+e+"-text"))},u=function(){t[yt](L)&&((Vt(t,Rt)||t[yt](Rt)===Rt)&&(Qt(t,Rt),t.removeAttribute(Rt)),t.innerHTML=t[yt](L))},f=function(e){var a=e[z][St],c=e[z].tagName===l?e[z]:a.tagName===l?a:null;if(c){var u=this,s=_t(u,"btn"),f=c[It](r)[0];if(f){if("checkbox"===f.type&&(f[o]?(Qt(c,Wt),f[yt](o),f.removeAttribute(o),f[o]=!1):(Kt(c,Wt),f[yt](o),f[wt](o,o),f[o]=!0),n||(n=!0,le.call(f,bt,i),le.call(t,bt,i))),"radio"===f.type&&!n&&!f[o]){Kt(c,Wt),f[wt](o,o),f[o]=!0,le.call(f,bt,i),le.call(t,bt,i),n=!0;for(var d=0,h=s[Dt];dd||n===v-1&&0===d)&&(g=s[c]=Ot),s.slideTo(d)}},S=function(t){if(t.preventDefault(),!p){var e=t.currentTarget||t.srcElement;e===y?(d++,g=s[c]=zt,d===v-1?d=v-1:d===v&&(d=0)):e===T&&(d--,g=s[c]=Ot,0===d?d=0:d<0&&(d=v-1)),s.slideTo(d)}},D=function(t){if(!p){switch(t.which){case 39:d++,g=s[c]=zt,d==v-1?d=v-1:d==v&&(d=0);break;case 37:d--,g=s[c]=Ot,0==d?d=0:d<0&&(d=v-1);break;default:return}s.slideTo(d)}},k=function(t){for(var e=0,n=A[Dt];e-1)&&(n.persist||l))return;c=null,m()}(/\#$/.test(r.href)||r[St]&&/\#$/.test(r[St].href))&&e.preventDefault()},p=function(){le.call(a,dt,l,c),Kt(a,r),u[wt](at,!0),le.call(a,ht,l,c),ne(document,ut,f),i=!0},m=function(){le.call(a,pt,l,c),Qt(a,r),u[wt](at,!1),le.call(a,mt,l,c),ie(document,ut,f),i=!1};this.toggle=function(){Vt(a,r)&&i?m():p()},h in t||(u[wt]("tabindex","0"),ne(document,rt,d)),t[h]=this};ce(h,be,o);var ye=function(i,o){i=te(i);var l=i[yt](y)||i[yt]("href"),r=te(l),c=Vt(i,"modal")?i:r,u="modal",s="static",f="paddingLeft",d="paddingRight",h="modal-backdrop";if(Vt(i,"modal")&&(i=null),c){o=o||{},this[$]=o[$]!==!1&&"false"!==c[yt](b),this[W]=o[W]!==s&&c[yt](T)!==s||s,this[W]=o[W]!==!1&&"false"!==c[yt](T)&&this[W],this[j]=o[j];var m,v,g,x,w=this,C=this.open=!1,I=null,A=function(){var n=e[At]();return t[et]||n[Ot]-Math.abs(n[zt])},L=function(){var e=n.currentStyle||t.getComputedStyle(n),i=parseInt(e[d],10);m&&(n[Nt][d]=i+g+"px")},E=function(){n[Nt][d]=""},M=function(){var t,e=document.createElement("div");return e.className=u+"-scrollbar-measure",n.appendChild(e),t=e[_]-e[V],n.removeChild(e),t},S=function(){m=n[V]e[Z],g=M()},D=function(){c[Nt][f]=!m&&v?g+"px":"",c[Nt][d]=m&&!v?g+"px":""},k=function(){c[Nt][f]="",c[Nt][d]=""},H=function(){var t=document.createElement("div");x=te("."+h),null===x&&(t[wt]("class",h+" fade"),x=t,n.appendChild(x))},B=function(){x=te("."+h),x&&null!==x&&"object"==typeof x&&(n.removeChild(x),x=null)},N=function(){Vt(c,$t)?ie(document,ut,q):ne(document,ut,q)},P=function(){Vt(c,$t)?ie(t,st,w.update):ne(t,st,w.update)},R=function(){Vt(c,$t)?ie(c,rt,F):ne(c,rt,F)},O=function(t){var e=t[z];e=e[Ct](y)||e[Ct]("href")?e:e[St],C||e!==i||Vt(c,$t)||(c.modalTrigger=i,I=i,w.show(),t.preventDefault())},q=function(t){var e=t.which||t.keyCode;w[$]&&27==e&&C&&w.hide()},F=function(t){var e=t[z];C&&(e[St][yt](a)===u||e[yt](a)===u||e===c&&w[W]!==s)&&(w.hide(),I=null,t.preventDefault())};this.toggle=function(){C&&Vt(c,$t)?this.hide():this.show()},this.show=function(){le.call(c,dt,u,I);var t=_t(document,u+" in")[0];t&&t!==c&&t.modalTrigger[p].hide(),this[W]&&H(),x&&!Vt(x,$t)&&setTimeout(function(){Kt(x,$t)},0),setTimeout(function(){c[Nt].display="block",S(),L(),D(),P(),R(),N(),Kt(n,u+"-open"),Kt(c,$t),c[wt](lt,!1)},0),ae(c,function(){C=w.open=!0,Jt(c),le.call(c,ht,u,I)})},this.hide=function(){le.call(c,pt,u),x=te("."+h),null!==x&&Qt(x,$t),Qt(c,$t),c[wt](lt,!0),ae(c,function(){Qt(n,u+"-open"),P(),R(),N(),k(),E(),c[Nt].display="",_t(document,u+" "+$t)[0]||B(),C=w.open=!1,i&&Jt(i),le.call(c,mt,u)})},this.setContent=function(t){te("."+u+"-content",c).innerHTML=t},this.update=function(){C&&(S(),L(),D())},!i||p in i||ne(i,rt,O),this[j]&&this.setContent(this[j]),!!i&&(i[p]=this)}};ce(p,ye,o);var we=function(e,o){e=te(e);var a=e[yt](M),l=e[yt](S),r=e[yt](k),c=e[yt](E),u=e[yt](H),s=e[yt](D),f="popover",d="template",h="trigger",p="class",v="div",g="fade",x="data-title",T="data-content",b="dismissible",y='';o=o||{},this[d]=o[d]?o[d]:null,this[h]=o[h]?o[h]:a||ct,this[F]=o[F]&&o[F]!==g?o[F]:l||g,this[U]=o[U]?o[U]:r||qt,this[P]=parseInt(o[P]||u)||200,this[b]=!(!o[b]&&"true"!==c),this[X]=te(o[X])||te(s)||n;var w=this,C=e[yt](x)||null,I=e[yt](T)||null;if(I||this[d]){var A=null,L=0,B=this[U],N=function(t){null!==A&&t[z]===te(".close",A)&&w.hide()},W=function(){w[X].removeChild(A),L=null,A=null},$=function(){if(C=e[yt](x),I=e[yt](T),A=document.createElement(v),null!==I&&null===w[d]){if(A[wt]("role","tooltip"),null!==C){var t=document.createElement("h3");t[wt](p,f+"-title"),t.innerHTML=w[b]?C+y:C,A.appendChild(t)}var n=document.createElement(v),i=document.createElement(v);n[wt](p,"arrow"),i[wt](p,f+"-content"),A.appendChild(n),A.appendChild(i),i.innerHTML=w[b]&&null===C?I+y:I}else{var o=document.createElement(v);o.innerHTML=w[d],A.innerHTML=o.firstChild.innerHTML}w[X].appendChild(A),A[Nt].display="block",A[wt](p,f+" "+B+" "+w[F])},R=function(){!Vt(A,$t)&&Kt(A,$t)},j=function(){he(e,A,B,w[X]),fe(A)||(B=pe(B),he(e,A,B,w[X]))};this.toggle=function(){null===A?w.show():w.hide()},this.show=function(){clearTimeout(L),L=setTimeout(function(){null===A&&(B=w[U],$(),j(),R(),le.call(e,dt,f),ae(A,function(){le.call(e,ht,f)}))},20)},this.hide=function(){clearTimeout(L),L=setTimeout(function(){A&&null!==A&&Vt(A,$t)&&(le.call(e,pt,f),Qt(A,$t),ae(A,function(){W(),le.call(e,mt,f)}))},w[P])},m in e||(w[h]===ct?(ne(e,Ut[0],w.show),w[b]||ne(e,Ut[1],w.hide)):/^(click|focus)$/.test(w[h])&&(ne(e,w[h],w.toggle),w[b]||ne(e,"blur",w.hide)),w[b]&&ne(document,rt,N),i&&i<9||ne(t,st,w.hide)),e[m]=w}};ce(m,we,o);var Ce=function(e,n){e=te(e);var o=te(e[yt](y));if(n=n||{},n[z]||o){for(var a,l=n[z]&&te(n[z])||o,r=l&&l[It]("A"),c=[],u=[],s=e[tt]=s&&d>a;if(!r&&h)"LI"!==n.tagName||Vt(n,Wt)||(Kt(n,Wt),r=!0,o&&!Vt(o,Wt)&&Kt(o,Wt),le.call(e,"activate","scrollspy",c[t]));else if(h){if(!h&&!r||r&&h)return}else"LI"===n.tagName&&Vt(n,Wt)&&(Qt(n,Wt),r=!1,o&&Vt(o,Wt)&&!_t(n[St],Wt).length&&Qt(o,Wt))},x=function(){a=f?de().y:e[K];for(var t=0,n=c[Dt];t1&&(t=e[e[Dt]-1]):t=e[0],t[It]("A")[0]},d=function(){return te(f()[yt]("href"))},h=function(t){t.preventDefault(),l=t[z],c.show()};this.show=function(){var e=te(l[yt]("href")),n=f(),c=d();n[a]&&l[a]||Vt(l[St],Wt)||(n[a]=l[a]=!0,Qt(n[St],Wt),Kt(l[St],Wt),s&&(Vt(t[St][St],"dropdown-menu")?Vt(s,Wt)||Kt(s,Wt):Vt(s,Wt)&&Qt(s,Wt)),r&&(r[Nt][o]=se(c)+"px"),le.call(n,pt,i,l),setTimeout(function(){Qt(c,$t)},0),ae(c,function(){r&&Kt(r,Pt),Qt(c,Wt),Kt(e,Wt),setTimeout(function(){Kt(e,$t),r&&(r[Nt][o]=se(e)+"px")},0),le.call(l,dt,i,n),le.call(n,mt,i,l)}),ae(e,function(){le.call(l,ht,i,n),r?setTimeout(function(){ae(r,function(){r[Nt][o]="",Qt(r,Pt),n[a]=l[a]=!1})},0):n[a]=l[a]=!1}))},g in t||ne(t,rt,h),this[o]&&(r=d()[St]),t[g]=this};ce(g,Ie,o);var Ae=function(t,e){t=te(t);var i=t[yt](S);placementData=t[yt](k),delayData=t[yt](H),containerData=t[yt](D),component="tooltip",classString="class",title="title",fade="fade",div="div",e=e||{},this[F]=e[F]&&e[F]!==fade?e[F]:i||fade,this[U]=e[U]?e[U]:placementData||qt,this[P]=parseInt(e[P]||delayData)||200,this[X]=te(e[X])||te(containerData)||n;var o=this,a=0,l=this[U],r=null,c=t[yt](title)||t[yt](A);if(c){var u=function(){o[X].removeChild(r),r=null,a=null},s=function(){c=t[yt](title)||t[yt](A),r=document.createElement(div),r[wt]("role",component);var e=document.createElement(div),n=document.createElement(div);e[wt](classString,component+"-arrow"),n[wt](classString,component+"-inner"),r.appendChild(e),r.appendChild(n),n.innerHTML=c,o[X].appendChild(r),r[wt](classString,component+" "+l+" "+o[F])},f=function(){he(t,r,l,o[X]),fe(r)||(l=pe(l),he(t,r,l,o[X]))},d=function(){!Vt(r,$t)&&Kt(r,$t)};this.show=function(){clearTimeout(a),a=setTimeout(function(){null===r&&(l=o[U],s(),f(),d(),le.call(t,dt,component),ae(r,function(){le.call(t,ht,component)}))},20)},this.hide=function(){clearTimeout(a),a=setTimeout(function(){r&&null!==r&&Vt(r,$t)&&(le.call(t,pt,component),Qt(r,$t),ae(r,function(){u(),le.call(t,mt,component)}))},o[P])},this.toggle=function(){r?o.hide():o.show()},x in t||(t[wt](A,c),t.removeAttribute(title),ne(t,Ut[0],this.show),ne(t,Ut[1],this.hide)),t[x]=this}};return ce(x,Ae,o),{Affix:me,Alert:ve,Button:ge,Carousel:xe,Collapse:Te,Dropdown:be,Modal:ye,Popover:we,ScrollSpy:Ce,Tab:Ie,Tooltip:Ae}}); diff --git a/lib/V3/carousel-native.js b/lib/V3/carousel-native.js index d684d6b3..943706a7 100644 --- a/lib/V3/carousel-native.js +++ b/lib/V3/carousel-native.js @@ -152,27 +152,32 @@ var Carousel = function( element, options ) { setActivePage( next ); if ( supportTransitions && hasClass(element,'slide') ) { + addClass(slides[next],orientation); - slides[next][offsetWidth]; + slides[next][offsetWidth]; addClass(slides[next],slideDirection); addClass(slides[activeItem],slideDirection); - one(slides[next], transitionEndEvent, function() { //we're gonna fake waiting for the animation to finish, cleaner and better - isSliding = self.isSliding = false; + one(slides[activeItem], transitionEndEvent, function(e) { + var timeout = e[target] !== slides[activeItem] ? e.elapsedTime*1000 : 0; + setTimeout(function(){ + isSliding = self.isSliding = false; - addClass(slides[next],active); - removeClass(slides[activeItem],active); + addClass(slides[next],active); + removeClass(slides[activeItem],active); - removeClass(slides[next],orientation); - removeClass(slides[next],slideDirection); - removeClass(slides[activeItem],slideDirection); + removeClass(slides[next],orientation); + removeClass(slides[next],slideDirection); + removeClass(slides[activeItem],slideDirection); - if ( self[interval] && !hasClass(element,paused) ) { - self.cycle(); - } - bootstrapCustomEvent.call(element, slidEvent, component, slides[next]); // here we go with the slid event + bootstrapCustomEvent.call(element, slidEvent, component, slides[next]); + + if ( self[interval] && !hasClass(element,paused) ) { + self.cycle(); + } + },timeout); }); - + } else { addClass(slides[next],active); slides[next][offsetWidth]; diff --git a/lib/V3/utils.js b/lib/V3/utils.js index 718836f3..9a2919a0 100644 --- a/lib/V3/utils.js +++ b/lib/V3/utils.js @@ -169,8 +169,8 @@ var globalObject = typeof global !== 'undefined' ? global : this||window, element.removeEventListener(event, handler, false); }, one = function (element, event, handler) { // one since 2.0.4 - on(element, event, function handlerWrapper(){ - handler(); + on(element, event, function handlerWrapper(e){ + handler(e); off(element, event, handlerWrapper); }); }, diff --git a/lib/V4/carousel-native.js b/lib/V4/carousel-native.js index 9f974258..79fce0ab 100644 --- a/lib/V4/carousel-native.js +++ b/lib/V4/carousel-native.js @@ -158,21 +158,25 @@ var Carousel = function( element, options ) { addClass(slides[next],carouselItem +'-'+ slideDirection); addClass(slides[activeItem],carouselItem +'-'+ slideDirection); - one(slides[next], transitionEndEvent, function(){ - isSliding = self.isSliding = false; + one(slides[activeItem], transitionEndEvent, function(e) { + var timeout = e[target] !== slides[activeItem] ? e.elapsedTime*1000 : 0; + setTimeout(function(){ + isSliding = self.isSliding = false; - addClass(slides[next],active); - removeClass(slides[activeItem],active); + addClass(slides[next],active); + removeClass(slides[activeItem],active); - removeClass(slides[next],carouselItem +'-'+ orientation); - removeClass(slides[next],carouselItem +'-'+ slideDirection); - removeClass(slides[activeItem],carouselItem +'-'+ slideDirection); + removeClass(slides[next],carouselItem +'-'+ orientation); + removeClass(slides[next],carouselItem +'-'+ slideDirection); + removeClass(slides[activeItem],carouselItem +'-'+ slideDirection); - if ( self[interval] && !hasClass(element,paused) ) { - self.cycle(); - } - bootstrapCustomEvent.call(element, slidEvent, component, slides[next]); // here we go with the slid event - }); + bootstrapCustomEvent.call(element, slidEvent, component, slides[next]); + + if ( !document.hidden && self[interval] && !hasClass(element,paused) ) { + self.cycle(); + } + },timeout); + }); } else { addClass(slides[next],active); @@ -183,7 +187,7 @@ var Carousel = function( element, options ) { if ( self[interval] && !hasClass(element,paused) ) { self.cycle(); } - bootstrapCustomEvent.call(element, slidEvent, component, slides[next]); // here we go with the slid event + bootstrapCustomEvent.call(element, slidEvent, component, slides[next]); }, 100 ); } }; diff --git a/lib/V4/utils.js b/lib/V4/utils.js index 09d27ca1..5589f24c 100644 --- a/lib/V4/utils.js +++ b/lib/V4/utils.js @@ -158,8 +158,8 @@ var globalObject = typeof global !== 'undefined' ? global : this||window, element.removeEventListener(event, handler, false); }, one = function (element, event, handler) { // one since 2.0.4 - on(element, event, function handlerWrapper(){ - handler(); + on(element, event, function handlerWrapper(e){ + handler(e); off(element, event, handlerWrapper); }); }, diff --git a/package.json b/package.json index 9feb14ac..f9c90411 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bootstrap.native", - "version": "2.0.4", + "version": "2.0.5", "description": "Native Javascript for Bootstrap, the sweetest Javascript library without jQuery.", "main": "dist/bootstrap-native.js", "scripts": {