Home
last modified time | relevance | path

Searched defs:afterSelect (Results 1 – 2 of 2) sorted by relevance

/template/mikio/assets/
H A Dmikio-typeahead.js725 afterSelect: $.noop, global() property in Typeahead.defaults
/template/bootstrap3/assets/typeahead/
H A Dbootstrap3-typeahead.min.js1 (function(a,b){if(typeof module!=="undefined"&&module.exports){module.exports=b(require("jquery"))}else{if(typeof define==="function"&&define.amd){define(["jquery"],function(c){return b(c)})}else{b(a.jQuery)}}}(this,function(b){var c=function(e,d){this.$element=b(e);this.options=b.extend({},c.defaults,d);this.matcher=this.options.matcher||this.matcher;this.sorter=this.options.sorter||this.sorter;this.select=this.options.select||this.select;this.autoSelect=typeof this.options.autoSelect=="boolean"?this.options.autoSelect:true;this.highlighter=this.options.highlighter||this.highlighter;this.render=this.options.render||this.render;this.updater=this.options.updater||this.updater;this.displayText=this.options.displayText||this.displayText;this.itemLink=this.options.itemLink||this.itemLink;this.itemTitle=this.options.itemTitle||this.itemTitle;this.followLinkOnSelect=this.options.followLinkOnSelect||this.followLinkOnSelect;this.source=this.options.source;this.delay=this.options.delay;this.theme=this.options.theme&&this.options.themes&&this.options.themes[this.options.theme]||c.defaults.themes[c.defaults.theme];this.$menu=b(this.options.menu||this.theme.menu);this.$appendTo=this.options.appendTo?b(this.options.appendTo):null;this.fitToElement=typeof this.options.fitToElement=="boolean"?this.options.fitToElement:false;this.shown=false;this.listen();this.showHintOnFocus=typeof this.options.showHintOnFocus=="boolean"||this.options.showHintOnFocus==="all"?this.options.showHintOnFocus:false;this.afterSelect=this.options.afterSelect;this.afterEmptySelect=this.options.afterEmptySelect;this.addItem=false;this.value=this.$element.val()||this.$element.text();this.keyPressed=false;this.focused=this.$element.is(":focus");this.changeInputOnSelect=this.options.changeInputOnSelect||this.changeInputOnSelect;this.changeInputOnMove=this.options.changeInputOnMove||this.changeInputOnMove;this.openLinkInNewTab=this.options.openLinkInNewTab||this.openLinkInNewTab;this.selectOnBlur=this.options.selectOnBlur||this.selectOnBlur;this.showCategoryHeader=this.options.showCategoryHeader||this.showCategoryHeader};c.prototype={constructor:c,setDefault:function(e){this.$element.data("active",e);if(this.autoSelect||e){var d=this.updater(e);if(!d){d=""}this.$element.val(this.displayText(d)||d).text(this.displayText(d)||d).change();this.afterSelect(d)}return this.hide()},select:function(){var e=this.$menu.find(".active").data("value");this.$element.data("active",e);if(this.autoSelect||e){var d=this.updater(e);if(!d){d=""}if(this.changeInputOnSelect){this.$element.val(this.displayText(d)||d).text(this.displayText(d)||d).change()}if(this.followLinkOnSelect&&this.itemLink(e)){if(this.openLinkInNewTab){window.open(this.itemLink(e),"_blank")}else{document.location=this.itemLink(e)}this.afterSelect(d)}else{if(this.followLinkOnSelect&&!this.itemLink(e)){this.afterEmptySelect(d)}else{this.afterSelect(d)}}}else{this.afterEmptySelect()}return this.hide()},updater:function(d){return d},setSource:function(d){this.source=d},show:function(){var k=b.extend({},this.$element.position(),{height:this.$element[0].offsetHeight});var h=typeof this.options.scrollHeight=="function"?this.options.scrollHeight.call():this.options.scrollHeight;var g;if(this.shown){g=this.$menu}else{if(this.$appendTo){g=this.$menu.appendTo(this.$appendTo);this.hasSameParent=this.$appendTo.is(this.$element.parent())}else{g=this.$menu.insertAfter(this.$element);this.hasSameParent=true}}if(!this.hasSameParent){g.css("position","fixed");var j=this.$element.offset();k.top=j.top;k.left=j.left}var e=b(g).parent().hasClass("dropup");var d=e?"auto":(k.top+k.height+h);var f=b(g).hasClass("dropdown-menu-right");var i=f?"auto":k.left;g.css({top:d,left:i}).show();if(this.options.fitToElement===true){g.css("width",this.$element.outerWidth()+"px")}this.shown=true;return this},hide:function(){this.$menu.hide();this.shown=false;return this},lookup:function(d){if(typeof(d)!="undefined"&&d!==null){this.query=d}else{this.query=this.$element.val()}if(this.query.length<this.options.minLength&&!this.options.showHintOnFocus){return this.shown?this.hide():this}var e=b.proxy(function(){if(b.isFunction(this.source)&&this.source.length===3){this.source(this.query,b.proxy(this.process,this),b.proxy(this.process,this))}else{if(b.isFunction(this.source)){this.source(this.query,b.proxy(this.process,this))}else{if(this.source){this.process(this.source)}}}},this);clearTimeout(this.lookupWorker);this.lookupWorker=setTimeout(e,this.delay)},process:function(d){var e=this;d=b.grep(d,function(f){return e.matcher(f)});d=this.sorter(d);if(!d.length&&!this.options.addItem){return this.shown?this.hide():this}if(d.length>0){this.$element.data("active",d[0])}else{this.$element.data("active",null)}if(this.options.items!="all"){d=d.slice(0,this.options.items)}if(this.options.addItem){d.push(this.options.addItem)}return this.render(d).show()},matcher:function(e){var d=this.displayText(e);return ~d.toLowerCase().indexOf(this.query.toLowerCase())},sorter:function(f){var g=[];var e=[];var d=[];var i;while((i=f.shift())){var h=this.displayText(i);if(!h.toLowerCase().indexOf(this.query.toLowerCase())){g.push(i)}else{if(~h.indexOf(this.query)){e.push(i)}else{d.push(i)}}}return g.concat(e,d)},highlighter:function(h){var l=this.query;if(l===""){return h}var j=h.match(/(>)([^<]*)(<)/g);var k=[];var e=[];var f;if(j&&j.length){for(f=0;f<j.length;++f){if(j[f].length>2){k.push(j[f])}}}else{k=[];k.push(h)}l=l.replace((/[\(\)\/\.\*\+\?\[\]]/g),function(i){return"\\"+i});var g=new RegExp(l,"g");var d;for(f=0;f<k.length;++f){d=k[f].match(g);if(d&&d.length>0){e.push(k[f])}}for(f=0;f<e.length;++f){h=h.replace(e[f],e[f].replace(g,"<strong>$&</strong>"))}return h},render:function(e){var g=this;var d=this;var f=false;var i=[];var h=g.options.separator;b.each(e,function(j,k){if(j>0&&k[h]!==e[j-1][h]){i.push({__type:"divider"})}if(g.options.showCategoryHeader){if(k[h]&&(j===0||k[h]!==e[j-1][h])){i.push({__type:"category",name:k[h]})}}i.push(k)});e=b(i).map(function(j,k){if((k.__type||false)=="category"){return b(g.options.headerHtml||g.theme.headerHtml).text(k.name)[0]}if((k.__type||false)=="divider"){return b(g.options.headerDivider||g.theme.headerDivider)[0]}var l=d.displayText(k);j=b(g.options.item||g.theme.item).data("value",k);j.find(g.options.itemContentSelector||g.theme.itemContentSelector).addBack(g.options.itemContentSelector||g.theme.itemContentSelector).html(g.highlighter(l,k));if(g.options.followLinkOnSelect){j.find("a").attr("href",d.itemLink(k))}j.find("a").attr("title",d.itemTitle(k));if(l==d.$element.val()){j.addClass("active");d.$element.data("active",k);f=true}return j[0]});if(this.autoSelect&&!f){e.filter(":not(.dropdown-header)").first().addClass("active");this.$element.data("active",e.first().data("value"))}this.$menu.html(e);return this},displayText:function(d){return typeof d!=="undefined"&&typeof d.name!="undefined"?d.name:d},itemLink:function(d){return null},itemTitle:function(d){return null},next:function(f){var g=this.$menu.find(".active").removeClass("active");var e=g.next();if(!e.length){e=b(this.$menu.find(b(this.options.item||this.theme.item).prop("tagName"))[0])}while(e.hasClass("divider")||e.hasClass("dropdown-header")){e=e.next()}e.addClass("active");var d=this.updater(e.data("value"));if(this.changeInputOnMove){this.$element.val(this.displayText(d)||d)}},prev:function(f){var g=this.$menu.find(".active").removeClass("active");var e=g.prev();if(!e.length){e=this.$menu.find(b(this.options.item||this.theme.item).prop("tagName")).last()}while(e.hasClass("divider")||e.hasClass("dropdown-header")){e=e.prev()}e.addClass("active");var d=this.updater(e.data("value"));if(this.changeInputOnMove){this.$element.val(this.displayText(d)||d)}},listen:function(){this.$element.on("focus.bootstrap3Typeahead",b.proxy(this.focus,this)).on("blur.bootstrap3Typeahead",b.proxy(this.blur,this)).on("keypress.bootstrap3Typeahead",b.proxy(this.keypress,this)).on("propertychange.bootstrap3Typeahead input.bootstrap3Typeahead",b.proxy(this.input,this)).on("keyup.bootstrap3Typeahead",b.proxy(this.keyup,this));if(this.eventSupported("keydown")){this.$element.on("keydown.bootstrap3Typeahead",b.proxy(this.keydown,this))}var d=b(this.options.item||this.theme.item).prop("tagName");if("ontouchstart" in document.documentElement&&"onmousemove" in document.documentElement){this.$menu.on("touchstart",d,b.proxy(this.touchstart,this)).on("touchend",d,b.proxy(this.click,this)).on("click",b.proxy(this.click,this)).on("mouseenter",d,b.proxy(this.mouseenter,this)).on("mouseleave",d,b.proxy(this.mouseleave,this)).on("mousedown",b.proxy(this.mousedown,this))}else{if("ontouchstart" in document.documentElement){this.$menu.on("touchstart",d,b.proxy(this.touchstart,this)).on("touchend",d,b.proxy(this.click,this))}else{this.$menu.on("click",b.proxy(this.click,this)).on("mouseenter",d,b.proxy(this.mouseenter,this)).on("mouseleave",d,b.proxy(this.mouseleave,this)).on("mousedown",b.proxy(this.mousedown,this))}}},destroy:function(){this.$element.data("typeahead",null);this.$element.data("active",null);this.$element.unbind("focus.bootstrap3Typeahead").unbind("blur.bootstrap3Typeahead").unbind("keypress.bootstrap3Typeahead").unbind("propertychange.bootstrap3Typeahead input.bootstrap3Typeahead").unbind("keyup.bootstrap3Typeahead");if(this.eventSupported("keydown")){this.$element.unbind("keydown.bootstrap3-typeahead")}this.$menu.remove();this.destroyed=true},eventSupported:function(d){var e=d in this.$element;if(!e){this.$element.setAttribute(d,"return;");e=typeof this.$element[d]==="function"}return e},move:function(d){if(!this.shown){return}switch(d.keyCode){case 9:case 13:case 27:d.preventDefault();break;case 38:if(d.shiftKey){return}d.preventDefault();this.prev();break;case 40:if(d.shiftKey){return}d.preventDefault();this.next();break}},keydown:function(d){if(d.keyCode===17){return}this.keyPressed=true;this.suppressKeyPressRepeat=~b.inArray(d.keyCode,[40,38,9,13,27]);if(!this.shown&&d.keyCode==40){this.lookup()}else{this.move(d)}},keypress:function(d){if(this.suppressKeyPressRepeat){return}this.move(d)},input:function(f){var d=this.$element.val()||this.$element.text();if(this.value!==d){this.value=d;this.lookup()}},keyup:function(d){if(this.destroyed){return}switch(d.keyCode){case 40:case 38:case 16:case 17:case 18:break;case 9:if(!this.shown||(this.showHintOnFocus&&!this.keyPressed)){return}this.select();break;case 13:if(!this.shown){return}this.select();break;case 27:if(!this.shown){return}this.hide();break}},focus:function(d){if(!this.focused){this.focused=true;this.keyPressed=false;if(this.options.showHintOnFocus&&this.skipShowHintOnFocus!==true){if(this.options.showHintOnFocus==="all"){this.lookup("")}else{this.lookup()}}}if(this.skipShowHintOnFocus){this.skipShowHintOnFocus=false}},blur:function(d){if(!this.mousedover&&!this.mouseddown&&this.shown){if(this.selectOnBlur){this.select()}this.hide();this.focused=false;this.keyPressed=false}else{if(this.mouseddown){this.skipShowHintOnFocus=true;this.$element.focus();this.mouseddown=false}}},click:function(d){d.preventDefault();this.skipShowHintOnFocus=true;this.select();this.$element.focus();this.hide()},mouseenter:function(d){this.mousedover=true;this.$menu.find(".active").removeClass("active");b(d.currentTarget).addClass("active")},mouseleave:function(d){this.mousedover=false;if(!this.focused&&this.shown){this.hide()}},mousedown:function(d){this.mouseddown=true;this.$menu.one("mouseup",function(f){this.mouseddown=false}.bind(this))},touchstart:function(d){d.preventDefault();this.$menu.find(".active").removeClass("active");b(d.currentTarget).addClass("active")},touchend:function(d){d.preventDefault();this.select();this.$element.focus()}};var a=b.fn.typeahead;b.fn.typeahead=function(e){var d=arguments;if(typeof e=="string"&&e=="getActive"){return this.data("active")}return this.each(function(){var h=b(this);var g=h.data("typeahead");var f=typeof e=="object"&&e;if(!g){h.data("typeahead",(g=new c(this,f)))}if(typeof e=="string"&&g[e]){if(d.length>1){g[e].apply(g,Array.prototype.slice.call(d,1))}else{g[e]()}}})};c.defaults={source:[],items:8,minLength:1,scrollHeight:0,autoSelect:true,afterSelect:b.noop,afterEmptySelect:b.noop,addItem:false,followLinkOnSelect:false,delay:0,separator:"category" (…) property in c.defaults