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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
jianliaoim/talk-os:talk-web/client/module/light-image.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = React.createClass
displayName: 'light-image'
propTypes:
onClick: React.PropTypes.func
onLoaded: React.PropTypes.func
src: React.PropTypes.string.isRequired
width: React.PropTypes.number
height: React.PropTypes.number
... | module.exports = React.createClass({
displayName: 'light-image',
propTypes: {
onClick: React.PropTypes.func,
onLoaded: React.PropTypes.func,
src: React.PropTypes.string.isRequired,
width: React.PropTypes.number,
height: React.PropTypes.number,
style: React.PropTypes.object
},
getDetaultP... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/client/module/light-image.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/module/light-image.coffee | 6 | 55 |
jianliaoim/talk-os:talk-web/client/module/light-image.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
module.exports = React.createClass({
displayName: 'light-image',
propTypes: {
onClick: React.PropTypes.func,
onLoaded: React.PropTypes.func,
src: React.PropTypes.string.isRequired,
width: React.PropTypes.number,
height: React.PropTypes.numbe... | module.exports = React.createClass
displayName: 'light-image'
propTypes:
onClick: React.PropTypes.func
onLoaded: React.PropTypes.func
src: React.PropTypes.string.isRequired
width: React.PropTypes.number
height: React.PropTypes.number
style: React.PropTypes.object
getDetaultProps: ->
... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/module/light-image.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/module/light-image.coffee | 6 | 55 |
jianliaoim/talk-os:talk-web/client/module/light-image.coffee:1:completion | completion | module.exports = React.createClass
displayName: 'light-image'
propTypes:
onClick: React.PropTypes.func
onLoaded: React.PropTypes.func
src: React.PropTypes.string.isRequired
width: React.PropTypes.number
height: React.PropTypes.number
style: React.PropTypes.object
getDetaultProps: ->
... | # methods
loadImage: (src) ->
isDataUri = @props.src.substring(0, 4) is 'data'
if isDataUri
@loadDataUrl src
else
@loadRemoteImage src
loadRemoteImage: (src) ->
@setState stage: 'loading'
@imgEl = document.createElement 'img'
@imgEl.onload = @onImageLoad
@imgEl.onerror = @o... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/module/light-image.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/module/light-image.coffee | 6 | 55 |
jianliaoim/talk-os:talk-web/client/module/light-image.coffee:2:raw_corpus | raw_corpus | # internal event
onImageLoad: (event) ->
if @isMounted()
@setState stage: 'done'
@onLoaded()
@destroyImage()
onImageError: (event) ->
@setState stage: 'error'
@destroyImage()
# external events
onClick: (event) ->
event.stopPropagation()
@props.onClick?()
onLoaded: ->
... | CoffeeScript | jianliaoim/talk-os | talk-web/client/module/light-image.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/module/light-image.coffee | 56 | 105 | ||
jianliaoim/talk-os:talk-web/client/module/light-image.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# internal event
onImageLoad: (event) ->
if @isMounted()
@setState stage: 'done'
@onLoaded()
@destroyImage()
onImageError: (event) ->
@setState stage: 'error'
@destroyImage()
# external events
onClick: (event) ->
event.... | // internal event
({
onImageLoad: function(event) {
if (this.isMounted()) {
this.setState({
stage: 'done'
});
this.onLoaded();
}
return this.destroyImage();
},
onImageError: function(event) {
this.setState({
stage: 'error'
});
return this.destroyImage();
}... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/client/module/light-image.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/module/light-image.coffee | 56 | 105 |
jianliaoim/talk-os:talk-web/client/module/light-image.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// internal event
({
onImageLoad: function(event) {
if (this.isMounted()) {
this.setState({
stage: 'done'
});
this.onLoaded();
}
return this.destroyImage();
},
onImageError: function(event) {
this.setState({
sta... | # internal event
onImageLoad: (event) ->
if @isMounted()
@setState stage: 'done'
@onLoaded()
@destroyImage()
onImageError: (event) ->
@setState stage: 'error'
@destroyImage()
# external events
onClick: (event) ->
event.stopPropagation()
@props.onClick?()
onLoaded: ->
... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/module/light-image.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/module/light-image.coffee | 56 | 105 |
jianliaoim/talk-os:talk-web/client/module/light-image.coffee:2:completion | completion | # internal event
onImageLoad: (event) ->
if @isMounted()
@setState stage: 'done'
@onLoaded()
@destroyImage()
onImageError: (event) ->
@setState stage: 'error'
@destroyImage()
# external events
onClick: (event) ->
event.stopPropagation()
@props.onClick?()
onLoaded: ->
... | # renderers
renderLoading: ->
className = classnames 'loading-layer',
'is-active': @state.stage is 'loading'
div className: className,
div className: 'image-spinner',
div className: 'cube1'
div className: 'cube2'
renderImage: ->
className = classnames 'image-layer',
... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/module/light-image.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/module/light-image.coffee | 56 | 105 |
jianliaoim/talk-os:talk-web/client/module/light-image.coffee:3:raw_corpus | raw_corpus | i className: 'image-reloader ti ti-refresh', onClick: @onReloadImage
render: ->
style = @props.style or {}
style.width = @props.width
style.height = @props.height
div className: 'light-image', style: style,
@renderLoading()
@renderError()
@renderImage() | CoffeeScript | jianliaoim/talk-os | talk-web/client/module/light-image.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/module/light-image.coffee | 106 | 116 | ||
jianliaoim/talk-os:talk-web/client/module/light-image.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
i className: 'image-reloader ti ti-refresh', onClick: @onReloadImage
render: ->
style = @props.style or {}
style.width = @props.width
style.height = @props.height
div className: 'light-image', style: style,
@renderLoading()
@render... | i({
className: 'image-reloader ti ti-refresh',
onClick: this.onReloadImage({
render: function() {
var style;
style = this.props.style || {};
style.width = this.props.width;
style.height = this.props.height;
return div({
className: 'light-image',
style: style
}... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/client/module/light-image.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/module/light-image.coffee | 106 | 116 |
jianliaoim/talk-os:talk-web/client/module/light-image.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
i({
className: 'image-reloader ti ti-refresh',
onClick: this.onReloadImage({
render: function() {
var style;
style = this.props.style || {};
style.width = this.props.width;
style.height = this.props.height;
return div({
... | i className: 'image-reloader ti ti-refresh', onClick: @onReloadImage
render: ->
style = @props.style or {}
style.width = @props.width
style.height = @props.height
div className: 'light-image', style: style,
@renderLoading()
@renderError()
@renderImage() | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/module/light-image.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/module/light-image.coffee | 106 | 116 |
jianliaoim/talk-os:talk-web/client/module/light-image.coffee:3:completion | completion | i className: 'image-reloader ti ti-refresh', onClick: @onReloadImage
render: ->
style = @props.style or {}
style.width = @props.width | style.height = @props.height
div className: 'light-image', style: style,
@renderLoading()
@renderError()
@renderImage() | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/module/light-image.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/module/light-image.coffee | 106 | 116 |
sorich87/bootstrap-tour:bootstrap-tour.coffee:1:raw_corpus | raw_corpus | ### ============================================================
# bootstrap-tour.js v0.1
# http://pushly.github.com/bootstrap-tour/
# ==============================================================
# Copyright 2012 Push.ly
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file e... | CoffeeScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | 206e43eca48e89346d5254d3d1c0b61621587ef4 | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/206e43eca48e89346d5254d3d1c0b61621587ef4/bootstrap-tour.coffee | 1 | 41 | ||
sorich87/bootstrap-tour:bootstrap-tour.coffee:1:completion | completion | ### ============================================================
# bootstrap-tour.js v0.1
# http://pushly.github.com/bootstrap-tour/
# ==============================================================
# Copyright 2012 Push.ly
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file e... | document = window.document
class Tour
constructor: (options) ->
@_options = $.extend({
afterSetState: (key, value) ->
afterGetState: (key, value) ->
}, options)
@_steps = []
@setCurrentStep()
# Go to next step after click on element with class .next
$(documen... | CoffeeScript | CoffeeScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | 206e43eca48e89346d5254d3d1c0b61621587ef4 | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/206e43eca48e89346d5254d3d1c0b61621587ef4/bootstrap-tour.coffee | 1 | 41 |
sorich87/bootstrap-tour:bootstrap-tour.coffee:2:raw_corpus | raw_corpus | setState: (key, value) ->
$.cookie("tour_" + key, value, { expires: 36500, path: '/' })
@_options.afterSetState(key, value)
getState: (key) ->
value = $.cookie("tour_" + key)
@_options.afterGetState(key, value)
return value
# Add a new step
addStep: (step) ->
@_steps.pu... | CoffeeScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | 206e43eca48e89346d5254d3d1c0b61621587ef4 | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/206e43eca48e89346d5254d3d1c0b61621587ef4/bootstrap-tour.coffee | 43 | 81 | ||
sorich87/bootstrap-tour:bootstrap-tour.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
setState: (key, value) ->
$.cookie("tour_" + key, value, { expires: 36500, path: '/' })
@_options.afterSetState(key, value)
getState: (key) ->
value = $.cookie("tour_" + key)
@_options.afterGetState(key, value)
return value
... | ({
setState: function(key, value) {
$.cookie("tour_" + key, value, {
expires: 36500,
path: '/'
});
return this._options.afterSetState(key, value);
},
getState: function(key) {
var value;
value = $.cookie("tour_" + key);
this._options.afterGetState(key, value);
return value;... | CoffeeScript | JavaScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | 206e43eca48e89346d5254d3d1c0b61621587ef4 | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/206e43eca48e89346d5254d3d1c0b61621587ef4/bootstrap-tour.coffee | 43 | 81 |
sorich87/bootstrap-tour:bootstrap-tour.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
setState: function(key, value) {
$.cookie("tour_" + key, value, {
expires: 36500,
path: '/'
});
return this._options.afterSetState(key, value);
},
getState: function(key) {
var value;
value = $.cookie("tour_" + key);
thi... | setState: (key, value) ->
$.cookie("tour_" + key, value, { expires: 36500, path: '/' })
@_options.afterSetState(key, value)
getState: (key) ->
value = $.cookie("tour_" + key)
@_options.afterGetState(key, value)
return value
# Add a new step
addStep: (step) ->
@_steps.pu... | JavaScript | CoffeeScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | 206e43eca48e89346d5254d3d1c0b61621587ef4 | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/206e43eca48e89346d5254d3d1c0b61621587ef4/bootstrap-tour.coffee | 43 | 81 |
sorich87/bootstrap-tour:bootstrap-tour.coffee:2:completion | completion | setState: (key, value) ->
$.cookie("tour_" + key, value, { expires: 36500, path: '/' })
@_options.afterSetState(key, value)
getState: (key) ->
value = $.cookie("tour_" + key)
@_options.afterGetState(key, value)
return value
# Add a new step
addStep: (step) ->
@_steps.pu... | content: "",
next: i + 1,
end: i == @_steps.length - 1,
animation: true
}, @_steps[i])
# Start tour from current step
start: (force = false) ->
if force || ! @ended()
@showStep(@_current)
# Hide current step and show next step
next: ->
@hideStep(@_curr... | CoffeeScript | CoffeeScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | 206e43eca48e89346d5254d3d1c0b61621587ef4 | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/206e43eca48e89346d5254d3d1c0b61621587ef4/bootstrap-tour.coffee | 43 | 81 |
sorich87/bootstrap-tour:bootstrap-tour.coffee:3:raw_corpus | raw_corpus | # Verify if tour is enabled
ended: ->
@getState("end")
# Restart tour
restart: ->
@setState("current_step", null)
@setState("end", null)
# Hide the specified step
hideStep: (i) ->
step = @getStep(i)
step.onHide(@) if step.onHide?
$(step.element).popover("hide")... | CoffeeScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | 206e43eca48e89346d5254d3d1c0b61621587ef4 | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/206e43eca48e89346d5254d3d1c0b61621587ef4/bootstrap-tour.coffee | 83 | 124 | ||
sorich87/bootstrap-tour:bootstrap-tour.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# Verify if tour is enabled
ended: ->
@getState("end")
# Restart tour
restart: ->
@setState("current_step", null)
@setState("end", null)
# Hide the specified step
hideStep: (i) ->
step = @getStep(i)
step.onHide(... | // Verify if tour is enabled
({
ended: function() {
return this.getState("end");
},
// Restart tour
restart: function() {
this.setState("current_step", null);
return this.setState("end", null);
},
// Hide the specified step
hideStep: function(i) {
var step;
step = this.getStep(i);
... | CoffeeScript | JavaScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | 206e43eca48e89346d5254d3d1c0b61621587ef4 | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/206e43eca48e89346d5254d3d1c0b61621587ef4/bootstrap-tour.coffee | 83 | 124 |
sorich87/bootstrap-tour:bootstrap-tour.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// Verify if tour is enabled
({
ended: function() {
return this.getState("end");
},
// Restart tour
restart: function() {
this.setState("current_step", null);
return this.setState("end", null);
},
// Hide the specified step
hideStep: funct... | # Verify if tour is enabled
ended: ->
@getState("end")
# Restart tour
restart: ->
@setState("current_step", null)
@setState("end", null)
# Hide the specified step
hideStep: (i) ->
step = @getStep(i)
step.onHide(@) if step.onHide?
$(step.element).popover("hide")... | JavaScript | CoffeeScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | 206e43eca48e89346d5254d3d1c0b61621587ef4 | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/206e43eca48e89346d5254d3d1c0b61621587ef4/bootstrap-tour.coffee | 83 | 124 |
sorich87/bootstrap-tour:bootstrap-tour.coffee:3:completion | completion | # Verify if tour is enabled
ended: ->
@getState("end")
# Restart tour
restart: ->
@setState("current_step", null)
@setState("end", null)
# Hide the specified step
hideStep: (i) ->
step = @getStep(i)
step.onHide(@) if step.onHide?
$(step.element).popover("hide")... | unless step.element?
@end
return
@setCurrentStep(i)
# Redirect to step path if not already there
# Compare to path, then filename
if step.path != "" && document.location.pathname != step.path && document.location.pathname.replace(/^.*[\\\/]/, '') != step.path
document.l... | CoffeeScript | CoffeeScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | 206e43eca48e89346d5254d3d1c0b61621587ef4 | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/206e43eca48e89346d5254d3d1c0b61621587ef4/bootstrap-tour.coffee | 83 | 124 |
sorich87/bootstrap-tour:bootstrap-tour.coffee:4:raw_corpus | raw_corpus | step.onShow(@) if step.onShow?
# Show popover
@showPopover(step, i)
# Setup current step variable
setCurrentStep: (value) ->
if value?
@_current = value
@setState("current_step", value)
else
@_current = @getState("current_step")
if (@_current == null || ... | CoffeeScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | 206e43eca48e89346d5254d3d1c0b61621587ef4 | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/206e43eca48e89346d5254d3d1c0b61621587ef4/bootstrap-tour.coffee | 126 | 169 | ||
sorich87/bootstrap-tour:bootstrap-tour.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
step.onShow(@) if step.onShow?
# Show popover
@showPopover(step, i)
# Setup current step variable
setCurrentStep: (value) ->
if value?
@_current = value
@setState("current_step", value)
else
@_current = @g... | // Show popover
step.onShow(this)(step.onShow != null ? this.showPopover(step, i) : void 0);
({
// Setup current step variable
setCurrentStep: function(value) {
if (value != null) {
this._current = value;
return this.setState("current_step", value);
} else {
this._current = this.getState(... | CoffeeScript | JavaScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | 206e43eca48e89346d5254d3d1c0b61621587ef4 | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/206e43eca48e89346d5254d3d1c0b61621587ef4/bootstrap-tour.coffee | 126 | 169 |
sorich87/bootstrap-tour:bootstrap-tour.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// Show popover
step.onShow(this)(step.onShow != null ? this.showPopover(step, i) : void 0);
({
// Setup current step variable
setCurrentStep: function(value) {
if (value != null) {
this._current = value;
return this.setState("current_step", va... | step.onShow(@) if step.onShow?
# Show popover
@showPopover(step, i)
# Setup current step variable
setCurrentStep: (value) ->
if value?
@_current = value
@setState("current_step", value)
else
@_current = @getState("current_step")
if (@_current == null || ... | JavaScript | CoffeeScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | 206e43eca48e89346d5254d3d1c0b61621587ef4 | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/206e43eca48e89346d5254d3d1c0b61621587ef4/bootstrap-tour.coffee | 126 | 169 |
sorich87/bootstrap-tour:bootstrap-tour.coffee:4:completion | completion | step.onShow(@) if step.onShow?
# Show popover
@showPopover(step, i)
# Setup current step variable
setCurrentStep: (value) ->
if value?
@_current = value
@setState("current_step", value)
else
@_current = @getState("current_step")
if (@_current == null || ... | # Show next step
showNextStep: ->
step = @getStep(@_current)
@showStep(step.next)
# Show step popover
showPopover: (step, i) ->
content = "#{step.content}<br /><p>"
if step.end
content += "<a href='#' class='end'>End</a>"
else
content += "<a href='##{step.next}... | CoffeeScript | CoffeeScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | 206e43eca48e89346d5254d3d1c0b61621587ef4 | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/206e43eca48e89346d5254d3d1c0b61621587ef4/bootstrap-tour.coffee | 126 | 169 |
sorich87/bootstrap-tour:bootstrap-tour.coffee:5:raw_corpus | raw_corpus | tip = $(step.element).data("popover").tip()
@_reposition(tip)
@_scrollIntoView(tip)
# Prevent popups from crossing over the edge of the window
_reposition: (tip) ->
tipOffset = tip.offset()
offsetBottom = $(document).outerHeight() - tipOffset.top - $(tip).outerHeight()
tipOffset.t... | CoffeeScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | 206e43eca48e89346d5254d3d1c0b61621587ef4 | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/206e43eca48e89346d5254d3d1c0b61621587ef4/bootstrap-tour.coffee | 171 | 195 | ||
sorich87/bootstrap-tour:bootstrap-tour.coffee:5:completion | completion | tip = $(step.element).data("popover").tip()
@_reposition(tip)
@_scrollIntoView(tip)
# Prevent popups from crossing over the edge of the window
_reposition: (tip) ->
tipOffset = tip.offset()
offsetBottom = $(document).outerHeight() - tipOffset.top - $(tip).outerHeight()
tipOffset.t... | tipOffset.top = 0 if tipOffset.top < 0
tipOffset.left = 0 if tipOffset.left < 0
tip.offset(tipOffset)
# Scroll to the popup if it is not in the viewport
_scrollIntoView: (tip) ->
tipRect = tip.get(0).getBoundingClientRect()
unless tipRect.top > 0 && tipRect.bottom < $(window).height() &... | CoffeeScript | CoffeeScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | 206e43eca48e89346d5254d3d1c0b61621587ef4 | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/206e43eca48e89346d5254d3d1c0b61621587ef4/bootstrap-tour.coffee | 171 | 195 |
sorich87/bootstrap-tour:bootstrap-tour.coffee:2:raw_corpus | raw_corpus | setState: (key, value) ->
$.cookie("tour_" + key, value, { expires: 36500, path: '/' })
@_options.afterSetState(key, value)
getState: (key) ->
value = $.cookie("tour_" + key)
@_options.afterGetState(key, value)
return value
# Add a new step
addStep: (step) ->
@_steps.pu... | CoffeeScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | e06ce0772d03dfe2d005abb6945b022a436600ba | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/e06ce0772d03dfe2d005abb6945b022a436600ba/bootstrap-tour.coffee | 43 | 81 | ||
sorich87/bootstrap-tour:bootstrap-tour.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
setState: (key, value) ->
$.cookie("tour_" + key, value, { expires: 36500, path: '/' })
@_options.afterSetState(key, value)
getState: (key) ->
value = $.cookie("tour_" + key)
@_options.afterGetState(key, value)
return value
... | ({
setState: function(key, value) {
$.cookie("tour_" + key, value, {
expires: 36500,
path: '/'
});
return this._options.afterSetState(key, value);
},
getState: function(key) {
var value;
value = $.cookie("tour_" + key);
this._options.afterGetState(key, value);
return value;... | CoffeeScript | JavaScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | e06ce0772d03dfe2d005abb6945b022a436600ba | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/e06ce0772d03dfe2d005abb6945b022a436600ba/bootstrap-tour.coffee | 43 | 81 |
sorich87/bootstrap-tour:bootstrap-tour.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
setState: function(key, value) {
$.cookie("tour_" + key, value, {
expires: 36500,
path: '/'
});
return this._options.afterSetState(key, value);
},
getState: function(key) {
var value;
value = $.cookie("tour_" + key);
thi... | setState: (key, value) ->
$.cookie("tour_" + key, value, { expires: 36500, path: '/' })
@_options.afterSetState(key, value)
getState: (key) ->
value = $.cookie("tour_" + key)
@_options.afterGetState(key, value)
return value
# Add a new step
addStep: (step) ->
@_steps.pu... | JavaScript | CoffeeScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | e06ce0772d03dfe2d005abb6945b022a436600ba | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/e06ce0772d03dfe2d005abb6945b022a436600ba/bootstrap-tour.coffee | 43 | 81 |
sorich87/bootstrap-tour:bootstrap-tour.coffee:2:completion | completion | setState: (key, value) ->
$.cookie("tour_" + key, value, { expires: 36500, path: '/' })
@_options.afterSetState(key, value)
getState: (key) ->
value = $.cookie("tour_" + key)
@_options.afterGetState(key, value)
return value
# Add a new step
addStep: (step) ->
@_steps.pu... | content: "",
next: i + 1,
end: i == @_steps.length - 1,
animation: true
}, @_steps[i])
# Start tour from current step
start: (force = false) ->
if force || @yes()
@showStep(@_current)
# Hide current step and show next step
next: ->
@hideStep(@_current)... | CoffeeScript | CoffeeScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | e06ce0772d03dfe2d005abb6945b022a436600ba | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/e06ce0772d03dfe2d005abb6945b022a436600ba/bootstrap-tour.coffee | 43 | 81 |
sorich87/bootstrap-tour:bootstrap-tour.coffee:3:raw_corpus | raw_corpus | # Verify if tour is enabled
yes: ->
!@getState("end")
# Hide the specified step
hideStep: (i) ->
step = @getStep(i)
step.onHide(@) if step.onHide?
$(step.element).popover("hide")
# Show the specified step
showStep: (i) ->
step = @getStep(i)
# If step doesn't e... | CoffeeScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | e06ce0772d03dfe2d005abb6945b022a436600ba | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/e06ce0772d03dfe2d005abb6945b022a436600ba/bootstrap-tour.coffee | 83 | 121 | ||
sorich87/bootstrap-tour:bootstrap-tour.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# Verify if tour is enabled
yes: ->
!@getState("end")
# Hide the specified step
hideStep: (i) ->
step = @getStep(i)
step.onHide(@) if step.onHide?
$(step.element).popover("hide")
# Show the specified step
showStep: (... | // Verify if tour is enabled
({
yes: function() {
return !this.getState("end");
},
// Hide the specified step
hideStep: function(i) {
var step;
step = this.getStep(i);
if (step.onHide != null) {
step.onHide(this);
}
return $(step.element).popover("hide");
},
// Show the specifi... | CoffeeScript | JavaScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | e06ce0772d03dfe2d005abb6945b022a436600ba | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/e06ce0772d03dfe2d005abb6945b022a436600ba/bootstrap-tour.coffee | 83 | 121 |
sorich87/bootstrap-tour:bootstrap-tour.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// Verify if tour is enabled
({
yes: function() {
return !this.getState("end");
},
// Hide the specified step
hideStep: function(i) {
var step;
step = this.getStep(i);
if (step.onHide != null) {
step.onHide(this);
}
return $(st... | # Verify if tour is enabled
yes: ->
!@getState("end")
# Hide the specified step
hideStep: (i) ->
step = @getStep(i)
step.onHide(@) if step.onHide?
$(step.element).popover("hide")
# Show the specified step
showStep: (i) ->
step = @getStep(i)
# If step doesn't e... | JavaScript | CoffeeScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | e06ce0772d03dfe2d005abb6945b022a436600ba | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/e06ce0772d03dfe2d005abb6945b022a436600ba/bootstrap-tour.coffee | 83 | 121 |
sorich87/bootstrap-tour:bootstrap-tour.coffee:3:completion | completion | # Verify if tour is enabled
yes: ->
!@getState("end")
# Hide the specified step
hideStep: (i) ->
step = @getStep(i)
step.onHide(@) if step.onHide?
$(step.element).popover("hide")
# Show the specified step
showStep: (i) ->
step = @getStep(i)
# If step doesn't e... | @setCurrentStep(i)
# Redirect to step path if not already there
# Compare to path, then filename
if step.path != "" && document.location.pathname != step.path && document.location.pathname.replace(/^.*[\\\/]/, '') != step.path
document.location.href = step.path
return
# If step... | CoffeeScript | CoffeeScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | e06ce0772d03dfe2d005abb6945b022a436600ba | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/e06ce0772d03dfe2d005abb6945b022a436600ba/bootstrap-tour.coffee | 83 | 121 |
sorich87/bootstrap-tour:bootstrap-tour.coffee:4:raw_corpus | raw_corpus | # Show popover
@showPopover(step, i)
# Setup current step variable
setCurrentStep: (value) ->
if value?
@_current = value
@setState("current_step", value)
else
@_current = @getState("current_step")
if (@_current == null || @_current == "null")
@_curre... | CoffeeScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | e06ce0772d03dfe2d005abb6945b022a436600ba | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/e06ce0772d03dfe2d005abb6945b022a436600ba/bootstrap-tour.coffee | 123 | 164 | ||
sorich87/bootstrap-tour:bootstrap-tour.coffee:4:completion | completion | # Show popover
@showPopover(step, i)
# Setup current step variable
setCurrentStep: (value) ->
if value?
@_current = value
@setState("current_step", value)
else
@_current = @getState("current_step")
if (@_current == null || @_current == "null")
@_curre... | # Show next step
showNextStep: ->
step = @getStep(@_current)
@showStep(step.next)
# Show step popover
showPopover: (step, i) ->
content = "#{step.content}<br /><p>"
if step.end
content += "<a href='#' class='end'>End</a>"
else
content += "<a href='##{step.next}... | CoffeeScript | CoffeeScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | e06ce0772d03dfe2d005abb6945b022a436600ba | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/e06ce0772d03dfe2d005abb6945b022a436600ba/bootstrap-tour.coffee | 123 | 164 |
sorich87/bootstrap-tour:bootstrap-tour.coffee:5:raw_corpus | raw_corpus | # Bootstrap doesn't prevent elements to cross over the edge of the window, so we do that here
tip = $(step.element).data("popover").tip()
tipOffset = tip.offset()
offsetBottom = $(document).outerHeight() - tipOffset.top - $(tip).outerHeight()
tipOffset.top = tipOffset.top + offsetBottom if offs... | CoffeeScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | 2e830d622a8a7a22e4d2cc6ebe512ccf7e0ed792 | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/2e830d622a8a7a22e4d2cc6ebe512ccf7e0ed792/bootstrap-tour.coffee | 166 | 181 | ||
sorich87/bootstrap-tour:bootstrap-tour.coffee:5:completion | completion | # Bootstrap doesn't prevent elements to cross over the edge of the window, so we do that here
tip = $(step.element).data("popover").tip()
tipOffset = tip.offset()
offsetBottom = $(document).outerHeight() - tipOffset.top - $(tip).outerHeight()
tipOffset.top = tipOffset.top + offsetBottom if offs... | tipOffset.top = 0 if tipOffset.top < 0
tipOffset.left = 0 if tipOffset.left < 0
tip.offset(tipOffset)
window.Tour = Tour
)(jQuery, window) | CoffeeScript | CoffeeScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | 2e830d622a8a7a22e4d2cc6ebe512ccf7e0ed792 | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/2e830d622a8a7a22e4d2cc6ebe512ccf7e0ed792/bootstrap-tour.coffee | 166 | 181 |
sorich87/bootstrap-tour:bootstrap-tour.coffee:1:raw_corpus | raw_corpus | ### ============================================================
# bootstrap-tour.js v0.1
# http://pushly.github.com/bootstrap-tour/
# ==============================================================
# Copyright 2012 Push.ly
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file e... | CoffeeScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | 0f702fc181e777df3ef49d600f0dd553588840e6 | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/0f702fc181e777df3ef49d600f0dd553588840e6/bootstrap-tour.coffee | 1 | 41 | ||
sorich87/bootstrap-tour:bootstrap-tour.coffee:1:completion | completion | ### ============================================================
# bootstrap-tour.js v0.1
# http://pushly.github.com/bootstrap-tour/
# ==============================================================
# Copyright 2012 Push.ly
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file e... | document = window.document
class Tour
constructor: (options) ->
@_options = $.extend({
afterSetState: (key, value) ->
afterGetState: (key, value) ->
}, options)
@_steps = []
@setCurrentStep()
# Go to next step after click on element with class .next
$(documen... | CoffeeScript | CoffeeScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | 0f702fc181e777df3ef49d600f0dd553588840e6 | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/0f702fc181e777df3ef49d600f0dd553588840e6/bootstrap-tour.coffee | 1 | 41 |
sorich87/bootstrap-tour:bootstrap-tour.coffee:2:raw_corpus | raw_corpus | setState: (key, value) ->
$.cookie("tour_" + key, value, { expires: 36500, path: '/' })
@_options.afterSetState(key, value)
getState: (key) ->
value = $.cookie("tour_" + key)
@_options.afterGetState(key, value)
return value
# Add a new step
addStep: (step) ->
@_steps.pu... | CoffeeScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | 0f702fc181e777df3ef49d600f0dd553588840e6 | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/0f702fc181e777df3ef49d600f0dd553588840e6/bootstrap-tour.coffee | 43 | 82 | ||
sorich87/bootstrap-tour:bootstrap-tour.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
setState: (key, value) ->
$.cookie("tour_" + key, value, { expires: 36500, path: '/' })
@_options.afterSetState(key, value)
getState: (key) ->
value = $.cookie("tour_" + key)
@_options.afterGetState(key, value)
return value
... | ({
setState: function(key, value) {
$.cookie("tour_" + key, value, {
expires: 36500,
path: '/'
});
return this._options.afterSetState(key, value);
},
getState: function(key) {
var value;
value = $.cookie("tour_" + key);
this._options.afterGetState(key, value);
return value;... | CoffeeScript | JavaScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | 0f702fc181e777df3ef49d600f0dd553588840e6 | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/0f702fc181e777df3ef49d600f0dd553588840e6/bootstrap-tour.coffee | 43 | 82 |
sorich87/bootstrap-tour:bootstrap-tour.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
setState: function(key, value) {
$.cookie("tour_" + key, value, {
expires: 36500,
path: '/'
});
return this._options.afterSetState(key, value);
},
getState: function(key) {
var value;
value = $.cookie("tour_" + key);
thi... | setState: (key, value) ->
$.cookie("tour_" + key, value, { expires: 36500, path: '/' })
@_options.afterSetState(key, value)
getState: (key) ->
value = $.cookie("tour_" + key)
@_options.afterGetState(key, value)
return value
# Add a new step
addStep: (step) ->
@_steps.pu... | JavaScript | CoffeeScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | 0f702fc181e777df3ef49d600f0dd553588840e6 | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/0f702fc181e777df3ef49d600f0dd553588840e6/bootstrap-tour.coffee | 43 | 82 |
sorich87/bootstrap-tour:bootstrap-tour.coffee:2:completion | completion | setState: (key, value) ->
$.cookie("tour_" + key, value, { expires: 36500, path: '/' })
@_options.afterSetState(key, value)
getState: (key) ->
value = $.cookie("tour_" + key)
@_options.afterGetState(key, value)
return value
# Add a new step
addStep: (step) ->
@_steps.pu... | @hideStep(@_current)
@showNextStep()
# End tour
end: ->
@hideStep(@_current)
@setState("end", "yes")
# Verify if tour is enabled
yes: ->
!@getState("end")
# Hide the specified step
hideStep: (i) ->
step = @_steps[i]
return unless step?
step.onHide(@)... | CoffeeScript | CoffeeScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | 0f702fc181e777df3ef49d600f0dd553588840e6 | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/0f702fc181e777df3ef49d600f0dd553588840e6/bootstrap-tour.coffee | 43 | 82 |
sorich87/bootstrap-tour:bootstrap-tour.coffee:3:raw_corpus | raw_corpus | # Show the specified step
showStep: (i) ->
step = @_steps[i]
# If step doesn't exist, end tour
unless step?
@end
return
@setCurrentStep(i)
# Redirect to step path if not already there
# Compare to path, then filename
if step.path? && document.location.pat... | CoffeeScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | 0f702fc181e777df3ef49d600f0dd553588840e6 | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/0f702fc181e777df3ef49d600f0dd553588840e6/bootstrap-tour.coffee | 84 | 125 | ||
sorich87/bootstrap-tour:bootstrap-tour.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# Show the specified step
showStep: (i) ->
step = @_steps[i]
# If step doesn't exist, end tour
unless step?
@end
return
@setCurrentStep(i)
# Redirect to step path if not already there
# Compare to path, t... | // Show the specified step
({
showStep: function(i) {
var endOnClick, step;
step = this._steps[i];
// If step doesn't exist, end tour
if (step == null) {
this.end;
return;
}
this.setCurrentStep(i);
// Redirect to step path if not already there
// Compare to path, then filen... | CoffeeScript | JavaScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | 0f702fc181e777df3ef49d600f0dd553588840e6 | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/0f702fc181e777df3ef49d600f0dd553588840e6/bootstrap-tour.coffee | 84 | 125 |
sorich87/bootstrap-tour:bootstrap-tour.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// Show the specified step
({
showStep: function(i) {
var endOnClick, step;
step = this._steps[i];
// If step doesn't exist, end tour
if (step == null) {
this.end;
return;
}
this.setCurrentStep(i);
// Redirect to step path ... | # Show the specified step
showStep: (i) ->
step = @_steps[i]
# If step doesn't exist, end tour
unless step?
@end
return
@setCurrentStep(i)
# Redirect to step path if not already there
# Compare to path, then filename
if step.path? && document.location.pat... | JavaScript | CoffeeScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | 0f702fc181e777df3ef49d600f0dd553588840e6 | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/0f702fc181e777df3ef49d600f0dd553588840e6/bootstrap-tour.coffee | 84 | 125 |
sorich87/bootstrap-tour:bootstrap-tour.coffee:3:completion | completion | # Show the specified step
showStep: (i) ->
step = @_steps[i]
# If step doesn't exist, end tour
unless step?
@end
return
@setCurrentStep(i)
# Redirect to step path if not already there
# Compare to path, then filename
if step.path? && document.location.pat... | @showNextStep()
return
# Setup even handler for hiding step
endOnClick = step.endOnClick || step.element
$(endOnClick).one "click", () =>
@endCurrentStep()
step.onShow(@) if step.onShow?
# Show popover
@showPopover(step, i)
# Show step popover
showPopover:... | CoffeeScript | CoffeeScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | 0f702fc181e777df3ef49d600f0dd553588840e6 | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/0f702fc181e777df3ef49d600f0dd553588840e6/bootstrap-tour.coffee | 84 | 125 |
sorich87/bootstrap-tour:bootstrap-tour.coffee:4:raw_corpus | raw_corpus | $(step.element).popover({
placement: step.placement
trigger: "manual"
title: step.title
content: content
}).popover("show")
# Bootstrap doesn't prevent elements to cross over the edge of the window, so we do that here
tip = $(step.element).data("popover").tip()
t... | CoffeeScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | 0f702fc181e777df3ef49d600f0dd553588840e6 | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/0f702fc181e777df3ef49d600f0dd553588840e6/bootstrap-tour.coffee | 127 | 165 | ||
sorich87/bootstrap-tour:bootstrap-tour.coffee:4:completion | completion | $(step.element).popover({
placement: step.placement
trigger: "manual"
title: step.title
content: content
}).popover("show")
# Bootstrap doesn't prevent elements to cross over the edge of the window, so we do that here
tip = $(step.element).data("popover").tip()
t... | # Return current step
getCurrentStep: -> @_steps[@_current]
# Setup current step variable
setCurrentStep: (value) ->
if value?
@_current = value
@setState("current_step", value)
else
@_current = @getState("current_step")
if (@_current == null || @_current == "nul... | CoffeeScript | CoffeeScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | 0f702fc181e777df3ef49d600f0dd553588840e6 | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/0f702fc181e777df3ef49d600f0dd553588840e6/bootstrap-tour.coffee | 127 | 165 |
sorich87/bootstrap-tour:bootstrap-tour.coffee:5:raw_corpus | raw_corpus | # Show next step
showNextStep: ->
step = @_steps[@_current]
next_step = if step.next then step.next else @_current + 1
@showStep(next_step)
# Set next step variable
setNextStep: (i) ->
i = @_current unless i?
step = @_steps[i]
@_next = if step.next then step.next else i ... | CoffeeScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | 0f702fc181e777df3ef49d600f0dd553588840e6 | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/0f702fc181e777df3ef49d600f0dd553588840e6/bootstrap-tour.coffee | 167 | 181 | ||
sorich87/bootstrap-tour:bootstrap-tour.coffee:5:completion | completion | # Show next step
showNextStep: ->
step = @_steps[@_current]
next_step = if step.next then step.next else @_current + 1
@showStep(next_step)
# Set next step variable | setNextStep: (i) ->
i = @_current unless i?
step = @_steps[i]
@_next = if step.next then step.next else i + 1
window.Tour = Tour
)(jQuery, window) | CoffeeScript | CoffeeScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | 0f702fc181e777df3ef49d600f0dd553588840e6 | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/0f702fc181e777df3ef49d600f0dd553588840e6/bootstrap-tour.coffee | 167 | 181 |
sorich87/bootstrap-tour:bootstrap-tour.coffee:2:raw_corpus | raw_corpus | setState: (key, value) ->
$.cookie("tour_" + key, value, { expires: 36500, path: '/' })
@_options.afterSetState(key, value)
getState: (key) ->
value = $.cookie("tour_" + key)
@_options.afterGetState(key, value)
return value
# Add a new step
addStep: (step) ->
@_steps.pu... | CoffeeScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | 740ace4a2ed62e709b876bc35a810838a3b8620b | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/740ace4a2ed62e709b876bc35a810838a3b8620b/bootstrap-tour.coffee | 43 | 81 | ||
sorich87/bootstrap-tour:bootstrap-tour.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
setState: (key, value) ->
$.cookie("tour_" + key, value, { expires: 36500, path: '/' })
@_options.afterSetState(key, value)
getState: (key) ->
value = $.cookie("tour_" + key)
@_options.afterGetState(key, value)
return value
... | ({
setState: function(key, value) {
$.cookie("tour_" + key, value, {
expires: 36500,
path: '/'
});
return this._options.afterSetState(key, value);
},
getState: function(key) {
var value;
value = $.cookie("tour_" + key);
this._options.afterGetState(key, value);
return value;... | CoffeeScript | JavaScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | 740ace4a2ed62e709b876bc35a810838a3b8620b | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/740ace4a2ed62e709b876bc35a810838a3b8620b/bootstrap-tour.coffee | 43 | 81 |
sorich87/bootstrap-tour:bootstrap-tour.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
setState: function(key, value) {
$.cookie("tour_" + key, value, {
expires: 36500,
path: '/'
});
return this._options.afterSetState(key, value);
},
getState: function(key) {
var value;
value = $.cookie("tour_" + key);
thi... | setState: (key, value) ->
$.cookie("tour_" + key, value, { expires: 36500, path: '/' })
@_options.afterSetState(key, value)
getState: (key) ->
value = $.cookie("tour_" + key)
@_options.afterGetState(key, value)
return value
# Add a new step
addStep: (step) ->
@_steps.pu... | JavaScript | CoffeeScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | 740ace4a2ed62e709b876bc35a810838a3b8620b | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/740ace4a2ed62e709b876bc35a810838a3b8620b/bootstrap-tour.coffee | 43 | 81 |
sorich87/bootstrap-tour:bootstrap-tour.coffee:2:completion | completion | setState: (key, value) ->
$.cookie("tour_" + key, value, { expires: 36500, path: '/' })
@_options.afterSetState(key, value)
getState: (key) ->
value = $.cookie("tour_" + key)
@_options.afterGetState(key, value)
return value
# Add a new step
addStep: (step) ->
@_steps.pu... | @hideStep(@_current)
@showNextStep()
# End tour
end: ->
@hideStep(@_current)
@setState("end", "yes")
# Verify if tour is enabled
yes: ->
!@getState("end")
# Hide the specified step
hideStep: (i) ->
step = @_steps[i]
return unless step?
step.onHide(@)... | CoffeeScript | CoffeeScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | 740ace4a2ed62e709b876bc35a810838a3b8620b | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/740ace4a2ed62e709b876bc35a810838a3b8620b/bootstrap-tour.coffee | 43 | 81 |
sorich87/bootstrap-tour:bootstrap-tour.coffee:1:raw_corpus | raw_corpus | ### ============================================================
# bootstrap-tour.js v0.1
# http://pushly.github.com/bootstrap-tour/
# ==============================================================
# Copyright 2012 Push.ly
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file e... | CoffeeScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | 0c23a704511458a8893c7ecf7e16cd3642796266 | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/0c23a704511458a8893c7ecf7e16cd3642796266/bootstrap-tour.coffee | 1 | 41 | ||
sorich87/bootstrap-tour:bootstrap-tour.coffee:1:completion | completion | ### ============================================================
# bootstrap-tour.js v0.1
# http://pushly.github.com/bootstrap-tour/
# ==============================================================
# Copyright 2012 Push.ly
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file e... | document = window.document
class Tour
constructor: (options) ->
@_options = $.extend({
afterSaveState: (key, value) ->
afterGetState: (key, value) ->
}, options)
@_steps = []
@setCurrentStep()
# Go to next step after click on element with class .next
$(docume... | CoffeeScript | CoffeeScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | 0c23a704511458a8893c7ecf7e16cd3642796266 | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/0c23a704511458a8893c7ecf7e16cd3642796266/bootstrap-tour.coffee | 1 | 41 |
sorich87/bootstrap-tour:bootstrap-tour.coffee:2:raw_corpus | raw_corpus | saveState: (key, value) ->
$.cookie("tour_" + key, value, { expires: 36500, path: '/' })
@_options.afterSaveState(key, value)
getState: (key) ->
value = $.cookie("tour_" + key)
@_options.afterGetState(key, value)
return value
# Add a new step
addStep: (step) ->
@_steps.... | CoffeeScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | 0c23a704511458a8893c7ecf7e16cd3642796266 | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/0c23a704511458a8893c7ecf7e16cd3642796266/bootstrap-tour.coffee | 43 | 81 | ||
sorich87/bootstrap-tour:bootstrap-tour.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
saveState: (key, value) ->
$.cookie("tour_" + key, value, { expires: 36500, path: '/' })
@_options.afterSaveState(key, value)
getState: (key) ->
value = $.cookie("tour_" + key)
@_options.afterGetState(key, value)
return value
... | ({
saveState: function(key, value) {
$.cookie("tour_" + key, value, {
expires: 36500,
path: '/'
});
return this._options.afterSaveState(key, value);
},
getState: function(key) {
var value;
value = $.cookie("tour_" + key);
this._options.afterGetState(key, value);
return valu... | CoffeeScript | JavaScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | 0c23a704511458a8893c7ecf7e16cd3642796266 | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/0c23a704511458a8893c7ecf7e16cd3642796266/bootstrap-tour.coffee | 43 | 81 |
sorich87/bootstrap-tour:bootstrap-tour.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
saveState: function(key, value) {
$.cookie("tour_" + key, value, {
expires: 36500,
path: '/'
});
return this._options.afterSaveState(key, value);
},
getState: function(key) {
var value;
value = $.cookie("tour_" + key);
t... | saveState: (key, value) ->
$.cookie("tour_" + key, value, { expires: 36500, path: '/' })
@_options.afterSaveState(key, value)
getState: (key) ->
value = $.cookie("tour_" + key)
@_options.afterGetState(key, value)
return value
# Add a new step
addStep: (step) ->
@_steps.... | JavaScript | CoffeeScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | 0c23a704511458a8893c7ecf7e16cd3642796266 | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/0c23a704511458a8893c7ecf7e16cd3642796266/bootstrap-tour.coffee | 43 | 81 |
sorich87/bootstrap-tour:bootstrap-tour.coffee:2:completion | completion | saveState: (key, value) ->
$.cookie("tour_" + key, value, { expires: 36500, path: '/' })
@_options.afterSaveState(key, value)
getState: (key) ->
value = $.cookie("tour_" + key)
@_options.afterGetState(key, value)
return value
# Add a new step
addStep: (step) ->
@_steps.... | @hideStep(@_current)
@showNextStep()
# End tour
end: ->
@hideStep(@_current)
@saveState("end", "yes")
# Verify if tour is enabled
yes: ->
!@getState("end")
# Hide the specified step
hideStep: (i) ->
step = @_steps[i]
return unless step?
step.onHide(@... | CoffeeScript | CoffeeScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | 0c23a704511458a8893c7ecf7e16cd3642796266 | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/0c23a704511458a8893c7ecf7e16cd3642796266/bootstrap-tour.coffee | 43 | 81 |
sorich87/bootstrap-tour:bootstrap-tour.coffee:3:raw_corpus | raw_corpus | # Show the specified step
showStep: (i) ->
step = @_steps[i]
# If step doesn't exist, end tour
unless step?
@end
return
@saveStep(i)
# Redirect to step path if not already there
# Compare to path, then filename
if step.path? && document.location.pathname ... | CoffeeScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | 0c23a704511458a8893c7ecf7e16cd3642796266 | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/0c23a704511458a8893c7ecf7e16cd3642796266/bootstrap-tour.coffee | 83 | 124 | ||
sorich87/bootstrap-tour:bootstrap-tour.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# Show the specified step
showStep: (i) ->
step = @_steps[i]
# If step doesn't exist, end tour
unless step?
@end
return
@saveStep(i)
# Redirect to step path if not already there
# Compare to path, then fi... | // Show the specified step
({
showStep: function(i) {
var endOnClick, step;
step = this._steps[i];
// If step doesn't exist, end tour
if (step == null) {
this.end;
return;
}
this.saveStep(i);
// Redirect to step path if not already there
// Compare to path, then filename
... | CoffeeScript | JavaScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | 0c23a704511458a8893c7ecf7e16cd3642796266 | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/0c23a704511458a8893c7ecf7e16cd3642796266/bootstrap-tour.coffee | 83 | 124 |
sorich87/bootstrap-tour:bootstrap-tour.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// Show the specified step
({
showStep: function(i) {
var endOnClick, step;
step = this._steps[i];
// If step doesn't exist, end tour
if (step == null) {
this.end;
return;
}
this.saveStep(i);
// Redirect to step path if not... | # Show the specified step
showStep: (i) ->
step = @_steps[i]
# If step doesn't exist, end tour
unless step?
@end
return
@saveStep(i)
# Redirect to step path if not already there
# Compare to path, then filename
if step.path? && document.location.pathname ... | JavaScript | CoffeeScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | 0c23a704511458a8893c7ecf7e16cd3642796266 | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/0c23a704511458a8893c7ecf7e16cd3642796266/bootstrap-tour.coffee | 83 | 124 |
sorich87/bootstrap-tour:bootstrap-tour.coffee:3:completion | completion | # Show the specified step
showStep: (i) ->
step = @_steps[i]
# If step doesn't exist, end tour
unless step?
@end
return
@saveStep(i)
# Redirect to step path if not already there
# Compare to path, then filename
if step.path? && document.location.pathname ... | @showNextStep()
return
# Setup even handler for hiding step
endOnClick = step.endOnClick || step.element
$(endOnClick).one "click", () =>
@endCurrentStep()
step.onShow(@) if step.onShow?
# Show popover
@showPopover(step, i)
# Show step popover
showPopover:... | CoffeeScript | CoffeeScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | 0c23a704511458a8893c7ecf7e16cd3642796266 | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/0c23a704511458a8893c7ecf7e16cd3642796266/bootstrap-tour.coffee | 83 | 124 |
sorich87/bootstrap-tour:bootstrap-tour.coffee:4:raw_corpus | raw_corpus | $(step.element).popover({
placement: step.placement
trigger: "manual"
title: step.title
content: content
}).popover("show")
# Bootstrap doesn't prevent elements to cross over the edge of the window, so we do that here
tip = $(step.element).data("popover").tip()
t... | CoffeeScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | 0c23a704511458a8893c7ecf7e16cd3642796266 | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/0c23a704511458a8893c7ecf7e16cd3642796266/bootstrap-tour.coffee | 126 | 165 | ||
sorich87/bootstrap-tour:bootstrap-tour.coffee:4:completion | completion | $(step.element).popover({
placement: step.placement
trigger: "manual"
title: step.title
content: content
}).popover("show")
# Bootstrap doesn't prevent elements to cross over the edge of the window, so we do that here
tip = $(step.element).data("popover").tip()
t... | # Return current step
getCurrentStep: -> @_steps[@_current]
# Setup current step variable
setCurrentStep: ->
@_current = @getState("current_step")
if (@_current == null || @_current == "null")
@_current = 0
else
@_current = parseInt(@_current)
# Save step
saveStep... | CoffeeScript | CoffeeScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | 0c23a704511458a8893c7ecf7e16cd3642796266 | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/0c23a704511458a8893c7ecf7e16cd3642796266/bootstrap-tour.coffee | 126 | 165 |
sorich87/bootstrap-tour:bootstrap-tour.coffee:3:raw_corpus | raw_corpus | # Show the specified step
showStep: (i) ->
step = @_steps[i]
# If step doesn't exist, end tour
unless step?
@end
return
@saveStep(i)
# Redirect to step path if not already there
if document.location.pathname != step.path
document.location.href = step.pa... | CoffeeScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | 66f46fc4d71ee19e6f6eba9962f8586042bd4269 | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/66f46fc4d71ee19e6f6eba9962f8586042bd4269/bootstrap-tour.coffee | 83 | 123 | ||
sorich87/bootstrap-tour:bootstrap-tour.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# Show the specified step
showStep: (i) ->
step = @_steps[i]
# If step doesn't exist, end tour
unless step?
@end
return
@saveStep(i)
# Redirect to step path if not already there
if document.location.pathn... | // Show the specified step
({
showStep: function(i) {
var endOnClick, step;
step = this._steps[i];
// If step doesn't exist, end tour
if (step == null) {
this.end;
return;
}
this.saveStep(i);
// Redirect to step path if not already there
if (document.location.pathname !== s... | CoffeeScript | JavaScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | 66f46fc4d71ee19e6f6eba9962f8586042bd4269 | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/66f46fc4d71ee19e6f6eba9962f8586042bd4269/bootstrap-tour.coffee | 83 | 123 |
sorich87/bootstrap-tour:bootstrap-tour.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// Show the specified step
({
showStep: function(i) {
var endOnClick, step;
step = this._steps[i];
// If step doesn't exist, end tour
if (step == null) {
this.end;
return;
}
this.saveStep(i);
// Redirect to step path if not... | # Show the specified step
showStep: (i) ->
step = @_steps[i]
# If step doesn't exist, end tour
unless step?
@end
return
@saveStep(i)
# Redirect to step path if not already there
if document.location.pathname != step.path
document.location.href = step.pa... | JavaScript | CoffeeScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | 66f46fc4d71ee19e6f6eba9962f8586042bd4269 | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/66f46fc4d71ee19e6f6eba9962f8586042bd4269/bootstrap-tour.coffee | 83 | 123 |
sorich87/bootstrap-tour:bootstrap-tour.coffee:3:completion | completion | # Show the specified step
showStep: (i) ->
step = @_steps[i]
# If step doesn't exist, end tour
unless step?
@end
return
@saveStep(i)
# Redirect to step path if not already there
if document.location.pathname != step.path
document.location.href = step.pa... | @showNextStep()
return
# Setup even handler for hiding step
endOnClick = step.endOnClick || step.element
$(endOnClick).one "click", () =>
@endCurrentStep()
step.onShow(@) if step.onShow?
# Show popover
@showPopover(step, i)
# Show step popover
showPopover:... | CoffeeScript | CoffeeScript | sorich87/bootstrap-tour | bootstrap-tour.coffee | MIT | 66f46fc4d71ee19e6f6eba9962f8586042bd4269 | 4,416 | https://github.com/sorich87/bootstrap-tour/blob/66f46fc4d71ee19e6f6eba9962f8586042bd4269/bootstrap-tour.coffee | 83 | 123 |
jianliaoim/talk-os:talk-account/client/app/thirdparty-entries.coffee:1:raw_corpus | raw_corpus | React = require 'react'
Immutable = require 'immutable'
ajax = require '../ajax'
locales = require '../locales'
controllers = require '../controllers'
Space = React.createFactory require 'react-lite-space'
{div, span, a} = React.DOM
module.exports = React.createClass
displayName: 'thirdparty-entries'
propTypes... | CoffeeScript | jianliaoim/talk-os | talk-account/client/app/thirdparty-entries.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/app/thirdparty-entries.coffee | 1 | 28 | ||
jianliaoim/talk-os:talk-account/client/app/thirdparty-entries.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
React = require 'react'
Immutable = require 'immutable'
ajax = require '../ajax'
locales = require '../locales'
controllers = require '../controllers'
Space = React.createFactory require 'react-lite-space'
{div, span, a} = React.DOM
module.exports = React.cre... | var Immutable, React, Space, a, ajax, controllers, div, locales, span;
React = require('react');
Immutable = require('immutable');
ajax = require('../ajax');
locales = require('../locales');
controllers = require('../controllers');
Space = React.createFactory(require('react-lite-space'));
({div, span, a} = React... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-account/client/app/thirdparty-entries.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/app/thirdparty-entries.coffee | 1 | 28 |
jianliaoim/talk-os:talk-account/client/app/thirdparty-entries.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Immutable, React, Space, a, ajax, controllers, div, locales, span;
React = require('react');
Immutable = require('immutable');
ajax = require('../ajax');
locales = require('../locales');
controllers = require('../controllers');
Space = React.createFactory... | React = require 'react'
Immutable = require 'immutable'
ajax = require '../ajax'
locales = require '../locales'
controllers = require '../controllers'
Space = React.createFactory require 'react-lite-space'
{div, span, a} = React.DOM
module.exports = React.createClass
displayName: 'thirdparty-entries'
propTypes... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-account/client/app/thirdparty-entries.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/app/thirdparty-entries.coffee | 1 | 28 |
jianliaoim/talk-os:talk-account/client/app/thirdparty-entries.coffee:1:completion | completion | React = require 'react'
Immutable = require 'immutable'
ajax = require '../ajax'
locales = require '../locales'
controllers = require '../controllers'
Space = React.createFactory require 'react-lite-space'
{div, span, a} = React.DOM
module.exports = React.createClass
displayName: 'thirdparty-entries' | propTypes:
language: React.PropTypes.string.isRequired
onRedirectTeambition: (event) ->
event.preventDefault()
controllers.redirectThirdPartyAuth '/union/teambition'
render: ->
a
className: 'thirdparty-entries', href: '/union/teambition'
onClick: @onRedirectTeambition
span classN... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-account/client/app/thirdparty-entries.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/app/thirdparty-entries.coffee | 1 | 28 |
ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/services/services.parameterService.coffee:1:raw_corpus | raw_corpus | ###
# Copyright (c) 2013-2018 the original author or authors.
#
# Licensed under the MIT License (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.opensource.org/licenses/mit-license.php
#
# Unless required by applicable law ... | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/scripts/dashboards/services/services.parameterService.coffee | MIT | 0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/scripts/dashboards/services/services.parameterService.coffee | 1 | 40 | ||
ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/services/services.parameterService.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
###
# Copyright (c) 2013-2018 the original author or authors.
#
# Licensed under the MIT License (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.opensource.org/licens... | /*
* Copyright (c) 2013-2018 the original author or authors.
*
* Licensed under the MIT License (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.opensource.org/licenses/mit-license.php
*
* Unless required by applica... | CoffeeScript | JavaScript | ExpediaGroup/cyclotron | cyclotron-site/app/scripts/dashboards/services/services.parameterService.coffee | MIT | 0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/scripts/dashboards/services/services.parameterService.coffee | 1 | 40 |
ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/services/services.parameterService.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
/*
* Copyright (c) 2013-2018 the original author or authors.
*
* Licensed under the MIT License (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.opensource.org/li... | ###
# Copyright (c) 2013-2018 the original author or authors.
#
# Licensed under the MIT License (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.opensource.org/licenses/mit-license.php
#
# Unless required by applicable law ... | JavaScript | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/scripts/dashboards/services/services.parameterService.coffee | MIT | 0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/scripts/dashboards/services/services.parameterService.coffee | 1 | 40 |
ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/services/services.parameterService.coffee:1:completion | completion | ###
# Copyright (c) 2013-2018 the original author or authors.
#
# Licensed under the MIT License (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.opensource.org/licenses/mit-license.php
#
# Unless required by applicable law ... | getLocalStorageKey = (dashboard, parameterDefinition) ->
'param.' + dashboard.name + '.' + parameterDefinition.name
isSet = (parameterDefinition) ->
$window.Cyclotron.parameters[parameterDefinition.name]?
setValue = (parameterDefinition, value) ->
$window.Cyclotron.parameters[paramete... | CoffeeScript | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/scripts/dashboards/services/services.parameterService.coffee | MIT | 0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/scripts/dashboards/services/services.parameterService.coffee | 1 | 40 |
ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/services/services.parameterService.coffee:2:raw_corpus | raw_corpus | return {
# Load Persisted Values for Parameters
# Returns a promise after all parameters have been initialized
initializeParameters: (dashboard) ->
return $q (resolve, reject) ->
# Shortcut if no parameters
resolve() unless dashboard?.parameters?
... | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/scripts/dashboards/services/services.parameterService.coffee | MIT | 0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/scripts/dashboards/services/services.parameterService.coffee | 42 | 82 | ||
ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/services/services.parameterService.coffee:2:completion | completion | return {
# Load Persisted Values for Parameters
# Returns a promise after all parameters have been initialized
initializeParameters: (dashboard) ->
return $q (resolve, reject) ->
# Shortcut if no parameters
resolve() unless dashboard?.parameters?
... | else
# Not persisted, try to load a default value instead
# Do this inside the promise to avoid race condition
tryLoadDefaultValue parameter
resolve()
else
... | CoffeeScript | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/scripts/dashboards/services/services.parameterService.coffee | MIT | 0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/scripts/dashboards/services/services.parameterService.coffee | 42 | 82 |
ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/services/services.parameterService.coffee:3:raw_corpus | raw_corpus | _.each persistentParams, (parameterDefinition) ->
value = parameters[parameterDefinition.name]
if value?
$localForage.setItem(getLocalStorageKey(dashboard, parameterDefinition), value).then ->
logService.debug 'Saved parameter to localstorage: ... | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/scripts/dashboards/services/services.parameterService.coffee | MIT | 0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/scripts/dashboards/services/services.parameterService.coffee | 84 | 93 | ||
ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/services/services.parameterService.coffee:3:completion | completion | _.each persistentParams, (parameterDefinition) ->
value = parameters[parameterDefinition.name]
if value?
$localForage.setItem(getLocalStorageKey(dashboard, parameterDefinition), value).then ->
logService.debug 'Saved parameter to localstorage: ... | else
$localForage.removeItem(getLocalStorageKey(dashboard, parameterDefinition)).then ->
logService.debug 'Removed parameter from localstorage: ' + parameterDefinition.name
} | CoffeeScript | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/scripts/dashboards/services/services.parameterService.coffee | MIT | 0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/scripts/dashboards/services/services.parameterService.coffee | 84 | 93 |
ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/services/services.parameterService.coffee:1:raw_corpus | raw_corpus | ###
# Copyright (c) 2013-2016 the original author or authors.
#
# Licensed under the MIT License (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.opensource.org/licenses/mit-license.php
#
# Unless required by applicable law ... | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/scripts/dashboards/services/services.parameterService.coffee | MIT | bc4b0328fb9e7d1f539ede0b874aba475a4c8f0d | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/bc4b0328fb9e7d1f539ede0b874aba475a4c8f0d/cyclotron-site/app/scripts/dashboards/services/services.parameterService.coffee | 1 | 40 | ||
ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/services/services.parameterService.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
###
# Copyright (c) 2013-2016 the original author or authors.
#
# Licensed under the MIT License (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.opensource.org/licens... | /*
* Copyright (c) 2013-2016 the original author or authors.
*
* Licensed under the MIT License (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.opensource.org/licenses/mit-license.php
*
* Unless required by applica... | CoffeeScript | JavaScript | ExpediaGroup/cyclotron | cyclotron-site/app/scripts/dashboards/services/services.parameterService.coffee | MIT | bc4b0328fb9e7d1f539ede0b874aba475a4c8f0d | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/bc4b0328fb9e7d1f539ede0b874aba475a4c8f0d/cyclotron-site/app/scripts/dashboards/services/services.parameterService.coffee | 1 | 40 |
ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/services/services.parameterService.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
/*
* Copyright (c) 2013-2016 the original author or authors.
*
* Licensed under the MIT License (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.opensource.org/li... | ###
# Copyright (c) 2013-2016 the original author or authors.
#
# Licensed under the MIT License (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.opensource.org/licenses/mit-license.php
#
# Unless required by applicable law ... | JavaScript | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/scripts/dashboards/services/services.parameterService.coffee | MIT | bc4b0328fb9e7d1f539ede0b874aba475a4c8f0d | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/bc4b0328fb9e7d1f539ede0b874aba475a4c8f0d/cyclotron-site/app/scripts/dashboards/services/services.parameterService.coffee | 1 | 40 |
ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/services/services.parameterService.coffee:1:completion | completion | ###
# Copyright (c) 2013-2016 the original author or authors.
#
# Licensed under the MIT License (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.opensource.org/licenses/mit-license.php
#
# Unless required by applicable law ... | getLocalStorageKey = (dashboard, parameterDefinition) ->
'param.' + dashboard.name + '.' + parameterDefinition.name
isSet = (parameterDefinition) ->
$window.Cyclotron.parameters[parameterDefinition.name]?
setValue = (parameterDefinition, value) ->
$window.Cyclotron.parameters[paramete... | CoffeeScript | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/scripts/dashboards/services/services.parameterService.coffee | MIT | bc4b0328fb9e7d1f539ede0b874aba475a4c8f0d | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/bc4b0328fb9e7d1f539ede0b874aba475a4c8f0d/cyclotron-site/app/scripts/dashboards/services/services.parameterService.coffee | 1 | 40 |
ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/services/services.parameterService.coffee:2:raw_corpus | raw_corpus | return {
# Load Persisted Values for Parameters
# Returns a promise after all parameters have been initialized
initializeParameters: (dashboard) ->
return $q (resolve, reject) ->
# Shortcut if no parameters
resolve() unless dashboard?.parameters?
... | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/scripts/dashboards/services/services.parameterService.coffee | MIT | 2c2eb7bc16616a8b1d9601b8307884f5f6be40de | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/2c2eb7bc16616a8b1d9601b8307884f5f6be40de/cyclotron-site/app/scripts/dashboards/services/services.parameterService.coffee | 42 | 82 | ||
ExpediaGroup/cyclotron:cyclotron-site/app/scripts/dashboards/services/services.parameterService.coffee:2:completion | completion | return {
# Load Persisted Values for Parameters
# Returns a promise after all parameters have been initialized
initializeParameters: (dashboard) ->
return $q (resolve, reject) ->
# Shortcut if no parameters
resolve() unless dashboard?.parameters?
... | else
# Not persisted, try to load a default value instead
# Do this inside the promise to avoid race condition
tryLoadDefaultValue parameter
resolve()
else
... | CoffeeScript | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/scripts/dashboards/services/services.parameterService.coffee | MIT | 2c2eb7bc16616a8b1d9601b8307884f5f6be40de | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/2c2eb7bc16616a8b1d9601b8307884f5f6be40de/cyclotron-site/app/scripts/dashboards/services/services.parameterService.coffee | 42 | 82 |
oozcitak/xmlbuilder-js:test/basic/skipnullelements.coffee:1:raw_corpus | raw_corpus | suite 'Element:', ->
test 'Skip if null (ele)', ->
eq(
xml('test', { headless: true })
.ele('node1', 'val1').up()
.ele('node2', null).up()
.ele('node3', undefined).up()
.ele('node4', 'val4').up()
.ele('node5', '').up()
.ele('node6', {att: 'val'}).up()
... | CoffeeScript | oozcitak/xmlbuilder-js | test/basic/skipnullelements.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/basic/skipnullelements.coffee | 1 | 50 | ||
oozcitak/xmlbuilder-js:test/basic/skipnullelements.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
suite 'Element:', ->
test 'Skip if null (ele)', ->
eq(
xml('test', { headless: true })
.ele('node1', 'val1').up()
.ele('node2', null).up()
.ele('node3', undefined).up()
.ele('node4', 'val4').up()
.ele('node5', ... | suite('Element:', function() {
test('Skip if null (ele)', function() {
return eq(xml('test', {
headless: true
}).ele('node1', 'val1').up().ele('node2', null).up().ele('node3', void 0).up().ele('node4', 'val4').up().ele('node5', '').up().ele('node6', {
att: 'val'
}).up().end(), '<test>' + '<nod... | CoffeeScript | JavaScript | oozcitak/xmlbuilder-js | test/basic/skipnullelements.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/basic/skipnullelements.coffee | 1 | 50 |
oozcitak/xmlbuilder-js:test/basic/skipnullelements.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
suite('Element:', function() {
test('Skip if null (ele)', function() {
return eq(xml('test', {
headless: true
}).ele('node1', 'val1').up().ele('node2', null).up().ele('node3', void 0).up().ele('node4', 'val4').up().ele('node5', '').up().ele('node6',... | suite 'Element:', ->
test 'Skip if null (ele)', ->
eq(
xml('test', { headless: true })
.ele('node1', 'val1').up()
.ele('node2', null).up()
.ele('node3', undefined).up()
.ele('node4', 'val4').up()
.ele('node5', '').up()
.ele('node6', {att: 'val'}).up()
... | JavaScript | CoffeeScript | oozcitak/xmlbuilder-js | test/basic/skipnullelements.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/basic/skipnullelements.coffee | 1 | 50 |
oozcitak/xmlbuilder-js:test/basic/skipnullelements.coffee:1:completion | completion | suite 'Element:', ->
test 'Skip if null (ele)', ->
eq(
xml('test', { headless: true })
.ele('node1', 'val1').up()
.ele('node2', null).up()
.ele('node3', undefined).up()
.ele('node4', 'val4').up()
.ele('node5', '').up()
.ele('node6', {att: 'val'}).up()
... | .end()
'<test>' +
'<node1>val1</node1>' +
'<node4>val4</node4>' +
'<node5/>' +
'</test>'
)
test 'Keep if null (ele) with keepNullNodes', ->
eq(
xml('test', { headless: true, keepNullNodes: true })
.ele('node1', 'val1').up()
.ele('node2', null).up()
... | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | test/basic/skipnullelements.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/basic/skipnullelements.coffee | 1 | 50 |
oozcitak/xmlbuilder-js:test/basic/skipnullelements.coffee:2:raw_corpus | raw_corpus | test 'Keep if null (JSON) with keepNullNodes', ->
eq(
xml('test', { headless: true, keepNullNodes: true })
.ele( { node1: 'val1', node2: null, node3: undefined, node4: 'val4', node5: '' })
.end()
'<test>' +
'<node1>val1</node1>' +
'<node2/>' +
'<node3/>' +
... | CoffeeScript | oozcitak/xmlbuilder-js | test/basic/skipnullelements.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/basic/skipnullelements.coffee | 51 | 64 | ||
oozcitak/xmlbuilder-js:test/basic/skipnullelements.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
test 'Keep if null (JSON) with keepNullNodes', ->
eq(
xml('test', { headless: true, keepNullNodes: true })
.ele( { node1: 'val1', node2: null, node3: undefined, node4: 'val4', node5: '' })
.end()
'<test>' +
'<node1>val1</no... | test('Keep if null (JSON) with keepNullNodes', function() {
return eq(xml('test', {
headless: true,
keepNullNodes: true
}).ele({
node1: 'val1',
node2: null,
node3: void 0,
node4: 'val4',
node5: ''
}).end(), '<test>' + '<node1>val1</node1>' + '<node2/>' + '<node3/>' + '<node4>val4</node... | CoffeeScript | JavaScript | oozcitak/xmlbuilder-js | test/basic/skipnullelements.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/basic/skipnullelements.coffee | 51 | 64 |
oozcitak/xmlbuilder-js:test/basic/skipnullelements.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
test('Keep if null (JSON) with keepNullNodes', function() {
return eq(xml('test', {
headless: true,
keepNullNodes: true
}).ele({
node1: 'val1',
node2: null,
node3: void 0,
node4: 'val4',
node5: ''
}).end(), '<test>' + '<node1>val1<... | test 'Keep if null (JSON) with keepNullNodes', ->
eq(
xml('test', { headless: true, keepNullNodes: true })
.ele( { node1: 'val1', node2: null, node3: undefined, node4: 'val4', node5: '' })
.end()
'<test>' +
'<node1>val1</node1>' +
'<node2/>' +
'<node3/>' +
... | JavaScript | CoffeeScript | oozcitak/xmlbuilder-js | test/basic/skipnullelements.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/basic/skipnullelements.coffee | 51 | 64 |
oozcitak/xmlbuilder-js:test/basic/skipnullelements.coffee:1:raw_corpus | raw_corpus | suite 'Element:', ->
test 'Skip if null (ele)', ->
eq(
xml('test', { headless: true })
.ele('node1', 'val1').up()
.ele('node2', null).up()
.ele('node3', undefined).up()
.ele('node4', 'val4').up()
.ele('node5', '').up()
.ele('node6', {att: 'val'}).up()
... | CoffeeScript | oozcitak/xmlbuilder-js | test/basic/skipnullelements.coffee | MIT | be07739fc6a42504111c174763de806b39b3db02 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/be07739fc6a42504111c174763de806b39b3db02/test/basic/skipnullelements.coffee | 1 | 50 | ||
oozcitak/xmlbuilder-js:test/basic/skipnullelements.coffee:1:completion | completion | suite 'Element:', ->
test 'Skip if null (ele)', ->
eq(
xml('test', { headless: true })
.ele('node1', 'val1').up()
.ele('node2', null).up()
.ele('node3', undefined).up()
.ele('node4', 'val4').up()
.ele('node5', '').up()
.ele('node6', {att: 'val'}).up()
... | .end()
'<test>' +
'<node1>val1</node1>' +
'<node3/>' +
'<node4>val4</node4>' +
'<node5/>' +
'</test>'
)
test 'Keep if null (ele) with keepNullNodes', ->
eq(
xml('test', { headless: true, keepNullNodes: true })
.ele('node1', 'val1').up()
.ele('... | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | test/basic/skipnullelements.coffee | MIT | be07739fc6a42504111c174763de806b39b3db02 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/be07739fc6a42504111c174763de806b39b3db02/test/basic/skipnullelements.coffee | 1 | 50 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.