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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
octoblu/meshblu:lib/simpleAuth.coffee:1:raw_corpus | raw_corpus | class SimpleAuth
constructor: (@dependencies={}) ->
@authDevice = @dependencies.authDevice || require './authDevice'
asyncCallback : (error, result, callback) =>
_.defer( => callback(error, result))
checkLists: (fromDevice, toDevice, whitelist, blacklist, openByDefault) =>
return false if !fromDevi... | CoffeeScript | octoblu/meshblu | lib/simpleAuth.coffee | MIT | 1991ecf9f04079ca8b9dff0877bc32cf98978e62 | 815 | https://github.com/octoblu/meshblu/blob/1991ecf9f04079ca8b9dff0877bc32cf98978e62/lib/simpleAuth.coffee | 5 | 54 | ||
octoblu/meshblu:lib/simpleAuth.coffee:1:completion | completion | class SimpleAuth
constructor: (@dependencies={}) ->
@authDevice = @dependencies.authDevice || require './authDevice'
asyncCallback : (error, result, callback) =>
_.defer( => callback(error, result))
checkLists: (fromDevice, toDevice, whitelist, blacklist, openByDefault) =>
return false if !fromDevi... | return @asyncCallback(null, true, callback) if @checkLists fromDevice, toDevice, toDevice?.discoverWhitelist, toDevice?.discoverBlacklist, true
if message?.token
return @authDevice(
toDevice.uuid
message.token
(error, result) =>
return @asyncCallback(error, false, callback) ... | CoffeeScript | CoffeeScript | octoblu/meshblu | lib/simpleAuth.coffee | MIT | 1991ecf9f04079ca8b9dff0877bc32cf98978e62 | 815 | https://github.com/octoblu/meshblu/blob/1991ecf9f04079ca8b9dff0877bc32cf98978e62/lib/simpleAuth.coffee | 5 | 54 |
octoblu/meshblu:lib/simpleAuth.coffee:2:raw_corpus | raw_corpus | return @asyncCallback(null, result?, callback)
)
listenWhitelist = _.cloneDeep toDevice?.listenWhitelist
unless listenWhitelist
listenWhitelist = []
listenWhitelist.push toDevice.owner if toDevice?.owner
result = @checkLists fromDevice, toDevice, listenWhitelist, toDevice?.listenBlackli... | CoffeeScript | octoblu/meshblu | lib/simpleAuth.coffee | MIT | 1991ecf9f04079ca8b9dff0877bc32cf98978e62 | 815 | https://github.com/octoblu/meshblu/blob/1991ecf9f04079ca8b9dff0877bc32cf98978e62/lib/simpleAuth.coffee | 55 | 104 | ||
octoblu/meshblu:lib/simpleAuth.coffee:2:completion | completion | return @asyncCallback(null, result?, callback)
)
listenWhitelist = _.cloneDeep toDevice?.listenWhitelist
unless listenWhitelist
listenWhitelist = []
listenWhitelist.push toDevice.owner if toDevice?.owner
result = @checkLists fromDevice, toDevice, listenWhitelist, toDevice?.listenBlackli... | result = @checkLists fromDevice, toDevice, toDevice?.receiveWhitelist, toDevice?.receiveBlacklist, true
@asyncCallback(null, result, callback)
canSend: (fromDevice, toDevice, message, callback) =>
if _.isFunction message
callback = message
message = null
if message?.token
return @authD... | CoffeeScript | CoffeeScript | octoblu/meshblu | lib/simpleAuth.coffee | MIT | 1991ecf9f04079ca8b9dff0877bc32cf98978e62 | 815 | https://github.com/octoblu/meshblu/blob/1991ecf9f04079ca8b9dff0877bc32cf98978e62/lib/simpleAuth.coffee | 55 | 104 |
octoblu/meshblu:lib/simpleAuth.coffee:3:raw_corpus | raw_corpus | return @asyncCallback(null, true, callback) if @checkLists fromDevice, toDevice, toDevice?.configureWhitelist, toDevice?.configureBlacklist, false
return @asyncCallback(null, false, callback) if !fromDevice || !toDevice
return @asyncCallback(null, true, callback) if fromDevice.uuid == toDevice.uuid
if to... | CoffeeScript | octoblu/meshblu | lib/simpleAuth.coffee | MIT | 1991ecf9f04079ca8b9dff0877bc32cf98978e62 | 815 | https://github.com/octoblu/meshblu/blob/1991ecf9f04079ca8b9dff0877bc32cf98978e62/lib/simpleAuth.coffee | 105 | 125 | ||
octoblu/meshblu:lib/simpleAuth.coffee:3:completion | completion | return @asyncCallback(null, true, callback) if @checkLists fromDevice, toDevice, toDevice?.configureWhitelist, toDevice?.configureBlacklist, false
return @asyncCallback(null, false, callback) if !fromDevice || !toDevice
return @asyncCallback(null, true, callback) if fromDevice.uuid == toDevice.uuid
if to... | if message?.token
return @authDevice(
toDevice.uuid
message.token
(error, result) =>
return @asyncCallback(error, false, callback) if error?
return @asyncCallback(null, result?, callback)
)
return @asyncCallback(null, false, callback) | CoffeeScript | CoffeeScript | octoblu/meshblu | lib/simpleAuth.coffee | MIT | 1991ecf9f04079ca8b9dff0877bc32cf98978e62 | 815 | https://github.com/octoblu/meshblu/blob/1991ecf9f04079ca8b9dff0877bc32cf98978e62/lib/simpleAuth.coffee | 105 | 125 |
octoblu/meshblu:lib/simpleAuth.coffee:1:raw_corpus | raw_corpus | class SimpleAuth
constructor: (@dependencies={}) ->
@authDevice = @dependencies.authDevice || require './authDevice'
asyncCallback : (error, result, callback) =>
_.defer( => callback(error, result))
checkLists: (fromDevice, toDevice, whitelist, blacklist, openByDefault) =>
return false if !fromDevi... | CoffeeScript | octoblu/meshblu | lib/simpleAuth.coffee | MIT | e315719b325c77ceb0671572d93ad7edf7d08475 | 815 | https://github.com/octoblu/meshblu/blob/e315719b325c77ceb0671572d93ad7edf7d08475/lib/simpleAuth.coffee | 5 | 54 | ||
octoblu/meshblu:lib/simpleAuth.coffee:1:completion | completion | class SimpleAuth
constructor: (@dependencies={}) ->
@authDevice = @dependencies.authDevice || require './authDevice'
asyncCallback : (error, result, callback) =>
_.defer( => callback(error, result))
checkLists: (fromDevice, toDevice, whitelist, blacklist, openByDefault) =>
return false if !fromDevi... | return @asyncCallback(null, true, callback) if @checkLists fromDevice, toDevice, toDevice?.discoverWhitelist, toDevice?.discoverBlacklist, true
if message?.token
return @authDevice(
toDevice.uuid
message.token
(error, result) =>
return @asyncCallback(error, false, callback) ... | CoffeeScript | CoffeeScript | octoblu/meshblu | lib/simpleAuth.coffee | MIT | e315719b325c77ceb0671572d93ad7edf7d08475 | 815 | https://github.com/octoblu/meshblu/blob/e315719b325c77ceb0671572d93ad7edf7d08475/lib/simpleAuth.coffee | 5 | 54 |
octoblu/meshblu:lib/simpleAuth.coffee:2:raw_corpus | raw_corpus | return @asyncCallback(error, false, callback) if error?
return @asyncCallback(null, result?, callback)
)
result = @checkLists fromDevice, toDevice, toDevice?.receiveWhitelist, toDevice?.receiveBlacklist, true
@asyncCallback(null, result, callback)
canSend: (fromDevice, toDevice, message, ca... | CoffeeScript | octoblu/meshblu | lib/simpleAuth.coffee | MIT | e315719b325c77ceb0671572d93ad7edf7d08475 | 815 | https://github.com/octoblu/meshblu/blob/e315719b325c77ceb0671572d93ad7edf7d08475/lib/simpleAuth.coffee | 55 | 104 | ||
octoblu/meshblu:lib/simpleAuth.coffee:2:completion | completion | return @asyncCallback(error, false, callback) if error?
return @asyncCallback(null, result?, callback)
)
result = @checkLists fromDevice, toDevice, toDevice?.receiveWhitelist, toDevice?.receiveBlacklist, true
@asyncCallback(null, result, callback)
canSend: (fromDevice, toDevice, message, ca... | if _.isFunction message
callback = message
message = null
return @asyncCallback(null, true, callback) if @checkLists fromDevice, toDevice, toDevice?.configureWhitelist, toDevice?.configureBlacklist, false
return @asyncCallback(null, false, callback) if !fromDevice || !toDevice
return @asyncCa... | CoffeeScript | CoffeeScript | octoblu/meshblu | lib/simpleAuth.coffee | MIT | e315719b325c77ceb0671572d93ad7edf7d08475 | 815 | https://github.com/octoblu/meshblu/blob/e315719b325c77ceb0671572d93ad7edf7d08475/lib/simpleAuth.coffee | 55 | 104 |
jianliaoim/talk-os:talk-account/test/apis/unions/weibo.coffee:1:raw_corpus | raw_corpus | should = require 'should'
request = require 'supertest'
jwt = require 'jsonwebtoken'
app = require '../../../server/server'
util = require '../../util'
describe 'Union#Weibo', ->
before util.prepare
it 'should redirect to weibo account page when visit redirect url', (done) ->
request(app).get '/union/weibo'
... | CoffeeScript | jianliaoim/talk-os | talk-account/test/apis/unions/weibo.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/test/apis/unions/weibo.coffee | 1 | 46 | ||
jianliaoim/talk-os:talk-account/test/apis/unions/weibo.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
should = require 'should'
request = require 'supertest'
jwt = require 'jsonwebtoken'
app = require '../../../server/server'
util = require '../../util'
describe 'Union#Weibo', ->
before util.prepare
it 'should redirect to weibo account page when visit redi... | var app, jwt, request, should, util;
should = require('should');
request = require('supertest');
jwt = require('jsonwebtoken');
app = require('../../../server/server');
util = require('../../util');
describe('Union#Weibo', function() {
before(util.prepare);
it('should redirect to weibo account page when visit... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-account/test/apis/unions/weibo.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/test/apis/unions/weibo.coffee | 1 | 46 |
jianliaoim/talk-os:talk-account/test/apis/unions/weibo.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var app, jwt, request, should, util;
should = require('should');
request = require('supertest');
jwt = require('jsonwebtoken');
app = require('../../../server/server');
util = require('../../util');
describe('Union#Weibo', function() {
before(util.prepare);... | should = require 'should'
request = require 'supertest'
jwt = require 'jsonwebtoken'
app = require '../../../server/server'
util = require '../../util'
describe 'Union#Weibo', ->
before util.prepare
it 'should redirect to weibo account page when visit redirect url', (done) ->
request(app).get '/union/weibo'
... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-account/test/apis/unions/weibo.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/test/apis/unions/weibo.coffee | 1 | 46 |
jianliaoim/talk-os:talk-account/test/apis/unions/weibo.coffee:1:completion | completion | should = require 'should'
request = require 'supertest'
jwt = require 'jsonwebtoken'
app = require '../../../server/server'
util = require '../../util'
describe 'Union#Weibo', ->
before util.prepare
it 'should redirect to weibo account page when visit redirect url', (done) ->
request(app).get '/union/weibo'
... | util.request options, (err, res, user) ->
user.should.have.properties 'name', 'refer', 'openId', 'accountToken', 'wasNew', 'showname'
user.wasNew.should.eql true
user.name.should.eql '微博用户'
user.openId.should.eql '1234567890'
user.showname.should.eql '简聊'
{id, login} = jwt.decode use... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-account/test/apis/unions/weibo.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/test/apis/unions/weibo.coffee | 1 | 46 |
jianliaoim/talk-os:talk-account/test/apis/unions/weibo.coffee:2:raw_corpus | raw_corpus | it 'should bind to an exist weibo account by bindCode', (done) ->
options =
method: 'POST'
url: '/union/forcebind/weibo'
body:
accountToken: util.user.accountToken
bindCode: util.bindCode
util.request options, (err, res, user) ->
user.should.have.properties 'accountToken'... | CoffeeScript | jianliaoim/talk-os | talk-account/test/apis/unions/weibo.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/test/apis/unions/weibo.coffee | 48 | 89 | ||
jianliaoim/talk-os:talk-account/test/apis/unions/weibo.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
it 'should bind to an exist weibo account by bindCode', (done) ->
options =
method: 'POST'
url: '/union/forcebind/weibo'
body:
accountToken: util.user.accountToken
bindCode: util.bindCode
util.request options, (err, res, ... | it('should bind to an exist weibo account by bindCode', function(done) {
var options;
options = {
method: 'POST',
url: '/union/forcebind/weibo',
body: {
accountToken: util.user.accountToken,
bindCode: util.bindCode
}
};
return util.request(options, function(err, res, user) {
user... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-account/test/apis/unions/weibo.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/test/apis/unions/weibo.coffee | 48 | 89 |
jianliaoim/talk-os:talk-account/test/apis/unions/weibo.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
it('should bind to an exist weibo account by bindCode', function(done) {
var options;
options = {
method: 'POST',
url: '/union/forcebind/weibo',
body: {
accountToken: util.user.accountToken,
bindCode: util.bindCode
}
};
return ut... | it 'should bind to an exist weibo account by bindCode', (done) ->
options =
method: 'POST'
url: '/union/forcebind/weibo'
body:
accountToken: util.user.accountToken
bindCode: util.bindCode
util.request options, (err, res, user) ->
user.should.have.properties 'accountToken'... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-account/test/apis/unions/weibo.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/test/apis/unions/weibo.coffee | 48 | 89 |
jianliaoim/talk-os:talk-account/test/apis/unions/weibo.coffee:2:completion | completion | it 'should bind to an exist weibo account by bindCode', (done) ->
options =
method: 'POST'
url: '/union/forcebind/weibo'
body:
accountToken: util.user.accountToken
bindCode: util.bindCode
util.request options, (err, res, user) ->
user.should.have.properties 'accountToken'... | it 'should bind weibo account again', (done) ->
options =
method: 'POST'
url: '/union/bind/weibo'
body:
accountToken: util.user.accountToken
code: 'xxx'
util.request options, (err, res, user) ->
user.should.have.properties 'refer', 'openId'
done err
it 'should ch... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-account/test/apis/unions/weibo.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/test/apis/unions/weibo.coffee | 48 | 89 |
meltingice/psd.js:lib/psd/node.coffee:1:raw_corpus | raw_corpus | module.exports = class Node extends Module
# We have a couple of important mixins that provide some really cool functionality.
@includes require('./nodes/ancestry.coffee')
@includes require('./nodes/search.coffee')
@includes require('./nodes/build_preview.coffee')
# There are some common properties that are ... | CoffeeScript | meltingice/psd.js | lib/psd/node.coffee | MIT | 7e8392d20fd5d66ad70ddda7309661b9a0ca67c8 | 2,846 | https://github.com/meltingice/psd.js/blob/7e8392d20fd5d66ad70ddda7309661b9a0ca67c8/lib/psd/node.coffee | 12 | 61 | ||
meltingice/psd.js:lib/psd/node.coffee:1:completion | completion | module.exports = class Node extends Module
# We have a couple of important mixins that provide some really cool functionality.
@includes require('./nodes/ancestry.coffee')
@includes require('./nodes/search.coffee')
@includes require('./nodes/build_preview.coffee')
# There are some common properties that are ... | @forceVisible = null
# We also store the coordinates on the node, especially since we'll eventually be
# able to modify them based on layer comp data.
@coords =
top: @layer.top
bottom: @layer.bottom
left: @layer.left
right: @layer.right
@topOffset = 0
@leftOffset = 0
@... | CoffeeScript | CoffeeScript | meltingice/psd.js | lib/psd/node.coffee | MIT | 7e8392d20fd5d66ad70ddda7309661b9a0ca67c8 | 2,846 | https://github.com/meltingice/psd.js/blob/7e8392d20fd5d66ad70ddda7309661b9a0ca67c8/lib/psd/node.coffee | 12 | 61 |
meltingice/psd.js:lib/psd/node.coffee:2:raw_corpus | raw_corpus | Object.defineProperty @, 'bottom',
get: -> @coords.bottom + @topOffset
set: (val) -> @coords.bottom = val
Object.defineProperty @, 'left',
get: -> @coords.left + @leftOffset
set: (val) -> @coords.left = val
# We take the tiny overhead of recalculating this every time since the offset c... | CoffeeScript | meltingice/psd.js | lib/psd/node.coffee | MIT | 7e8392d20fd5d66ad70ddda7309661b9a0ca67c8 | 2,846 | https://github.com/meltingice/psd.js/blob/7e8392d20fd5d66ad70ddda7309661b9a0ca67c8/lib/psd/node.coffee | 62 | 111 | ||
meltingice/psd.js:lib/psd/node.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Object.defineProperty @, 'bottom',
get: -> @coords.bottom + @topOffset
set: (val) -> @coords.bottom = val
Object.defineProperty @, 'left',
get: -> @coords.left + @leftOffset
set: (val) -> @coords.left = val
# We take the tiny ove... | Object.defineProperty(this, 'bottom', {
get: function() {
return this.coords.bottom + this.topOffset;
},
set: function(val) {
return this.coords.bottom = val;
}
});
Object.defineProperty(this, 'left', {
get: function() {
return this.coords.left + this.leftOffset;
},
set: function(val) {
r... | CoffeeScript | JavaScript | meltingice/psd.js | lib/psd/node.coffee | MIT | 7e8392d20fd5d66ad70ddda7309661b9a0ca67c8 | 2,846 | https://github.com/meltingice/psd.js/blob/7e8392d20fd5d66ad70ddda7309661b9a0ca67c8/lib/psd/node.coffee | 62 | 111 |
meltingice/psd.js:lib/psd/node.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
Object.defineProperty(this, 'bottom', {
get: function() {
return this.coords.bottom + this.topOffset;
},
set: function(val) {
return this.coords.bottom = val;
}
});
Object.defineProperty(this, 'left', {
get: function() {
return this.coords.le... | Object.defineProperty @, 'bottom',
get: -> @coords.bottom + @topOffset
set: (val) -> @coords.bottom = val
Object.defineProperty @, 'left',
get: -> @coords.left + @leftOffset
set: (val) -> @coords.left = val
# We take the tiny overhead of recalculating this every time since the offset c... | JavaScript | CoffeeScript | meltingice/psd.js | lib/psd/node.coffee | MIT | 7e8392d20fd5d66ad70ddda7309661b9a0ca67c8 | 2,846 | https://github.com/meltingice/psd.js/blob/7e8392d20fd5d66ad70ddda7309661b9a0ca67c8/lib/psd/node.coffee | 62 | 111 |
meltingice/psd.js:lib/psd/node.coffee:2:completion | completion | Object.defineProperty @, 'bottom',
get: -> @coords.bottom + @topOffset
set: (val) -> @coords.bottom = val
Object.defineProperty @, 'left',
get: -> @coords.left + @leftOffset
set: (val) -> @coords.left = val
# We take the tiny overhead of recalculating this every time since the offset c... | #
# # vs
#
# node.layer.typeTool().export()
# ```
get: (prop) ->
value = if @[prop]? then @[prop] else @layer[prop]
if typeof value is 'function' then value() else value
# Is this layer/group visible? This checks all possible places that could define
# whether or not this is true, e.g. clipping m... | CoffeeScript | CoffeeScript | meltingice/psd.js | lib/psd/node.coffee | MIT | 7e8392d20fd5d66ad70ddda7309661b9a0ca67c8 | 2,846 | https://github.com/meltingice/psd.js/blob/7e8392d20fd5d66ad70ddda7309661b9a0ca67c8/lib/psd/node.coffee | 62 | 111 |
meltingice/psd.js:lib/psd/node.coffee:3:raw_corpus | raw_corpus | # the clipping node affects must be siblings and in sequence.
clippingMask: ->
return null unless @layer.clipped
@clippingMaskCached or= (
maskNode = @nextSibling()
maskNode = maskNode.nextSibling() while maskNode.clipped
maskNode
)
clippedBy: -> @clippingMask()
# We can export the... | CoffeeScript | meltingice/psd.js | lib/psd/node.coffee | MIT | 7e8392d20fd5d66ad70ddda7309661b9a0ca67c8 | 2,846 | https://github.com/meltingice/psd.js/blob/7e8392d20fd5d66ad70ddda7309661b9a0ca67c8/lib/psd/node.coffee | 112 | 150 | ||
meltingice/psd.js:lib/psd/node.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# the clipping node affects must be siblings and in sequence.
clippingMask: ->
return null unless @layer.clipped
@clippingMaskCached or= (
maskNode = @nextSibling()
maskNode = maskNode.nextSibling() while maskNode.clipped
maskNode
... | // the clipping node affects must be siblings and in sequence.
({
clippingMask: function() {
var maskNode;
if (!this.layer.clipped) {
return null;
}
return this.clippingMaskCached || (this.clippingMaskCached = ((function() {
maskNode = this.nextSibling();
while (maskNode.clipped) {
... | CoffeeScript | JavaScript | meltingice/psd.js | lib/psd/node.coffee | MIT | 7e8392d20fd5d66ad70ddda7309661b9a0ca67c8 | 2,846 | https://github.com/meltingice/psd.js/blob/7e8392d20fd5d66ad70ddda7309661b9a0ca67c8/lib/psd/node.coffee | 112 | 150 |
meltingice/psd.js:lib/psd/node.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// the clipping node affects must be siblings and in sequence.
({
clippingMask: function() {
var maskNode;
if (!this.layer.clipped) {
return null;
}
return this.clippingMaskCached || (this.clippingMaskCached = ((function() {
maskNode =... | # the clipping node affects must be siblings and in sequence.
clippingMask: ->
return null unless @layer.clipped
@clippingMaskCached or= (
maskNode = @nextSibling()
maskNode = maskNode.nextSibling() while maskNode.clipped
maskNode
)
clippedBy: -> @clippingMask()
# We can export the... | JavaScript | CoffeeScript | meltingice/psd.js | lib/psd/node.coffee | MIT | 7e8392d20fd5d66ad70ddda7309661b9a0ca67c8 | 2,846 | https://github.com/meltingice/psd.js/blob/7e8392d20fd5d66ad70ddda7309661b9a0ca67c8/lib/psd/node.coffee | 112 | 150 |
meltingice/psd.js:lib/psd/node.coffee:3:completion | completion | # the clipping node affects must be siblings and in sequence.
clippingMask: ->
return null unless @layer.clipped
@clippingMaskCached or= (
maskNode = @nextSibling()
maskNode = maskNode.nextSibling() while maskNode.clipped
maskNode
)
clippedBy: -> @clippingMask()
# We can export the... | hash[prop] = @[prop] for prop in Node.PROPERTIES
hash
# While the PSD document does not define explicit dimensions for groups, we can generate
# them based on the bounding boxes of their layer children. When we build the tree structure,
# we update the dimensions of the group whenever a layer is added so tha... | CoffeeScript | CoffeeScript | meltingice/psd.js | lib/psd/node.coffee | MIT | 7e8392d20fd5d66ad70ddda7309661b9a0ca67c8 | 2,846 | https://github.com/meltingice/psd.js/blob/7e8392d20fd5d66ad70ddda7309661b9a0ca67c8/lib/psd/node.coffee | 112 | 150 |
meltingice/psd.js:lib/psd/node.coffee:1:raw_corpus | raw_corpus | module.exports = class Node extends Module
@includes require('./nodes/ancestry.coffee')
@includes require('./nodes/search.coffee')
@includes require('./nodes/build_preview.coffee')
@PROPERTIES: ['name', 'left', 'right', 'top', 'bottom', 'height', 'width']
type: 'node'
constructor: (@layer, @parent = null... | CoffeeScript | meltingice/psd.js | lib/psd/node.coffee | MIT | 539ca415121c71d3ea757538073acbd2496118bf | 2,846 | https://github.com/meltingice/psd.js/blob/539ca415121c71d3ea757538073acbd2496118bf/lib/psd/node.coffee | 4 | 53 | ||
meltingice/psd.js:lib/psd/node.coffee:1:completion | completion | module.exports = class Node extends Module
@includes require('./nodes/ancestry.coffee')
@includes require('./nodes/search.coffee')
@includes require('./nodes/build_preview.coffee')
@PROPERTIES: ['name', 'left', 'right', 'top', 'bottom', 'height', 'width']
type: 'node'
constructor: (@layer, @parent = null... | @createProperties()
createProperties: ->
Object.defineProperty @, 'top',
get: -> @coords.top + @topOffset
set: (val) -> @coords.top = val
Object.defineProperty @, 'right',
get: -> @coords.right + @leftOffset
set: (val) -> @coords.right = val
Object.defineProperty @, 'bottom',
... | CoffeeScript | CoffeeScript | meltingice/psd.js | lib/psd/node.coffee | MIT | 539ca415121c71d3ea757538073acbd2496118bf | 2,846 | https://github.com/meltingice/psd.js/blob/539ca415121c71d3ea757538073acbd2496118bf/lib/psd/node.coffee | 4 | 53 |
meltingice/psd.js:lib/psd/node.coffee:2:raw_corpus | raw_corpus | if typeof value is 'function' then value() else value
visible: ->
return false if @layer.clipped and not @clippingMask().visible()
if @forceVisible? then @forceVisible else @layer.visible
hidden: -> not @visible()
isLayer: -> @type is 'layer'
isGroup: -> @type is 'group'
isRoot: -> @type is 'root'... | CoffeeScript | meltingice/psd.js | lib/psd/node.coffee | MIT | 539ca415121c71d3ea757538073acbd2496118bf | 2,846 | https://github.com/meltingice/psd.js/blob/539ca415121c71d3ea757538073acbd2496118bf/lib/psd/node.coffee | 54 | 97 | ||
meltingice/psd.js:lib/psd/node.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
if typeof value is 'function' then value() else value
visible: ->
return false if @layer.clipped and not @clippingMask().visible()
if @forceVisible? then @forceVisible else @layer.visible
hidden: -> not @visible()
isLayer: -> @type is 'layer'
i... | if (typeof value === 'function') {
value();
} else {
value({
visible: function() {
if (this.layer.clipped && !this.clippingMask().visible()) {
return false;
}
if (this.forceVisible != null) {
return this.forceVisible;
} else {
return this.layer.visible;
}
... | CoffeeScript | JavaScript | meltingice/psd.js | lib/psd/node.coffee | MIT | 539ca415121c71d3ea757538073acbd2496118bf | 2,846 | https://github.com/meltingice/psd.js/blob/539ca415121c71d3ea757538073acbd2496118bf/lib/psd/node.coffee | 54 | 97 |
meltingice/psd.js:lib/psd/node.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
if (typeof value === 'function') {
value();
} else {
value({
visible: function() {
if (this.layer.clipped && !this.clippingMask().visible()) {
return false;
}
if (this.forceVisible != null) {
return this.forceVisible;
... | if typeof value is 'function' then value() else value
visible: ->
return false if @layer.clipped and not @clippingMask().visible()
if @forceVisible? then @forceVisible else @layer.visible
hidden: -> not @visible()
isLayer: -> @type is 'layer'
isGroup: -> @type is 'group'
isRoot: -> @type is 'root'... | JavaScript | CoffeeScript | meltingice/psd.js | lib/psd/node.coffee | MIT | 539ca415121c71d3ea757538073acbd2496118bf | 2,846 | https://github.com/meltingice/psd.js/blob/539ca415121c71d3ea757538073acbd2496118bf/lib/psd/node.coffee | 54 | 97 |
meltingice/psd.js:lib/psd/node.coffee:2:completion | completion | if typeof value is 'function' then value() else value
visible: ->
return false if @layer.clipped and not @clippingMask().visible()
if @forceVisible? then @forceVisible else @layer.visible
hidden: -> not @visible()
isLayer: -> @type is 'layer'
isGroup: -> @type is 'group'
isRoot: -> @type is 'root'... | export: ->
hash =
type: null
visible: @visible()
opacity: @layer.opacity / 255.0
blendingMode: @layer.blendingMode()
hash[prop] = @[prop] for prop in Node.PROPERTIES
hash
updateDimensions: ->
return if @isLayer()
child.updateDimensions() for child in @_children
retu... | CoffeeScript | CoffeeScript | meltingice/psd.js | lib/psd/node.coffee | MIT | 539ca415121c71d3ea757538073acbd2496118bf | 2,846 | https://github.com/meltingice/psd.js/blob/539ca415121c71d3ea757538073acbd2496118bf/lib/psd/node.coffee | 54 | 97 |
meltingice/psd.js:lib/psd/node.coffee:1:raw_corpus | raw_corpus | module.exports = class Node extends Module
@includes require('./nodes/ancestry.coffee')
@includes require('./nodes/search.coffee')
# @includes require('./nodes/build_preview.coffee')
@PROPERTIES: ['name', 'left', 'right', 'top', 'bottom', 'height', 'width']
type: 'node'
constructor: (@layer, @parent = nu... | CoffeeScript | meltingice/psd.js | lib/psd/node.coffee | MIT | f92d255ce85a63a336aedf83424ffa13f756cbec | 2,846 | https://github.com/meltingice/psd.js/blob/f92d255ce85a63a336aedf83424ffa13f756cbec/lib/psd/node.coffee | 4 | 53 | ||
meltingice/psd.js:lib/psd/node.coffee:1:completion | completion | module.exports = class Node extends Module
@includes require('./nodes/ancestry.coffee')
@includes require('./nodes/search.coffee')
# @includes require('./nodes/build_preview.coffee')
@PROPERTIES: ['name', 'left', 'right', 'top', 'bottom', 'height', 'width']
type: 'node'
constructor: (@layer, @parent = nu... | @createProperties()
createProperties: ->
Object.defineProperty @, 'top',
get: -> @coords.top + @topOffset
set: (val) -> @coords.top = val
Object.defineProperty @, 'right',
get: -> @coords.right + @leftOffset
set: (val) -> @coords.right = val
Object.defineProperty @, 'bottom',
... | CoffeeScript | CoffeeScript | meltingice/psd.js | lib/psd/node.coffee | MIT | f92d255ce85a63a336aedf83424ffa13f756cbec | 2,846 | https://github.com/meltingice/psd.js/blob/f92d255ce85a63a336aedf83424ffa13f756cbec/lib/psd/node.coffee | 4 | 53 |
meltingice/psd.js:lib/psd/node.coffee:1:raw_corpus | raw_corpus | module.exports = class Node extends Module
@includes require('./nodes/ancestry.coffee')
@includes require('./nodes/search.coffee')
@PROPERTIES: ['name', 'left', 'right', 'top', 'bottom', 'height', 'width']
type: 'node'
constructor: (@layer, @parent = null) ->
@layer.node = @
@_children = []
@n... | CoffeeScript | meltingice/psd.js | lib/psd/node.coffee | MIT | 71635fa6b662893485b0beaf7e099846ad8270dd | 2,846 | https://github.com/meltingice/psd.js/blob/71635fa6b662893485b0beaf7e099846ad8270dd/lib/psd/node.coffee | 4 | 53 | ||
meltingice/psd.js:lib/psd/node.coffee:1:completion | completion | module.exports = class Node extends Module
@includes require('./nodes/ancestry.coffee')
@includes require('./nodes/search.coffee')
@PROPERTIES: ['name', 'left', 'right', 'top', 'bottom', 'height', 'width']
type: 'node'
constructor: (@layer, @parent = null) ->
@layer.node = @
@_children = []
@n... | @createProperties()
createProperties: ->
Object.defineProperty @, 'top',
get: -> @coords.top + @topOffset
set: (val) -> @coords.top = val
Object.defineProperty @, 'right',
get: -> @coords.right + @leftOffset
set: (val) -> @coords.right = val
Object.defineProperty @, 'bottom',
... | CoffeeScript | CoffeeScript | meltingice/psd.js | lib/psd/node.coffee | MIT | 71635fa6b662893485b0beaf7e099846ad8270dd | 2,846 | https://github.com/meltingice/psd.js/blob/71635fa6b662893485b0beaf7e099846ad8270dd/lib/psd/node.coffee | 4 | 53 |
meltingice/psd.js:lib/psd/node.coffee:2:raw_corpus | raw_corpus | visible: ->
return false if @layer.clipped and not @clippingMask().visible()
if @forceVisible? then @forceVisible else @layer.visible
hidden: -> not @visible()
isLayer: -> @type is 'layer'
isGroup: -> @type is 'group'
isRoot: -> @type is 'root'
clippingMask: ->
return null unless @layer.clippe... | CoffeeScript | meltingice/psd.js | lib/psd/node.coffee | MIT | 71635fa6b662893485b0beaf7e099846ad8270dd | 2,846 | https://github.com/meltingice/psd.js/blob/71635fa6b662893485b0beaf7e099846ad8270dd/lib/psd/node.coffee | 54 | 96 | ||
meltingice/psd.js:lib/psd/node.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
visible: ->
return false if @layer.clipped and not @clippingMask().visible()
if @forceVisible? then @forceVisible else @layer.visible
hidden: -> not @visible()
isLayer: -> @type is 'layer'
isGroup: -> @type is 'group'
isRoot: -> @type is 'root'... | ({
visible: function() {
if (this.layer.clipped && !this.clippingMask().visible()) {
return false;
}
if (this.forceVisible != null) {
return this.forceVisible;
} else {
return this.layer.visible;
}
},
hidden: function() {
return !this.visible();
},
isLayer: function()... | CoffeeScript | JavaScript | meltingice/psd.js | lib/psd/node.coffee | MIT | 71635fa6b662893485b0beaf7e099846ad8270dd | 2,846 | https://github.com/meltingice/psd.js/blob/71635fa6b662893485b0beaf7e099846ad8270dd/lib/psd/node.coffee | 54 | 96 |
meltingice/psd.js:lib/psd/node.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
visible: function() {
if (this.layer.clipped && !this.clippingMask().visible()) {
return false;
}
if (this.forceVisible != null) {
return this.forceVisible;
} else {
return this.layer.visible;
}
},
hidden: function() {... | visible: ->
return false if @layer.clipped and not @clippingMask().visible()
if @forceVisible? then @forceVisible else @layer.visible
hidden: -> not @visible()
isLayer: -> @type is 'layer'
isGroup: -> @type is 'group'
isRoot: -> @type is 'root'
clippingMask: ->
return null unless @layer.clippe... | JavaScript | CoffeeScript | meltingice/psd.js | lib/psd/node.coffee | MIT | 71635fa6b662893485b0beaf7e099846ad8270dd | 2,846 | https://github.com/meltingice/psd.js/blob/71635fa6b662893485b0beaf7e099846ad8270dd/lib/psd/node.coffee | 54 | 96 |
meltingice/psd.js:lib/psd/node.coffee:2:completion | completion | visible: ->
return false if @layer.clipped and not @clippingMask().visible()
if @forceVisible? then @forceVisible else @layer.visible
hidden: -> not @visible()
isLayer: -> @type is 'layer'
isGroup: -> @type is 'group'
isRoot: -> @type is 'root'
clippingMask: ->
return null unless @layer.clippe... | hash =
type: null
visible: @visible()
opacity: @layer.opacity / 255.0
blendingMode: @layer.blendingMode()
hash[prop] = @[prop] for prop in Node.PROPERTIES
hash
updateDimensions: ->
return if @isLayer()
child.updateDimensions() for child in @_children
return if @isRoot()... | CoffeeScript | CoffeeScript | meltingice/psd.js | lib/psd/node.coffee | MIT | 71635fa6b662893485b0beaf7e099846ad8270dd | 2,846 | https://github.com/meltingice/psd.js/blob/71635fa6b662893485b0beaf7e099846ad8270dd/lib/psd/node.coffee | 54 | 96 |
meltingice/psd.js:lib/psd/node.coffee:1:raw_corpus | raw_corpus | module.exports = class Node extends Module
@includes require('./nodes/ancestry.coffee')
@includes require('./nodes/search.coffee')
@PROPERTIES: ['name', 'left', 'right', 'top', 'bottom', 'height', 'width']
type: 'node'
constructor: (@layer, @parent = null) ->
@layer.node = @
@_children = []
@n... | CoffeeScript | meltingice/psd.js | lib/psd/node.coffee | MIT | c567b01dfa2ba33279befba1799825a77d500680 | 2,846 | https://github.com/meltingice/psd.js/blob/c567b01dfa2ba33279befba1799825a77d500680/lib/psd/node.coffee | 4 | 53 | ||
meltingice/psd.js:lib/psd/node.coffee:1:completion | completion | module.exports = class Node extends Module
@includes require('./nodes/ancestry.coffee')
@includes require('./nodes/search.coffee')
@PROPERTIES: ['name', 'left', 'right', 'top', 'bottom', 'height', 'width']
type: 'node'
constructor: (@layer, @parent = null) ->
@layer.node = @
@_children = []
@n... | @createProperties()
createProperties: ->
Object.defineProperty @, 'top',
get: -> @coords.top + @topOffset
set: (val) -> @coords.top = val
Object.defineProperty @, 'right',
get: -> @coords.right + @leftOffset
set: (val) -> @coords.right = val
Object.defineProperty @, 'bottom',
... | CoffeeScript | CoffeeScript | meltingice/psd.js | lib/psd/node.coffee | MIT | c567b01dfa2ba33279befba1799825a77d500680 | 2,846 | https://github.com/meltingice/psd.js/blob/c567b01dfa2ba33279befba1799825a77d500680/lib/psd/node.coffee | 4 | 53 |
meltingice/psd.js:lib/psd/node.coffee:2:raw_corpus | raw_corpus | return false if @layer.clipped and not @clippingMask().visible()
if @forceVisible? then @forceVisible else @layer.visible
hidden: -> not @visible()
isLayer: -> @type is 'layer'
isGroup: -> @type is 'group'
isRoot: -> @type is 'root'
clippingMask: ->
return null unless @layer.clipped
@clippingM... | CoffeeScript | meltingice/psd.js | lib/psd/node.coffee | MIT | c567b01dfa2ba33279befba1799825a77d500680 | 2,846 | https://github.com/meltingice/psd.js/blob/c567b01dfa2ba33279befba1799825a77d500680/lib/psd/node.coffee | 54 | 94 | ||
meltingice/psd.js:lib/psd/node.coffee:2:completion | completion | return false if @layer.clipped and not @clippingMask().visible()
if @forceVisible? then @forceVisible else @layer.visible
hidden: -> not @visible()
isLayer: -> @type is 'layer'
isGroup: -> @type is 'group'
isRoot: -> @type is 'root'
clippingMask: ->
return null unless @layer.clipped
@clippingM... | hash =
type: null
visible: @visible()
opacity: @layer.opacity / 255.0
blendingMode: @layer.blendingMode()
hash[prop] = @[prop] for prop in Node.PROPERTIES
hash
updateDimensions: ->
return if @isLayer()
child.updateDimensions() for child in @_children
return if @isRoot()... | CoffeeScript | CoffeeScript | meltingice/psd.js | lib/psd/node.coffee | MIT | c567b01dfa2ba33279befba1799825a77d500680 | 2,846 | https://github.com/meltingice/psd.js/blob/c567b01dfa2ba33279befba1799825a77d500680/lib/psd/node.coffee | 54 | 94 |
meltingice/psd.js:lib/psd/node.coffee:1:raw_corpus | raw_corpus | module.exports = class Node extends Module
@includes require('./nodes/ancestry.coffee')
@PROPERTIES: ['name', 'left', 'right', 'top', 'bottom', 'height', 'width']
type: 'node'
constructor: (@layer, @parent = null) ->
@layer.node = @
@_children = []
@name = @layer.name
@forceVisible = null
... | CoffeeScript | meltingice/psd.js | lib/psd/node.coffee | MIT | ad21712fd68b99cacb607911177f73b729d5504e | 2,846 | https://github.com/meltingice/psd.js/blob/ad21712fd68b99cacb607911177f73b729d5504e/lib/psd/node.coffee | 4 | 53 | ||
meltingice/psd.js:lib/psd/node.coffee:1:completion | completion | module.exports = class Node extends Module
@includes require('./nodes/ancestry.coffee')
@PROPERTIES: ['name', 'left', 'right', 'top', 'bottom', 'height', 'width']
type: 'node'
constructor: (@layer, @parent = null) ->
@layer.node = @
@_children = []
@name = @layer.name
@forceVisible = null
... | createProperties: ->
Object.defineProperty @, 'top',
get: -> @coords.top + @topOffset
set: (val) -> @coords.top = val
Object.defineProperty @, 'right',
get: -> @coords.right + @leftOffset
set: (val) -> @coords.right = val
Object.defineProperty @, 'bottom',
get: -> @coords.bot... | CoffeeScript | CoffeeScript | meltingice/psd.js | lib/psd/node.coffee | MIT | ad21712fd68b99cacb607911177f73b729d5504e | 2,846 | https://github.com/meltingice/psd.js/blob/ad21712fd68b99cacb607911177f73b729d5504e/lib/psd/node.coffee | 4 | 53 |
meltingice/psd.js:lib/psd/node.coffee:2:raw_corpus | raw_corpus | if @forceVisible? then @forceVisible else @layer.visible
hidden: -> not @visible()
isLayer: -> @type is 'layer'
isGroup: -> @type is 'group'
isRoot: -> @type is 'root'
clippingMask: ->
return null unless @layer.clipped
@clippingMaskCached or= (
maskNode = @nextSibling()
maskNode = mask... | CoffeeScript | meltingice/psd.js | lib/psd/node.coffee | MIT | ad21712fd68b99cacb607911177f73b729d5504e | 2,846 | https://github.com/meltingice/psd.js/blob/ad21712fd68b99cacb607911177f73b729d5504e/lib/psd/node.coffee | 54 | 93 | ||
meltingice/psd.js:lib/psd/node.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
if @forceVisible? then @forceVisible else @layer.visible
hidden: -> not @visible()
isLayer: -> @type is 'layer'
isGroup: -> @type is 'group'
isRoot: -> @type is 'root'
clippingMask: ->
return null unless @layer.clipped
@clippingMaskCached or... | if (this.forceVisible != null) {
this.forceVisible;
} else {
this.layer.visible({
hidden: function() {
return !this.visible();
},
isLayer: function() {
return this.type === 'layer';
},
isGroup: function() {
return this.type === 'group';
},
isRoot: function() {
ret... | CoffeeScript | JavaScript | meltingice/psd.js | lib/psd/node.coffee | MIT | ad21712fd68b99cacb607911177f73b729d5504e | 2,846 | https://github.com/meltingice/psd.js/blob/ad21712fd68b99cacb607911177f73b729d5504e/lib/psd/node.coffee | 54 | 93 |
meltingice/psd.js:lib/psd/node.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
if (this.forceVisible != null) {
this.forceVisible;
} else {
this.layer.visible({
hidden: function() {
return !this.visible();
},
isLayer: function() {
return this.type === 'layer';
},
isGroup: function() {
return this.type... | if @forceVisible? then @forceVisible else @layer.visible
hidden: -> not @visible()
isLayer: -> @type is 'layer'
isGroup: -> @type is 'group'
isRoot: -> @type is 'root'
clippingMask: ->
return null unless @layer.clipped
@clippingMaskCached or= (
maskNode = @nextSibling()
maskNode = mask... | JavaScript | CoffeeScript | meltingice/psd.js | lib/psd/node.coffee | MIT | ad21712fd68b99cacb607911177f73b729d5504e | 2,846 | https://github.com/meltingice/psd.js/blob/ad21712fd68b99cacb607911177f73b729d5504e/lib/psd/node.coffee | 54 | 93 |
meltingice/psd.js:lib/psd/node.coffee:2:completion | completion | if @forceVisible? then @forceVisible else @layer.visible
hidden: -> not @visible()
isLayer: -> @type is 'layer'
isGroup: -> @type is 'group'
isRoot: -> @type is 'root'
clippingMask: ->
return null unless @layer.clipped
@clippingMaskCached or= (
maskNode = @nextSibling()
maskNode = mask... | type: null
visible: @visible()
opacity: @layer.opacity / 255.0
blendingMode: @layer.blendingMode()
hash[prop] = @[prop] for prop in Node.PROPERTIES
hash
updateDimensions: ->
return if @isLayer()
child.updateDimensions() for child in @_children
return if @isRoot()
nonEmpt... | CoffeeScript | CoffeeScript | meltingice/psd.js | lib/psd/node.coffee | MIT | ad21712fd68b99cacb607911177f73b729d5504e | 2,846 | https://github.com/meltingice/psd.js/blob/ad21712fd68b99cacb607911177f73b729d5504e/lib/psd/node.coffee | 54 | 93 |
meltingice/psd.js:lib/psd/node.coffee:1:raw_corpus | raw_corpus | module.exports = class Node extends Module
@includes require('./nodes/ancestry.coffee')
@PROPERTIES: ['name', 'left', 'right', 'top', 'bottom', 'height', 'width']
type: 'node'
constructor: (@layer, @parent = null) ->
@layer.node = @
@children = []
@name = @layer.name
@forceVisible = null
... | CoffeeScript | meltingice/psd.js | lib/psd/node.coffee | MIT | 6a23a9a7ecc7afe49c4cea4e96bf92d60a925955 | 2,846 | https://github.com/meltingice/psd.js/blob/6a23a9a7ecc7afe49c4cea4e96bf92d60a925955/lib/psd/node.coffee | 4 | 53 | ||
meltingice/psd.js:lib/psd/node.coffee:1:completion | completion | module.exports = class Node extends Module
@includes require('./nodes/ancestry.coffee')
@PROPERTIES: ['name', 'left', 'right', 'top', 'bottom', 'height', 'width']
type: 'node'
constructor: (@layer, @parent = null) ->
@layer.node = @
@children = []
@name = @layer.name
@forceVisible = null
... | createProperties: ->
Object.defineProperty @, 'top',
get: -> @coords.top + @topOffset
set: (val) -> @coords.top = val
Object.defineProperty @, 'right',
get: -> @coords.right + @leftOffset
set: (val) -> @coords.right = val
Object.defineProperty @, 'bottom',
get: -> @coords.bot... | CoffeeScript | CoffeeScript | meltingice/psd.js | lib/psd/node.coffee | MIT | 6a23a9a7ecc7afe49c4cea4e96bf92d60a925955 | 2,846 | https://github.com/meltingice/psd.js/blob/6a23a9a7ecc7afe49c4cea4e96bf92d60a925955/lib/psd/node.coffee | 4 | 53 |
meltingice/psd.js:lib/psd/node.coffee:2:raw_corpus | raw_corpus | if @forceVisible? then @forceVisible else @layer.visible
hidden: -> not @visible()
isLayer: -> @type is 'layer'
isGroup: -> @type is 'group'
isRoot: -> @type is 'root'
clippingMask: ->
return null unless @layer.clipped
@clippingMaskCached or= (
maskNode = @nextSibling()
maskNode = mask... | CoffeeScript | meltingice/psd.js | lib/psd/node.coffee | MIT | 6a23a9a7ecc7afe49c4cea4e96bf92d60a925955 | 2,846 | https://github.com/meltingice/psd.js/blob/6a23a9a7ecc7afe49c4cea4e96bf92d60a925955/lib/psd/node.coffee | 54 | 93 | ||
meltingice/psd.js:lib/psd/node.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
if @forceVisible? then @forceVisible else @layer.visible
hidden: -> not @visible()
isLayer: -> @type is 'layer'
isGroup: -> @type is 'group'
isRoot: -> @type is 'root'
clippingMask: ->
return null unless @layer.clipped
@clippingMaskCached or... | if (this.forceVisible != null) {
this.forceVisible;
} else {
this.layer.visible({
hidden: function() {
return !this.visible();
},
isLayer: function() {
return this.type === 'layer';
},
isGroup: function() {
return this.type === 'group';
},
isRoot: function() {
ret... | CoffeeScript | JavaScript | meltingice/psd.js | lib/psd/node.coffee | MIT | 6a23a9a7ecc7afe49c4cea4e96bf92d60a925955 | 2,846 | https://github.com/meltingice/psd.js/blob/6a23a9a7ecc7afe49c4cea4e96bf92d60a925955/lib/psd/node.coffee | 54 | 93 |
meltingice/psd.js:lib/psd/node.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
if (this.forceVisible != null) {
this.forceVisible;
} else {
this.layer.visible({
hidden: function() {
return !this.visible();
},
isLayer: function() {
return this.type === 'layer';
},
isGroup: function() {
return this.type... | if @forceVisible? then @forceVisible else @layer.visible
hidden: -> not @visible()
isLayer: -> @type is 'layer'
isGroup: -> @type is 'group'
isRoot: -> @type is 'root'
clippingMask: ->
return null unless @layer.clipped
@clippingMaskCached or= (
maskNode = @nextSibling()
maskNode = mask... | JavaScript | CoffeeScript | meltingice/psd.js | lib/psd/node.coffee | MIT | 6a23a9a7ecc7afe49c4cea4e96bf92d60a925955 | 2,846 | https://github.com/meltingice/psd.js/blob/6a23a9a7ecc7afe49c4cea4e96bf92d60a925955/lib/psd/node.coffee | 54 | 93 |
meltingice/psd.js:lib/psd/node.coffee:2:completion | completion | if @forceVisible? then @forceVisible else @layer.visible
hidden: -> not @visible()
isLayer: -> @type is 'layer'
isGroup: -> @type is 'group'
isRoot: -> @type is 'root'
clippingMask: ->
return null unless @layer.clipped
@clippingMaskCached or= (
maskNode = @nextSibling()
maskNode = mask... | type: null
visible: @visible()
opacity: @layer.opacity / 255.0
blendingMode: @layer.blendingMode()
hash[prop] = @[prop] for prop in Node.PROPERTIES
hash
updateDimensions: ->
return if @isLayer()
child.updateDimensions() for child in @children
return if @isRoot()
nonEmpty... | CoffeeScript | CoffeeScript | meltingice/psd.js | lib/psd/node.coffee | MIT | 6a23a9a7ecc7afe49c4cea4e96bf92d60a925955 | 2,846 | https://github.com/meltingice/psd.js/blob/6a23a9a7ecc7afe49c4cea4e96bf92d60a925955/lib/psd/node.coffee | 54 | 93 |
meltingice/psd.js:lib/psd/node.coffee:1:raw_corpus | raw_corpus | module.exports = class Node extends Module
@includes require('./nodes/ancestry.coffee')
@PROPERTIES: ['name', 'left', 'right', 'top', 'bottom', 'height', 'width']
type: 'node'
constructor: (@layer, @parent = null) ->
@layer.node = @
@children = []
@name = @layer.name
@forceVisible = null
... | CoffeeScript | meltingice/psd.js | lib/psd/node.coffee | MIT | 8109e14661ced33512578a53147cb444b22a606e | 2,846 | https://github.com/meltingice/psd.js/blob/8109e14661ced33512578a53147cb444b22a606e/lib/psd/node.coffee | 4 | 53 | ||
meltingice/psd.js:lib/psd/node.coffee:1:completion | completion | module.exports = class Node extends Module
@includes require('./nodes/ancestry.coffee')
@PROPERTIES: ['name', 'left', 'right', 'top', 'bottom', 'height', 'width']
type: 'node'
constructor: (@layer, @parent = null) ->
@layer.node = @
@children = []
@name = @layer.name
@forceVisible = null
... | createProperties: ->
Object.defineProperty @, 'top', get: -> @coords.top + @topOffset
Object.defineProperty @, 'right', get: -> @coords.right + @leftOffset
Object.defineProperty @, 'bottom', get: -> @coords.bottom + @topOffset
Object.defineProperty @, 'left', get: -> @coords.left + @leftOffset... | CoffeeScript | CoffeeScript | meltingice/psd.js | lib/psd/node.coffee | MIT | 8109e14661ced33512578a53147cb444b22a606e | 2,846 | https://github.com/meltingice/psd.js/blob/8109e14661ced33512578a53147cb444b22a606e/lib/psd/node.coffee | 4 | 53 |
meltingice/psd.js:lib/psd/node.coffee:2:raw_corpus | raw_corpus | maskNode = maskNode.nextSibling() while maskNode.clipped
maskNode
)
clippedBy: -> @clippingMask()
export: ->
hash =
type: null
visible: @visible()
opacity: @layer.opacity / 255.0
blendingMode: @layer.blendingMode()
hash[prop] = @[prop] for prop in Node.PROPERTIES
has... | CoffeeScript | meltingice/psd.js | lib/psd/node.coffee | MIT | 8109e14661ced33512578a53147cb444b22a606e | 2,846 | https://github.com/meltingice/psd.js/blob/8109e14661ced33512578a53147cb444b22a606e/lib/psd/node.coffee | 54 | 81 | ||
meltingice/psd.js:lib/psd/node.coffee:2:completion | completion | maskNode = maskNode.nextSibling() while maskNode.clipped
maskNode
)
clippedBy: -> @clippingMask()
export: ->
hash =
type: null
visible: @visible()
opacity: @layer.opacity / 255.0
blendingMode: @layer.blendingMode()
hash[prop] = @[prop] for prop in Node.PROPERTIES | hash
updateDimensions: ->
return if @isLayer()
child.updateDimensions() for child in @children
return if @isRoot()
nonEmptyChildren = @children.filter((c) -> not c.isEmpty())
@coords.left = _.min(nonEmptyChildren.map((c) -> c.left)) or 0
@coords.top = _.min(nonEmptyChildren.map((c) -> c.to... | CoffeeScript | CoffeeScript | meltingice/psd.js | lib/psd/node.coffee | MIT | 8109e14661ced33512578a53147cb444b22a606e | 2,846 | https://github.com/meltingice/psd.js/blob/8109e14661ced33512578a53147cb444b22a606e/lib/psd/node.coffee | 54 | 81 |
meltingice/psd.js:lib/psd/node.coffee:2:raw_corpus | raw_corpus | maskNode = maskNode.nextSibling() while maskNode.clipped
maskNode
)
clippedBy: -> @clippingMask()
export: ->
hash =
type: null
visible: @visible()
opacity: @layer.opacity / 255.0
blendingMode: @layer.blendingMode()
hash[prop] = @[prop] for prop in Node.PROPERTIES
has... | CoffeeScript | meltingice/psd.js | lib/psd/node.coffee | MIT | aabb6de133eab9ae0a16981d0706fb83ce69fdba | 2,846 | https://github.com/meltingice/psd.js/blob/aabb6de133eab9ae0a16981d0706fb83ce69fdba/lib/psd/node.coffee | 54 | 81 | ||
meltingice/psd.js:lib/psd/node.coffee:2:completion | completion | maskNode = maskNode.nextSibling() while maskNode.clipped
maskNode
)
clippedBy: -> @clippingMask()
export: ->
hash =
type: null
visible: @visible()
opacity: @layer.opacity / 255.0
blendingMode: @layer.blendingMode()
hash[prop] = @[prop] for prop in Node.PROPERTIES | hash
updateDimensions: ->
return if @isLayer()
child.updateDimensions() for child in @children
return if @isRoot()
nonEmptyChildren = @children.filter((c) -> not c.isEmpty())
@left = _.min(nonEmptyChildren.map((c) -> c.left)) or 0
@top = _.min(nonEmptyChildren.map((c) -> c.top)) or 0
@... | CoffeeScript | CoffeeScript | meltingice/psd.js | lib/psd/node.coffee | MIT | aabb6de133eab9ae0a16981d0706fb83ce69fdba | 2,846 | https://github.com/meltingice/psd.js/blob/aabb6de133eab9ae0a16981d0706fb83ce69fdba/lib/psd/node.coffee | 54 | 81 |
JoelBesada/activate-power-mode:lib/power-canvas.coffee:1:raw_corpus | raw_corpus | module.exports =
colorHelper: colorHelper
subscriptions: null
enable: ->
@initConfigSubscribers()
disable: ->
@destroy()
onChangePane: (editor, editorElement) ->
@resetCanvas()
@setupCanvas editor, editorElement if editor
onNewCursor: (cursor) ->
cursor.spawnParticles = throttle @spa... | CoffeeScript | JoelBesada/activate-power-mode | lib/power-canvas.coffee | MIT | 5d1989713f4204e3d12cbcc14325622e74b29dc9 | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/5d1989713f4204e3d12cbcc14325622e74b29dc9/lib/power-canvas.coffee | 6 | 55 | ||
JoelBesada/activate-power-mode:lib/power-canvas.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports =
colorHelper: colorHelper
subscriptions: null
enable: ->
@initConfigSubscribers()
disable: ->
@destroy()
onChangePane: (editor, editorElement) ->
@resetCanvas()
@setupCanvas editor, editorElement if editor
onNewCurs... | module.exports = {
colorHelper: colorHelper,
subscriptions: null,
enable: function() {
return this.initConfigSubscribers();
},
disable: function() {
return this.destroy();
},
onChangePane: function(editor, editorElement) {
this.resetCanvas();
if (editor) {
return this.setupCanvas(edi... | CoffeeScript | JavaScript | JoelBesada/activate-power-mode | lib/power-canvas.coffee | MIT | 5d1989713f4204e3d12cbcc14325622e74b29dc9 | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/5d1989713f4204e3d12cbcc14325622e74b29dc9/lib/power-canvas.coffee | 6 | 55 |
JoelBesada/activate-power-mode:lib/power-canvas.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
module.exports = {
colorHelper: colorHelper,
subscriptions: null,
enable: function() {
return this.initConfigSubscribers();
},
disable: function() {
return this.destroy();
},
onChangePane: function(editor, editorElement) {
this.resetCanvas... | module.exports =
colorHelper: colorHelper
subscriptions: null
enable: ->
@initConfigSubscribers()
disable: ->
@destroy()
onChangePane: (editor, editorElement) ->
@resetCanvas()
@setupCanvas editor, editorElement if editor
onNewCursor: (cursor) ->
cursor.spawnParticles = throttle @spa... | JavaScript | CoffeeScript | JoelBesada/activate-power-mode | lib/power-canvas.coffee | MIT | 5d1989713f4204e3d12cbcc14325622e74b29dc9 | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/5d1989713f4204e3d12cbcc14325622e74b29dc9/lib/power-canvas.coffee | 6 | 55 |
JoelBesada/activate-power-mode:lib/power-canvas.coffee:1:completion | completion | module.exports =
colorHelper: colorHelper
subscriptions: null
enable: ->
@initConfigSubscribers()
disable: ->
@destroy()
onChangePane: (editor, editorElement) ->
@resetCanvas()
@setupCanvas editor, editorElement if editor
onNewCursor: (cursor) ->
cursor.spawnParticles = throttle @spa... | @animationOff()
@editor = null
@editorElement = null
animationOff: ->
cancelAnimationFrame(@animationFrame)
@animationFrame = null
animationOn: ->
@animationFrame = requestAnimationFrame @drawParticles.bind(this)
resetParticles: ->
@particles = []
destroy: ->
@resetCanvas()
@... | CoffeeScript | CoffeeScript | JoelBesada/activate-power-mode | lib/power-canvas.coffee | MIT | 5d1989713f4204e3d12cbcc14325622e74b29dc9 | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/5d1989713f4204e3d12cbcc14325622e74b29dc9/lib/power-canvas.coffee | 6 | 55 |
JoelBesada/activate-power-mode:lib/power-canvas.coffee:2:raw_corpus | raw_corpus | @canvas.classList.add "power-mode-canvas"
@initConfigSubscribers()
editorElement.appendChild @canvas
@canvas.style.display = "block"
@canvas.width = editorElement.offsetWidth
@canvas.height = editorElement.offsetHeight
@scrollView = editorElement.querySelector(".scroll-view")
@editorEleme... | CoffeeScript | JoelBesada/activate-power-mode | lib/power-canvas.coffee | MIT | 5d1989713f4204e3d12cbcc14325622e74b29dc9 | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/5d1989713f4204e3d12cbcc14325622e74b29dc9/lib/power-canvas.coffee | 56 | 105 | ||
JoelBesada/activate-power-mode:lib/power-canvas.coffee:2:completion | completion | @canvas.classList.add "power-mode-canvas"
@initConfigSubscribers()
editorElement.appendChild @canvas
@canvas.style.display = "block"
@canvas.width = editorElement.offsetWidth
@canvas.height = editorElement.offsetHeight
@scrollView = editorElement.querySelector(".scroll-view")
@editorEleme... | spawnParticles: (screenPosition) ->
{left, top} = @calculatePositions screenPosition
numParticles = random @confMinCount, @confMaxCount
color = @colorHelper.getColor @editor, @editorElement, screenPosition
while numParticles--
nextColor = if typeof color is "object" then color.next().value else... | CoffeeScript | CoffeeScript | JoelBesada/activate-power-mode | lib/power-canvas.coffee | MIT | 5d1989713f4204e3d12cbcc14325622e74b29dc9 | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/5d1989713f4204e3d12cbcc14325622e74b29dc9/lib/power-canvas.coffee | 56 | 105 |
JoelBesada/activate-power-mode:lib/power-canvas.coffee:3:raw_corpus | raw_corpus | velocity:
x: -1 + Math.random() * 2
y: -3.5 + Math.random() * 2
drawParticles: ->
@animationOn()
@canvas.width = @canvas.width
return if not @particles.length
gco = @context.globalCompositeOperation
@context.globalCompositeOperation = "lighter"
for i in [@particles.length - 1 ..... | CoffeeScript | JoelBesada/activate-power-mode | lib/power-canvas.coffee | MIT | 5d1989713f4204e3d12cbcc14325622e74b29dc9 | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/5d1989713f4204e3d12cbcc14325622e74b29dc9/lib/power-canvas.coffee | 106 | 139 | ||
JoelBesada/activate-power-mode:lib/power-canvas.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
velocity:
x: -1 + Math.random() * 2
y: -3.5 + Math.random() * 2
drawParticles: ->
@animationOn()
@canvas.width = @canvas.width
return if not @particles.length
gco = @context.globalCompositeOperation
@context.globalCompositeOper... | ({
velocity: {
x: -1 + Math.random() * 2,
y: -3.5 + Math.random() * 2
},
drawParticles: function() {
var gco, i, j, particle, ref;
this.animationOn();
this.canvas.width = this.canvas.width;
if (!this.particles.length) {
return;
}
gco = this.context.globalCompositeOperation;
... | CoffeeScript | JavaScript | JoelBesada/activate-power-mode | lib/power-canvas.coffee | MIT | 5d1989713f4204e3d12cbcc14325622e74b29dc9 | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/5d1989713f4204e3d12cbcc14325622e74b29dc9/lib/power-canvas.coffee | 106 | 139 |
JoelBesada/activate-power-mode:lib/power-canvas.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
velocity: {
x: -1 + Math.random() * 2,
y: -3.5 + Math.random() * 2
},
drawParticles: function() {
var gco, i, j, particle, ref;
this.animationOn();
this.canvas.width = this.canvas.width;
if (!this.particles.length) {
return;
... | velocity:
x: -1 + Math.random() * 2
y: -3.5 + Math.random() * 2
drawParticles: ->
@animationOn()
@canvas.width = @canvas.width
return if not @particles.length
gco = @context.globalCompositeOperation
@context.globalCompositeOperation = "lighter"
for i in [@particles.length - 1 ..... | JavaScript | CoffeeScript | JoelBesada/activate-power-mode | lib/power-canvas.coffee | MIT | 5d1989713f4204e3d12cbcc14325622e74b29dc9 | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/5d1989713f4204e3d12cbcc14325622e74b29dc9/lib/power-canvas.coffee | 106 | 139 |
JoelBesada/activate-power-mode:lib/power-canvas.coffee:3:completion | completion | velocity:
x: -1 + Math.random() * 2
y: -3.5 + Math.random() * 2
drawParticles: ->
@animationOn()
@canvas.width = @canvas.width
return if not @particles.length
gco = @context.globalCompositeOperation
@context.globalCompositeOperation = "lighter"
for i in [@particles.length - 1 ..... | particle.velocity.y += 0.075
particle.x += particle.velocity.x
particle.y += particle.velocity.y
particle.alpha *= 0.96
@context.fillStyle = "rgba(#{particle.color[4...-1]}, #{particle.alpha})"
@context.fillRect(
Math.round(particle.x - particle.size / 2)
Math.round(partic... | CoffeeScript | CoffeeScript | JoelBesada/activate-power-mode | lib/power-canvas.coffee | MIT | 5d1989713f4204e3d12cbcc14325622e74b29dc9 | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/5d1989713f4204e3d12cbcc14325622e74b29dc9/lib/power-canvas.coffee | 106 | 139 |
JoelBesada/activate-power-mode:lib/power-canvas.coffee:1:raw_corpus | raw_corpus | module.exports =
colorHelper: colorHelper
subscriptions: null
init: ->
@resetParticles()
@animationOn()
resetCanvas: ->
@animationOff()
@editor = null
@editorElement = null
animationOff: ->
cancelAnimationFrame(@animationFrame)
@animationFrame = null
animationOn: ->
@anim... | CoffeeScript | JoelBesada/activate-power-mode | lib/power-canvas.coffee | MIT | 4e6994b8ebcb5c742576517051879689a49235fc | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/4e6994b8ebcb5c742576517051879689a49235fc/lib/power-canvas.coffee | 5 | 54 | ||
JoelBesada/activate-power-mode:lib/power-canvas.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports =
colorHelper: colorHelper
subscriptions: null
init: ->
@resetParticles()
@animationOn()
resetCanvas: ->
@animationOff()
@editor = null
@editorElement = null
animationOff: ->
cancelAnimationFrame(@animationFrame... | module.exports = {
colorHelper: colorHelper,
subscriptions: null,
init: function() {
this.resetParticles();
return this.animationOn();
},
resetCanvas: function() {
this.animationOff();
this.editor = null;
return this.editorElement = null;
},
animationOff: function() {
cancelAnimati... | CoffeeScript | JavaScript | JoelBesada/activate-power-mode | lib/power-canvas.coffee | MIT | 4e6994b8ebcb5c742576517051879689a49235fc | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/4e6994b8ebcb5c742576517051879689a49235fc/lib/power-canvas.coffee | 5 | 54 |
JoelBesada/activate-power-mode:lib/power-canvas.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
module.exports = {
colorHelper: colorHelper,
subscriptions: null,
init: function() {
this.resetParticles();
return this.animationOn();
},
resetCanvas: function() {
this.animationOff();
this.editor = null;
return this.editorElement = nu... | module.exports =
colorHelper: colorHelper
subscriptions: null
init: ->
@resetParticles()
@animationOn()
resetCanvas: ->
@animationOff()
@editor = null
@editorElement = null
animationOff: ->
cancelAnimationFrame(@animationFrame)
@animationFrame = null
animationOn: ->
@anim... | JavaScript | CoffeeScript | JoelBesada/activate-power-mode | lib/power-canvas.coffee | MIT | 4e6994b8ebcb5c742576517051879689a49235fc | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/4e6994b8ebcb5c742576517051879689a49235fc/lib/power-canvas.coffee | 5 | 54 |
JoelBesada/activate-power-mode:lib/power-canvas.coffee:1:completion | completion | module.exports =
colorHelper: colorHelper
subscriptions: null
init: ->
@resetParticles()
@animationOn()
resetCanvas: ->
@animationOff()
@editor = null
@editorElement = null
animationOff: ->
cancelAnimationFrame(@animationFrame)
@animationFrame = null
animationOn: ->
@anim... | @resetParticles()
@canvas?.parentNode.removeChild @canvas
@canvas = null
@subscriptions?.dispose()
setupCanvas: (editor, editorElement) ->
if not @canvas
@canvas = document.createElement "canvas"
@context = @canvas.getContext "2d"
@canvas.classList.add "power-mode-canvas"
@ini... | CoffeeScript | CoffeeScript | JoelBesada/activate-power-mode | lib/power-canvas.coffee | MIT | 4e6994b8ebcb5c742576517051879689a49235fc | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/4e6994b8ebcb5c742576517051879689a49235fc/lib/power-canvas.coffee | 5 | 54 |
JoelBesada/activate-power-mode:lib/power-canvas.coffee:2:raw_corpus | raw_corpus | @confMinCount = value
@subscriptions.add atom.config.observe 'activate-power-mode.particles.spawnCount.max', (value) =>
@confMaxCount = value
@subscriptions.add atom.config.observe 'activate-power-mode.particles.totalCount.max', (value) =>
@confTotalCount = value
@subscriptions.add atom.config.o... | CoffeeScript | JoelBesada/activate-power-mode | lib/power-canvas.coffee | MIT | 4e6994b8ebcb5c742576517051879689a49235fc | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/4e6994b8ebcb5c742576517051879689a49235fc/lib/power-canvas.coffee | 55 | 104 | ||
JoelBesada/activate-power-mode:lib/power-canvas.coffee:2:completion | completion | @confMinCount = value
@subscriptions.add atom.config.observe 'activate-power-mode.particles.spawnCount.max', (value) =>
@confMaxCount = value
@subscriptions.add atom.config.observe 'activate-power-mode.particles.totalCount.max', (value) =>
@confTotalCount = value
@subscriptions.add atom.config.o... | left: left + @scrollView.offsetLeft - @editorElement.getScrollLeft()
top: top + @scrollView.offsetTop - @editorElement.getScrollTop() + @editor.getLineHeightInPixels() / 2
createParticle: (x, y, color) ->
x: x
y: y
alpha: 1
color: color
size: random @confMinSize, @confMaxSize, true
veloci... | CoffeeScript | CoffeeScript | JoelBesada/activate-power-mode | lib/power-canvas.coffee | MIT | 4e6994b8ebcb5c742576517051879689a49235fc | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/4e6994b8ebcb5c742576517051879689a49235fc/lib/power-canvas.coffee | 55 | 104 |
JoelBesada/activate-power-mode:lib/power-canvas.coffee:3:raw_corpus | raw_corpus | continue
particle.velocity.y += 0.075
particle.x += particle.velocity.x
particle.y += particle.velocity.y
particle.alpha *= 0.96
@context.fillStyle = "rgba(#{particle.color[4...-1]}, #{particle.alpha})"
@context.fillRect(
Math.round(particle.x - particle.size / 2)
M... | CoffeeScript | JoelBesada/activate-power-mode | lib/power-canvas.coffee | MIT | 4e6994b8ebcb5c742576517051879689a49235fc | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/4e6994b8ebcb5c742576517051879689a49235fc/lib/power-canvas.coffee | 105 | 122 | ||
JoelBesada/activate-power-mode:lib/power-canvas.coffee:3:completion | completion | continue
particle.velocity.y += 0.075
particle.x += particle.velocity.x
particle.y += particle.velocity.y
particle.alpha *= 0.96
@context.fillStyle = "rgba(#{particle.color[4...-1]}, #{particle.alpha})"
@context.fillRect( | Math.round(particle.x - particle.size / 2)
Math.round(particle.y - particle.size / 2)
particle.size, particle.size
)
@context.globalCompositeOperation = gco
getConfig: (config) ->
atom.config.get "activate-power-mode.particles.#{config}" | CoffeeScript | CoffeeScript | JoelBesada/activate-power-mode | lib/power-canvas.coffee | MIT | 4e6994b8ebcb5c742576517051879689a49235fc | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/4e6994b8ebcb5c742576517051879689a49235fc/lib/power-canvas.coffee | 105 | 122 |
JoelBesada/activate-power-mode:lib/power-canvas.coffee:1:raw_corpus | raw_corpus | module.exports =
colorHelper: colorHelper
init: ->
@resetParticles()
@animationFrame = requestAnimationFrame @drawParticles.bind(this)
resetCanvas: ->
@editor = null
@editorElement = null
cancelAnimationFrame(@animationFrame)
resetParticles: ->
@particlePointer = 0
@particles = [... | CoffeeScript | JoelBesada/activate-power-mode | lib/power-canvas.coffee | MIT | 98ff5a99d52aaae413104e3c3540f7a948c1be6e | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/98ff5a99d52aaae413104e3c3540f7a948c1be6e/lib/power-canvas.coffee | 4 | 53 | ||
JoelBesada/activate-power-mode:lib/power-canvas.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports =
colorHelper: colorHelper
init: ->
@resetParticles()
@animationFrame = requestAnimationFrame @drawParticles.bind(this)
resetCanvas: ->
@editor = null
@editorElement = null
cancelAnimationFrame(@animationFrame)
reset... | module.exports = {
colorHelper: colorHelper,
init: function() {
this.resetParticles();
return this.animationFrame = requestAnimationFrame(this.drawParticles.bind(this));
},
resetCanvas: function() {
this.editor = null;
this.editorElement = null;
return cancelAnimationFrame(this.animationFram... | CoffeeScript | JavaScript | JoelBesada/activate-power-mode | lib/power-canvas.coffee | MIT | 98ff5a99d52aaae413104e3c3540f7a948c1be6e | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/98ff5a99d52aaae413104e3c3540f7a948c1be6e/lib/power-canvas.coffee | 4 | 53 |
JoelBesada/activate-power-mode:lib/power-canvas.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
module.exports = {
colorHelper: colorHelper,
init: function() {
this.resetParticles();
return this.animationFrame = requestAnimationFrame(this.drawParticles.bind(this));
},
resetCanvas: function() {
this.editor = null;
this.editorElement = n... | module.exports =
colorHelper: colorHelper
init: ->
@resetParticles()
@animationFrame = requestAnimationFrame @drawParticles.bind(this)
resetCanvas: ->
@editor = null
@editorElement = null
cancelAnimationFrame(@animationFrame)
resetParticles: ->
@particlePointer = 0
@particles = [... | JavaScript | CoffeeScript | JoelBesada/activate-power-mode | lib/power-canvas.coffee | MIT | 98ff5a99d52aaae413104e3c3540f7a948c1be6e | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/98ff5a99d52aaae413104e3c3540f7a948c1be6e/lib/power-canvas.coffee | 4 | 53 |
JoelBesada/activate-power-mode:lib/power-canvas.coffee:1:completion | completion | module.exports =
colorHelper: colorHelper
init: ->
@resetParticles()
@animationFrame = requestAnimationFrame @drawParticles.bind(this)
resetCanvas: ->
@editor = null
@editorElement = null
cancelAnimationFrame(@animationFrame)
resetParticles: ->
@particlePointer = 0
@particles = [... | if not @canvas
@canvas = document.createElement "canvas"
@context = @canvas.getContext "2d"
@canvas.classList.add "power-mode-canvas"
editorElement.appendChild @canvas
@canvas.style.display = "block"
@editorElement = editorElement
@editor = editor
@init()
spawnParticles: (scre... | CoffeeScript | CoffeeScript | JoelBesada/activate-power-mode | lib/power-canvas.coffee | MIT | 98ff5a99d52aaae413104e3c3540f7a948c1be6e | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/98ff5a99d52aaae413104e3c3540f7a948c1be6e/lib/power-canvas.coffee | 4 | 53 |
JoelBesada/activate-power-mode:lib/power-canvas.coffee:2:raw_corpus | raw_corpus | @particles[@particlePointer] = @createParticle left, top, nextColor
@particlePointer = (@particlePointer + 1) % @getConfig("totalCount.max")
calculateCursorOffset: ->
editorRect = @editorElement.getBoundingClientRect()
scrollViewRect = @editorElement.querySelector(".scroll-view").getBoundingClientRect(... | CoffeeScript | JoelBesada/activate-power-mode | lib/power-canvas.coffee | MIT | 98ff5a99d52aaae413104e3c3540f7a948c1be6e | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/98ff5a99d52aaae413104e3c3540f7a948c1be6e/lib/power-canvas.coffee | 54 | 101 | ||
JoelBesada/activate-power-mode:lib/power-canvas.coffee:2:completion | completion | @particles[@particlePointer] = @createParticle left, top, nextColor
@particlePointer = (@particlePointer + 1) % @getConfig("totalCount.max")
calculateCursorOffset: ->
editorRect = @editorElement.getBoundingClientRect()
scrollViewRect = @editorElement.querySelector(".scroll-view").getBoundingClientRect(... | @canvas.height = @editorElement.offsetHeight
gco = @context.globalCompositeOperation
@context.globalCompositeOperation = "lighter"
for particle in @particles
continue if particle.alpha <= 0.1
particle.velocity.y += 0.075
particle.x += particle.velocity.x
particle.y += particle.velo... | CoffeeScript | CoffeeScript | JoelBesada/activate-power-mode | lib/power-canvas.coffee | MIT | 98ff5a99d52aaae413104e3c3540f7a948c1be6e | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/98ff5a99d52aaae413104e3c3540f7a948c1be6e/lib/power-canvas.coffee | 54 | 101 |
JoelBesada/activate-power-mode:lib/power-canvas.coffee:1:raw_corpus | raw_corpus | module.exports =
init: ->
@resetParticles()
@animationFrame = requestAnimationFrame @drawParticles.bind(this)
resetCanvas: ->
@editor = null
@editorElement = null
cancelAnimationFrame(@animationFrame)
resetParticles: ->
@particlePointer = 0
@particles = []
destroy: ->
@resetC... | CoffeeScript | JoelBesada/activate-power-mode | lib/power-canvas.coffee | MIT | ec7915d236c421cbcca3711bc675a6fe129952ee | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/ec7915d236c421cbcca3711bc675a6fe129952ee/lib/power-canvas.coffee | 3 | 52 | ||
JoelBesada/activate-power-mode:lib/power-canvas.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports =
init: ->
@resetParticles()
@animationFrame = requestAnimationFrame @drawParticles.bind(this)
resetCanvas: ->
@editor = null
@editorElement = null
cancelAnimationFrame(@animationFrame)
resetParticles: ->
@particleP... | module.exports = {
init: function() {
this.resetParticles();
return this.animationFrame = requestAnimationFrame(this.drawParticles.bind(this));
},
resetCanvas: function() {
this.editor = null;
this.editorElement = null;
return cancelAnimationFrame(this.animationFrame);
},
resetParticles: f... | CoffeeScript | JavaScript | JoelBesada/activate-power-mode | lib/power-canvas.coffee | MIT | ec7915d236c421cbcca3711bc675a6fe129952ee | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/ec7915d236c421cbcca3711bc675a6fe129952ee/lib/power-canvas.coffee | 3 | 52 |
JoelBesada/activate-power-mode:lib/power-canvas.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
module.exports = {
init: function() {
this.resetParticles();
return this.animationFrame = requestAnimationFrame(this.drawParticles.bind(this));
},
resetCanvas: function() {
this.editor = null;
this.editorElement = null;
return cancelAnimat... | module.exports =
init: ->
@resetParticles()
@animationFrame = requestAnimationFrame @drawParticles.bind(this)
resetCanvas: ->
@editor = null
@editorElement = null
cancelAnimationFrame(@animationFrame)
resetParticles: ->
@particlePointer = 0
@particles = []
destroy: ->
@resetC... | JavaScript | CoffeeScript | JoelBesada/activate-power-mode | lib/power-canvas.coffee | MIT | ec7915d236c421cbcca3711bc675a6fe129952ee | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/ec7915d236c421cbcca3711bc675a6fe129952ee/lib/power-canvas.coffee | 3 | 52 |
JoelBesada/activate-power-mode:lib/power-canvas.coffee:1:completion | completion | module.exports =
init: ->
@resetParticles()
@animationFrame = requestAnimationFrame @drawParticles.bind(this)
resetCanvas: ->
@editor = null
@editorElement = null
cancelAnimationFrame(@animationFrame)
resetParticles: ->
@particlePointer = 0
@particles = []
destroy: ->
@resetC... | @context = @canvas.getContext "2d"
@canvas.classList.add "power-mode-canvas"
editorElement.appendChild @canvas
@canvas.style.display = "block"
@editorElement = editorElement
@editor = editor
@init()
hsvToRgb: (h,s,v) -> # HSV to RGB algorithm, as per wikipedia
c = v * s
h2 = (360.... | CoffeeScript | CoffeeScript | JoelBesada/activate-power-mode | lib/power-canvas.coffee | MIT | ec7915d236c421cbcca3711bc675a6fe129952ee | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/ec7915d236c421cbcca3711bc675a6fe129952ee/lib/power-canvas.coffee | 3 | 52 |
JoelBesada/activate-power-mode:lib/power-canvas.coffee:2:raw_corpus | raw_corpus | {left, top} = @editorElement.pixelPositionForScreenPosition screenPosition
left += cursorOffset.left - @editorElement.getScrollLeft()
top += cursorOffset.top - @editorElement.getScrollTop()
numParticles = random @getConfig("spawnCount.min"), @getConfig("spawnCount.max")
colorType = @getConfig "colours.... | CoffeeScript | JoelBesada/activate-power-mode | lib/power-canvas.coffee | MIT | ec7915d236c421cbcca3711bc675a6fe129952ee | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/ec7915d236c421cbcca3711bc675a6fe129952ee/lib/power-canvas.coffee | 53 | 102 | ||
JoelBesada/activate-power-mode:lib/power-canvas.coffee:2:completion | completion | {left, top} = @editorElement.pixelPositionForScreenPosition screenPosition
left += cursorOffset.left - @editorElement.getScrollLeft()
top += cursorOffset.top - @editorElement.getScrollTop()
numParticles = random @getConfig("spawnCount.min"), @getConfig("spawnCount.max")
colorType = @getConfig "colours.... | color = "rgb(#{c.red},#{c.green},#{c.blue})"
else
color = @getColorAtPosition [screenPosition.row, screenPosition.column - 1]
while numParticles--
@particles[@particlePointer] = @createParticle left, top, color
@particlePointer = (@particlePointer + 1) % @getConfig("totalCount.max")
... | CoffeeScript | CoffeeScript | JoelBesada/activate-power-mode | lib/power-canvas.coffee | MIT | ec7915d236c421cbcca3711bc675a6fe129952ee | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/ec7915d236c421cbcca3711bc675a6fe129952ee/lib/power-canvas.coffee | 53 | 102 |
JoelBesada/activate-power-mode:lib/power-canvas.coffee:3:raw_corpus | raw_corpus | top: scrollViewRect.top - editorRect.top + @editor.getLineHeightInPixels() / 2
left: scrollViewRect.left - editorRect.left
createParticle: (x, y, color) ->
x: x
y: y
alpha: 1
color: color
velocity:
x: -1 + Math.random() * 2
y: -3.5 + Math.random() * 2
drawParticles: ->
@ani... | CoffeeScript | JoelBesada/activate-power-mode | lib/power-canvas.coffee | MIT | ec7915d236c421cbcca3711bc675a6fe129952ee | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/ec7915d236c421cbcca3711bc675a6fe129952ee/lib/power-canvas.coffee | 103 | 143 | ||
JoelBesada/activate-power-mode:lib/power-canvas.coffee:3:completion | completion | top: scrollViewRect.top - editorRect.top + @editor.getLineHeightInPixels() / 2
left: scrollViewRect.left - editorRect.left
createParticle: (x, y, color) ->
x: x
y: y
alpha: 1
color: color
velocity:
x: -1 + Math.random() * 2
y: -3.5 + Math.random() * 2
drawParticles: ->
@ani... | for particle in @particles
continue if particle.alpha <= 0.1
particle.velocity.y += 0.075
particle.x += particle.velocity.x
particle.y += particle.velocity.y
particle.alpha *= 0.96
@context.fillStyle = "rgba(#{particle.color[4...-1]}, #{particle.alpha})"
size = random @getCon... | CoffeeScript | CoffeeScript | JoelBesada/activate-power-mode | lib/power-canvas.coffee | MIT | ec7915d236c421cbcca3711bc675a6fe129952ee | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/ec7915d236c421cbcca3711bc675a6fe129952ee/lib/power-canvas.coffee | 103 | 143 |
JoelBesada/activate-power-mode:lib/power-canvas.coffee:1:raw_corpus | raw_corpus | module.exports =
init: ->
@resetParticles()
@animationFrame = requestAnimationFrame @drawParticles.bind(this)
resetCanvas: ->
@editor = null
@editorElement = null
cancelAnimationFrame(@animationFrame)
resetParticles: ->
@particlePointer = 0
@particles = []
destroy: ->
@resetC... | CoffeeScript | JoelBesada/activate-power-mode | lib/power-canvas.coffee | MIT | 0e12a3c0e7630f3169f5716a940595ecc920a3f8 | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/0e12a3c0e7630f3169f5716a940595ecc920a3f8/lib/power-canvas.coffee | 3 | 52 | ||
JoelBesada/activate-power-mode:lib/power-canvas.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports =
init: ->
@resetParticles()
@animationFrame = requestAnimationFrame @drawParticles.bind(this)
resetCanvas: ->
@editor = null
@editorElement = null
cancelAnimationFrame(@animationFrame)
resetParticles: ->
@particleP... | module.exports = {
init: function() {
this.resetParticles();
return this.animationFrame = requestAnimationFrame(this.drawParticles.bind(this));
},
resetCanvas: function() {
this.editor = null;
this.editorElement = null;
return cancelAnimationFrame(this.animationFrame);
},
resetParticles: f... | CoffeeScript | JavaScript | JoelBesada/activate-power-mode | lib/power-canvas.coffee | MIT | 0e12a3c0e7630f3169f5716a940595ecc920a3f8 | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/0e12a3c0e7630f3169f5716a940595ecc920a3f8/lib/power-canvas.coffee | 3 | 52 |
JoelBesada/activate-power-mode:lib/power-canvas.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
module.exports = {
init: function() {
this.resetParticles();
return this.animationFrame = requestAnimationFrame(this.drawParticles.bind(this));
},
resetCanvas: function() {
this.editor = null;
this.editorElement = null;
return cancelAnimat... | module.exports =
init: ->
@resetParticles()
@animationFrame = requestAnimationFrame @drawParticles.bind(this)
resetCanvas: ->
@editor = null
@editorElement = null
cancelAnimationFrame(@animationFrame)
resetParticles: ->
@particlePointer = 0
@particles = []
destroy: ->
@resetC... | JavaScript | CoffeeScript | JoelBesada/activate-power-mode | lib/power-canvas.coffee | MIT | 0e12a3c0e7630f3169f5716a940595ecc920a3f8 | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/0e12a3c0e7630f3169f5716a940595ecc920a3f8/lib/power-canvas.coffee | 3 | 52 |
JoelBesada/activate-power-mode:lib/power-canvas.coffee:1:completion | completion | module.exports =
init: ->
@resetParticles()
@animationFrame = requestAnimationFrame @drawParticles.bind(this)
resetCanvas: ->
@editor = null
@editorElement = null
cancelAnimationFrame(@animationFrame)
resetParticles: ->
@particlePointer = 0
@particles = []
destroy: ->
@resetC... | @context = @canvas.getContext "2d"
@canvas.classList.add "power-mode-canvas"
(editorElement.shadowRoot ? editorElement).appendChild @canvas
@canvas.style.display = "block"
@editorElement = editorElement
@editor = editor
@init()
hsvToRgb: (h,s,v) -> # HSV to RGB algorithm, as per wikipedia... | CoffeeScript | CoffeeScript | JoelBesada/activate-power-mode | lib/power-canvas.coffee | MIT | 0e12a3c0e7630f3169f5716a940595ecc920a3f8 | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/0e12a3c0e7630f3169f5716a940595ecc920a3f8/lib/power-canvas.coffee | 3 | 52 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.