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/controller.coffee:2:completion | completion | eventName = if alias then "#{name}-#{alias}.atwho" else "#{name}.atwho"
@$inputor.trigger eventName, data
# Get callback either in settings which was set by plugin user or in default callbacks list.
#
# @param funcName [String] callback's name
# @return [Function] The callback.
callbacks: (funcName)->
... | this.callbacks("tplEval").call(this, tpl, data, "onInsert")
# Render list view
#
# @param data [Array] The data
renderView: (data) ->
searchKey = this.getOpt("searchKey")
data = this.callbacks("sorter").call(this, @query.text, data[0..1000] , searchKey)
@view.render data[0...this.getOpt('limit')]
... | CoffeeScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 294b093f8c65eb8c830c64610a39ebab1b32938c | 5,250 | https://github.com/ichord/At.js/blob/294b093f8c65eb8c830c64610a39ebab1b32938c/src/controller.coffee | 51 | 100 |
ichord/At.js:src/controller.coffee:3:raw_corpus | raw_corpus | @_lookUp query
query
_lookUp: (query) ->
_callback = (data) ->
if data and data.length > 0
this.renderView @constructor.arrayToDefaultHash data
else
@view.hide()
@model.query query.text, $.proxy(_callback, this) | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 294b093f8c65eb8c830c64610a39ebab1b32938c | 5,250 | https://github.com/ichord/At.js/blob/294b093f8c65eb8c830c64610a39ebab1b32938c/src/controller.coffee | 101 | 110 | ||
ichord/At.js:src/controller.coffee:3:completion | completion | @_lookUp query
query
_lookUp: (query) ->
_callback = (data) -> | if data and data.length > 0
this.renderView @constructor.arrayToDefaultHash data
else
@view.hide()
@model.query query.text, $.proxy(_callback, this) | CoffeeScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 294b093f8c65eb8c830c64610a39ebab1b32938c | 5,250 | https://github.com/ichord/At.js/blob/294b093f8c65eb8c830c64610a39ebab1b32938c/src/controller.coffee | 101 | 110 |
ichord/At.js:src/controller.coffee:2:raw_corpus | raw_corpus | eventName = if alias then "#{name}-#{alias}.atwho" else "#{name}.atwho"
@$inputor.trigger eventName, data
# Get callback either in settings which was set by plugin user or in default callbacks list.
#
# @param funcName [String] callback's name
# @return [Function] The callback.
callbacks: (funcName)->
... | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 0132259fe93147a8f8a7f2f42620b6e14dac0925 | 5,250 | https://github.com/ichord/At.js/blob/0132259fe93147a8f8a7f2f42620b6e14dac0925/src/controller.coffee | 51 | 100 | ||
ichord/At.js:src/controller.coffee:2:completion | completion | eventName = if alias then "#{name}-#{alias}.atwho" else "#{name}.atwho"
@$inputor.trigger eventName, data
# Get callback either in settings which was set by plugin user or in default callbacks list.
#
# @param funcName [String] callback's name
# @return [Function] The callback.
callbacks: (funcName)->
... | data = $.extend {}, $li.data('item-data'), {'atwho-at': @at}
this.callbacks("tplEval").call(this, tpl, data, "onInsert")
# Render list view
#
# @param data [Array] The data
renderView: (data) ->
searchKey = this.getOpt("searchKey")
data = this.callbacks("sorter").call(this, @query.text, data[0..100... | CoffeeScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 0132259fe93147a8f8a7f2f42620b6e14dac0925 | 5,250 | https://github.com/ichord/At.js/blob/0132259fe93147a8f8a7f2f42620b6e14dac0925/src/controller.coffee | 51 | 100 |
ichord/At.js:src/controller.coffee:3:raw_corpus | raw_corpus | _lookUp: (e) ->
return if not query = this.catchQuery e
@app.setContextFor @at
_callback = (data) ->
if data and data.length > 0
this.renderView @constructor.arrayToDefaultHash data
else
@view.hide()
@model.query query.text, $.proxy(_callback, this)
query | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 0132259fe93147a8f8a7f2f42620b6e14dac0925 | 5,250 | https://github.com/ichord/At.js/blob/0132259fe93147a8f8a7f2f42620b6e14dac0925/src/controller.coffee | 101 | 110 | ||
ichord/At.js:src/controller.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
_lookUp: (e) ->
return if not query = this.catchQuery e
@app.setContextFor @at
_callback = (data) ->
if data and data.length > 0
this.renderView @constructor.arrayToDefaultHash data
else
@view.hide()
@model.query query.... | ({
_lookUp: function(e) {
var _callback, query;
if (!(query = this.catchQuery(e))) {
return;
}
this.app.setContextFor(this.at);
_callback = function(data) {
if (data && data.length > 0) {
return this.renderView(this.constructor.arrayToDefaultHash(data));
} else {
... | CoffeeScript | JavaScript | ichord/At.js | src/controller.coffee | MIT | 0132259fe93147a8f8a7f2f42620b6e14dac0925 | 5,250 | https://github.com/ichord/At.js/blob/0132259fe93147a8f8a7f2f42620b6e14dac0925/src/controller.coffee | 101 | 110 |
ichord/At.js:src/controller.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
_lookUp: function(e) {
var _callback, query;
if (!(query = this.catchQuery(e))) {
return;
}
this.app.setContextFor(this.at);
_callback = function(data) {
if (data && data.length > 0) {
return this.renderView(this.constru... | _lookUp: (e) ->
return if not query = this.catchQuery e
@app.setContextFor @at
_callback = (data) ->
if data and data.length > 0
this.renderView @constructor.arrayToDefaultHash data
else
@view.hide()
@model.query query.text, $.proxy(_callback, this)
query | JavaScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 0132259fe93147a8f8a7f2f42620b6e14dac0925 | 5,250 | https://github.com/ichord/At.js/blob/0132259fe93147a8f8a7f2f42620b6e14dac0925/src/controller.coffee | 101 | 110 |
ichord/At.js:src/controller.coffee:3:completion | completion | _lookUp: (e) ->
return if not query = this.catchQuery e
@app.setContextFor @at
_callback = (data) ->
if data and data.length > 0 | this.renderView @constructor.arrayToDefaultHash data
else
@view.hide()
@model.query query.text, $.proxy(_callback, this)
query | CoffeeScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 0132259fe93147a8f8a7f2f42620b6e14dac0925 | 5,250 | https://github.com/ichord/At.js/blob/0132259fe93147a8f8a7f2f42620b6e14dac0925/src/controller.coffee | 101 | 110 |
ichord/At.js:src/controller.coffee:2:raw_corpus | raw_corpus | eventName = if alias then "#{name}-#{alias}.atwho" else "#{name}.atwho"
@$inputor.trigger eventName, data
# Get callback either in settings which was set by plugin user or in default callbacks list.
#
# @param funcName [String] callback's name
# @return [Function] The callback.
callbacks: (funcName)->
... | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 9bcb06e82c2e1302a223300646b77b304b3421aa | 5,250 | https://github.com/ichord/At.js/blob/9bcb06e82c2e1302a223300646b77b304b3421aa/src/controller.coffee | 51 | 100 | ||
ichord/At.js:src/controller.coffee:2:completion | completion | eventName = if alias then "#{name}-#{alias}.atwho" else "#{name}.atwho"
@$inputor.trigger eventName, data
# Get callback either in settings which was set by plugin user or in default callbacks list.
#
# @param funcName [String] callback's name
# @return [Function] The callback.
callbacks: (funcName)->
... | this.callbacks("tplEval").call(this, tpl, data, "onInsert")
# Render list view
#
# @param data [Array] The data
renderView: (data) ->
searchKey = this.getOpt("searchKey")
data = this.callbacks("sorter").call(this, @query.text, data[0..1000] , searchKey)
@view.render data[0...this.getOpt('limit')]
... | CoffeeScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 9bcb06e82c2e1302a223300646b77b304b3421aa | 5,250 | https://github.com/ichord/At.js/blob/9bcb06e82c2e1302a223300646b77b304b3421aa/src/controller.coffee | 51 | 100 |
ichord/At.js:src/controller.coffee:2:raw_corpus | raw_corpus | eventName = if alias then "#{name}-#{alias}.atwho" else "#{name}.atwho"
@$inputor.trigger eventName, data
# Get callback either in settings which was set by plugin user or in default callbacks list.
#
# @param funcName [String] callback's name
# @return [Function] The callback.
callbacks: (funcName)->
... | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 1c1900ac52430ace4e772de533303db43743dca8 | 5,250 | https://github.com/ichord/At.js/blob/1c1900ac52430ace4e772de533303db43743dca8/src/controller.coffee | 51 | 100 | ||
ichord/At.js:src/controller.coffee:2:completion | completion | eventName = if alias then "#{name}-#{alias}.atwho" else "#{name}.atwho"
@$inputor.trigger eventName, data
# Get callback either in settings which was set by plugin user or in default callbacks list.
#
# @param funcName [String] callback's name
# @return [Function] The callback.
callbacks: (funcName)->
... | this.callbacks("tplEval").call(this, tpl, data)
# Render list view
#
# @param data [Array] The data
renderView: (data) ->
searchKey = this.getOpt("searchKey")
data = this.callbacks("sorter").call(this, @query.text, data[0..1000] , searchKey)
@view.render data[0...this.getOpt('limit')]
@arrayToDe... | CoffeeScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 1c1900ac52430ace4e772de533303db43743dca8 | 5,250 | https://github.com/ichord/At.js/blob/1c1900ac52430ace4e772de533303db43743dca8/src/controller.coffee | 51 | 100 |
ichord/At.js:src/controller.coffee:2:raw_corpus | raw_corpus | eventName = if alias then "#{name}-#{alias}.atwho" else "#{name}.atwho"
@$inputor.trigger eventName, data
# Get callback either in settings which was set by plugin user or in default callbacks list.
#
# @param funcName [String] callback's name
# @return [Function] The callback.
callbacks: (funcName)->
... | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | ac213212f2d0d421896f8e490ec99698ed1d99f0 | 5,250 | https://github.com/ichord/At.js/blob/ac213212f2d0d421896f8e490ec99698ed1d99f0/src/controller.coffee | 51 | 91 | ||
ichord/At.js:src/controller.coffee:2:completion | completion | eventName = if alias then "#{name}-#{alias}.atwho" else "#{name}.atwho"
@$inputor.trigger eventName, data
# Get callback either in settings which was set by plugin user or in default callbacks list.
#
# @param funcName [String] callback's name
# @return [Function] The callback.
callbacks: (funcName)->
... | null
insertContentFor: ($li) ->
tpl = this.getOpt('insertTpl')
data = $.extend {}, $li.data('item-data'), {'atwho-at': @at}
this.callbacks("tplEval").call(this, tpl, data)
# Render list view
#
# @param data [Array] The data
renderView: (data) ->
searchKey = this.getOpt("searchKey")
data ... | CoffeeScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | ac213212f2d0d421896f8e490ec99698ed1d99f0 | 5,250 | https://github.com/ichord/At.js/blob/ac213212f2d0d421896f8e490ec99698ed1d99f0/src/controller.coffee | 51 | 91 |
ichord/At.js:src/controller.coffee:2:raw_corpus | raw_corpus | eventName = if alias then "#{name}-#{alias}.atwho" else "#{name}.atwho"
@$inputor.trigger eventName, data
# Get callback either in settings which was set by plugin user or in default callbacks list.
#
# @param funcName [String] callback's name
# @return [Function] The callback.
callbacks: (funcName)->
... | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | ccefdd18940e098a0e82d3ac23cfd128e04c98c2 | 5,250 | https://github.com/ichord/At.js/blob/ccefdd18940e098a0e82d3ac23cfd128e04c98c2/src/controller.coffee | 51 | 91 | ||
ichord/At.js:src/controller.coffee:2:completion | completion | eventName = if alias then "#{name}-#{alias}.atwho" else "#{name}.atwho"
@$inputor.trigger eventName, data
# Get callback either in settings which was set by plugin user or in default callbacks list.
#
# @param funcName [String] callback's name
# @return [Function] The callback.
callbacks: (funcName)->
... | null
insertContentFor: ($li) ->
tpl = this.getOpt('insert_tpl')
data = $.extend {}, $li.data('item-data'), {'atwho-at': @at}
this.callbacks("tpl_eval").call(this, tpl, data)
# Render list view
#
# @param data [Array] The data
renderView: (data) ->
search_key = this.getOpt("search_key")
d... | CoffeeScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | ccefdd18940e098a0e82d3ac23cfd128e04c98c2 | 5,250 | https://github.com/ichord/At.js/blob/ccefdd18940e098a0e82d3ac23cfd128e04c98c2/src/controller.coffee | 51 | 91 |
ichord/At.js:src/controller.coffee:2:raw_corpus | raw_corpus | eventName = if alias then "#{name}-#{alias}.atwho" else "#{name}.atwho"
@$inputor.trigger eventName, data
# Get callback either in settings which was set by plugin user or in default callbacks list.
#
# @param funcName [String] callback's name
# @return [Function] The callback.
callbacks: (funcName)->
... | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | dea7f905a54abd351d68c768fd3d6bd4fc281e9c | 5,250 | https://github.com/ichord/At.js/blob/dea7f905a54abd351d68c768fd3d6bd4fc281e9c/src/controller.coffee | 51 | 95 | ||
ichord/At.js:src/controller.coffee:2:completion | completion | eventName = if alias then "#{name}-#{alias}.atwho" else "#{name}.atwho"
@$inputor.trigger eventName, data
# Get callback either in settings which was set by plugin user or in default callbacks list.
#
# @param funcName [String] callback's name
# @return [Function] The callback.
callbacks: (funcName)->
... | insertContentFor: ($li) ->
data_value = $li.data('value')
tpl = this.getOpt('insert_tpl')
if @$inputor.is('textarea, input') or not tpl
return data_value
data = $.extend {}, $li.data('item-data'), {'atwho-data-value': data_value, 'atwho-at': @at}
this.callbacks("tpl_eval").call(this, tpl, dat... | CoffeeScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | dea7f905a54abd351d68c768fd3d6bd4fc281e9c | 5,250 | https://github.com/ichord/At.js/blob/dea7f905a54abd351d68c768fd3d6bd4fc281e9c/src/controller.coffee | 51 | 95 |
ichord/At.js:src/controller.coffee:1:raw_corpus | raw_corpus | class Controller
uid: ->
(Math.random().toString(16)+"000000000").substr(2,8) + (new Date().getTime())
constructor: (@app, @at) ->
@$inputor = @app.$inputor
@id = @$inputor[0].id || this.uid()
@setting = null
@query = null
@pos = 0
@cur_rect = null
@range = null
if ... | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | b05d51a77ef9a02aa2dbcd72543ead335a5cb5a0 | 5,250 | https://github.com/ichord/At.js/blob/b05d51a77ef9a02aa2dbcd72543ead335a5cb5a0/src/controller.coffee | 1 | 50 | ||
ichord/At.js:src/controller.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class Controller
uid: ->
(Math.random().toString(16)+"000000000").substr(2,8) + (new Date().getTime())
constructor: (@app, @at) ->
@$inputor = @app.$inputor
@id = @$inputor[0].id || this.uid()
@setting = null
@query = null
@pos ... | var Controller;
Controller = class Controller {
uid() {
return (Math.random().toString(16) + "000000000").substr(2, 8) + (new Date().getTime());
}
constructor(app, at) {
this.app = app;
this.at = at;
this.$inputor = this.app.$inputor;
this.id = this.$inputor[0].id || this.uid();
this.set... | CoffeeScript | JavaScript | ichord/At.js | src/controller.coffee | MIT | b05d51a77ef9a02aa2dbcd72543ead335a5cb5a0 | 5,250 | https://github.com/ichord/At.js/blob/b05d51a77ef9a02aa2dbcd72543ead335a5cb5a0/src/controller.coffee | 1 | 50 |
ichord/At.js:src/controller.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Controller;
Controller = class Controller {
uid() {
return (Math.random().toString(16) + "000000000").substr(2, 8) + (new Date().getTime());
}
constructor(app, at) {
this.app = app;
this.at = at;
this.$inputor = this.app.$inputor;
th... | class Controller
uid: ->
(Math.random().toString(16)+"000000000").substr(2,8) + (new Date().getTime())
constructor: (@app, @at) ->
@$inputor = @app.$inputor
@id = @$inputor[0].id || this.uid()
@setting = null
@query = null
@pos = 0
@cur_rect = null
@range = null
if ... | JavaScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | b05d51a77ef9a02aa2dbcd72543ead335a5cb5a0 | 5,250 | https://github.com/ichord/At.js/blob/b05d51a77ef9a02aa2dbcd72543ead335a5cb5a0/src/controller.coffee | 1 | 50 |
ichord/At.js:src/controller.coffee:1:completion | completion | class Controller
uid: ->
(Math.random().toString(16)+"000000000").substr(2,8) + (new Date().getTime())
constructor: (@app, @at) ->
@$inputor = @app.$inputor
@id = @$inputor[0].id || this.uid()
@setting = null
@query = null
@pos = 0
@cur_rect = null
@range = null
if ... | this.trigger 'beforeDestroy'
@model.destroy()
@view.destroy()
@$el.remove()
call_default: (func_name, args...) ->
try
DEFAULT_CALLBACKS[func_name].apply this, args
catch error
$.error "#{error} Or maybe At.js doesn't have function #{func_name}"
# Delegate custom `jQueryEvent` to th... | CoffeeScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | b05d51a77ef9a02aa2dbcd72543ead335a5cb5a0 | 5,250 | https://github.com/ichord/At.js/blob/b05d51a77ef9a02aa2dbcd72543ead335a5cb5a0/src/controller.coffee | 1 | 50 |
ichord/At.js:src/controller.coffee:2:raw_corpus | raw_corpus | alias = this.get_opt('alias')
event_name = if alias then "#{name}-#{alias}.atwho" else "#{name}.atwho"
@$inputor.trigger event_name, data
# Get callback either in settings which was set by plugin user or in default callbacks list.
#
# @param func_name [String] callback's name
# @return [Function] The c... | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | b05d51a77ef9a02aa2dbcd72543ead335a5cb5a0 | 5,250 | https://github.com/ichord/At.js/blob/b05d51a77ef9a02aa2dbcd72543ead335a5cb5a0/src/controller.coffee | 51 | 96 | ||
ichord/At.js:src/controller.coffee:2:completion | completion | alias = this.get_opt('alias')
event_name = if alias then "#{name}-#{alias}.atwho" else "#{name}.atwho"
@$inputor.trigger event_name, data
# Get callback either in settings which was set by plugin user or in default callbacks list.
#
# @param func_name [String] callback's name
# @return [Function] The c... | insert_content_for: ($li) ->
data_value = $li.data('value')
tpl = this.get_opt('insert_tpl')
if @$inputor.is('textarea, input') or not tpl
return data_value
data = $.extend {}, $li.data('item-data'), {'atwho-data-value': data_value, 'atwho-at': @at}
this.callbacks("tpl_eval").call(this, tpl, ... | CoffeeScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | b05d51a77ef9a02aa2dbcd72543ead335a5cb5a0 | 5,250 | https://github.com/ichord/At.js/blob/b05d51a77ef9a02aa2dbcd72543ead335a5cb5a0/src/controller.coffee | 51 | 96 |
ichord/At.js:src/controller.coffee:2:raw_corpus | raw_corpus | alias = this.get_opt('alias')
event_name = if alias then "#{name}-#{alias}.atwho" else "#{name}.atwho"
@$inputor.trigger event_name, data
# Get callback either in settings which was set by plugin user or in default callbacks list.
#
# @param func_name [String] callback's name
# @return [Function] The c... | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 8fe3a54e980995b8a48e8b414fb5e34da5b8ba5f | 5,250 | https://github.com/ichord/At.js/blob/8fe3a54e980995b8a48e8b414fb5e34da5b8ba5f/src/controller.coffee | 51 | 100 | ||
ichord/At.js:src/controller.coffee:2:completion | completion | alias = this.get_opt('alias')
event_name = if alias then "#{name}-#{alias}.atwho" else "#{name}.atwho"
@$inputor.trigger event_name, data
# Get callback either in settings which was set by plugin user or in default callbacks list.
#
# @param func_name [String] callback's name
# @return [Function] The c... | # Catch query string behind the at char
#
# @return [Hash] Info of the query. Look likes this: {'text': "hello", 'head_pos': 0, 'end_pos': 0}
catch_query: ->
content = this.content()
caret_pos = @$inputor.caret('pos', {iframe: @app.iframe})
subtext = content.slice(0, caret_pos)
query = this.callb... | CoffeeScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 8fe3a54e980995b8a48e8b414fb5e34da5b8ba5f | 5,250 | https://github.com/ichord/At.js/blob/8fe3a54e980995b8a48e8b414fb5e34da5b8ba5f/src/controller.coffee | 51 | 100 |
ichord/At.js:src/controller.coffee:3:raw_corpus | raw_corpus | return if not c = @$inputor.caret('offset', @pos - 1, {iframe: @app.iframe})
if @app.iframe and not @app.iframeStandalone
iframe_offset = $(@app.iframe).offset()
c.left += iframe_offset.left
c.top += iframe_offset.top
c = @cur_rect ||= c if @$inputor.is('[contentEditable]')
scale_bottom = ... | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 8fe3a54e980995b8a48e8b414fb5e34da5b8ba5f | 5,250 | https://github.com/ichord/At.js/blob/8fe3a54e980995b8a48e8b414fb5e34da5b8ba5f/src/controller.coffee | 101 | 150 | ||
ichord/At.js:src/controller.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
return if not c = @$inputor.caret('offset', @pos - 1, {iframe: @app.iframe})
if @app.iframe and not @app.iframeStandalone
iframe_offset = $(@app.iframe).offset()
c.left += iframe_offset.left
c.top += iframe_offset.top
c = @cur_rect ||= c... | var c, iframe_offset, scale_bottom;
if (!(c = this.$inputor.caret('offset', this.pos - 1, {
iframe: this.app.iframe
}))) {
if (this.app.iframe && !this.app.iframeStandalone) {
iframe_offset = $(this.app.iframe).offset();
c.left += iframe_offset.left;
c.top += iframe_offset.top;
}
if (this.$inputor.... | CoffeeScript | JavaScript | ichord/At.js | src/controller.coffee | MIT | 8fe3a54e980995b8a48e8b414fb5e34da5b8ba5f | 5,250 | https://github.com/ichord/At.js/blob/8fe3a54e980995b8a48e8b414fb5e34da5b8ba5f/src/controller.coffee | 101 | 150 |
ichord/At.js:src/controller.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var c, iframe_offset, scale_bottom;
if (!(c = this.$inputor.caret('offset', this.pos - 1, {
iframe: this.app.iframe
}))) {
if (this.app.iframe && !this.app.iframeStandalone) {
iframe_offset = $(this.app.iframe).offset();
c.left += iframe_offset.left;
... | return if not c = @$inputor.caret('offset', @pos - 1, {iframe: @app.iframe})
if @app.iframe and not @app.iframeStandalone
iframe_offset = $(@app.iframe).offset()
c.left += iframe_offset.left
c.top += iframe_offset.top
c = @cur_rect ||= c if @$inputor.is('[contentEditable]')
scale_bottom = ... | JavaScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 8fe3a54e980995b8a48e8b414fb5e34da5b8ba5f | 5,250 | https://github.com/ichord/At.js/blob/8fe3a54e980995b8a48e8b414fb5e34da5b8ba5f/src/controller.coffee | 101 | 150 |
ichord/At.js:src/controller.coffee:3:completion | completion | return if not c = @$inputor.caret('offset', @pos - 1, {iframe: @app.iframe})
if @app.iframe and not @app.iframeStandalone
iframe_offset = $(@app.iframe).offset()
c.left += iframe_offset.left
c.top += iframe_offset.top
c = @cur_rect ||= c if @$inputor.is('[contentEditable]')
scale_bottom = ... | data = $.extend {}, $li.data('item-data'), {'atwho-data-value': data_value, 'atwho-at': @at}
this.callbacks("tpl_eval").call(this, tpl, data)
# Insert value of `data-value` attribute of chosen item into inputor
#
# @param content [String] string to insert
insert: (content, $li) ->
$inputor = @$inputor
... | CoffeeScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 8fe3a54e980995b8a48e8b414fb5e34da5b8ba5f | 5,250 | https://github.com/ichord/At.js/blob/8fe3a54e980995b8a48e8b414fb5e34da5b8ba5f/src/controller.coffee | 101 | 150 |
ichord/At.js:src/controller.coffee:4:raw_corpus | raw_corpus | range.collapse(false)
sel = @app.window.getSelection()
sel.removeAllRanges()
sel.addRange(range)
else if range = @ie8_range # IE < 9
# NOTE: have to add this <meta http-equiv="x-ua-compatible" content="IE=Edge"/> into <header>
# to make it work batter.
# REF: http://stacko... | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 8fe3a54e980995b8a48e8b414fb5e34da5b8ba5f | 5,250 | https://github.com/ichord/At.js/blob/8fe3a54e980995b8a48e8b414fb5e34da5b8ba5f/src/controller.coffee | 151 | 179 | ||
ichord/At.js:src/controller.coffee:4:completion | completion | range.collapse(false)
sel = @app.window.getSelection()
sel.removeAllRanges()
sel.addRange(range)
else if range = @ie8_range # IE < 9
# NOTE: have to add this <meta http-equiv="x-ua-compatible" content="IE=Edge"/> into <header>
# to make it work batter.
# REF: http://stacko... | # Render list view
#
# @param data [Array] The data
render_view: (data) ->
search_key = this.get_opt("search_key")
data = this.callbacks("sorter").call(this, @query.text, data[0..1000] , search_key)
@view.render data[0...this.get_opt('limit')]
# Searching!
look_up: ->
return if not (query = t... | CoffeeScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 8fe3a54e980995b8a48e8b414fb5e34da5b8ba5f | 5,250 | https://github.com/ichord/At.js/blob/8fe3a54e980995b8a48e8b414fb5e34da5b8ba5f/src/controller.coffee | 151 | 179 |
ichord/At.js:src/controller.coffee:3:raw_corpus | raw_corpus | return if not c = @$inputor.caret('offset', @pos - 1, {iframe: @app.iframe})
if @app.iframe and not @app.iframeStandalone
iframe_offset = $(@app.iframe).offset()
c.left += iframe_offset.left
c.top += iframe_offset.top
c = @cur_rect ||= c if @$inputor.is('[contentEditable]')
scale_bottom = ... | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 0f7ba07ce828957fc5bfff40025caf5eee35a977 | 5,250 | https://github.com/ichord/At.js/blob/0f7ba07ce828957fc5bfff40025caf5eee35a977/src/controller.coffee | 101 | 150 | ||
ichord/At.js:src/controller.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
return if not c = @$inputor.caret('offset', @pos - 1, {iframe: @app.iframe})
if @app.iframe and not @app.iframeStandalone
iframe_offset = $(@app.iframe).offset()
c.left += iframe_offset.left
c.top += iframe_offset.top
c = @cur_rect ||= c... | var c, iframe_offset, scale_bottom;
if (!(c = this.$inputor.caret('offset', this.pos - 1, {
iframe: this.app.iframe
}))) {
if (this.app.iframe && !this.app.iframeStandalone) {
iframe_offset = $(this.app.iframe).offset();
c.left += iframe_offset.left;
c.top += iframe_offset.top;
}
if (this.$inputor.... | CoffeeScript | JavaScript | ichord/At.js | src/controller.coffee | MIT | 0f7ba07ce828957fc5bfff40025caf5eee35a977 | 5,250 | https://github.com/ichord/At.js/blob/0f7ba07ce828957fc5bfff40025caf5eee35a977/src/controller.coffee | 101 | 150 |
ichord/At.js:src/controller.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var c, iframe_offset, scale_bottom;
if (!(c = this.$inputor.caret('offset', this.pos - 1, {
iframe: this.app.iframe
}))) {
if (this.app.iframe && !this.app.iframeStandalone) {
iframe_offset = $(this.app.iframe).offset();
c.left += iframe_offset.left;
... | return if not c = @$inputor.caret('offset', @pos - 1, {iframe: @app.iframe})
if @app.iframe and not @app.iframeStandalone
iframe_offset = $(@app.iframe).offset()
c.left += iframe_offset.left
c.top += iframe_offset.top
c = @cur_rect ||= c if @$inputor.is('[contentEditable]')
scale_bottom = ... | JavaScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 0f7ba07ce828957fc5bfff40025caf5eee35a977 | 5,250 | https://github.com/ichord/At.js/blob/0f7ba07ce828957fc5bfff40025caf5eee35a977/src/controller.coffee | 101 | 150 |
ichord/At.js:src/controller.coffee:3:completion | completion | return if not c = @$inputor.caret('offset', @pos - 1, {iframe: @app.iframe})
if @app.iframe and not @app.iframeStandalone
iframe_offset = $(@app.iframe).offset()
c.left += iframe_offset.left
c.top += iframe_offset.top
c = @cur_rect ||= c if @$inputor.is('[contentEditable]')
scale_bottom = ... | data = $.extend {}, $li.data('item-data'), {'atwho-data-value': data_value, 'atwho-at': @at}
this.callbacks("tpl_eval").call(this, tpl, data)
# Insert value of `data-value` attribute of chosen item into inputor
#
# @param content [String] string to insert
insert: (content, $li) ->
$inputor = @$inputor
... | CoffeeScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 0f7ba07ce828957fc5bfff40025caf5eee35a977 | 5,250 | https://github.com/ichord/At.js/blob/0f7ba07ce828957fc5bfff40025caf5eee35a977/src/controller.coffee | 101 | 150 |
ichord/At.js:src/controller.coffee:4:raw_corpus | raw_corpus | range.collapse(false)
sel = @app.window.getSelection()
sel.removeAllRanges()
sel.addRange(range)
else if range = @ie8_range # IE < 9
# NOTE: have to add this <meta http-equiv="x-ua-compatible" content="IE=Edge"/> into <header>
# to make it work batter.
# REF: http://stacko... | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 0f7ba07ce828957fc5bfff40025caf5eee35a977 | 5,250 | https://github.com/ichord/At.js/blob/0f7ba07ce828957fc5bfff40025caf5eee35a977/src/controller.coffee | 151 | 179 | ||
ichord/At.js:src/controller.coffee:4:completion | completion | range.collapse(false)
sel = @app.window.getSelection()
sel.removeAllRanges()
sel.addRange(range)
else if range = @ie8_range # IE < 9
# NOTE: have to add this <meta http-equiv="x-ua-compatible" content="IE=Edge"/> into <header>
# to make it work batter.
# REF: http://stacko... | # Render list view
#
# @param data [Array] The data
render_view: (data) ->
search_key = this.get_opt("search_key")
data = this.callbacks("sorter").call(this, @query.text, data[0..1000] , search_key)
@view.render data[0...this.get_opt('limit')]
# Searching!
look_up: ->
return if not (query = t... | CoffeeScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 0f7ba07ce828957fc5bfff40025caf5eee35a977 | 5,250 | https://github.com/ichord/At.js/blob/0f7ba07ce828957fc5bfff40025caf5eee35a977/src/controller.coffee | 151 | 179 |
ichord/At.js:src/controller.coffee:3:raw_corpus | raw_corpus | return if not c = @$inputor.caret('offset', @pos - 1, {iframe: @app.iframe})
if @app.iframe and not @app.iframeStandalone
iframe_offset = $(@app.iframe).offset()
c.left += iframe_offset.left
c.top += iframe_offset.top
c = @cur_rect ||= c if @$inputor.attr('contentEditable') == 'true'
scale... | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 70958c457df11e0bcfe33871087f370a3aa50bb5 | 5,250 | https://github.com/ichord/At.js/blob/70958c457df11e0bcfe33871087f370a3aa50bb5/src/controller.coffee | 101 | 150 | ||
ichord/At.js:src/controller.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
return if not c = @$inputor.caret('offset', @pos - 1, {iframe: @app.iframe})
if @app.iframe and not @app.iframeStandalone
iframe_offset = $(@app.iframe).offset()
c.left += iframe_offset.left
c.top += iframe_offset.top
c = @cur_rect ||= c... | var c, iframe_offset, scale_bottom;
if (!(c = this.$inputor.caret('offset', this.pos - 1, {
iframe: this.app.iframe
}))) {
if (this.app.iframe && !this.app.iframeStandalone) {
iframe_offset = $(this.app.iframe).offset();
c.left += iframe_offset.left;
c.top += iframe_offset.top;
}
if (this.$inputor.... | CoffeeScript | JavaScript | ichord/At.js | src/controller.coffee | MIT | 70958c457df11e0bcfe33871087f370a3aa50bb5 | 5,250 | https://github.com/ichord/At.js/blob/70958c457df11e0bcfe33871087f370a3aa50bb5/src/controller.coffee | 101 | 150 |
ichord/At.js:src/controller.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var c, iframe_offset, scale_bottom;
if (!(c = this.$inputor.caret('offset', this.pos - 1, {
iframe: this.app.iframe
}))) {
if (this.app.iframe && !this.app.iframeStandalone) {
iframe_offset = $(this.app.iframe).offset();
c.left += iframe_offset.left;
... | return if not c = @$inputor.caret('offset', @pos - 1, {iframe: @app.iframe})
if @app.iframe and not @app.iframeStandalone
iframe_offset = $(@app.iframe).offset()
c.left += iframe_offset.left
c.top += iframe_offset.top
c = @cur_rect ||= c if @$inputor.attr('contentEditable') == 'true'
scale... | JavaScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 70958c457df11e0bcfe33871087f370a3aa50bb5 | 5,250 | https://github.com/ichord/At.js/blob/70958c457df11e0bcfe33871087f370a3aa50bb5/src/controller.coffee | 101 | 150 |
ichord/At.js:src/controller.coffee:3:completion | completion | return if not c = @$inputor.caret('offset', @pos - 1, {iframe: @app.iframe})
if @app.iframe and not @app.iframeStandalone
iframe_offset = $(@app.iframe).offset()
c.left += iframe_offset.left
c.top += iframe_offset.top
c = @cur_rect ||= c if @$inputor.attr('contentEditable') == 'true'
scale... | # Insert value of `data-value` attribute of chosen item into inputor
#
# @param content [String] string to insert
insert: (content, $li) ->
$inputor = @$inputor
wrapped_content = this.callbacks('inserting_wrapper').call this, $inputor, content, this.get_opt("suffix")
if $inputor.is('textarea, input'... | CoffeeScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 70958c457df11e0bcfe33871087f370a3aa50bb5 | 5,250 | https://github.com/ichord/At.js/blob/70958c457df11e0bcfe33871087f370a3aa50bb5/src/controller.coffee | 101 | 150 |
ichord/At.js:src/controller.coffee:4:raw_corpus | raw_corpus | sel.removeAllRanges()
sel.addRange(range)
else if range = @ie8_range # IE < 9
# NOTE: have to add this <meta http-equiv="x-ua-compatible" content="IE=Edge"/> into <header>
# to make it work batter.
# REF: http://stackoverflow.com/questions/15535933/ie-html1114-error-with-custom-cledit... | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 70958c457df11e0bcfe33871087f370a3aa50bb5 | 5,250 | https://github.com/ichord/At.js/blob/70958c457df11e0bcfe33871087f370a3aa50bb5/src/controller.coffee | 151 | 177 | ||
ichord/At.js:src/controller.coffee:4:completion | completion | sel.removeAllRanges()
sel.addRange(range)
else if range = @ie8_range # IE < 9
# NOTE: have to add this <meta http-equiv="x-ua-compatible" content="IE=Edge"/> into <header>
# to make it work batter.
# REF: http://stackoverflow.com/questions/15535933/ie-html1114-error-with-custom-cledit... | # Render list view
#
# @param data [Array] The data
render_view: (data) ->
search_key = this.get_opt("search_key")
data = this.callbacks("sorter").call(this, @query.text, data[0..1000] , search_key)
@view.render data[0...this.get_opt('limit')]
# Searching!
look_up: ->
return if not (query = t... | CoffeeScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 70958c457df11e0bcfe33871087f370a3aa50bb5 | 5,250 | https://github.com/ichord/At.js/blob/70958c457df11e0bcfe33871087f370a3aa50bb5/src/controller.coffee | 151 | 177 |
ichord/At.js:src/controller.coffee:3:raw_corpus | raw_corpus | caret_method = if @app.iframeStandalone then 'position' else 'offset'
return if not c = @$inputor.caret(caret_method, @pos - 1, {iframe: @app.iframe})
c = (@cur_rect ||= c) || c if @$inputor.attr('contentEditable') == 'true'
scale_bottom = if @app.document.selection then 0 else 2
{left: c.left, top: c.t... | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | ce60958d2719f8fb5deb1bb1d2589fdc34a55fd0 | 5,250 | https://github.com/ichord/At.js/blob/ce60958d2719f8fb5deb1bb1d2589fdc34a55fd0/src/controller.coffee | 101 | 150 | ||
ichord/At.js:src/controller.coffee:3:completion | completion | caret_method = if @app.iframeStandalone then 'position' else 'offset'
return if not c = @$inputor.caret(caret_method, @pos - 1, {iframe: @app.iframe})
c = (@cur_rect ||= c) || c if @$inputor.attr('contentEditable') == 'true'
scale_bottom = if @app.document.selection then 0 else 2
{left: c.left, top: c.t... | # @param content [String] string to insert
insert: (content, $li) ->
$inputor = @$inputor
wrapped_content = this.callbacks('inserting_wrapper').call this, $inputor, content, this.get_opt("suffix")
if $inputor.is('textarea, input')
source = $inputor.val()
start_str = source.slice 0, Math.max(... | CoffeeScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | ce60958d2719f8fb5deb1bb1d2589fdc34a55fd0 | 5,250 | https://github.com/ichord/At.js/blob/ce60958d2719f8fb5deb1bb1d2589fdc34a55fd0/src/controller.coffee | 101 | 150 |
ichord/At.js:src/controller.coffee:4:raw_corpus | raw_corpus | # NOTE: have to add this <meta http-equiv="x-ua-compatible" content="IE=Edge"/> into <header>
# to make it work batter.
# REF: http://stackoverflow.com/questions/15535933/ie-html1114-error-with-custom-cleditor-button?answertab=votes#tab-top
range.moveStart('character', @query.end_pos - @query.h... | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | ce60958d2719f8fb5deb1bb1d2589fdc34a55fd0 | 5,250 | https://github.com/ichord/At.js/blob/ce60958d2719f8fb5deb1bb1d2589fdc34a55fd0/src/controller.coffee | 151 | 174 | ||
ichord/At.js:src/controller.coffee:4:completion | completion | # NOTE: have to add this <meta http-equiv="x-ua-compatible" content="IE=Edge"/> into <header>
# to make it work batter.
# REF: http://stackoverflow.com/questions/15535933/ie-html1114-error-with-custom-cleditor-button?answertab=votes#tab-top
range.moveStart('character', @query.end_pos - @query.h... | # @param data [Array] The data
render_view: (data) ->
search_key = this.get_opt("search_key")
data = this.callbacks("sorter").call(this, @query.text, data[0..1000] , search_key)
@view.render data[0...this.get_opt('limit')]
# Searching!
look_up: ->
return if not (query = this.catch_query())
_c... | CoffeeScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | ce60958d2719f8fb5deb1bb1d2589fdc34a55fd0 | 5,250 | https://github.com/ichord/At.js/blob/ce60958d2719f8fb5deb1bb1d2589fdc34a55fd0/src/controller.coffee | 151 | 174 |
ichord/At.js:src/controller.coffee:1:raw_corpus | raw_corpus | class Controller
uid: ->
(Math.random().toString(16)+"000000000").substr(2,8) + (new Date().getTime())
constructor: (@app, @at) ->
@$inputor = @app.$inputor
@id = @$inputor[0].id || this.uid()
@setting = null
@query = null
@pos = 0
@cur_rect = null
@range = null
if ... | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 0b72c0dddfba09f161e1cdf193c6dffb5f95bd19 | 5,250 | https://github.com/ichord/At.js/blob/0b72c0dddfba09f161e1cdf193c6dffb5f95bd19/src/controller.coffee | 1 | 50 | ||
ichord/At.js:src/controller.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class Controller
uid: ->
(Math.random().toString(16)+"000000000").substr(2,8) + (new Date().getTime())
constructor: (@app, @at) ->
@$inputor = @app.$inputor
@id = @$inputor[0].id || this.uid()
@setting = null
@query = null
@pos ... | var Controller;
Controller = class Controller {
uid() {
return (Math.random().toString(16) + "000000000").substr(2, 8) + (new Date().getTime());
}
constructor(app, at) {
this.app = app;
this.at = at;
this.$inputor = this.app.$inputor;
this.id = this.$inputor[0].id || this.uid();
this.set... | CoffeeScript | JavaScript | ichord/At.js | src/controller.coffee | MIT | 0b72c0dddfba09f161e1cdf193c6dffb5f95bd19 | 5,250 | https://github.com/ichord/At.js/blob/0b72c0dddfba09f161e1cdf193c6dffb5f95bd19/src/controller.coffee | 1 | 50 |
ichord/At.js:src/controller.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Controller;
Controller = class Controller {
uid() {
return (Math.random().toString(16) + "000000000").substr(2, 8) + (new Date().getTime());
}
constructor(app, at) {
this.app = app;
this.at = at;
this.$inputor = this.app.$inputor;
th... | class Controller
uid: ->
(Math.random().toString(16)+"000000000").substr(2,8) + (new Date().getTime())
constructor: (@app, @at) ->
@$inputor = @app.$inputor
@id = @$inputor[0].id || this.uid()
@setting = null
@query = null
@pos = 0
@cur_rect = null
@range = null
if ... | JavaScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 0b72c0dddfba09f161e1cdf193c6dffb5f95bd19 | 5,250 | https://github.com/ichord/At.js/blob/0b72c0dddfba09f161e1cdf193c6dffb5f95bd19/src/controller.coffee | 1 | 50 |
ichord/At.js:src/controller.coffee:1:completion | completion | class Controller
uid: ->
(Math.random().toString(16)+"000000000").substr(2,8) + (new Date().getTime())
constructor: (@app, @at) ->
@$inputor = @app.$inputor
@id = @$inputor[0].id || this.uid()
@setting = null
@query = null
@pos = 0
@cur_rect = null
@range = null
if ... | this.trigger 'beforeDestroy'
@model.destroy()
@view.destroy()
@$el.remove()
call_default: (func_name, args...) ->
try
DEFAULT_CALLBACKS[func_name].apply this, args
catch error
$.error "#{error} Or maybe At.js doesn't have function #{func_name}"
# Delegate custom `jQueryEvent` to th... | CoffeeScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 0b72c0dddfba09f161e1cdf193c6dffb5f95bd19 | 5,250 | https://github.com/ichord/At.js/blob/0b72c0dddfba09f161e1cdf193c6dffb5f95bd19/src/controller.coffee | 1 | 50 |
ichord/At.js:src/controller.coffee:3:raw_corpus | raw_corpus | return if not c = @$inputor.caret('offset', @pos - 1, {iframe: @app.iframe})
c = (@cur_rect ||= c) || c if @$inputor.attr('contentEditable') == 'true'
scale_bottom = if @app.document.selection then 0 else 2
{left: c.left, top: c.top, bottom: c.top + c.height + scale_bottom}
reset_rect: ->
@cur_rect =... | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 0b72c0dddfba09f161e1cdf193c6dffb5f95bd19 | 5,250 | https://github.com/ichord/At.js/blob/0b72c0dddfba09f161e1cdf193c6dffb5f95bd19/src/controller.coffee | 101 | 150 | ||
ichord/At.js:src/controller.coffee:3:completion | completion | return if not c = @$inputor.caret('offset', @pos - 1, {iframe: @app.iframe})
c = (@cur_rect ||= c) || c if @$inputor.attr('contentEditable') == 'true'
scale_bottom = if @app.document.selection then 0 else 2
{left: c.left, top: c.top, bottom: c.top + c.height + scale_bottom}
reset_rect: ->
@cur_rect =... | insert: (content, $li) ->
$inputor = @$inputor
wrapped_content = this.callbacks('inserting_wrapper').call this, $inputor, content, this.get_opt("suffix")
if $inputor.is('textarea, input')
source = $inputor.val()
start_str = source.slice 0, Math.max(@query.head_pos - @at.length, 0)
text =... | CoffeeScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 0b72c0dddfba09f161e1cdf193c6dffb5f95bd19 | 5,250 | https://github.com/ichord/At.js/blob/0b72c0dddfba09f161e1cdf193c6dffb5f95bd19/src/controller.coffee | 101 | 150 |
ichord/At.js:src/controller.coffee:4:raw_corpus | raw_corpus | # to make it work batter.
# REF: http://stackoverflow.com/questions/15535933/ie-html1114-error-with-custom-cleditor-button?answertab=votes#tab-top
range.moveStart('character', @query.end_pos - @query.head_pos - @at.length)
range.pasteHTML wrapped_content
range.collapse(false)
range.... | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 0b72c0dddfba09f161e1cdf193c6dffb5f95bd19 | 5,250 | https://github.com/ichord/At.js/blob/0b72c0dddfba09f161e1cdf193c6dffb5f95bd19/src/controller.coffee | 151 | 173 | ||
ichord/At.js:src/controller.coffee:4:completion | completion | # to make it work batter.
# REF: http://stackoverflow.com/questions/15535933/ie-html1114-error-with-custom-cleditor-button?answertab=votes#tab-top
range.moveStart('character', @query.end_pos - @query.head_pos - @at.length)
range.pasteHTML wrapped_content
range.collapse(false)
range.... | # @param data [Array] The data
render_view: (data) ->
search_key = this.get_opt("search_key")
data = this.callbacks("sorter").call(this, @query.text, data[0..1000] , search_key)
@view.render data[0...this.get_opt('limit')]
# Searching!
look_up: ->
return if not (query = this.catch_query())
_c... | CoffeeScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 0b72c0dddfba09f161e1cdf193c6dffb5f95bd19 | 5,250 | https://github.com/ichord/At.js/blob/0b72c0dddfba09f161e1cdf193c6dffb5f95bd19/src/controller.coffee | 151 | 173 |
ichord/At.js:src/controller.coffee:1:raw_corpus | raw_corpus | class Controller
uid: ->
(Math.random().toString(16)+"000000000").substr(2,8) + (new Date().getTime())
constructor: (@app, @at) ->
@$inputor = @app.$inputor
@id = @$inputor[0].id || this.uid()
@setting = null
@query = null
@pos = 0
@cur_rect = null
@range = null
$CO... | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 4f1e7ff9407f447ce0ddff91f73e7a3fe9f2b06a | 5,250 | https://github.com/ichord/At.js/blob/4f1e7ff9407f447ce0ddff91f73e7a3fe9f2b06a/src/controller.coffee | 1 | 50 | ||
ichord/At.js:src/controller.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class Controller
uid: ->
(Math.random().toString(16)+"000000000").substr(2,8) + (new Date().getTime())
constructor: (@app, @at) ->
@$inputor = @app.$inputor
@id = @$inputor[0].id || this.uid()
@setting = null
@query = null
@pos ... | var Controller;
Controller = class Controller {
uid() {
return (Math.random().toString(16) + "000000000").substr(2, 8) + (new Date().getTime());
}
constructor(app, at) {
this.app = app;
this.at = at;
this.$inputor = this.app.$inputor;
this.id = this.$inputor[0].id || this.uid();
this.set... | CoffeeScript | JavaScript | ichord/At.js | src/controller.coffee | MIT | 4f1e7ff9407f447ce0ddff91f73e7a3fe9f2b06a | 5,250 | https://github.com/ichord/At.js/blob/4f1e7ff9407f447ce0ddff91f73e7a3fe9f2b06a/src/controller.coffee | 1 | 50 |
ichord/At.js:src/controller.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Controller;
Controller = class Controller {
uid() {
return (Math.random().toString(16) + "000000000").substr(2, 8) + (new Date().getTime());
}
constructor(app, at) {
this.app = app;
this.at = at;
this.$inputor = this.app.$inputor;
th... | class Controller
uid: ->
(Math.random().toString(16)+"000000000").substr(2,8) + (new Date().getTime())
constructor: (@app, @at) ->
@$inputor = @app.$inputor
@id = @$inputor[0].id || this.uid()
@setting = null
@query = null
@pos = 0
@cur_rect = null
@range = null
$CO... | JavaScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 4f1e7ff9407f447ce0ddff91f73e7a3fe9f2b06a | 5,250 | https://github.com/ichord/At.js/blob/4f1e7ff9407f447ce0ddff91f73e7a3fe9f2b06a/src/controller.coffee | 1 | 50 |
ichord/At.js:src/controller.coffee:1:completion | completion | class Controller
uid: ->
(Math.random().toString(16)+"000000000").substr(2,8) + (new Date().getTime())
constructor: (@app, @at) ->
@$inputor = @app.$inputor
@id = @$inputor[0].id || this.uid()
@setting = null
@query = null
@pos = 0
@cur_rect = null
@range = null
$CO... | @model.destroy()
@view.destroy()
@$el.remove()
call_default: (func_name, args...) ->
try
DEFAULT_CALLBACKS[func_name].apply this, args
catch error
$.error "#{error} Or maybe At.js doesn't have function #{func_name}"
# Delegate custom `jQueryEvent` to the inputor
# This function will ... | CoffeeScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 4f1e7ff9407f447ce0ddff91f73e7a3fe9f2b06a | 5,250 | https://github.com/ichord/At.js/blob/4f1e7ff9407f447ce0ddff91f73e7a3fe9f2b06a/src/controller.coffee | 1 | 50 |
ichord/At.js:src/controller.coffee:2:raw_corpus | raw_corpus | event_name = if alias then "#{name}-#{alias}.atwho" else "#{name}.atwho"
@$inputor.trigger event_name, data
# Get callback either in settings which was set by plugin user or in default callbacks list.
#
# @param func_name [String] callback's name
# @return [Function] The callback.
callbacks: (func_name)-... | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 4f1e7ff9407f447ce0ddff91f73e7a3fe9f2b06a | 5,250 | https://github.com/ichord/At.js/blob/4f1e7ff9407f447ce0ddff91f73e7a3fe9f2b06a/src/controller.coffee | 51 | 100 | ||
ichord/At.js:src/controller.coffee:2:completion | completion | event_name = if alias then "#{name}-#{alias}.atwho" else "#{name}.atwho"
@$inputor.trigger event_name, data
# Get callback either in settings which was set by plugin user or in default callbacks list.
#
# @param func_name [String] callback's name
# @return [Function] The callback.
callbacks: (func_name)-... | #
# @return [Hash] Info of the query. Look likes this: {'text': "hello", 'head_pos': 0, 'end_pos': 0}
catch_query: ->
content = this.content()
caret_pos = @$inputor.caret('pos', {iframe: @app.iframe})
subtext = content.slice(0, caret_pos)
query = this.callbacks("matcher").call(this, @at, subtext, t... | CoffeeScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 4f1e7ff9407f447ce0ddff91f73e7a3fe9f2b06a | 5,250 | https://github.com/ichord/At.js/blob/4f1e7ff9407f447ce0ddff91f73e7a3fe9f2b06a/src/controller.coffee | 51 | 100 |
ichord/At.js:src/controller.coffee:3:raw_corpus | raw_corpus | c = (@cur_rect ||= c) || c if @$inputor.attr('contentEditable') == 'true'
scale_bottom = if @app.document.selection then 0 else 2
{left: c.left, top: c.top, bottom: c.top + c.height + scale_bottom}
reset_rect: ->
@cur_rect = null if @$inputor.attr('contentEditable') == 'true'
mark_range: ->
if @$i... | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 4f1e7ff9407f447ce0ddff91f73e7a3fe9f2b06a | 5,250 | https://github.com/ichord/At.js/blob/4f1e7ff9407f447ce0ddff91f73e7a3fe9f2b06a/src/controller.coffee | 101 | 150 | ||
ichord/At.js:src/controller.coffee:3:completion | completion | c = (@cur_rect ||= c) || c if @$inputor.attr('contentEditable') == 'true'
scale_bottom = if @app.document.selection then 0 else 2
{left: c.left, top: c.top, bottom: c.top + c.height + scale_bottom}
reset_rect: ->
@cur_rect = null if @$inputor.attr('contentEditable') == 'true'
mark_range: ->
if @$i... | $inputor = @$inputor
wrapped_content = this.callbacks('inserting_wrapper').call this, $inputor, content, this.get_opt("suffix")
if $inputor.is('textarea, input')
source = $inputor.val()
start_str = source.slice 0, Math.max(@query.head_pos - @at.length, 0)
text = "#{start_str}#{wrapped_conten... | CoffeeScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 4f1e7ff9407f447ce0ddff91f73e7a3fe9f2b06a | 5,250 | https://github.com/ichord/At.js/blob/4f1e7ff9407f447ce0ddff91f73e7a3fe9f2b06a/src/controller.coffee | 101 | 150 |
ichord/At.js:src/controller.coffee:4:raw_corpus | raw_corpus | # REF: http://stackoverflow.com/questions/15535933/ie-html1114-error-with-custom-cleditor-button?answertab=votes#tab-top
range.moveStart('character', @query.end_pos - @query.head_pos - @at.length)
range.pasteHTML wrapped_content
range.collapse(false)
range.select()
$inputor.focus() if not $... | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 4f1e7ff9407f447ce0ddff91f73e7a3fe9f2b06a | 5,250 | https://github.com/ichord/At.js/blob/4f1e7ff9407f447ce0ddff91f73e7a3fe9f2b06a/src/controller.coffee | 151 | 172 | ||
ichord/At.js:src/controller.coffee:4:completion | completion | # REF: http://stackoverflow.com/questions/15535933/ie-html1114-error-with-custom-cleditor-button?answertab=votes#tab-top
range.moveStart('character', @query.end_pos - @query.head_pos - @at.length)
range.pasteHTML wrapped_content
range.collapse(false)
range.select()
$inputor.focus() if not $... | render_view: (data) ->
search_key = this.get_opt("search_key")
data = this.callbacks("sorter").call(this, @query.text, data[0..1000] , search_key)
@view.render data[0...this.get_opt('limit')]
# Searching!
look_up: ->
return if not (query = this.catch_query())
_callback = (data) -> if data and d... | CoffeeScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 4f1e7ff9407f447ce0ddff91f73e7a3fe9f2b06a | 5,250 | https://github.com/ichord/At.js/blob/4f1e7ff9407f447ce0ddff91f73e7a3fe9f2b06a/src/controller.coffee | 151 | 172 |
ichord/At.js:src/controller.coffee:3:raw_corpus | raw_corpus | c = (@cur_rect ||= c) || c if @$inputor.attr('contentEditable') == 'true'
scale_bottom = if @app.document.selection then 0 else 2
{left: c.left, top: c.top, bottom: c.top + c.height + scale_bottom}
reset_rect: ->
@cur_rect = null if @$inputor.attr('contentEditable') == 'true'
mark_range: ->
if @$i... | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 70057691aff1afd7d2758a638437e75a0b3185e4 | 5,250 | https://github.com/ichord/At.js/blob/70057691aff1afd7d2758a638437e75a0b3185e4/src/controller.coffee | 101 | 150 | ||
ichord/At.js:src/controller.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
c = (@cur_rect ||= c) || c if @$inputor.attr('contentEditable') == 'true'
scale_bottom = if @app.document.selection then 0 else 2
{left: c.left, top: c.top, bottom: c.top + c.height + scale_bottom}
reset_rect: ->
@cur_rect = null if @$inputor.attr(... | var c, scale_bottom;
c = (this.cur_rect || (this.cur_rect = c)) || c(this.$inputor.attr('contentEditable') === 'true' ? (scale_bottom = this.app.document.selection ? 0 : 2, {
left: c.left,
top: c.top,
bottom: c.top + c.height + scale_bottom
}) : void 0);
({
reset_rect: function() {
if (this.$inputor.attr(... | CoffeeScript | JavaScript | ichord/At.js | src/controller.coffee | MIT | 70057691aff1afd7d2758a638437e75a0b3185e4 | 5,250 | https://github.com/ichord/At.js/blob/70057691aff1afd7d2758a638437e75a0b3185e4/src/controller.coffee | 101 | 150 |
ichord/At.js:src/controller.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var c, scale_bottom;
c = (this.cur_rect || (this.cur_rect = c)) || c(this.$inputor.attr('contentEditable') === 'true' ? (scale_bottom = this.app.document.selection ? 0 : 2, {
left: c.left,
top: c.top,
bottom: c.top + c.height + scale_bottom
}) : void 0);
({... | c = (@cur_rect ||= c) || c if @$inputor.attr('contentEditable') == 'true'
scale_bottom = if @app.document.selection then 0 else 2
{left: c.left, top: c.top, bottom: c.top + c.height + scale_bottom}
reset_rect: ->
@cur_rect = null if @$inputor.attr('contentEditable') == 'true'
mark_range: ->
if @$i... | JavaScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 70057691aff1afd7d2758a638437e75a0b3185e4 | 5,250 | https://github.com/ichord/At.js/blob/70057691aff1afd7d2758a638437e75a0b3185e4/src/controller.coffee | 101 | 150 |
ichord/At.js:src/controller.coffee:3:completion | completion | c = (@cur_rect ||= c) || c if @$inputor.attr('contentEditable') == 'true'
scale_bottom = if @app.document.selection then 0 else 2
{left: c.left, top: c.top, bottom: c.top + c.height + scale_bottom}
reset_rect: ->
@cur_rect = null if @$inputor.attr('contentEditable') == 'true'
mark_range: ->
if @$i... | $inputor = @$inputor
wrapped_content = this.callbacks('inserting_wrapper').call this, $inputor, content, this.get_opt("suffix")
if $inputor.is('textarea, input')
source = $inputor.val()
start_str = source.slice 0, Math.max(@query.head_pos - @at.length, 0)
text = "#{start_str}#{wrapped_conten... | CoffeeScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 70057691aff1afd7d2758a638437e75a0b3185e4 | 5,250 | https://github.com/ichord/At.js/blob/70057691aff1afd7d2758a638437e75a0b3185e4/src/controller.coffee | 101 | 150 |
ichord/At.js:src/controller.coffee:4:raw_corpus | raw_corpus | range.pasteHTML wrapped_content
range.collapse(false)
range.select()
$inputor.focus() if not $inputor.is ':focus'
$inputor.change()
# Render list view
#
# @param data [Array] The data
render_view: (data) ->
search_key = this.get_opt("search_key")
data = this.callbacks("sorter").call... | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 70057691aff1afd7d2758a638437e75a0b3185e4 | 5,250 | https://github.com/ichord/At.js/blob/70057691aff1afd7d2758a638437e75a0b3185e4/src/controller.coffee | 151 | 170 | ||
ichord/At.js:src/controller.coffee:4:completion | completion | range.pasteHTML wrapped_content
range.collapse(false)
range.select()
$inputor.focus() if not $inputor.is ':focus'
$inputor.change()
# Render list view
#
# @param data [Array] The data
render_view: (data) -> | search_key = this.get_opt("search_key")
data = this.callbacks("sorter").call(this, @query.text, data[0..1000] , search_key)
@view.render data[0...this.get_opt('limit')]
# Searching!
look_up: ->
return if not (query = this.catch_query())
_callback = (data) -> if data and data.length > 0 then this.re... | CoffeeScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 70057691aff1afd7d2758a638437e75a0b3185e4 | 5,250 | https://github.com/ichord/At.js/blob/70057691aff1afd7d2758a638437e75a0b3185e4/src/controller.coffee | 151 | 170 |
ichord/At.js:src/controller.coffee:3:raw_corpus | raw_corpus | c = (@cur_rect ||= c) || c if @$inputor.attr('contentEditable') == 'true'
scale_bottom = if @app.document.selection then 0 else 2
{left: c.left, top: c.top, bottom: c.top + c.height + scale_bottom}
reset_rect: ->
@cur_rect = null if @$inputor.attr('contentEditable') == 'true'
mark_range: ->
if @$i... | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 1f13a168bb7b5dbf19f2159d7839a0d11448b75e | 5,250 | https://github.com/ichord/At.js/blob/1f13a168bb7b5dbf19f2159d7839a0d11448b75e/src/controller.coffee | 101 | 150 | ||
ichord/At.js:src/controller.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
c = (@cur_rect ||= c) || c if @$inputor.attr('contentEditable') == 'true'
scale_bottom = if @app.document.selection then 0 else 2
{left: c.left, top: c.top, bottom: c.top + c.height + scale_bottom}
reset_rect: ->
@cur_rect = null if @$inputor.attr(... | var c, scale_bottom;
c = (this.cur_rect || (this.cur_rect = c)) || c(this.$inputor.attr('contentEditable') === 'true' ? (scale_bottom = this.app.document.selection ? 0 : 2, {
left: c.left,
top: c.top,
bottom: c.top + c.height + scale_bottom
}) : void 0);
({
reset_rect: function() {
if (this.$inputor.attr(... | CoffeeScript | JavaScript | ichord/At.js | src/controller.coffee | MIT | 1f13a168bb7b5dbf19f2159d7839a0d11448b75e | 5,250 | https://github.com/ichord/At.js/blob/1f13a168bb7b5dbf19f2159d7839a0d11448b75e/src/controller.coffee | 101 | 150 |
ichord/At.js:src/controller.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var c, scale_bottom;
c = (this.cur_rect || (this.cur_rect = c)) || c(this.$inputor.attr('contentEditable') === 'true' ? (scale_bottom = this.app.document.selection ? 0 : 2, {
left: c.left,
top: c.top,
bottom: c.top + c.height + scale_bottom
}) : void 0);
({... | c = (@cur_rect ||= c) || c if @$inputor.attr('contentEditable') == 'true'
scale_bottom = if @app.document.selection then 0 else 2
{left: c.left, top: c.top, bottom: c.top + c.height + scale_bottom}
reset_rect: ->
@cur_rect = null if @$inputor.attr('contentEditable') == 'true'
mark_range: ->
if @$i... | JavaScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 1f13a168bb7b5dbf19f2159d7839a0d11448b75e | 5,250 | https://github.com/ichord/At.js/blob/1f13a168bb7b5dbf19f2159d7839a0d11448b75e/src/controller.coffee | 101 | 150 |
ichord/At.js:src/controller.coffee:3:completion | completion | c = (@cur_rect ||= c) || c if @$inputor.attr('contentEditable') == 'true'
scale_bottom = if @app.document.selection then 0 else 2
{left: c.left, top: c.top, bottom: c.top + c.height + scale_bottom}
reset_rect: ->
@cur_rect = null if @$inputor.attr('contentEditable') == 'true'
mark_range: ->
if @$i... | $inputor = @$inputor
if $inputor.attr('contentEditable') == 'true'
class_name = "atwho-view-flag atwho-view-flag-#{this.get_opt('alias') || @at}"
if (suffix = this.get_opt 'suffix') == " "
content_node = "#{content}<span contenteditable='false'> <span>"
else
content_node = ''... | CoffeeScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 1f13a168bb7b5dbf19f2159d7839a0d11448b75e | 5,250 | https://github.com/ichord/At.js/blob/1f13a168bb7b5dbf19f2159d7839a0d11448b75e/src/controller.coffee | 101 | 150 |
ichord/At.js:src/controller.coffee:4:raw_corpus | raw_corpus | range.setEnd(range.endContainer, range.endOffset)
range.deleteContents()
range.insertNode($insert_node[0])
range.collapse(false)
sel = @app.window.getSelection()
sel.removeAllRanges()
sel.addRange(range)
else if range = @ie8_range # IE < 9
# NOTE: have to add this <meta htt... | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 1f13a168bb7b5dbf19f2159d7839a0d11448b75e | 5,250 | https://github.com/ichord/At.js/blob/1f13a168bb7b5dbf19f2159d7839a0d11448b75e/src/controller.coffee | 151 | 182 | ||
ichord/At.js:src/controller.coffee:4:completion | completion | range.setEnd(range.endContainer, range.endOffset)
range.deleteContents()
range.insertNode($insert_node[0])
range.collapse(false)
sel = @app.window.getSelection()
sel.removeAllRanges()
sel.addRange(range)
else if range = @ie8_range # IE < 9
# NOTE: have to add this <meta htt... | $inputor.change()
# Render list view
#
# @param data [Array] The data
render_view: (data) ->
search_key = this.get_opt("search_key")
data = this.callbacks("sorter").call(this, @query.text, data[0..1000] , search_key)
@view.render data[0...this.get_opt('limit')]
# Searching!
look_up: ->
ret... | CoffeeScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 1f13a168bb7b5dbf19f2159d7839a0d11448b75e | 5,250 | https://github.com/ichord/At.js/blob/1f13a168bb7b5dbf19f2159d7839a0d11448b75e/src/controller.coffee | 151 | 182 |
ichord/At.js:src/controller.coffee:3:raw_corpus | raw_corpus | c = (@cur_rect ||= c) || c if @$inputor.attr('contentEditable') == 'true'
scale_bottom = if @app.document.selection then 0 else 2
{left: c.left, top: c.top, bottom: c.top + c.height + scale_bottom}
reset_rect: ->
@cur_rect = null if @$inputor.attr('contentEditable') == 'true'
mark_range: ->
if @$i... | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 4d3fb8fcebea1bee5314b2022f37a9554bbc8b57 | 5,250 | https://github.com/ichord/At.js/blob/4d3fb8fcebea1bee5314b2022f37a9554bbc8b57/src/controller.coffee | 101 | 150 | ||
ichord/At.js:src/controller.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
c = (@cur_rect ||= c) || c if @$inputor.attr('contentEditable') == 'true'
scale_bottom = if @app.document.selection then 0 else 2
{left: c.left, top: c.top, bottom: c.top + c.height + scale_bottom}
reset_rect: ->
@cur_rect = null if @$inputor.attr(... | var c, scale_bottom;
c = (this.cur_rect || (this.cur_rect = c)) || c(this.$inputor.attr('contentEditable') === 'true' ? (scale_bottom = this.app.document.selection ? 0 : 2, {
left: c.left,
top: c.top,
bottom: c.top + c.height + scale_bottom
}) : void 0);
({
reset_rect: function() {
if (this.$inputor.attr(... | CoffeeScript | JavaScript | ichord/At.js | src/controller.coffee | MIT | 4d3fb8fcebea1bee5314b2022f37a9554bbc8b57 | 5,250 | https://github.com/ichord/At.js/blob/4d3fb8fcebea1bee5314b2022f37a9554bbc8b57/src/controller.coffee | 101 | 150 |
ichord/At.js:src/controller.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var c, scale_bottom;
c = (this.cur_rect || (this.cur_rect = c)) || c(this.$inputor.attr('contentEditable') === 'true' ? (scale_bottom = this.app.document.selection ? 0 : 2, {
left: c.left,
top: c.top,
bottom: c.top + c.height + scale_bottom
}) : void 0);
({... | c = (@cur_rect ||= c) || c if @$inputor.attr('contentEditable') == 'true'
scale_bottom = if @app.document.selection then 0 else 2
{left: c.left, top: c.top, bottom: c.top + c.height + scale_bottom}
reset_rect: ->
@cur_rect = null if @$inputor.attr('contentEditable') == 'true'
mark_range: ->
if @$i... | JavaScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 4d3fb8fcebea1bee5314b2022f37a9554bbc8b57 | 5,250 | https://github.com/ichord/At.js/blob/4d3fb8fcebea1bee5314b2022f37a9554bbc8b57/src/controller.coffee | 101 | 150 |
ichord/At.js:src/controller.coffee:3:completion | completion | c = (@cur_rect ||= c) || c if @$inputor.attr('contentEditable') == 'true'
scale_bottom = if @app.document.selection then 0 else 2
{left: c.left, top: c.top, bottom: c.top + c.height + scale_bottom}
reset_rect: ->
@cur_rect = null if @$inputor.attr('contentEditable') == 'true'
mark_range: ->
if @$i... | $inputor = @$inputor
if $inputor.attr('contentEditable') == 'true'
class_name = "atwho-view-flag atwho-view-flag-#{this.get_opt('alias') || @at}"
content_node = "#{content}<span contenteditable='false'> <span>"
insert_node = "<span contenteditable='false' class='#{class_name}'>#{content_node... | CoffeeScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 4d3fb8fcebea1bee5314b2022f37a9554bbc8b57 | 5,250 | https://github.com/ichord/At.js/blob/4d3fb8fcebea1bee5314b2022f37a9554bbc8b57/src/controller.coffee | 101 | 150 |
ichord/At.js:src/controller.coffee:4:raw_corpus | raw_corpus | range.collapse(false)
sel = @app.window.getSelection()
sel.removeAllRanges()
sel.addRange(range)
else if range = @ie8_range # IE < 9
# NOTE: have to add this <meta http-equiv="x-ua-compatible" content="IE=Edge"/> into <header>
# to make it work batter.
# REF: http://stacko... | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 4d3fb8fcebea1bee5314b2022f37a9554bbc8b57 | 5,250 | https://github.com/ichord/At.js/blob/4d3fb8fcebea1bee5314b2022f37a9554bbc8b57/src/controller.coffee | 151 | 179 | ||
ichord/At.js:src/controller.coffee:4:completion | completion | range.collapse(false)
sel = @app.window.getSelection()
sel.removeAllRanges()
sel.addRange(range)
else if range = @ie8_range # IE < 9
# NOTE: have to add this <meta http-equiv="x-ua-compatible" content="IE=Edge"/> into <header>
# to make it work batter.
# REF: http://stacko... | # Render list view
#
# @param data [Array] The data
render_view: (data) ->
search_key = this.get_opt("search_key")
data = this.callbacks("sorter").call(this, @query.text, data[0..1000] , search_key)
@view.render data[0...this.get_opt('limit')]
# Searching!
look_up: ->
return if not (query = t... | CoffeeScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 4d3fb8fcebea1bee5314b2022f37a9554bbc8b57 | 5,250 | https://github.com/ichord/At.js/blob/4d3fb8fcebea1bee5314b2022f37a9554bbc8b57/src/controller.coffee | 151 | 179 |
ichord/At.js:src/controller.coffee:2:raw_corpus | raw_corpus | event_name = if alias then "#{name}-#{alias}.atwho" else "#{name}.atwho"
@$inputor.trigger event_name, data
# Get callback either in settings which was set by plugin user or in default callbacks list.
#
# @param func_name [String] callback's name
# @return [Function] The callback.
callbacks: (func_name)-... | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 0a6433a61c66fa68a8264e1ffa871fa108c37eb6 | 5,250 | https://github.com/ichord/At.js/blob/0a6433a61c66fa68a8264e1ffa871fa108c37eb6/src/controller.coffee | 51 | 100 | ||
ichord/At.js:src/controller.coffee:2:completion | completion | event_name = if alias then "#{name}-#{alias}.atwho" else "#{name}.atwho"
@$inputor.trigger event_name, data
# Get callback either in settings which was set by plugin user or in default callbacks list.
#
# @param func_name [String] callback's name
# @return [Function] The callback.
callbacks: (func_name)-... | #
# @return [Hash] Info of the query. Look likes this: {'text': "hello", 'head_pos': 0, 'end_pos': 0}
catch_query: ->
content = this.content()
caret_pos = @$inputor.caret('pos')
subtext = content.slice(0,caret_pos)
query = this.callbacks("matcher").call(this, @at, subtext, this.get_opt('start_with_... | CoffeeScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 0a6433a61c66fa68a8264e1ffa871fa108c37eb6 | 5,250 | https://github.com/ichord/At.js/blob/0a6433a61c66fa68a8264e1ffa871fa108c37eb6/src/controller.coffee | 51 | 100 |
ichord/At.js:src/controller.coffee:3:raw_corpus | raw_corpus | c = (@cur_rect ||= c) || c if @$inputor.attr('contentEditable') == 'true'
scale_bottom = if @app.document.selection then 0 else 2
{left: c.left, top: c.top, bottom: c.top + c.height + scale_bottom}
reset_rect: ->
@cur_rect = null if @$inputor.attr('contentEditable') == 'true'
mark_range: ->
if @$i... | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 0a6433a61c66fa68a8264e1ffa871fa108c37eb6 | 5,250 | https://github.com/ichord/At.js/blob/0a6433a61c66fa68a8264e1ffa871fa108c37eb6/src/controller.coffee | 101 | 150 | ||
ichord/At.js:src/controller.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
c = (@cur_rect ||= c) || c if @$inputor.attr('contentEditable') == 'true'
scale_bottom = if @app.document.selection then 0 else 2
{left: c.left, top: c.top, bottom: c.top + c.height + scale_bottom}
reset_rect: ->
@cur_rect = null if @$inputor.attr(... | var c, scale_bottom;
c = (this.cur_rect || (this.cur_rect = c)) || c(this.$inputor.attr('contentEditable') === 'true' ? (scale_bottom = this.app.document.selection ? 0 : 2, {
left: c.left,
top: c.top,
bottom: c.top + c.height + scale_bottom
}) : void 0);
({
reset_rect: function() {
if (this.$inputor.attr(... | CoffeeScript | JavaScript | ichord/At.js | src/controller.coffee | MIT | 0a6433a61c66fa68a8264e1ffa871fa108c37eb6 | 5,250 | https://github.com/ichord/At.js/blob/0a6433a61c66fa68a8264e1ffa871fa108c37eb6/src/controller.coffee | 101 | 150 |
ichord/At.js:src/controller.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var c, scale_bottom;
c = (this.cur_rect || (this.cur_rect = c)) || c(this.$inputor.attr('contentEditable') === 'true' ? (scale_bottom = this.app.document.selection ? 0 : 2, {
left: c.left,
top: c.top,
bottom: c.top + c.height + scale_bottom
}) : void 0);
({... | c = (@cur_rect ||= c) || c if @$inputor.attr('contentEditable') == 'true'
scale_bottom = if @app.document.selection then 0 else 2
{left: c.left, top: c.top, bottom: c.top + c.height + scale_bottom}
reset_rect: ->
@cur_rect = null if @$inputor.attr('contentEditable') == 'true'
mark_range: ->
if @$i... | JavaScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 0a6433a61c66fa68a8264e1ffa871fa108c37eb6 | 5,250 | https://github.com/ichord/At.js/blob/0a6433a61c66fa68a8264e1ffa871fa108c37eb6/src/controller.coffee | 101 | 150 |
ichord/At.js:src/controller.coffee:3:completion | completion | c = (@cur_rect ||= c) || c if @$inputor.attr('contentEditable') == 'true'
scale_bottom = if @app.document.selection then 0 else 2
{left: c.left, top: c.top, bottom: c.top + c.height + scale_bottom}
reset_rect: ->
@cur_rect = null if @$inputor.attr('contentEditable') == 'true'
mark_range: ->
if @$i... | $inputor = @$inputor
if $inputor.attr('contentEditable') == 'true'
class_name = "atwho-view-flag atwho-view-flag-#{this.get_opt('alias') || @at}"
content_node = "#{content}<span contenteditable='false'> <span>"
insert_node = "<span contenteditable='false' class='#{class_name}'>#{content_node... | CoffeeScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 0a6433a61c66fa68a8264e1ffa871fa108c37eb6 | 5,250 | https://github.com/ichord/At.js/blob/0a6433a61c66fa68a8264e1ffa871fa108c37eb6/src/controller.coffee | 101 | 150 |
ichord/At.js:src/controller.coffee:3:raw_corpus | raw_corpus | c = (@cur_rect ||= c) || c if @$inputor.attr('contentEditable') == 'true'
scale_bottom = if @app.document.selection then 0 else 2
{left: c.left, top: c.top, bottom: c.top + c.height + scale_bottom}
reset_rect: ->
@cur_rect = null if @$inputor.attr('contentEditable') == 'true'
mark_range: ->
if @$i... | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | a0b5a6f736b8ac35765dc7b3051dce8783c755af | 5,250 | https://github.com/ichord/At.js/blob/a0b5a6f736b8ac35765dc7b3051dce8783c755af/src/controller.coffee | 101 | 150 | ||
ichord/At.js:src/controller.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
c = (@cur_rect ||= c) || c if @$inputor.attr('contentEditable') == 'true'
scale_bottom = if @app.document.selection then 0 else 2
{left: c.left, top: c.top, bottom: c.top + c.height + scale_bottom}
reset_rect: ->
@cur_rect = null if @$inputor.attr(... | var c, scale_bottom;
c = (this.cur_rect || (this.cur_rect = c)) || c(this.$inputor.attr('contentEditable') === 'true' ? (scale_bottom = this.app.document.selection ? 0 : 2, {
left: c.left,
top: c.top,
bottom: c.top + c.height + scale_bottom
}) : void 0);
({
reset_rect: function() {
if (this.$inputor.attr(... | CoffeeScript | JavaScript | ichord/At.js | src/controller.coffee | MIT | a0b5a6f736b8ac35765dc7b3051dce8783c755af | 5,250 | https://github.com/ichord/At.js/blob/a0b5a6f736b8ac35765dc7b3051dce8783c755af/src/controller.coffee | 101 | 150 |
ichord/At.js:src/controller.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var c, scale_bottom;
c = (this.cur_rect || (this.cur_rect = c)) || c(this.$inputor.attr('contentEditable') === 'true' ? (scale_bottom = this.app.document.selection ? 0 : 2, {
left: c.left,
top: c.top,
bottom: c.top + c.height + scale_bottom
}) : void 0);
({... | c = (@cur_rect ||= c) || c if @$inputor.attr('contentEditable') == 'true'
scale_bottom = if @app.document.selection then 0 else 2
{left: c.left, top: c.top, bottom: c.top + c.height + scale_bottom}
reset_rect: ->
@cur_rect = null if @$inputor.attr('contentEditable') == 'true'
mark_range: ->
if @$i... | JavaScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | a0b5a6f736b8ac35765dc7b3051dce8783c755af | 5,250 | https://github.com/ichord/At.js/blob/a0b5a6f736b8ac35765dc7b3051dce8783c755af/src/controller.coffee | 101 | 150 |
ichord/At.js:src/controller.coffee:3:completion | completion | c = (@cur_rect ||= c) || c if @$inputor.attr('contentEditable') == 'true'
scale_bottom = if @app.document.selection then 0 else 2
{left: c.left, top: c.top, bottom: c.top + c.height + scale_bottom}
reset_rect: ->
@cur_rect = null if @$inputor.attr('contentEditable') == 'true'
mark_range: ->
if @$i... | $inputor = @$inputor
if $inputor.attr('contentEditable') == 'true'
class_name = "atwho-view-flag atwho-view-flag-#{this.get_opt('alias') || @at}"
content_node = "#{content}<span contenteditable='false'> <span>"
insert_node = "<span contenteditable='false' class='#{class_name}'>#{content_node... | CoffeeScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | a0b5a6f736b8ac35765dc7b3051dce8783c755af | 5,250 | https://github.com/ichord/At.js/blob/a0b5a6f736b8ac35765dc7b3051dce8783c755af/src/controller.coffee | 101 | 150 |
ichord/At.js:src/controller.coffee:2:raw_corpus | raw_corpus | event_name = if alias then "#{name}-#{alias}.atwho" else "#{name}.atwho"
@$inputor.trigger event_name, data
# Get callback either in settings which was set by plugin user or in default callbacks list.
#
# @param func_name [String] callback's name
# @return [Function] The callback.
callbacks: (func_name)-... | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 3134ece10fdcf7e1bcdc4fca7891fa9d3d412f8a | 5,250 | https://github.com/ichord/At.js/blob/3134ece10fdcf7e1bcdc4fca7891fa9d3d412f8a/src/controller.coffee | 51 | 100 | ||
ichord/At.js:src/controller.coffee:2:completion | completion | event_name = if alias then "#{name}-#{alias}.atwho" else "#{name}.atwho"
@$inputor.trigger event_name, data
# Get callback either in settings which was set by plugin user or in default callbacks list.
#
# @param func_name [String] callback's name
# @return [Function] The callback.
callbacks: (func_name)-... | #
# @return [Hash] Info of the query. Look likes this: {'text': "hello", 'head_pos': 0, 'end_pos': 0}
catch_query: ->
content = this.content()
caret_pos = @$inputor.caret('pos')
subtext = content.slice(0,caret_pos)
query = this.callbacks("matcher").call(this, @at, subtext, this.get_opt('start_with_... | CoffeeScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 3134ece10fdcf7e1bcdc4fca7891fa9d3d412f8a | 5,250 | https://github.com/ichord/At.js/blob/3134ece10fdcf7e1bcdc4fca7891fa9d3d412f8a/src/controller.coffee | 51 | 100 |
ichord/At.js:src/controller.coffee:3:raw_corpus | raw_corpus | scale_bottom = if @app.document.selection then 0 else 2
{left: c.left, top: c.top, bottom: c.top + c.height + scale_bottom}
reset_rect: ->
@cur_rect = null if @$inputor.attr('contentEditable') == 'true'
mark_range: ->
if @$inputor.attr('contentEditable') == 'true'
@range = @app.window.getSelecti... | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 3134ece10fdcf7e1bcdc4fca7891fa9d3d412f8a | 5,250 | https://github.com/ichord/At.js/blob/3134ece10fdcf7e1bcdc4fca7891fa9d3d412f8a/src/controller.coffee | 101 | 150 | ||
ichord/At.js:src/controller.coffee:3:completion | completion | scale_bottom = if @app.document.selection then 0 else 2
{left: c.left, top: c.top, bottom: c.top + c.height + scale_bottom}
reset_rect: ->
@cur_rect = null if @$inputor.attr('contentEditable') == 'true'
mark_range: ->
if @$inputor.attr('contentEditable') == 'true'
@range = @app.window.getSelecti... | if $inputor.attr('contentEditable') == 'true'
class_name = "atwho-view-flag atwho-view-flag-#{this.get_opt('alias') || @at}"
content_node = "#{content}<span contenteditable='false'> <span>"
insert_node = "<span contenteditable='false' class='#{class_name}'>#{content_node}</span>"
$insert_no... | CoffeeScript | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 3134ece10fdcf7e1bcdc4fca7891fa9d3d412f8a | 5,250 | https://github.com/ichord/At.js/blob/3134ece10fdcf7e1bcdc4fca7891fa9d3d412f8a/src/controller.coffee | 101 | 150 |
ichord/At.js:src/controller.coffee:4:raw_corpus | raw_corpus | sel = @app.window.getSelection()
sel.removeAllRanges()
sel.addRange(range)
else if range = @ie8_range # IE < 9
# NOTE: have to add this <meta http-equiv="x-ua-compatible" content="IE=Edge"/> into <header>
# to make it work batter.
# REF: http://stackoverflow.com/questions/155359... | CoffeeScript | ichord/At.js | src/controller.coffee | MIT | 3134ece10fdcf7e1bcdc4fca7891fa9d3d412f8a | 5,250 | https://github.com/ichord/At.js/blob/3134ece10fdcf7e1bcdc4fca7891fa9d3d412f8a/src/controller.coffee | 151 | 178 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.