bludit/admin/themes/default/js/kube.min.js
2015-03-27 01:00:01 +00:00

1 line
41 KiB
JavaScript

(function(b){b.fn.accordion=function(c){return this.each(function(){b.data(this,"accordion",{});b.data(this,"accordion",a(this,c))})};function a(d,c){return new a.prototype.init(d,c)}b.Accordion=a;b.Accordion.NAME="accordion";b.Accordion.VERSION="1.0";b.Accordion.opts={scroll:false,collapse:true,toggle:true,titleClass:".accordion-title",panelClass:".accordion-panel"};a.fn=b.Accordion.prototype={init:function(d,c){this.$element=d!==false?b(d):false;this.loadOptions(c);this.build();if(this.opts.collapse){this.closeAll()}else{this.openAll()}this.loadFromHash()},loadOptions:function(c){this.opts=b.extend({},b.extend(true,{},b.Accordion.opts),this.$element.data(),c)},setCallback:function(j,h,d){var m=b._data(this.$element[0],"events");if(m&&typeof m[j]!="undefined"){var k=[];var g=m[j].length;for(var f=0;f<g;f++){var c=m[j][f].namespace;if(c=="tools."+b.Accordion.NAME||c==b.Accordion.NAME+".tools"){var l=m[j][f].handler;k.push((typeof d=="undefined")?l.call(this,h):l.call(this,h,d))}}if(k.length==1){return k[0]}else{return k}}return(typeof d=="undefined")?h:d},getTitles:function(){this.titles=this.$element.find(this.opts.titleClass);this.titles.append(b("<span />").addClass("accordion-toggle"));this.titles.each(function(){var c=b(this);c.attr("rel",c.attr("href"))})},getPanels:function(){this.panels=this.$element.find(this.opts.panelClass)},build:function(){this.getTitles();this.getPanels();this.titles.on("click",b.proxy(this.toggle,this))},loadFromHash:function(){if(top.location.hash===""){return}if(!this.opts.scroll){return}if(this.$element.find("[rel="+top.location.hash+"]").size()===0){return}this.open(top.location.hash);this.scrollTo(top.location.hash)},toggle:function(g){g.preventDefault();g.stopPropagation();var f=b(g.target).attr("rel");if(this.opts.toggle){var c=b(g.target);var d=c.closest(this.opts.titleClass);var h=d.hasClass("accordion-title-opened");this.closeAll();if(!h){this.open(f)}}else{if(b("[rel="+f+"]").hasClass("accordion-title-opened")){this.close(f)}else{this.open(f)}}},open:function(c){this.$title=b("[rel="+c+"]");this.$panel=b(c);top.location.hash=c;this.setStatus("open");this.$panel.show();this.setCallback("opened",this.$title,this.$panel)},close:function(c){this.$title=b("[rel="+c+"]");this.$panel=b(c);this.setStatus("close");this.$panel.hide();this.setCallback("closed",this.$title,this.$panel)},setStatus:function(d){var c={toggle:this.$title.find("span.accordion-toggle"),title:this.$title,panel:this.$panel};b.each(c,function(e,f){if(d=="close"){f.removeClass("accordion-"+e+"-opened").addClass("accordion-"+e+"-closed")}else{f.removeClass("accordion-"+e+"-closed").addClass("accordion-"+e+"-opened")}})},openAll:function(){this.titles.each(b.proxy(function(c,d){this.open(b(d).attr("rel"))},this))},closeAll:function(){this.titles.each(b.proxy(function(c,d){this.close(b(d).attr("rel"))},this))},scrollTo:function(c){b("html, body").animate({scrollTop:b(c).offset().top-50},500)}};b(window).on("load.tools.accordion",function(){b('[data-tools="accordion"]').accordion()});a.prototype.init.prototype=a.prototype})(jQuery);(function(b){b.fn.autocomplete=function(c){return this.each(function(){b.data(this,"autocomplete",{});b.data(this,"autocomplete",a(this,c))})};function a(d,c){return new a.prototype.init(d,c)}b.Autocomplete=a;b.Autocomplete.NAME="autocomplete";b.Autocomplete.VERSION="1.0";b.Autocomplete.opts={url:false,min:2,set:"value"};a.fn=b.Autocomplete.prototype={init:function(d,c){this.$element=d!==false?b(d):false;this.loadOptions(c);this.build()},loadOptions:function(c){this.opts=b.extend({},b.extend(true,{},b.Autocomplete.opts),this.$element.data(),c)},setCallback:function(j,h,d){var m=b._data(this.$element[0],"events");if(m&&typeof m[j]!="undefined"){var k=[];var g=m[j].length;for(var f=0;f<g;f++){var c=m[j][f].namespace;if(c=="tools."+b.Autocomplete.NAME||c==b.Autocomplete.NAME+".tools"){var l=m[j][f].handler;k.push((typeof d=="undefined")?l.call(this,h):l.call(this,h,d))}}if(k.length==1){return k[0]}else{return k}}return(typeof d=="undefined")?h:d},build:function(){this.result=b('<ul class="autocomplete">').hide();this.pos=this.$element.offset();this.elementHeight=this.$element.innerHeight();b("body").append(this.result);this.placement=((b(document).height()-(this.pos.top+this.elementHeight))<this.result.height())?"top":"bottom";b(document).on("click",b.proxy(this.hide,this));this.$element.on("keyup",b.proxy(function(d){var c=this.$element.val();if(c.length>=this.opts.min){this.$element.addClass("autocomplete-in");this.result.addClass("autocomplete-open");this.listen(d)}else{this.hide()}},this))},lookup:function(){b.ajax({url:this.opts.url,type:"post",data:this.$element.attr("name")+"="+this.$element.val(),success:b.proxy(function(c){var d=b.parseJSON(c);this.result.html("");b.each(d,b.proxy(function(h,j){var f=b("<li>");var g=b('<a href="#" rel="'+j.id+'">').html(j.value).on("click",b.proxy(this.set,this));f.append(g);this.result.append(f)},this));var e=(this.placement==="top")?(this.pos.top-this.result.height()-this.elementHeight):(this.pos.top+this.elementHeight);this.result.css({top:e+"px",left:this.pos.left+"px"});this.result.show();this.active=false},this)})},listen:function(c){if(!this.$element.hasClass("autocomplete-in")){return}c.stopPropagation();c.preventDefault();switch(c.keyCode){case 40:this.select("next");break;case 38:this.select("prev");break;case 13:this.set();break;case 27:this.hide();break;default:this.lookup();break}},select:function(f){var g=this.result.find("a");var e=g.size();var c=this.result.find("a.active");c.removeClass("active");var d=(f==="next")?c.parent().next().children("a"):c.parent().prev().children("a");if(d.size()===0){d=(f==="next")?g.eq(0):g.eq(e-1)}d.addClass("active");this.active=d},set:function(f){var c=b(this.active);if(f){f.preventDefault();c=b(f.target)}var g=c.attr("rel");var d=c.html();if(this.opts.set=="value"){this.$element.val(d)}else{this.$element.val(g)}this.setCallback("set",g,d);this.hide()},hide:function(c){if(c&&(b(c.target).hasClass("autocomplete-in")||b(c.target).hasClass("autocomplete-open")||b(c.target).parents().hasClass("autocomplete-open"))){return}this.$element.removeClass("autocomplete-in");this.result.removeClass("autocomplete-open");this.result.hide()}};b(window).on("load.tools.autocomplete",function(){b('[data-tools="autocomplete"]').autocomplete()});a.prototype.init.prototype=a.prototype})(jQuery);(function(b){b.fn.buttons=function(c){return this.each(function(){b.data(this,"buttons",{});b.data(this,"buttons",a(this,c))})};function a(d,c){return new a.prototype.init(d,c)}b.Buttons=a;b.Buttons.NAME="buttons";b.Buttons.VERSION="1.0";b.Buttons.opts={className:"btn",activeClassName:"btn-active",target:false,type:"switch"};a.fn=b.Buttons.prototype={init:function(d,c){this.$element=d!==false?b(d):false;this.loadOptions(c);this.buttons=this.getButtons();this.value=this.getValue();this.buttons.each(b.proxy(function(f,g){var e=b(g);this.setDefault(e);e.click(b.proxy(function(h){h.preventDefault();if(this.opts.type==="segmented"){this.setSegmented(e)}else{if(this.opts.type==="toggle"){this.setToggle(e)}else{this.setBasic(e)}}},this))},this))},loadOptions:function(c){this.opts=b.extend({},b.extend(true,{},b.Buttons.opts),this.$element.data(),c)},getButtons:function(){return(this.opts.type==="toggle")?this.$element:this.$element.find("."+this.opts.className)},getValue:function(){return(this.opts.type==="segmented")?b(this.opts.target).val().split(","):b(this.opts.target).val()},setDefault:function(c){if(this.opts.type==="segmented"&&b.inArray(c.val(),this.value)!==-1){this.setActive(c)}else{if((this.opts.type==="toggle"&&this.value===1)||this.value===c.val()){this.setActive(c)}}},setBasic:function(c){this.setInActive(this.buttons);this.setActive(c);b(this.opts.target).val(c.val())},setSegmented:function(d){var c=b(this.opts.target);this.value=c.val().split(",");if(!d.hasClass(this.opts.activeClassName)){this.setActive(d);this.value.push(d.val())}else{this.setInActive(d);this.value.splice(this.value.indexOf(d.val()),1)}c.val(this.value.join(",").replace(/^,/,""))},setToggle:function(c){if(c.hasClass(this.opts.activeClassName)){this.setInActive(c);b(this.opts.target).val(0)}else{this.setActive(c);b(this.opts.target).val(1)}},setActive:function(c){c.addClass(this.opts.activeClassName)},setInActive:function(c){c.removeClass(this.opts.activeClassName)}};b(window).on("load.tools.buttons",function(){b('[data-tools="buttons"]').buttons()});a.prototype.init.prototype=a.prototype})(jQuery);(function(b){b.fn.checkAll=function(c){return this.each(function(){b.data(this,"checkAll",{});b.data(this,"checkAll",a(this,c))})};function a(d,c){return new a.prototype.init(d,c)}b.CheckAll=a;b.CheckAll.opts={classname:false,parent:false,highlight:"highlight",target:false};a.fn=b.CheckAll.prototype={init:function(d,c){this.$element=d!==false?b(d):false;this.loadOptions(c);this.$elements=b("."+this.opts.classname);this.$target=b(this.opts.target);this.$element.on("click",b.proxy(this.load,this));this.setter=(this.opts.target)?this.$target.val().split(","):[];this.$elements.each(b.proxy(this.setOnStart,this))},loadOptions:function(c){this.opts=b.extend({},b.extend(true,{},b.CheckAll.opts),this.$element.data(),c)},load:function(){if(this.$element.prop("checked")){this.$elements.prop("checked",true);if(this.opts.parent||this.opts.target){this.$elements.each(b.proxy(function(d,e){var c=b(e);this.setHighlight(c);this.setValue(c.val())},this))}}else{this.$elements.prop("checked",false);if(this.opts.parent){this.$elements.each(b.proxy(this.removeHighlight,this))}if(this.opts.target){this.$target.val("")}}},setOnStart:function(d,e){var c=b(e);if(this.$element.prop("checked")||(this.setter&&(b.inArray(c.val(),this.setter)!==-1))){c.prop("checked",true);this.setHighlight(c)}c.on("click",b.proxy(function(){var f=this.$elements.filter(":checked").size();if(c.prop("checked")){this.setValue(c.val());this.setHighlight(c)}else{this.removeValue(c.val());this.removeHighlight(c)}var g=(f!==this.$elements.size())?false:true;this.$element.prop("checked",g)},this))},setHighlight:function(c){if(!this.opts.parent){return}c.closest(this.opts.parent).addClass(this.opts.highlight)},removeHighlight:function(d,c){if(!this.opts.parent){return}b(c).closest(this.opts.parent).removeClass(this.opts.highlight)},setValue:function(d){if(!this.opts.target){return}var e=this.$target.val();var c=e.split(",");c.push(d);if(e===""){c=[d]}this.$target.val(c.join(","))},removeValue:function(e){if(!this.opts.target){return}var c=this.$target.val().split(",");var d=c.indexOf(e);c.splice(d,1);this.$target.val(c.join(","))}};b(window).on("load.tools.buttons",function(){b('[data-tools="check-all"]').checkAll()});a.prototype.init.prototype=a.prototype})(jQuery);(function(b){b.fn.dropdown=function(c){return this.each(function(){b.data(this,"dropdown",{});b.data(this,"dropdown",a(this,c))})};function a(d,c){return new a.prototype.init(d,c)}b.Dropdown=a;b.Dropdown.NAME="dropdown";b.Dropdown.VERSION="1.0";b.Dropdown.opts={target:false,targetClose:false,height:false,width:false};a.fn=b.Dropdown.prototype={init:function(d,c){this.$element=d!==false?b(d):false;this.loadOptions(c);this.build()},loadOptions:function(c){this.opts=b.extend({},b.extend(true,{},b.Dropdown.opts),this.$element.data(),c)},setCallback:function(j,h,d){var m=b._data(this.$element[0],"events");if(m&&typeof m[j]!="undefined"){var k=[];var g=m[j].length;for(var f=0;f<g;f++){var c=m[j][f].namespace;if(c=="tools."+b.Dropdown.NAME||c==b.Dropdown.NAME+".tools"){var l=m[j][f].handler;k.push((typeof d=="undefined")?l.call(this,h):l.call(this,h,d))}}if(k.length==1){return k[0]}else{return k}}return(typeof d=="undefined")?h:d},build:function(){this.$dropdown=b(this.opts.target);this.$dropdown.hide();this.$caret=b('<b class="caret"></b>');this.$element.append(this.$caret);this.setCaretUp();this.preventBodyScroll();this.$element.click(b.proxy(this.toggle,this))},setCaretUp:function(){var c=this.$element.offset().top+this.$element.innerHeight()+this.$dropdown.innerHeight();if(b(document).height()>c){return}this.$caret.addClass("caret-up")},toggle:function(c){c.preventDefault();if(this.$element.hasClass("dropdown-in")){this.hide()}else{this.show()}},getPlacement:function(c){return(b(document).height()<c)?"top":"bottom"},getPosition:function(){return(this.$element.closest(".navigation-fixed").size()!==0)?"fixed":"absolute"},setPosition:function(){var j=this.$element.position();var h=this.$element.innerHeight();var k=this.$element.innerWidth();var l=this.$dropdown.innerHeight();var d=this.$dropdown.innerWidth();var g=this.getPosition();var f=this.getPlacement(j.top+l+h);var c=0;if(b(window).width()<(j.left+d)){c=(d-k)}var i;var e=j.left-c;if(f=="bottom"){this.$caret.removeClass("caret-up");i=(g=="fixed")?h:j.top+h}else{this.$caret.addClass("caret-up");i=(g=="fixed")?l:j.top-l}this.$dropdown.css({position:g,top:i+"px",left:e+"px"})},show:function(){b(".dropdown-in").removeClass("dropdown-in");b(".dropdown").removeClass("dropdown-open").hide();if(this.opts.height){this.$dropdown.css("min-height",this.opts.height+"px")}if(this.opts.width){this.$dropdown.width(this.opts.width)}this.setPosition();this.$dropdown.addClass("dropdown-open").show();this.$element.addClass("dropdown-in");b(document).on("scroll.tools.dropdown",b.proxy(this.setPosition,this));b(window).on("resize.tools.dropdown",b.proxy(this.setPosition,this));b(document).on("click.tools.dropdown touchstart.tools.dropdown",b.proxy(this.hide,this));if(this.opts.targetClose){b(this.opts.targetClose).on("click.tools.dropdown",b.proxy(function(c){c.preventDefault();this.hide(false)},this))}b(document).on("keydown.tools.dropdown",b.proxy(function(c){if(c.which===27){this.hide()}},this));this.setCallback("opened",this.$dropdown,this.$element)},preventBodyScroll:function(){this.$dropdown.on("mouseover",function(){b("html").css("overflow","hidden")});this.$dropdown.on("mouseout",function(){b("html").css("overflow","")})},hide:function(d){if(d){d=d.originalEvent||d;var c=b(d.target);if(c.hasClass("caret")||c.hasClass("dropdown-in")||c.closest(".dropdown-open").size()!==0){return}}this.$dropdown.removeClass("dropdown-open").hide();this.$element.removeClass("dropdown-in");b(document).off(".tools.dropdown");b(window).off(".tools.dropdown");this.setCallback("closed",this.$dropdown,this.$element)}};b(window).on("load.tools.dropdown",function(){b('[data-tools="dropdown"]').dropdown()});a.prototype.init.prototype=a.prototype})(jQuery);(function(b){b.fn.filterbox=function(c){return this.each(function(){b.data(this,"filterbox",{});b.data(this,"filterbox",a(this,c))})};function a(d,c){return new a.prototype.init(d,c)}b.Filterbox=a;b.Filterbox.NAME="filterbox";b.Filterbox.VERSION="1.0";b.Filterbox.opts={placeholder:false};a.fn=b.Filterbox.prototype={init:function(d,c){this.$element=d!==false?b(d):false;this.loadOptions(c);this.build()},loadOptions:function(c){this.opts=b.extend({},b.extend(true,{},b.Filterbox.opts),this.$element.data(),c)},setCallback:function(j,h,d){var m=b._data(this.$element[0],"events");if(m&&typeof m[j]!="undefined"){var k=[];var g=m[j].length;for(var f=0;f<g;f++){var c=m[j][f].namespace;if(c=="tools."+b.Filterbox.NAME||c==b.Filterbox.NAME+".tools"){var l=m[j][f].handler;k.push((typeof d=="undefined")?l.call(this,h):l.call(this,h,d))}}if(k.length==1){return k[0]}else{return k}}return(typeof d=="undefined")?h:d},build:function(){this.$sourceBox=b('<div class="filterbox" />');this.$sourceSelect=b('<span class="filterbox-toggle" />');this.$sourceLayer=b('<ul class="filterbox-list hide" />');this.$source=b('<input type="text" id="'+this.$element.attr("id")+'-input" class="'+this.$element.attr("class")+'" />');this.$sourceBox.append(this.$source);this.$sourceBox.append(this.$sourceSelect);this.$sourceBox.append(this.$sourceLayer);this.setPlaceholder();this.$element.hide().after(this.$sourceBox);this.$element.find("option").each(b.proxy(this.buildListItemsFromOptions,this));this.$source.on("keyup",b.proxy(this.clearSelected,this));this.$sourceSelect.on("click",b.proxy(this.load,this));this.preventBodyScroll()},load:function(f){f.preventDefault();if(this.$sourceLayer.hasClass("open")){this.close();return}var d=this.$element.val();this.$sourceLayer.addClass("open").show();var c=this.$sourceLayer.find("li").removeClass("active");this.setSelectedItem(c,d);b(document).on("click.tools.filterbox",b.proxy(this.close,this));b(document).on("keydown.tools.filterbox",b.proxy(function(l){var h=l.which;var g;var k;if(h===38){l.preventDefault();if(c.hasClass("active")){k=c.filter("li.active");k.removeClass("active");var j=k.prev();g=(j.size()!==0)?g=j:c.last()}else{g=c.last()}g.addClass("active");this.setScrollTop(g)}else{if(h===40){l.preventDefault();if(c.hasClass("active")){k=c.filter("li.active");k.removeClass("active");var i=k.next();g=(i.size()!==0)?i:c.first()}else{g=c.first()}g.addClass("active");this.setScrollTop(g)}else{if(h===13){if(!c.hasClass("active")){return}k=c.filter("li.active");this.onItemClick(l,k)}else{if(h===27){this.close()}}}}},this))},clearSelected:function(){if(this.$source.val().length===0){this.$element.val(0)}},setSelectedItem:function(c,e){var f=c.filter("[rel="+e+"]");if(f.size()===0){f=false;var d=this.$source.val();b.each(c,function(h,j){var g=b(j);if(g.text()==d){f=g}});if(f===false){return}}f.addClass("active");this.setScrollTop(f)},setScrollTop:function(c){this.$sourceLayer.scrollTop(this.$sourceLayer.scrollTop()+c.position().top-40)},buildListItemsFromOptions:function(d,e){var c=b(e);var g=c.val();if(g===0){return}var f=b("<li />");f.attr("rel",g).text(c.html());f.on("click",b.proxy(this.onItemClick,this));this.$sourceLayer.append(f)},onItemClick:function(g,f){g.preventDefault();var d=b(f||g.target);var c=d.attr("rel");var h=d.text();this.$source.val(h);this.$element.val(c);this.close();this.setCallback("select",{id:c,value:h})},preventBodyScroll:function(){this.$sourceLayer.on("mouseover",function(){b("html").css("overflow","hidden")});this.$sourceLayer.on("mouseout",function(){b("html").css("overflow","")})},setPlaceholder:function(){if(!this.opts.placeholder){return}this.$source.attr("placeholder",this.opts.placeholder)},close:function(c){if(c&&(b(c.target).hasClass("filterbox-toggle")||b(c.target).closest("div.filterbox").size()==1)){return}this.$sourceLayer.removeClass("open").hide();b(document).off(".tools.filterbox")}};b(window).on("load.tools.filterbox",function(){b('[data-tools="filterbox"]').filterbox()});a.prototype.init.prototype=a.prototype})(jQuery);(function(b){b.fn.infinityScroll=function(c){return this.each(function(){b.data(this,"infinity-scroll",{});b.data(this,"infinity-scroll",a(this,c))})};function a(d,c){return new a.prototype.init(d,c)}b.InfinityScroll=a;b.InfinityScroll.NAME="infinity-scroll";b.InfinityScroll.VERSION="1.0";b.InfinityScroll.opts={url:false,offset:0,limit:20,tolerance:50,pagination:false};a.fn=b.InfinityScroll.prototype={init:function(d,c){this.$element=d!==false?b(d):false;this.loadOptions(c);this.hidePagination();this.build()},loadOptions:function(c){this.opts=b.extend({},b.extend(true,{},b.InfinityScroll.opts),this.$element.data(),c)},setCallback:function(j,h,d){var m=b._data(this.$element[0],"events");if(m&&typeof m[j]!="undefined"){var k=[];var g=m[j].length;for(var f=0;f<g;f++){var c=m[j][f].namespace;if(c=="tools."+b.InfinityScroll.NAME||c==b.InfinityScroll.NAME+".tools"){var l=m[j][f].handler;k.push((typeof d=="undefined")?l.call(this,h):l.call(this,h,d))}}if(k.length==1){return k[0]}else{return k}}return(typeof d=="undefined")?h:d},build:function(){b(window).on("DOMContentLoaded.tools.infinite-scroll load.tools.infinite-scroll resize.tools.infinite-scroll scroll.tools.infinite-scroll",b.proxy(function(){var c=this.$element.children().last();if(this.isElementInViewport(c[0])){this.getData()}},this))},getData:function(){b.ajax({url:this.opts.url,type:"post",data:"limit="+this.opts.limit+"&offset="+this.opts.offset,success:b.proxy(function(c){if(c===""){b(window).off(".tools.infinite-scroll");return}this.opts.offset=this.opts.offset+this.opts.limit;this.$element.append(c);this.setCallback("loaded",c)},this)})},hidePagination:function(){if(!this.opts.pagination){return}b(this.opts.pagination).hide()},isElementInViewport:function(c){var d=c.getBoundingClientRect();return(d.top>=0&&d.left>=0&&d.bottom<=b(window).height()+this.opts.tolerance&&d.right<=b(window).width())}};b(window).on("load.tools.infinity-scroll",function(){b('[data-tools="infinity-scroll"]').infinityScroll()});a.prototype.init.prototype=a.prototype})(jQuery);(function(b){b.fn.livesearch=function(c){return this.each(function(){b.data(this,"livesearch",{});b.data(this,"livesearch",a(this,c))})};function a(d,c){return new a.prototype.init(d,c)}b.Livesearch=a;b.Livesearch.NAME="livesearch";b.Livesearch.VERSION="1.0";b.Livesearch.opts={url:false,target:false,min:2,params:false,appendForms:false};a.fn=b.Livesearch.prototype={init:function(d,c){this.$element=d!==false?b(d):false;this.loadOptions(c);this.build()},loadOptions:function(c){this.opts=b.extend({},b.extend(true,{},b.Livesearch.opts),this.$element.data(),c)},setCallback:function(j,h,d){var m=b._data(this.$element[0],"events");if(m&&typeof m[j]!="undefined"){var k=[];var g=m[j].length;for(var f=0;f<g;f++){var c=m[j][f].namespace;if(c=="tools."+b.Livesearch.NAME||c==b.Livesearch.NAME+".tools"){var l=m[j][f].handler;k.push((typeof d=="undefined")?l.call(this,h):l.call(this,h,d))}}if(k.length==1){return k[0]}else{return k}}return(typeof d=="undefined")?h:d},build:function(){this.$box=b('<span class="livesearch-box" />');this.$element.after(this.$box);this.$box.append(this.$element);this.$element.off("keyup.tools.livesearch");this.$element.on("keyup.tools.livesearch",b.proxy(this.load,this));this.$icon=b('<span class="livesearch-icon" />');this.$box.append(this.$icon);this.$close=b('<span class="close" />').hide();this.$box.append(this.$close);this.$close.off("click.tools.livesearch");this.$close.on("click.tools.livesearch",b.proxy(function(){this.search();this.$element.val("").focus();this.$close.hide()},this))},toggleClose:function(c){if(c===0){this.$close.hide()}else{this.$close.show()}},load:function(){var f=this.$element.val();var e="";if(f.length>this.opts.min){var c="q";if(typeof this.$element.attr("name")!="undefined"){c=this.$element.attr("name")}e+="&"+c+"="+f;e=this.appendForms(e);var h="";if(this.opts.params){this.opts.params=b.trim(this.opts.params.replace("{","").replace("}",""));var d=this.opts.params.split(",");var g={};b.each(d,function(j,i){var l=i.split(":");g[b.trim(l[0])]=b.trim(l[1])});h=[];b.each(g,b.proxy(function(j,i){h.push(j+"="+i)},this));h=h.join("&");e+="&"+h}}this.toggleClose(f.length);this.search(e)},appendForms:function(c){if(!this.opts.appendForms){return c}b.each(this.opts.appendForms,function(d,e){c+="&"+b(e).serialize()});return c},search:function(c){b.ajax({url:this.opts.url,type:"post",data:c,success:b.proxy(function(d){b(this.opts.target).html(d);this.setCallback("result",d)},this)})}};b(window).on("load.tools.livesearch",function(){b('[data-tools="livesearch"]').livesearch()});a.prototype.init.prototype=a.prototype})(jQuery);(function(b){b.fn.message=function(d){var e=[];var c=Array.prototype.slice.call(arguments,1);if(typeof d==="string"){this.each(function(){var g=b.data(this,"message");if(typeof g!=="undefined"&&b.isFunction(g[d])){var f=g[d].apply(g,c);if(f!==undefined&&f!==g){e.push(f)}}else{return b.error('No such method "'+d+'" for Message')}})}else{this.each(function(){b.data(this,"message",{});b.data(this,"message",a(this,d))})}if(e.length===0){return this}else{if(e.length===1){return e[0]}else{return e}}};function a(d,c){return new a.prototype.init(d,c)}b.Message=a;b.Message.NAME="message";b.Message.VERSION="1.0";b.Message.opts={target:false,delay:10};a.fn=b.Message.prototype={init:function(d,c){this.$element=d!==false?b(d):false;this.loadOptions(c);this.build()},loadOptions:function(c){this.opts=b.extend({},b.extend(true,{},b.Message.opts),this.$element.data(),c)},setCallback:function(j,h,d){var m=b._data(this.$message[0],"events");if(m&&typeof m[j]!="undefined"){var k=[];var g=m[j].length;for(var f=0;f<g;f++){var c=m[j][f].namespace;if(c=="tools."+b.Message.NAME||c==b.Message.NAME+".tools"){var l=m[j][f].handler;k.push((typeof d=="undefined")?l.call(this,h):l.call(this,h,d))}}if(k.length==1){return k[0]}else{return k}}return(typeof d=="undefined")?h:d},build:function(){if(!this.opts.target){this.$message=this.$element;this.show()}else{this.$message=b(this.opts.target);this.$message.data("message","");this.$message.data("message",this);this.$element.on("click",b.proxy(this.show,this))}},show:function(){if(this.$message.hasClass("open")){this.hide();return}b(".tools-message").hide().removeClass("open");this.$message.addClass("open").fadeIn("fast").on("click.tools.message",b.proxy(this.hide,this));b(document).on("keyup.tools.message",b.proxy(this.hideHandler,this));if(this.opts.delay){setTimeout(b.proxy(this.hide,this),this.opts.delay*1000)}this.setCallback("opened")},hideHandler:function(c){if(c.which!=27){return}this.hide()},hide:function(){if(!this.$message.hasClass("open")){return}this.$message.off("click.tools.message");b(document).off("keyup.tools.message");this.$message.fadeOut("fast",b.proxy(function(){this.$message.removeClass("open");this.setCallback("closed")},this))}};a.prototype.init.prototype=a.prototype;b(function(){b('[data-tools="message"]').message()})})(jQuery);(function(b){b.fn.modal=function(d){var e=[];var c=Array.prototype.slice.call(arguments,1);if(typeof d==="string"){this.each(function(){var g=b.data(this,"modal");if(typeof g!=="undefined"&&b.isFunction(g[d])){var f=g[d].apply(g,c);if(f!==undefined&&f!==g){e.push(f)}}else{return b.error('No such method "'+d+'" for Modal')}})}else{this.each(function(){b.data(this,"modal",{});b.data(this,"modal",a(this,d))})}if(e.length===0){return this}else{if(e.length===1){return e[0]}else{return e}}};function a(d,c){return new a.prototype.init(d,c)}b.Modal=a;b.Modal.NAME="modal";b.Modal.VERSION="1.0";b.Modal.opts={title:"",width:500,blur:false};a.fn=b.Modal.prototype={init:function(d,c){this.$element=d!==false?b(d):false;this.loadOptions(c);this.$element.on("click.tools.modal",b.proxy(this.load,this))},loadOptions:function(c){this.opts=b.extend({},b.extend(true,{},b.Modal.opts),this.$element.data(),c)},setCallback:function(j,h,d){var m=b._data(this.$element[0],"events");if(m&&typeof m[j]!="undefined"){var k=[];var g=m[j].length;for(var f=0;f<g;f++){var c=m[j][f].namespace;if(c=="tools."+b.Modal.NAME||c==b.Modal.NAME+".tools"){var l=m[j][f].handler;k.push((typeof d=="undefined")?l.call(this,h):l.call(this,h,d))}}if(k.length==1){return k[0]}else{return k}}return(typeof d=="undefined")?h:d},load:function(){this.build();this.enableEvents();this.setTitle();this.setDraggable();this.setContent()},build:function(){this.buildOverlay();this.$modalBox=b('<div class="modal-box" />').hide();this.$modal=b('<div class="modal" />');this.$modalHeader=b("<header />");this.$modalClose=b('<span class="modal-close" />').html("&times;");this.$modalBody=b("<section />");this.$modalFooter=b("<footer />");this.$modal.append(this.$modalHeader);this.$modal.append(this.$modalClose);this.$modal.append(this.$modalBody);this.$modal.append(this.$modalFooter);this.$modalBox.append(this.$modal);this.$modalBox.appendTo(document.body)},buildOverlay:function(){this.$modalOverlay=b('<div id="modal-overlay">').hide();b("body").prepend(this.$modalOverlay);if(this.opts.blur){this.blurredElements=b("body").children("div, section, header, article, pre, aside, table").not(".modal, .modal-box, #modal-overlay");this.blurredElements.addClass("modal-blur")}},show:function(){this.setCallback("loading",this.$modal);this.bodyOveflow=b(document.body).css("overflow");b(document.body).css("overflow","hidden");if(this.isMobile()){this.showOnMobile()}else{this.showOnDesktop()}this.$modalOverlay.show();this.$modalBox.show();this.setButtonsWidth();if(!this.isMobile()){setTimeout(b.proxy(this.showOnDesktop,this),0);b(window).on("resize.tools.modal",b.proxy(this.resize,this))}this.setCallback("opened",this.$modal);b(document).off("focusin.modal")},showOnDesktop:function(){var c=this.$modal.outerHeight();var e=b(window).height();var d=b(window).width();if(this.opts.width>d){this.$modal.css({width:"96%",marginTop:(e/2-c/2)+"px"});return}if(c>e){this.$modal.css({width:this.opts.width+"px",marginTop:"20px"})}else{this.$modal.css({width:this.opts.width+"px",marginTop:(e/2-c/2)+"px"})}},showOnMobile:function(){this.$modal.css({width:"96%",marginTop:"2%"})},resize:function(){if(this.isMobile()){this.showOnMobile()}else{this.showOnDesktop()}},setTitle:function(){this.$modalHeader.html(this.opts.title)},setContent:function(){if(typeof this.opts.content=="object"||this.opts.content.search("#")===0){this.type="html";this.$modalBody.html(b(this.opts.content).html());this.show()}else{b.ajax({url:this.opts.content,cache:false,success:b.proxy(function(c){this.$modalBody.html(c);this.show()},this)})}},setDraggable:function(){if(typeof b.fn.draggable==="undefined"){return}this.$modal.draggable({handle:this.$modalHeader});this.$modalHeader.css("cursor","move")},createCancelButton:function(c){if(typeof c=="undefined"){c="Cancel"}var d=b("<button>").addClass("btn modal-close-btn").html(c);d.on("click",b.proxy(this.close,this));this.$modalFooter.append(d)},createDeleteButton:function(c){if(typeof c=="undefined"){c="Delete"}return this.createButton(c,"red")},createActionButton:function(c){if(typeof c=="undefined"){c="Ok"}return this.createButton(c,"blue")},createButton:function(c,e){var d=b("<button>").addClass("btn").addClass("btn-"+e).html(c);this.$modalFooter.append(d);return d},setButtonsWidth:function(){var c=this.$modalFooter.find("button");var d=c.size();if(d===0){return}c.css("width",(100/d)+"%")},enableEvents:function(){this.$modalClose.on("click.tools.modal",b.proxy(this.close,this));b(document).on("keyup.tools.modal",b.proxy(this.closeHandler,this));this.$modalBox.on("click.tools.modal",b.proxy(this.close,this))},disableEvents:function(){this.$modalClose.off("click.tools.modal");b(document).off("keyup.tools.modal");this.$modalBox.off("click.tools.modal");b(window).off("resize.tools.modal")},closeHandler:function(c){if(c.which!=27){return}this.close()},close:function(c){if(c){if(!b(c.target).hasClass("modal-close-btn")&&c.target!=this.$modalClose[0]&&c.target!=this.$modalBox[0]){return}c.preventDefault()}if(!this.$modalBox){return}this.disableEvents();this.$modalOverlay.remove();this.$modalBox.fadeOut("fast",b.proxy(function(){this.$modalBox.remove();b(document.body).css("overflow",this.bodyOveflow);if(this.opts.blur&&typeof this.blurredElements!="undefined"){this.blurredElements.removeClass("modal-blur")}this.setCallback("closed")},this))},isMobile:function(){var c=window.matchMedia("(max-width: 767px)");return(c.matches)?true:false}};b(window).on("load.tools.modal",function(){b('[data-tools="modal"]').modal()});a.prototype.init.prototype=a.prototype})(jQuery);(function(b){b.fn.navigationFixed=function(c){return this.each(function(){b.data(this,"navigationFixed",{});b.data(this,"navigationFixed",a(this,c))})};function a(d,c){return new a.prototype.init(d,c)}b.NavigationFixed=a;b.NavigationFixed.NAME="navigation-fixed";b.NavigationFixed.VERSION="1.0";b.NavigationFixed.opts={};a.fn=b.NavigationFixed.prototype={init:function(e,c){var d=window.matchMedia("(max-width: 767px)");if(d.matches){return}this.$element=e!==false?b(e):false;this.loadOptions(c);this.navBoxOffsetTop=this.$element.offset().top;this.build();b(window).scroll(b.proxy(this.build,this))},loadOptions:function(c){this.opts=b.extend({},b.extend(true,{},b.NavigationFixed.opts),this.$element.data(),c)},setCallback:function(j,h,d){var m=b._data(this.$element[0],"events");if(m&&typeof m[j]!="undefined"){var k=[];var g=m[j].length;for(var f=0;f<g;f++){var c=m[j][f].namespace;if(c=="tools."+b.NavigationFixed.NAME||c==b.NavigationFixed.NAME+".tools"){var l=m[j][f].handler;k.push((typeof d=="undefined")?l.call(this,h):l.call(this,h,d))}}if(k.length==1){return k[0]}else{return k}}return(typeof d=="undefined")?h:d},build:function(){if(b(window).scrollTop()>this.navBoxOffsetTop){this.$element.addClass("navigation-fixed");this.setCallback("fixed")}else{this.$element.removeClass("navigation-fixed");this.setCallback("unfixed")}}};b(window).on("load.tools.navigation-fixed",function(){b('[data-tools="navigation-fixed"]').navigationFixed()});a.prototype.init.prototype=a.prototype})(jQuery);(function(b){b.fn.navigationToggle=function(c){return this.each(function(){b.data(this,"navigationToggle",{});b.data(this,"navigationToggle",a(this,c))})};function a(d,c){return new a.prototype.init(d,c)}b.NavigationToggle=a;b.NavigationToggle.NAME="navigation-toggle";b.NavigationToggle.VERSION="1.0";b.NavigationToggle.opts={target:false};a.fn=b.NavigationToggle.prototype={init:function(d,c){this.$element=d!==false?b(d):false;this.loadOptions(c);this.$target=b(this.opts.target);this.$toggle=this.$element.find("span");this.$toggle.on("click",b.proxy(this.onClick,this));this.build();b(window).resize(b.proxy(this.build,this))},loadOptions:function(c){this.opts=b.extend({},b.extend(true,{},b.NavigationToggle.opts),this.$element.data(),c)},setCallback:function(j,h,d){var m=b._data(this.$element[0],"events");if(m&&typeof m[j]!="undefined"){var k=[];var g=m[j].length;for(var f=0;f<g;f++){var c=m[j][f].namespace;if(c=="tools."+b.NavigationToggle.NAME||c==b.NavigationToggle.NAME+".tools"){var l=m[j][f].handler;k.push((typeof d=="undefined")?l.call(this,h):l.call(this,h,d))}}if(k.length==1){return k[0]}else{return k}}return(typeof d=="undefined")?h:d},build:function(){var c=window.matchMedia("(max-width: 767px)");if(c.matches){if(!this.$target.hasClass("navigation-target-show")){this.$element.addClass("navigation-toggle-show").show();this.$target.addClass("navigation-target-show").hide()}}else{this.$element.removeClass("navigation-toggle-show").hide();this.$target.removeClass("navigation-target-show").show()}},onClick:function(c){c.stopPropagation();c.preventDefault();if(this.isTargetHide()){this.$element.addClass("navigation-toggle-show");this.$target.show();this.setCallback("show",this.$target)}else{this.$element.removeClass("navigation-toggle-show");this.$target.hide();this.setCallback("hide",this.$target)}},isTargetHide:function(){return(this.$target[0].style.display=="none")?true:false}};b(window).on("load.tools.navigation-toggle",function(){b('[data-tools="navigation-toggle"]').navigationToggle()});a.prototype.init.prototype=a.prototype})(jQuery);(function(a){a.progress={show:function(){if(a("#tools-progress").length!==0){a("#tools-progress").fadeIn()}else{var b=a('<div id="tools-progress"><span></span></div>').hide();a(document.body).append(b);a("#tools-progress").fadeIn()}},update:function(b){this.show();a("#tools-progress").find("span").css("width",b+"%")},hide:function(){a("#tools-progress").fadeOut(1500)}}})(jQuery);(function(b){b.fn.tabs=function(d){var e=[];var c=Array.prototype.slice.call(arguments,1);if(typeof d==="string"){this.each(function(){var g=b.data(this,"tabs");if(typeof g!=="undefined"&&b.isFunction(g[d])){var f=g[d].apply(g,c);if(f!==undefined&&f!==g){e.push(f)}}else{return b.error('No such method "'+d+'" for Tabs')}})}else{this.each(function(){b.data(this,"tabs",{});b.data(this,"tabs",a(this,d))})}if(e.length===0){return this}else{if(e.length===1){return e[0]}else{return e}}};function a(d,c){return new a.prototype.init(d,c)}b.Tabs=a;b.Tabs.NAME="tabs";b.Tabs.VERSION="1.0";b.Tabs.opts={equals:false,active:false};a.fn=b.Tabs.prototype={init:function(d,c){this.$element=d!==false?b(d):false;this.loadOptions(c);this.links=this.$element.find("a");this.tabs=[];this.links.each(b.proxy(this.load,this));this.setEquals();this.setCallback("init")},loadOptions:function(c){this.opts=b.extend({},b.extend(true,{},b.Tabs.opts),this.$element.data(),c)},setCallback:function(j,h,d){var m=b._data(this.$element[0],"events");if(m&&typeof m[j]!="undefined"){var k=[];var g=m[j].length;for(var f=0;f<g;f++){var c=m[j][f].namespace;if(c=="tools."+b.Tabs.NAME||c==b.Tabs.NAME+".tools"){var l=m[j][f].handler;k.push((typeof d=="undefined")?l.call(this,h):l.call(this,h,d))}}if(k.length==1){return k[0]}else{return k}}return(typeof d=="undefined")?h:d},load:function(d,e){var c=b(e);var f=c.attr("href");c.attr("rel",f);this.tabs.push(b(f));if(!c.parent().hasClass("active")){b(f).hide()}this.readLocationHash(f);if(this.opts.active!==false&&this.opts.active===f){this.show(f)}c.on("click",b.proxy(this.onClick,this))},onClick:function(d){d.preventDefault();var c=b(d.target).attr("rel");top.location.hash=c;this.show(c)},readLocationHash:function(c){if(top.location.hash===""||top.location.hash!=c){return}this.opts.active=top.location.hash},setActive:function(c){this.activeHash=c;this.activeTab=b("[rel="+c+"]");this.links.parent().removeClass("active");this.activeTab.parent().addClass("active")},getActiveHash:function(){return this.activeHash},getActiveTab:function(){return this.activeTab},show:function(c){this.hideAll();b(c).show();this.setActive(c);this.setCallback("show",b("[rel="+c+"]"),c)},hideAll:function(){b.each(this.tabs,function(){b(this).hide()})},setEquals:function(){if(!this.opts.equals){return}this.setMaxHeight(this.getMaxHeight())},setMaxHeight:function(c){b.each(this.tabs,function(){b(this).css("min-height",c+"px")})},getMaxHeight:function(){var c=0;b.each(this.tabs,function(){var d=b(this).height();c=d>c?d:c});return c}};b(window).on("load.tools.tabs",function(){b('[data-tools="tabs"]').tabs()});a.prototype.init.prototype=a.prototype})(jQuery);(function(a){a.fn.textfit=function(c){return this.each(function(){a.data(this,"textfit",{});a.data(this,"textfit",b(this,c))})};function b(d,c){return new b.prototype.init(d,c)}a.Textfit=b;a.Textfit.NAME="textfit";a.Textfit.VERSION="1.0";a.Textfit.opts={min:"10px",max:"100px",compressor:1};b.fn=a.Textfit.prototype={init:function(d,c){this.$element=d!==false?a(d):false;this.loadOptions(c);this.$element.css("font-size",Math.max(Math.min(this.$element.width()/(this.opts.compressor*10),parseFloat(this.opts.max)),parseFloat(this.opts.min)))},loadOptions:function(c){this.opts=a.extend({},a.extend(true,{},a.Textfit.opts),this.$element.data(),c)}};a(window).on("load.tools.textfit",function(){a('[data-tools="textfit"]').textfit()});b.prototype.init.prototype=b.prototype})(jQuery);(function(b){b.fn.tooltip=function(c){return this.each(function(){b.data(this,"tooltip",{});b.data(this,"tooltip",a(this,c))})};function a(d,c){return new a.prototype.init(d,c)}b.Tooltip=a;b.Tooltip.NAME="tooltip";b.Tooltip.VERSION="1.0";b.Tooltip.opts={theme:false};a.fn=b.Tooltip.prototype={init:function(d,c){this.$element=d!==false?b(d):false;this.loadOptions(c);this.$element.on("mouseover",b.proxy(this.show,this));this.$element.on("mouseout",b.proxy(this.hide,this))},loadOptions:function(c){this.opts=b.extend({},b.extend(true,{},b.Tooltip.opts),this.$element.data(),c)},show:function(){b(".tooltip").hide();var c=this.$element.attr("title");this.$element.data("cached-title",c);this.$element.attr("title","");this.tooltip=b('<div class="tooltip" />').html(c).hide();if(this.opts.theme!==false){this.tooltip.addClass("tooltip-theme-"+this.opts.theme)}this.tooltip.css({top:(this.$element.offset().top+this.$element.innerHeight())+"px",left:this.$element.offset().left+"px"});b("body").append(this.tooltip);this.tooltip.show()},hide:function(){this.tooltip.fadeOut("fast",b.proxy(function(){this.tooltip.remove()},this));this.$element.attr("title",this.$element.data("cached-title"));this.$element.data("cached-title","")}};a.prototype.init.prototype=a.prototype;b(function(){b('[data-tools="tooltip"]').tooltip()})})(jQuery);(function(b){b.fn.upload=function(c){return this.each(function(){b.data(this,"upload",{});b.data(this,"upload",a(this,c))})};function a(d,c){return new a.prototype.init(d,c)}b.Upload=a;b.Upload.NAME="upload";b.Upload.VERSION="1.0";b.Upload.opts={url:false,placeholder:"Drop file here or ",param:"file"};a.fn=b.Upload.prototype={init:function(d,c){this.$element=d!==false?b(d):false;this.loadOptions(c);this.load()},loadOptions:function(c){this.opts=b.extend({},b.extend(true,{},b.Upload.opts),this.$element.data(),c)},setCallback:function(j,h,d){var m=b._data(this.$element[0],"events");if(m&&typeof m[j]!="undefined"){var k=[];var g=m[j].length;for(var f=0;f<g;f++){var c=m[j][f].namespace;if(c=="tools."+b.Upload.NAME||c==b.Upload.NAME+".tools"){var l=m[j][f].handler;k.push((typeof d=="undefined")?l.call(this,h):l.call(this,h,d))}}if(k.length==1){return k[0]}else{return k}}return(typeof d=="undefined")?h:d},load:function(){this.$droparea=b('<div class="tools-droparea" />');this.$placeholdler=b('<div class="tools-droparea-placeholder" />').text(this.opts.placeholder);this.$droparea.append(this.$placeholdler);this.$element.after(this.$droparea);this.$placeholdler.append(this.$element);this.$droparea.off(".tools.upload");this.$element.off(".tools.upload");this.$droparea.on("dragover.tools.upload",b.proxy(this.onDrag,this));this.$droparea.on("dragleave.tools.upload",b.proxy(this.onDragLeave,this));this.$element.on("change.tools.upload",b.proxy(function(c){c=c.originalEvent||c;this.traverseFile(this.$element[0].files[0],c)},this));this.$droparea.on("drop.tools.upload",b.proxy(function(c){c.preventDefault();this.$droparea.removeClass("drag-hover").addClass("drag-drop");this.onDrop(c)},this))},onDrop:function(d){d=d.originalEvent||d;var c=d.dataTransfer.files;this.traverseFile(c[0],d)},traverseFile:function(c,f){var d=!!window.FormData?new FormData():null;if(window.FormData){d.append(this.opts.param,c)}if(b.progress){b.progress.show()}this.sendData(d,f)},sendData:function(d,c){var f=new XMLHttpRequest();f.open("POST",this.opts.url);f.onreadystatechange=b.proxy(function(){if(f.readyState==4){var g=f.responseText;g=g.replace(/^\[/,"");g=g.replace(/\]$/,"");var e=(typeof g==="string"?b.parseJSON(g):g);if(b.progress){b.progress.hide()}this.$droparea.removeClass("drag-drop");this.setCallback("success",e)}},this);f.send(d)},onDrag:function(c){c.preventDefault();this.$droparea.addClass("drag-hover")},onDragLeave:function(c){c.preventDefault();this.$droparea.removeClass("drag-hover")}};a.prototype.init.prototype=a.prototype;b(function(){b('[data-tools="upload"]').upload()})})(jQuery);