6 lines
25 KiB
JavaScript
6 lines
25 KiB
JavaScript
/*
|
|
* Bootstrap.js by @fat & @mdo
|
|
* Copyright 2012 Twitter, Inc.
|
|
* http://www.apache.org/licenses/LICENSE-2.0.txt
|
|
*/
|
|
!function(a){a(function(){a.support.transition=function(){var b=function(){var d=document.createElement("bootstrap"),c={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"},f;for(f in c){if(d.style[f]!==undefined){return c[f]}}}();return b&&{end:b}}()})}(window.jQuery),!function(b){var a='[data-dismiss="alert"]',c=function(d){b(d).on("click",a,this.close)};c.prototype.close=function(e){function f(){d.trigger("closed").remove()}var h=b(this),g=h.attr("data-target"),d;g||(g=h.attr("href"),g=g&&g.replace(/.*(?=#[^\s]*$)/,"")),d=b(g),e&&e.preventDefault(),d.length||(d=h.hasClass("alert")?h:h.parent()),d.trigger(e=b.Event("close"));if(e.isDefaultPrevented()){return}d.removeClass("in"),b.support.transition&&d.hasClass("fade")?d.on(b.support.transition.end,f):f()},b.fn.alert=function(d){return this.each(function(){var f=b(this),e=f.data("alert");e||f.data("alert",e=new c(this)),typeof d=="string"&&e[d].call(f)})},b.fn.alert.Constructor=c,b(function(){b("body").on("click.alert.data-api",a,c.prototype.close)})}(window.jQuery),!function(b){var a=function(c,d){this.$element=b(c),this.options=b.extend({},b.fn.button.defaults,d)};a.prototype.setState=function(g){var d="disabled",h=this.$element,f=h.data(),c=h.is("input")?"val":"html";g+="Text",f.resetText||h.data("resetText",h[c]()),h[c](f[g]||this.options[g]),setTimeout(function(){g=="loadingText"?h.addClass(d).attr(d,d):h.removeClass(d).removeAttr(d)},0)},a.prototype.toggle=function(){var c=this.$element.closest('[data-toggle="buttons-radio"]');c&&c.find(".active").removeClass("active"),this.$element.toggleClass("active")},b.fn.button=function(c){return this.each(function(){var f=b(this),d=f.data("button"),e=typeof c=="object"&&c;d||f.data("button",d=new a(this,e)),c=="toggle"?d.toggle():c&&d.setState(c)})},b.fn.button.defaults={loadingText:"loading..."},b.fn.button.Constructor=a,b(function(){b("body").on("click.button.data-api","[data-toggle^=button]",function(c){var d=b(c.target);d.hasClass("btn")||(d=d.closest(".btn")),d.button("toggle")})})}(window.jQuery),!function(b){var a=function(c,d){this.$element=b(c),this.options=d,this.options.slide&&this.slide(this.options.slide),this.options.pause=="hover"&&this.$element.on("mouseenter",b.proxy(this.pause,this)).on("mouseleave",b.proxy(this.cycle,this))};a.prototype={cycle:function(c){return c||(this.paused=!1),this.options.interval&&!this.paused&&(this.interval=setInterval(b.proxy(this.next,this),this.options.interval)),this},to:function(d){var g=this.$element.find(".item.active"),f=g.parent().children(),c=f.index(g),e=this;if(d>f.length-1||d<0){return}return this.sliding?this.$element.one("slid",function(){e.to(d)}):c==d?this.pause().cycle():this.slide(d>c?"next":"prev",b(f[d]))},pause:function(c){return c||(this.paused=!0),this.$element.find(".next, .prev").length&&b.support.transition.end&&(this.$element.trigger(b.support.transition.end),this.cycle()),clearInterval(this.interval),this.interval=null,this},next:function(){if(this.sliding){return}return this.slide("next")},prev:function(){if(this.sliding){return}return this.slide("prev")},slide:function(l,e){var c=this.$element.find(".item.active"),g=e||c[l](),m=this.interval,d=l=="next"?"left":"right",k=l=="next"?"first":"last",j=this,h=b.Event("slide",{relatedTarget:g[0]});this.sliding=!0,m&&this.pause(),g=g.length?g:this.$element.find(".item")[k]();if(g.hasClass("active")){return}if(b.support.transition&&this.$element.hasClass("slide")){this.$element.trigger(h);if(h.isDefaultPrevented()){return}g.addClass(l),g[0].offsetWidth,c.addClass(d),g.addClass(d),this.$element.one(b.support.transition.end,function(){g.removeClass([l,d].join(" ")).addClass("active"),c.removeClass(["active",d].join(" ")),j.sliding=!1,setTimeout(function(){j.$element.trigger("slid")},0)})}else{this.$element.trigger(h);if(h.isDefaultPrevented()){return}c.removeClass("active"),g.addClass("active"),this.sliding=!1,this.$element.trigger("slid")}return m&&this.cycle(),this}},b.fn.carousel=function(c){return this.each(function(){var f=b(this),d=f.data("carousel"),e=b.extend({},b.fn.carousel.defaults,typeof c=="object"&&c),g=typeof c=="string"?c:e.slide;d||f.data("carousel",d=new a(this,e)),typeof c=="number"?d.to(c):g?d[g]():e.interval&&d.cycle()})},b.fn.carousel.defaults={interval:5000,pause:"hover"},b.fn.carousel.Constructor=a,b(function(){b("body").on("click.carousel.data-api","[data-slide]",function(d){var g=b(this),f,c=b(g.attr("data-target")||(f=g.attr("href"))&&f.replace(/.*(?=#[^\s]+$)/,"")),e=!c.data("modal")&&b.extend({},c.data(),g.data());c.carousel(e),d.preventDefault()})})}(window.jQuery),!function(b){var a=function(c,d){this.$element=b(c),this.options=b.extend({},b.fn.collapse.defaults,d),this.options.parent&&(this.$parent=b(this.options.parent)),this.options.toggle&&this.toggle()};a.prototype={constructor:a,dimension:function(){var c=this.$element.hasClass("width");return c?"width":"height"},show:function(){var d,f,e,c;if(this.transitioning){return}d=this.dimension(),f=b.camelCase(["scroll",d].join("-")),e=this.$parent&&this.$parent.find("> .accordion-group > .in");if(e&&e.length){c=e.data("collapse");if(c&&c.transitioning){return}e.collapse("hide"),c||e.data("collapse",null)}this.$element[d](0),this.transition("addClass",b.Event("show"),"shown"),b.support.transition&&this.$element[d](this.$element[0][f])},hide:function(){var c;if(this.transitioning){return}c=this.dimension(),this.reset(this.$element[c]()),this.transition("removeClass",b.Event("hide"),"hidden"),this.$element[c](0)},reset:function(d){var c=this.dimension();return this.$element.removeClass("collapse")[c](d||"auto")[0].offsetWidth,this.$element[d!==null?"addClass":"removeClass"]("collapse"),this},transition:function(d,g,f){var c=this,e=function(){g.type=="show"&&c.reset(),c.transitioning=0,c.$element.trigger(f)};this.$element.trigger(g);if(g.isDefaultPrevented()){return}this.transitioning=1,this.$element[d]("in"),b.support.transition&&this.$element.hasClass("collapse")?this.$element.one(b.support.transition.end,e):e()},toggle:function(){this[this.$element.hasClass("in")?"hide":"show"]()}},b.fn.collapse=function(c){return this.each(function(){var f=b(this),d=f.data("collapse"),e=typeof c=="object"&&c;d||f.data("collapse",d=new a(this,e)),typeof c=="string"&&d[c]()})},b.fn.collapse.defaults={toggle:!0},b.fn.collapse.Constructor=a,b(function(){b("body").on("click.collapse.data-api","[data-toggle=collapse]",function(d){var g=b(this),f,c=g.attr("data-target")||d.preventDefault()||(f=g.attr("href"))&&f.replace(/.*(?=#[^\s]+$)/,""),e=b(c).data("collapse")?"toggle":g.data();g[b(c).hasClass("in")?"addClass":"removeClass"]("collapsed"),b(c).collapse(e)})})}(window.jQuery),!function(d){function c(){b(d(a)).removeClass("open")}function b(e){var h=e.attr("data-target"),g;return h||(h=e.attr("href"),h=h&&/#/.test(h)&&h.replace(/.*(?=#[^\s]*$)/,"")),g=d(h),g.length||(g=e.parent()),g}var a="[data-toggle=dropdown]",f=function(e){var g=d(e).on("click.dropdown.data-api",this.toggle);d("html").on("click.dropdown.data-api",function(){g.parent().removeClass("open")})};f.prototype={constructor:f,toggle:function(e){var i=d(this),g,h;if(i.is(".disabled, :disabled")){return}return g=b(i),h=g.hasClass("open"),c(),h||(g.toggleClass("open"),i.focus()),!1},keydown:function(h){var l,j,i,k,g,e;if(!/(38|40|27)/.test(h.keyCode)){return}l=d(this),h.preventDefault(),h.stopPropagation();if(l.is(".disabled, :disabled")){return}k=b(l),g=k.hasClass("open");if(!g||g&&h.keyCode==27){return l.click()}j=d("[role=menu] li:not(.divider) a",k);if(!j.length){return}e=j.index(j.filter(":focus")),h.keyCode==38&&e>0&&e--,h.keyCode==40&&e<j.length-1&&e++,~e||(e=0),j.eq(e).focus()}},d.fn.dropdown=function(e){return this.each(function(){var h=d(this),g=h.data("dropdown");g||h.data("dropdown",g=new f(this)),typeof e=="string"&&g[e].call(h)})},d.fn.dropdown.Constructor=f,d(function(){d("html").on("click.dropdown.data-api touchstart.dropdown.data-api",c),d("body").on("click.dropdown touchstart.dropdown.data-api",".dropdown form",function(g){g.stopPropagation()}).on("click.dropdown.data-api touchstart.dropdown.data-api",a,f.prototype.toggle).on("keydown.dropdown.data-api touchstart.dropdown.data-api",a+", [role=menu]",f.prototype.keydown)})}(window.jQuery),!function(b){var a=function(c,d){this.options=d,this.$element=b(c).delegate('[data-dismiss="modal"]',"click.dismiss.modal",b.proxy(this.hide,this)),this.options.remote&&this.$element.find(".modal-body").load(this.options.remote)};a.prototype={constructor:a,toggle:function(){return this[this.isShown?"hide":"show"]()},show:function(){var c=this,d=b.Event("show");this.$element.trigger(d);if(this.isShown||d.isDefaultPrevented()){return}b("body").addClass("modal-open"),this.isShown=!0,this.escape(),this.backdrop(function(){var e=b.support.transition&&c.$element.hasClass("fade");c.$element.parent().length||c.$element.appendTo(document.body),c.$element.show(),e&&c.$element[0].offsetWidth,c.$element.addClass("in").attr("aria-hidden",!1).focus(),c.enforceFocus(),e?c.$element.one(b.support.transition.end,function(){c.$element.trigger("shown")}):c.$element.trigger("shown")})},hide:function(c){c&&c.preventDefault();var d=this;c=b.Event("hide"),this.$element.trigger(c);if(!this.isShown||c.isDefaultPrevented()){return}this.isShown=!1,b("body").removeClass("modal-open"),this.escape(),b(document).off("focusin.modal"),this.$element.removeClass("in").attr("aria-hidden",!0),b.support.transition&&this.$element.hasClass("fade")?this.hideWithTransition():this.hideModal()},enforceFocus:function(){var c=this;b(document).on("focusin.modal",function(d){c.$element[0]!==d.target&&!c.$element.has(d.target).length&&c.$element.focus()})},escape:function(){var c=this;this.isShown&&this.options.keyboard?this.$element.on("keyup.dismiss.modal",function(d){d.which==27&&c.hide()}):this.isShown||this.$element.off("keyup.dismiss.modal")},hideWithTransition:function(){var c=this,d=setTimeout(function(){c.$element.off(b.support.transition.end),c.hideModal()},500);this.$element.one(b.support.transition.end,function(){clearTimeout(d),c.hideModal()})},hideModal:function(c){this.$element.hide().trigger("hidden"),this.backdrop()},removeBackdrop:function(){this.$backdrop.remove(),this.$backdrop=null},backdrop:function(d){var f=this,e=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var c=b.support.transition&&e;this.$backdrop=b('<div class="modal-backdrop '+e+'" />').appendTo(document.body),this.options.backdrop!="static"&&this.$backdrop.click(b.proxy(this.hide,this)),c&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),c?this.$backdrop.one(b.support.transition.end,d):d()}else{!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),b.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(b.support.transition.end,b.proxy(this.removeBackdrop,this)):this.removeBackdrop()):d&&d()}}},b.fn.modal=function(c){return this.each(function(){var f=b(this),d=f.data("modal"),e=b.extend({},b.fn.modal.defaults,f.data(),typeof c=="object"&&c);d||f.data("modal",d=new a(this,e)),typeof c=="string"?d[c]():e.show&&d.show()})},b.fn.modal.defaults={backdrop:!0,keyboard:!0,show:!0},b.fn.modal.Constructor=a,b(function(){b("body").on("click.modal.data-api",'[data-toggle="modal"]',function(d){var g=b(this),f=g.attr("href"),c=b(g.attr("data-target")||f&&f.replace(/.*(?=#[^\s]+$)/,"")),e=c.data("modal")?"toggle":b.extend({remote:!/#/.test(f)&&f},c.data(),g.data());d.preventDefault(),c.modal(e).one("hide",function(){g.focus()})})})}(window.jQuery),!function(b){var a=function(d,c){this.init("tooltip",d,c)};a.prototype={constructor:a,init:function(d,g,f){var c,e;this.type=d,this.$element=b(g),this.options=this.getOptions(f),this.enabled=!0,this.options.trigger=="click"?this.$element.on("click."+this.type,this.options.selector,b.proxy(this.toggle,this)):this.options.trigger!="manual"&&(c=this.options.trigger=="hover"?"mouseenter":"focus",e=this.options.trigger=="hover"?"mouseleave":"blur",this.$element.on(c+"."+this.type,this.options.selector,b.proxy(this.enter,this)),this.$element.on(e+"."+this.type,this.options.selector,b.proxy(this.leave,this))),this.options.selector?this._options=b.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},getOptions:function(c){return c=b.extend({},b.fn[this.type].defaults,c,this.$element.data()),c.delay&&typeof c.delay=="number"&&(c.delay={show:c.delay,hide:c.delay}),c},enter:function(c){var d=b(c.currentTarget)[this.type](this._options).data(this.type);if(!d.options.delay||!d.options.delay.show){return d.show()}clearTimeout(this.timeout),d.hoverState="in",this.timeout=setTimeout(function(){d.hoverState=="in"&&d.show()},d.options.delay.show)},leave:function(c){var d=b(c.currentTarget)[this.type](this._options).data(this.type);this.timeout&&clearTimeout(this.timeout);if(!d.options.delay||!d.options.delay.hide){return d.hide()}d.hoverState="out",this.timeout=setTimeout(function(){d.hoverState=="out"&&d.hide()},d.options.delay.hide)},show:function(){var h,d,k,g,c,f,j;if(this.hasContent()&&this.enabled){h=this.tip(),this.setContent(),this.options.animation&&h.addClass("fade"),f=typeof this.options.placement=="function"?this.options.placement.call(this,h[0],this.$element[0]):this.options.placement,d=/in/.test(f),h.remove().css({top:0,left:0,display:"block"}).appendTo(d?this.$element:document.body),k=this.getPosition(d),g=h[0].offsetWidth,c=h[0].offsetHeight;switch(d?f.split(" ")[1]:f){case"bottom":j={top:k.top+k.height,left:k.left+k.width/2-g/2};break;case"top":j={top:k.top-c,left:k.left+k.width/2-g/2};break;case"left":j={top:k.top+k.height/2-c/2,left:k.left-g};break;case"right":j={top:k.top+k.height/2-c/2,left:k.left+k.width}}h.css(j).addClass(f).addClass("in")}},setContent:function(){var d=this.tip(),c=this.getTitle();d.find(".tooltip-inner")[this.options.html?"html":"text"](c),d.removeClass("fade in top bottom left right")},hide:function(){function d(){var f=setTimeout(function(){e.off(b.support.transition.end).remove()},500);e.one(b.support.transition.end,function(){clearTimeout(f),e.remove()})}var c=this,e=this.tip();return e.removeClass("in"),b.support.transition&&this.$tip.hasClass("fade")?d():e.remove(),this},fixTitle:function(){var c=this.$element;(c.attr("title")||typeof c.attr("data-original-title")!="string")&&c.attr("data-original-title",c.attr("title")||"").removeAttr("title")},hasContent:function(){return this.getTitle()},getPosition:function(c){return b.extend({},c?{top:0,left:0}:this.$element.offset(),{width:this.$element[0].offsetWidth,height:this.$element[0].offsetHeight})},getTitle:function(){var d,c=this.$element,f=this.options;return d=c.attr("data-original-title")||(typeof f.title=="function"?f.title.call(c[0]):f.title),d},tip:function(){return this.$tip=this.$tip||b(this.options.template)},validate:function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},toggleEnabled:function(){this.enabled=!this.enabled},toggle:function(){this[this.tip().hasClass("in")?"hide":"show"]()},destroy:function(){this.hide().$element.off("."+this.type).removeData(this.type)}},b.fn.tooltip=function(c){return this.each(function(){var f=b(this),d=f.data("tooltip"),e=typeof c=="object"&&c;d||f.data("tooltip",d=new a(this,e)),typeof c=="string"&&d[c]()})},b.fn.tooltip.Constructor=a,b.fn.tooltip.defaults={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover",title:"",delay:0,html:!0}}(window.jQuery),!function(b){var a=function(d,c){this.init("popover",d,c)};a.prototype=b.extend({},b.fn.tooltip.Constructor.prototype,{constructor:a,setContent:function(){var d=this.tip(),c=this.getTitle(),f=this.getContent();d.find(".popover-title")[this.options.html?"html":"text"](c),d.find(".popover-content > *")[this.options.html?"html":"text"](f),d.removeClass("fade top bottom left right in")},hasContent:function(){return this.getTitle()||this.getContent()},getContent:function(){var d,c=this.$element,f=this.options;return d=c.attr("data-content")||(typeof f.content=="function"?f.content.call(c[0]):f.content),d},tip:function(){return this.$tip||(this.$tip=b(this.options.template)),this.$tip},destroy:function(){this.hide().$element.off("."+this.type).removeData(this.type)}}),b.fn.popover=function(c){return this.each(function(){var f=b(this),d=f.data("popover"),e=typeof c=="object"&&c;d||f.data("popover",d=new a(this,e)),typeof c=="string"&&d[c]()})},b.fn.popover.Constructor=a,b.fn.popover.defaults=b.extend({},b.fn.tooltip.defaults,{placement:"right",trigger:"click",content:"",template:'<div class="popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"><p></p></div></div></div>'})}(window.jQuery),!function(b){function a(d,g){var f=b.proxy(this.process,this),c=b(d).is("body")?b(window):b(d),e;this.options=b.extend({},b.fn.scrollspy.defaults,g),this.$scrollElement=c.on("scroll.scroll-spy.data-api",f),this.selector=(this.options.target||(e=b(d).attr("href"))&&e.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li > a",this.$body=b("body"),this.refresh(),this.process()}a.prototype={constructor:a,refresh:function(){var c=this,d;this.offsets=b([]),this.targets=b([]),d=this.$body.find(this.selector).map(function(){var e=b(this),g=e.data("target")||e.attr("href"),f=/^#\w/.test(g)&&b(g);return f&&f.length&&[[f.position().top,g]]||null}).sort(function(g,f){return g[0]-f[0]}).each(function(){c.offsets.push(this[0]),c.targets.push(this[1])})},process:function(){var h=this.$scrollElement.scrollTop()+this.options.offset,d=this.$scrollElement[0].scrollHeight||this.$body[0].scrollHeight,k=d-this.$scrollElement.height(),g=this.offsets,c=this.targets,f=this.activeTarget,j;if(h>=k){return f!=(j=c.last()[0])&&this.activate(j)}for(j=g.length;j--;){f!=c[j]&&h>=g[j]&&(!g[j+1]||h<=g[j+1])&&this.activate(c[j])}},activate:function(c){var e,d;this.activeTarget=c,b(this.selector).parent(".active").removeClass("active"),d=this.selector+'[data-target="'+c+'"],'+this.selector+'[href="'+c+'"]',e=b(d).parent("li").addClass("active"),e.parent(".dropdown-menu").length&&(e=e.closest("li.dropdown").addClass("active")),e.trigger("activate")}},b.fn.scrollspy=function(c){return this.each(function(){var f=b(this),d=f.data("scrollspy"),e=typeof c=="object"&&c;d||f.data("scrollspy",d=new a(this,e)),typeof c=="string"&&d[c]()})},b.fn.scrollspy.Constructor=a,b.fn.scrollspy.defaults={offset:10},b(window).on("load",function(){b('[data-spy="scroll"]').each(function(){var c=b(this);c.scrollspy(c.data())})})}(window.jQuery),!function(b){var a=function(c){this.element=b(c)};a.prototype={constructor:a,show:function(){var d=this.element,h=d.closest("ul:not(.dropdown-menu)"),f=d.attr("data-target"),c,e,g;f||(f=d.attr("href"),f=f&&f.replace(/.*(?=#[^\s]*$)/,""));if(d.parent("li").hasClass("active")){return}c=h.find(".active a").last()[0],g=b.Event("show",{relatedTarget:c}),d.trigger(g);if(g.isDefaultPrevented()){return}e=b(f),this.activate(d.parent("li"),h),this.activate(e,e.parent(),function(){d.trigger({type:"shown",relatedTarget:c})})},activate:function(d,h,f){function g(){c.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),d.addClass("active"),e?(d[0].offsetWidth,d.addClass("in")):d.removeClass("fade"),d.parent(".dropdown-menu")&&d.closest("li.dropdown").addClass("active"),f&&f()}var c=h.find("> .active"),e=f&&b.support.transition&&c.hasClass("fade");e?c.one(b.support.transition.end,g):g(),c.removeClass("in")}},b.fn.tab=function(c){return this.each(function(){var e=b(this),d=e.data("tab");d||e.data("tab",d=new a(this)),typeof c=="string"&&d[c]()})},b.fn.tab.Constructor=a,b(function(){b("body").on("click.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(c){c.preventDefault(),b(this).tab("show")})})}(window.jQuery),!function(b){var a=function(c,d){this.$element=b(c),this.options=b.extend({},b.fn.typeahead.defaults,d),this.matcher=this.options.matcher||this.matcher,this.sorter=this.options.sorter||this.sorter,this.highlighter=this.options.highlighter||this.highlighter,this.updater=this.options.updater||this.updater,this.$menu=b(this.options.menu).appendTo("body"),this.source=this.options.source,this.shown=!1,this.listen()};a.prototype={constructor:a,select:function(){var c=this.$menu.find(".active").attr("data-value");return this.$element.val(this.updater(c)).change(),this.hide()},updater:function(c){return c},show:function(){var c=b.extend({},this.$element.offset(),{height:this.$element[0].offsetHeight});return this.$menu.css({top:c.top+c.height,left:c.left}),this.$menu.show(),this.shown=!0,this},hide:function(){return this.$menu.hide(),this.shown=!1,this},lookup:function(c){var d;return this.query=this.$element.val(),!this.query||this.query.length<this.options.minLength?this.shown?this.hide():this:(d=b.isFunction(this.source)?this.source(this.query,b.proxy(this.process,this)):this.source,d?this.process(d):this)},process:function(c){var d=this;return c=b.grep(c,function(f){return d.matcher(f)}),c=this.sorter(c),c.length?this.render(c.slice(0,this.options.items)).show():this.shown?this.hide():this},matcher:function(c){return ~c.toLowerCase().indexOf(this.query.toLowerCase())},sorter:function(g){var d=[],h=[],f=[],c;while(c=g.shift()){c.toLowerCase().indexOf(this.query.toLowerCase())?~c.indexOf(this.query)?h.push(c):f.push(c):d.push(c)}return d.concat(h,f)},highlighter:function(d){var c=this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&");return d.replace(new RegExp("("+c+")","ig"),function(g,f){return"<strong>"+f+"</strong>"})},render:function(c){var d=this;return c=b(c).map(function(e,f){return e=b(d.options.item).attr("data-value",f),e.find("a").html(d.highlighter(f)),e[0]}),c.first().addClass("active"),this.$menu.html(c),this},next:function(c){var e=this.$menu.find(".active").removeClass("active"),d=e.next();d.length||(d=b(this.$menu.find("li")[0])),d.addClass("active")},prev:function(d){var c=this.$menu.find(".active").removeClass("active"),f=c.prev();f.length||(f=this.$menu.find("li").last()),f.addClass("active")},listen:function(){this.$element.on("blur",b.proxy(this.blur,this)).on("keypress",b.proxy(this.keypress,this)).on("keyup",b.proxy(this.keyup,this)),(b.browser.chrome||b.browser.webkit||b.browser.msie)&&this.$element.on("keydown",b.proxy(this.keydown,this)),this.$menu.on("click",b.proxy(this.click,this)).on("mouseenter","li",b.proxy(this.mouseenter,this))},move:function(c){if(!this.shown){return}switch(c.keyCode){case 9:case 13:case 27:c.preventDefault();break;case 38:c.preventDefault(),this.prev();break;case 40:c.preventDefault(),this.next()}c.stopPropagation()},keydown:function(c){this.suppressKeyPressRepeat=!~b.inArray(c.keyCode,[40,38,9,13,27]),this.move(c)},keypress:function(c){if(this.suppressKeyPressRepeat){return}this.move(c)},keyup:function(c){switch(c.keyCode){case 40:case 38:break;case 9:case 13:if(!this.shown){return}this.select();break;case 27:if(!this.shown){return}this.hide();break;default:this.lookup()}c.stopPropagation(),c.preventDefault()},blur:function(d){var c=this;setTimeout(function(){c.hide()},150)},click:function(c){c.stopPropagation(),c.preventDefault(),this.select()},mouseenter:function(c){this.$menu.find(".active").removeClass("active"),b(c.currentTarget).addClass("active")}},b.fn.typeahead=function(c){return this.each(function(){var f=b(this),d=f.data("typeahead"),e=typeof c=="object"&&c;d||f.data("typeahead",d=new a(this,e)),typeof c=="string"&&d[c]()})},b.fn.typeahead.defaults={source:[],items:8,menu:'<ul class="typeahead dropdown-menu"></ul>',item:'<li><a href="#"></a></li>',minLength:1},b.fn.typeahead.Constructor=a,b(function(){b("body").on("focus.typeahead.data-api",'[data-provide="typeahead"]',function(c){var d=b(this);if(d.data("typeahead")){return}c.preventDefault(),d.typeahead(d.data())})})}(window.jQuery),!function(b){var a=function(c,d){this.options=b.extend({},b.fn.affix.defaults,d),this.$window=b(window).on("scroll.affix.data-api",b.proxy(this.checkPosition,this)),this.$element=b(c),this.checkPosition()};a.prototype.checkPosition=function(){if(!this.$element.is(":visible")){return}var f=b(document).height(),k=this.$window.scrollTop(),h=this.$element.offset(),e=this.options.offset,g=e.bottom,j=e.top,d="affix affix-top affix-bottom",c;typeof e!="object"&&(g=j=e),typeof j=="function"&&(j=e.top()),typeof g=="function"&&(g=e.bottom()),c=this.unpin!=null&&k+this.unpin<=h.top?!1:g!=null&&h.top+this.$element.height()>=f-g?"bottom":j!=null&&k<=j?"top":!1;if(this.affixed===c){return}this.affixed=c,this.unpin=c=="bottom"?h.top-k:null,this.$element.removeClass(d).addClass("affix"+(c?"-"+c:""))},b.fn.affix=function(c){return this.each(function(){var f=b(this),d=f.data("affix"),e=typeof c=="object"&&c;d||f.data("affix",d=new a(this,e)),typeof c=="string"&&d[c]()})},b.fn.affix.Constructor=a,b.fn.affix.defaults={offset:0},b(window).on("load",function(){b('[data-spy="affix"]').each(function(){var c=b(this),d=c.data();d.offset=d.offset||{},d.offsetBottom&&(d.offset.bottom=d.offsetBottom),d.offsetTop&&(d.offset.top=d.offsetTop),c.affix(d)})})}(window.jQuery); |