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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
mojs/mojs:src/shapes/shapesMap.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
h = require 'src/h'
Bit = require('./bit').default or require('./bit');
Custom = require('./custom').default or require('./custom');
Circle = require './circle'
Line = require './line'
Zigzag = require './zigzag'
Rect = require '.... | var Bit, BitsMap, Circle, Cross, Curve, Custom, Equal, Line, Polygon, Rect, Zigzag, h;
h = require('src/h');
Bit = require('./bit').default || require('./bit');
Custom = require('./custom').default || require('./custom');
Circle = require('./circle');
Line = require('./line');
Zigzag = require('./zigzag');
Rect ... | CoffeeScript | JavaScript | mojs/mojs | src/shapes/shapesMap.coffee | MIT | 768850a20165488e3098a3003b153e905266dac8 | 18,698 | https://github.com/mojs/mojs/blob/768850a20165488e3098a3003b153e905266dac8/src/shapes/shapesMap.coffee | 1 | 37 |
mojs/mojs:src/shapes/shapesMap.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Bit, BitsMap, Circle, Cross, Curve, Custom, Equal, Line, Polygon, Rect, Zigzag, h;
h = require('src/h');
Bit = require('./bit').default || require('./bit');
Custom = require('./custom').default || require('./custom');
Circle = require('./circle');
Line = r... | h = require 'src/h'
Bit = require('./bit').default or require('./bit');
Custom = require('./custom').default or require('./custom');
Circle = require './circle'
Line = require './line'
Zigzag = require './zigzag'
Rect = require './rect'
Polygon = require './polygon'
Cross = requir... | JavaScript | CoffeeScript | mojs/mojs | src/shapes/shapesMap.coffee | MIT | 768850a20165488e3098a3003b153e905266dac8 | 18,698 | https://github.com/mojs/mojs/blob/768850a20165488e3098a3003b153e905266dac8/src/shapes/shapesMap.coffee | 1 | 37 |
mojs/mojs:src/shapes/shapesMap.coffee:1:completion | completion | h = require 'src/h'
Bit = require('./bit').default or require('./bit');
Custom = require('./custom').default or require('./custom');
Circle = require './circle'
Line = require './line'
Zigzag = require './zigzag'
Rect = require './rect'
Polygon = require './polygon'
Cross = requir... | line: Line
zigzag: Zigzag
rect: Rect
polygon: Polygon
cross: Cross
equal: Equal
curve: Curve
getShape:(name)-> @[name] or h.error "no \"#{name}\" shape available yet,
please choose from this list:", [ 'circle', 'line', 'zigzag', 'rect', 'polygon', 'cross', 'equal', 'curve' ]
#... | CoffeeScript | CoffeeScript | mojs/mojs | src/shapes/shapesMap.coffee | MIT | 768850a20165488e3098a3003b153e905266dac8 | 18,698 | https://github.com/mojs/mojs/blob/768850a20165488e3098a3003b153e905266dac8/src/shapes/shapesMap.coffee | 1 | 37 |
jianliaoim/talk-os:talk-web/client/app/member-card.coffee:1:raw_corpus | raw_corpus | module.exports = React.createClass
displayName: 'member-card'
mixins: [mixinSubscribe, PureRenderMixin]
propTypes:
_teamId: T.string.isRequired
_contactId: T.string
showEntrance: T.bool
member: T.instanceOf(Immutable.Map)
getDefaultProps: ->
showEntrance: true
member: Immuta... | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/member-card.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/member-card.coffee | 26 | 75 | ||
jianliaoim/talk-os:talk-web/client/app/member-card.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = React.createClass
displayName: 'member-card'
mixins: [mixinSubscribe, PureRenderMixin]
propTypes:
_teamId: T.string.isRequired
_contactId: T.string
showEntrance: T.bool
member: T.instanceOf(Immutable.Map)
getD... | module.exports = React.createClass({
displayName: 'member-card',
mixins: [mixinSubscribe, PureRenderMixin],
propTypes: {
_teamId: T.string.isRequired,
_contactId: T.string,
showEntrance: T.bool,
member: T.instanceOf(Immutable.Map)
},
getDefaultProps: function() {
return {
showEntranc... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/client/app/member-card.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/member-card.coffee | 26 | 75 |
jianliaoim/talk-os:talk-web/client/app/member-card.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
module.exports = React.createClass({
displayName: 'member-card',
mixins: [mixinSubscribe, PureRenderMixin],
propTypes: {
_teamId: T.string.isRequired,
_contactId: T.string,
showEntrance: T.bool,
member: T.instanceOf(Immutable.Map)
},
getDe... | module.exports = React.createClass
displayName: 'member-card'
mixins: [mixinSubscribe, PureRenderMixin]
propTypes:
_teamId: T.string.isRequired
_contactId: T.string
showEntrance: T.bool
member: T.instanceOf(Immutable.Map)
getDefaultProps: ->
showEntrance: true
member: Immuta... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/member-card.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/member-card.coffee | 26 | 75 |
jianliaoim/talk-os:talk-web/client/app/member-card.coffee:1:completion | completion | module.exports = React.createClass
displayName: 'member-card'
mixins: [mixinSubscribe, PureRenderMixin]
propTypes:
_teamId: T.string.isRequired
_contactId: T.string
showEntrance: T.bool
member: T.instanceOf(Immutable.Map)
getDefaultProps: ->
showEntrance: true
member: Immuta... | isReachable: ->
not @contactNotAvailable() and @props.showEntrance
getPrefs: ->
_contactId = @props._contactId or @props.member.get('_id')
query.contactPrefsBy(recorder.getState(), @props._teamId, _contactId)
getContact: ->
query.requestContactsByOne(recorder.getState(), @props._teamId, @props._co... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/member-card.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/member-card.coffee | 26 | 75 |
jianliaoim/talk-os:talk-web/client/app/member-card.coffee:2:raw_corpus | raw_corpus | renderName: ->
div className: 'profile-name flex-horiz flex-vcenter',
UserAlias
_teamId: @props._teamId
_userId: @state.contact.get('_id')
defaultName: @state.contact.get('name')
if not detect.isTalkai(@state.contact) and @state.contact.get('isRobot')
Icon name: 'bot', cl... | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/member-card.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/member-card.coffee | 76 | 109 | ||
jianliaoim/talk-os:talk-web/client/app/member-card.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
renderName: ->
div className: 'profile-name flex-horiz flex-vcenter',
UserAlias
_teamId: @props._teamId
_userId: @state.contact.get('_id')
defaultName: @state.contact.get('name')
if not detect.isTalkai(@state.contact) and @... | ({
renderName: function() {
return div({
className: 'profile-name flex-horiz flex-vcenter'
}, UserAlias({
_teamId: this.props._teamId,
_userId: this.state.contact.get('_id'),
defaultName: this.state.contact.get('name')
}), !detect.isTalkai(this.state.contact) && this.state.contact.... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/client/app/member-card.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/member-card.coffee | 76 | 109 |
jianliaoim/talk-os:talk-web/client/app/member-card.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
renderName: function() {
return div({
className: 'profile-name flex-horiz flex-vcenter'
}, UserAlias({
_teamId: this.props._teamId,
_userId: this.state.contact.get('_id'),
defaultName: this.state.contact.get('name')
}), !det... | renderName: ->
div className: 'profile-name flex-horiz flex-vcenter',
UserAlias
_teamId: @props._teamId
_userId: @state.contact.get('_id')
defaultName: @state.contact.get('name')
if not detect.isTalkai(@state.contact) and @state.contact.get('isRobot')
Icon name: 'bot', cl... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/member-card.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/member-card.coffee | 76 | 109 |
jianliaoim/talk-os:talk-web/client/app/member-card.coffee:2:completion | completion | renderName: ->
div className: 'profile-name flex-horiz flex-vcenter',
UserAlias
_teamId: @props._teamId
_userId: @state.contact.get('_id')
defaultName: @state.contact.get('name')
if not detect.isTalkai(@state.contact) and @state.contact.get('isRobot')
Icon name: 'bot', cl... | div className: 'email short muted', @state.contact.get('email')
else
span className: 'no-email', lang.getText('no-email')
if (not @state.prefs?.get('hideMobile')) and @state.contact.get('mobile')?
div className: 'phone muted', @state.contact.get('mobile')
render: ->
avatarStyle =
... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/member-card.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/member-card.coffee | 76 | 109 |
gss/engine:src/GSS.coffee:1:raw_corpus | raw_corpus | ### Constructor: GSS
Dispatches arguments by type, returns engine
When scope is given, creates Document
Otherwise abstract Engine ###
GSS = -> #(data, url, scope)
for argument, index in arguments
continue unless argument
switch typeof argument
when 'object'
if argument.nodeType
s... | CoffeeScript | gss/engine | src/GSS.coffee | MIT | be430ea249f8030e11c8e03a8e170dcc8b8cf5fb | 2,854 | https://github.com/gss/engine/blob/be430ea249f8030e11c8e03a8e170dcc8b8cf5fb/src/GSS.coffee | 1 | 38 | ||
gss/engine:src/GSS.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
### Constructor: GSS
Dispatches arguments by type, returns engine
When scope is given, creates Document
Otherwise abstract Engine ###
GSS = -> #(data, url, scope)
for argument, index in arguments
continue unless argument
switch typeof argument
... | /* Constructor: GSS
Dispatches arguments by type, returns engine
When scope is given, creates Document
Otherwise abstract Engine */
var GSS;
GSS = function() { //(data, url, scope)
var argument, data, engine, i, id, index, len, parent, scope, url;
for (index = i = 0, len = arguments.length; i < len; index = ++i... | CoffeeScript | JavaScript | gss/engine | src/GSS.coffee | MIT | be430ea249f8030e11c8e03a8e170dcc8b8cf5fb | 2,854 | https://github.com/gss/engine/blob/be430ea249f8030e11c8e03a8e170dcc8b8cf5fb/src/GSS.coffee | 1 | 38 |
gss/engine:src/GSS.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
/* Constructor: GSS
Dispatches arguments by type, returns engine
When scope is given, creates Document
Otherwise abstract Engine */
var GSS;
GSS = function() { //(data, url, scope)
var argument, data, engine, i, id, index, len, parent, scope, url;
for (inde... | ### Constructor: GSS
Dispatches arguments by type, returns engine
When scope is given, creates Document
Otherwise abstract Engine ###
GSS = -> #(data, url, scope)
for argument, index in arguments
continue unless argument
switch typeof argument
when 'object'
if argument.nodeType
s... | JavaScript | CoffeeScript | gss/engine | src/GSS.coffee | MIT | be430ea249f8030e11c8e03a8e170dcc8b8cf5fb | 2,854 | https://github.com/gss/engine/blob/be430ea249f8030e11c8e03a8e170dcc8b8cf5fb/src/GSS.coffee | 1 | 38 |
gss/engine:src/GSS.coffee:1:completion | completion | ### Constructor: GSS
Dispatches arguments by type, returns engine
When scope is given, creates Document
Otherwise abstract Engine ###
GSS = -> #(data, url, scope)
for argument, index in arguments
continue unless argument
switch typeof argument
when 'object'
if argument.nodeType
s... | parent = scope
while parent
if id = GSS.identity.find(parent)
if engine = GSS.Engine[id]
return engine
break unless parent.parentNode
parent = parent.parentNode
if scope && GSS.Document
return new GSS.Document(data, url, scope)
else
return new GSS.Engine(data, url, s... | CoffeeScript | CoffeeScript | gss/engine | src/GSS.coffee | MIT | be430ea249f8030e11c8e03a8e170dcc8b8cf5fb | 2,854 | https://github.com/gss/engine/blob/be430ea249f8030e11c8e03a8e170dcc8b8cf5fb/src/GSS.coffee | 1 | 38 |
jianliaoim/talk-os:talk-web/client/app/topic-configs.coffee:1:raw_corpus | raw_corpus | module.exports = React.createClass
displayName: 'topic-configs'
mixins: [PureRenderMixin]
propTypes:
topic: T.instanceOf(Immutable.Map)
_teamId: T.string
hasPermission: T.bool.isRequired
saveConfigs: T.func.isRequired
getInitialState: ->
topic: @props.topic.get('topic')... | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/topic-configs.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/topic-configs.coffee | 25 | 74 | ||
jianliaoim/talk-os:talk-web/client/app/topic-configs.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = React.createClass
displayName: 'topic-configs'
mixins: [PureRenderMixin]
propTypes:
topic: T.instanceOf(Immutable.Map)
_teamId: T.string
hasPermission: T.bool.isRequired
saveConfigs: T.func.isRequired
... | module.exports = React.createClass({
displayName: 'topic-configs',
mixins: [PureRenderMixin],
propTypes: {
topic: T.instanceOf(Immutable.Map),
_teamId: T.string,
hasPermission: T.bool.isRequired,
saveConfigs: T.func.isRequired
},
getInitialState: function() {
return {
topic: this.pro... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/client/app/topic-configs.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/topic-configs.coffee | 25 | 74 |
jianliaoim/talk-os:talk-web/client/app/topic-configs.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
module.exports = React.createClass({
displayName: 'topic-configs',
mixins: [PureRenderMixin],
propTypes: {
topic: T.instanceOf(Immutable.Map),
_teamId: T.string,
hasPermission: T.bool.isRequired,
saveConfigs: T.func.isRequired
},
getInitia... | module.exports = React.createClass
displayName: 'topic-configs'
mixins: [PureRenderMixin]
propTypes:
topic: T.instanceOf(Immutable.Map)
_teamId: T.string
hasPermission: T.bool.isRequired
saveConfigs: T.func.isRequired
getInitialState: ->
topic: @props.topic.get('topic')... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/topic-configs.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/topic-configs.coffee | 25 | 74 |
jianliaoim/talk-os:talk-web/client/app/topic-configs.coffee:1:completion | completion | module.exports = React.createClass
displayName: 'topic-configs'
mixins: [PureRenderMixin]
propTypes:
topic: T.instanceOf(Immutable.Map)
_teamId: T.string
hasPermission: T.bool.isRequired
saveConfigs: T.func.isRequired
getInitialState: ->
topic: @props.topic.get('topic')... | @getRooms().concat(@getArchivedTopics())
.filterNot (room) => room.get('_id') is @props.topic.get('_id')
.every (room) =>
room.get('topic') isnt @state.topic.trim()
needSave: ->
if @state.topic isnt @props.topic.get('topic') then return true
if @state.purpose isnt @props.topic.get('p... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/topic-configs.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/topic-configs.coffee | 25 | 74 |
jianliaoim/talk-os:talk-web/client/app/topic-configs.coffee:2:raw_corpus | raw_corpus | @setState buttonDisabled: false
# event handlers
onTopicChange: (event) ->
if @props.hasPermission
topic = format.trimLeft event.target.value
@setState {topic}
onPurposeChange: (event) ->
if @props.hasPermission
purpose = format.trimLeft event.target.value
@setState {purpose}
... | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/topic-configs.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/topic-configs.coffee | 75 | 124 | ||
jianliaoim/talk-os:talk-web/client/app/topic-configs.coffee:2:completion | completion | @setState buttonDisabled: false
# event handlers
onTopicChange: (event) ->
if @props.hasPermission
topic = format.trimLeft event.target.value
@setState {topic}
onPurposeChange: (event) ->
if @props.hasPermission
purpose = format.trimLeft event.target.value
@setState {purpose}
... | input readOnly: true, type: 'radio', checked: (not @state.isPrivate)
lang.getText('about-public-topic')
br()
label className: 'line', onClick: @onPrivateClick,
input readOnly: true, type: 'radio', checked: @state.isPrivate
lang.getText('about-private-topic')
re... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/topic-configs.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/topic-configs.coffee | 75 | 124 |
jianliaoim/talk-os:talk-web/client/app/topic-configs.coffee:3:raw_corpus | raw_corpus | readOnly: (not @props.hasPermission)
@renderPrivate()
if @props.hasPermission
className = cx 'button', 'is-primary', 'is-extended',
'is-disabled': not @needSave()
button className: className, onClick: @saveConfigs, disabled: @state.buttonDisabled,
lang.getText('save') | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/topic-configs.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/topic-configs.coffee | 125 | 134 | ||
jianliaoim/talk-os:talk-web/client/app/topic-configs.coffee:3:completion | completion | readOnly: (not @props.hasPermission)
@renderPrivate()
if @props.hasPermission | className = cx 'button', 'is-primary', 'is-extended',
'is-disabled': not @needSave()
button className: className, onClick: @saveConfigs, disabled: @state.buttonDisabled,
lang.getText('save') | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/topic-configs.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/topic-configs.coffee | 125 | 134 |
gss/engine:src/engine/domains/Output.coffee:1:raw_corpus | raw_corpus | Data = require('./Data')
Constraint = require('../commands/Constraint')
class Output extends Data
displayName: 'Output'
immutable: true
priority: -200
finalized: true
Output::Constraint = Constraint.extend {
signature: [
left: ['Variable', 'Number', 'Constraint'],
right: ['Variable', 'N... | CoffeeScript | gss/engine | src/engine/domains/Output.coffee | MIT | be430ea249f8030e11c8e03a8e170dcc8b8cf5fb | 2,854 | https://github.com/gss/engine/blob/be430ea249f8030e11c8e03a8e170dcc8b8cf5fb/src/engine/domains/Output.coffee | 1 | 40 | ||
gss/engine:src/engine/domains/Output.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Data = require('./Data')
Constraint = require('../commands/Constraint')
class Output extends Data
displayName: 'Output'
immutable: true
priority: -200
finalized: true
Output::Constraint = Constraint.extend {
signature: [
left: ['Variable... | var Constraint, Data, Output;
Data = require('./Data');
Constraint = require('../commands/Constraint');
Output = (function() {
class Output extends Data {};
Output.prototype.displayName = 'Output';
Output.prototype.immutable = true;
Output.prototype.priority = -200;
Output.prototype.finalized = true;
... | CoffeeScript | JavaScript | gss/engine | src/engine/domains/Output.coffee | MIT | be430ea249f8030e11c8e03a8e170dcc8b8cf5fb | 2,854 | https://github.com/gss/engine/blob/be430ea249f8030e11c8e03a8e170dcc8b8cf5fb/src/engine/domains/Output.coffee | 1 | 40 |
gss/engine:src/engine/domains/Output.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Constraint, Data, Output;
Data = require('./Data');
Constraint = require('../commands/Constraint');
Output = (function() {
class Output extends Data {};
Output.prototype.displayName = 'Output';
Output.prototype.immutable = true;
Output.prototype.p... | Data = require('./Data')
Constraint = require('../commands/Constraint')
class Output extends Data
displayName: 'Output'
immutable: true
priority: -200
finalized: true
Output::Constraint = Constraint.extend {
signature: [
left: ['Variable', 'Number', 'Constraint'],
right: ['Variable', 'N... | JavaScript | CoffeeScript | gss/engine | src/engine/domains/Output.coffee | MIT | be430ea249f8030e11c8e03a8e170dcc8b8cf5fb | 2,854 | https://github.com/gss/engine/blob/be430ea249f8030e11c8e03a8e170dcc8b8cf5fb/src/engine/domains/Output.coffee | 1 | 40 |
gss/engine:src/engine/domains/Output.coffee:1:completion | completion | Data = require('./Data')
Constraint = require('../commands/Constraint')
class Output extends Data
displayName: 'Output'
immutable: true
priority: -200
finalized: true
Output::Constraint = Constraint.extend {
signature: [
left: ['Variable', 'Number', 'Constraint'],
right: ['Variable', 'N... | "!=": (a, b) ->
return a != b
"==": (a, b) ->
return a == b
"<=": (a, b) ->
return a <= b
">=": (a, b) ->
return a >= b
"<": (a, b) ->
return a < b
">": (a, b) ->
return a > b
module.exports = Output | CoffeeScript | CoffeeScript | gss/engine | src/engine/domains/Output.coffee | MIT | be430ea249f8030e11c8e03a8e170dcc8b8cf5fb | 2,854 | https://github.com/gss/engine/blob/be430ea249f8030e11c8e03a8e170dcc8b8cf5fb/src/engine/domains/Output.coffee | 1 | 40 |
gss/engine:src/engine/domains/Output.coffee:1:raw_corpus | raw_corpus | Data = require('./Data')
Constraint = require('../commands/Constraint')
class Output extends Data
displayName: 'Output'
immutable: true
priority: -200
finalized: true
Output::Constraint = Constraint.extend {
signature: [
left: ['Variable', 'Number', 'Constraint'],
right: ['Variable', 'N... | CoffeeScript | gss/engine | src/engine/domains/Output.coffee | MIT | c9f22fd388a6f2ca132fa2cfad35d0888346ce7d | 2,854 | https://github.com/gss/engine/blob/c9f22fd388a6f2ca132fa2cfad35d0888346ce7d/src/engine/domains/Output.coffee | 1 | 40 | ||
gss/engine:src/engine/domains/Output.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Data = require('./Data')
Constraint = require('../commands/Constraint')
class Output extends Data
displayName: 'Output'
immutable: true
priority: -200
finalized: true
Output::Constraint = Constraint.extend {
signature: [
left: ['Variable... | var Constraint, Data, Output;
Data = require('./Data');
Constraint = require('../commands/Constraint');
Output = (function() {
class Output extends Data {};
Output.prototype.displayName = 'Output';
Output.prototype.immutable = true;
Output.prototype.priority = -200;
Output.prototype.finalized = true;
... | CoffeeScript | JavaScript | gss/engine | src/engine/domains/Output.coffee | MIT | c9f22fd388a6f2ca132fa2cfad35d0888346ce7d | 2,854 | https://github.com/gss/engine/blob/c9f22fd388a6f2ca132fa2cfad35d0888346ce7d/src/engine/domains/Output.coffee | 1 | 40 |
gss/engine:src/engine/domains/Output.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Constraint, Data, Output;
Data = require('./Data');
Constraint = require('../commands/Constraint');
Output = (function() {
class Output extends Data {};
Output.prototype.displayName = 'Output';
Output.prototype.immutable = true;
Output.prototype.p... | Data = require('./Data')
Constraint = require('../commands/Constraint')
class Output extends Data
displayName: 'Output'
immutable: true
priority: -200
finalized: true
Output::Constraint = Constraint.extend {
signature: [
left: ['Variable', 'Number', 'Constraint'],
right: ['Variable', 'N... | JavaScript | CoffeeScript | gss/engine | src/engine/domains/Output.coffee | MIT | c9f22fd388a6f2ca132fa2cfad35d0888346ce7d | 2,854 | https://github.com/gss/engine/blob/c9f22fd388a6f2ca132fa2cfad35d0888346ce7d/src/engine/domains/Output.coffee | 1 | 40 |
gss/engine:src/engine/domains/Output.coffee:1:completion | completion | Data = require('./Data')
Constraint = require('../commands/Constraint')
class Output extends Data
displayName: 'Output'
immutable: true
priority: -200
finalized: true
Output::Constraint = Constraint.extend {
signature: [
left: ['Variable', 'Number', 'Constraint'],
right: ['Variable', 'N... | "!=": (a, b) ->
return a == b
"==": (a, b) ->
return a == b
"<=": (a, b) ->
return a <= b
">=": (a, b) ->
return a >= b
"<": (a, b) ->
return a < b
">": (a, b) ->
return a > b
module.exports = Output | CoffeeScript | CoffeeScript | gss/engine | src/engine/domains/Output.coffee | MIT | c9f22fd388a6f2ca132fa2cfad35d0888346ce7d | 2,854 | https://github.com/gss/engine/blob/c9f22fd388a6f2ca132fa2cfad35d0888346ce7d/src/engine/domains/Output.coffee | 1 | 40 |
gss/engine:src/engine/domains/Output.coffee:1:raw_corpus | raw_corpus | Data = require('./Data')
Constraint = require('../commands/Constraint')
class Output extends Data
displayName: 'Output'
immutable: true
priority: -200
finalized: true
Gradient: require('../types/Gradient')
Matrix: require('../types/Matrix')
Easing: require('../types/Easing')
Colo... | CoffeeScript | gss/engine | src/engine/domains/Output.coffee | MIT | dd0070ab8687793b8b0d1da85f23842df5d88f08 | 2,854 | https://github.com/gss/engine/blob/dd0070ab8687793b8b0d1da85f23842df5d88f08/src/engine/domains/Output.coffee | 1 | 50 | ||
gss/engine:src/engine/domains/Output.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Data = require('./Data')
Constraint = require('../commands/Constraint')
class Output extends Data
displayName: 'Output'
immutable: true
priority: -200
finalized: true
Gradient: require('../types/Gradient')
Matrix: require('../types/M... | var Constraint, Data, Output;
Data = require('./Data');
Constraint = require('../commands/Constraint');
Output = (function() {
class Output extends Data {};
Output.prototype.displayName = 'Output';
Output.prototype.immutable = true;
Output.prototype.priority = -200;
Output.prototype.finalized = true;
... | CoffeeScript | JavaScript | gss/engine | src/engine/domains/Output.coffee | MIT | dd0070ab8687793b8b0d1da85f23842df5d88f08 | 2,854 | https://github.com/gss/engine/blob/dd0070ab8687793b8b0d1da85f23842df5d88f08/src/engine/domains/Output.coffee | 1 | 50 |
gss/engine:src/engine/domains/Output.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Constraint, Data, Output;
Data = require('./Data');
Constraint = require('../commands/Constraint');
Output = (function() {
class Output extends Data {};
Output.prototype.displayName = 'Output';
Output.prototype.immutable = true;
Output.prototype.p... | Data = require('./Data')
Constraint = require('../commands/Constraint')
class Output extends Data
displayName: 'Output'
immutable: true
priority: -200
finalized: true
Gradient: require('../types/Gradient')
Matrix: require('../types/Matrix')
Easing: require('../types/Easing')
Colo... | JavaScript | CoffeeScript | gss/engine | src/engine/domains/Output.coffee | MIT | dd0070ab8687793b8b0d1da85f23842df5d88f08 | 2,854 | https://github.com/gss/engine/blob/dd0070ab8687793b8b0d1da85f23842df5d88f08/src/engine/domains/Output.coffee | 1 | 50 |
gss/engine:src/engine/domains/Output.coffee:1:completion | completion | Data = require('./Data')
Constraint = require('../commands/Constraint')
class Output extends Data
displayName: 'Output'
immutable: true
priority: -200
finalized: true
Gradient: require('../types/Gradient')
Matrix: require('../types/Matrix')
Easing: require('../types/Easing')
Colo... | signature: [
left: ['Variable', 'Number', 'Constraint'],
right: ['Variable', 'Number', 'Constraint']
]
},
"&&": (a, b) ->
return a && b
"||": (a, b) ->
return a || b
"!=": (a, b) ->
return a == b
"==": (a, b) ->
return a == b
"<=": (a, b) ->
return a <= b
">=": (a, ... | CoffeeScript | CoffeeScript | gss/engine | src/engine/domains/Output.coffee | MIT | dd0070ab8687793b8b0d1da85f23842df5d88f08 | 2,854 | https://github.com/gss/engine/blob/dd0070ab8687793b8b0d1da85f23842df5d88f08/src/engine/domains/Output.coffee | 1 | 50 |
gss/engine:src/engine/domains/Output.coffee:2:raw_corpus | raw_corpus | ">": (a, b) ->
return a > b
module.exports = Output | CoffeeScript | gss/engine | src/engine/domains/Output.coffee | MIT | dd0070ab8687793b8b0d1da85f23842df5d88f08 | 2,854 | https://github.com/gss/engine/blob/dd0070ab8687793b8b0d1da85f23842df5d88f08/src/engine/domains/Output.coffee | 51 | 54 | ||
gss/engine:src/engine/domains/Output.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
">": (a, b) ->
return a > b
module.exports = Output
``` | ({
">": function(a, b) {
return a > b;
}
});
module.exports = Output; | CoffeeScript | JavaScript | gss/engine | src/engine/domains/Output.coffee | MIT | dd0070ab8687793b8b0d1da85f23842df5d88f08 | 2,854 | https://github.com/gss/engine/blob/dd0070ab8687793b8b0d1da85f23842df5d88f08/src/engine/domains/Output.coffee | 51 | 54 |
gss/engine:src/engine/domains/Output.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
">": function(a, b) {
return a > b;
}
});
module.exports = Output;
``` | ">": (a, b) ->
return a > b
module.exports = Output | JavaScript | CoffeeScript | gss/engine | src/engine/domains/Output.coffee | MIT | dd0070ab8687793b8b0d1da85f23842df5d88f08 | 2,854 | https://github.com/gss/engine/blob/dd0070ab8687793b8b0d1da85f23842df5d88f08/src/engine/domains/Output.coffee | 51 | 54 |
gss/engine:src/engine/domains/Output.coffee:2:completion | completion | ">": (a, b) ->
return a > b | module.exports = Output | CoffeeScript | CoffeeScript | gss/engine | src/engine/domains/Output.coffee | MIT | dd0070ab8687793b8b0d1da85f23842df5d88f08 | 2,854 | https://github.com/gss/engine/blob/dd0070ab8687793b8b0d1da85f23842df5d88f08/src/engine/domains/Output.coffee | 51 | 54 |
gss/engine:src/engine/domains/Output.coffee:1:raw_corpus | raw_corpus | Input = require('./Input')
Constraint = require('../commands/Constraint')
class Output extends Input
immutable: true
priority: -200
finalized: true
Gradient: require('../types/Gradient')
Matrix: require('../types/Matrix')
Easing: require('../types/Easing')
Color: require('../... | CoffeeScript | gss/engine | src/engine/domains/Output.coffee | MIT | daa2a82301cb1696b74d4bda01f1eefdbc0a3151 | 2,854 | https://github.com/gss/engine/blob/daa2a82301cb1696b74d4bda01f1eefdbc0a3151/src/engine/domains/Output.coffee | 1 | 50 | ||
gss/engine:src/engine/domains/Output.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Input = require('./Input')
Constraint = require('../commands/Constraint')
class Output extends Input
immutable: true
priority: -200
finalized: true
Gradient: require('../types/Gradient')
Matrix: require('../types/Matrix')
Easing: ... | var Constraint, Input, Output;
Input = require('./Input');
Constraint = require('../commands/Constraint');
Output = (function() {
class Output extends Input {};
Output.prototype.immutable = true;
Output.prototype.priority = -200;
Output.prototype.finalized = true;
Output.prototype.Gradient = require('.... | CoffeeScript | JavaScript | gss/engine | src/engine/domains/Output.coffee | MIT | daa2a82301cb1696b74d4bda01f1eefdbc0a3151 | 2,854 | https://github.com/gss/engine/blob/daa2a82301cb1696b74d4bda01f1eefdbc0a3151/src/engine/domains/Output.coffee | 1 | 50 |
gss/engine:src/engine/domains/Output.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Constraint, Input, Output;
Input = require('./Input');
Constraint = require('../commands/Constraint');
Output = (function() {
class Output extends Input {};
Output.prototype.immutable = true;
Output.prototype.priority = -200;
Output.prototype.fina... | Input = require('./Input')
Constraint = require('../commands/Constraint')
class Output extends Input
immutable: true
priority: -200
finalized: true
Gradient: require('../types/Gradient')
Matrix: require('../types/Matrix')
Easing: require('../types/Easing')
Color: require('../... | JavaScript | CoffeeScript | gss/engine | src/engine/domains/Output.coffee | MIT | daa2a82301cb1696b74d4bda01f1eefdbc0a3151 | 2,854 | https://github.com/gss/engine/blob/daa2a82301cb1696b74d4bda01f1eefdbc0a3151/src/engine/domains/Output.coffee | 1 | 50 |
gss/engine:src/engine/domains/Output.coffee:1:completion | completion | Input = require('./Input')
Constraint = require('../commands/Constraint')
class Output extends Input
immutable: true
priority: -200
finalized: true
Gradient: require('../types/Gradient')
Matrix: require('../types/Matrix')
Easing: require('../types/Easing')
Color: require('../... | right: ['Variable', 'Number', 'Constraint']
]
},
"&&": (a, b) ->
return a && b
"||": (a, b) ->
return a || b
"!=": (a, b) ->
return a == b
"==": (a, b) ->
return a == b
"<=": (a, b) ->
return a <= b
">=": (a, b) ->
return a >= b
"<": (a, b) ->
return a < b
">": (a... | CoffeeScript | CoffeeScript | gss/engine | src/engine/domains/Output.coffee | MIT | daa2a82301cb1696b74d4bda01f1eefdbc0a3151 | 2,854 | https://github.com/gss/engine/blob/daa2a82301cb1696b74d4bda01f1eefdbc0a3151/src/engine/domains/Output.coffee | 1 | 50 |
gss/engine:src/engine/domains/Output.coffee:1:raw_corpus | raw_corpus | Numeric = require('./Numeric')
Constraint = require('../commands/Constraint')
class Boolean extends Numeric
immutable: true
priority: -200
finalized: true
Boolean::Constraint = Constraint.extend {
signature: [
left: ['Variable', 'Number', 'Constraint'],
right: ['Variable', 'Number', 'Constra... | CoffeeScript | gss/engine | src/engine/domains/Output.coffee | MIT | 237252c14721b761f4555f959d9ea5e479774c1f | 2,854 | https://github.com/gss/engine/blob/237252c14721b761f4555f959d9ea5e479774c1f/src/engine/domains/Output.coffee | 1 | 39 | ||
gss/engine:src/engine/domains/Output.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Numeric = require('./Numeric')
Constraint = require('../commands/Constraint')
class Boolean extends Numeric
immutable: true
priority: -200
finalized: true
Boolean::Constraint = Constraint.extend {
signature: [
left: ['Variable', 'Number', 'Co... | var Boolean, Constraint, Numeric;
Numeric = require('./Numeric');
Constraint = require('../commands/Constraint');
Boolean = (function() {
class Boolean extends Numeric {};
Boolean.prototype.immutable = true;
Boolean.prototype.priority = -200;
Boolean.prototype.finalized = true;
return Boolean;
}).call... | CoffeeScript | JavaScript | gss/engine | src/engine/domains/Output.coffee | MIT | 237252c14721b761f4555f959d9ea5e479774c1f | 2,854 | https://github.com/gss/engine/blob/237252c14721b761f4555f959d9ea5e479774c1f/src/engine/domains/Output.coffee | 1 | 39 |
gss/engine:src/engine/domains/Output.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Boolean, Constraint, Numeric;
Numeric = require('./Numeric');
Constraint = require('../commands/Constraint');
Boolean = (function() {
class Boolean extends Numeric {};
Boolean.prototype.immutable = true;
Boolean.prototype.priority = -200;
Boolean.... | Numeric = require('./Numeric')
Constraint = require('../commands/Constraint')
class Boolean extends Numeric
immutable: true
priority: -200
finalized: true
Boolean::Constraint = Constraint.extend {
signature: [
left: ['Variable', 'Number', 'Constraint'],
right: ['Variable', 'Number', 'Constra... | JavaScript | CoffeeScript | gss/engine | src/engine/domains/Output.coffee | MIT | 237252c14721b761f4555f959d9ea5e479774c1f | 2,854 | https://github.com/gss/engine/blob/237252c14721b761f4555f959d9ea5e479774c1f/src/engine/domains/Output.coffee | 1 | 39 |
gss/engine:src/engine/domains/Output.coffee:1:completion | completion | Numeric = require('./Numeric')
Constraint = require('../commands/Constraint')
class Boolean extends Numeric
immutable: true
priority: -200
finalized: true
Boolean::Constraint = Constraint.extend {
signature: [
left: ['Variable', 'Number', 'Constraint'],
right: ['Variable', 'Number', 'Constra... | "!=": (a, b) ->
return a == b
"==": (a, b) ->
return a == b
"<=": (a, b) ->
return a <= b
">=": (a, b) ->
return a >= b
"<": (a, b) ->
return a < b
">": (a, b) ->
return a > b
module.exports = Boolean | CoffeeScript | CoffeeScript | gss/engine | src/engine/domains/Output.coffee | MIT | 237252c14721b761f4555f959d9ea5e479774c1f | 2,854 | https://github.com/gss/engine/blob/237252c14721b761f4555f959d9ea5e479774c1f/src/engine/domains/Output.coffee | 1 | 39 |
Atraci/Atraci:coffee/_l10n.coffee:1:raw_corpus | raw_corpus | class L10n
constructor: (defaultLang) ->
@cachedStrings = {}
@currentLang = Settings.get("lang") or defaultLang or 'en'
@folder = 'l10n/'
@l10nFileSuffix = '.ini'
@metadataPath = 'metadata.json'
@callbacks = []
getSupportedLanguages: (cb) ->
$.ajax(
url: @folder + @metadataPath,
... | CoffeeScript | Atraci/Atraci | coffee/_l10n.coffee | MIT | d3fd00622f5f2e6c5d402c7a1ef2cd693f35e9ca | 800 | https://github.com/Atraci/Atraci/blob/d3fd00622f5f2e6c5d402c7a1ef2cd693f35e9ca/coffee/_l10n.coffee | 2 | 51 | ||
Atraci/Atraci:coffee/_l10n.coffee:1:completion | completion | class L10n
constructor: (defaultLang) ->
@cachedStrings = {}
@currentLang = Settings.get("lang") or defaultLang or 'en'
@folder = 'l10n/'
@l10nFileSuffix = '.ini'
@metadataPath = 'metadata.json'
@callbacks = []
getSupportedLanguages: (cb) ->
$.ajax(
url: @folder + @metadataPath,
... | $.ajax(
url: @folder + @currentLang + @l10nFileSuffix,
).done((iniData) =>
@cachedStrings[@currentLang] = @parseInI(iniData)
cb()
).fail((error) ->
console.error(error)
)
parseInI: (data) ->
result = {}
lines = data.split(/\r\n|\r|\n/)
lines.forEach((each... | CoffeeScript | CoffeeScript | Atraci/Atraci | coffee/_l10n.coffee | MIT | d3fd00622f5f2e6c5d402c7a1ef2cd693f35e9ca | 800 | https://github.com/Atraci/Atraci/blob/d3fd00622f5f2e6c5d402c7a1ef2cd693f35e9ca/coffee/_l10n.coffee | 2 | 51 |
Atraci/Atraci:coffee/_l10n.coffee:2:raw_corpus | raw_corpus | if matchedKey and matchedValue
result[matchedKey] = matchedValue
)
return result
get: (l10nId, params, fallbackToEn) ->
lang = @currentLang
# We may not find new-added string, so let's fallback to english
if fallbackToEn
lang = 'en'
translatedString = @cachedStrings[lang][l10n... | CoffeeScript | Atraci/Atraci | coffee/_l10n.coffee | MIT | d3fd00622f5f2e6c5d402c7a1ef2cd693f35e9ca | 800 | https://github.com/Atraci/Atraci/blob/d3fd00622f5f2e6c5d402c7a1ef2cd693f35e9ca/coffee/_l10n.coffee | 52 | 101 | ||
Atraci/Atraci:coffee/_l10n.coffee:2:completion | completion | if matchedKey and matchedValue
result[matchedKey] = matchedValue
)
return result
get: (l10nId, params, fallbackToEn) ->
lang = @currentLang
# We may not find new-added string, so let's fallback to english
if fallbackToEn
lang = 'en'
translatedString = @cachedStrings[lang][l10n... | translate() while matched = reBracket.exec(translatedString)
if not translatedString
console.log("""
You are accessing non-existent l10nId : #{l10nId},lang: #{@currentLang}
""")
return @get(l10nId, params, true)
else
return translatedString
addEventListener: (eventName, callb... | CoffeeScript | CoffeeScript | Atraci/Atraci | coffee/_l10n.coffee | MIT | d3fd00622f5f2e6c5d402c7a1ef2cd693f35e9ca | 800 | https://github.com/Atraci/Atraci/blob/d3fd00622f5f2e6c5d402c7a1ef2cd693f35e9ca/coffee/_l10n.coffee | 52 | 101 |
Atraci/Atraci:coffee/_l10n.coffee:3:raw_corpus | raw_corpus | @fetchIniData(() =>
@callbacks.forEach((callback) ->
callback()
)
) | CoffeeScript | Atraci/Atraci | coffee/_l10n.coffee | MIT | d3fd00622f5f2e6c5d402c7a1ef2cd693f35e9ca | 800 | https://github.com/Atraci/Atraci/blob/d3fd00622f5f2e6c5d402c7a1ef2cd693f35e9ca/coffee/_l10n.coffee | 102 | 107 | ||
Atraci/Atraci:coffee/_l10n.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
@fetchIniData(() =>
@callbacks.forEach((callback) ->
callback()
)
)
``` | this.fetchIniData(() => {
return this.callbacks.forEach(function(callback) {
return callback();
});
}); | CoffeeScript | JavaScript | Atraci/Atraci | coffee/_l10n.coffee | MIT | d3fd00622f5f2e6c5d402c7a1ef2cd693f35e9ca | 800 | https://github.com/Atraci/Atraci/blob/d3fd00622f5f2e6c5d402c7a1ef2cd693f35e9ca/coffee/_l10n.coffee | 102 | 107 |
Atraci/Atraci:coffee/_l10n.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
this.fetchIniData(() => {
return this.callbacks.forEach(function(callback) {
return callback();
});
});
``` | @fetchIniData(() =>
@callbacks.forEach((callback) ->
callback()
)
) | JavaScript | CoffeeScript | Atraci/Atraci | coffee/_l10n.coffee | MIT | d3fd00622f5f2e6c5d402c7a1ef2cd693f35e9ca | 800 | https://github.com/Atraci/Atraci/blob/d3fd00622f5f2e6c5d402c7a1ef2cd693f35e9ca/coffee/_l10n.coffee | 102 | 107 |
Atraci/Atraci:coffee/_l10n.coffee:2:raw_corpus | raw_corpus | if matchedKey and matchedValue
result[matchedKey] = matchedValue
)
return result
get: (l10nId, params, fallbackToEn) ->
lang = @currentLang
# We may not find new-added string, so let's fallback to english
if fallbackToEn
lang = 'en'
translatedString = @cachedStrings[lang][l10n... | CoffeeScript | Atraci/Atraci | coffee/_l10n.coffee | MIT | 4617f8f1a2f7fb8937a9aa94be24bdd926b9a8b9 | 800 | https://github.com/Atraci/Atraci/blob/4617f8f1a2f7fb8937a9aa94be24bdd926b9a8b9/coffee/_l10n.coffee | 52 | 101 | ||
Atraci/Atraci:coffee/_l10n.coffee:2:completion | completion | if matchedKey and matchedValue
result[matchedKey] = matchedValue
)
return result
get: (l10nId, params, fallbackToEn) ->
lang = @currentLang
# We may not find new-added string, so let's fallback to english
if fallbackToEn
lang = 'en'
translatedString = @cachedStrings[lang][l10n... | translate() while matched = reBracket.exec(translatedString)
if not translatedString
console.log("""
You are accessing non-existent l10nId : #{l10nId},lang: #{@currentLang}
""")
return @get(l10nId, params, true)
else
return translatedString
addEventListener: (eventName, callb... | CoffeeScript | CoffeeScript | Atraci/Atraci | coffee/_l10n.coffee | MIT | 4617f8f1a2f7fb8937a9aa94be24bdd926b9a8b9 | 800 | https://github.com/Atraci/Atraci/blob/4617f8f1a2f7fb8937a9aa94be24bdd926b9a8b9/coffee/_l10n.coffee | 52 | 101 |
Atraci/Atraci:coffee/_l10n.coffee:1:raw_corpus | raw_corpus | class L10n
constructor: (defaultLang) ->
@cachedStrings = {}
@currentLang = defaultLang or 'en'
@folder = 'l10n/'
@l10nFileSuffix = '.ini'
@metadataPath = 'metadata.json'
@callbacks = []
getSupportedLanguages: (cb) ->
$.ajax(
url: @folder + @metadataPath,
dataType: 'json'
... | CoffeeScript | Atraci/Atraci | coffee/_l10n.coffee | MIT | b7c388a6e82adeb5864d31a7df6120375ab3f727 | 800 | https://github.com/Atraci/Atraci/blob/b7c388a6e82adeb5864d31a7df6120375ab3f727/coffee/_l10n.coffee | 2 | 51 | ||
Atraci/Atraci:coffee/_l10n.coffee:1:completion | completion | class L10n
constructor: (defaultLang) ->
@cachedStrings = {}
@currentLang = defaultLang or 'en'
@folder = 'l10n/'
@l10nFileSuffix = '.ini'
@metadataPath = 'metadata.json'
@callbacks = []
getSupportedLanguages: (cb) ->
$.ajax(
url: @folder + @metadataPath,
dataType: 'json'
... | $.ajax(
url: @folder + @currentLang + @l10nFileSuffix,
).done((iniData) =>
@cachedStrings[@currentLang] = @parseInI(iniData)
cb()
).fail((error) ->
console.error(error)
)
parseInI: (data) ->
result = {}
lines = data.split(/\r\n|\r|\n/)
lines.forEach((each... | CoffeeScript | CoffeeScript | Atraci/Atraci | coffee/_l10n.coffee | MIT | b7c388a6e82adeb5864d31a7df6120375ab3f727 | 800 | https://github.com/Atraci/Atraci/blob/b7c388a6e82adeb5864d31a7df6120375ab3f727/coffee/_l10n.coffee | 2 | 51 |
Atraci/Atraci:coffee/_l10n.coffee:2:raw_corpus | raw_corpus | if matchedKey and matchedValue
result[matchedKey] = matchedValue
)
return result
get: (l10nId, params, fallbackToEn) ->
lang = @currentLang
# We may not find new-added string, so let's fallback to english
if fallbackToEn
lang = 'en'
translatedString = @cachedStrings[lang][l10n... | CoffeeScript | Atraci/Atraci | coffee/_l10n.coffee | MIT | b7c388a6e82adeb5864d31a7df6120375ab3f727 | 800 | https://github.com/Atraci/Atraci/blob/b7c388a6e82adeb5864d31a7df6120375ab3f727/coffee/_l10n.coffee | 52 | 101 | ||
Atraci/Atraci:coffee/_l10n.coffee:2:completion | completion | if matchedKey and matchedValue
result[matchedKey] = matchedValue
)
return result
get: (l10nId, params, fallbackToEn) ->
lang = @currentLang
# We may not find new-added string, so let's fallback to english
if fallbackToEn
lang = 'en'
translatedString = @cachedStrings[lang][l10n... | translatedString.replace(matchedBracketSubject, replaced)
translate() while matched = reBracket.exec(translatedString)
if not translatedString
console.log("""
You are accessing non-existent l10nId : #{l10nId},lang: #{@currentLang}
""")
return @get(l10nId, params, true)
else
... | CoffeeScript | CoffeeScript | Atraci/Atraci | coffee/_l10n.coffee | MIT | b7c388a6e82adeb5864d31a7df6120375ab3f727 | 800 | https://github.com/Atraci/Atraci/blob/b7c388a6e82adeb5864d31a7df6120375ab3f727/coffee/_l10n.coffee | 52 | 101 |
Atraci/Atraci:coffee/_l10n.coffee:2:raw_corpus | raw_corpus | if matchedKey and matchedValue
result[matchedKey] = matchedValue
)
return result
get: (l10nId, params, fallbackToEn) ->
lang = @currentLang
# We may not find new-added string, so let's fallback to english
if fallbackToEn
lang = 'en'
translatedString = @cachedStrings[lang][l10n... | CoffeeScript | Atraci/Atraci | coffee/_l10n.coffee | MIT | 6f9d4a3b1d05fabdae92a04dca76144c2c2907bd | 800 | https://github.com/Atraci/Atraci/blob/6f9d4a3b1d05fabdae92a04dca76144c2c2907bd/coffee/_l10n.coffee | 52 | 101 | ||
Atraci/Atraci:coffee/_l10n.coffee:2:completion | completion | if matchedKey and matchedValue
result[matchedKey] = matchedValue
)
return result
get: (l10nId, params, fallbackToEn) ->
lang = @currentLang
# We may not find new-added string, so let's fallback to english
if fallbackToEn
lang = 'en'
translatedString = @cachedStrings[lang][l10n... | translatedString.replace(matchedBracketSubject, replaced)
translate() while matched = reBracket.exec(translatedString)
if not translatedString
console.log("""
You are accessing non-existent l10nId : #{l10nId}, lang: #{@currentLang}
""")
return @get(l10nId, params, true)
else
... | CoffeeScript | CoffeeScript | Atraci/Atraci | coffee/_l10n.coffee | MIT | 6f9d4a3b1d05fabdae92a04dca76144c2c2907bd | 800 | https://github.com/Atraci/Atraci/blob/6f9d4a3b1d05fabdae92a04dca76144c2c2907bd/coffee/_l10n.coffee | 52 | 101 |
Atraci/Atraci:coffee/_l10n.coffee:1:raw_corpus | raw_corpus | class L10n
constructor: (defaultLang) ->
@cachedStrings = {}
@currentLang = defaultLang or 'en'
@folder = 'l10n/'
@l10nFileSuffix = '.ini'
@callbacks = []
fetchIniData: (cb) ->
if @cachedStrings[@currentLang]
cb()
else
$.ajax(
url: @folder + @currentLang + @l10nFileS... | CoffeeScript | Atraci/Atraci | coffee/_l10n.coffee | MIT | 409adeb372f76ca4dee651088c2ba83ea42708cd | 800 | https://github.com/Atraci/Atraci/blob/409adeb372f76ca4dee651088c2ba83ea42708cd/coffee/_l10n.coffee | 2 | 51 | ||
Atraci/Atraci:coffee/_l10n.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class L10n
constructor: (defaultLang) ->
@cachedStrings = {}
@currentLang = defaultLang or 'en'
@folder = 'l10n/'
@l10nFileSuffix = '.ini'
@callbacks = []
fetchIniData: (cb) ->
if @cachedStrings[@currentLang]
cb()
else
... | var L10n;
L10n = class L10n {
constructor(defaultLang) {
this.cachedStrings = {};
this.currentLang = defaultLang || 'en';
this.folder = 'l10n/';
this.l10nFileSuffix = '.ini';
this.callbacks = [];
}
fetchIniData(cb) {
if (this.cachedStrings[this.currentLang]) {
return cb();
} el... | CoffeeScript | JavaScript | Atraci/Atraci | coffee/_l10n.coffee | MIT | 409adeb372f76ca4dee651088c2ba83ea42708cd | 800 | https://github.com/Atraci/Atraci/blob/409adeb372f76ca4dee651088c2ba83ea42708cd/coffee/_l10n.coffee | 2 | 51 |
Atraci/Atraci:coffee/_l10n.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var L10n;
L10n = class L10n {
constructor(defaultLang) {
this.cachedStrings = {};
this.currentLang = defaultLang || 'en';
this.folder = 'l10n/';
this.l10nFileSuffix = '.ini';
this.callbacks = [];
}
fetchIniData(cb) {
if (this.cachedS... | class L10n
constructor: (defaultLang) ->
@cachedStrings = {}
@currentLang = defaultLang or 'en'
@folder = 'l10n/'
@l10nFileSuffix = '.ini'
@callbacks = []
fetchIniData: (cb) ->
if @cachedStrings[@currentLang]
cb()
else
$.ajax(
url: @folder + @currentLang + @l10nFileS... | JavaScript | CoffeeScript | Atraci/Atraci | coffee/_l10n.coffee | MIT | 409adeb372f76ca4dee651088c2ba83ea42708cd | 800 | https://github.com/Atraci/Atraci/blob/409adeb372f76ca4dee651088c2ba83ea42708cd/coffee/_l10n.coffee | 2 | 51 |
Atraci/Atraci:coffee/_l10n.coffee:1:completion | completion | class L10n
constructor: (defaultLang) ->
@cachedStrings = {}
@currentLang = defaultLang or 'en'
@folder = 'l10n/'
@l10nFileSuffix = '.ini'
@callbacks = []
fetchIniData: (cb) ->
if @cachedStrings[@currentLang]
cb()
else
$.ajax(
url: @folder + @currentLang + @l10nFileS... | if eachLine.length == 0
return
if eachLine.charAt(0) == '#' || eachLine.charAt(0) == ';'
return
reLine = /(\w+)\s*=\s*["]?(.*?)["]?$/
matched = reLine.exec(eachLine)
matchedKey = matched and matched[1]
matchedValue = matched and matched[2]
if matchedKey and matched... | CoffeeScript | CoffeeScript | Atraci/Atraci | coffee/_l10n.coffee | MIT | 409adeb372f76ca4dee651088c2ba83ea42708cd | 800 | https://github.com/Atraci/Atraci/blob/409adeb372f76ca4dee651088c2ba83ea42708cd/coffee/_l10n.coffee | 2 | 51 |
Atraci/Atraci:coffee/_l10n.coffee:2:raw_corpus | raw_corpus | reBracket = /\{\{\s*(\w+)\s*\}\}/g
matched = false
translate = () ->
matchedBracketSubject = matched and matched[0]
matchedParamKey = matched and matched[1]
if matchedBracketSubject and matchedParamKey
replaced = params[matchedParamKey]
if replaced
translatedString =... | CoffeeScript | Atraci/Atraci | coffee/_l10n.coffee | MIT | 409adeb372f76ca4dee651088c2ba83ea42708cd | 800 | https://github.com/Atraci/Atraci/blob/409adeb372f76ca4dee651088c2ba83ea42708cd/coffee/_l10n.coffee | 52 | 92 | ||
Atraci/Atraci:coffee/_l10n.coffee:2:completion | completion | reBracket = /\{\{\s*(\w+)\s*\}\}/g
matched = false
translate = () ->
matchedBracketSubject = matched and matched[0]
matchedParamKey = matched and matched[1]
if matchedBracketSubject and matchedParamKey
replaced = params[matchedParamKey]
if replaced
translatedString =... | return translatedString
addEventListener: (eventName, callback) ->
if eventName is 'localizationchange'
@callbacks.push callback
removeEventListener: (eventName, callback) ->
if eventName is 'localizationchange'
callbackIndex = @callbacks.indexOf(callback)
if callbackIndex >= 0
@... | CoffeeScript | CoffeeScript | Atraci/Atraci | coffee/_l10n.coffee | MIT | 409adeb372f76ca4dee651088c2ba83ea42708cd | 800 | https://github.com/Atraci/Atraci/blob/409adeb372f76ca4dee651088c2ba83ea42708cd/coffee/_l10n.coffee | 52 | 92 |
Atraci/Atraci:coffee/_l10n.coffee:1:raw_corpus | raw_corpus | class L10n
constructor: (defaultLang) ->
@cachedStrings = {}
@currentLang = defaultLang or 'en'
@folder = 'l10n/'
@l10nFileSuffix = '.ini'
@callbacks = []
fetchIniData: (cb) ->
if @cachedStrings[@currentLang]
cb()
else
$.ajax(
url: @folder + @currentLang + @l10nFileS... | CoffeeScript | Atraci/Atraci | coffee/_l10n.coffee | MIT | a4e3a69e284a1ef05051d95c0dc9bbb90c15b74f | 800 | https://github.com/Atraci/Atraci/blob/a4e3a69e284a1ef05051d95c0dc9bbb90c15b74f/coffee/_l10n.coffee | 2 | 51 | ||
Atraci/Atraci:coffee/_l10n.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class L10n
constructor: (defaultLang) ->
@cachedStrings = {}
@currentLang = defaultLang or 'en'
@folder = 'l10n/'
@l10nFileSuffix = '.ini'
@callbacks = []
fetchIniData: (cb) ->
if @cachedStrings[@currentLang]
cb()
else
... | var L10n;
L10n = class L10n {
constructor(defaultLang) {
this.cachedStrings = {};
this.currentLang = defaultLang || 'en';
this.folder = 'l10n/';
this.l10nFileSuffix = '.ini';
this.callbacks = [];
}
fetchIniData(cb) {
if (this.cachedStrings[this.currentLang]) {
return cb();
} el... | CoffeeScript | JavaScript | Atraci/Atraci | coffee/_l10n.coffee | MIT | a4e3a69e284a1ef05051d95c0dc9bbb90c15b74f | 800 | https://github.com/Atraci/Atraci/blob/a4e3a69e284a1ef05051d95c0dc9bbb90c15b74f/coffee/_l10n.coffee | 2 | 51 |
Atraci/Atraci:coffee/_l10n.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var L10n;
L10n = class L10n {
constructor(defaultLang) {
this.cachedStrings = {};
this.currentLang = defaultLang || 'en';
this.folder = 'l10n/';
this.l10nFileSuffix = '.ini';
this.callbacks = [];
}
fetchIniData(cb) {
if (this.cachedS... | class L10n
constructor: (defaultLang) ->
@cachedStrings = {}
@currentLang = defaultLang or 'en'
@folder = 'l10n/'
@l10nFileSuffix = '.ini'
@callbacks = []
fetchIniData: (cb) ->
if @cachedStrings[@currentLang]
cb()
else
$.ajax(
url: @folder + @currentLang + @l10nFileS... | JavaScript | CoffeeScript | Atraci/Atraci | coffee/_l10n.coffee | MIT | a4e3a69e284a1ef05051d95c0dc9bbb90c15b74f | 800 | https://github.com/Atraci/Atraci/blob/a4e3a69e284a1ef05051d95c0dc9bbb90c15b74f/coffee/_l10n.coffee | 2 | 51 |
Atraci/Atraci:coffee/_l10n.coffee:1:completion | completion | class L10n
constructor: (defaultLang) ->
@cachedStrings = {}
@currentLang = defaultLang or 'en'
@folder = 'l10n/'
@l10nFileSuffix = '.ini'
@callbacks = []
fetchIniData: (cb) ->
if @cachedStrings[@currentLang]
cb()
else
$.ajax(
url: @folder + @currentLang + @l10nFileS... | if eachLine.length == 0
return
if eachLine.charAt(0) == '#' || eachLine.charAt(0) == ';'
return
reLine = /(\w+)\s*=\s*["]?(.*?)["]?$/
matched = reLine.exec(eachLine)
matchedKey = matched and matched[1]
matchedValue = matched and matched[2]
if matchedKey and matched... | CoffeeScript | CoffeeScript | Atraci/Atraci | coffee/_l10n.coffee | MIT | a4e3a69e284a1ef05051d95c0dc9bbb90c15b74f | 800 | https://github.com/Atraci/Atraci/blob/a4e3a69e284a1ef05051d95c0dc9bbb90c15b74f/coffee/_l10n.coffee | 2 | 51 |
Atraci/Atraci:coffee/_l10n.coffee:2:raw_corpus | raw_corpus | if matchedBracketSubject and matchedParamKey
replaced = params[matchedParamKey]
if replaced
translatedString =
translatedString.replace(matchedBracketSubject, replaced)
translate() while matched = reBracket.exec(translatedString)
if not translatedString
throw new Er... | CoffeeScript | Atraci/Atraci | coffee/_l10n.coffee | MIT | a4e3a69e284a1ef05051d95c0dc9bbb90c15b74f | 800 | https://github.com/Atraci/Atraci/blob/a4e3a69e284a1ef05051d95c0dc9bbb90c15b74f/coffee/_l10n.coffee | 52 | 83 | ||
Atraci/Atraci:coffee/_l10n.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
if matchedBracketSubject and matchedParamKey
replaced = params[matchedParamKey]
if replaced
translatedString =
translatedString.replace(matchedBracketSubject, replaced)
translate() while matched = reBracket.exec(translat... | var matched, replaced, translatedString;
if (matchedBracketSubject && matchedParamKey) {
replaced = params[matchedParamKey];
if (replaced) {
translatedString = translatedString.replace(matchedBracketSubject, replaced);
}
}
while (matched = reBracket.exec(translatedString)) {
translate();
}
if (!translate... | CoffeeScript | JavaScript | Atraci/Atraci | coffee/_l10n.coffee | MIT | a4e3a69e284a1ef05051d95c0dc9bbb90c15b74f | 800 | https://github.com/Atraci/Atraci/blob/a4e3a69e284a1ef05051d95c0dc9bbb90c15b74f/coffee/_l10n.coffee | 52 | 83 |
Atraci/Atraci:coffee/_l10n.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var matched, replaced, translatedString;
if (matchedBracketSubject && matchedParamKey) {
replaced = params[matchedParamKey];
if (replaced) {
translatedString = translatedString.replace(matchedBracketSubject, replaced);
}
}
while (matched = reBracket.exe... | if matchedBracketSubject and matchedParamKey
replaced = params[matchedParamKey]
if replaced
translatedString =
translatedString.replace(matchedBracketSubject, replaced)
translate() while matched = reBracket.exec(translatedString)
if not translatedString
throw new Er... | JavaScript | CoffeeScript | Atraci/Atraci | coffee/_l10n.coffee | MIT | a4e3a69e284a1ef05051d95c0dc9bbb90c15b74f | 800 | https://github.com/Atraci/Atraci/blob/a4e3a69e284a1ef05051d95c0dc9bbb90c15b74f/coffee/_l10n.coffee | 52 | 83 |
Atraci/Atraci:coffee/_l10n.coffee:2:completion | completion | if matchedBracketSubject and matchedParamKey
replaced = params[matchedParamKey]
if replaced
translatedString =
translatedString.replace(matchedBracketSubject, replaced)
translate() while matched = reBracket.exec(translatedString)
if not translatedString
throw new Er... | removeEventListener: (eventName, callback) ->
if eventName is 'localizationchange'
callbackIndex = @callbacks.indexOf(callback)
if callbackIndex >= 0
@callbacks.splice(callbackIndex, 1)
changeLang: (lang) ->
if lang
@currentLang = lang
@fetchIniData(() =>
@callbacks.forEa... | CoffeeScript | CoffeeScript | Atraci/Atraci | coffee/_l10n.coffee | MIT | a4e3a69e284a1ef05051d95c0dc9bbb90c15b74f | 800 | https://github.com/Atraci/Atraci/blob/a4e3a69e284a1ef05051d95c0dc9bbb90c15b74f/coffee/_l10n.coffee | 52 | 83 |
Atraci/Atraci:coffee/_l10n.coffee:1:raw_corpus | raw_corpus | # Based on jQuery
class L10n
constructor: (defaultLang) ->
@cachedStrings = {}
@currentLang = defaultLang or 'en'
@folder = 'l10n/'
@l10nFileSuffix = '.ini'
@changeLang(@currentLang)
fetchIniData: (cb) ->
if @cachedStrings[@currentLang]
cb()
else
$.ajax(
url: @folder... | CoffeeScript | Atraci/Atraci | coffee/_l10n.coffee | MIT | b2a4388578171f20a79a01f58de44c001ec68a35 | 800 | https://github.com/Atraci/Atraci/blob/b2a4388578171f20a79a01f58de44c001ec68a35/coffee/_l10n.coffee | 1 | 50 | ||
Atraci/Atraci:coffee/_l10n.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# Based on jQuery
class L10n
constructor: (defaultLang) ->
@cachedStrings = {}
@currentLang = defaultLang or 'en'
@folder = 'l10n/'
@l10nFileSuffix = '.ini'
@changeLang(@currentLang)
fetchIniData: (cb) ->
if @cachedStrings[@currentLan... | // Based on jQuery
var L10n;
L10n = class L10n {
constructor(defaultLang) {
this.cachedStrings = {};
this.currentLang = defaultLang || 'en';
this.folder = 'l10n/';
this.l10nFileSuffix = '.ini';
this.changeLang(this.currentLang);
}
fetchIniData(cb) {
if (this.cachedStrings[this.currentLan... | CoffeeScript | JavaScript | Atraci/Atraci | coffee/_l10n.coffee | MIT | b2a4388578171f20a79a01f58de44c001ec68a35 | 800 | https://github.com/Atraci/Atraci/blob/b2a4388578171f20a79a01f58de44c001ec68a35/coffee/_l10n.coffee | 1 | 50 |
Atraci/Atraci:coffee/_l10n.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// Based on jQuery
var L10n;
L10n = class L10n {
constructor(defaultLang) {
this.cachedStrings = {};
this.currentLang = defaultLang || 'en';
this.folder = 'l10n/';
this.l10nFileSuffix = '.ini';
this.changeLang(this.currentLang);
}
fetchI... | # Based on jQuery
class L10n
constructor: (defaultLang) ->
@cachedStrings = {}
@currentLang = defaultLang or 'en'
@folder = 'l10n/'
@l10nFileSuffix = '.ini'
@changeLang(@currentLang)
fetchIniData: (cb) ->
if @cachedStrings[@currentLang]
cb()
else
$.ajax(
url: @folder... | JavaScript | CoffeeScript | Atraci/Atraci | coffee/_l10n.coffee | MIT | b2a4388578171f20a79a01f58de44c001ec68a35 | 800 | https://github.com/Atraci/Atraci/blob/b2a4388578171f20a79a01f58de44c001ec68a35/coffee/_l10n.coffee | 1 | 50 |
Atraci/Atraci:coffee/_l10n.coffee:1:completion | completion | # Based on jQuery
class L10n
constructor: (defaultLang) ->
@cachedStrings = {}
@currentLang = defaultLang or 'en'
@folder = 'l10n/'
@l10nFileSuffix = '.ini'
@changeLang(@currentLang)
fetchIniData: (cb) ->
if @cachedStrings[@currentLang]
cb()
else
$.ajax(
url: @folder... | if eachLine.length == 0
return
if eachLine.charAt(0) == '#' || eachLine.charAt(0) == ';'
return
reLine = /(\w+)\s*=\s*["]?(.*?)["]?$/
matched = reLine.exec(eachLine)
matchedKey = matched and matched[1]
matchedValue = matched and matched[2]
if matchedKey and matched... | CoffeeScript | CoffeeScript | Atraci/Atraci | coffee/_l10n.coffee | MIT | b2a4388578171f20a79a01f58de44c001ec68a35 | 800 | https://github.com/Atraci/Atraci/blob/b2a4388578171f20a79a01f58de44c001ec68a35/coffee/_l10n.coffee | 1 | 50 |
Atraci/Atraci:coffee/_l10n.coffee:2:raw_corpus | raw_corpus | if matchedBracketSubject and matchedParamKey
replaced = params[matchedParamKey]
if replaced
translatedString =
translatedString.replace(matchedBracketSubject, replaced)
translate() while matched = reBracket.exec(translatedString)
if not translatedString
throw new Er... | CoffeeScript | Atraci/Atraci | coffee/_l10n.coffee | MIT | b2a4388578171f20a79a01f58de44c001ec68a35 | 800 | https://github.com/Atraci/Atraci/blob/b2a4388578171f20a79a01f58de44c001ec68a35/coffee/_l10n.coffee | 51 | 75 | ||
Atraci/Atraci:coffee/_l10n.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
if matchedBracketSubject and matchedParamKey
replaced = params[matchedParamKey]
if replaced
translatedString =
translatedString.replace(matchedBracketSubject, replaced)
translate() while matched = reBracket.exec(translat... | var matched, replaced, translatedString;
if (matchedBracketSubject && matchedParamKey) {
replaced = params[matchedParamKey];
if (replaced) {
translatedString = translatedString.replace(matchedBracketSubject, replaced);
}
}
while (matched = reBracket.exec(translatedString)) {
translate();
}
if (!translate... | CoffeeScript | JavaScript | Atraci/Atraci | coffee/_l10n.coffee | MIT | b2a4388578171f20a79a01f58de44c001ec68a35 | 800 | https://github.com/Atraci/Atraci/blob/b2a4388578171f20a79a01f58de44c001ec68a35/coffee/_l10n.coffee | 51 | 75 |
Atraci/Atraci:coffee/_l10n.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var matched, replaced, translatedString;
if (matchedBracketSubject && matchedParamKey) {
replaced = params[matchedParamKey];
if (replaced) {
translatedString = translatedString.replace(matchedBracketSubject, replaced);
}
}
while (matched = reBracket.exe... | if matchedBracketSubject and matchedParamKey
replaced = params[matchedParamKey]
if replaced
translatedString =
translatedString.replace(matchedBracketSubject, replaced)
translate() while matched = reBracket.exec(translatedString)
if not translatedString
throw new Er... | JavaScript | CoffeeScript | Atraci/Atraci | coffee/_l10n.coffee | MIT | b2a4388578171f20a79a01f58de44c001ec68a35 | 800 | https://github.com/Atraci/Atraci/blob/b2a4388578171f20a79a01f58de44c001ec68a35/coffee/_l10n.coffee | 51 | 75 |
Atraci/Atraci:coffee/_l10n.coffee:2:completion | completion | if matchedBracketSubject and matchedParamKey
replaced = params[matchedParamKey]
if replaced
translatedString =
translatedString.replace(matchedBracketSubject, replaced)
translate() while matched = reBracket.exec(translatedString)
if not translatedString
throw new Er... | changeLang: (lang) ->
@currentLang = lang
@fetchIniData(() =>
$elements = $('[data-l10n-id]')
$elements.each((index, ele) =>
$ele = $(ele)
l10nId = $ele.data('l10n-id')
params = $ele.data('l10n-params')
$ele.text(@get(l10nId, params))
)
) | CoffeeScript | CoffeeScript | Atraci/Atraci | coffee/_l10n.coffee | MIT | b2a4388578171f20a79a01f58de44c001ec68a35 | 800 | https://github.com/Atraci/Atraci/blob/b2a4388578171f20a79a01f58de44c001ec68a35/coffee/_l10n.coffee | 51 | 75 |
Atraci/Atraci:coffee/_l10n.coffee:2:raw_corpus | raw_corpus | if matchedBracketSubject and matchedParamKey
replaced = params[matchedParamKey]
if replaced
translatedString =
translatedString.replace(matchedBracketSubject, replaced)
translate() while matched = reBracket.exec(translatedString)
if not translatedString
throw new Er... | CoffeeScript | Atraci/Atraci | coffee/_l10n.coffee | MIT | f039c6aae2b92da7a3303e53efbb146ec3b59130 | 800 | https://github.com/Atraci/Atraci/blob/f039c6aae2b92da7a3303e53efbb146ec3b59130/coffee/_l10n.coffee | 51 | 79 | ||
Atraci/Atraci:coffee/_l10n.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
if matchedBracketSubject and matchedParamKey
replaced = params[matchedParamKey]
if replaced
translatedString =
translatedString.replace(matchedBracketSubject, replaced)
translate() while matched = reBracket.exec(translat... | var matched, replaced, translatedString;
if (matchedBracketSubject && matchedParamKey) {
replaced = params[matchedParamKey];
if (replaced) {
translatedString = translatedString.replace(matchedBracketSubject, replaced);
}
}
while (matched = reBracket.exec(translatedString)) {
translate();
}
if (!translate... | CoffeeScript | JavaScript | Atraci/Atraci | coffee/_l10n.coffee | MIT | f039c6aae2b92da7a3303e53efbb146ec3b59130 | 800 | https://github.com/Atraci/Atraci/blob/f039c6aae2b92da7a3303e53efbb146ec3b59130/coffee/_l10n.coffee | 51 | 79 |
Atraci/Atraci:coffee/_l10n.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var matched, replaced, translatedString;
if (matchedBracketSubject && matchedParamKey) {
replaced = params[matchedParamKey];
if (replaced) {
translatedString = translatedString.replace(matchedBracketSubject, replaced);
}
}
while (matched = reBracket.exe... | if matchedBracketSubject and matchedParamKey
replaced = params[matchedParamKey]
if replaced
translatedString =
translatedString.replace(matchedBracketSubject, replaced)
translate() while matched = reBracket.exec(translatedString)
if not translatedString
throw new Er... | JavaScript | CoffeeScript | Atraci/Atraci | coffee/_l10n.coffee | MIT | f039c6aae2b92da7a3303e53efbb146ec3b59130 | 800 | https://github.com/Atraci/Atraci/blob/f039c6aae2b92da7a3303e53efbb146ec3b59130/coffee/_l10n.coffee | 51 | 79 |
Atraci/Atraci:coffee/_l10n.coffee:2:completion | completion | if matchedBracketSubject and matchedParamKey
replaced = params[matchedParamKey]
if replaced
translatedString =
translatedString.replace(matchedBracketSubject, replaced)
translate() while matched = reBracket.exec(translatedString)
if not translatedString
throw new Er... | console.log 'changed lang' + lang
@currentLang = lang
@fetchIniData(() =>
console.log('xxxx')
$elements = $('[data-l10n-id]')
$elements.each((index, ele) =>
$ele = $(ele)
l10nId = $ele.data('l10n-id')
params = $ele.data('l10n-params')
console.log($ele)
c... | CoffeeScript | CoffeeScript | Atraci/Atraci | coffee/_l10n.coffee | MIT | f039c6aae2b92da7a3303e53efbb146ec3b59130 | 800 | https://github.com/Atraci/Atraci/blob/f039c6aae2b92da7a3303e53efbb146ec3b59130/coffee/_l10n.coffee | 51 | 79 |
Atraci/Atraci:coffee/_l10n.coffee:1:raw_corpus | raw_corpus | # Based on jQuery
class L10n
constructor: (defaultLang) ->
@cachedStrings = {}
@currentLang = defaultLang or 'en'
@folder = 'l10n/'
@l10nFileSuffix = '.ini'
@fetchIniData(->)
fetchIniData: (cb) ->
if @cachedStrings[@currentLang]
cb()
else
$.ajax(
url: @folder + @curr... | CoffeeScript | Atraci/Atraci | coffee/_l10n.coffee | MIT | 974ceaaf1e25de24ae38e4220db96ef65dce30df | 800 | https://github.com/Atraci/Atraci/blob/974ceaaf1e25de24ae38e4220db96ef65dce30df/coffee/_l10n.coffee | 1 | 50 | ||
Atraci/Atraci:coffee/_l10n.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# Based on jQuery
class L10n
constructor: (defaultLang) ->
@cachedStrings = {}
@currentLang = defaultLang or 'en'
@folder = 'l10n/'
@l10nFileSuffix = '.ini'
@fetchIniData(->)
fetchIniData: (cb) ->
if @cachedStrings[@currentLang]
... | // Based on jQuery
var L10n;
L10n = class L10n {
constructor(defaultLang) {
this.cachedStrings = {};
this.currentLang = defaultLang || 'en';
this.folder = 'l10n/';
this.l10nFileSuffix = '.ini';
this.fetchIniData(function() {});
}
fetchIniData(cb) {
if (this.cachedStrings[this.currentLang... | CoffeeScript | JavaScript | Atraci/Atraci | coffee/_l10n.coffee | MIT | 974ceaaf1e25de24ae38e4220db96ef65dce30df | 800 | https://github.com/Atraci/Atraci/blob/974ceaaf1e25de24ae38e4220db96ef65dce30df/coffee/_l10n.coffee | 1 | 50 |
Atraci/Atraci:coffee/_l10n.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// Based on jQuery
var L10n;
L10n = class L10n {
constructor(defaultLang) {
this.cachedStrings = {};
this.currentLang = defaultLang || 'en';
this.folder = 'l10n/';
this.l10nFileSuffix = '.ini';
this.fetchIniData(function() {});
}
fetchIn... | # Based on jQuery
class L10n
constructor: (defaultLang) ->
@cachedStrings = {}
@currentLang = defaultLang or 'en'
@folder = 'l10n/'
@l10nFileSuffix = '.ini'
@fetchIniData(->)
fetchIniData: (cb) ->
if @cachedStrings[@currentLang]
cb()
else
$.ajax(
url: @folder + @curr... | JavaScript | CoffeeScript | Atraci/Atraci | coffee/_l10n.coffee | MIT | 974ceaaf1e25de24ae38e4220db96ef65dce30df | 800 | https://github.com/Atraci/Atraci/blob/974ceaaf1e25de24ae38e4220db96ef65dce30df/coffee/_l10n.coffee | 1 | 50 |
Atraci/Atraci:coffee/_l10n.coffee:1:completion | completion | # Based on jQuery
class L10n
constructor: (defaultLang) ->
@cachedStrings = {}
@currentLang = defaultLang or 'en'
@folder = 'l10n/'
@l10nFileSuffix = '.ini'
@fetchIniData(->)
fetchIniData: (cb) ->
if @cachedStrings[@currentLang]
cb()
else
$.ajax(
url: @folder + @curr... | if eachLine.length == 0
return
if eachLine.charAt(0) == '#' || eachLine.charAt(0) == ';'
return
reLine = /(\w+)\s*=\s*(.*)$/
matched = reLine.exec(eachLine)
matchedKey = matched and matched[1]
matchedValue = matched and matched[2]
if matchedKey and matchedValue
... | CoffeeScript | CoffeeScript | Atraci/Atraci | coffee/_l10n.coffee | MIT | 974ceaaf1e25de24ae38e4220db96ef65dce30df | 800 | https://github.com/Atraci/Atraci/blob/974ceaaf1e25de24ae38e4220db96ef65dce30df/coffee/_l10n.coffee | 1 | 50 |
Atraci/Atraci:coffee/_l10n.coffee:2:raw_corpus | raw_corpus | if matchedBracketSubject and matchedParamKey
replaced = params[matchedParamKey]
if replaced
translatedString =
translatedString.replace(matchedBracketSubject, replaced)
translate() while matched = reBracket.exec(translatedString)
if not translatedString
throw new Er... | CoffeeScript | Atraci/Atraci | coffee/_l10n.coffee | MIT | 974ceaaf1e25de24ae38e4220db96ef65dce30df | 800 | https://github.com/Atraci/Atraci/blob/974ceaaf1e25de24ae38e4220db96ef65dce30df/coffee/_l10n.coffee | 51 | 74 | ||
Atraci/Atraci:coffee/_l10n.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
if matchedBracketSubject and matchedParamKey
replaced = params[matchedParamKey]
if replaced
translatedString =
translatedString.replace(matchedBracketSubject, replaced)
translate() while matched = reBracket.exec(translat... | var matched, replaced, translatedString;
if (matchedBracketSubject && matchedParamKey) {
replaced = params[matchedParamKey];
if (replaced) {
translatedString = translatedString.replace(matchedBracketSubject, replaced);
}
}
while (matched = reBracket.exec(translatedString)) {
translate();
}
if (!translate... | CoffeeScript | JavaScript | Atraci/Atraci | coffee/_l10n.coffee | MIT | 974ceaaf1e25de24ae38e4220db96ef65dce30df | 800 | https://github.com/Atraci/Atraci/blob/974ceaaf1e25de24ae38e4220db96ef65dce30df/coffee/_l10n.coffee | 51 | 74 |
Atraci/Atraci:coffee/_l10n.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var matched, replaced, translatedString;
if (matchedBracketSubject && matchedParamKey) {
replaced = params[matchedParamKey];
if (replaced) {
translatedString = translatedString.replace(matchedBracketSubject, replaced);
}
}
while (matched = reBracket.exe... | if matchedBracketSubject and matchedParamKey
replaced = params[matchedParamKey]
if replaced
translatedString =
translatedString.replace(matchedBracketSubject, replaced)
translate() while matched = reBracket.exec(translatedString)
if not translatedString
throw new Er... | JavaScript | CoffeeScript | Atraci/Atraci | coffee/_l10n.coffee | MIT | 974ceaaf1e25de24ae38e4220db96ef65dce30df | 800 | https://github.com/Atraci/Atraci/blob/974ceaaf1e25de24ae38e4220db96ef65dce30df/coffee/_l10n.coffee | 51 | 74 |
Atraci/Atraci:coffee/_l10n.coffee:2:completion | completion | if matchedBracketSubject and matchedParamKey
replaced = params[matchedParamKey]
if replaced
translatedString =
translatedString.replace(matchedBracketSubject, replaced)
translate() while matched = reBracket.exec(translatedString)
if not translatedString
throw new Er... | return translatedString
changeLang: (lang) ->
@currentLang = lang
@fetchIniData(->
$elements = $('[data-l10n-id]')
$elements.each((index, $ele) =>
l10nId = $ele.data('l10n-id')
params = $ele.data('l10n-params')
$ele.text(@get(l10nId, params))
)
) | CoffeeScript | CoffeeScript | Atraci/Atraci | coffee/_l10n.coffee | MIT | 974ceaaf1e25de24ae38e4220db96ef65dce30df | 800 | https://github.com/Atraci/Atraci/blob/974ceaaf1e25de24ae38e4220db96ef65dce30df/coffee/_l10n.coffee | 51 | 74 |
jianliaoim/talk-os:talk-api2x/test/services/loader.coffee:1:raw_corpus | raw_corpus | should = require 'should'
serviceLoader = require 'talk-services'
describe 'Service#Load', ->
it 'should load all services and append robots to each service', (done) ->
$incoming = serviceLoader.load 'incoming'
$incoming.then (incoming) ->
incoming.robot.isRobot.should.eql true
incoming.robot.... | CoffeeScript | jianliaoim/talk-os | talk-api2x/test/services/loader.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/test/services/loader.coffee | 1 | 27 | ||
jianliaoim/talk-os:talk-api2x/test/services/loader.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
should = require 'should'
serviceLoader = require 'talk-services'
describe 'Service#Load', ->
it 'should load all services and append robots to each service', (done) ->
$incoming = serviceLoader.load 'incoming'
$incoming.then (incoming) ->
inc... | var serviceLoader, should;
should = require('should');
serviceLoader = require('talk-services');
describe('Service#Load', function() {
it('should load all services and append robots to each service', function(done) {
var $incoming;
$incoming = serviceLoader.load('incoming');
return $incoming.then(funct... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-api2x/test/services/loader.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/test/services/loader.coffee | 1 | 27 |
jianliaoim/talk-os:talk-api2x/test/services/loader.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var serviceLoader, should;
should = require('should');
serviceLoader = require('talk-services');
describe('Service#Load', function() {
it('should load all services and append robots to each service', function(done) {
var $incoming;
$incoming = serviceL... | should = require 'should'
serviceLoader = require 'talk-services'
describe 'Service#Load', ->
it 'should load all services and append robots to each service', (done) ->
$incoming = serviceLoader.load 'incoming'
$incoming.then (incoming) ->
incoming.robot.isRobot.should.eql true
incoming.robot.... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-api2x/test/services/loader.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/test/services/loader.coffee | 1 | 27 |
jianliaoim/talk-os:talk-api2x/test/services/loader.coffee:1:completion | completion | should = require 'should'
serviceLoader = require 'talk-services'
describe 'Service#Load', ->
it 'should load all services and append robots to each service', (done) ->
$incoming = serviceLoader.load 'incoming'
$incoming.then (incoming) ->
incoming.robot.isRobot.should.eql true
incoming.robot.... | .nodeify done
it 'should load all the settings of services', (done) ->
serviceLoader.settings().then (settings) ->
settings.length.should.above 0
settings.forEach (setting) ->
setting.name.should.not.eql 'talkai' # Do not show hidden services
setting.constructor.name.should.eql 'Obj... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-api2x/test/services/loader.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/test/services/loader.coffee | 1 | 27 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.