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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:1:raw_corpus | raw_corpus | # Bootstrap Tags
# Max Lahey
# Monday, November 12, 2012
# todos
# 1) make suggestions list scrollable
# 2) popovers for tag data
# 3) ajax for tags, suggestions, and restrictions
jQuery ->
$.tags = (element, options) ->
@defaults = {}
@suggestions = options.suggestions
@restrictTo = (if options.restr... | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | c9c0dddbf9e2b170fedaa3dc956d9724b6e78e25 | 543 | https://github.com/maxwells/bootstrap-tags/blob/c9c0dddbf9e2b170fedaa3dc956d9724b6e78e25/src/bootstrap-tags.coffee | 1 | 43 | ||
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# Bootstrap Tags
# Max Lahey
# Monday, November 12, 2012
# todos
# 1) make suggestions list scrollable
# 2) popovers for tag data
# 3) ajax for tags, suggestions, and restrictions
jQuery ->
$.tags = (element, options) ->
@defaults = {}
@suggestions ... | // Bootstrap Tags
// Max Lahey
// Monday, November 12, 2012
// todos
// 1) make suggestions list scrollable
// 2) popovers for tag data
// 3) ajax for tags, suggestions, and restrictions
jQuery(function() {
return $.tags = function(element, options) {
this.defaults = {};
this.suggestions = options.suggestion... | CoffeeScript | JavaScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | c9c0dddbf9e2b170fedaa3dc956d9724b6e78e25 | 543 | https://github.com/maxwells/bootstrap-tags/blob/c9c0dddbf9e2b170fedaa3dc956d9724b6e78e25/src/bootstrap-tags.coffee | 1 | 43 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// Bootstrap Tags
// Max Lahey
// Monday, November 12, 2012
// todos
// 1) make suggestions list scrollable
// 2) popovers for tag data
// 3) ajax for tags, suggestions, and restrictions
jQuery(function() {
return $.tags = function(element, options) {
this.d... | # Bootstrap Tags
# Max Lahey
# Monday, November 12, 2012
# todos
# 1) make suggestions list scrollable
# 2) popovers for tag data
# 3) ajax for tags, suggestions, and restrictions
jQuery ->
$.tags = (element, options) ->
@defaults = {}
@suggestions = options.suggestions
@restrictTo = (if options.restr... | JavaScript | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | c9c0dddbf9e2b170fedaa3dc956d9724b6e78e25 | 543 | https://github.com/maxwells/bootstrap-tags/blob/c9c0dddbf9e2b170fedaa3dc956d9724b6e78e25/src/bootstrap-tags.coffee | 1 | 43 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:1:completion | completion | # Bootstrap Tags
# Max Lahey
# Monday, November 12, 2012
# todos
# 1) make suggestions list scrollable
# 2) popovers for tag data
# 3) ajax for tags, suggestions, and restrictions
jQuery ->
$.tags = (element, options) ->
@defaults = {}
@suggestions = options.suggestions
@restrictTo = (if options.restr... | # add/remove methods
@removeTagClicked = (e) =>
if e.target.tagName == "A"
@removeTag e.target.previousSibling.textContent
$(e.target.parentNode).remove()
@removeLastTag = =>
el = $('.tag', @$element).last()
el.remove()
@removeTag @tagsArray[@tagsArray.length-1]
@re... | CoffeeScript | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | c9c0dddbf9e2b170fedaa3dc956d9724b6e78e25 | 543 | https://github.com/maxwells/bootstrap-tags/blob/c9c0dddbf9e2b170fedaa3dc956d9724b6e78e25/src/bootstrap-tags.coffee | 1 | 43 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:2:raw_corpus | raw_corpus | # toggles remove button color for a tag when moused over or out
@toggleCloseColor = (e) ->
tagAnchor = $ e.target
color = (if tagAnchor.css('color') == "rgb(255, 255, 255)" then "#bbb" else "#fff")
tagAnchor.css color:color
# Key handlers
@keyDownHandler = (e) =>
k = (if e.keyCode? ... | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | c9c0dddbf9e2b170fedaa3dc956d9724b6e78e25 | 543 | https://github.com/maxwells/bootstrap-tags/blob/c9c0dddbf9e2b170fedaa3dc956d9724b6e78e25/src/bootstrap-tags.coffee | 45 | 88 | ||
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# toggles remove button color for a tag when moused over or out
@toggleCloseColor = (e) ->
tagAnchor = $ e.target
color = (if tagAnchor.css('color') == "rgb(255, 255, 255)" then "#bbb" else "#fff")
tagAnchor.css color:color
# Key handle... | // toggles remove button color for a tag when moused over or out
this.toggleCloseColor = function(e) {
var color, tagAnchor;
tagAnchor = $(e.target);
color = (tagAnchor.css('color') === "rgb(255, 255, 255)" ? "#bbb" : "#fff");
return tagAnchor.css({
color: color
});
};
// Key handlers
this.keyDownHandler... | CoffeeScript | JavaScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | c9c0dddbf9e2b170fedaa3dc956d9724b6e78e25 | 543 | https://github.com/maxwells/bootstrap-tags/blob/c9c0dddbf9e2b170fedaa3dc956d9724b6e78e25/src/bootstrap-tags.coffee | 45 | 88 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// toggles remove button color for a tag when moused over or out
this.toggleCloseColor = function(e) {
var color, tagAnchor;
tagAnchor = $(e.target);
color = (tagAnchor.css('color') === "rgb(255, 255, 255)" ? "#bbb" : "#fff");
return tagAnchor.css({
col... | # toggles remove button color for a tag when moused over or out
@toggleCloseColor = (e) ->
tagAnchor = $ e.target
color = (if tagAnchor.css('color') == "rgb(255, 255, 255)" then "#bbb" else "#fff")
tagAnchor.css color:color
# Key handlers
@keyDownHandler = (e) =>
k = (if e.keyCode? ... | JavaScript | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | c9c0dddbf9e2b170fedaa3dc956d9724b6e78e25 | 543 | https://github.com/maxwells/bootstrap-tags/blob/c9c0dddbf9e2b170fedaa3dc956d9724b6e78e25/src/bootstrap-tags.coffee | 45 | 88 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:2:completion | completion | # toggles remove button color for a tag when moused over or out
@toggleCloseColor = (e) ->
tagAnchor = $ e.target
color = (if tagAnchor.css('color') == "rgb(255, 255, 255)" then "#bbb" else "#fff")
tagAnchor.css color:color
# Key handlers
@keyDownHandler = (e) =>
k = (if e.keyCode? ... | @makeSuggestions e, true
numSuggestions = @suggestionList.length
@suggestedIndex = (if @suggestedIndex < numSuggestions-1 then @suggestedIndex+1 else numSuggestions-1)
@selectSuggested @suggestedIndex
when 38 # up
@suggestedIndex = (if @suggestedIndex > 0 then @suggestedI... | CoffeeScript | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | c9c0dddbf9e2b170fedaa3dc956d9724b6e78e25 | 543 | https://github.com/maxwells/bootstrap-tags/blob/c9c0dddbf9e2b170fedaa3dc956d9724b6e78e25/src/bootstrap-tags.coffee | 45 | 88 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:3:raw_corpus | raw_corpus | @suggestedClicked = (e) =>
tag = e.target.textContent
if @suggestedIndex != -1
tag = @suggestionList[@suggestedIndex]
@addTag tag
@input.val ''
@makeSuggestions e, false
@input.focus() # return focus to input so user can continue typing
@keyUpHandler = (e) =>
k = (... | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | c9c0dddbf9e2b170fedaa3dc956d9724b6e78e25 | 543 | https://github.com/maxwells/bootstrap-tags/blob/c9c0dddbf9e2b170fedaa3dc956d9724b6e78e25/src/bootstrap-tags.coffee | 90 | 129 | ||
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
@suggestedClicked = (e) =>
tag = e.target.textContent
if @suggestedIndex != -1
tag = @suggestionList[@suggestedIndex]
@addTag tag
@input.val ''
@makeSuggestions e, false
@input.focus() # return focus to input so user ca... | this.suggestedClicked = (e) => {
var tag;
tag = e.target.textContent;
if (this.suggestedIndex !== -1) {
tag = this.suggestionList[this.suggestedIndex];
}
this.addTag(tag);
this.input.val('');
this.makeSuggestions(e, false);
return this.input.focus(); // return focus to input so user can continue typ... | CoffeeScript | JavaScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | c9c0dddbf9e2b170fedaa3dc956d9724b6e78e25 | 543 | https://github.com/maxwells/bootstrap-tags/blob/c9c0dddbf9e2b170fedaa3dc956d9724b6e78e25/src/bootstrap-tags.coffee | 90 | 129 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
this.suggestedClicked = (e) => {
var tag;
tag = e.target.textContent;
if (this.suggestedIndex !== -1) {
tag = this.suggestionList[this.suggestedIndex];
}
this.addTag(tag);
this.input.val('');
this.makeSuggestions(e, false);
return this.input.foc... | @suggestedClicked = (e) =>
tag = e.target.textContent
if @suggestedIndex != -1
tag = @suggestionList[@suggestedIndex]
@addTag tag
@input.val ''
@makeSuggestions e, false
@input.focus() # return focus to input so user can continue typing
@keyUpHandler = (e) =>
k = (... | JavaScript | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | c9c0dddbf9e2b170fedaa3dc956d9724b6e78e25 | 543 | https://github.com/maxwells/bootstrap-tags/blob/c9c0dddbf9e2b170fedaa3dc956d9724b6e78e25/src/bootstrap-tags.coffee | 90 | 129 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:3:completion | completion | @suggestedClicked = (e) =>
tag = e.target.textContent
if @suggestedIndex != -1
tag = @suggestionList[@suggestedIndex]
@addTag tag
@input.val ''
@makeSuggestions e, false
@input.focus() # return focus to input so user can continue typing
@keyUpHandler = (e) =>
k = (... | @selectSuggestedMousedOut = (e) =>
$(e.target).removeClass('tags-suggestion-highlighted')
@selectSuggested = (i) => # shows the provided index of suggestion list for this element as highlighted (exclusion of others)
$('.tags-suggestion').removeClass('tags-suggestion-highlighted')
tagElement = $('... | CoffeeScript | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | c9c0dddbf9e2b170fedaa3dc956d9724b6e78e25 | 543 | https://github.com/maxwells/bootstrap-tags/blob/c9c0dddbf9e2b170fedaa3dc956d9724b6e78e25/src/bootstrap-tags.coffee | 90 | 129 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:4:raw_corpus | raw_corpus | @renderTags = (tags) =>
tagList = $('.tags',@$element)
tagList.html('')
$.each tags, (i, tag) =>
tag = $(@formatTag i, tag)
$('a', tag).click @removeTagClicked
$('a', tag).mouseover @toggleCloseColor
$('a', tag).mouseout @toggleCloseColor
tagList.append tag
... | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | c9c0dddbf9e2b170fedaa3dc956d9724b6e78e25 | 543 | https://github.com/maxwells/bootstrap-tags/blob/c9c0dddbf9e2b170fedaa3dc956d9724b6e78e25/src/bootstrap-tags.coffee | 131 | 162 | ||
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
@renderTags = (tags) =>
tagList = $('.tags',@$element)
tagList.html('')
$.each tags, (i, tag) =>
tag = $(@formatTag i, tag)
$('a', tag).click @removeTagClicked
$('a', tag).mouseover @toggleCloseColor
$('a', tag).m... | this.renderTags = (tags) => {
var tagList;
tagList = $('.tags', this.$element);
tagList.html('');
$.each(tags, (i, tag) => {
tag = $(this.formatTag(i, tag));
$('a', tag).click(this.removeTagClicked);
$('a', tag).mouseover(this.toggleCloseColor);
$('a', tag).mouseout(this.toggleCloseColor);
r... | CoffeeScript | JavaScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | c9c0dddbf9e2b170fedaa3dc956d9724b6e78e25 | 543 | https://github.com/maxwells/bootstrap-tags/blob/c9c0dddbf9e2b170fedaa3dc956d9724b6e78e25/src/bootstrap-tags.coffee | 131 | 162 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
this.renderTags = (tags) => {
var tagList;
tagList = $('.tags', this.$element);
tagList.html('');
$.each(tags, (i, tag) => {
tag = $(this.formatTag(i, tag));
$('a', tag).click(this.removeTagClicked);
$('a', tag).mouseover(this.toggleCloseColor);... | @renderTags = (tags) =>
tagList = $('.tags',@$element)
tagList.html('')
$.each tags, (i, tag) =>
tag = $(@formatTag i, tag)
$('a', tag).click @removeTagClicked
$('a', tag).mouseover @toggleCloseColor
$('a', tag).mouseout @toggleCloseColor
tagList.append tag
... | JavaScript | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | c9c0dddbf9e2b170fedaa3dc956d9724b6e78e25 | 543 | https://github.com/maxwells/bootstrap-tags/blob/c9c0dddbf9e2b170fedaa3dc956d9724b6e78e25/src/bootstrap-tags.coffee | 131 | 162 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:4:completion | completion | @renderTags = (tags) =>
tagList = $('.tags',@$element)
tagList.html('')
$.each tags, (i, tag) =>
tag = $(@formatTag i, tag)
$('a', tag).click @removeTagClicked
$('a', tag).mouseover @toggleCloseColor
$('a', tag).mouseout @toggleCloseColor
tagList.append tag
... | @tagsArray = @tagData.split ','
@input = $ "<input class='tags-input'>"
@input.keydown @keyDownHandler
@input.keyup @keyUpHandler
@$element.append @input
@$suggestionList = $ '<ul class="tags-suggestion-list"></ul>'
@$element.append @$suggestionList
@renderTags @tagsArray
... | CoffeeScript | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | c9c0dddbf9e2b170fedaa3dc956d9724b6e78e25 | 543 | https://github.com/maxwells/bootstrap-tags/blob/c9c0dddbf9e2b170fedaa3dc956d9724b6e78e25/src/bootstrap-tags.coffee | 131 | 162 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:1:raw_corpus | raw_corpus | # Bootstrap Tags
# Max Lahey
# Monday, November 12, 2012
jQuery ->
$.tags = (element, options) ->
@defaults = {}
@suggestions = options.suggestions
@restrictTo = (if options.restrictTo? then options.restrictTo.concat @suggestions else false)
@$element = $ element
# add/remove methods
@rem... | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | 9b20eaf2ab0cae86eff578ad1526aef1095a3a78 | 543 | https://github.com/maxwells/bootstrap-tags/blob/9b20eaf2ab0cae86eff578ad1526aef1095a3a78/src/bootstrap-tags.coffee | 1 | 41 | ||
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# Bootstrap Tags
# Max Lahey
# Monday, November 12, 2012
jQuery ->
$.tags = (element, options) ->
@defaults = {}
@suggestions = options.suggestions
@restrictTo = (if options.restrictTo? then options.restrictTo.concat @suggestions else false)
... | // Bootstrap Tags
// Max Lahey
// Monday, November 12, 2012
jQuery(function() {
return $.tags = function(element, options) {
this.defaults = {};
this.suggestions = options.suggestions;
this.restrictTo = (options.restrictTo != null ? options.restrictTo.concat(this.suggestions) : false);
this.$element =... | CoffeeScript | JavaScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | 9b20eaf2ab0cae86eff578ad1526aef1095a3a78 | 543 | https://github.com/maxwells/bootstrap-tags/blob/9b20eaf2ab0cae86eff578ad1526aef1095a3a78/src/bootstrap-tags.coffee | 1 | 41 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// Bootstrap Tags
// Max Lahey
// Monday, November 12, 2012
jQuery(function() {
return $.tags = function(element, options) {
this.defaults = {};
this.suggestions = options.suggestions;
this.restrictTo = (options.restrictTo != null ? options.restrictTo... | # Bootstrap Tags
# Max Lahey
# Monday, November 12, 2012
jQuery ->
$.tags = (element, options) ->
@defaults = {}
@suggestions = options.suggestions
@restrictTo = (if options.restrictTo? then options.restrictTo.concat @suggestions else false)
@$element = $ element
# add/remove methods
@rem... | JavaScript | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | 9b20eaf2ab0cae86eff578ad1526aef1095a3a78 | 543 | https://github.com/maxwells/bootstrap-tags/blob/9b20eaf2ab0cae86eff578ad1526aef1095a3a78/src/bootstrap-tags.coffee | 1 | 41 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:1:completion | completion | # Bootstrap Tags
# Max Lahey
# Monday, November 12, 2012
jQuery ->
$.tags = (element, options) ->
@defaults = {}
@suggestions = options.suggestions
@restrictTo = (if options.restrictTo? then options.restrictTo.concat @suggestions else false)
@$element = $ element
# add/remove methods
@rem... | @removeLastTag = =>
el = $('.tag', @$element).last()
el.remove()
@removeTag @tags[@tags.length-1]
@removeTag = (tag) =>
@tags.splice(@tags.indexOf(tag), 1)
$('.tag-data', @$element).html @tags.join(',')
@renderTags @tags
@addTag = (tag) =>
if (@restrictTo == false or ... | CoffeeScript | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | 9b20eaf2ab0cae86eff578ad1526aef1095a3a78 | 543 | https://github.com/maxwells/bootstrap-tags/blob/9b20eaf2ab0cae86eff578ad1526aef1095a3a78/src/bootstrap-tags.coffee | 1 | 41 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:2:raw_corpus | raw_corpus | # Key handlers
@keyDownHandler = (e) =>
k = (if e.keyCode? then e.keyCode else e.which)
switch k
when 13 # enter
tag = e.target.value
if @suggestedIndex != -1
tag = @suggestionList[@suggestedIndex]
@addTag tag
e.target.value = ''
@re... | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | 9b20eaf2ab0cae86eff578ad1526aef1095a3a78 | 543 | https://github.com/maxwells/bootstrap-tags/blob/9b20eaf2ab0cae86eff578ad1526aef1095a3a78/src/bootstrap-tags.coffee | 43 | 88 | ||
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# Key handlers
@keyDownHandler = (e) =>
k = (if e.keyCode? then e.keyCode else e.which)
switch k
when 13 # enter
tag = e.target.value
if @suggestedIndex != -1
tag = @suggestionList[@suggestedIndex]
... | // Key handlers
this.keyDownHandler = (e) => {
var k, numSuggestions, tag;
k = (e.keyCode != null ? e.keyCode : e.which);
switch (k) {
case 13: // enter
tag = e.target.value;
if (this.suggestedIndex !== -1) {
tag = this.suggestionList[this.suggestedIndex];
}
this.addTag(tag);
... | CoffeeScript | JavaScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | 9b20eaf2ab0cae86eff578ad1526aef1095a3a78 | 543 | https://github.com/maxwells/bootstrap-tags/blob/9b20eaf2ab0cae86eff578ad1526aef1095a3a78/src/bootstrap-tags.coffee | 43 | 88 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// Key handlers
this.keyDownHandler = (e) => {
var k, numSuggestions, tag;
k = (e.keyCode != null ? e.keyCode : e.which);
switch (k) {
case 13: // enter
tag = e.target.value;
if (this.suggestedIndex !== -1) {
tag = this.suggestionList[... | # Key handlers
@keyDownHandler = (e) =>
k = (if e.keyCode? then e.keyCode else e.which)
switch k
when 13 # enter
tag = e.target.value
if @suggestedIndex != -1
tag = @suggestionList[@suggestedIndex]
@addTag tag
e.target.value = ''
@re... | JavaScript | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | 9b20eaf2ab0cae86eff578ad1526aef1095a3a78 | 543 | https://github.com/maxwells/bootstrap-tags/blob/9b20eaf2ab0cae86eff578ad1526aef1095a3a78/src/bootstrap-tags.coffee | 43 | 88 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:2:completion | completion | # Key handlers
@keyDownHandler = (e) =>
k = (if e.keyCode? then e.keyCode else e.which)
switch k
when 13 # enter
tag = e.target.value
if @suggestedIndex != -1
tag = @suggestionList[@suggestedIndex]
@addTag tag
e.target.value = ''
@re... | @selectSuggested @suggestedIndex
else
@makeSuggestions = (e, overrideLengthCheck) =>
val = (if e.target.value? then e.target.value else e.target.textContent)
@suggestedIndex = -1
@$suggestionList.html ''
@suggestionList = []
$.each @suggestions, (i, suggestion) =>
curr... | CoffeeScript | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | 9b20eaf2ab0cae86eff578ad1526aef1095a3a78 | 543 | https://github.com/maxwells/bootstrap-tags/blob/9b20eaf2ab0cae86eff578ad1526aef1095a3a78/src/bootstrap-tags.coffee | 43 | 88 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:3:raw_corpus | raw_corpus | @keyUpHandler = (e) =>
k = (if e.keyCode? then e.keyCode else e.which)
if (k != 40 and k != 38)
@makeSuggestions e, false
# display methods
@selectSuggestedMouseOver = (e) =>
$('.tags-suggestion').removeClass('tags-suggestion-highlighted')
$(e.target).addClass('tags-suggestion-h... | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | 9b20eaf2ab0cae86eff578ad1526aef1095a3a78 | 543 | https://github.com/maxwells/bootstrap-tags/blob/9b20eaf2ab0cae86eff578ad1526aef1095a3a78/src/bootstrap-tags.coffee | 90 | 132 | ||
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
@keyUpHandler = (e) =>
k = (if e.keyCode? then e.keyCode else e.which)
if (k != 40 and k != 38)
@makeSuggestions e, false
# display methods
@selectSuggestedMouseOver = (e) =>
$('.tags-suggestion').removeClass('tags-suggestion-hi... | this.keyUpHandler = (e) => {
var k;
k = (e.keyCode != null ? e.keyCode : e.which);
if (k !== 40 && k !== 38) {
return this.makeSuggestions(e, false);
}
};
// display methods
this.selectSuggestedMouseOver = (e) => {
$('.tags-suggestion').removeClass('tags-suggestion-highlighted');
$(e.target).addClass('... | CoffeeScript | JavaScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | 9b20eaf2ab0cae86eff578ad1526aef1095a3a78 | 543 | https://github.com/maxwells/bootstrap-tags/blob/9b20eaf2ab0cae86eff578ad1526aef1095a3a78/src/bootstrap-tags.coffee | 90 | 132 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
this.keyUpHandler = (e) => {
var k;
k = (e.keyCode != null ? e.keyCode : e.which);
if (k !== 40 && k !== 38) {
return this.makeSuggestions(e, false);
}
};
// display methods
this.selectSuggestedMouseOver = (e) => {
$('.tags-suggestion').removeClass('... | @keyUpHandler = (e) =>
k = (if e.keyCode? then e.keyCode else e.which)
if (k != 40 and k != 38)
@makeSuggestions e, false
# display methods
@selectSuggestedMouseOver = (e) =>
$('.tags-suggestion').removeClass('tags-suggestion-highlighted')
$(e.target).addClass('tags-suggestion-h... | JavaScript | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | 9b20eaf2ab0cae86eff578ad1526aef1095a3a78 | 543 | https://github.com/maxwells/bootstrap-tags/blob/9b20eaf2ab0cae86eff578ad1526aef1095a3a78/src/bootstrap-tags.coffee | 90 | 132 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:3:completion | completion | @keyUpHandler = (e) =>
k = (if e.keyCode? then e.keyCode else e.which)
if (k != 40 and k != 38)
@makeSuggestions e, false
# display methods
@selectSuggestedMouseOver = (e) =>
$('.tags-suggestion').removeClass('tags-suggestion-highlighted')
$(e.target).addClass('tags-suggestion-h... | @adjustInputPosition = =>
tagElement = $('.tag', @$element).last()
tagPosition = tagElement.position()
pLeft = if tagPosition? then tagPosition.left + tagElement.width() else 0
pTop = if tagPosition? then tagPosition.top else 0
$('.tags-input', @$element).css
paddingLeft : pLeft
... | CoffeeScript | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | 9b20eaf2ab0cae86eff578ad1526aef1095a3a78 | 543 | https://github.com/maxwells/bootstrap-tags/blob/9b20eaf2ab0cae86eff578ad1526aef1095a3a78/src/bootstrap-tags.coffee | 90 | 132 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:4:raw_corpus | raw_corpus | @formatTag = (i, tag) ->
markup = "<div id='tag_"+i+"' class='tag'><span id='label_tag_"+i+"' class='label label-inverse'>"+tag+"<a id='close_tag_"+i+"'> X</a></span></div>"
@init = ->
@tags = $('.tag-data', @$element).html().split ','
@input = $ "<input class='tags-input'>"
@$element.appen... | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | 9b20eaf2ab0cae86eff578ad1526aef1095a3a78 | 543 | https://github.com/maxwells/bootstrap-tags/blob/9b20eaf2ab0cae86eff578ad1526aef1095a3a78/src/bootstrap-tags.coffee | 134 | 153 | ||
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
@formatTag = (i, tag) ->
markup = "<div id='tag_"+i+"' class='tag'><span id='label_tag_"+i+"' class='label label-inverse'>"+tag+"<a id='close_tag_"+i+"'> X</a></span></div>"
@init = ->
@tags = $('.tag-data', @$element).html().split ','
@inp... | this.formatTag = function(i, tag) {
var markup;
return markup = "<div id='tag_" + i + "' class='tag'><span id='label_tag_" + i + "' class='label label-inverse'>" + tag + "<a id='close_tag_" + i + "'> X</a></span></div>";
};
this.init = function() {
this.tags = $('.tag-data', this.$element).html().split(',');
t... | CoffeeScript | JavaScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | 9b20eaf2ab0cae86eff578ad1526aef1095a3a78 | 543 | https://github.com/maxwells/bootstrap-tags/blob/9b20eaf2ab0cae86eff578ad1526aef1095a3a78/src/bootstrap-tags.coffee | 134 | 153 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
this.formatTag = function(i, tag) {
var markup;
return markup = "<div id='tag_" + i + "' class='tag'><span id='label_tag_" + i + "' class='label label-inverse'>" + tag + "<a id='close_tag_" + i + "'> X</a></span></div>";
};
this.init = function() {
this.tags... | @formatTag = (i, tag) ->
markup = "<div id='tag_"+i+"' class='tag'><span id='label_tag_"+i+"' class='label label-inverse'>"+tag+"<a id='close_tag_"+i+"'> X</a></span></div>"
@init = ->
@tags = $('.tag-data', @$element).html().split ','
@input = $ "<input class='tags-input'>"
@$element.appen... | JavaScript | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | 9b20eaf2ab0cae86eff578ad1526aef1095a3a78 | 543 | https://github.com/maxwells/bootstrap-tags/blob/9b20eaf2ab0cae86eff578ad1526aef1095a3a78/src/bootstrap-tags.coffee | 134 | 153 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:4:completion | completion | @formatTag = (i, tag) ->
markup = "<div id='tag_"+i+"' class='tag'><span id='label_tag_"+i+"' class='label label-inverse'>"+tag+"<a id='close_tag_"+i+"'> X</a></span></div>"
@init = ->
@tags = $('.tag-data', @$element).html().split ','
@input = $ "<input class='tags-input'>"
@$element.appen... | @input.keydown @keyDownHandler
@input.keyup @keyUpHandler
@init()
@
$.fn.tags = (options) ->
return this.each ->
tags = new $.tags this, options | CoffeeScript | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | 9b20eaf2ab0cae86eff578ad1526aef1095a3a78 | 543 | https://github.com/maxwells/bootstrap-tags/blob/9b20eaf2ab0cae86eff578ad1526aef1095a3a78/src/bootstrap-tags.coffee | 134 | 153 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:2:raw_corpus | raw_corpus | # Key handlers
@keyDownHandler = (e) =>
k = (if e.keyCode? then e.keyCode else e.which)
switch k
when 13 # enter
tag = e.target.value
if @suggestedIndex != -1
tag = @suggestionList[@suggestedIndex]
@addTag tag
e.target.value = ''
@re... | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | 4f47b62e5e03a54a4af127d8d8b809adfe42f602 | 543 | https://github.com/maxwells/bootstrap-tags/blob/4f47b62e5e03a54a4af127d8d8b809adfe42f602/src/bootstrap-tags.coffee | 43 | 87 | ||
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# Key handlers
@keyDownHandler = (e) =>
k = (if e.keyCode? then e.keyCode else e.which)
switch k
when 13 # enter
tag = e.target.value
if @suggestedIndex != -1
tag = @suggestionList[@suggestedIndex]
... | // Key handlers
this.keyDownHandler = (e) => {
var k, numSuggestions, tag;
k = (e.keyCode != null ? e.keyCode : e.which);
switch (k) {
case 13: // enter
tag = e.target.value;
if (this.suggestedIndex !== -1) {
tag = this.suggestionList[this.suggestedIndex];
}
this.addTag(tag);
... | CoffeeScript | JavaScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | 4f47b62e5e03a54a4af127d8d8b809adfe42f602 | 543 | https://github.com/maxwells/bootstrap-tags/blob/4f47b62e5e03a54a4af127d8d8b809adfe42f602/src/bootstrap-tags.coffee | 43 | 87 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// Key handlers
this.keyDownHandler = (e) => {
var k, numSuggestions, tag;
k = (e.keyCode != null ? e.keyCode : e.which);
switch (k) {
case 13: // enter
tag = e.target.value;
if (this.suggestedIndex !== -1) {
tag = this.suggestionList[... | # Key handlers
@keyDownHandler = (e) =>
k = (if e.keyCode? then e.keyCode else e.which)
switch k
when 13 # enter
tag = e.target.value
if @suggestedIndex != -1
tag = @suggestionList[@suggestedIndex]
@addTag tag
e.target.value = ''
@re... | JavaScript | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | 4f47b62e5e03a54a4af127d8d8b809adfe42f602 | 543 | https://github.com/maxwells/bootstrap-tags/blob/4f47b62e5e03a54a4af127d8d8b809adfe42f602/src/bootstrap-tags.coffee | 43 | 87 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:2:completion | completion | # Key handlers
@keyDownHandler = (e) =>
k = (if e.keyCode? then e.keyCode else e.which)
switch k
when 13 # enter
tag = e.target.value
if @suggestedIndex != -1
tag = @suggestionList[@suggestedIndex]
@addTag tag
e.target.value = ''
@re... | @suggestedIndex = (if @suggestedIndex > 0 then @suggestedIndex-1 else 0)
@selectSuggested @suggestedIndex
else
@makeSuggestions = (e, overrideLengthCheck) =>
val = (if e.target.value? then e.target.value else e.target.textContent)
@suggestedIndex = -1
@$suggestionList.html ''
... | CoffeeScript | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | 4f47b62e5e03a54a4af127d8d8b809adfe42f602 | 543 | https://github.com/maxwells/bootstrap-tags/blob/4f47b62e5e03a54a4af127d8d8b809adfe42f602/src/bootstrap-tags.coffee | 43 | 87 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:1:raw_corpus | raw_corpus | # Bootstrap Tags
# Max Lahey
# Monday, November 12, 2012
jQuery ->
$.tags = (element, options) ->
@defaults = {}
@suggestions = options.suggestions
@$element = $ element
# add/remove methods
@removeTagClicked = (e) =>
if e.target.tagName == "A"
@removeTag e.target.previousSiblin... | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | ae0cd12270696c44895fd5c797a2501b13cd77fe | 543 | https://github.com/maxwells/bootstrap-tags/blob/ae0cd12270696c44895fd5c797a2501b13cd77fe/src/bootstrap-tags.coffee | 1 | 39 | ||
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# Bootstrap Tags
# Max Lahey
# Monday, November 12, 2012
jQuery ->
$.tags = (element, options) ->
@defaults = {}
@suggestions = options.suggestions
@$element = $ element
# add/remove methods
@removeTagClicked = (e) =>
if e.target.... | // Bootstrap Tags
// Max Lahey
// Monday, November 12, 2012
jQuery(function() {
return $.tags = function(element, options) {
this.defaults = {};
this.suggestions = options.suggestions;
this.$element = $(element);
// add/remove methods
this.removeTagClicked = (e) => {
if (e.target.tagName ===... | CoffeeScript | JavaScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | ae0cd12270696c44895fd5c797a2501b13cd77fe | 543 | https://github.com/maxwells/bootstrap-tags/blob/ae0cd12270696c44895fd5c797a2501b13cd77fe/src/bootstrap-tags.coffee | 1 | 39 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// Bootstrap Tags
// Max Lahey
// Monday, November 12, 2012
jQuery(function() {
return $.tags = function(element, options) {
this.defaults = {};
this.suggestions = options.suggestions;
this.$element = $(element);
// add/remove methods
this.rem... | # Bootstrap Tags
# Max Lahey
# Monday, November 12, 2012
jQuery ->
$.tags = (element, options) ->
@defaults = {}
@suggestions = options.suggestions
@$element = $ element
# add/remove methods
@removeTagClicked = (e) =>
if e.target.tagName == "A"
@removeTag e.target.previousSiblin... | JavaScript | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | ae0cd12270696c44895fd5c797a2501b13cd77fe | 543 | https://github.com/maxwells/bootstrap-tags/blob/ae0cd12270696c44895fd5c797a2501b13cd77fe/src/bootstrap-tags.coffee | 1 | 39 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:1:completion | completion | # Bootstrap Tags
# Max Lahey
# Monday, November 12, 2012
jQuery ->
$.tags = (element, options) ->
@defaults = {}
@suggestions = options.suggestions
@$element = $ element
# add/remove methods
@removeTagClicked = (e) =>
if e.target.tagName == "A"
@removeTag e.target.previousSiblin... | @removeLastTag = =>
el = $('.tag', @$element).last()
el.remove()
@removeTag @tags[@tags.length-1]
@removeTag = (tag) =>
@tags.splice(@tags.indexOf(tag), 1)
$('.tag-data', @$element).html @tags.join(',')
@renderTags @tags
@addTag = (tag) =>
@tags.push tag
$('.tag... | CoffeeScript | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | ae0cd12270696c44895fd5c797a2501b13cd77fe | 543 | https://github.com/maxwells/bootstrap-tags/blob/ae0cd12270696c44895fd5c797a2501b13cd77fe/src/bootstrap-tags.coffee | 1 | 39 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:2:raw_corpus | raw_corpus | # Key handlers
@keyDownHandler = (e) =>
k = (if e.keyCode? then e.keyCode else e.which)
switch k
when 13 # enter
tag = e.target.value
if @suggestedIndex != -1
tag = @suggestionList[@suggestedIndex]
@addTag tag
e.target.value = ''
@re... | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | ae0cd12270696c44895fd5c797a2501b13cd77fe | 543 | https://github.com/maxwells/bootstrap-tags/blob/ae0cd12270696c44895fd5c797a2501b13cd77fe/src/bootstrap-tags.coffee | 41 | 82 | ||
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# Key handlers
@keyDownHandler = (e) =>
k = (if e.keyCode? then e.keyCode else e.which)
switch k
when 13 # enter
tag = e.target.value
if @suggestedIndex != -1
tag = @suggestionList[@suggestedIndex]
... | // Key handlers
this.keyDownHandler = (e) => {
var k, numSuggestions, tag;
k = (e.keyCode != null ? e.keyCode : e.which);
switch (k) {
case 13: // enter
tag = e.target.value;
if (this.suggestedIndex !== -1) {
tag = this.suggestionList[this.suggestedIndex];
}
this.addTag(tag);
... | CoffeeScript | JavaScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | ae0cd12270696c44895fd5c797a2501b13cd77fe | 543 | https://github.com/maxwells/bootstrap-tags/blob/ae0cd12270696c44895fd5c797a2501b13cd77fe/src/bootstrap-tags.coffee | 41 | 82 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// Key handlers
this.keyDownHandler = (e) => {
var k, numSuggestions, tag;
k = (e.keyCode != null ? e.keyCode : e.which);
switch (k) {
case 13: // enter
tag = e.target.value;
if (this.suggestedIndex !== -1) {
tag = this.suggestionList[... | # Key handlers
@keyDownHandler = (e) =>
k = (if e.keyCode? then e.keyCode else e.which)
switch k
when 13 # enter
tag = e.target.value
if @suggestedIndex != -1
tag = @suggestionList[@suggestedIndex]
@addTag tag
e.target.value = ''
@re... | JavaScript | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | ae0cd12270696c44895fd5c797a2501b13cd77fe | 543 | https://github.com/maxwells/bootstrap-tags/blob/ae0cd12270696c44895fd5c797a2501b13cd77fe/src/bootstrap-tags.coffee | 41 | 82 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:2:completion | completion | # Key handlers
@keyDownHandler = (e) =>
k = (if e.keyCode? then e.keyCode else e.which)
switch k
when 13 # enter
tag = e.target.value
if @suggestedIndex != -1
tag = @suggestionList[@suggestedIndex]
@addTag tag
e.target.value = ''
@re... | @selectSuggested @suggestedIndex
else
@keyUpHandler = (e) =>
k = (if e.keyCode? then e.keyCode else e.which)
if k != 40 and k != 38
@suggestedIndex = -1
@$suggestionList.html ''
@suggestionList = []
$.each @suggestions, (i, suggestion) =>
if suggestion.... | CoffeeScript | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | ae0cd12270696c44895fd5c797a2501b13cd77fe | 543 | https://github.com/maxwells/bootstrap-tags/blob/ae0cd12270696c44895fd5c797a2501b13cd77fe/src/bootstrap-tags.coffee | 41 | 82 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:3:raw_corpus | raw_corpus | @selectSuggestedMousedOut = (e) =>
$(e.target).removeClass('tags-suggestion-highlighted')
@selectSuggested = (i) => # shows the provided index of suggestion list for this element as highlighted (exclusion of others)
$('.tags-suggestion').removeClass('tags-suggestion-highlighted')
tagElement = $('... | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | ae0cd12270696c44895fd5c797a2501b13cd77fe | 543 | https://github.com/maxwells/bootstrap-tags/blob/ae0cd12270696c44895fd5c797a2501b13cd77fe/src/bootstrap-tags.coffee | 84 | 125 | ||
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
@selectSuggestedMousedOut = (e) =>
$(e.target).removeClass('tags-suggestion-highlighted')
@selectSuggested = (i) => # shows the provided index of suggestion list for this element as highlighted (exclusion of others)
$('.tags-suggestion').removeCl... | this.selectSuggestedMousedOut = (e) => {
return $(e.target).removeClass('tags-suggestion-highlighted');
};
this.selectSuggested = (i) => { // shows the provided index of suggestion list for this element as highlighted (exclusion of others)
var tagElement;
$('.tags-suggestion').removeClass('tags-suggestion-highli... | CoffeeScript | JavaScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | ae0cd12270696c44895fd5c797a2501b13cd77fe | 543 | https://github.com/maxwells/bootstrap-tags/blob/ae0cd12270696c44895fd5c797a2501b13cd77fe/src/bootstrap-tags.coffee | 84 | 125 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
this.selectSuggestedMousedOut = (e) => {
return $(e.target).removeClass('tags-suggestion-highlighted');
};
this.selectSuggested = (i) => { // shows the provided index of suggestion list for this element as highlighted (exclusion of others)
var tagElement;
$(... | @selectSuggestedMousedOut = (e) =>
$(e.target).removeClass('tags-suggestion-highlighted')
@selectSuggested = (i) => # shows the provided index of suggestion list for this element as highlighted (exclusion of others)
$('.tags-suggestion').removeClass('tags-suggestion-highlighted')
tagElement = $('... | JavaScript | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | ae0cd12270696c44895fd5c797a2501b13cd77fe | 543 | https://github.com/maxwells/bootstrap-tags/blob/ae0cd12270696c44895fd5c797a2501b13cd77fe/src/bootstrap-tags.coffee | 84 | 125 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:3:completion | completion | @selectSuggestedMousedOut = (e) =>
$(e.target).removeClass('tags-suggestion-highlighted')
@selectSuggested = (i) => # shows the provided index of suggestion list for this element as highlighted (exclusion of others)
$('.tags-suggestion').removeClass('tags-suggestion-highlighted')
tagElement = $('... | el.html('')
$.each tags, (i, tag) =>
tag = $(@formatTag i, tag)
# tag.on "click", @alert
$('a', tag).on "click", @removeTagClicked
$('a', tag).on "mouseover", @toggleCloseColor
$('a', tag).on "mouseout", @toggleCloseColor
el.append tag
@adjustInputPosition()
... | CoffeeScript | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | ae0cd12270696c44895fd5c797a2501b13cd77fe | 543 | https://github.com/maxwells/bootstrap-tags/blob/ae0cd12270696c44895fd5c797a2501b13cd77fe/src/bootstrap-tags.coffee | 84 | 125 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:4:raw_corpus | raw_corpus | @init()
this
$.fn.tags = (options) ->
return this.each ->
tags = new $.tags this, options | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | ae0cd12270696c44895fd5c797a2501b13cd77fe | 543 | https://github.com/maxwells/bootstrap-tags/blob/ae0cd12270696c44895fd5c797a2501b13cd77fe/src/bootstrap-tags.coffee | 127 | 133 | ||
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:2:raw_corpus | raw_corpus | @keyDownHandler = (e) =>
k = (if e.keyCode? then e.keyCode else e.which)
if k == 13
tag = e.target.value
if @suggestedIndex != -1
tag = @suggestionList[@suggestedIndex]
@addTag tag
e.target.value = ''
@renderTags @tags
else if k == 46 or k == 8
... | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | 4acb009bfbd785c09882eeb99ca47d6ccb6c9428 | 543 | https://github.com/maxwells/bootstrap-tags/blob/4acb009bfbd785c09882eeb99ca47d6ccb6c9428/src/bootstrap-tags.coffee | 41 | 79 | ||
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
@keyDownHandler = (e) =>
k = (if e.keyCode? then e.keyCode else e.which)
if k == 13
tag = e.target.value
if @suggestedIndex != -1
tag = @suggestionList[@suggestedIndex]
@addTag tag
e.target.value = ''
... | this.keyDownHandler = (e) => {
var k, numSuggestions, tag;
k = (e.keyCode != null ? e.keyCode : e.which);
if (k === 13) {
tag = e.target.value;
if (this.suggestedIndex !== -1) {
tag = this.suggestionList[this.suggestedIndex];
}
this.addTag(tag);
e.target.value = '';
return this.rende... | CoffeeScript | JavaScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | 4acb009bfbd785c09882eeb99ca47d6ccb6c9428 | 543 | https://github.com/maxwells/bootstrap-tags/blob/4acb009bfbd785c09882eeb99ca47d6ccb6c9428/src/bootstrap-tags.coffee | 41 | 79 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
this.keyDownHandler = (e) => {
var k, numSuggestions, tag;
k = (e.keyCode != null ? e.keyCode : e.which);
if (k === 13) {
tag = e.target.value;
if (this.suggestedIndex !== -1) {
tag = this.suggestionList[this.suggestedIndex];
}
this.addT... | @keyDownHandler = (e) =>
k = (if e.keyCode? then e.keyCode else e.which)
if k == 13
tag = e.target.value
if @suggestedIndex != -1
tag = @suggestionList[@suggestedIndex]
@addTag tag
e.target.value = ''
@renderTags @tags
else if k == 46 or k == 8
... | JavaScript | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | 4acb009bfbd785c09882eeb99ca47d6ccb6c9428 | 543 | https://github.com/maxwells/bootstrap-tags/blob/4acb009bfbd785c09882eeb99ca47d6ccb6c9428/src/bootstrap-tags.coffee | 41 | 79 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:2:completion | completion | @keyDownHandler = (e) =>
k = (if e.keyCode? then e.keyCode else e.which)
if k == 13
tag = e.target.value
if @suggestedIndex != -1
tag = @suggestionList[@suggestedIndex]
@addTag tag
e.target.value = ''
@renderTags @tags
else if k == 46 or k == 8
... | @keyUpHandler = (e) =>
k = (if e.keyCode? then e.keyCode else e.which)
if k != 40 and k != 38
@suggestedIndex = -1
@$suggestionList.html ''
@suggestionList = []
$.each @suggestions, (i, suggestion) =>
if suggestion.substring(0, e.target.value.length) == e.target.val... | CoffeeScript | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | 4acb009bfbd785c09882eeb99ca47d6ccb6c9428 | 543 | https://github.com/maxwells/bootstrap-tags/blob/4acb009bfbd785c09882eeb99ca47d6ccb6c9428/src/bootstrap-tags.coffee | 41 | 79 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:3:raw_corpus | raw_corpus | @positionInput = =>
tagElement = $('.tag', @$element).last()
tagPosition = tagElement.position()
pLeft = if tagPosition? then tagPosition.left + tagElement.width() else 0
pTop = if tagPosition? then tagPosition.top else 0
$('.tags-input', @$element).css
paddingLeft : pLeft
... | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | 4acb009bfbd785c09882eeb99ca47d6ccb6c9428 | 543 | https://github.com/maxwells/bootstrap-tags/blob/4acb009bfbd785c09882eeb99ca47d6ccb6c9428/src/bootstrap-tags.coffee | 81 | 122 | ||
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
@positionInput = =>
tagElement = $('.tag', @$element).last()
tagPosition = tagElement.position()
pLeft = if tagPosition? then tagPosition.left + tagElement.width() else 0
pTop = if tagPosition? then tagPosition.top else 0
$('.tags-in... | this.positionInput = () => {
var pBottom, pLeft, pTop, tagElement, tagPosition;
tagElement = $('.tag', this.$element).last();
tagPosition = tagElement.position();
pLeft = tagPosition != null ? tagPosition.left + tagElement.width() : 0;
pTop = tagPosition != null ? tagPosition.top : 0;
$('.tags-input', this.... | CoffeeScript | JavaScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | 4acb009bfbd785c09882eeb99ca47d6ccb6c9428 | 543 | https://github.com/maxwells/bootstrap-tags/blob/4acb009bfbd785c09882eeb99ca47d6ccb6c9428/src/bootstrap-tags.coffee | 81 | 122 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
this.positionInput = () => {
var pBottom, pLeft, pTop, tagElement, tagPosition;
tagElement = $('.tag', this.$element).last();
tagPosition = tagElement.position();
pLeft = tagPosition != null ? tagPosition.left + tagElement.width() : 0;
pTop = tagPosition ... | @positionInput = =>
tagElement = $('.tag', @$element).last()
tagPosition = tagElement.position()
pLeft = if tagPosition? then tagPosition.left + tagElement.width() else 0
pTop = if tagPosition? then tagPosition.top else 0
$('.tags-input', @$element).css
paddingLeft : pLeft
... | JavaScript | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | 4acb009bfbd785c09882eeb99ca47d6ccb6c9428 | 543 | https://github.com/maxwells/bootstrap-tags/blob/4acb009bfbd785c09882eeb99ca47d6ccb6c9428/src/bootstrap-tags.coffee | 81 | 122 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:3:completion | completion | @positionInput = =>
tagElement = $('.tag', @$element).last()
tagPosition = tagElement.position()
pLeft = if tagPosition? then tagPosition.left + tagElement.width() else 0
pTop = if tagPosition? then tagPosition.top else 0
$('.tags-input', @$element).css
paddingLeft : pLeft
... | @positionInput()
@formatTag = (i, tag) ->
markup = "<div id='tag_"+i+"' class='tag'><span id='label_tag_"+i+"' class='label label-inverse'>"+tag+"<a id='close_tag_"+i+"'> X</a></span></div>"
@init = ->
@tags = $('.tag-data', @$element).html().split ','
input = @$element.append "<input class=... | CoffeeScript | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | 4acb009bfbd785c09882eeb99ca47d6ccb6c9428 | 543 | https://github.com/maxwells/bootstrap-tags/blob/4acb009bfbd785c09882eeb99ca47d6ccb6c9428/src/bootstrap-tags.coffee | 81 | 122 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:1:raw_corpus | raw_corpus | # Bootstrap Tags
# Max Lahey
# Monday, November 12, 2012
jQuery ->
$.tags = (element, options) ->
@defaults = {}
@$element = $ element
@removeTagClicked = (e) =>
if e.target.tagName == "A"
@removeTag e.target.previousSibling.textContent
$(e.target.parentNode).remove()
@remov... | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | 9b742d247044aefaec84d1cd012626944935a459 | 543 | https://github.com/maxwells/bootstrap-tags/blob/9b742d247044aefaec84d1cd012626944935a459/src/bootstrap-tags.coffee | 1 | 47 | ||
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# Bootstrap Tags
# Max Lahey
# Monday, November 12, 2012
jQuery ->
$.tags = (element, options) ->
@defaults = {}
@$element = $ element
@removeTagClicked = (e) =>
if e.target.tagName == "A"
@removeTag e.target.previousSibling.textCo... | // Bootstrap Tags
// Max Lahey
// Monday, November 12, 2012
jQuery(function() {
return $.tags = function(element, options) {
this.defaults = {};
this.$element = $(element);
this.removeTagClicked = (e) => {
if (e.target.tagName === "A") {
this.removeTag(e.target.previousSibling.textContent);
... | CoffeeScript | JavaScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | 9b742d247044aefaec84d1cd012626944935a459 | 543 | https://github.com/maxwells/bootstrap-tags/blob/9b742d247044aefaec84d1cd012626944935a459/src/bootstrap-tags.coffee | 1 | 47 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// Bootstrap Tags
// Max Lahey
// Monday, November 12, 2012
jQuery(function() {
return $.tags = function(element, options) {
this.defaults = {};
this.$element = $(element);
this.removeTagClicked = (e) => {
if (e.target.tagName === "A") {
... | # Bootstrap Tags
# Max Lahey
# Monday, November 12, 2012
jQuery ->
$.tags = (element, options) ->
@defaults = {}
@$element = $ element
@removeTagClicked = (e) =>
if e.target.tagName == "A"
@removeTag e.target.previousSibling.textContent
$(e.target.parentNode).remove()
@remov... | JavaScript | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | 9b742d247044aefaec84d1cd012626944935a459 | 543 | https://github.com/maxwells/bootstrap-tags/blob/9b742d247044aefaec84d1cd012626944935a459/src/bootstrap-tags.coffee | 1 | 47 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:1:completion | completion | # Bootstrap Tags
# Max Lahey
# Monday, November 12, 2012
jQuery ->
$.tags = (element, options) ->
@defaults = {}
@$element = $ element
@removeTagClicked = (e) =>
if e.target.tagName == "A"
@removeTag e.target.previousSibling.textContent
$(e.target.parentNode).remove()
@remov... | $('.tag-data', @$element).html @tags.join(',')
@renderTags @tags
@addTag = (tag) =>
@tags.push tag
$('.tag-data', @$element).html @tags.join(',')
@renderTags @tags
@toggleCloseAlpha = (e) ->
tagAnchor = $ e.target
color = (if tagAnchor.css('color') == "rgb(255, 255, 255)" t... | CoffeeScript | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | 9b742d247044aefaec84d1cd012626944935a459 | 543 | https://github.com/maxwells/bootstrap-tags/blob/9b742d247044aefaec84d1cd012626944935a459/src/bootstrap-tags.coffee | 1 | 47 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:2:raw_corpus | raw_corpus | @keyHandler = (e) =>
k = (if e.keyCode? then e.keyCode else e.which)
if k == 13
@addTag e.target.value
e.target.value = ''
@renderTags @tags
else if k == 46 or k == 8
if e.target.value == ''
@removeLastTag()
@positionInput = =>
tagElement = $('.tag'... | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | 9b742d247044aefaec84d1cd012626944935a459 | 543 | https://github.com/maxwells/bootstrap-tags/blob/9b742d247044aefaec84d1cd012626944935a459/src/bootstrap-tags.coffee | 49 | 89 | ||
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
@keyHandler = (e) =>
k = (if e.keyCode? then e.keyCode else e.which)
if k == 13
@addTag e.target.value
e.target.value = ''
@renderTags @tags
else if k == 46 or k == 8
if e.target.value == ''
@removeLastT... | this.keyHandler = (e) => {
var k;
k = (e.keyCode != null ? e.keyCode : e.which);
if (k === 13) {
this.addTag(e.target.value);
e.target.value = '';
return this.renderTags(this.tags);
} else if (k === 46 || k === 8) {
if (e.target.value === '') {
return this.removeLastTag();
}
}
};
th... | CoffeeScript | JavaScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | 9b742d247044aefaec84d1cd012626944935a459 | 543 | https://github.com/maxwells/bootstrap-tags/blob/9b742d247044aefaec84d1cd012626944935a459/src/bootstrap-tags.coffee | 49 | 89 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
this.keyHandler = (e) => {
var k;
k = (e.keyCode != null ? e.keyCode : e.which);
if (k === 13) {
this.addTag(e.target.value);
e.target.value = '';
return this.renderTags(this.tags);
} else if (k === 46 || k === 8) {
if (e.target.value === ''... | @keyHandler = (e) =>
k = (if e.keyCode? then e.keyCode else e.which)
if k == 13
@addTag e.target.value
e.target.value = ''
@renderTags @tags
else if k == 46 or k == 8
if e.target.value == ''
@removeLastTag()
@positionInput = =>
tagElement = $('.tag'... | JavaScript | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | 9b742d247044aefaec84d1cd012626944935a459 | 543 | https://github.com/maxwells/bootstrap-tags/blob/9b742d247044aefaec84d1cd012626944935a459/src/bootstrap-tags.coffee | 49 | 89 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:2:completion | completion | @keyHandler = (e) =>
k = (if e.keyCode? then e.keyCode else e.which)
if k == 13
@addTag e.target.value
e.target.value = ''
@renderTags @tags
else if k == 46 or k == 8
if e.target.value == ''
@removeLastTag()
@positionInput = =>
tagElement = $('.tag'... | @formatTag = (i, tag) ->
markup = "<div id='tag_"+i+"' class='tag'><span id='label_tag_"+i+"' class='label label-inverse'>"+tag+"<a id='close_tag_"+i+"'> X</a></span></div>"
@setListeners = ->
#@$element.on "click", @alert
@init = ->
@tags = $('.tag-data', @$element).html().split ','
i... | CoffeeScript | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | 9b742d247044aefaec84d1cd012626944935a459 | 543 | https://github.com/maxwells/bootstrap-tags/blob/9b742d247044aefaec84d1cd012626944935a459/src/bootstrap-tags.coffee | 49 | 89 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:1:raw_corpus | raw_corpus | # Bootstrap Tags
# Max Lahey
# Monday, November 12, 2012
jQuery ->
$.tags = (element, options) ->
@defaults = {}
@$element = $ element
@removeTagClicked = (e) =>
if e.target.tagName == "A"
$(e.target.parentNode).remove()
@removeTag e.target.previousSibling.textContent
@remov... | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | 57678647c2a876d2b0f59289f86d40ecc8d5122b | 543 | https://github.com/maxwells/bootstrap-tags/blob/57678647c2a876d2b0f59289f86d40ecc8d5122b/src/bootstrap-tags.coffee | 1 | 50 | ||
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# Bootstrap Tags
# Max Lahey
# Monday, November 12, 2012
jQuery ->
$.tags = (element, options) ->
@defaults = {}
@$element = $ element
@removeTagClicked = (e) =>
if e.target.tagName == "A"
$(e.target.parentNode).remove()
@r... | // Bootstrap Tags
// Max Lahey
// Monday, November 12, 2012
jQuery(function() {
return $.tags = function(element, options) {
this.defaults = {};
this.$element = $(element);
this.removeTagClicked = (e) => {
if (e.target.tagName === "A") {
$(e.target.parentNode).remove();
return this.r... | CoffeeScript | JavaScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | 57678647c2a876d2b0f59289f86d40ecc8d5122b | 543 | https://github.com/maxwells/bootstrap-tags/blob/57678647c2a876d2b0f59289f86d40ecc8d5122b/src/bootstrap-tags.coffee | 1 | 50 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// Bootstrap Tags
// Max Lahey
// Monday, November 12, 2012
jQuery(function() {
return $.tags = function(element, options) {
this.defaults = {};
this.$element = $(element);
this.removeTagClicked = (e) => {
if (e.target.tagName === "A") {
... | # Bootstrap Tags
# Max Lahey
# Monday, November 12, 2012
jQuery ->
$.tags = (element, options) ->
@defaults = {}
@$element = $ element
@removeTagClicked = (e) =>
if e.target.tagName == "A"
$(e.target.parentNode).remove()
@removeTag e.target.previousSibling.textContent
@remov... | JavaScript | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | 57678647c2a876d2b0f59289f86d40ecc8d5122b | 543 | https://github.com/maxwells/bootstrap-tags/blob/57678647c2a876d2b0f59289f86d40ecc8d5122b/src/bootstrap-tags.coffee | 1 | 50 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:1:completion | completion | # Bootstrap Tags
# Max Lahey
# Monday, November 12, 2012
jQuery ->
$.tags = (element, options) ->
@defaults = {}
@$element = $ element
@removeTagClicked = (e) =>
if e.target.tagName == "A"
$(e.target.parentNode).remove()
@removeTag e.target.previousSibling.textContent
@remov... | @addTag = (tag) =>
@tags.push tag
$('.tag-data', @$element).html @tags.join(',')
@renderTags @tags
@renderTags = (tags) =>
el = $('.tags',@$element)
el.html('')
$.each tags, (i, tag) =>
tag = $(@formatTag i, tag)
# tag.on "click", @alert
$('a', tag).on "c... | CoffeeScript | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | 57678647c2a876d2b0f59289f86d40ecc8d5122b | 543 | https://github.com/maxwells/bootstrap-tags/blob/57678647c2a876d2b0f59289f86d40ecc8d5122b/src/bootstrap-tags.coffee | 1 | 50 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:2:raw_corpus | raw_corpus | @positionInput = =>
tagElement = $('.tag', @$element).last()
tagPosition = tagElement.position()
pLeft = if tagPosition? then tagPosition.left + tagElement.width() else 0
pTop = if tagPosition? then tagPosition.top else 0
$('.tags-input', @$element).css
paddingLeft : pLeft
... | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | 57678647c2a876d2b0f59289f86d40ecc8d5122b | 543 | https://github.com/maxwells/bootstrap-tags/blob/57678647c2a876d2b0f59289f86d40ecc8d5122b/src/bootstrap-tags.coffee | 51 | 80 | ||
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
@positionInput = =>
tagElement = $('.tag', @$element).last()
tagPosition = tagElement.position()
pLeft = if tagPosition? then tagPosition.left + tagElement.width() else 0
pTop = if tagPosition? then tagPosition.top else 0
$('.tags-in... | this.positionInput = () => {
var pLeft, pTop, tagElement, tagPosition;
tagElement = $('.tag', this.$element).last();
tagPosition = tagElement.position();
pLeft = tagPosition != null ? tagPosition.left + tagElement.width() : 0;
pTop = tagPosition != null ? tagPosition.top : 0;
return $('.tags-input', this.$e... | CoffeeScript | JavaScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | 57678647c2a876d2b0f59289f86d40ecc8d5122b | 543 | https://github.com/maxwells/bootstrap-tags/blob/57678647c2a876d2b0f59289f86d40ecc8d5122b/src/bootstrap-tags.coffee | 51 | 80 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
this.positionInput = () => {
var pLeft, pTop, tagElement, tagPosition;
tagElement = $('.tag', this.$element).last();
tagPosition = tagElement.position();
pLeft = tagPosition != null ? tagPosition.left + tagElement.width() : 0;
pTop = tagPosition != null ?... | @positionInput = =>
tagElement = $('.tag', @$element).last()
tagPosition = tagElement.position()
pLeft = if tagPosition? then tagPosition.left + tagElement.width() else 0
pTop = if tagPosition? then tagPosition.top else 0
$('.tags-input', @$element).css
paddingLeft : pLeft
... | JavaScript | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | 57678647c2a876d2b0f59289f86d40ecc8d5122b | 543 | https://github.com/maxwells/bootstrap-tags/blob/57678647c2a876d2b0f59289f86d40ecc8d5122b/src/bootstrap-tags.coffee | 51 | 80 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:2:completion | completion | @positionInput = =>
tagElement = $('.tag', @$element).last()
tagPosition = tagElement.position()
pLeft = if tagPosition? then tagPosition.left + tagElement.width() else 0
pTop = if tagPosition? then tagPosition.top else 0
$('.tags-input', @$element).css
paddingLeft : pLeft
... | @init = ->
@tags = $('.tag-data', @$element).html().split ','
input = @$element.append "<input class='tags-input'>"
@renderTags @tags
input.keydown @keyHandler
@setListeners()
@init()
this
$.fn.tags = (options) ->
return this.each ->
tags = new $.tags this, options | CoffeeScript | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | 57678647c2a876d2b0f59289f86d40ecc8d5122b | 543 | https://github.com/maxwells/bootstrap-tags/blob/57678647c2a876d2b0f59289f86d40ecc8d5122b/src/bootstrap-tags.coffee | 51 | 80 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:1:raw_corpus | raw_corpus | # Bootstrap Tags
# Max Lahey
# Monday, November 12, 2012
jQuery ->
$.tags = (element, options) ->
@defaults = {}
@$element = $ element
@removeTagClicked = (e) =>
if e.target.tagName == "A"
$(e.target.parentNode).remove()
@removeTag e.target.previousSibling.textContent
@remov... | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | 40b49a6781ce0d788464956c1d114800b8e22bdc | 543 | https://github.com/maxwells/bootstrap-tags/blob/40b49a6781ce0d788464956c1d114800b8e22bdc/src/bootstrap-tags.coffee | 1 | 50 | ||
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# Bootstrap Tags
# Max Lahey
# Monday, November 12, 2012
jQuery ->
$.tags = (element, options) ->
@defaults = {}
@$element = $ element
@removeTagClicked = (e) =>
if e.target.tagName == "A"
$(e.target.parentNode).remove()
@r... | // Bootstrap Tags
// Max Lahey
// Monday, November 12, 2012
jQuery(function() {
return $.tags = function(element, options) {
this.defaults = {};
this.$element = $(element);
this.removeTagClicked = (e) => {
if (e.target.tagName === "A") {
$(e.target.parentNode).remove();
return this.r... | CoffeeScript | JavaScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | 40b49a6781ce0d788464956c1d114800b8e22bdc | 543 | https://github.com/maxwells/bootstrap-tags/blob/40b49a6781ce0d788464956c1d114800b8e22bdc/src/bootstrap-tags.coffee | 1 | 50 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// Bootstrap Tags
// Max Lahey
// Monday, November 12, 2012
jQuery(function() {
return $.tags = function(element, options) {
this.defaults = {};
this.$element = $(element);
this.removeTagClicked = (e) => {
if (e.target.tagName === "A") {
... | # Bootstrap Tags
# Max Lahey
# Monday, November 12, 2012
jQuery ->
$.tags = (element, options) ->
@defaults = {}
@$element = $ element
@removeTagClicked = (e) =>
if e.target.tagName == "A"
$(e.target.parentNode).remove()
@removeTag e.target.previousSibling.textContent
@remov... | JavaScript | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | 40b49a6781ce0d788464956c1d114800b8e22bdc | 543 | https://github.com/maxwells/bootstrap-tags/blob/40b49a6781ce0d788464956c1d114800b8e22bdc/src/bootstrap-tags.coffee | 1 | 50 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:1:completion | completion | # Bootstrap Tags
# Max Lahey
# Monday, November 12, 2012
jQuery ->
$.tags = (element, options) ->
@defaults = {}
@$element = $ element
@removeTagClicked = (e) =>
if e.target.tagName == "A"
$(e.target.parentNode).remove()
@removeTag e.target.previousSibling.textContent
@remov... | @renderTags = (tags) =>
el = $('.tags',@$element)
el.html('')
$.each tags, (i, tag) =>
tag = $(@formatTag i, tag)
# tag.on "click", @alert
$('a', tag).on "click", @removeTagClicked
el.append tag
@keyHandler = (e) =>
if e.which == 13
@addTag e.target.v... | CoffeeScript | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | 40b49a6781ce0d788464956c1d114800b8e22bdc | 543 | https://github.com/maxwells/bootstrap-tags/blob/40b49a6781ce0d788464956c1d114800b8e22bdc/src/bootstrap-tags.coffee | 1 | 50 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:2:raw_corpus | raw_corpus | @init = ->
@tags = $('.tag-data', @$element).html().split ','
input = @$element.append "<input class='tags-input'>"
@renderTags @tags
input.keypress @keyHandler
@setListeners()
@init()
this
$.fn.tags = (options) ->
return this.each ->
tags = new $.tags this, options | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | 40b49a6781ce0d788464956c1d114800b8e22bdc | 543 | https://github.com/maxwells/bootstrap-tags/blob/40b49a6781ce0d788464956c1d114800b8e22bdc/src/bootstrap-tags.coffee | 51 | 64 | ||
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
@init = ->
@tags = $('.tag-data', @$element).html().split ','
input = @$element.append "<input class='tags-input'>"
@renderTags @tags
input.keypress @keyHandler
@setListeners()
@init()
this
$.fn.tags = (options) ->
r... | this.init = function() {
var input;
this.tags = $('.tag-data', this.$element).html().split(',');
input = this.$element.append("<input class='tags-input'>");
this.renderTags(this.tags);
input.keypress(this.keyHandler);
return this.setListeners();
};
this.init();
this;
$.fn.tags = function(options) {
ret... | CoffeeScript | JavaScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | 40b49a6781ce0d788464956c1d114800b8e22bdc | 543 | https://github.com/maxwells/bootstrap-tags/blob/40b49a6781ce0d788464956c1d114800b8e22bdc/src/bootstrap-tags.coffee | 51 | 64 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
this.init = function() {
var input;
this.tags = $('.tag-data', this.$element).html().split(',');
input = this.$element.append("<input class='tags-input'>");
this.renderTags(this.tags);
input.keypress(this.keyHandler);
return this.setListeners();
};
thi... | @init = ->
@tags = $('.tag-data', @$element).html().split ','
input = @$element.append "<input class='tags-input'>"
@renderTags @tags
input.keypress @keyHandler
@setListeners()
@init()
this
$.fn.tags = (options) ->
return this.each ->
tags = new $.tags this, options | JavaScript | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | 40b49a6781ce0d788464956c1d114800b8e22bdc | 543 | https://github.com/maxwells/bootstrap-tags/blob/40b49a6781ce0d788464956c1d114800b8e22bdc/src/bootstrap-tags.coffee | 51 | 64 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:2:completion | completion | @init = ->
@tags = $('.tag-data', @$element).html().split ','
input = @$element.append "<input class='tags-input'>"
@renderTags @tags
input.keypress @keyHandler
@setListeners() | @init()
this
$.fn.tags = (options) ->
return this.each ->
tags = new $.tags this, options | CoffeeScript | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | 40b49a6781ce0d788464956c1d114800b8e22bdc | 543 | https://github.com/maxwells/bootstrap-tags/blob/40b49a6781ce0d788464956c1d114800b8e22bdc/src/bootstrap-tags.coffee | 51 | 64 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:1:raw_corpus | raw_corpus | # Bootstrap Tags
# Max Lahey
# Monday, November 12, 2012
jQuery ->
$.tags = (element, options) ->
# default plugin settings
@defaults = {}
# jQuery version of DOM element attached to the plugin
@$element = $ element
## private methods
# set the current state
setState = (@state) =>
#... | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | 8e5b184c5c37d27d5d786dd3bb04fb22b76917f3 | 543 | https://github.com/maxwells/bootstrap-tags/blob/8e5b184c5c37d27d5d786dd3bb04fb22b76917f3/src/bootstrap-tags.coffee | 1 | 45 | ||
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# Bootstrap Tags
# Max Lahey
# Monday, November 12, 2012
jQuery ->
$.tags = (element, options) ->
# default plugin settings
@defaults = {}
# jQuery version of DOM element attached to the plugin
@$element = $ element
## private methods
... | // Bootstrap Tags
// Max Lahey
// Monday, November 12, 2012
jQuery(function() {
$.tags = function(element, options) {
var getArrowCss, setState;
// default plugin settings
this.defaults = {};
// jQuery version of DOM element attached to the plugin
this.$element = $(element);
//# private method... | CoffeeScript | JavaScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | 8e5b184c5c37d27d5d786dd3bb04fb22b76917f3 | 543 | https://github.com/maxwells/bootstrap-tags/blob/8e5b184c5c37d27d5d786dd3bb04fb22b76917f3/src/bootstrap-tags.coffee | 1 | 45 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// Bootstrap Tags
// Max Lahey
// Monday, November 12, 2012
jQuery(function() {
$.tags = function(element, options) {
var getArrowCss, setState;
// default plugin settings
this.defaults = {};
// jQuery version of DOM element attached to the plugin... | # Bootstrap Tags
# Max Lahey
# Monday, November 12, 2012
jQuery ->
$.tags = (element, options) ->
# default plugin settings
@defaults = {}
# jQuery version of DOM element attached to the plugin
@$element = $ element
## private methods
# set the current state
setState = (@state) =>
#... | JavaScript | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | 8e5b184c5c37d27d5d786dd3bb04fb22b76917f3 | 543 | https://github.com/maxwells/bootstrap-tags/blob/8e5b184c5c37d27d5d786dd3bb04fb22b76917f3/src/bootstrap-tags.coffee | 1 | 45 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:1:completion | completion | # Bootstrap Tags
# Max Lahey
# Monday, November 12, 2012
jQuery ->
$.tags = (element, options) ->
# default plugin settings
@defaults = {}
# jQuery version of DOM element attached to the plugin
@$element = $ element
## private methods
# set the current state
setState = (@state) =>
#... | @settings[settingKey]
# call one of the plugin setting functions
@callSettingFunction = (functionName) ->
@settings[functionName](element, @$tags[0])
# get miniTip content
@getContent = ->
content
@init = ->
alert "init"
@init()
this
$.fn.tags = (options) ->
ret... | CoffeeScript | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | 8e5b184c5c37d27d5d786dd3bb04fb22b76917f3 | 543 | https://github.com/maxwells/bootstrap-tags/blob/8e5b184c5c37d27d5d786dd3bb04fb22b76917f3/src/bootstrap-tags.coffee | 1 | 45 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:1:raw_corpus | raw_corpus | # Bootstrap Tags
# Max Lahey
# Monday, November 12, 2012
# Reference jQuery
$ = jQuery
$.fn.extend
tags: (options) ->
# Default settings
settings =
option1: true
option2: false
debug: false
# Merge default settings with options.
settings = $.extend settings, options
# Simple... | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | 49e1a762d150f4ad758fa2a08c42941ef0e1d665 | 543 | https://github.com/maxwells/bootstrap-tags/blob/49e1a762d150f4ad758fa2a08c42941ef0e1d665/src/bootstrap-tags.coffee | 1 | 28 | ||
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# Bootstrap Tags
# Max Lahey
# Monday, November 12, 2012
# Reference jQuery
$ = jQuery
$.fn.extend
tags: (options) ->
# Default settings
settings =
option1: true
option2: false
debug: false
# Merge default settings with options... | // Bootstrap Tags
// Max Lahey
// Monday, November 12, 2012
// Reference jQuery
var $;
$ = jQuery;
$.fn.extend({
tags: function(options) {
var log, settings;
// Default settings
settings = {
option1: true,
option2: false,
debug: false
};
// Merge default settings with options.... | CoffeeScript | JavaScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | 49e1a762d150f4ad758fa2a08c42941ef0e1d665 | 543 | https://github.com/maxwells/bootstrap-tags/blob/49e1a762d150f4ad758fa2a08c42941ef0e1d665/src/bootstrap-tags.coffee | 1 | 28 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// Bootstrap Tags
// Max Lahey
// Monday, November 12, 2012
// Reference jQuery
var $;
$ = jQuery;
$.fn.extend({
tags: function(options) {
var log, settings;
// Default settings
settings = {
option1: true,
option2: false,
debug: f... | # Bootstrap Tags
# Max Lahey
# Monday, November 12, 2012
# Reference jQuery
$ = jQuery
$.fn.extend
tags: (options) ->
# Default settings
settings =
option1: true
option2: false
debug: false
# Merge default settings with options.
settings = $.extend settings, options
# Simple... | JavaScript | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | 49e1a762d150f4ad758fa2a08c42941ef0e1d665 | 543 | https://github.com/maxwells/bootstrap-tags/blob/49e1a762d150f4ad758fa2a08c42941ef0e1d665/src/bootstrap-tags.coffee | 1 | 28 |
maxwells/bootstrap-tags:src/bootstrap-tags.coffee:1:completion | completion | # Bootstrap Tags
# Max Lahey
# Monday, November 12, 2012
# Reference jQuery
$ = jQuery
$.fn.extend
tags: (options) ->
# Default settings
settings =
option1: true
option2: false | debug: false
# Merge default settings with options.
settings = $.extend settings, options
# Simple logger.
log = (msg) ->
console?.log msg if settings.debug
# _Insert magic here._
return @each ()->
alert "Preparing magic show."
# You can use your settings in here now.
... | CoffeeScript | CoffeeScript | maxwells/bootstrap-tags | src/bootstrap-tags.coffee | MIT | 49e1a762d150f4ad758fa2a08c42941ef0e1d665 | 543 | https://github.com/maxwells/bootstrap-tags/blob/49e1a762d150f4ad758fa2a08c42941ef0e1d665/src/bootstrap-tags.coffee | 1 | 28 |
cdglabs/apparatus:src/Util/JspmCache.coffee:1:raw_corpus | raw_corpus | _ = require "underscore"
module.exports = class JspmCache
constructor: ->
@_modules = {}
@_callbacksToRun = {}
getSync: (moduleName) ->
@_modules[moduleName] # will be undefined if module is not saved
get: (moduleName, callback) ->
# Either the module is cached...
if _.has(@_modules, modul... | CoffeeScript | cdglabs/apparatus | src/Util/JspmCache.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/JspmCache.coffee | 1 | 43 | ||
cdglabs/apparatus:src/Util/JspmCache.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
_ = require "underscore"
module.exports = class JspmCache
constructor: ->
@_modules = {}
@_callbacksToRun = {}
getSync: (moduleName) ->
@_modules[moduleName] # will be undefined if module is not saved
get: (moduleName, callback) ->
# Eit... | var JspmCache, _;
_ = require("underscore");
module.exports = JspmCache = (function() {
class JspmCache {
constructor() {
this._modules = {};
this._callbacksToRun = {};
}
getSync(moduleName) {
return this._modules[moduleName];
}
get(moduleName, callback) {
var imported,... | CoffeeScript | JavaScript | cdglabs/apparatus | src/Util/JspmCache.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/JspmCache.coffee | 1 | 43 |
cdglabs/apparatus:src/Util/JspmCache.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var JspmCache, _;
_ = require("underscore");
module.exports = JspmCache = (function() {
class JspmCache {
constructor() {
this._modules = {};
this._callbacksToRun = {};
}
getSync(moduleName) {
return this._modules[moduleName];
... | _ = require "underscore"
module.exports = class JspmCache
constructor: ->
@_modules = {}
@_callbacksToRun = {}
getSync: (moduleName) ->
@_modules[moduleName] # will be undefined if module is not saved
get: (moduleName, callback) ->
# Either the module is cached...
if _.has(@_modules, modul... | JavaScript | CoffeeScript | cdglabs/apparatus | src/Util/JspmCache.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/JspmCache.coffee | 1 | 43 |
cdglabs/apparatus:src/Util/JspmCache.coffee:1:completion | completion | _ = require "underscore"
module.exports = class JspmCache
constructor: ->
@_modules = {}
@_callbacksToRun = {}
getSync: (moduleName) ->
@_modules[moduleName] # will be undefined if module is not saved
get: (moduleName, callback) ->
# Either the module is cached...
if _.has(@_modules, modul... | @_callbacksToRun[moduleName] = callback
url = "https://esm.sh/#{moduleName}"
# HACK: wrap import in eval cuz old webpack doesn't like it
imported = eval("import('#{url}')")
imported.then(
(result) =>
# HACK: convert Module into normal Object so it works with inspector
... | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/Util/JspmCache.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/JspmCache.coffee | 1 | 43 |
cdglabs/apparatus:src/Util/JspmCache.coffee:1:raw_corpus | raw_corpus | _ = require "underscore"
module.exports = class JspmCache
constructor: ->
@_modules = {}
@_callbacksToRun = {}
getSync: (moduleName) ->
@_modules[moduleName] # will be undefined if module is not saved
get: (moduleName, callback) ->
# Either the module is cached...
if _.has(@_modules, modu... | CoffeeScript | cdglabs/apparatus | src/Util/JspmCache.coffee | MIT | 504564ac693a99b113657cfdd0154ef8787ac17b | 1,052 | https://github.com/cdglabs/apparatus/blob/504564ac693a99b113657cfdd0154ef8787ac17b/src/Util/JspmCache.coffee | 1 | 38 | ||
cdglabs/apparatus:src/Util/JspmCache.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
_ = require "underscore"
module.exports = class JspmCache
constructor: ->
@_modules = {}
@_callbacksToRun = {}
getSync: (moduleName) ->
@_modules[moduleName] # will be undefined if module is not saved
get: (moduleName, callback) ->
# Ei... | var JspmCache, _;
_ = require("underscore");
module.exports = JspmCache = (function() {
class JspmCache {
constructor() {
this._modules = {};
this._callbacksToRun = {};
}
getSync(moduleName) {
return this._modules[moduleName];
}
get(moduleName, callback) {
// Either the... | CoffeeScript | JavaScript | cdglabs/apparatus | src/Util/JspmCache.coffee | MIT | 504564ac693a99b113657cfdd0154ef8787ac17b | 1,052 | https://github.com/cdglabs/apparatus/blob/504564ac693a99b113657cfdd0154ef8787ac17b/src/Util/JspmCache.coffee | 1 | 38 |
cdglabs/apparatus:src/Util/JspmCache.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var JspmCache, _;
_ = require("underscore");
module.exports = JspmCache = (function() {
class JspmCache {
constructor() {
this._modules = {};
this._callbacksToRun = {};
}
getSync(moduleName) {
return this._modules[moduleName];
... | _ = require "underscore"
module.exports = class JspmCache
constructor: ->
@_modules = {}
@_callbacksToRun = {}
getSync: (moduleName) ->
@_modules[moduleName] # will be undefined if module is not saved
get: (moduleName, callback) ->
# Either the module is cached...
if _.has(@_modules, modu... | JavaScript | CoffeeScript | cdglabs/apparatus | src/Util/JspmCache.coffee | MIT | 504564ac693a99b113657cfdd0154ef8787ac17b | 1,052 | https://github.com/cdglabs/apparatus/blob/504564ac693a99b113657cfdd0154ef8787ac17b/src/Util/JspmCache.coffee | 1 | 38 |
cdglabs/apparatus:src/Util/JspmCache.coffee:1:completion | completion | _ = require "underscore"
module.exports = class JspmCache
constructor: ->
@_modules = {}
@_callbacksToRun = {}
getSync: (moduleName) ->
@_modules[moduleName] # will be undefined if module is not saved
get: (moduleName, callback) ->
# Either the module is cached...
if _.has(@_modules, modu... | # Or it's totally new...
else
@_callbacksToRun[moduleName] = callback
System.import(moduleName).then(
(result) =>
@_modules[moduleName] = result
callbackToRun = @_callbacksToRun[moduleName]
delete @_callbacksToRun[moduleName]
callbackToRun()
(erro... | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/Util/JspmCache.coffee | MIT | 504564ac693a99b113657cfdd0154ef8787ac17b | 1,052 | https://github.com/cdglabs/apparatus/blob/504564ac693a99b113657cfdd0154ef8787ac17b/src/Util/JspmCache.coffee | 1 | 38 |
twilson63/express-coffee:lib/coffee/lib/coffee-script/documentation/coffee/object_comprehensions.coffee:1:raw_corpus | raw_corpus | years_old: {max: 10, ida: 9, tim: 11}
ages: for child, age of years_old
child + " is " + age | CoffeeScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/documentation/coffee/object_comprehensions.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/documentation/coffee/object_comprehensions.coffee | 1 | 4 | ||
twilson63/express-coffee:lib/coffee/lib/coffee-script/documentation/coffee/object_comprehensions.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
years_old: {max: 10, ida: 9, tim: 11}
ages: for child, age of years_old
child + " is " + age
``` | var age, child;
({
years_old: {
max: 10,
ida: 9,
tim: 11
},
ages: (function() {
var results;
results = [];
for (child in years_old) {
age = years_old[child];
results.push(child + " is " + age);
}
return results;
})()
}); | CoffeeScript | JavaScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/documentation/coffee/object_comprehensions.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/documentation/coffee/object_comprehensions.coffee | 1 | 4 |
twilson63/express-coffee:lib/coffee/lib/coffee-script/documentation/coffee/object_comprehensions.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var age, child;
({
years_old: {
max: 10,
ida: 9,
tim: 11
},
ages: (function() {
var results;
results = [];
for (child in years_old) {
age = years_old[child];
results.push(child + " is " + age);
}
return results;
... | years_old: {max: 10, ida: 9, tim: 11}
ages: for child, age of years_old
child + " is " + age | JavaScript | CoffeeScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/documentation/coffee/object_comprehensions.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/documentation/coffee/object_comprehensions.coffee | 1 | 4 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.