id stringlengths 34 124 | type stringclasses 4
values | prompt stringlengths 0 4.95k | response stringlengths 21 4.89k | source_lang stringclasses 3
values | target_lang stringclasses 2
values | repo stringclasses 75
values | path stringlengths 10 88 | license stringclasses 1
value | commit stringlengths 40 40 | stars int64 431 18.7k | source_url stringlengths 86 176 | line_start int64 1 214 | line_end int64 3 253 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ichord/At.js:src/view.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class View
# @param controller [Object] The Controller.
constructor: (@context) ->
@$el = $("<div class='atwho-view'><ul class='atwho-view-ul'></ul></div>")
@timeoutID = null
# create HTML DOM of list view if it does not exist
@context.$el.ap... | var View;
View = class View {
// @param controller [Object] The Controller.
constructor(context) {
this.context = context;
this.$el = $("<div class='atwho-view'><ul class='atwho-view-ul'></ul></div>");
this.timeoutID = null;
// create HTML DOM of list view if it does not exist
this.context.$el.... | CoffeeScript | JavaScript | ichord/At.js | src/view.coffee | MIT | a0e08a806ff67996d3fa20f52ece29f32077b39a | 5,250 | https://github.com/ichord/At.js/blob/a0e08a806ff67996d3fa20f52ece29f32077b39a/src/view.coffee | 3 | 52 |
ichord/At.js:src/view.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var View;
View = class View {
// @param controller [Object] The Controller.
constructor(context) {
this.context = context;
this.$el = $("<div class='atwho-view'><ul class='atwho-view-ul'></ul></div>");
this.timeoutID = null;
// create HTML DOM ... | class View
# @param controller [Object] The Controller.
constructor: (@context) ->
@$el = $("<div class='atwho-view'><ul class='atwho-view-ul'></ul></div>")
@timeoutID = null
# create HTML DOM of list view if it does not exist
@context.$el.append(@$el)
this.bindEvent()
init: ->
id = @con... | JavaScript | CoffeeScript | ichord/At.js | src/view.coffee | MIT | a0e08a806ff67996d3fa20f52ece29f32077b39a | 5,250 | https://github.com/ichord/At.js/blob/a0e08a806ff67996d3fa20f52ece29f32077b39a/src/view.coffee | 3 | 52 |
ichord/At.js:src/view.coffee:1:completion | completion | class View
# @param controller [Object] The Controller.
constructor: (@context) ->
@$el = $("<div class='atwho-view'><ul class='atwho-view-ul'></ul></div>")
@timeoutID = null
# create HTML DOM of list view if it does not exist
@context.$el.append(@$el)
this.bindEvent()
init: ->
id = @con... | lastCoordY = e.clientY
$cur = $(e.currentTarget)
return if $cur.hasClass('cur')
$menu.find('.cur').removeClass 'cur'
$cur.addClass 'cur'
.on 'click.atwho-view', 'li', (e) =>
$menu.find('.cur').removeClass 'cur'
$(e.currentTarget).addClass 'cur'
this.choose(e)
e.preven... | CoffeeScript | CoffeeScript | ichord/At.js | src/view.coffee | MIT | a0e08a806ff67996d3fa20f52ece29f32077b39a | 5,250 | https://github.com/ichord/At.js/blob/a0e08a806ff67996d3fa20f52ece29f32077b39a/src/view.coffee | 3 | 52 |
ichord/At.js:src/view.coffee:2:raw_corpus | raw_corpus | @context.insert @context.callbacks("beforeInsert").call(@context, content, $li), $li
@context.trigger "inserted", [$li, e]
this.hide(e)
@stopShowing = yes if @context.getOpt("hideWithoutSuffix")
reposition: (rect) ->
_window = if @context.app.iframeAsRoot then @context.app.window else window
... | CoffeeScript | ichord/At.js | src/view.coffee | MIT | a0e08a806ff67996d3fa20f52ece29f32077b39a | 5,250 | https://github.com/ichord/At.js/blob/a0e08a806ff67996d3fa20f52ece29f32077b39a/src/view.coffee | 53 | 102 | ||
ichord/At.js:src/view.coffee:2:completion | completion | @context.insert @context.callbacks("beforeInsert").call(@context, content, $li), $li
@context.trigger "inserted", [$li, e]
this.hide(e)
@stopShowing = yes if @context.getOpt("hideWithoutSuffix")
reposition: (rect) ->
_window = if @context.app.iframeAsRoot then @context.app.window else window
... | cur = @$el.find('.cur').removeClass('cur')
prev = cur.prev()
prev = @$el.find('li:last') if not prev.length
prev.addClass 'cur'
@scrollTop Math.max(0, cur.innerHeight() * (prev.index() + 2) - @$el.height())
scrollTop: (scrollTop) ->
scrollDuration = @context.getOpt('scrollDuration')
if scrol... | CoffeeScript | CoffeeScript | ichord/At.js | src/view.coffee | MIT | a0e08a806ff67996d3fa20f52ece29f32077b39a | 5,250 | https://github.com/ichord/At.js/blob/a0e08a806ff67996d3fa20f52ece29f32077b39a/src/view.coffee | 53 | 102 |
ichord/At.js:src/view.coffee:3:raw_corpus | raw_corpus | return if not this.visible()
if isNaN(time)
@$el.hide()
@context.trigger 'hidden', [e]
else
callback = => this.hide()
clearTimeout @timeoutID
@timeoutID = setTimeout callback, time
# render list view
render: (list) ->
if not ($.isArray(list) and list.length > 0)
this... | CoffeeScript | ichord/At.js | src/view.coffee | MIT | a0e08a806ff67996d3fa20f52ece29f32077b39a | 5,250 | https://github.com/ichord/At.js/blob/a0e08a806ff67996d3fa20f52ece29f32077b39a/src/view.coffee | 103 | 130 | ||
ichord/At.js:src/view.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
return if not this.visible()
if isNaN(time)
@$el.hide()
@context.trigger 'hidden', [e]
else
callback = => this.hide()
clearTimeout @timeoutID
@timeoutID = setTimeout callback, time
# render list view
render: (list) ->
... | var callback;
if (!this.visible()) {
if (isNaN(time)) {
this.$el.hide();
return this.context.trigger('hidden', [e]);
} else {
callback = () => {
return this.hide();
};
clearTimeout(this.timeoutID);
return this.timeoutID = setTimeout(callback, time);
}
}
({
// render list view
r... | CoffeeScript | JavaScript | ichord/At.js | src/view.coffee | MIT | a0e08a806ff67996d3fa20f52ece29f32077b39a | 5,250 | https://github.com/ichord/At.js/blob/a0e08a806ff67996d3fa20f52ece29f32077b39a/src/view.coffee | 103 | 130 |
ichord/At.js:src/view.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var callback;
if (!this.visible()) {
if (isNaN(time)) {
this.$el.hide();
return this.context.trigger('hidden', [e]);
} else {
callback = () => {
return this.hide();
};
clearTimeout(this.timeoutID);
return this.timeoutID = setTimeo... | return if not this.visible()
if isNaN(time)
@$el.hide()
@context.trigger 'hidden', [e]
else
callback = => this.hide()
clearTimeout @timeoutID
@timeoutID = setTimeout callback, time
# render list view
render: (list) ->
if not ($.isArray(list) and list.length > 0)
this... | JavaScript | CoffeeScript | ichord/At.js | src/view.coffee | MIT | a0e08a806ff67996d3fa20f52ece29f32077b39a | 5,250 | https://github.com/ichord/At.js/blob/a0e08a806ff67996d3fa20f52ece29f32077b39a/src/view.coffee | 103 | 130 |
ichord/At.js:src/view.coffee:3:completion | completion | return if not this.visible()
if isNaN(time)
@$el.hide()
@context.trigger 'hidden', [e]
else
callback = => this.hide()
clearTimeout @timeoutID
@timeoutID = setTimeout callback, time
# render list view
render: (list) ->
if not ($.isArray(list) and list.length > 0)
this... | @$el.find('ul').empty()
$ul = @$el.find('ul')
tpl = @context.getOpt('displayTpl')
for item in list
item = $.extend {}, item, {'atwho-at': @context.at}
li = @context.callbacks("tplEval").call(@context, tpl, item, "onDisplay")
$li = $ @context.callbacks("highlighter").call(@context, li, @co... | CoffeeScript | CoffeeScript | ichord/At.js | src/view.coffee | MIT | a0e08a806ff67996d3fa20f52ece29f32077b39a | 5,250 | https://github.com/ichord/At.js/blob/a0e08a806ff67996d3fa20f52ece29f32077b39a/src/view.coffee | 103 | 130 |
ichord/At.js:src/view.coffee:2:raw_corpus | raw_corpus | reposition: (rect) ->
_window = if @context.app.iframeAsRoot then @context.app.window else window
if rect.bottom + @$el.height() - $(_window).scrollTop() > $(_window).height()
rect.bottom = rect.top - @$el.height()
if rect.left > overflowOffset = $(_window).width() - @$el.width() - 5
rect.left =... | CoffeeScript | ichord/At.js | src/view.coffee | MIT | c9ed2e2d44746f5c513e0af00cfdb5d1189c5789 | 5,250 | https://github.com/ichord/At.js/blob/c9ed2e2d44746f5c513e0af00cfdb5d1189c5789/src/view.coffee | 53 | 102 | ||
ichord/At.js:src/view.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
reposition: (rect) ->
_window = if @context.app.iframeAsRoot then @context.app.window else window
if rect.bottom + @$el.height() - $(_window).scrollTop() > $(_window).height()
rect.bottom = rect.top - @$el.height()
if rect.left > overflowOffset ... | ({
reposition: function(rect) {
var _window, offset, overflowOffset, ref;
_window = this.context.app.iframeAsRoot ? this.context.app.window : window;
if (rect.bottom + this.$el.height() - $(_window).scrollTop() > $(_window).height()) {
rect.bottom = rect.top - this.$el.height();
}
if (rect.l... | CoffeeScript | JavaScript | ichord/At.js | src/view.coffee | MIT | c9ed2e2d44746f5c513e0af00cfdb5d1189c5789 | 5,250 | https://github.com/ichord/At.js/blob/c9ed2e2d44746f5c513e0af00cfdb5d1189c5789/src/view.coffee | 53 | 102 |
ichord/At.js:src/view.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
reposition: function(rect) {
var _window, offset, overflowOffset, ref;
_window = this.context.app.iframeAsRoot ? this.context.app.window : window;
if (rect.bottom + this.$el.height() - $(_window).scrollTop() > $(_window).height()) {
rect.bott... | reposition: (rect) ->
_window = if @context.app.iframeAsRoot then @context.app.window else window
if rect.bottom + @$el.height() - $(_window).scrollTop() > $(_window).height()
rect.bottom = rect.top - @$el.height()
if rect.left > overflowOffset = $(_window).width() - @$el.width() - 5
rect.left =... | JavaScript | CoffeeScript | ichord/At.js | src/view.coffee | MIT | c9ed2e2d44746f5c513e0af00cfdb5d1189c5789 | 5,250 | https://github.com/ichord/At.js/blob/c9ed2e2d44746f5c513e0af00cfdb5d1189c5789/src/view.coffee | 53 | 102 |
ichord/At.js:src/view.coffee:2:completion | completion | reposition: (rect) ->
_window = if @context.app.iframeAsRoot then @context.app.window else window
if rect.bottom + @$el.height() - $(_window).scrollTop() > $(_window).height()
rect.bottom = rect.top - @$el.height()
if rect.left > overflowOffset = $(_window).width() - @$el.width() - 5
rect.left =... | @scrollTop Math.max(0, cur.outerHeight(true) * (prev.index() + 2) - @$el.height())
scrollTop: (scrollTop) ->
scrollDuration = @context.getOpt('scrollDuration')
if scrollDuration
@$elUl.animate {scrollTop: scrollTop}, scrollDuration
else
@$elUl.scrollTop(scrollTop)
show: ->
if @stopShow... | CoffeeScript | CoffeeScript | ichord/At.js | src/view.coffee | MIT | c9ed2e2d44746f5c513e0af00cfdb5d1189c5789 | 5,250 | https://github.com/ichord/At.js/blob/c9ed2e2d44746f5c513e0af00cfdb5d1189c5789/src/view.coffee | 53 | 102 |
ichord/At.js:src/view.coffee:3:raw_corpus | raw_corpus | else
callback = => this.hide()
clearTimeout @timeoutID
@timeoutID = setTimeout callback, time
# render list view
render: (list) ->
if not ($.isArray(list) and list.length > 0)
this.hide()
return
@$el.find('ul').empty()
$ul = @$el.find('ul')
tpl = @context.getOpt('disp... | CoffeeScript | ichord/At.js | src/view.coffee | MIT | c9ed2e2d44746f5c513e0af00cfdb5d1189c5789 | 5,250 | https://github.com/ichord/At.js/blob/c9ed2e2d44746f5c513e0af00cfdb5d1189c5789/src/view.coffee | 103 | 126 | ||
ichord/At.js:src/view.coffee:3:completion | completion | else
callback = => this.hide()
clearTimeout @timeoutID
@timeoutID = setTimeout callback, time
# render list view
render: (list) ->
if not ($.isArray(list) and list.length > 0)
this.hide()
return
@$el.find('ul').empty() | $ul = @$el.find('ul')
tpl = @context.getOpt('displayTpl')
for item in list
item = $.extend {}, item, {'atwho-at': @context.at}
li = @context.callbacks("tplEval").call(@context, tpl, item, "onDisplay")
$li = $ @context.callbacks("highlighter").call(@context, li, @context.query.text)
$li.... | CoffeeScript | CoffeeScript | ichord/At.js | src/view.coffee | MIT | c9ed2e2d44746f5c513e0af00cfdb5d1189c5789 | 5,250 | https://github.com/ichord/At.js/blob/c9ed2e2d44746f5c513e0af00cfdb5d1189c5789/src/view.coffee | 103 | 126 |
ichord/At.js:src/view.coffee:1:raw_corpus | raw_corpus | class View
# @param controller [Object] The Controller.
constructor: (@context) ->
@$el = $("<div class='atwho-view'><ul class='atwho-view-ul'></ul></div>")
@timeoutID = null
# create HTML DOM of list view if it does not exist
@context.$el.append(@$el)
this.bindEvent()
init: ->
id = @con... | CoffeeScript | ichord/At.js | src/view.coffee | MIT | 7f4295a9f8962fee8867a9d5006e22fe01ef19b5 | 5,250 | https://github.com/ichord/At.js/blob/7f4295a9f8962fee8867a9d5006e22fe01ef19b5/src/view.coffee | 3 | 52 | ||
ichord/At.js:src/view.coffee:1:completion | completion | class View
# @param controller [Object] The Controller.
constructor: (@context) ->
@$el = $("<div class='atwho-view'><ul class='atwho-view-ul'></ul></div>")
@timeoutID = null
# create HTML DOM of list view if it does not exist
@context.$el.append(@$el)
this.bindEvent()
init: ->
id = @con... | this.choose(e)
e.preventDefault()
# Check if view is visible
#
# @return [Boolean]
visible: ->
@$el.is(":visible")
highlighted: ->
@$el.find(".cur").length > 0
choose: (e) ->
if ($li = @$el.find ".cur").length
content = @context.insertContentFor $li
@context._stopDelayedCal... | CoffeeScript | CoffeeScript | ichord/At.js | src/view.coffee | MIT | 7f4295a9f8962fee8867a9d5006e22fe01ef19b5 | 5,250 | https://github.com/ichord/At.js/blob/7f4295a9f8962fee8867a9d5006e22fe01ef19b5/src/view.coffee | 3 | 52 |
ichord/At.js:src/view.coffee:2:raw_corpus | raw_corpus | rect.bottom = rect.top - @$el.height()
if rect.left > overflowOffset = $(_window).width() - @$el.width() - 5
rect.left = overflowOffset
offset = {left:rect.left, top:rect.bottom}
@context.callbacks("beforeReposition")?.call(@context, offset)
@$el.offset offset
@context.trigger "reposition", [o... | CoffeeScript | ichord/At.js | src/view.coffee | MIT | 7f4295a9f8962fee8867a9d5006e22fe01ef19b5 | 5,250 | https://github.com/ichord/At.js/blob/7f4295a9f8962fee8867a9d5006e22fe01ef19b5/src/view.coffee | 53 | 102 | ||
ichord/At.js:src/view.coffee:2:completion | completion | rect.bottom = rect.top - @$el.height()
if rect.left > overflowOffset = $(_window).width() - @$el.width() - 5
rect.left = overflowOffset
offset = {left:rect.left, top:rect.bottom}
@context.callbacks("beforeReposition")?.call(@context, offset)
@$el.offset offset
@context.trigger "reposition", [o... | scrollDuration = @context.getOpt('scrollDuration')
if scrollDuration
@$el.animate {scrollTop: scrollTop}, scrollDuration
else
@$el.scrollTop(scrollTop)
show: ->
if @stopShowing
@stopShowing = false
return
if not this.visible()
@$el.show()
@$el.scrollTop 0
@co... | CoffeeScript | CoffeeScript | ichord/At.js | src/view.coffee | MIT | 7f4295a9f8962fee8867a9d5006e22fe01ef19b5 | 5,250 | https://github.com/ichord/At.js/blob/7f4295a9f8962fee8867a9d5006e22fe01ef19b5/src/view.coffee | 53 | 102 |
ichord/At.js:src/view.coffee:3:raw_corpus | raw_corpus | # render list view
render: (list) ->
if not ($.isArray(list) and list.length > 0)
this.hide()
return
@$el.find('ul').empty()
$ul = @$el.find('ul')
tpl = @context.getOpt('displayTpl')
for item in list
item = $.extend {}, item, {'atwho-at': @context.at}
li = @context.callba... | CoffeeScript | ichord/At.js | src/view.coffee | MIT | 7f4295a9f8962fee8867a9d5006e22fe01ef19b5 | 5,250 | https://github.com/ichord/At.js/blob/7f4295a9f8962fee8867a9d5006e22fe01ef19b5/src/view.coffee | 103 | 122 | ||
ichord/At.js:src/view.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# render list view
render: (list) ->
if not ($.isArray(list) and list.length > 0)
this.hide()
return
@$el.find('ul').empty()
$ul = @$el.find('ul')
tpl = @context.getOpt('displayTpl')
for item in list
item = $.extend {}, i... | // render list view
({
render: function(list) {
var $li, $ul, i, item, len, li, tpl;
if (!($.isArray(list) && list.length > 0)) {
this.hide();
return;
}
this.$el.find('ul').empty();
$ul = this.$el.find('ul');
tpl = this.context.getOpt('displayTpl');
for (i = 0, len = list.lengt... | CoffeeScript | JavaScript | ichord/At.js | src/view.coffee | MIT | 7f4295a9f8962fee8867a9d5006e22fe01ef19b5 | 5,250 | https://github.com/ichord/At.js/blob/7f4295a9f8962fee8867a9d5006e22fe01ef19b5/src/view.coffee | 103 | 122 |
ichord/At.js:src/view.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// render list view
({
render: function(list) {
var $li, $ul, i, item, len, li, tpl;
if (!($.isArray(list) && list.length > 0)) {
this.hide();
return;
}
this.$el.find('ul').empty();
$ul = this.$el.find('ul');
tpl = this.context... | # render list view
render: (list) ->
if not ($.isArray(list) and list.length > 0)
this.hide()
return
@$el.find('ul').empty()
$ul = @$el.find('ul')
tpl = @context.getOpt('displayTpl')
for item in list
item = $.extend {}, item, {'atwho-at': @context.at}
li = @context.callba... | JavaScript | CoffeeScript | ichord/At.js | src/view.coffee | MIT | 7f4295a9f8962fee8867a9d5006e22fe01ef19b5 | 5,250 | https://github.com/ichord/At.js/blob/7f4295a9f8962fee8867a9d5006e22fe01ef19b5/src/view.coffee | 103 | 122 |
ichord/At.js:src/view.coffee:3:completion | completion | # render list view
render: (list) ->
if not ($.isArray(list) and list.length > 0)
this.hide()
return
@$el.find('ul').empty()
$ul = @$el.find('ul')
tpl = @context.getOpt('displayTpl') | for item in list
item = $.extend {}, item, {'atwho-at': @context.at}
li = @context.callbacks("tplEval").call(@context, tpl, item, "onDisplay")
$li = $ @context.callbacks("highlighter").call(@context, li, @context.query.text)
$li.data("item-data", item)
$ul.append $li
this.show()
$... | CoffeeScript | CoffeeScript | ichord/At.js | src/view.coffee | MIT | 7f4295a9f8962fee8867a9d5006e22fe01ef19b5 | 5,250 | https://github.com/ichord/At.js/blob/7f4295a9f8962fee8867a9d5006e22fe01ef19b5/src/view.coffee | 103 | 122 |
ichord/At.js:src/view.coffee:1:raw_corpus | raw_corpus | class View
# @param controller [Object] The Controller.
constructor: (@context) ->
@$el = $("<div class='atwho-view'><ul class='atwho-view-ul'></ul></div>")
@timeoutID = null
# create HTML DOM of list view if it does not exist
@context.$el.append(@$el)
this.bindEvent()
init: ->
id = @con... | CoffeeScript | ichord/At.js | src/view.coffee | MIT | 6567af98a74758a56e0aca2915a6e931f795d697 | 5,250 | https://github.com/ichord/At.js/blob/6567af98a74758a56e0aca2915a6e931f795d697/src/view.coffee | 3 | 52 | ||
ichord/At.js:src/view.coffee:1:completion | completion | class View
# @param controller [Object] The Controller.
constructor: (@context) ->
@$el = $("<div class='atwho-view'><ul class='atwho-view-ul'></ul></div>")
@timeoutID = null
# create HTML DOM of list view if it does not exist
@context.$el.append(@$el)
this.bindEvent()
init: ->
id = @con... | this.choose(e)
e.preventDefault()
# Check if view is visible
#
# @return [Boolean]
visible: ->
@$el.is(":visible")
highlighted: ->
@$el.find(".cur").length > 0
choose: (e) ->
if ($li = @$el.find ".cur").length
content = @context.insertContentFor $li
@context.insert @context.... | CoffeeScript | CoffeeScript | ichord/At.js | src/view.coffee | MIT | 6567af98a74758a56e0aca2915a6e931f795d697 | 5,250 | https://github.com/ichord/At.js/blob/6567af98a74758a56e0aca2915a6e931f795d697/src/view.coffee | 3 | 52 |
ichord/At.js:src/view.coffee:2:raw_corpus | raw_corpus | rect.left = overflowOffset
offset = {left:rect.left, top:rect.bottom}
@context.callbacks("beforeReposition")?.call(@context, offset)
@$el.offset offset
@context.trigger "reposition", [offset]
next: ->
cur = @$el.find('.cur').removeClass('cur')
next = cur.next()
next = @$el.find('li:first'... | CoffeeScript | ichord/At.js | src/view.coffee | MIT | 6567af98a74758a56e0aca2915a6e931f795d697 | 5,250 | https://github.com/ichord/At.js/blob/6567af98a74758a56e0aca2915a6e931f795d697/src/view.coffee | 53 | 102 | ||
ichord/At.js:src/view.coffee:2:completion | completion | rect.left = overflowOffset
offset = {left:rect.left, top:rect.bottom}
@context.callbacks("beforeReposition")?.call(@context, offset)
@$el.offset offset
@context.trigger "reposition", [offset]
next: ->
cur = @$el.find('.cur').removeClass('cur')
next = cur.next()
next = @$el.find('li:first'... | @$el.animate {scrollTop: scrollTop}, scrollDuration
else
@$el.scrollTop(scrollTop)
show: ->
if @stopShowing
@stopShowing = false
return
if not this.visible()
@$el.show()
@$el.scrollTop 0
@context.trigger 'shown'
this.reposition(rect) if rect = @context.rect()
hi... | CoffeeScript | CoffeeScript | ichord/At.js | src/view.coffee | MIT | 6567af98a74758a56e0aca2915a6e931f795d697 | 5,250 | https://github.com/ichord/At.js/blob/6567af98a74758a56e0aca2915a6e931f795d697/src/view.coffee | 53 | 102 |
ichord/At.js:src/view.coffee:3:raw_corpus | raw_corpus | render: (list) ->
if not ($.isArray(list) and list.length > 0)
this.hide()
return
@$el.find('ul').empty()
$ul = @$el.find('ul')
tpl = @context.getOpt('displayTpl')
for item in list
item = $.extend {}, item, {'atwho-at': @context.at}
li = @context.callbacks("tplEval").call(@... | CoffeeScript | ichord/At.js | src/view.coffee | MIT | 6567af98a74758a56e0aca2915a6e931f795d697 | 5,250 | https://github.com/ichord/At.js/blob/6567af98a74758a56e0aca2915a6e931f795d697/src/view.coffee | 103 | 120 | ||
ichord/At.js:src/view.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
render: (list) ->
if not ($.isArray(list) and list.length > 0)
this.hide()
return
@$el.find('ul').empty()
$ul = @$el.find('ul')
tpl = @context.getOpt('displayTpl')
for item in list
item = $.extend {}, item, {'atwho-at': @co... | ({
render: function(list) {
var $li, $ul, i, item, len, li, tpl;
if (!($.isArray(list) && list.length > 0)) {
this.hide();
return;
}
this.$el.find('ul').empty();
$ul = this.$el.find('ul');
tpl = this.context.getOpt('displayTpl');
for (i = 0, len = list.length; i < len; i++) {
... | CoffeeScript | JavaScript | ichord/At.js | src/view.coffee | MIT | 6567af98a74758a56e0aca2915a6e931f795d697 | 5,250 | https://github.com/ichord/At.js/blob/6567af98a74758a56e0aca2915a6e931f795d697/src/view.coffee | 103 | 120 |
ichord/At.js:src/view.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
render: function(list) {
var $li, $ul, i, item, len, li, tpl;
if (!($.isArray(list) && list.length > 0)) {
this.hide();
return;
}
this.$el.find('ul').empty();
$ul = this.$el.find('ul');
tpl = this.context.getOpt('displayTpl'... | render: (list) ->
if not ($.isArray(list) and list.length > 0)
this.hide()
return
@$el.find('ul').empty()
$ul = @$el.find('ul')
tpl = @context.getOpt('displayTpl')
for item in list
item = $.extend {}, item, {'atwho-at': @context.at}
li = @context.callbacks("tplEval").call(@... | JavaScript | CoffeeScript | ichord/At.js | src/view.coffee | MIT | 6567af98a74758a56e0aca2915a6e931f795d697 | 5,250 | https://github.com/ichord/At.js/blob/6567af98a74758a56e0aca2915a6e931f795d697/src/view.coffee | 103 | 120 |
ichord/At.js:src/view.coffee:3:completion | completion | render: (list) ->
if not ($.isArray(list) and list.length > 0)
this.hide()
return
@$el.find('ul').empty()
$ul = @$el.find('ul')
tpl = @context.getOpt('displayTpl') | for item in list
item = $.extend {}, item, {'atwho-at': @context.at}
li = @context.callbacks("tplEval").call(@context, tpl, item, "onDisplay")
$li = $ @context.callbacks("highlighter").call(@context, li, @context.query.text)
$li.data("item-data", item)
$ul.append $li
this.show()
$... | CoffeeScript | CoffeeScript | ichord/At.js | src/view.coffee | MIT | 6567af98a74758a56e0aca2915a6e931f795d697 | 5,250 | https://github.com/ichord/At.js/blob/6567af98a74758a56e0aca2915a6e931f795d697/src/view.coffee | 103 | 120 |
ichord/At.js:src/view.coffee:1:raw_corpus | raw_corpus | class View
# @param controller [Object] The Controller.
constructor: (@context) ->
@$el = $("<div class='atwho-view'><ul class='atwho-view-ul'></ul></div>")
@timeoutID = null
# create HTML DOM of list view if it does not exist
@context.$el.append(@$el)
this.bindEvent()
init: ->
id = @con... | CoffeeScript | ichord/At.js | src/view.coffee | MIT | 752ad4adc64c7ab6148caa4b2742de73399f30e8 | 5,250 | https://github.com/ichord/At.js/blob/752ad4adc64c7ab6148caa4b2742de73399f30e8/src/view.coffee | 3 | 52 | ||
ichord/At.js:src/view.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class View
# @param controller [Object] The Controller.
constructor: (@context) ->
@$el = $("<div class='atwho-view'><ul class='atwho-view-ul'></ul></div>")
@timeoutID = null
# create HTML DOM of list view if it does not exist
@context.$el.ap... | var View;
View = class View {
// @param controller [Object] The Controller.
constructor(context) {
this.context = context;
this.$el = $("<div class='atwho-view'><ul class='atwho-view-ul'></ul></div>");
this.timeoutID = null;
// create HTML DOM of list view if it does not exist
this.context.$el.... | CoffeeScript | JavaScript | ichord/At.js | src/view.coffee | MIT | 752ad4adc64c7ab6148caa4b2742de73399f30e8 | 5,250 | https://github.com/ichord/At.js/blob/752ad4adc64c7ab6148caa4b2742de73399f30e8/src/view.coffee | 3 | 52 |
ichord/At.js:src/view.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var View;
View = class View {
// @param controller [Object] The Controller.
constructor(context) {
this.context = context;
this.$el = $("<div class='atwho-view'><ul class='atwho-view-ul'></ul></div>");
this.timeoutID = null;
// create HTML DOM ... | class View
# @param controller [Object] The Controller.
constructor: (@context) ->
@$el = $("<div class='atwho-view'><ul class='atwho-view-ul'></ul></div>")
@timeoutID = null
# create HTML DOM of list view if it does not exist
@context.$el.append(@$el)
this.bindEvent()
init: ->
id = @con... | JavaScript | CoffeeScript | ichord/At.js | src/view.coffee | MIT | 752ad4adc64c7ab6148caa4b2742de73399f30e8 | 5,250 | https://github.com/ichord/At.js/blob/752ad4adc64c7ab6148caa4b2742de73399f30e8/src/view.coffee | 3 | 52 |
ichord/At.js:src/view.coffee:1:completion | completion | class View
# @param controller [Object] The Controller.
constructor: (@context) ->
@$el = $("<div class='atwho-view'><ul class='atwho-view-ul'></ul></div>")
@timeoutID = null
# create HTML DOM of list view if it does not exist
@context.$el.append(@$el)
this.bindEvent()
init: ->
id = @con... | this.choose(e)
e.preventDefault()
# Check if view is visible
#
# @return [Boolean]
visible: ->
@$el.is(":visible")
choose: (e) ->
if ($li = @$el.find ".cur").length
content = @context.insertContentFor $li
@context.insert @context.callbacks("beforeInsert").call(@context, content, $l... | CoffeeScript | CoffeeScript | ichord/At.js | src/view.coffee | MIT | 752ad4adc64c7ab6148caa4b2742de73399f30e8 | 5,250 | https://github.com/ichord/At.js/blob/752ad4adc64c7ab6148caa4b2742de73399f30e8/src/view.coffee | 3 | 52 |
ichord/At.js:src/view.coffee:2:raw_corpus | raw_corpus | @$el.offset offset
@context.trigger "reposition", [offset]
next: ->
cur = @$el.find('.cur').removeClass('cur')
next = cur.next()
next = @$el.find('li:first') if not next.length
next.addClass 'cur'
@scrollTop Math.max(0, cur.innerHeight() * (next.index() + 2) - @$el.height())
prev: ->
... | CoffeeScript | ichord/At.js | src/view.coffee | MIT | 752ad4adc64c7ab6148caa4b2742de73399f30e8 | 5,250 | https://github.com/ichord/At.js/blob/752ad4adc64c7ab6148caa4b2742de73399f30e8/src/view.coffee | 53 | 102 | ||
ichord/At.js:src/view.coffee:2:completion | completion | @$el.offset offset
@context.trigger "reposition", [offset]
next: ->
cur = @$el.find('.cur').removeClass('cur')
next = cur.next()
next = @$el.find('li:first') if not next.length
next.addClass 'cur'
@scrollTop Math.max(0, cur.innerHeight() * (next.index() + 2) - @$el.height())
prev: ->
... | show: ->
if @stopShowing
@stopShowing = false
return
if not this.visible()
@$el.show()
@$el.scrollTop 0
@context.trigger 'shown'
this.reposition(rect) if rect = @context.rect()
hide: (e, time) ->
return if not this.visible()
if isNaN(time)
@$el.hide()
@co... | CoffeeScript | CoffeeScript | ichord/At.js | src/view.coffee | MIT | 752ad4adc64c7ab6148caa4b2742de73399f30e8 | 5,250 | https://github.com/ichord/At.js/blob/752ad4adc64c7ab6148caa4b2742de73399f30e8/src/view.coffee | 53 | 102 |
ichord/At.js:src/view.coffee:3:raw_corpus | raw_corpus | return
@$el.find('ul').empty()
$ul = @$el.find('ul')
tpl = @context.getOpt('displayTpl')
for item in list
item = $.extend {}, item, {'atwho-at': @context.at}
li = @context.callbacks("tplEval").call(@context, tpl, item, "onDisplay")
$li = $ @context.callbacks("highlighter").call(@cont... | CoffeeScript | ichord/At.js | src/view.coffee | MIT | 752ad4adc64c7ab6148caa4b2742de73399f30e8 | 5,250 | https://github.com/ichord/At.js/blob/752ad4adc64c7ab6148caa4b2742de73399f30e8/src/view.coffee | 103 | 117 | ||
ichord/At.js:src/view.coffee:3:completion | completion | return
@$el.find('ul').empty()
$ul = @$el.find('ul')
tpl = @context.getOpt('displayTpl')
for item in list | item = $.extend {}, item, {'atwho-at': @context.at}
li = @context.callbacks("tplEval").call(@context, tpl, item, "onDisplay")
$li = $ @context.callbacks("highlighter").call(@context, li, @context.query.text)
$li.data("item-data", item)
$ul.append $li
this.show()
$ul.find("li:first").add... | CoffeeScript | CoffeeScript | ichord/At.js | src/view.coffee | MIT | 752ad4adc64c7ab6148caa4b2742de73399f30e8 | 5,250 | https://github.com/ichord/At.js/blob/752ad4adc64c7ab6148caa4b2742de73399f30e8/src/view.coffee | 103 | 117 |
ichord/At.js:src/view.coffee:2:raw_corpus | raw_corpus | @$el.offset offset
@context.trigger "reposition", [offset]
next: ->
cur = @$el.find('.cur').removeClass('cur')
next = cur.next()
next = @$el.find('li:first') if not next.length
next.addClass 'cur'
@$el.animate {
scrollTop: Math.max 0, cur.innerHeight() * (next.index() + 2) - @$el.height... | CoffeeScript | ichord/At.js | src/view.coffee | MIT | 9bcb06e82c2e1302a223300646b77b304b3421aa | 5,250 | https://github.com/ichord/At.js/blob/9bcb06e82c2e1302a223300646b77b304b3421aa/src/view.coffee | 53 | 102 | ||
ichord/At.js:src/view.coffee:2:completion | completion | @$el.offset offset
@context.trigger "reposition", [offset]
next: ->
cur = @$el.find('.cur').removeClass('cur')
next = cur.next()
next = @$el.find('li:first') if not next.length
next.addClass 'cur'
@$el.animate {
scrollTop: Math.max 0, cur.innerHeight() * (next.index() + 2) - @$el.height... | if not this.visible()
@$el.show()
@$el.scrollTop 0
@context.trigger 'shown'
this.reposition(rect) if rect = @context.rect()
hide: (e, time) ->
return if not this.visible()
if isNaN(time)
@$el.hide()
@context.trigger 'hidden', [e]
else
callback = => this.hide()
... | CoffeeScript | CoffeeScript | ichord/At.js | src/view.coffee | MIT | 9bcb06e82c2e1302a223300646b77b304b3421aa | 5,250 | https://github.com/ichord/At.js/blob/9bcb06e82c2e1302a223300646b77b304b3421aa/src/view.coffee | 53 | 102 |
ichord/At.js:src/view.coffee:3:raw_corpus | raw_corpus | for item in list
item = $.extend {}, item, {'atwho-at': @context.at}
li = @context.callbacks("tplEval").call(@context, tpl, item, "onDisplay")
$li = $ @context.callbacks("highlighter").call(@context, li, @context.query.text)
$li.data("item-data", item)
$ul.append $li
this.show()
$... | CoffeeScript | ichord/At.js | src/view.coffee | MIT | 9bcb06e82c2e1302a223300646b77b304b3421aa | 5,250 | https://github.com/ichord/At.js/blob/9bcb06e82c2e1302a223300646b77b304b3421aa/src/view.coffee | 103 | 112 | ||
ichord/At.js:src/view.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
for item in list
item = $.extend {}, item, {'atwho-at': @context.at}
li = @context.callbacks("tplEval").call(@context, tpl, item, "onDisplay")
$li = $ @context.callbacks("highlighter").call(@context, li, @context.query.text)
$li.data("item... | var $li, i, item, len, li;
for (i = 0, len = list.length; i < len; i++) {
item = list[i];
item = $.extend({}, item, {
'atwho-at': this.context.at
});
li = this.context.callbacks("tplEval").call(this.context, tpl, item, "onDisplay");
$li = $(this.context.callbacks("highlighter").call(this.context, li, thi... | CoffeeScript | JavaScript | ichord/At.js | src/view.coffee | MIT | 9bcb06e82c2e1302a223300646b77b304b3421aa | 5,250 | https://github.com/ichord/At.js/blob/9bcb06e82c2e1302a223300646b77b304b3421aa/src/view.coffee | 103 | 112 |
ichord/At.js:src/view.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var $li, i, item, len, li;
for (i = 0, len = list.length; i < len; i++) {
item = list[i];
item = $.extend({}, item, {
'atwho-at': this.context.at
});
li = this.context.callbacks("tplEval").call(this.context, tpl, item, "onDisplay");
$li = $(this.cont... | for item in list
item = $.extend {}, item, {'atwho-at': @context.at}
li = @context.callbacks("tplEval").call(@context, tpl, item, "onDisplay")
$li = $ @context.callbacks("highlighter").call(@context, li, @context.query.text)
$li.data("item-data", item)
$ul.append $li
this.show()
$... | JavaScript | CoffeeScript | ichord/At.js | src/view.coffee | MIT | 9bcb06e82c2e1302a223300646b77b304b3421aa | 5,250 | https://github.com/ichord/At.js/blob/9bcb06e82c2e1302a223300646b77b304b3421aa/src/view.coffee | 103 | 112 |
ichord/At.js:src/view.coffee:3:completion | completion | for item in list
item = $.extend {}, item, {'atwho-at': @context.at}
li = @context.callbacks("tplEval").call(@context, tpl, item, "onDisplay")
$li = $ @context.callbacks("highlighter").call(@context, li, @context.query.text) | $li.data("item-data", item)
$ul.append $li
this.show()
$ul.find("li:first").addClass "cur" if @context.getOpt('highlightFirst') | CoffeeScript | CoffeeScript | ichord/At.js | src/view.coffee | MIT | 9bcb06e82c2e1302a223300646b77b304b3421aa | 5,250 | https://github.com/ichord/At.js/blob/9bcb06e82c2e1302a223300646b77b304b3421aa/src/view.coffee | 103 | 112 |
ichord/At.js:src/view.coffee:3:raw_corpus | raw_corpus | for item in list
item = $.extend {}, item, {'atwho-at': @context.at}
li = @context.callbacks("tplEval").call(@context, tpl, item)
$li = $ @context.callbacks("highlighter").call(@context, li, @context.query.text)
$li.data("item-data", item)
$ul.append $li
this.show()
$ul.find("li:f... | CoffeeScript | ichord/At.js | src/view.coffee | MIT | eaf8d9e4db5dba89f1a3a3de8f75da47ac2cf007 | 5,250 | https://github.com/ichord/At.js/blob/eaf8d9e4db5dba89f1a3a3de8f75da47ac2cf007/src/view.coffee | 103 | 112 | ||
ichord/At.js:src/view.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
for item in list
item = $.extend {}, item, {'atwho-at': @context.at}
li = @context.callbacks("tplEval").call(@context, tpl, item)
$li = $ @context.callbacks("highlighter").call(@context, li, @context.query.text)
$li.data("item-data", item)... | var $li, i, item, len, li;
for (i = 0, len = list.length; i < len; i++) {
item = list[i];
item = $.extend({}, item, {
'atwho-at': this.context.at
});
li = this.context.callbacks("tplEval").call(this.context, tpl, item);
$li = $(this.context.callbacks("highlighter").call(this.context, li, this.context.que... | CoffeeScript | JavaScript | ichord/At.js | src/view.coffee | MIT | eaf8d9e4db5dba89f1a3a3de8f75da47ac2cf007 | 5,250 | https://github.com/ichord/At.js/blob/eaf8d9e4db5dba89f1a3a3de8f75da47ac2cf007/src/view.coffee | 103 | 112 |
ichord/At.js:src/view.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var $li, i, item, len, li;
for (i = 0, len = list.length; i < len; i++) {
item = list[i];
item = $.extend({}, item, {
'atwho-at': this.context.at
});
li = this.context.callbacks("tplEval").call(this.context, tpl, item);
$li = $(this.context.callbacks... | for item in list
item = $.extend {}, item, {'atwho-at': @context.at}
li = @context.callbacks("tplEval").call(@context, tpl, item)
$li = $ @context.callbacks("highlighter").call(@context, li, @context.query.text)
$li.data("item-data", item)
$ul.append $li
this.show()
$ul.find("li:f... | JavaScript | CoffeeScript | ichord/At.js | src/view.coffee | MIT | eaf8d9e4db5dba89f1a3a3de8f75da47ac2cf007 | 5,250 | https://github.com/ichord/At.js/blob/eaf8d9e4db5dba89f1a3a3de8f75da47ac2cf007/src/view.coffee | 103 | 112 |
ichord/At.js:src/view.coffee:3:completion | completion | for item in list
item = $.extend {}, item, {'atwho-at': @context.at}
li = @context.callbacks("tplEval").call(@context, tpl, item)
$li = $ @context.callbacks("highlighter").call(@context, li, @context.query.text) | $li.data("item-data", item)
$ul.append $li
this.show()
$ul.find("li:first").addClass "cur" if @context.getOpt('highlightFirst') | CoffeeScript | CoffeeScript | ichord/At.js | src/view.coffee | MIT | eaf8d9e4db5dba89f1a3a3de8f75da47ac2cf007 | 5,250 | https://github.com/ichord/At.js/blob/eaf8d9e4db5dba89f1a3a3de8f75da47ac2cf007/src/view.coffee | 103 | 112 |
ichord/At.js:src/view.coffee:1:raw_corpus | raw_corpus | class View
# @param controller [Object] The Controller.
constructor: (@context) ->
@$el = $("<div class='atwho-view'><ul class='atwho-view-ul'></ul></div>")
@timeoutID = null
# create HTML DOM of list view if it does not exist
@context.$el.append(@$el)
this.bindEvent()
init: ->
id = @con... | CoffeeScript | ichord/At.js | src/view.coffee | MIT | 88fd9bcbd68bb681f152584999e3b83968e4779d | 5,250 | https://github.com/ichord/At.js/blob/88fd9bcbd68bb681f152584999e3b83968e4779d/src/view.coffee | 3 | 52 | ||
ichord/At.js:src/view.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class View
# @param controller [Object] The Controller.
constructor: (@context) ->
@$el = $("<div class='atwho-view'><ul class='atwho-view-ul'></ul></div>")
@timeoutID = null
# create HTML DOM of list view if it does not exist
@context.$el.ap... | var View;
View = class View {
// @param controller [Object] The Controller.
constructor(context) {
this.context = context;
this.$el = $("<div class='atwho-view'><ul class='atwho-view-ul'></ul></div>");
this.timeoutID = null;
// create HTML DOM of list view if it does not exist
this.context.$el.... | CoffeeScript | JavaScript | ichord/At.js | src/view.coffee | MIT | 88fd9bcbd68bb681f152584999e3b83968e4779d | 5,250 | https://github.com/ichord/At.js/blob/88fd9bcbd68bb681f152584999e3b83968e4779d/src/view.coffee | 3 | 52 |
ichord/At.js:src/view.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var View;
View = class View {
// @param controller [Object] The Controller.
constructor(context) {
this.context = context;
this.$el = $("<div class='atwho-view'><ul class='atwho-view-ul'></ul></div>");
this.timeoutID = null;
// create HTML DOM ... | class View
# @param controller [Object] The Controller.
constructor: (@context) ->
@$el = $("<div class='atwho-view'><ul class='atwho-view-ul'></ul></div>")
@timeoutID = null
# create HTML DOM of list view if it does not exist
@context.$el.append(@$el)
this.bindEvent()
init: ->
id = @con... | JavaScript | CoffeeScript | ichord/At.js | src/view.coffee | MIT | 88fd9bcbd68bb681f152584999e3b83968e4779d | 5,250 | https://github.com/ichord/At.js/blob/88fd9bcbd68bb681f152584999e3b83968e4779d/src/view.coffee | 3 | 52 |
ichord/At.js:src/view.coffee:1:completion | completion | class View
# @param controller [Object] The Controller.
constructor: (@context) ->
@$el = $("<div class='atwho-view'><ul class='atwho-view-ul'></ul></div>")
@timeoutID = null
# create HTML DOM of list view if it does not exist
@context.$el.append(@$el)
this.bindEvent()
init: ->
id = @con... | this.choose(e)
e.preventDefault()
# Check if view is visible
#
# @return [Boolean]
visible: ->
@$el.is(":visible")
choose: (e) ->
if ($li = @$el.find ".cur").length
content = @context.insertContentFor $li
@context.insert @context.callbacks("beforeInsert").call(@context, content, $l... | CoffeeScript | CoffeeScript | ichord/At.js | src/view.coffee | MIT | 88fd9bcbd68bb681f152584999e3b83968e4779d | 5,250 | https://github.com/ichord/At.js/blob/88fd9bcbd68bb681f152584999e3b83968e4779d/src/view.coffee | 3 | 52 |
ichord/At.js:src/view.coffee:2:raw_corpus | raw_corpus | @$el.offset offset
@context.trigger "reposition", [offset]
next: ->
cur = @$el.find('.cur').removeClass('cur')
next = cur.next()
next = @$el.find('li:first') if not next.length
next.addClass 'cur'
@$el.animate {
scrollTop: Math.max 0, cur.innerHeight() * (next.index() + 2) - @$el.height... | CoffeeScript | ichord/At.js | src/view.coffee | MIT | ac213212f2d0d421896f8e490ec99698ed1d99f0 | 5,250 | https://github.com/ichord/At.js/blob/ac213212f2d0d421896f8e490ec99698ed1d99f0/src/view.coffee | 53 | 102 | ||
ichord/At.js:src/view.coffee:2:completion | completion | @$el.offset offset
@context.trigger "reposition", [offset]
next: ->
cur = @$el.find('.cur').removeClass('cur')
next = cur.next()
next = @$el.find('li:first') if not next.length
next.addClass 'cur'
@$el.animate {
scrollTop: Math.max 0, cur.innerHeight() * (next.index() + 2) - @$el.height... | if not this.visible()
@$el.show()
@$el.scrollTop 0
@context.trigger 'shown'
this.reposition(rect) if rect = @context.rect()
hide: (e, time) ->
return if not this.visible()
if isNaN(time)
@$el.hide()
@context.trigger 'hidden', [e]
else
callback = => this.hide()
... | CoffeeScript | CoffeeScript | ichord/At.js | src/view.coffee | MIT | ac213212f2d0d421896f8e490ec99698ed1d99f0 | 5,250 | https://github.com/ichord/At.js/blob/ac213212f2d0d421896f8e490ec99698ed1d99f0/src/view.coffee | 53 | 102 |
ichord/At.js:src/view.coffee:1:raw_corpus | raw_corpus | class View
# @param controller [Object] The Controller.
constructor: (@context) ->
@$el = $("<div class='atwho-view'><ul class='atwho-view-ul'></ul></div>")
@timeoutID = null
# create HTML DOM of list view if it does not exist
@context.$el.append(@$el)
this.bindEvent()
init: ->
id = @con... | CoffeeScript | ichord/At.js | src/view.coffee | MIT | dea7f905a54abd351d68c768fd3d6bd4fc281e9c | 5,250 | https://github.com/ichord/At.js/blob/dea7f905a54abd351d68c768fd3d6bd4fc281e9c/src/view.coffee | 3 | 52 | ||
ichord/At.js:src/view.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class View
# @param controller [Object] The Controller.
constructor: (@context) ->
@$el = $("<div class='atwho-view'><ul class='atwho-view-ul'></ul></div>")
@timeoutID = null
# create HTML DOM of list view if it does not exist
@context.$el.ap... | var View;
View = class View {
// @param controller [Object] The Controller.
constructor(context) {
this.context = context;
this.$el = $("<div class='atwho-view'><ul class='atwho-view-ul'></ul></div>");
this.timeoutID = null;
// create HTML DOM of list view if it does not exist
this.context.$el.... | CoffeeScript | JavaScript | ichord/At.js | src/view.coffee | MIT | dea7f905a54abd351d68c768fd3d6bd4fc281e9c | 5,250 | https://github.com/ichord/At.js/blob/dea7f905a54abd351d68c768fd3d6bd4fc281e9c/src/view.coffee | 3 | 52 |
ichord/At.js:src/view.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var View;
View = class View {
// @param controller [Object] The Controller.
constructor(context) {
this.context = context;
this.$el = $("<div class='atwho-view'><ul class='atwho-view-ul'></ul></div>");
this.timeoutID = null;
// create HTML DOM ... | class View
# @param controller [Object] The Controller.
constructor: (@context) ->
@$el = $("<div class='atwho-view'><ul class='atwho-view-ul'></ul></div>")
@timeoutID = null
# create HTML DOM of list view if it does not exist
@context.$el.append(@$el)
this.bindEvent()
init: ->
id = @con... | JavaScript | CoffeeScript | ichord/At.js | src/view.coffee | MIT | dea7f905a54abd351d68c768fd3d6bd4fc281e9c | 5,250 | https://github.com/ichord/At.js/blob/dea7f905a54abd351d68c768fd3d6bd4fc281e9c/src/view.coffee | 3 | 52 |
ichord/At.js:src/view.coffee:1:completion | completion | class View
# @param controller [Object] The Controller.
constructor: (@context) ->
@$el = $("<div class='atwho-view'><ul class='atwho-view-ul'></ul></div>")
@timeoutID = null
# create HTML DOM of list view if it does not exist
@context.$el.append(@$el)
this.bindEvent()
init: ->
id = @con... | this.choose(e)
e.preventDefault()
# Check if view is visible
#
# @return [Boolean]
visible: ->
@$el.is(":visible")
choose: (e) ->
if ($li = @$el.find ".cur").length
content = @context.insertContentFor $li
@context.insert @context.callbacks("before_insert").call(@context, content, $... | CoffeeScript | CoffeeScript | ichord/At.js | src/view.coffee | MIT | dea7f905a54abd351d68c768fd3d6bd4fc281e9c | 5,250 | https://github.com/ichord/At.js/blob/dea7f905a54abd351d68c768fd3d6bd4fc281e9c/src/view.coffee | 3 | 52 |
ichord/At.js:src/view.coffee:3:raw_corpus | raw_corpus | for item in list
item = $.extend {}, item, {'atwho-at': @context.at}
li = @context.callbacks("tpl_eval").call(@context, tpl, item)
$li = $ @context.callbacks("highlighter").call(@context, li, @context.query.text)
$li.data("item-data", item)
$ul.append $li
this.show()
$ul.find("li:... | CoffeeScript | ichord/At.js | src/view.coffee | MIT | dea7f905a54abd351d68c768fd3d6bd4fc281e9c | 5,250 | https://github.com/ichord/At.js/blob/dea7f905a54abd351d68c768fd3d6bd4fc281e9c/src/view.coffee | 103 | 112 | ||
ichord/At.js:src/view.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
for item in list
item = $.extend {}, item, {'atwho-at': @context.at}
li = @context.callbacks("tpl_eval").call(@context, tpl, item)
$li = $ @context.callbacks("highlighter").call(@context, li, @context.query.text)
$li.data("item-data", item... | var $li, i, item, len, li;
for (i = 0, len = list.length; i < len; i++) {
item = list[i];
item = $.extend({}, item, {
'atwho-at': this.context.at
});
li = this.context.callbacks("tpl_eval").call(this.context, tpl, item);
$li = $(this.context.callbacks("highlighter").call(this.context, li, this.context.qu... | CoffeeScript | JavaScript | ichord/At.js | src/view.coffee | MIT | dea7f905a54abd351d68c768fd3d6bd4fc281e9c | 5,250 | https://github.com/ichord/At.js/blob/dea7f905a54abd351d68c768fd3d6bd4fc281e9c/src/view.coffee | 103 | 112 |
ichord/At.js:src/view.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var $li, i, item, len, li;
for (i = 0, len = list.length; i < len; i++) {
item = list[i];
item = $.extend({}, item, {
'atwho-at': this.context.at
});
li = this.context.callbacks("tpl_eval").call(this.context, tpl, item);
$li = $(this.context.callback... | for item in list
item = $.extend {}, item, {'atwho-at': @context.at}
li = @context.callbacks("tpl_eval").call(@context, tpl, item)
$li = $ @context.callbacks("highlighter").call(@context, li, @context.query.text)
$li.data("item-data", item)
$ul.append $li
this.show()
$ul.find("li:... | JavaScript | CoffeeScript | ichord/At.js | src/view.coffee | MIT | dea7f905a54abd351d68c768fd3d6bd4fc281e9c | 5,250 | https://github.com/ichord/At.js/blob/dea7f905a54abd351d68c768fd3d6bd4fc281e9c/src/view.coffee | 103 | 112 |
ichord/At.js:src/view.coffee:3:completion | completion | for item in list
item = $.extend {}, item, {'atwho-at': @context.at}
li = @context.callbacks("tpl_eval").call(@context, tpl, item)
$li = $ @context.callbacks("highlighter").call(@context, li, @context.query.text) | $li.data("item-data", item)
$ul.append $li
this.show()
$ul.find("li:first").addClass "cur" if @context.getOpt('highlight_first') | CoffeeScript | CoffeeScript | ichord/At.js | src/view.coffee | MIT | dea7f905a54abd351d68c768fd3d6bd4fc281e9c | 5,250 | https://github.com/ichord/At.js/blob/dea7f905a54abd351d68c768fd3d6bd4fc281e9c/src/view.coffee | 103 | 112 |
ichord/At.js:src/view.coffee:1:raw_corpus | raw_corpus | class View
# @param controller [Object] The Controller.
constructor: (@context) ->
@$el = $("<div class='atwho-view'><ul class='atwho-view-ul'></ul></div>")
@timeout_id = null
# create HTML DOM of list view if it does not exist
@context.$el.append(@$el)
this.bind_event()
init: ->
id = @c... | CoffeeScript | ichord/At.js | src/view.coffee | MIT | b05d51a77ef9a02aa2dbcd72543ead335a5cb5a0 | 5,250 | https://github.com/ichord/At.js/blob/b05d51a77ef9a02aa2dbcd72543ead335a5cb5a0/src/view.coffee | 3 | 52 | ||
ichord/At.js:src/view.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class View
# @param controller [Object] The Controller.
constructor: (@context) ->
@$el = $("<div class='atwho-view'><ul class='atwho-view-ul'></ul></div>")
@timeout_id = null
# create HTML DOM of list view if it does not exist
@context.$el.a... | var View;
View = class View {
// @param controller [Object] The Controller.
constructor(context) {
this.context = context;
this.$el = $("<div class='atwho-view'><ul class='atwho-view-ul'></ul></div>");
this.timeout_id = null;
// create HTML DOM of list view if it does not exist
this.context.$el... | CoffeeScript | JavaScript | ichord/At.js | src/view.coffee | MIT | b05d51a77ef9a02aa2dbcd72543ead335a5cb5a0 | 5,250 | https://github.com/ichord/At.js/blob/b05d51a77ef9a02aa2dbcd72543ead335a5cb5a0/src/view.coffee | 3 | 52 |
ichord/At.js:src/view.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var View;
View = class View {
// @param controller [Object] The Controller.
constructor(context) {
this.context = context;
this.$el = $("<div class='atwho-view'><ul class='atwho-view-ul'></ul></div>");
this.timeout_id = null;
// create HTML DOM... | class View
# @param controller [Object] The Controller.
constructor: (@context) ->
@$el = $("<div class='atwho-view'><ul class='atwho-view-ul'></ul></div>")
@timeout_id = null
# create HTML DOM of list view if it does not exist
@context.$el.append(@$el)
this.bind_event()
init: ->
id = @c... | JavaScript | CoffeeScript | ichord/At.js | src/view.coffee | MIT | b05d51a77ef9a02aa2dbcd72543ead335a5cb5a0 | 5,250 | https://github.com/ichord/At.js/blob/b05d51a77ef9a02aa2dbcd72543ead335a5cb5a0/src/view.coffee | 3 | 52 |
ichord/At.js:src/view.coffee:1:completion | completion | class View
# @param controller [Object] The Controller.
constructor: (@context) ->
@$el = $("<div class='atwho-view'><ul class='atwho-view-ul'></ul></div>")
@timeout_id = null
# create HTML DOM of list view if it does not exist
@context.$el.append(@$el)
this.bind_event()
init: ->
id = @c... | this.choose(e)
e.preventDefault()
# Check if view is visible
#
# @return [Boolean]
visible: ->
@$el.is(":visible")
choose: (e) ->
if ($li = @$el.find ".cur").length
content = @context.insert_content_for $li
@context.insert @context.callbacks("before_insert").call(@context, content,... | CoffeeScript | CoffeeScript | ichord/At.js | src/view.coffee | MIT | b05d51a77ef9a02aa2dbcd72543ead335a5cb5a0 | 5,250 | https://github.com/ichord/At.js/blob/b05d51a77ef9a02aa2dbcd72543ead335a5cb5a0/src/view.coffee | 3 | 52 |
ichord/At.js:src/view.coffee:2:raw_corpus | raw_corpus | @$el.offset offset
@context.trigger "reposition", [offset]
next: ->
cur = @$el.find('.cur').removeClass('cur')
next = cur.next()
next = @$el.find('li:first') if not next.length
next.addClass 'cur'
@$el.animate {
scrollTop: Math.max 0, cur.innerHeight() * (next.index() + 2) - @$el.height... | CoffeeScript | ichord/At.js | src/view.coffee | MIT | b05d51a77ef9a02aa2dbcd72543ead335a5cb5a0 | 5,250 | https://github.com/ichord/At.js/blob/b05d51a77ef9a02aa2dbcd72543ead335a5cb5a0/src/view.coffee | 53 | 102 | ||
ichord/At.js:src/view.coffee:2:completion | completion | @$el.offset offset
@context.trigger "reposition", [offset]
next: ->
cur = @$el.find('.cur').removeClass('cur')
next = cur.next()
next = @$el.find('li:first') if not next.length
next.addClass 'cur'
@$el.animate {
scrollTop: Math.max 0, cur.innerHeight() * (next.index() + 2) - @$el.height... | if not this.visible()
@$el.show()
@$el.scrollTop 0
@context.trigger 'shown'
this.reposition(rect) if rect = @context.rect()
hide: (e, time) ->
return if not this.visible()
if isNaN(time)
@$el.hide()
@context.trigger 'hidden', [e]
else
callback = => this.hide()
... | CoffeeScript | CoffeeScript | ichord/At.js | src/view.coffee | MIT | b05d51a77ef9a02aa2dbcd72543ead335a5cb5a0 | 5,250 | https://github.com/ichord/At.js/blob/b05d51a77ef9a02aa2dbcd72543ead335a5cb5a0/src/view.coffee | 53 | 102 |
ichord/At.js:src/view.coffee:3:raw_corpus | raw_corpus | for item in list
item = $.extend {}, item, {'atwho-at': @context.at}
li = @context.callbacks("tpl_eval").call(@context, tpl, item)
$li = $ @context.callbacks("highlighter").call(@context, li, @context.query.text)
$li.data("item-data", item)
$ul.append $li
this.show()
$ul.find("li:... | CoffeeScript | ichord/At.js | src/view.coffee | MIT | b05d51a77ef9a02aa2dbcd72543ead335a5cb5a0 | 5,250 | https://github.com/ichord/At.js/blob/b05d51a77ef9a02aa2dbcd72543ead335a5cb5a0/src/view.coffee | 103 | 112 | ||
ichord/At.js:src/view.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
for item in list
item = $.extend {}, item, {'atwho-at': @context.at}
li = @context.callbacks("tpl_eval").call(@context, tpl, item)
$li = $ @context.callbacks("highlighter").call(@context, li, @context.query.text)
$li.data("item-data", item... | var $li, i, item, len, li;
for (i = 0, len = list.length; i < len; i++) {
item = list[i];
item = $.extend({}, item, {
'atwho-at': this.context.at
});
li = this.context.callbacks("tpl_eval").call(this.context, tpl, item);
$li = $(this.context.callbacks("highlighter").call(this.context, li, this.context.qu... | CoffeeScript | JavaScript | ichord/At.js | src/view.coffee | MIT | b05d51a77ef9a02aa2dbcd72543ead335a5cb5a0 | 5,250 | https://github.com/ichord/At.js/blob/b05d51a77ef9a02aa2dbcd72543ead335a5cb5a0/src/view.coffee | 103 | 112 |
ichord/At.js:src/view.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var $li, i, item, len, li;
for (i = 0, len = list.length; i < len; i++) {
item = list[i];
item = $.extend({}, item, {
'atwho-at': this.context.at
});
li = this.context.callbacks("tpl_eval").call(this.context, tpl, item);
$li = $(this.context.callback... | for item in list
item = $.extend {}, item, {'atwho-at': @context.at}
li = @context.callbacks("tpl_eval").call(@context, tpl, item)
$li = $ @context.callbacks("highlighter").call(@context, li, @context.query.text)
$li.data("item-data", item)
$ul.append $li
this.show()
$ul.find("li:... | JavaScript | CoffeeScript | ichord/At.js | src/view.coffee | MIT | b05d51a77ef9a02aa2dbcd72543ead335a5cb5a0 | 5,250 | https://github.com/ichord/At.js/blob/b05d51a77ef9a02aa2dbcd72543ead335a5cb5a0/src/view.coffee | 103 | 112 |
ichord/At.js:src/view.coffee:3:completion | completion | for item in list
item = $.extend {}, item, {'atwho-at': @context.at}
li = @context.callbacks("tpl_eval").call(@context, tpl, item)
$li = $ @context.callbacks("highlighter").call(@context, li, @context.query.text) | $li.data("item-data", item)
$ul.append $li
this.show()
$ul.find("li:first").addClass "cur" if @context.get_opt('highlight_first') | CoffeeScript | CoffeeScript | ichord/At.js | src/view.coffee | MIT | b05d51a77ef9a02aa2dbcd72543ead335a5cb5a0 | 5,250 | https://github.com/ichord/At.js/blob/b05d51a77ef9a02aa2dbcd72543ead335a5cb5a0/src/view.coffee | 103 | 112 |
ichord/At.js:src/view.coffee:2:raw_corpus | raw_corpus | @$el.offset offset
@context.trigger "reposition", [offset]
next: ->
cur = @$el.find('.cur').removeClass('cur')
next = cur.next()
next = @$el.find('li:first') if not next.length
next.addClass 'cur'
@$el.animate {
scrollTop: Math.max 0, cur.innerHeight() * (next.index() + 2) - @$el.height... | CoffeeScript | ichord/At.js | src/view.coffee | MIT | 5377d0ede80e160ba476083de276dd389fd00298 | 5,250 | https://github.com/ichord/At.js/blob/5377d0ede80e160ba476083de276dd389fd00298/src/view.coffee | 53 | 102 | ||
ichord/At.js:src/view.coffee:2:completion | completion | @$el.offset offset
@context.trigger "reposition", [offset]
next: ->
cur = @$el.find('.cur').removeClass('cur')
next = cur.next()
next = @$el.find('li:first') if not next.length
next.addClass 'cur'
@$el.animate {
scrollTop: Math.max 0, cur.innerHeight() * (next.index() + 2) - @$el.height... | @context.mark_range()
if not this.visible()
@$el.show()
@$el.scrollTop 0
@context.trigger 'shown'
this.reposition(rect) if rect = @context.rect()
hide: (e, time) ->
return if not this.visible()
if isNaN(time)
@context.reset_rect()
@$el.hide()
@context.trigger 'hidd... | CoffeeScript | CoffeeScript | ichord/At.js | src/view.coffee | MIT | 5377d0ede80e160ba476083de276dd389fd00298 | 5,250 | https://github.com/ichord/At.js/blob/5377d0ede80e160ba476083de276dd389fd00298/src/view.coffee | 53 | 102 |
ichord/At.js:src/view.coffee:3:raw_corpus | raw_corpus | $ul = @$el.find('ul')
tpl = @context.get_opt('tpl')
for item in list
item = $.extend {}, item, {'atwho-at': @context.at}
li = @context.callbacks("tpl_eval").call(@context, tpl, item)
$li = $ @context.callbacks("highlighter").call(@context, li, @context.query.text)
$li.data("item-data", ... | CoffeeScript | ichord/At.js | src/view.coffee | MIT | 5377d0ede80e160ba476083de276dd389fd00298 | 5,250 | https://github.com/ichord/At.js/blob/5377d0ede80e160ba476083de276dd389fd00298/src/view.coffee | 103 | 114 | ||
ichord/At.js:src/view.coffee:3:completion | completion | $ul = @$el.find('ul')
tpl = @context.get_opt('tpl')
for item in list
item = $.extend {}, item, {'atwho-at': @context.at}
li = @context.callbacks("tpl_eval").call(@context, tpl, item) | $li = $ @context.callbacks("highlighter").call(@context, li, @context.query.text)
$li.data("item-data", item)
$ul.append $li
this.show()
$ul.find("li:first").addClass "cur" if @context.get_opt('highlight_first') | CoffeeScript | CoffeeScript | ichord/At.js | src/view.coffee | MIT | 5377d0ede80e160ba476083de276dd389fd00298 | 5,250 | https://github.com/ichord/At.js/blob/5377d0ede80e160ba476083de276dd389fd00298/src/view.coffee | 103 | 114 |
ichord/At.js:src/view.coffee:1:raw_corpus | raw_corpus | class View
# @param controller [Object] The Controller.
constructor: (@context) ->
@$el = $("<div class='atwho-view'><ul class='atwho-view-ul'></ul></div>")
@timeout_id = null
# create HTML DOM of list view if it does not exist
@context.$el.append(@$el)
this.bind_event()
init: ->
id = @c... | CoffeeScript | ichord/At.js | src/view.coffee | MIT | b1efd096127fce3c370e51746897616ef53bf18b | 5,250 | https://github.com/ichord/At.js/blob/b1efd096127fce3c370e51746897616ef53bf18b/src/view.coffee | 3 | 52 | ||
ichord/At.js:src/view.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class View
# @param controller [Object] The Controller.
constructor: (@context) ->
@$el = $("<div class='atwho-view'><ul class='atwho-view-ul'></ul></div>")
@timeout_id = null
# create HTML DOM of list view if it does not exist
@context.$el.a... | var View;
View = class View {
// @param controller [Object] The Controller.
constructor(context) {
this.context = context;
this.$el = $("<div class='atwho-view'><ul class='atwho-view-ul'></ul></div>");
this.timeout_id = null;
// create HTML DOM of list view if it does not exist
this.context.$el... | CoffeeScript | JavaScript | ichord/At.js | src/view.coffee | MIT | b1efd096127fce3c370e51746897616ef53bf18b | 5,250 | https://github.com/ichord/At.js/blob/b1efd096127fce3c370e51746897616ef53bf18b/src/view.coffee | 3 | 52 |
ichord/At.js:src/view.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var View;
View = class View {
// @param controller [Object] The Controller.
constructor(context) {
this.context = context;
this.$el = $("<div class='atwho-view'><ul class='atwho-view-ul'></ul></div>");
this.timeout_id = null;
// create HTML DOM... | class View
# @param controller [Object] The Controller.
constructor: (@context) ->
@$el = $("<div class='atwho-view'><ul class='atwho-view-ul'></ul></div>")
@timeout_id = null
# create HTML DOM of list view if it does not exist
@context.$el.append(@$el)
this.bind_event()
init: ->
id = @c... | JavaScript | CoffeeScript | ichord/At.js | src/view.coffee | MIT | b1efd096127fce3c370e51746897616ef53bf18b | 5,250 | https://github.com/ichord/At.js/blob/b1efd096127fce3c370e51746897616ef53bf18b/src/view.coffee | 3 | 52 |
ichord/At.js:src/view.coffee:1:completion | completion | class View
# @param controller [Object] The Controller.
constructor: (@context) ->
@$el = $("<div class='atwho-view'><ul class='atwho-view-ul'></ul></div>")
@timeout_id = null
# create HTML DOM of list view if it does not exist
@context.$el.append(@$el)
this.bind_event()
init: ->
id = @c... | .on 'click', (e) =>
this.choose(e)
e.preventDefault()
# Check if view is visible
#
# @return [Boolean]
visible: ->
@$el.is(":visible")
choose: (e) ->
if ($li = @$el.find ".cur").length
content = @context.insert_content_for $li
@context.insert @context.callbacks("before_insert... | CoffeeScript | CoffeeScript | ichord/At.js | src/view.coffee | MIT | b1efd096127fce3c370e51746897616ef53bf18b | 5,250 | https://github.com/ichord/At.js/blob/b1efd096127fce3c370e51746897616ef53bf18b/src/view.coffee | 3 | 52 |
ichord/At.js:src/view.coffee:2:raw_corpus | raw_corpus | @context.callbacks("before_reposition")?.call(@context, offset)
@$el.offset offset
@context.trigger "reposition", [offset]
next: ->
cur = @$el.find('.cur').removeClass('cur')
next = cur.next()
next = @$el.find('li:first') if not next.length
next.addClass 'cur'
@$el.animate {
scrollT... | CoffeeScript | ichord/At.js | src/view.coffee | MIT | b1efd096127fce3c370e51746897616ef53bf18b | 5,250 | https://github.com/ichord/At.js/blob/b1efd096127fce3c370e51746897616ef53bf18b/src/view.coffee | 53 | 102 | ||
ichord/At.js:src/view.coffee:2:completion | completion | @context.callbacks("before_reposition")?.call(@context, offset)
@$el.offset offset
@context.trigger "reposition", [offset]
next: ->
cur = @$el.find('.cur').removeClass('cur')
next = cur.next()
next = @$el.find('li:first') if not next.length
next.addClass 'cur'
@$el.animate {
scrollT... | @stop_showing = false
return
@context.mark_range()
if not this.visible()
@$el.show()
@$el.scrollTop 0
@context.trigger 'shown'
this.reposition(rect) if rect = @context.rect()
hide: (e, time) ->
return if not this.visible()
if isNaN(time)
@context.reset_rect()
@... | CoffeeScript | CoffeeScript | ichord/At.js | src/view.coffee | MIT | b1efd096127fce3c370e51746897616ef53bf18b | 5,250 | https://github.com/ichord/At.js/blob/b1efd096127fce3c370e51746897616ef53bf18b/src/view.coffee | 53 | 102 |
ichord/At.js:src/view.coffee:3:raw_corpus | raw_corpus | @$el.find('ul').empty()
$ul = @$el.find('ul')
tpl = @context.get_opt('tpl')
for item in list
item = $.extend {}, item, {'atwho-at': @context.at}
li = @context.callbacks("tpl_eval").call(@context, tpl, item)
$li = $ @context.callbacks("highlighter").call(@context, li, @context.query.text)
... | CoffeeScript | ichord/At.js | src/view.coffee | MIT | b1efd096127fce3c370e51746897616ef53bf18b | 5,250 | https://github.com/ichord/At.js/blob/b1efd096127fce3c370e51746897616ef53bf18b/src/view.coffee | 103 | 115 | ||
ichord/At.js:src/view.coffee:3:completion | completion | @$el.find('ul').empty()
$ul = @$el.find('ul')
tpl = @context.get_opt('tpl')
for item in list
item = $.extend {}, item, {'atwho-at': @context.at} | li = @context.callbacks("tpl_eval").call(@context, tpl, item)
$li = $ @context.callbacks("highlighter").call(@context, li, @context.query.text)
$li.data("item-data", item)
$ul.append $li
this.show()
$ul.find("li:first").addClass "cur" if @context.get_opt('highlight_first') | CoffeeScript | CoffeeScript | ichord/At.js | src/view.coffee | MIT | b1efd096127fce3c370e51746897616ef53bf18b | 5,250 | https://github.com/ichord/At.js/blob/b1efd096127fce3c370e51746897616ef53bf18b/src/view.coffee | 103 | 115 |
ichord/At.js:src/view.coffee:1:raw_corpus | raw_corpus | class View
# @param controller [Object] The Controller.
constructor: (@context) ->
@$el = $("<div class='atwho-view'><ul class='atwho-view-ul'></ul></div>")
@timeout_id = null
# create HTML DOM of list view if it does not exist
@context.$el.append(@$el)
this.bind_event()
init: ->
id = @c... | CoffeeScript | ichord/At.js | src/view.coffee | MIT | 40801513d96cda866591c23e5f00938e1bc8d674 | 5,250 | https://github.com/ichord/At.js/blob/40801513d96cda866591c23e5f00938e1bc8d674/src/view.coffee | 3 | 52 | ||
ichord/At.js:src/view.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class View
# @param controller [Object] The Controller.
constructor: (@context) ->
@$el = $("<div class='atwho-view'><ul class='atwho-view-ul'></ul></div>")
@timeout_id = null
# create HTML DOM of list view if it does not exist
@context.$el.a... | var View;
View = class View {
// @param controller [Object] The Controller.
constructor(context) {
this.context = context;
this.$el = $("<div class='atwho-view'><ul class='atwho-view-ul'></ul></div>");
this.timeout_id = null;
// create HTML DOM of list view if it does not exist
this.context.$el... | CoffeeScript | JavaScript | ichord/At.js | src/view.coffee | MIT | 40801513d96cda866591c23e5f00938e1bc8d674 | 5,250 | https://github.com/ichord/At.js/blob/40801513d96cda866591c23e5f00938e1bc8d674/src/view.coffee | 3 | 52 |
ichord/At.js:src/view.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var View;
View = class View {
// @param controller [Object] The Controller.
constructor(context) {
this.context = context;
this.$el = $("<div class='atwho-view'><ul class='atwho-view-ul'></ul></div>");
this.timeout_id = null;
// create HTML DOM... | class View
# @param controller [Object] The Controller.
constructor: (@context) ->
@$el = $("<div class='atwho-view'><ul class='atwho-view-ul'></ul></div>")
@timeout_id = null
# create HTML DOM of list view if it does not exist
@context.$el.append(@$el)
this.bind_event()
init: ->
id = @c... | JavaScript | CoffeeScript | ichord/At.js | src/view.coffee | MIT | 40801513d96cda866591c23e5f00938e1bc8d674 | 5,250 | https://github.com/ichord/At.js/blob/40801513d96cda866591c23e5f00938e1bc8d674/src/view.coffee | 3 | 52 |
ichord/At.js:src/view.coffee:1:completion | completion | class View
# @param controller [Object] The Controller.
constructor: (@context) ->
@$el = $("<div class='atwho-view'><ul class='atwho-view-ul'></ul></div>")
@timeout_id = null
# create HTML DOM of list view if it does not exist
@context.$el.append(@$el)
this.bind_event()
init: ->
id = @c... | # Check if view is visible
#
# @return [Boolean]
visible: ->
@$el.is(":visible")
choose: (e) ->
if ($li = @$el.find ".cur").length
content = @context.insert_content_for $li
@context.insert @context.callbacks("before_insert").call(@context, content, $li), $li
@context.trigger "inserted... | CoffeeScript | CoffeeScript | ichord/At.js | src/view.coffee | MIT | 40801513d96cda866591c23e5f00938e1bc8d674 | 5,250 | https://github.com/ichord/At.js/blob/40801513d96cda866591c23e5f00938e1bc8d674/src/view.coffee | 3 | 52 |
ichord/At.js:src/view.coffee:2:raw_corpus | raw_corpus | next: ->
cur = @$el.find('.cur').removeClass('cur')
next = cur.next()
next = @$el.find('li:first') if not next.length
next.addClass 'cur'
@$el.animate {
scrollTop: Math.max 0, cur.innerHeight() * (next.index() + 2) - @$el.height()
}, 150
prev: ->
cur = @$el.find('.cur').removeClas... | CoffeeScript | ichord/At.js | src/view.coffee | MIT | 40801513d96cda866591c23e5f00938e1bc8d674 | 5,250 | https://github.com/ichord/At.js/blob/40801513d96cda866591c23e5f00938e1bc8d674/src/view.coffee | 53 | 102 | ||
ichord/At.js:src/view.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
next: ->
cur = @$el.find('.cur').removeClass('cur')
next = cur.next()
next = @$el.find('li:first') if not next.length
next.addClass 'cur'
@$el.animate {
scrollTop: Math.max 0, cur.innerHeight() * (next.index() + 2) - @$el.height()
... | ({
next: function() {
var cur, next;
cur = this.$el.find('.cur').removeClass('cur');
next = cur.next();
if (!next.length) {
next = this.$el.find('li:first');
}
next.addClass('cur');
return this.$el.animate({
scrollTop: Math.max(0, cur.innerHeight() * (next.index() + 2) - this.$... | CoffeeScript | JavaScript | ichord/At.js | src/view.coffee | MIT | 40801513d96cda866591c23e5f00938e1bc8d674 | 5,250 | https://github.com/ichord/At.js/blob/40801513d96cda866591c23e5f00938e1bc8d674/src/view.coffee | 53 | 102 |
ichord/At.js:src/view.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
next: function() {
var cur, next;
cur = this.$el.find('.cur').removeClass('cur');
next = cur.next();
if (!next.length) {
next = this.$el.find('li:first');
}
next.addClass('cur');
return this.$el.animate({
scrollTop: Math... | next: ->
cur = @$el.find('.cur').removeClass('cur')
next = cur.next()
next = @$el.find('li:first') if not next.length
next.addClass 'cur'
@$el.animate {
scrollTop: Math.max 0, cur.innerHeight() * (next.index() + 2) - @$el.height()
}, 150
prev: ->
cur = @$el.find('.cur').removeClas... | JavaScript | CoffeeScript | ichord/At.js | src/view.coffee | MIT | 40801513d96cda866591c23e5f00938e1bc8d674 | 5,250 | https://github.com/ichord/At.js/blob/40801513d96cda866591c23e5f00938e1bc8d674/src/view.coffee | 53 | 102 |
ichord/At.js:src/view.coffee:2:completion | completion | next: ->
cur = @$el.find('.cur').removeClass('cur')
next = cur.next()
next = @$el.find('li:first') if not next.length
next.addClass 'cur'
@$el.animate {
scrollTop: Math.max 0, cur.innerHeight() * (next.index() + 2) - @$el.height()
}, 150
prev: ->
cur = @$el.find('.cur').removeClas... | @$el.show()
@$el.scrollTop 0
@context.trigger 'shown'
this.reposition(rect) if rect = @context.rect()
hide: (e, time) ->
return if not this.visible()
if isNaN(time)
@context.reset_rect()
@$el.hide()
@context.trigger 'hidden', [e]
else
callback = => this.hide()
... | CoffeeScript | CoffeeScript | ichord/At.js | src/view.coffee | MIT | 40801513d96cda866591c23e5f00938e1bc8d674 | 5,250 | https://github.com/ichord/At.js/blob/40801513d96cda866591c23e5f00938e1bc8d674/src/view.coffee | 53 | 102 |
ichord/At.js:src/view.coffee:2:raw_corpus | raw_corpus | next: ->
cur = @$el.find('.cur').removeClass('cur')
next = cur.next()
next = @$el.find('li:first') if not next.length
next.addClass 'cur'
@$el.animate {
scrollTop: Math.max 0, cur.innerHeight() * (next.index() + 2) - @$el.height()
}, 150
prev: ->
cur = @$el.find('.cur').removeClas... | CoffeeScript | ichord/At.js | src/view.coffee | MIT | 01555f8921131160b1a76489dd743ce893d54f3e | 5,250 | https://github.com/ichord/At.js/blob/01555f8921131160b1a76489dd743ce893d54f3e/src/view.coffee | 53 | 102 | ||
ichord/At.js:src/view.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
next: ->
cur = @$el.find('.cur').removeClass('cur')
next = cur.next()
next = @$el.find('li:first') if not next.length
next.addClass 'cur'
@$el.animate {
scrollTop: Math.max 0, cur.innerHeight() * (next.index() + 2) - @$el.height()
... | ({
next: function() {
var cur, next;
cur = this.$el.find('.cur').removeClass('cur');
next = cur.next();
if (!next.length) {
next = this.$el.find('li:first');
}
next.addClass('cur');
return this.$el.animate({
scrollTop: Math.max(0, cur.innerHeight() * (next.index() + 2) - this.$... | CoffeeScript | JavaScript | ichord/At.js | src/view.coffee | MIT | 01555f8921131160b1a76489dd743ce893d54f3e | 5,250 | https://github.com/ichord/At.js/blob/01555f8921131160b1a76489dd743ce893d54f3e/src/view.coffee | 53 | 102 |
ichord/At.js:src/view.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
next: function() {
var cur, next;
cur = this.$el.find('.cur').removeClass('cur');
next = cur.next();
if (!next.length) {
next = this.$el.find('li:first');
}
next.addClass('cur');
return this.$el.animate({
scrollTop: Math... | next: ->
cur = @$el.find('.cur').removeClass('cur')
next = cur.next()
next = @$el.find('li:first') if not next.length
next.addClass 'cur'
@$el.animate {
scrollTop: Math.max 0, cur.innerHeight() * (next.index() + 2) - @$el.height()
}, 150
prev: ->
cur = @$el.find('.cur').removeClas... | JavaScript | CoffeeScript | ichord/At.js | src/view.coffee | MIT | 01555f8921131160b1a76489dd743ce893d54f3e | 5,250 | https://github.com/ichord/At.js/blob/01555f8921131160b1a76489dd743ce893d54f3e/src/view.coffee | 53 | 102 |
ichord/At.js:src/view.coffee:2:completion | completion | next: ->
cur = @$el.find('.cur').removeClass('cur')
next = cur.next()
next = @$el.find('li:first') if not next.length
next.addClass 'cur'
@$el.animate {
scrollTop: Math.max 0, cur.innerHeight() * (next.index() + 2) - @$el.height()
}, 150
prev: ->
cur = @$el.find('.cur').removeClas... | @$el.show()
@context.trigger 'shown'
this.reposition(rect) if rect = @context.rect()
hide: (e, time) ->
return if not this.visible()
if isNaN(time)
@context.reset_rect()
@$el.hide()
@context.trigger 'hidden', [e]
else
callback = => this.hide()
clearTimeout @timeout... | CoffeeScript | CoffeeScript | ichord/At.js | src/view.coffee | MIT | 01555f8921131160b1a76489dd743ce893d54f3e | 5,250 | https://github.com/ichord/At.js/blob/01555f8921131160b1a76489dd743ce893d54f3e/src/view.coffee | 53 | 102 |
ichord/At.js:src/view.coffee:2:raw_corpus | raw_corpus | next: ->
cur = @$el.find('.cur').removeClass('cur')
next = cur.next()
next = @$el.find('li:first') if not next.length
next.addClass 'cur'
prev: ->
cur = @$el.find('.cur').removeClass('cur')
prev = cur.prev()
prev = @$el.find('li:last') if not prev.length
prev.addClass 'cur'
show: -... | CoffeeScript | ichord/At.js | src/view.coffee | MIT | 219de3d20ca71d0391e9c55b793f55e1eb184daf | 5,250 | https://github.com/ichord/At.js/blob/219de3d20ca71d0391e9c55b793f55e1eb184daf/src/view.coffee | 53 | 102 | ||
ichord/At.js:src/view.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
next: ->
cur = @$el.find('.cur').removeClass('cur')
next = cur.next()
next = @$el.find('li:first') if not next.length
next.addClass 'cur'
prev: ->
cur = @$el.find('.cur').removeClass('cur')
prev = cur.prev()
prev = @$el.find('li:las... | ({
next: function() {
var cur, next;
cur = this.$el.find('.cur').removeClass('cur');
next = cur.next();
if (!next.length) {
next = this.$el.find('li:first');
}
return next.addClass('cur');
},
prev: function() {
var cur, prev;
cur = this.$el.find('.cur').removeClass('cur');
... | CoffeeScript | JavaScript | ichord/At.js | src/view.coffee | MIT | 219de3d20ca71d0391e9c55b793f55e1eb184daf | 5,250 | https://github.com/ichord/At.js/blob/219de3d20ca71d0391e9c55b793f55e1eb184daf/src/view.coffee | 53 | 102 |
ichord/At.js:src/view.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
next: function() {
var cur, next;
cur = this.$el.find('.cur').removeClass('cur');
next = cur.next();
if (!next.length) {
next = this.$el.find('li:first');
}
return next.addClass('cur');
},
prev: function() {
var cur, prev;... | next: ->
cur = @$el.find('.cur').removeClass('cur')
next = cur.next()
next = @$el.find('li:first') if not next.length
next.addClass 'cur'
prev: ->
cur = @$el.find('.cur').removeClass('cur')
prev = cur.prev()
prev = @$el.find('li:last') if not prev.length
prev.addClass 'cur'
show: -... | JavaScript | CoffeeScript | ichord/At.js | src/view.coffee | MIT | 219de3d20ca71d0391e9c55b793f55e1eb184daf | 5,250 | https://github.com/ichord/At.js/blob/219de3d20ca71d0391e9c55b793f55e1eb184daf/src/view.coffee | 53 | 102 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.