template/static/scripts/bootstrap-typeahead.js
function (element, options) {
        this.$element = $(element);
        this.options = $.extend(true, {}, $.fn.typeahead.defaults, options);
        this.$menu = $(this.options.menu).appendTo('body');
        this.shown = false;

        // Method overrides    
        this.eventSupported = this.options.eventSupported || this.eventSupported;
        this.grepper = this.options.grepper || this.grepper;
        this.highlighter = this.options.highlighter || this.highlighter;
        this.lookup = this.options.lookup || this.lookup;
        this.matcher = this.options.matcher || this.matcher;
        this.render = this.options.render || this.render;
        this.select = this.options.select || this.select;
        this.sorter = this.options.sorter || this.sorter;
        this.source = this.options.source || this.source;        
                
        if (!this.source.length) {
            var ajax = this.options.ajax;

            if (typeof ajax === 'string') {
                this.ajax = $.extend({}, $.fn.typeahead.defaults.ajax, { url: ajax });
            } else {
                this.ajax = $.extend({}, $.fn.typeahead.defaults.ajax, ajax);
            }

            if (!this.ajax.url) {
                this.ajax = null;
            }
        }

        this.listen();        
    }
function (element, options) {
        this.$element = $(element);
        this.options = $.extend(true, {}, $.fn.typeahead.defaults, options);
        this.$menu = $(this.options.menu).appendTo('body');
        this.shown = false;

        // Method overrides    
        this.eventSupported = this.options.eventSupported || this.eventSupported;
        this.grepper = this.options.grepper || this.grepper;
        this.highlighter = this.options.highlighter || this.highlighter;
        this.lookup = this.options.lookup || this.lookup;
        this.matcher = this.options.matcher || this.matcher;
        this.render = this.options.render || this.render;
        this.select = this.options.select || this.select;
        this.sorter = this.options.sorter || this.sorter;
        this.source = this.options.source || this.source;        
                
        if (!this.source.length) {
            var ajax = this.options.ajax;

            if (typeof ajax === 'string') {
                this.ajax = $.extend({}, $.fn.typeahead.defaults.ajax, { url: ajax });
            } else {
                this.ajax = $.extend({}, $.fn.typeahead.defaults.ajax, ajax);
            }

            if (!this.ajax.url) {
                this.ajax = null;
            }
        }

        this.listen();        
    }
function ( element , options ) { this . $element = $ ( element ) ; this . options = $ . extend ( true , { } , $ . fn . typeahead . defaults , options ) ; this . $menu = $ ( this . options . menu ) . appendTo ( 'body' ) ; this . shown = false ; // Method overrides     this . eventSupported = this . options . eventSupported || this . eventSupported ; this . grepper = this . options . grepper || this . grepper ; this . highlighter = this . options . highlighter || this . highlighter ; this . lookup = this . options . lookup || this . lookup ; this . matcher = this . options . matcher || this . matcher ; this . render = this . options . render || this . render ; this . select = this . options . select || this . select ; this . sorter = this . options . sorter || this . sorter ; this . source = this . options . source || this . source ; if ( ! this . source . length ) { var ajax = this . options . ajax ; if ( typeof ajax === 'string' ) { this . ajax = $ . extend ( { } , $ . fn . typeahead . defaults . ajax , { url : ajax } ) ; } else { this . ajax = $ . extend ( { } , $ . fn . typeahead . defaults . ajax , ajax ) ; } if ( ! this . ajax . url ) { this . ajax = null ; } } this . listen ( ) ; }
------------------------------------------------------------------  Constructor
------------------------------------------------------------------ Constructor