Lines Matching full:this

8  * you may not use this file except in compliance with the License.
30 this.$element = $(element)
31 this.options = $.extend({}, $.fn.typeahead.defaults, options)
32 this.matcher = this.options.matcher || this.matcher
33 this.sorter = this.options.sorter || this.sorter
34 this.highlighter = this.options.highlighter || this.highlighter
35 this.updater = this.options.updater || this.updater
36 this.source = this.options.source
37 this.$menu = $(this.options.menu)
38 this.shown = false
39 this.listen()
47 var val = this.$menu.find('.active').attr('data-value')
48 this.$element
49 .val(this.updater(val))
51 return this.hide()
59 var pos = $.extend({}, this.$element.position(), {
60 height: this.$element[0].offsetHeight
63 this.$menu
64 .insertAfter(this.$element)
71 this.shown = true
72 return this
76 this.$menu.hide()
77 this.shown = false
78 return this
84 this.query = this.$element.val()
86 if (!this.query || this.query.length < this.options.minLength) {
87 return this.shown ? this.hide() : this
90 …items = $.isFunction(this.source) ? this.source(this.query, $.proxy(this.process, this)) : this.so…
92 return items ? this.process(items) : this
96 var that = this
102 items = this.sorter(items)
105 return this.shown ? this.hide() : this
108 return this.render(items.slice(0, this.options.items)).show()
112 return ~item.toLowerCase().indexOf(this.query.toLowerCase())
122 if (!item.toLowerCase().indexOf(this.query.toLowerCase())) beginswith.push(item)
123 else if (~item.indexOf(this.query)) caseSensitive.push(item)
131 var query = this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, '\\$&')
138 var that = this
147 this.$menu.html(items)
148 return this
152 var active = this.$menu.find('.active').removeClass('active')
156 next = $(this.$menu.find('li')[0])
163 var active = this.$menu.find('.active').removeClass('active')
167 prev = this.$menu.find('li').last()
174 this.$element
175 .on('focus', $.proxy(this.focus, this))
176 .on('blur', $.proxy(this.blur, this))
177 .on('keypress', $.proxy(this.keypress, this))
178 .on('keyup', $.proxy(this.keyup, this))
180 if (this.eventSupported('keydown')) {
181 this.$element.on('keydown', $.proxy(this.keydown, this))
184 this.$menu
185 .on('click', $.proxy(this.click, this))
186 .on('mouseenter', 'li', $.proxy(this.mouseenter, this))
187 .on('mouseleave', 'li', $.proxy(this.mouseleave, this))
191 var isSupported = eventName in this.$element
193 this.$element.setAttribute(eventName, 'return;')
194 isSupported = typeof this.$element[eventName] === 'function'
200 if (!this.shown) return
211 this.prev()
216 this.next()
224 this.suppressKeyPressRepeat = ~$.inArray(e.keyCode, [40,38,9,13,27])
225 this.move(e)
229 if (this.suppressKeyPressRepeat) return
230 this.move(e)
244 if (!this.shown) return
245 this.select()
249 if (!this.shown) return
250 this.hide()
254 this.lookup()
262 this.focused = true
266 this.focused = false
267 if (!this.mousedover && this.shown) this.hide()
273 this.select()
274 this.$element.focus()
278 this.mousedover = true
279 this.$menu.find('.active').removeClass('active')
284 this.mousedover = false
285 if (!this.focused && this.shown) this.hide()
297 return this.each(function () {
298 var $this = $(this)
299 , data = $this.data('typeahead')
301 if (!data) $this.data('typeahead', (data = new Typeahead(this, options)))
322 return this
330 var $this = $(this)
331 if ($this.data('typeahead')) return
332 $this.typeahead($this.data())