diff --git a/web/js/bootstrap-extensions.js b/web/js/bootstrap-extensions.js index 6a17a9c..378bb92 100644 --- a/web/js/bootstrap-extensions.js +++ b/web/js/bootstrap-extensions.js @@ -863,7 +863,13 @@ function ($) { items; items = $.grep(data, function (item) { - return ~item[that.options.display].toLowerCase().indexOf(that.query.toLowerCase()); + var query_items = that.query.toLowerCase().split(' '), + data = item[that.options.display].toLowerCase(); + + for (var i = query_items.length - 1; i >= 0; i--) { + if (~data.indexOf(query_items[i])) + return true; + }; }); if (!items || !items.length) { diff --git a/web/js/bootstrap-extensions.min.js b/web/js/bootstrap-extensions.min.js index 0e4e7f8..3ab9a0d 100644 --- a/web/js/bootstrap-extensions.min.js +++ b/web/js/bootstrap-extensions.min.js @@ -3,4 +3,4 @@ * Copyright 2013 OpenBuildings, Inc. * http://www.apache.org/licenses/LICENSE-2.0.txt */ -!function(a){"use strict";var b=function(b){var d=a(b);d.on("dragstart",function(b){a(b.currentTarget).data("current",b.target).data("x",b.originalEvent.clientX).data("y",b.originalEvent.clientY)}),d.on("dragover",function(a){a.preventDefault()}),d.on("drop",function(b){var c=a(a(b.currentTarget).data("current")),d=c.position().left+b.originalEvent.clientX-a(b.currentTarget).data("x"),e=c.position().top+b.originalEvent.clientY-a(b.currentTarget).data("y");c.css({left:100*(d/a(b.currentTarget).width())+"%",top:100*(e/a(b.currentTarget).height())+"%"}),c.find('[data-draggable="left"]').val(100*(d/a(b.currentTarget).width())),c.find('[data-draggable="top"]').val(100*(e/a(b.currentTarget).height()))})};b.prototype={constructor:b};var c=a.fn.draggable;a.fn.draggable=function(c){return this.each(function(){var d=a(this),e=d.data("draggable"),f="object"==typeof c&&c;e||d.data("draggable",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.draggable.Constructor=b,a.fn.draggable.noConflict=function(){return a.fn.draggable=c,this},a(function(){a(document).on("mouseover.draggable.data-api",'[data-provide="draggable"]',function(b){var c=a(this);c.data("draggable")||(b.preventDefault(),c.draggable(c.data()))})})}(window.jQuery),!function(a){"use strict";var b=function(b,c){if(this.$element=a(b),this.type=this.$element.data("uploadtype")||(this.$element.find(".thumbnail").length>0?"image":"file"),this.$input=this.$element.find(":file"),0!==this.$input.length){this.name=this.$input.attr("name")||c.name,this.$hidden=this.$element.find('input[type=hidden][name="'+this.name+'"]'),0===this.$hidden.length&&(this.$hidden=a(''),this.$element.prepend(this.$hidden)),this.$preview=this.$element.find(".fileupload-preview");var d=this.$preview.css("height");"inline"!=this.$preview.css("display")&&"0px"!=d&&"none"!=d&&this.$preview.css("line-height",d),this.original={exists:this.$element.hasClass("fileupload-exists"),preview:this.$preview.html(),hiddenVal:this.$hidden.val()},this.$remove=this.$element.find('[data-dismiss="fileupload"]'),this.$element.find('[data-trigger="fileupload"]').on("click.fileupload",a.proxy(this.trigger,this)),this.listen()}};b.prototype={listen:function(){this.$input.on("change.fileupload",a.proxy(this.change,this)),a(this.$input[0].form).on("reset.fileupload",a.proxy(this.reset,this)),this.$remove&&this.$remove.on("click.fileupload",a.proxy(this.clear,this))},change:function(a,b){if("clear"!==b){var c=void 0!==a.target.files?a.target.files[0]:a.target.value?{name:a.target.value.replace(/^.+\\/,"")}:null;if(!c)return this.clear(),void 0;if(this.$hidden.val(""),this.$hidden.attr("name",""),this.$input.attr("name",this.name),"image"===this.type&&this.$preview.length>0&&("undefined"!=typeof c.type?c.type.match("image.*"):c.name.match(/\.(gif|png|jpe?g)$/i))&&"undefined"!=typeof FileReader){var d=new FileReader,e=this.$preview,f=this.$element;d.onload=function(a){e.html('"),f.addClass("fileupload-exists").removeClass("fileupload-new")},d.readAsDataURL(c)}else this.$preview.text(c.name),this.$element.addClass("fileupload-exists").removeClass("fileupload-new")}},clear:function(a){if(this.$hidden.val(""),this.$hidden.attr("name",this.name),this.$input.attr("name",""),navigator.userAgent.match(/msie/i)){var b=this.$input.clone(!0);this.$input.after(b),this.$input.remove(),this.$input=b}else this.$input.val("");this.$preview.html(""),this.$element.addClass("fileupload-new").removeClass("fileupload-exists"),a&&(this.$input.trigger("change",["clear"]),a.preventDefault())},reset:function(){this.clear(),this.$hidden.val(this.original.hiddenVal),this.$preview.html(this.original.preview),this.original.exists?this.$element.addClass("fileupload-exists").removeClass("fileupload-new"):this.$element.addClass("fileupload-new").removeClass("fileupload-exists")},trigger:function(a){this.$input.trigger("click"),a.preventDefault()}},a.fn.fileupload=function(c){return this.each(function(){var d=a(this),e=d.data("fileupload");e||d.data("fileupload",e=new b(this,c)),"string"==typeof c&&e[c]()})},a.fn.fileupload.Constructor=b,a(document).on("click.fileupload.data-api",'[data-provides="fileupload"]',function(b){var c=a(this);if(!c.data("fileupload")){c.fileupload(c.data());var d=a(b.target).closest('[data-dismiss="fileupload"],[data-trigger="fileupload"]');d.length>0&&(d.trigger("click.fileupload"),b.preventDefault())}})}(window.jQuery),!function(a){"use strict";var b=function(b,c){var d=a(b);d.on("dragstart",function(b){var d=b.target;a(c.dropzone).addClass("drop-target").height(a(c.dropzone).closest(".row-fluid").height()).data("href",a(d).data("href"))}).on("dragover",function(a){a.preventDefault()}).on("dragend",function(){a(c.dropzone).removeClass("drop-target").data("href",!1)}),a(c.dropzone).on("dragover",function(a){a.preventDefault()}).on("drop",function(b){return a(b.currentTarget).data("href")&&(window.location=a(b.currentTarget).data("href")),!1})};b.prototype={constructor:b};var c=a.fn.filters;a.fn.filters=function(c){return this.each(function(){var d=a(this),e=d.data("filters"),f="object"==typeof c&&c;e||d.data("filters",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.filters.Constructor=b,a.fn.filters.noConflict=function(){return a.fn.filters=c,this},a(function(){a(document).on("mouseover.filters.data-api",'[data-provide="filters"]',function(b){var c=a(this);c.data("filters")||(b.preventDefault(),c.filters(c.data()))})})}(window.jQuery),!function(a){"use strict";function b(b,c){return a(b).data("sortableId")||a(b).find(c).data("sortableId")}a(function(){document.addEventListener("mousedown",function(c){if(a(c.target).closest('[data-provide="sortable"]').length){var d=a(c.target).closest('[data-provide="sortable"]');if(d.data("sortable"))return;d.sortable({handle:d.data("handle"),items:d.data("items"),placeholder:d.data("placeholder"),tolerance:d.data("tolerance"),stop:function(c,d){a(this).data("sortUrl")?a.ajax([a(this).data("sortUrl"),"&from=",b(d.item,a(this).data("handle")),"&to=",b(d.item.next(),a(this).data("handle"))].join("")):a(this).children().each(function(b){a(this).find('[data-sortable="position"]').val(b)})}})}},!0)})}(window.jQuery),!function(a){"use strict";var b=function(b){this.$element=a(b)};b.prototype={constructor:b,reindex:function(){var b=this.$element,c=new RegExp(b.attr("data-index").replace(/[\-\[\]\/\(\)\*\+\?\.\\\^\$\|]/g,"\\$&").replace("{{index}}","(\\d+)"));b.children(".multiform").each(function(d){a(this).find("input,select,textarea").each(function(){a(this).attr("name",a(this).attr("name").replace(c,b.attr("data-index").replace("{{index}}",d)))})})},add:function(b){a('
').html(a(b).clone().html()).prependTo(this.$element).addClass("in"),this.$element.multiform("reindex")}};var c=a.fn.multiform;a.fn.multiform=function(c,d){return this.each(function(){var e=a(this),f=e.data("multiform"),g="object"==typeof c&&c;f||e.data("multiform",f=new b(this,g)),"string"==typeof c&&f[c](d)})},a.fn.multiform.Constructor=b,a.fn.multiform.noConflict=function(){return a.fn.multiform=c,this},a(function(){a(document).on("click.multiform.data-api","[data-multiform-add]",function(b){var c=a(a(this).data("multiformAdd"));b.preventDefault(),c.multiform("add",a(this).attr("href"))}),a(document).on("click.multiform.data-api",'[data-dismiss="multiform"]',function(b){function e(){c.remove(),d.multiform("reindex")}var c=a(this).closest(".multiform"),d=c.parent();b.preventDefault(),a.support.transition?c.addClass("fade").removeClass("in").on(a.support.transition.end,e):e()})})}(window.jQuery),!function(a){"use strict";var b=function(b,c){var d=this.$element=a(b);this.url=c.url,this.count=c.count||a(c.container).children().length,this.$container=a(c.container),this.$element.is("select")?this.$element.on("change",function(){d.remoteselect("add",d.val(),null).val("")}):this.$element.typeahead({source:{url:c.source,dataType:"json"},val:{},itemSelected:function(b){c.overwrite&&(a(c.container).empty(),d.addClass("hide")),d.val("").remoteselect("add",b.id,b.model)}})};b.prototype={constructor:b,add:function(b,c){var d=this.$container;a.get(this.url.replace("{{id}}",b).replace("{{count}}",this.count++).replace("{{model}}",c),function(b){d.append(b),a(".chzn-select").chosen()})}};var c=a.fn.remoteselect;a.fn.remoteselect=function(c,d,e){return this.each(function(){var f=a(this),g=f.data("remoteselect"),h="object"==typeof c&&c;g||f.data("remoteselect",g=new b(this,h||f.data())),"string"==typeof c&&g[c](d,e)})},a.fn.remoteselect.Constructor=b,a.fn.remoteselect.noConflict=function(){return a.fn.remoteselect=c,this},a(function(){a(document).on("focus.remoteselect.data-api",'[data-provide="remoteselect"]',function(b){var c=a(this);c.data("remoteselect")||(b.preventDefault(),c.remoteselect(c.data()))}),a(document).on("click.remoteselect.data-api",'[data-dismiss="remoteselect"]',function(b){function d(){a('input[data-container="#'+c.parent().attr("id")+'"]').removeClass("hide").addClass("in"),c.remove()}var c=a(this).closest(".remoteselect-item");b.preventDefault(),a.support.transition?c.addClass("fade").on(a.support.transition.end,d):d()}),a(document).on("click.remoteselect.data-api","[data-remoteselect-new]",function(b){var c=a(a(this).attr("href")).length?a(a(this).attr("href")):a(this).siblings('[data-provide="remoteselect"]');b.preventDefault(),c.remoteselect("add",null,a(this).data("remoteselectNew"))})})}(window.jQuery),!function(a){"use strict";var b=function(b){this.element=a(b)};b.prototype={constructor:b,show:function(){function g(){c.removeClass("active"),d.addClass("active"),f?d.addClass("in"):d.removeClass("fade"),b.data("disable")&&(d.removeAttr("disabled"),c.attr("disabled","disabled")),b.trigger({type:"shown",target:d,relatedTarget:c})}var e,b=this.element,c=a(b.data("previous")),d=a("#"+(b.data("tabPrefix")||"")+b.val()),f=a.support.transition&&d.hasClass("fade");d.hasClass("active")||(e=a.Event("show",{target:d,relatedTarget:c}),b.trigger(e),e.isDefaultPrevented()||(f?c.one(a.support.transition.end,g):g(),c.removeClass("in"),b.data("previous","#"+(b.data("tabPrefix")||"")+b.val())))}};var c=a.fn.selecttab;a.fn.selecttab=function(c){return this.each(function(){var d=a(this),e=d.data("selecttab");e||d.data("selecttab",e=new b(this)),"string"==typeof c&&e[c]()})},a.fn.selecttab.Constructor=b,a.fn.selecttab.noConflict=function(){return a.fn.selecttab=c,this},a(document).on("change.selecttab.data-api",'[data-provide="selecttab"]',function(b){b.preventDefault(),a(this).selecttab("show")})}(window.jQuery),!function(a){"use strict";var b={source:[],maxResults:8,minLength:1,menu:'',item:'
  • ',display:"name",val:"id",itemSelected:function(){}},c={DOWN:40,ENTER:13,ESCAPE:27,TAB:9,UP:38},d=function(b,c){this.$element=a(b),this.options=a.extend(!0,{},a.fn.typeahead.defaults,c),this.$menu=a(this.options.menu).appendTo("body"),this.sorter=this.options.sorter||this.sorter,this.highlighter=this.options.highlighter||this.highlighter,this.shown=!1,this.initSource(),this.listen()};d.prototype={constructor:d,initSource:function(){this.options.source&&("string"==typeof this.options.source?this.source=a.extend({},a.ajaxSettings,{url:this.options.source}):"object"==typeof this.options.source&&(this.source=this.options.source instanceof Array?this.options.source:a.extend(!0,{},a.ajaxSettings,this.options.source)))},eventSupported:function(a){var b=a in this.$element;return b||(this.$element.setAttribute(a,"return;"),b="function"==typeof this.$element[a]),b},lookup:function(){var d,c=this;return this.query=this.$element.val(),!this.query||this.query.length"+b+""})},render:function(b){var d,e,c=this;return b=a(b).map(function(b,f){return b=c.options.tmpl?a(c.options.tmpl(f)):a(c.options.item),"string"==typeof c.options.val?b.attr("data-value",f[c.options.val]):b.attr("data-value",JSON.stringify(a.extend({},c.options.val,f))),d=f[c.options.display],e=b.find("a"),d.indexOf("typeahead-display-val")>0?e.html(d).find(".typeahead-display-val").each(function(){a(this).html(c.highlighter(a(this).html()))}):e.html(c.highlighter(d)),b[0]}),b.first().addClass("active"),setTimeout(function(){c.$menu.html(b)},250),this},select:function(){var a=this.$menu.find(".active");return this.$element.val(a.text()).change(),this.options.itemSelected(JSON.parse(a.attr("data-value"))),this.hide()},next:function(){var c=this.$menu.find(".active").removeClass("active"),d=c.next();d.length||(d=a(this.$menu.find("li")[0])),d.addClass("active")},prev:function(){var b=this.$menu.find(".active").removeClass("active"),c=b.prev();c.length||(c=this.$menu.find("li").last()),c.addClass("active")},listen:function(){this.$element.on("blur",a.proxy(this.blur,this)).on("keyup",a.proxy(this.keyup,this)),this.eventSupported("keydown")?this.$element.on("keydown",a.proxy(this.keypress,this)):this.$element.on("keypress",a.proxy(this.keypress,this)),this.$menu.on("click",a.proxy(this.click,this)).on("mouseenter","li",a.proxy(this.mouseenter,this))},keyup:function(a){switch(a.stopPropagation(),a.preventDefault(),a.keyCode){case c.DOWN:case c.UP:break;case c.TAB:case c.ENTER:if(!this.shown)return;this.select();break;case c.ESCAPE:this.hide();break;default:this.lookup()}},keypress:function(a){if(a.stopPropagation(),this.shown)switch(a.keyCode){case c.TAB:case c.ESCAPE:case c.ENTER:a.preventDefault();break;case c.UP:a.preventDefault(),this.prev();break;case c.DOWN:a.preventDefault(),this.next()}},blur:function(a){var b=this;a.stopPropagation(),a.preventDefault(),setTimeout(function(){b.$menu.is(":focus")||b.hide()},150)},click:function(a){a.stopPropagation(),a.preventDefault(),this.select()},mouseenter:function(b){this.$menu.find(".active").removeClass("active"),a(b.currentTarget).addClass("active")}},a.fn.typeahead=function(b){return this.each(function(){var c=a(this),e=c.data("typeahead"),f="object"==typeof b&&b;e||c.data("typeahead",e=new d(this,f)),"string"==typeof b&&e[b]()})},a.fn.typeahead.defaults=b,a.fn.typeahead.Constructor=d,a(function(){a("body").on("focus.typeahead.data-api",'[data-provide="typeahead"]',function(b){var c=a(this);c.data("typeahead")||(b.preventDefault(),c.typeahead(c.data()))})})}(window.jQuery); \ No newline at end of file +!function(a){"use strict";var b=function(b){var d=a(b);d.on("dragstart",function(b){a(b.currentTarget).data("current",b.target).data("x",b.originalEvent.clientX).data("y",b.originalEvent.clientY)}),d.on("dragover",function(a){a.preventDefault()}),d.on("drop",function(b){var c=a(a(b.currentTarget).data("current")),d=c.position().left+b.originalEvent.clientX-a(b.currentTarget).data("x"),e=c.position().top+b.originalEvent.clientY-a(b.currentTarget).data("y");c.css({left:100*(d/a(b.currentTarget).width())+"%",top:100*(e/a(b.currentTarget).height())+"%"}),c.find('[data-draggable="left"]').val(100*(d/a(b.currentTarget).width())),c.find('[data-draggable="top"]').val(100*(e/a(b.currentTarget).height()))})};b.prototype={constructor:b};var c=a.fn.draggable;a.fn.draggable=function(c){return this.each(function(){var d=a(this),e=d.data("draggable"),f="object"==typeof c&&c;e||d.data("draggable",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.draggable.Constructor=b,a.fn.draggable.noConflict=function(){return a.fn.draggable=c,this},a(function(){a(document).on("mouseover.draggable.data-api",'[data-provide="draggable"]',function(b){var c=a(this);c.data("draggable")||(b.preventDefault(),c.draggable(c.data()))})})}(window.jQuery),!function(a){"use strict";var b=function(b,c){if(this.$element=a(b),this.type=this.$element.data("uploadtype")||(this.$element.find(".thumbnail").length>0?"image":"file"),this.$input=this.$element.find(":file"),0!==this.$input.length){this.name=this.$input.attr("name")||c.name,this.$hidden=this.$element.find('input[type=hidden][name="'+this.name+'"]'),0===this.$hidden.length&&(this.$hidden=a(''),this.$element.prepend(this.$hidden)),this.$preview=this.$element.find(".fileupload-preview");var d=this.$preview.css("height");"inline"!=this.$preview.css("display")&&"0px"!=d&&"none"!=d&&this.$preview.css("line-height",d),this.original={exists:this.$element.hasClass("fileupload-exists"),preview:this.$preview.html(),hiddenVal:this.$hidden.val()},this.$remove=this.$element.find('[data-dismiss="fileupload"]'),this.$element.find('[data-trigger="fileupload"]').on("click.fileupload",a.proxy(this.trigger,this)),this.listen()}};b.prototype={listen:function(){this.$input.on("change.fileupload",a.proxy(this.change,this)),a(this.$input[0].form).on("reset.fileupload",a.proxy(this.reset,this)),this.$remove&&this.$remove.on("click.fileupload",a.proxy(this.clear,this))},change:function(a,b){if("clear"!==b){var c=void 0!==a.target.files?a.target.files[0]:a.target.value?{name:a.target.value.replace(/^.+\\/,"")}:null;if(!c)return this.clear(),void 0;if(this.$hidden.val(""),this.$hidden.attr("name",""),this.$input.attr("name",this.name),"image"===this.type&&this.$preview.length>0&&("undefined"!=typeof c.type?c.type.match("image.*"):c.name.match(/\.(gif|png|jpe?g)$/i))&&"undefined"!=typeof FileReader){var d=new FileReader,e=this.$preview,f=this.$element;d.onload=function(a){e.html('"),f.addClass("fileupload-exists").removeClass("fileupload-new")},d.readAsDataURL(c)}else this.$preview.text(c.name),this.$element.addClass("fileupload-exists").removeClass("fileupload-new")}},clear:function(a){if(this.$hidden.val(""),this.$hidden.attr("name",this.name),this.$input.attr("name",""),navigator.userAgent.match(/msie/i)){var b=this.$input.clone(!0);this.$input.after(b),this.$input.remove(),this.$input=b}else this.$input.val("");this.$preview.html(""),this.$element.addClass("fileupload-new").removeClass("fileupload-exists"),a&&(this.$input.trigger("change",["clear"]),a.preventDefault())},reset:function(){this.clear(),this.$hidden.val(this.original.hiddenVal),this.$preview.html(this.original.preview),this.original.exists?this.$element.addClass("fileupload-exists").removeClass("fileupload-new"):this.$element.addClass("fileupload-new").removeClass("fileupload-exists")},trigger:function(a){this.$input.trigger("click"),a.preventDefault()}},a.fn.fileupload=function(c){return this.each(function(){var d=a(this),e=d.data("fileupload");e||d.data("fileupload",e=new b(this,c)),"string"==typeof c&&e[c]()})},a.fn.fileupload.Constructor=b,a(document).on("click.fileupload.data-api",'[data-provides="fileupload"]',function(b){var c=a(this);if(!c.data("fileupload")){c.fileupload(c.data());var d=a(b.target).closest('[data-dismiss="fileupload"],[data-trigger="fileupload"]');d.length>0&&(d.trigger("click.fileupload"),b.preventDefault())}})}(window.jQuery),!function(a){"use strict";var b=function(b,c){var d=a(b);d.on("dragstart",function(b){var d=b.target;a(c.dropzone).addClass("drop-target").height(a(c.dropzone).closest(".row-fluid").height()).data("href",a(d).data("href"))}).on("dragover",function(a){a.preventDefault()}).on("dragend",function(){a(c.dropzone).removeClass("drop-target").data("href",!1)}),a(c.dropzone).on("dragover",function(a){a.preventDefault()}).on("drop",function(b){return a(b.currentTarget).data("href")&&(window.location=a(b.currentTarget).data("href")),!1})};b.prototype={constructor:b};var c=a.fn.filters;a.fn.filters=function(c){return this.each(function(){var d=a(this),e=d.data("filters"),f="object"==typeof c&&c;e||d.data("filters",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.filters.Constructor=b,a.fn.filters.noConflict=function(){return a.fn.filters=c,this},a(function(){a(document).on("mouseover.filters.data-api",'[data-provide="filters"]',function(b){var c=a(this);c.data("filters")||(b.preventDefault(),c.filters(c.data()))})})}(window.jQuery),!function(a){"use strict";function b(b,c){return a(b).data("sortableId")||a(b).find(c).data("sortableId")}a(function(){document.addEventListener("mousedown",function(c){if(a(c.target).closest('[data-provide="sortable"]').length){var d=a(c.target).closest('[data-provide="sortable"]');if(d.data("sortable"))return;d.sortable({handle:d.data("handle"),items:d.data("items"),placeholder:d.data("placeholder"),tolerance:d.data("tolerance"),stop:function(c,d){a(this).data("sortUrl")?a.ajax([a(this).data("sortUrl"),"&from=",b(d.item,a(this).data("handle")),"&to=",b(d.item.next(),a(this).data("handle"))].join("")):a(this).children().each(function(b){a(this).find('[data-sortable="position"]').val(b)})}})}},!0)})}(window.jQuery),!function(a){"use strict";var b=function(b){this.$element=a(b)};b.prototype={constructor:b,reindex:function(){var b=this.$element,c=new RegExp(b.attr("data-index").replace(/[\-\[\]\/\(\)\*\+\?\.\\\^\$\|]/g,"\\$&").replace("{{index}}","(\\d+)"));b.children(".multiform").each(function(d){a(this).find("input,select,textarea").each(function(){a(this).attr("name",a(this).attr("name").replace(c,b.attr("data-index").replace("{{index}}",d)))})})},add:function(b){a('
    ').html(a(b).clone().html()).prependTo(this.$element).addClass("in"),this.$element.multiform("reindex")}};var c=a.fn.multiform;a.fn.multiform=function(c,d){return this.each(function(){var e=a(this),f=e.data("multiform"),g="object"==typeof c&&c;f||e.data("multiform",f=new b(this,g)),"string"==typeof c&&f[c](d)})},a.fn.multiform.Constructor=b,a.fn.multiform.noConflict=function(){return a.fn.multiform=c,this},a(function(){a(document).on("click.multiform.data-api","[data-multiform-add]",function(b){var c=a(a(this).data("multiformAdd"));b.preventDefault(),c.multiform("add",a(this).attr("href"))}),a(document).on("click.multiform.data-api",'[data-dismiss="multiform"]',function(b){function e(){c.remove(),d.multiform("reindex")}var c=a(this).closest(".multiform"),d=c.parent();b.preventDefault(),a.support.transition?c.addClass("fade").removeClass("in").on(a.support.transition.end,e):e()})})}(window.jQuery),!function(a){"use strict";var b=function(b,c){var d=this.$element=a(b);this.url=c.url,this.count=c.count||a(c.container).children().length,this.$container=a(c.container),this.$element.is("select")?this.$element.on("change",function(){d.remoteselect("add",d.val(),null).val("")}):this.$element.typeahead({source:{url:c.source,dataType:"json"},val:{},itemSelected:function(b){c.overwrite&&(a(c.container).empty(),d.addClass("hide")),d.val("").remoteselect("add",b.id,b.model)}})};b.prototype={constructor:b,add:function(b,c){var d=this.$container;a.get(this.url.replace("{{id}}",b).replace("{{count}}",this.count++).replace("{{model}}",c),function(b){d.append(b),a(".chzn-select").chosen()})}};var c=a.fn.remoteselect;a.fn.remoteselect=function(c,d,e){return this.each(function(){var f=a(this),g=f.data("remoteselect"),h="object"==typeof c&&c;g||f.data("remoteselect",g=new b(this,h||f.data())),"string"==typeof c&&g[c](d,e)})},a.fn.remoteselect.Constructor=b,a.fn.remoteselect.noConflict=function(){return a.fn.remoteselect=c,this},a(function(){a(document).on("focus.remoteselect.data-api",'[data-provide="remoteselect"]',function(b){var c=a(this);c.data("remoteselect")||(b.preventDefault(),c.remoteselect(c.data()))}),a(document).on("click.remoteselect.data-api",'[data-dismiss="remoteselect"]',function(b){function d(){a('input[data-container="#'+c.parent().attr("id")+'"]').removeClass("hide").addClass("in"),c.remove()}var c=a(this).closest(".remoteselect-item");b.preventDefault(),a.support.transition?c.addClass("fade").on(a.support.transition.end,d):d()}),a(document).on("click.remoteselect.data-api","[data-remoteselect-new]",function(b){var c=a(a(this).attr("href")).length?a(a(this).attr("href")):a(this).siblings('[data-provide="remoteselect"]');b.preventDefault(),c.remoteselect("add",null,a(this).data("remoteselectNew"))})})}(window.jQuery),!function(a){"use strict";var b=function(b){this.element=a(b)};b.prototype={constructor:b,show:function(){function g(){c.removeClass("active"),d.addClass("active"),f?d.addClass("in"):d.removeClass("fade"),b.data("disable")&&(d.removeAttr("disabled"),c.attr("disabled","disabled")),b.trigger({type:"shown",target:d,relatedTarget:c})}var e,b=this.element,c=a(b.data("previous")),d=a("#"+(b.data("tabPrefix")||"")+b.val()),f=a.support.transition&&d.hasClass("fade");d.hasClass("active")||(e=a.Event("show",{target:d,relatedTarget:c}),b.trigger(e),e.isDefaultPrevented()||(f?c.one(a.support.transition.end,g):g(),c.removeClass("in"),b.data("previous","#"+(b.data("tabPrefix")||"")+b.val())))}};var c=a.fn.selecttab;a.fn.selecttab=function(c){return this.each(function(){var d=a(this),e=d.data("selecttab");e||d.data("selecttab",e=new b(this)),"string"==typeof c&&e[c]()})},a.fn.selecttab.Constructor=b,a.fn.selecttab.noConflict=function(){return a.fn.selecttab=c,this},a(document).on("change.selecttab.data-api",'[data-provide="selecttab"]',function(b){b.preventDefault(),a(this).selecttab("show")})}(window.jQuery),!function(a){"use strict";var b={source:[],maxResults:8,minLength:1,menu:'',item:'
  • ',display:"name",val:"id",itemSelected:function(){}},c={DOWN:40,ENTER:13,ESCAPE:27,TAB:9,UP:38},d=function(b,c){this.$element=a(b),this.options=a.extend(!0,{},a.fn.typeahead.defaults,c),this.$menu=a(this.options.menu).appendTo("body"),this.sorter=this.options.sorter||this.sorter,this.highlighter=this.options.highlighter||this.highlighter,this.shown=!1,this.initSource(),this.listen()};d.prototype={constructor:d,initSource:function(){this.options.source&&("string"==typeof this.options.source?this.source=a.extend({},a.ajaxSettings,{url:this.options.source}):"object"==typeof this.options.source&&(this.source=this.options.source instanceof Array?this.options.source:a.extend(!0,{},a.ajaxSettings,this.options.source)))},eventSupported:function(a){var b=a in this.$element;return b||(this.$element.setAttribute(a,"return;"),b="function"==typeof this.$element[a]),b},lookup:function(){var d,c=this;return this.query=this.$element.val(),!this.query||this.query.length=0;e--)if(~d.indexOf(b[e]))return!0}),d&&d.length?(d=d.slice(0,this.options.maxResults),this.render(this.sorter(d)).show()):this.shown?this.hide():this},sorter:function(a){for(var f,b=this,c=[],d=[],e=[];f=a.shift();)f[b.options.display].toLowerCase().indexOf(this.query.toLowerCase())?~f[b.options.display].indexOf(this.query)?d.push(f):e.push(f):c.push(f);return c.concat(d,e)},show:function(){var b=a.extend({},this.$element.offset(),{height:this.$element[0].offsetHeight});return this.$menu.css({top:b.top+b.height,left:b.left}),this.$menu.show(),this.shown=!0,this},hide:function(){return this.$menu.hide(),this.shown=!1,this},highlighter:function(a){var b=this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&");return a.replace(new RegExp("("+b+")","ig"),function(a,b){return""+b+""})},render:function(b){var d,e,c=this;return b=a(b).map(function(b,f){return b=c.options.tmpl?a(c.options.tmpl(f)):a(c.options.item),"string"==typeof c.options.val?b.attr("data-value",f[c.options.val]):b.attr("data-value",JSON.stringify(a.extend({},c.options.val,f))),d=f[c.options.display],e=b.find("a"),d.indexOf("typeahead-display-val")>0?e.html(d).find(".typeahead-display-val").each(function(){a(this).html(c.highlighter(a(this).html()))}):e.html(c.highlighter(d)),b[0]}),b.first().addClass("active"),setTimeout(function(){c.$menu.html(b)},250),this},select:function(){var a=this.$menu.find(".active");return this.$element.val(a.text()).change(),this.options.itemSelected(JSON.parse(a.attr("data-value"))),this.hide()},next:function(){var c=this.$menu.find(".active").removeClass("active"),d=c.next();d.length||(d=a(this.$menu.find("li")[0])),d.addClass("active")},prev:function(){var b=this.$menu.find(".active").removeClass("active"),c=b.prev();c.length||(c=this.$menu.find("li").last()),c.addClass("active")},listen:function(){this.$element.on("blur",a.proxy(this.blur,this)).on("keyup",a.proxy(this.keyup,this)),this.eventSupported("keydown")?this.$element.on("keydown",a.proxy(this.keypress,this)):this.$element.on("keypress",a.proxy(this.keypress,this)),this.$menu.on("click",a.proxy(this.click,this)).on("mouseenter","li",a.proxy(this.mouseenter,this))},keyup:function(a){switch(a.stopPropagation(),a.preventDefault(),a.keyCode){case c.DOWN:case c.UP:break;case c.TAB:case c.ENTER:if(!this.shown)return;this.select();break;case c.ESCAPE:this.hide();break;default:this.lookup()}},keypress:function(a){if(a.stopPropagation(),this.shown)switch(a.keyCode){case c.TAB:case c.ESCAPE:case c.ENTER:a.preventDefault();break;case c.UP:a.preventDefault(),this.prev();break;case c.DOWN:a.preventDefault(),this.next()}},blur:function(a){var b=this;a.stopPropagation(),a.preventDefault(),setTimeout(function(){b.$menu.is(":focus")||b.hide()},150)},click:function(a){a.stopPropagation(),a.preventDefault(),this.select()},mouseenter:function(b){this.$menu.find(".active").removeClass("active"),a(b.currentTarget).addClass("active")}},a.fn.typeahead=function(b){return this.each(function(){var c=a(this),e=c.data("typeahead"),f="object"==typeof b&&b;e||c.data("typeahead",e=new d(this,f)),"string"==typeof b&&e[b]()})},a.fn.typeahead.defaults=b,a.fn.typeahead.Constructor=d,a(function(){a("body").on("focus.typeahead.data-api",'[data-provide="typeahead"]',function(b){var c=a(this);c.data("typeahead")||(b.preventDefault(),c.typeahead(c.data()))})})}(window.jQuery); \ No newline at end of file