-
Notifications
You must be signed in to change notification settings - Fork 668
/
Copy pathapi.coffee
59 lines (56 loc) · 1.61 KB
/
api.coffee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
Api =
# load a flag's data
#
# @params at[String] the flag
# @params data [Array] data to storage.
load: (at, data) -> c.model.load data if c = this.controller(at)
isSelecting: () -> !!this.controller()?.view.visible()
hide: () -> this.controller()?.view.hide()
reposition: () ->
if c = this.controller()
c.view.reposition(c.rect())
setIframe: (iframe, asRoot) -> this.setupRootElement(iframe, asRoot); null;
run: -> this.dispatch()
destroy: ->
this.shutdown()
@$inputor.data('atwho', null)
$.fn.atwho = (method) ->
_args = arguments
result = null
this.filter('textarea, input, [contenteditable=""], [contenteditable=true]').each ->
if not app = ($this = $ this).data "atwho"
$this.data 'atwho', (app = new App this)
if typeof method is 'object' || !method
app.reg method.at, method
else if Api[method] and app
result = Api[method].apply app, Array::slice.call(_args, 1)
else
$.error "Method #{method} does not exist on jQuery.atwho"
if result? then result else this
$.fn.atwho.default =
at: undefined
alias: undefined
data: null
displayTpl: "<li>${name}</li>"
insertTpl: "${atwho-at}${name}"
headerTpl: null
callbacks: DEFAULT_CALLBACKS
functionOverrides: {}
searchKey: "name"
suffix: undefined
hideWithoutSuffix: no
startWithSpace: yes
acceptSpaceBar: false
highlightFirst: yes
limit: 5
maxLen: 20
minLen: 0
displayTimeout: 300
delay: null
spaceSelectsMatch: no
tabSelectsMatch: yes
editableAtwhoQueryAttrs: {}
scrollDuration: 150
suspendOnComposing: true
lookUpOnClick: true
$.fn.atwho.debug = false