From 2905d0f14562939d91db7916d4d0898e52d5b5be Mon Sep 17 00:00:00 2001 From: thednp Date: Fri, 25 Mar 2016 13:25:13 +0200 Subject: [PATCH] Preparing 1.0.2 release. --- assets/css/theme.css | 2 +- dist/bootstrap-native.js | 133 +++++++++------- dist/bootstrap-native.min.js | 4 +- index.html | 279 +++++++++++++++++---------------- lib/min/collapse-native.min.js | 2 +- lib/min/dropdown-native.min.js | 2 +- lib/min/popover-native.min.js | 2 +- lib/min/tooltip-native.min.js | 2 +- 8 files changed, 228 insertions(+), 198 deletions(-) diff --git a/assets/css/theme.css b/assets/css/theme.css index 1d5475a9..8bd81825 100644 --- a/assets/css/theme.css +++ b/assets/css/theme.css @@ -1,7 +1,7 @@ /* REQUIRED STYLING */ /* enables animation for the collapse, has no effect on legacy browsers */ -.collapse { transition: height .3s ease-out; -webkit-transition: height .3s ease-out } +.collapse { transition: height .3s ease-out; /*-webkit-transition: height .3s ease-out*/ } /* styles the close button for the dismissible popovers */ .popover .close { position: absolute; top: 7px; right: 10px; } diff --git a/dist/bootstrap-native.js b/dist/bootstrap-native.js index 4652fb19..6b26099b 100644 --- a/dist/bootstrap-native.js +++ b/dist/bootstrap-native.js @@ -722,7 +722,7 @@ init : function() { this.actions(); - this.btn.addEventListener('click', this.toggle, false); + this.addEvent(); }, actions : function() { @@ -772,41 +772,53 @@ } }, this._open = function(c) { - this.addClass(c,'in'); + self.removeEvent(); + self.addClass(c,'in'); c.setAttribute('area-expanded','true'); self.addClass(c,'collapsing'); setTimeout(function() { - c.style.height = self.getMaxHeight(c) + 'px'; - c.style.overflowY = 'hidden'; + var h = self.getMaxHeight(c); + c.style.height = h + 'px'; + c.style.overflowY = 'hidden'; }, 0); setTimeout(function() { c.style.height = ''; c.style.overflowY = ''; self.removeClass(c,'collapsing'); + self.addEvent(); }, self.options.duration); }, this._close = function(c) { - c.setAttribute('area-expanded','false'); - c.style.height = this.getMaxHeight(c) + 'px'; + self.removeEvent(); + c.setAttribute('area-expanded','false'); + c.style.height = self.getMaxHeight(c) + 'px'; setTimeout(function() { - self.addClass(c,'collapsing'); + c.style.height = '0px'; c.style.overflowY = 'hidden'; - c.style.height = ''; + self.addClass(c,'collapsing'); }, 0); setTimeout(function() { - c.style.overflowY = ''; - self.removeClass(c,'in'); self.removeClass(c,'collapsing'); + self.removeClass(c,'in'); + c.style.overflowY = ''; + c.style.height = ''; + self.addEvent(); }, self.options.duration); }, this.getMaxHeight = function(l) { // get collapse trueHeight and border var h = 0; - for (var k = 0; k < l.children.length; k++) { + for (var k = 0, ll = l.children.length; k < ll; k++) { h += getOuterHeight(l.children[k]); } return h; }, + this.removeEvent = function() { + this.btn.removeEventListener('click', this.toggle, false); + }, + this.addEvent = function() { + this.btn.addEventListener('click', this.toggle, false); + }, this.getTarget = function(e) { var t = e.currentTarget || e.srcElement, h = t.href && t.getAttribute('href').replace('#',''), @@ -838,7 +850,7 @@ if (el.classList) { el.classList.add(c); } else { el.className += ' '+c; } }; this.removeClass = function(el,c) { - if (el.classList) { el.classList.remove(c); } else { el.className = el.className.replace(c,'').replace(/^\s+|\s+$/g,''); } + if (el.classList) { el.classList.remove(c); } else { el.className = el.className.replace(c,'').replace(/^\s+|\s+$/g,''); } }; } }; @@ -888,37 +900,43 @@ Dropdown.prototype = { init : function() { - var self = this; - self.actions(); - self.menu.setAttribute('tabindex', '0'); // Fix onblur on Chrome - self.menu.addEventListener('click', self.toggle, false); - self.menu.addEventListener('blur', self.close, false); + this.actions(); + this.menu.setAttribute('tabindex', '0'); // Fix onblur on Chrome | Safari + document.addEventListener('click', this.handle, false); }, actions : function() { - var self = this; - - self.toggle = function(e) { - var target = e.currentTarget || e.srcElement; - if (/open/.test(target.parentNode.className)) { - target.parentNode.className = target.parentNode.className.replace(' open',''); + var self = this; + + this.handle = function(e) { // fix some Safari bug with '}else{j.innerHTML=this.title}this.popover.appendChild(j)}var i=document.createElement("div");i.setAttribute("class","popover-content");this.popover.appendChild(h);this.popover.appendChild(i);if(this.options.dismiss&&this.title===null){i.innerHTML=this.content+''}else{i.innerHTML=this.content}}else{var k=document.createElement("div");k.innerHTML=this.options.template;this.popover.innerHTML=k.firstChild.innerHTML}this.options.container.appendChild(this.popover);this.popover.style.display="block"},this.stylePopover=function(l){this.rect=this.getRect();var k=l||this.options.placement;var h=this.options.animation==="true"?"fade":"";this.popover.setAttribute("class","popover "+k+" "+h);var i={w:this.link.offsetWidth,h:this.link.offsetHeight};var j=this.popoverDimensions(this.popover);var o={w:j.w,h:j.h};var n=this.getScroll().y;var m=this.getScroll().x;if(/top/.test(k)){this.popover.style.top=this.rect.top+n-o.h+"px";this.popover.style.left=this.rect.left+m-o.w/2+i.w/2+"px"}else{if(/bottom/.test(k)){this.popover.style.top=this.rect.top+n+i.h+"px";this.popover.style.left=this.rect.left+m-o.w/2+i.w/2+"px"}else{if(/left/.test(k)){this.popover.style.top=this.rect.top+n-o.h/2+i.h/2+"px";this.popover.style.left=this.rect.left+m-o.w+"px"}else{if(/right/.test(k)){this.popover.style.top=this.rect.top+n-o.h/2+i.h/2+"px";this.popover.style.left=this.rect.left+m+i.w+"px"}}}}},this.updatePopover=function(){var h=null;if(!g.isElementInViewport(g.popover)){h=g.updatePlacement()}else{h=g.options.placement}g.stylePopover(h);g.popover.className+=" in"},this.updatePlacement=function(){var h=this.options.placement;if(/top/.test(h)){return"bottom"}else{if(/bottom/.test(h)){return"top"}else{if(/left/.test(h)){return"right"}else{if(/right/.test(h)){return"left"}}}}},this.getRect=function(){return this.link.getBoundingClientRect()},this.getScroll=function(){return{y:window.pageYOffset||document.documentElement.scrollTop,x:window.pageXOffset||document.documentElement.scrollLeft}},this.popoverDimensions=function(h){return{w:h.offsetWidth,h:h.offsetHeight}},this.isElementInViewport=function(i){var h=i.getBoundingClientRect();return(h.top>=0&&h.left>=0&&h.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&h.right<=(window.innerWidth||document.documentElement.clientWidth))}}};var e=document.querySelectorAll("[data-toggle=popover]"),a=0,f=e.length;for(a;a-1){this.checkEdges();this.refresh();this.scrollEvent();if(!(this.isIE&&this.isIE<9)){this.resizeEvent()}}},topLimit:function(){if(this.scrollTarget===window){return this.tg.getBoundingClientRect().top+this.scrollOffset()-5}else{return this.tg.offsetTop}},bottomLimit:function(){return this.topLimit()+this.tg.clientHeight},checkEdges:function(){this.topEdge=this.topLimit();this.bottomEdge=this.bottomLimit()},scrollOffset:function(){if(this.scrollTarget===window){return window.pageYOffset||document.documentElement.scrollTop}else{return this.element.scrollTop}},activate:function(){if(this.parent&&this.parent.tagName==="LI"&&!/active/.test(this.parent.className)){this.addClass(this.parent,"active");if(this.parentParent&&this.parentParent.tagName==="LI"&&/dropdown/.test(this.parentParent.className)&&!/active/.test(this.parentParent.className)){this.addClass(this.parentParent,"active")}this.active=true}},deactivate:function(){if(this.parent&&this.parent.tagName==="LI"&&/active/.test(this.parent.className)){this.removeClass(this.parent,"active");if(this.parentParent&&this.parentParent.tagName==="LI"&&/dropdown/.test(this.parentParent.className)&&/active/.test(this.parentParent.className)){this.removeClass(this.parentParent,"active")}this.active=false}},toggle:function(){if(this.active===false&&(this.bottomEdge>this.scrollOffset()&&this.scrollOffset()>=this.topEdge)){this.activate()}else{if(this.active===true&&(this.bottomEdge<=this.scrollOffset()&&this.scrollOffset()1){return h[h.length-1]}}},this.getActiveContent=function(){var h=this.getActiveTab().getElementsByTagName("A")[0].getAttribute("href").replace("#","");return h&&document.getElementById(h)}}};var e=document.querySelectorAll("[data-toggle='tab'], [data-toggle='pill']"),f=e.length,a=0;for(a;a=0&&i.left>=0&&i.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&i.right<=(window.innerWidth||document.documentElement.clientWidth))}}};var f=document.querySelectorAll("[data-toggle=tooltip]"),a=0,g=f.length;for(a;ae?500:50;window.addEventListener("resize",function(){setTimeout(function(){t.updateAffix()},i)},!1)}};var e=document.querySelectorAll('[data-spy="affix"]'),i=0,o=e.length;for(i;o>i;i++){var s=e[i],n={};n.offsetTop=s.getAttribute("data-offset-top"),n.offsetBottom=s.getAttribute("data-offset-bottom"),n.target=s.getAttribute("data-target"),!s||null===n.offsetTop&&null===n.offsetBottom&&null===n.target||new t(s,n)}return t}),function(t){"undefined"!=typeof module&&"object"==typeof exports?"undefined"!=typeof window?module.exports=t():module.exports=t:window.Alert=t()}(function(t){var e=function(t){this.btn="object"==typeof t?t:document.querySelector(t),this.alert=null,this.duration=150,this.init()};e.prototype={init:function(){this.actions(),document.addEventListener("click",this.close,!1)},actions:function(){var t=this;this.close=function(e){var i=e.target;t.btn="alert"===i.getAttribute("data-dismiss")&&"close"===i.className?i:i.parentNode,t.alert=t.btn.parentNode,null!==t.alert&&"alert"===t.btn.getAttribute("data-dismiss")&&/in/.test(t.alert.className)&&(t.alert.className=t.alert.className.replace(" in",""),setTimeout(function(){t.alert&&t.alert.parentNode.removeChild(t.alert)},t.duration))}}};var i=document.querySelectorAll('[data-dismiss="alert"]'),o=0,s=i.length;for(o;s>o;o++)new e(i[o]);return e}),function(t){"undefined"!=typeof module&&"object"==typeof exports?"undefined"!=typeof window?module.exports=t():module.exports=t:window.Button=t()}(function(){var t=function(t,e){this.btn="object"==typeof t?t:document.querySelector(t),this.option="string"==typeof e?e:null,this.init()};t.prototype={init:function(){var t=this;this.actions(),/btn/.test(this.btn.className)&&(this.option&&"reset"!==this.option?(this.state=this.btn.getAttribute("data-"+this.option+"-text")||null,!this.btn.getAttribute("data-original-text")&&this.btn.setAttribute("data-original-text",t.btn.innerHTML.replace(/^\s+|\s+$/g,"")),this.setState()):"reset"===this.option&&this.reset()),/btn-group/.test(this.btn.className)&&this.btn.addEventListener("click",this.toggle,!1)},actions:function(){function t(t){i&&t.dispatchEvent(i)}var e=this,i="CustomEvent"in window&&window.dispatchEvent?new CustomEvent("bs.button.change"):null;this.setState=function(){"loading"===this.option&&(this.addClass(this.btn,"disabled"),this.btn.setAttribute("disabled","disabled")),this.btn.innerHTML=this.state},this.reset=function(){(/disabled/.test(e.btn.className)||"disabled"===e.btn.getAttribute("disabled"))&&(this.removeClass(this.btn,"disabled"),e.btn.removeAttribute("disabled")),e.btn.innerHTML=e.btn.getAttribute("data-original-text")},this.toggle=function(i){var o=i.target.parentNode,s="LABEL"===i.target.tagName?i.target:"LABEL"===o.tagName?o:null;if(s){var n=this,a=n.querySelectorAll(".btn"),r=a.length,l=0,c=s.getElementsByTagName("INPUT")[0];if(c&&("checkbox"===c.type&&(c.checked?(e.removeClass(s,"active"),c.getAttribute("checked"),c.removeAttribute("checked"),c.checked=!1):(e.addClass(s,"active"),c.getAttribute("checked"),c.setAttribute("checked","checked"),c.checked=!0),t(c),t(e.btn)),"radio"===c.type&&!c.checked))for(e.addClass(s,"active"),c.setAttribute("checked","checked"),c.checked=!0,t(e.btn),t(c),l;r>l;l++){var d=a[l];if(d!==s&&/active/.test(d.className)){var u=d.getElementsByTagName("INPUT")[0];e.removeClass(d,"active"),u.removeAttribute("checked"),u.checked=!1,t(u)}}}},this.addClass=function(t,e){t.classList?t.classList.add(e):(t.className+=" "+e,t.offsetWidth)},this.removeClass=function(t,e){t.classList?t.classList.remove(e):(t.className=t.className.replace(e,"").replace(/^\s+|\s+$/g,""),t.offsetWidth)}}};var e=document.querySelectorAll("[data-toggle=button]"),i=0,o=e.length;for(i;o>i;i++)new t(e[i]);var s=document.querySelectorAll("[data-toggle=buttons]"),n=0,a=s.length;for(n;a>n;n++)new t(s[n]);return t}),function(t){"undefined"!=typeof module&&"object"==typeof exports?"undefined"!=typeof window?module.exports=t():module.exports=t:window.Carousel=t()}(function(){var t=function(t,e){e=e||{},this.carousel="object"==typeof t?t:document.querySelector(t),this.options={},this.options.keyboard="true"===e.keyboard?!0:!1,this.options.pause=e.pause?e.pause:"hover",this.duration=600,this.isIE=null!=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})").exec(navigator.userAgent)?parseFloat(RegExp.$1):!1,this.options.duration=this.isIE&&this.isIE<10?0:e.duration||this.duration;var i=this.carousel.querySelectorAll(".item"),o=i.length;this.controls=this.carousel.querySelectorAll(".carousel-control"),this.prev=this.controls[0],this.next=this.controls[1],this.slides=[];for(var s=0;o>s;s++)this.slides.push(i[s]);this.indicator=this.carousel.querySelector(".carousel-indicators"),this.indicators=this.carousel.querySelectorAll(".carousel-indicators li"),this.total=this.slides.length,this.timer=null,this.direction=null,this.index=0,"false"===e.interval?this.options.interval=!1:this.options.interval=parseInt(e.interval)||5e3,this.init()};t.prototype={init:function(){this.options.interval!==!1&&this.cycle(),this.options&&"hover"===this.options.pause&&this.options.interval!==!1&&this.pause(),this.actions(),this._addEventListeners()},cycle:function(t){var e=this;e.direction="left",e.timer=setInterval(function(){e.index++,e.index==e.slides.length&&(e.index=0),e._slideTo(e.index,t)},e.options.interval)},pause:function(){var t=this,e=function(){t.options.interval===!1||/paused/.test(t.carousel.className)||(t.carousel.className+=" paused",clearInterval(t.timer),t.timer=null)},i=function(){t.options.interval!==!1&&/paused/.test(t.carousel.className)&&(t.cycle(),t.carousel.className=t.carousel.className.replace(" paused",""))};t.carousel.addEventListener("mouseenter",e,!1),t.carousel.addEventListener("mouseleave",i,!1),t.carousel.addEventListener("touchstart",e,!1),t.carousel.addEventListener("touchend",i,!1)},_slideTo:function(t,e){var i=this,o=i._getActiveIndex(),s=i.direction,n="left"===s?"next":"prev",a=null,r=null;"CustomEvent"in window&&window.dispatchEvent&&(a=new CustomEvent("slid.bs.carousel"),r=new CustomEvent("slide.bs.carousel")),a&&i.carousel.dispatchEvent(a),i._removeEventListeners(),clearInterval(i.timer),i.timer=null,i._curentPage(i.indicators[t]),!/slide/.test(this.carousel.className)||this.isIE&&this.isIE<10?(i.slides[t].className+=" active",i.slides[t].offsetWidth,i.slides[o].className=i.slides[o].className.replace(" active",""),setTimeout(function(){i._addEventListeners(),i.options.interval===!1||/paused/.test(i.carousel.className)||(clearInterval(i.timer),i.cycle()),r&&i.carousel.dispatchEvent(r)},i.options.duration+100)):(i.slides[t].className+=" "+n,i.slides[t].offsetWidth,i.slides[t].className+=" "+s,i.slides[o].className+=" "+s,setTimeout(function(){i._addEventListeners(),i.slides[t].className+=" active",i.slides[o].className=i.slides[o].className.replace(" active",""),i.slides[t].className=i.slides[t].className.replace(" "+n,""),i.slides[t].className=i.slides[t].className.replace(" "+s,""),i.slides[o].className=i.slides[o].className.replace(" "+s,""),i.options.interval===!1||/paused/.test(i.carousel.className)||(clearInterval(i.timer),i.cycle()),r&&i.carousel.dispatchEvent(r)},i.options.duration+100))},_addEventListeners:function(){var t=this;t.next&&t.next.addEventListener("click",t.controlsHandler,!1),t.prev&&t.prev.addEventListener("click",t.controlsHandler,!1),t.indicator&&t.indicator.addEventListener("click",t.indicatorHandler,!1),t.options.keyboard===!0&&window.addEventListener("keydown",t.keyHandler,!1)},_removeEventListeners:function(){var t=this;t.next&&t.next.removeEventListener("click",t.controlsHandler,!1),t.prev&&t.prev.removeEventListener("click",t.controlsHandler,!1),t.indicator&&t.indicator.removeEventListener("click",t.indicatorHandler,!1),t.options.keyboard===!0&&window.removeEventListener("keydown",t.keyHandler,!1)},_getActiveIndex:function(){return this.slides.indexOf(this.carousel.querySelector(".item.active"))},_curentPage:function(t){for(var e=0;et.index||0===o&&t.index===t.total-1)&&(t.direction="right"),t._slideTo(t.index,e)},t.controlsHandler=function(e){var i=e.currentTarget||e.srcElement;e.preventDefault(),i===t.next?(t.index++,t.direction="left",t.index==t.total-1?t.index=t.total-1:t.index==t.total&&(t.index=0)):i===t.prev&&(t.index--,t.direction="right",0==t.index?t.index=0:t.index<0&&(t.index=t.total-1)),t._slideTo(t.index,e)},t.keyHandler=function(e){switch(e.which){case 39:e.preventDefault(),t.index++,t.direction="left",t.index==t.total-1?t.index=t.total-1:t.index==t.total&&(t.index=0);break;case 37:e.preventDefault(),t.index--,t.direction="right",0==t.index?t.index=0:t.index<0&&(t.index=t.total-1);break;default:return}t._slideTo(t.index,e)}}};var e=document.querySelectorAll('[data-ride="carousel"]'),i=0,o=e.length;for(i;o>i;i++){var s=e[i],n={};n.interval=s.getAttribute("data-interval")&&s.getAttribute("data-interval"),n.pause=s.getAttribute("data-pause")&&s.getAttribute("data-pause")||"hover",n.keyboard=s.getAttribute("data-keyboard")&&s.getAttribute("data-keyboard")||!1,n.duration=s.getAttribute("data-duration")&&s.getAttribute("data-duration")||!1,new t(s,n)}return t}),function(t){"undefined"!=typeof module&&"object"==typeof exports?"undefined"!=typeof window?module.exports=t():module.exports=t:window.Collapse=t()}(function(){var t=function(t,e){e=e||{},this.isIE=null!=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})").exec(navigator.userAgent)?parseFloat(RegExp.$1):!1,this.btn="object"==typeof t?t:document.querySelector(t),this.accordion=null,this.collapse=null,this.duration=300,this.options={},this.options.duration=this.isIE&&this.isIE<10?0:e.duration||this.duration,this.init()};t.prototype={init:function(){this.actions(),this.addEvent()},actions:function(){var t=this,e=function(t){var e=t&&t.currentStyle||window.getComputedStyle(t),i=e.borderTopWidth||0,o=/px/.test(e.marginTop)?Math.round(e.marginTop.replace("px","")):0,s=/px/.test(e.marginBottom)?Math.round(e.marginBottom.replace("px","")):0,n=/em/.test(e.marginTop)?Math.round(e.marginTop.replace("em","")*parseInt(e.fontSize)):0,a=/em/.test(e.marginBottom)?Math.round(e.marginBottom.replace("em","")*parseInt(e.fontSize)):0;return t.clientHeight+parseInt(i)+parseInt(o)+parseInt(s)+parseInt(n)+parseInt(a)};this.toggle=function(e){t.btn=t.getTarget(e).btn,t.collapse=t.getTarget(e).collapse,/in/.test(t.collapse.className)?t.close(e):t.open(e)},this.close=function(e){e.preventDefault(),t.btn=t.getTarget(e).btn,t.collapse=t.getTarget(e).collapse,t._close(t.collapse),t.removeClass(t.btn,"collapsed")},this.open=function(e){if(e.preventDefault(),t.btn=t.getTarget(e).btn,t.collapse=t.getTarget(e).collapse,t.accordion=t.btn.getAttribute("data-parent")&&t.getClosest(t.btn,t.btn.getAttribute("data-parent")),t._open(t.collapse),t.addClass(t.btn,"collapsed"),null!==t.accordion){var i=t.accordion.querySelectorAll(".collapse.in"),o=i.length,s=0;for(s;o>s;s++)i[s]!==t.collapse&&t._close(i[s])}},this._open=function(e){t.removeEvent(),t.addClass(e,"in"),e.setAttribute("area-expanded","true"),t.addClass(e,"collapsing"),setTimeout(function(){var i=t.getMaxHeight(e);e.style.height=i+"px",e.style.overflowY="hidden"},0),setTimeout(function(){e.style.height="",e.style.overflowY="",t.removeClass(e,"collapsing"),t.addEvent()},t.options.duration)},this._close=function(e){t.removeEvent(),e.setAttribute("area-expanded","false"),e.style.height=t.getMaxHeight(e)+"px",setTimeout(function(){e.style.height="0px",e.style.overflowY="hidden",t.addClass(e,"collapsing")},0),setTimeout(function(){t.removeClass(e,"collapsing"),t.removeClass(e,"in"),e.style.overflowY="",e.style.height="",t.addEvent()},t.options.duration)},this.getMaxHeight=function(t){for(var i=0,o=0,s=t.children.length;s>o;o++)i+=e(t.children[o]);return i},this.removeEvent=function(){this.btn.removeEventListener("click",this.toggle,!1)},this.addEvent=function(){this.btn.addEventListener("click",this.toggle,!1)},this.getTarget=function(t){var e=t.currentTarget||t.srcElement,i=e.href&&e.getAttribute("href").replace("#",""),o=e.getAttribute("data-target")&&e.getAttribute("data-target"),s=i||o&&/#/.test(o)&&o.replace("#",""),n=o&&"."===o.charAt(0)&&o,a=s&&document.getElementById(s)||n&&document.querySelector(n);return{btn:e,collapse:a}},this.getClosest=function(t,e){for(var i=e.charAt(0);t&&t!==document;t=t.parentNode){if("."===i&&void 0!==document.querySelector(e))return t;if("#"===i&&t.id===e.substr(1))return t}return!1},this.addClass=function(t,e){t.classList?t.classList.add(e):t.className+=" "+e},this.removeClass=function(t,e){t.classList?t.classList.remove(e):t.className=t.className.replace(e,"").replace(/^\s+|\s+$/g,"")}}};var e=document.querySelectorAll('[data-toggle="collapse"]'),i=0,o=e.length;for(i;o>i;i++){var s=e[i],n={};n.duration=s.getAttribute("data-duration"),new t(s,n)}return t}),function(t){"undefined"!=typeof module&&"object"==typeof exports?"undefined"!=typeof window?module.exports=t():module.exports=t:window.Dropdown=t()}(function(t){var e=function(t){this.menu="object"==typeof t?t:document.querySelector(t),this.init()};e.prototype={init:function(){this.actions(),this.menu.setAttribute("tabindex","0"),document.addEventListener("click",this.handle,!1)},actions:function(){var t=this;this.handle=function(e){var i=e.target||e.currentTarget;i===t.menu||i===t.menu.querySelector("span")?t.toggle(e):t.close(200),/\#$/g.test(i.href)&&e.preventDefault()},this.toggle=function(t){/open/.test(this.menu.parentNode.className)?(this.close(0),document.removeEventListener("keydown",this.key,!1)):(this.menu.parentNode.className+=" open",this.menu.setAttribute("aria-expanded",!0),document.addEventListener("keydown",this.key,!1))},this.key=function(e){27==e.which&&t.close(0)},this.close=function(e){setTimeout(function(){t.menu.parentNode.className=t.menu.parentNode.className.replace(" open",""),t.menu.setAttribute("aria-expanded",!1)},e)}}};var i=document.querySelectorAll("[data-toggle=dropdown]"),o=0,s=i.length;for(o;s>o;o++)new e(i[o]);return e}),function(t){"undefined"!=typeof module&&"object"==typeof exports?"undefined"!=typeof window?module.exports=t():module.exports=t:window.Modal=t()}(function(){var t=function(t,e){e=e||{},this.isIE=null!=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})").exec(navigator.userAgent)?parseFloat(RegExp.$1):!1,this.opened=!1,this.modal="object"==typeof t?t:document.querySelector(t),this.options={},this.options.backdrop="false"===e.backdrop?!1:!0,this.options.keyboard="false"===e.keyboard?!1:!0,this.options.content=e.content,this.duration=e.duration||300,this.options.duration=this.isIE&&this.isIE<10?0:this.duration,this.scrollbarWidth=0,this.dialog=this.modal.querySelector(".modal-dialog"),this.timer=0,this.init()},e=function(){var t=document.documentElement.getBoundingClientRect(),e=window.innerWidth||t.right-Math.abs(t.left);return e};t.prototype={init:function(){this.actions(),this.trigger(),this.options.content&&void 0!==this.options.content&&this.content(this.options.content)},actions:function(){var t=this;this.open=function(){this._open()},this.close=function(){this._close()},this._open=function(){this.options.backdrop?this.createOverlay():this.overlay=null,this.overlay&&setTimeout(function(){t.addClass(t.overlay,"in")},0),clearTimeout(t.modal.getAttribute("data-timer")),this.timer=setTimeout(function(){t.modal.style.display="block",t.opened=!0,t.checkScrollbar(),t.adjustDialog(),t.setScrollbar(),t.resize(),t.dismiss(),t.keydown(),t.addClass(document.body,"modal-open"),t.addClass(t.modal,"in"),t.modal.setAttribute("aria-hidden",!1)},t.options.duration/2),this.modal.setAttribute("data-timer",t.timer)},this._close=function(){this.overlay&&this.removeClass(this.overlay,"in"),this.removeClass(this.modal,"in"),this.modal.setAttribute("aria-hidden",!0),clearTimeout(t.modal.getAttribute("data-timer")),this.timer=setTimeout(function(){t.opened=!1,t.removeClass(document.body,"modal-open"),t.resize(),t.resetAdjustments(),t.resetScrollbar(),t.dismiss(),t.keydown(),t.modal.style.display=""},t.options.duration/2),this.modal.setAttribute("data-timer",t.timer),setTimeout(function(){document.querySelector(".modal.in")||t.removeOverlay()},t.options.duration)},this.content=function(t){return this.modal.querySelector(".modal-content").innerHTML=t},this.createOverlay=function(){var t=document.createElement("div"),e=document.querySelector(".modal-backdrop");t.setAttribute("class","modal-backdrop fade"),e?this.overlay=e:(this.overlay=t,document.body.appendChild(t))},this.removeOverlay=function(){var t=document.querySelector(".modal-backdrop");null!==t&&void 0!==t&&document.body.removeChild(t)},this.keydown=function(){function e(e){t.options.keyboard&&27==e.which&&t.close()}this.opened?document.addEventListener("keydown",e,!1):document.removeEventListener("keydown",e,!1)},this.trigger=function(){var e=document.querySelectorAll('[data-toggle="modal"]'),i=e.length,o=0;for(o;i>o;o++)e[o].addEventListener("click",function(e){var i=e.target,o=i.getAttribute("data-target")&&i.getAttribute("data-target").replace("#","")||i.getAttribute("href")&&i.getAttribute("href").replace("#","");document.getElementById(o)===t.modal&&t.open()})},this._resize=function(){var t=this.overlay||document.querySelector(".modal-backdrop"),e={w:document.documentElement.clientWidth+"px",h:document.documentElement.clientHeight+"px"};null!==t&&/in/.test(t.className)&&(t.style.height=e.h,t.style.width=e.w)},this.oneResize=function(){function e(){t._resize(),t.handleUpdate(),window.removeEventListener("resize",e,!1)}window.addEventListener("resize",e,!1)},this.resize=function(){this.opened?window.addEventListener("resize",this.oneResize,!1):window.removeEventListener("resize",this.oneResize,!1)},this.dismiss=function(){function e(e){("modal"===e.target.parentNode.getAttribute("data-dismiss")||"modal"===e.target.getAttribute("data-dismiss")||e.target===t.modal)&&(e.preventDefault(),t.close())}this.opened?this.modal.addEventListener("click",e,!1):this.modal.removeEventListener("click",e,!1)},this.handleUpdate=function(){this.adjustDialog()},this.adjustDialog=function(){this.modal.style.paddingLeft=!this.bodyIsOverflowing&&this.modalIsOverflowing?this.scrollbarWidth+"px":"",this.modal.style.paddingRight=this.bodyIsOverflowing&&!this.modalIsOverflowing?this.scrollbarWidth+"px":""},this.resetAdjustments=function(){this.modal.style.paddingLeft="",this.modal.style.paddingRight=""},this.checkScrollbar=function(){this.bodyIsOverflowing=document.body.clientWidthdocument.documentElement.clientHeight,this.scrollbarWidth=this.measureScrollbar()},this.setScrollbar=function(){var t=window.getComputedStyle(document.body),e=parseInt(t.paddingRight,10);this.bodyIsOverflowing&&(document.body.style.paddingRight=e+this.scrollbarWidth+"px")},this.resetScrollbar=function(){document.body.style.paddingRight=""},this.measureScrollbar=function(){var t=document.createElement("div");t.className="modal-scrollbar-measure",document.body.appendChild(t);var e=t.offsetWidth-t.clientWidth;return document.body.removeChild(t),e},this.addClass=function(t,e){t.classList?t.classList.add(e):t.className+=" "+e},this.removeClass=function(t,e){t.classList?t.classList.remove(e):t.className=t.className.replace(e,"").replace(/^\s+|\s+$/g,"")}}};var i=document.querySelectorAll(".modal"),o=i.length,s=0;for(s;o>s;s++){var n=i[s],a={};a.keyboard=n.getAttribute("data-keyboard"),a.backdrop=n.getAttribute("data-backdrop"),a.duration=n.getAttribute("data-duration"),new t(n,a)}return t}),function(t){"undefined"!=typeof module&&"object"==typeof exports?"undefined"!=typeof window?module.exports=t():module.exports=t:window.Popover=t()}(function(){var t=function(t,e){e=e||{},this.isIE=null!=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})").exec(navigator.userAgent)?parseFloat(RegExp.$1):!1,this.link="object"==typeof t?t:document.querySelector(t),this.title=this.link.getAttribute("data-title")||null,this.content=this.link.getAttribute("data-content")||null,this.popover=null,this.options={},this.options.template=e.template?e.template:null,this.options.trigger=e.trigger?e.trigger:"hover",this.options.animation=e.animation&&"true"!==e.animation?e.animation:"true",this.options.placement=e.placement?e.placement:"top",this.options.delay=parseInt(e.delay)||100,this.options.dismiss=e.dismiss&&"true"===e.dismiss?!0:!1,this.duration=150,this.options.duration=this.isIE&&this.isIE<10?0:e.duration||this.duration,this.options.container=document.body,(this.content||this.options.template)&&this.init(),this.timer=0,this.rect=null};t.prototype={init:function(){this.actions();var t="onmouseleave"in this.link?["mouseenter","mouseleave"]:["mouseover","mouseout"];"hover"===this.options.trigger?(this.link.addEventListener(t[0],this.open,!1),this.options.dismiss||this.link.addEventListener(t[1],this.close,!1)):"click"===this.options.trigger?(this.link.addEventListener("click",this.toggle,!1),this.options.dismiss||this.link.addEventListener("blur",this.close,!1)):"focus"===this.options.trigger&&(this.link.addEventListener("focus",this.toggle,!1),this.options.dismiss||this.link.addEventListener("blur",this.close,!1)),this.options.dismiss&&document.addEventListener("click",this.dismiss,!1),this.isIE&&this.isIE<9||window.addEventListener("resize",this.close,!1)},actions:function(){var t=this;this.toggle=function(e){null===t.popover?t.open():t.close()},this.open=function(e){clearTimeout(t.link.getAttribute("data-timer")),t.timer=setTimeout(function(){null===t.popover&&(t.createPopover(),t.stylePopover(),t.updatePopover())},t.options.duration),t.link.setAttribute("data-timer",t.timer)},this.dismiss=function(e){t.popover&&e.target===t.popover.querySelector(".close")&&t.close()},this.close=function(e){clearTimeout(t.link.getAttribute("data-timer")),t.timer=setTimeout(function(){t.popover&&null!==t.popover&&/in/.test(t.popover.className)&&(t.popover.className=t.popover.className.replace(" in",""),setTimeout(function(){t.removePopover()},t.options.duration))},t.options.delay+t.options.duration),t.link.setAttribute("data-timer",t.timer)},this.removePopover=function(){this.popover&&this.options.container.removeChild(this.popover),this.popover=null,this.timer=null},this.createPopover=function(){if(this.popover=document.createElement("div"),null!==this.content&&null===this.options.template){this.popover.setAttribute("role","tooltip");var t=document.createElement("div");if(t.setAttribute("class","arrow"),null!==this.title){var e=document.createElement("h3");e.setAttribute("class","popover-title"),this.options.dismiss?e.innerHTML=this.title+'':e.innerHTML=this.title,this.popover.appendChild(e)}var i=document.createElement("div");i.setAttribute("class","popover-content"),this.popover.appendChild(t),this.popover.appendChild(i),this.options.dismiss&&null===this.title?i.innerHTML=this.content+'':i.innerHTML=this.content}else{var o=document.createElement("div");o.innerHTML=this.options.template,this.popover.innerHTML=o.firstChild.innerHTML}this.options.container.appendChild(this.popover),this.popover.style.display="block"},this.stylePopover=function(t){this.rect=this.getRect();var e=t||this.options.placement,i="true"===this.options.animation?"fade":"";this.popover.setAttribute("class","popover "+e+" "+i);var o={w:this.link.offsetWidth,h:this.link.offsetHeight},s=this.popoverDimensions(this.popover),n={w:s.w,h:s.h},a=this.getScroll().y,r=this.getScroll().x;/top/.test(e)?(this.popover.style.top=this.rect.top+a-n.h+"px",this.popover.style.left=this.rect.left+r-n.w/2+o.w/2+"px"):/bottom/.test(e)?(this.popover.style.top=this.rect.top+a+o.h+"px",this.popover.style.left=this.rect.left+r-n.w/2+o.w/2+"px"):/left/.test(e)?(this.popover.style.top=this.rect.top+a-n.h/2+o.h/2+"px",this.popover.style.left=this.rect.left+r-n.w+"px"):/right/.test(e)&&(this.popover.style.top=this.rect.top+a-n.h/2+o.h/2+"px",this.popover.style.left=this.rect.left+r+o.w+"px")},this.updatePopover=function(){var e=null;e=t.isElementInViewport(t.popover)?t.options.placement:t.updatePlacement(),t.stylePopover(e),t.popover.className+=" in"},this.updatePlacement=function(){var t=this.options.placement;return/top/.test(t)?"bottom":/bottom/.test(t)?"top":/left/.test(t)?"right":/right/.test(t)?"left":void 0},this.getRect=function(){return this.link.getBoundingClientRect()},this.getScroll=function(){return{y:window.pageYOffset||document.documentElement.scrollTop,x:window.pageXOffset||document.documentElement.scrollLeft}},this.popoverDimensions=function(t){return{w:t.offsetWidth,h:t.offsetHeight}},this.isElementInViewport=function(t){var e=t.getBoundingClientRect();return e.top>=0&&e.left>=0&&e.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&e.right<=(window.innerWidth||document.documentElement.clientWidth)}}};var e=document.querySelectorAll("[data-toggle=popover]"),i=0,o=e.length;for(i;o>i;i++){var s=e[i],n={};n.trigger=s.getAttribute("data-trigger"),n.animation=s.getAttribute("data-animation"),n.duration=s.getAttribute("data-duration"),n.placement=s.getAttribute("data-placement"),n.dismiss=s.getAttribute("data-dismiss"),n.delay=s.getAttribute("data-delay"),new t(s,n)}return t}),function(t){"undefined"!=typeof module&&"object"==typeof exports?"undefined"!=typeof window?module.exports=t():module.exports=t:window.ScrollSpy=t()}(function(){var t=function(t,e,i){i=i||{},this.element="object"==typeof t?t:document.querySelector(t),this.options={},this.isIE=null!=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})").exec(navigator.userAgent)?parseFloat(RegExp.$1):!1,this.options.target=i.target?"object"==typeof i.target?i.target:document.querySelector(i.target):null,this.items=this.options.target&&this.options.target.getElementsByTagName("A"),this.item=e,this.parent=this.item.parentNode,this.parentParent=this.parent.parentNode.parentNode,this.tg=this.item.href&&document.getElementById(this.item.getAttribute("href").replace("#","")),this.active=!1,this.topEdge=0,this.bottomEdge=0,this.element.offsetHeight-1&&(this.checkEdges(),this.refresh(),this.scrollEvent(),this.isIE&&this.isIE<9||this.resizeEvent())},topLimit:function(){return this.scrollTarget===window?this.tg.getBoundingClientRect().top+this.scrollOffset()-5:this.tg.offsetTop},bottomLimit:function(){return this.topLimit()+this.tg.clientHeight},checkEdges:function(){this.topEdge=this.topLimit(),this.bottomEdge=this.bottomLimit()},scrollOffset:function(){return this.scrollTarget===window?window.pageYOffset||document.documentElement.scrollTop:this.element.scrollTop},activate:function(){this.parent&&"LI"===this.parent.tagName&&!/active/.test(this.parent.className)&&(this.addClass(this.parent,"active"),this.parentParent&&"LI"===this.parentParent.tagName&&/dropdown/.test(this.parentParent.className)&&!/active/.test(this.parentParent.className)&&this.addClass(this.parentParent,"active"),this.active=!0)},deactivate:function(){this.parent&&"LI"===this.parent.tagName&&/active/.test(this.parent.className)&&(this.removeClass(this.parent,"active"),this.parentParent&&"LI"===this.parentParent.tagName&&/dropdown/.test(this.parentParent.className)&&/active/.test(this.parentParent.className)&&this.removeClass(this.parentParent,"active"),this.active=!1)},toggle:function(){this.active===!1&&this.bottomEdge>this.scrollOffset()&&this.scrollOffset()>=this.topEdge?this.activate():this.active===!0&&this.bottomEdge<=this.scrollOffset()&&this.scrollOffset()i;i++){var s=e[i],n={};if(n.target=s.getAttribute("data-target")||null,null!==n.target){var a="object"===n.target?n.target:document.querySelector(n.target),r=a.querySelectorAll("a"),l=0,c=r.length;for(l;c>l;l++){var d=r[l];d.href&&"#"!==d.getAttribute("href")&&new t(s,d,n)}}}return t}),function(t){"undefined"!=typeof module&&"object"==typeof exports?"undefined"!=typeof window?module.exports=t():module.exports=t:window.Tab=t()}(function(){var t=function(t,e){e=e||{},this.isIE=null!=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})").exec(navigator.userAgent)?parseFloat(RegExp.$1):!1,this.tab="object"==typeof t?t:document.querySelector(t),this.tabs=this.tab.parentNode.parentNode,this.dropdown=this.tabs.querySelector(".dropdown"),/dropdown-menu/.test(this.tabs.className)&&(this.dropdown=this.tabs.parentNode,this.tabs=this.tabs.parentNode.parentNode),this.options=e,this.duration=150,this.options.duration=this.isIE&&this.isIE<10?0:e.duration||this.duration,this.init()};t.prototype={init:function(){this.actions(),this.tab.addEventListener("click",this.action,!1)},actions:function(){var t=this;this.action=function(e){e=e||window.e,e.preventDefault();var i=e.target,o=document.getElementById(i.getAttribute("href").replace("#","")),s=new RegExp("(?:^|\\s)dropdown-menu(?!\\S)"),n=t.getActiveTab(),a=t.getActiveContent();/active/.test(i.parentNode.className)||(t.removeClass(n,"active"),t.addClass(i.parentNode,"active"),t.dropdown&&(s.test(t.tab.parentNode.parentNode.className)?/active/.test(t.dropdown.className)||t.addClass(t.dropdown,"active"):/active/.test(t.dropdown.className)&&t.removeClass(t.dropdown,"active")),t.removeClass(a,"in"),setTimeout(function(){t.removeClass(a,"active"),t.addClass(o,"active")},t.options.duration),setTimeout(function(){t.addClass(o,"in")},2*t.options.duration))},this.addClass=function(t,e){t.classList?t.classList.add(e):t.className+=" "+e},this.removeClass=function(t,e){t.classList?t.classList.remove(e):t.className=t.className.replace(e,"").replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")},this.getActiveTab=function(){var t=this.tabs.querySelectorAll(".active");return 1!==t.length||/dropdown/.test(t[0].className)?t.length>1?t[t.length-1]:void 0:t[0]},this.getActiveContent=function(){var t=this.getActiveTab().getElementsByTagName("A")[0].getAttribute("href").replace("#","");return t&&document.getElementById(t)}}};var e=document.querySelectorAll("[data-toggle='tab'], [data-toggle='pill']"),i=e.length,o=0;for(o;i>o;o++){var s=e[o],n={};n.duration=s.getAttribute("data-duration")&&s.getAttribute("data-duration")||!1,new t(s,n)}return t}),function(t){"undefined"!=typeof module&&"object"==typeof exports?"undefined"!=typeof window?module.exports=t():module.exports=t:window.Tooltip=t()}(function(t){var e=function(t,e){e=e||{},this.link="object"==typeof t?t:document.querySelector(t),this.title=this.link.getAttribute("title")||this.link.getAttribute("data-original-title"),this.tooltip=null,this.options={},this.options.animation=e.animation&&"fade"!==e.animation?e.animation:"fade",this.options.placement=e.placement?e.placement:"top",this.options.delay=parseInt(e.delay)||100,this.isIE=null!=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})").exec(navigator.userAgent)?parseFloat(RegExp.$1):!1,this.duration=150,this.options.duration=this.isIE&&this.isIE<10?0:e.duration||this.duration,this.options.container=e.container||document.body,this.title&&this.init(),this.timer=0};e.prototype={init:function(){this.actions(),this.rect=null;var t="onmouseleave"in this.link?["mouseenter","mouseleave"]:["mouseover","mouseout"];this.link.addEventListener(t[0],this.open,!1),this.link.addEventListener(t[1],this.close,!1),this.link.setAttribute("data-original-title",this.title),this.link.removeAttribute("title")},actions:function(){var t=this;this.open=function(e){clearTimeout(t.link.getAttribute("data-timer")),t.timer=setTimeout(function(){null===t.tooltip&&(t.createToolTip(),t.styleTooltip(),t.updateTooltip())},t.options.duration),t.link.setAttribute("data-timer",t.timer)},this.close=function(e){clearTimeout(t.link.getAttribute("data-timer")),t.timer=setTimeout(function(){t.tooltip&&null!==t.tooltip&&(t.tooltip.className=t.tooltip.className.replace(" in",""),setTimeout(function(){t.removeToolTip()},t.options.duration))},t.options.delay+t.options.duration),t.link.setAttribute("data-timer",t.timer)},this.removeToolTip=function(){this.tooltip&&this.options.container.removeChild(this.tooltip),this.tooltip=null},this.createToolTip=function(){this.tooltip=document.createElement("div"),this.tooltip.setAttribute("role","tooltip");var t=document.createElement("div");t.setAttribute("class","tooltip-arrow");var e=document.createElement("div");e.setAttribute("class","tooltip-inner"),this.tooltip.appendChild(t),this.tooltip.appendChild(e),e.innerHTML=this.title,this.options.container.appendChild(this.tooltip)},this.styleTooltip=function(t){this.rect=this.getRect();var e=t||this.options.placement;this.tooltip.setAttribute("class","tooltip "+e+" "+this.options.animation);var i={w:this.link.offsetWidth,h:this.link.offsetHeight},o=this.tooltipDimensions(this.tooltip),s={w:o.w,h:o.h},n=this.getScroll().y,a=this.getScroll().x;/top/.test(e)?(this.tooltip.style.top=this.rect.top+n-s.h+"px",this.tooltip.style.left=this.rect.left+a-s.w/2+i.w/2+"px"):/bottom/.test(e)?(this.tooltip.style.top=this.rect.top+n+i.h+"px",this.tooltip.style.left=this.rect.left+a-s.w/2+i.w/2+"px"):/left/.test(e)?(this.tooltip.style.top=this.rect.top+n-s.h/2+i.h/2+"px",this.tooltip.style.left=this.rect.left+a-s.w+"px"):/right/.test(e)&&(this.tooltip.style.top=this.rect.top+n-s.h/2+i.h/2+"px",this.tooltip.style.left=this.rect.left+a+i.w+"px")},this.updateTooltip=function(){var t=null;t=this.isElementInViewport(this.tooltip)?this.options.placement:this.updatePlacement(),this.styleTooltip(t),this.tooltip.className+=" in"},this.updatePlacement=function(){var t=this.options.placement;return/top/.test(t)?"bottom":/bottom/.test(t)?"top":/left/.test(t)?"right":/right/.test(t)?"left":void 0},this.getRect=function(){return this.link.getBoundingClientRect()},this.getScroll=function(){return{y:window.pageYOffset||document.documentElement.scrollTop,x:window.pageXOffset||document.documentElement.scrollLeft}},this.tooltipDimensions=function(t){return{w:t.offsetWidth,h:t.offsetHeight}},this.isElementInViewport=function(t){var e=t.getBoundingClientRect();return e.top>=0&&e.left>=0&&e.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&e.right<=(window.innerWidth||document.documentElement.clientWidth)}}};var i=document.querySelectorAll("[data-toggle=tooltip]"),o=0,s=i.length;for(o;s>o;o++){var n=i[o],a={};a.animation=n.getAttribute("data-animation"),a.placement=n.getAttribute("data-placement"),a.duration=n.getAttribute("data-duration"),a.delay=n.getAttribute("data-delay"),new e(n,a)}return e}); \ No newline at end of file diff --git a/index.html b/index.html index 526616b3..2f6bd75c 100644 --- a/index.html +++ b/index.html @@ -7,22 +7,22 @@ - - - - - - - Native Javascript for Bootstrap + + + + + + + Native Javascript for Bootstrap - - + + - + - - + + @@ -31,13 +31,14 @@ - - - - - + + + @@ -67,12 +68,19 @@
  • Download
  • + - +