mirror of
https://github.com/atom/atom.git
synced 2026-01-24 14:28:14 -05:00
Extract fuzzyFilter function into a file that is shared between file finder and autocompleter. Fix jQuery.fn.preempt to pass its arguments to the event handler.
25 lines
649 B
CoffeeScript
25 lines
649 B
CoffeeScript
$ = require 'jquery'
|
|
|
|
$.fn.scrollBottom = (newValue) ->
|
|
if newValue?
|
|
@scrollTop(newValue - @height())
|
|
else
|
|
@scrollTop() + @height()
|
|
|
|
$.fn.scrollRight = (newValue) ->
|
|
if newValue?
|
|
@scrollLeft(newValue - @width())
|
|
else
|
|
@scrollLeft() + @width()
|
|
|
|
$.fn.containsElement = (element) ->
|
|
(element[0].compareDocumentPosition(this[0]) & 8) == 8
|
|
|
|
$.fn.preempt = (eventName, handler) ->
|
|
@on eventName, (e, args...) ->
|
|
if handler(e, args...) == false then e.stopImmediatePropagation()
|
|
|
|
eventNameWithoutNamespace = eventName.split('.')[0]
|
|
handlers = @data('events')[eventNameWithoutNamespace]
|
|
handlers.unshift(handlers.pop())
|