repo
stringlengths
5
67
path
stringlengths
4
116
func_name
stringlengths
0
58
original_string
stringlengths
52
373k
language
stringclasses
1 value
code
stringlengths
52
373k
code_tokens
list
docstring
stringlengths
4
11.8k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
86
226
partition
stringclasses
1 value
clientIO/joint
dist/joint.nowrap.js
function($el) { var el = joint.util.isString($el) ? this.viewport.querySelector($el) : $el instanceof $ ? $el[0] : $el; var id = this.findAttribute('model-id', el); if (id) return this._views[id]; return undefined; }
javascript
function($el) { var el = joint.util.isString($el) ? this.viewport.querySelector($el) : $el instanceof $ ? $el[0] : $el; var id = this.findAttribute('model-id', el); if (id) return this._views[id]; return undefined; }
[ "function", "(", "$el", ")", "{", "var", "el", "=", "joint", ".", "util", ".", "isString", "(", "$el", ")", "?", "this", ".", "viewport", ".", "querySelector", "(", "$el", ")", ":", "$el", "instanceof", "$", "?", "$el", "[", "0", "]", ":", "$el",...
Find the first view climbing up the DOM tree starting at element `el`. Note that `el` can also be a selector or a jQuery object.
[ "Find", "the", "first", "view", "climbing", "up", "the", "DOM", "tree", "starting", "at", "element", "el", ".", "Note", "that", "el", "can", "also", "be", "a", "selector", "or", "a", "jQuery", "object", "." ]
99ba02fe6c64e407bdfff6ba595d2068422c3e76
https://github.com/clientIO/joint/blob/99ba02fe6c64e407bdfff6ba595d2068422c3e76/dist/joint.nowrap.js#L18216-L18226
train
clientIO/joint
dist/joint.nowrap.js
function(cell) { var id = (joint.util.isString(cell) || joint.util.isNumber(cell)) ? cell : (cell && cell.id); return this._views[id]; }
javascript
function(cell) { var id = (joint.util.isString(cell) || joint.util.isNumber(cell)) ? cell : (cell && cell.id); return this._views[id]; }
[ "function", "(", "cell", ")", "{", "var", "id", "=", "(", "joint", ".", "util", ".", "isString", "(", "cell", ")", "||", "joint", ".", "util", ".", "isNumber", "(", "cell", ")", ")", "?", "cell", ":", "(", "cell", "&&", "cell", ".", "id", ")", ...
Find a view for a model `cell`. `cell` can also be a string or number representing a model `id`.
[ "Find", "a", "view", "for", "a", "model", "cell", ".", "cell", "can", "also", "be", "a", "string", "or", "number", "representing", "a", "model", "id", "." ]
99ba02fe6c64e407bdfff6ba595d2068422c3e76
https://github.com/clientIO/joint/blob/99ba02fe6c64e407bdfff6ba595d2068422c3e76/dist/joint.nowrap.js#L18229-L18234
train
clientIO/joint
dist/joint.nowrap.js
function(p) { p = new g.Point(p); var views = this.model.getElements().map(this.findViewByModel, this); return views.filter(function(view) { return view && view.vel.getBBox({ target: this.viewport }).containsPoint(p); }, this); }
javascript
function(p) { p = new g.Point(p); var views = this.model.getElements().map(this.findViewByModel, this); return views.filter(function(view) { return view && view.vel.getBBox({ target: this.viewport }).containsPoint(p); }, this); }
[ "function", "(", "p", ")", "{", "p", "=", "new", "g", ".", "Point", "(", "p", ")", ";", "var", "views", "=", "this", ".", "model", ".", "getElements", "(", ")", ".", "map", "(", "this", ".", "findViewByModel", ",", "this", ")", ";", "return", "...
Find all views at given point
[ "Find", "all", "views", "at", "given", "point" ]
99ba02fe6c64e407bdfff6ba595d2068422c3e76
https://github.com/clientIO/joint/blob/99ba02fe6c64e407bdfff6ba595d2068422c3e76/dist/joint.nowrap.js#L18237-L18246
train
clientIO/joint
dist/joint.nowrap.js
function(rect, opt) { opt = joint.util.defaults(opt || {}, { strict: false }); rect = new g.Rect(rect); var views = this.model.getElements().map(this.findViewByModel, this); var method = opt.strict ? 'containsRect' : 'intersect'; return views.filter(function(view) { ...
javascript
function(rect, opt) { opt = joint.util.defaults(opt || {}, { strict: false }); rect = new g.Rect(rect); var views = this.model.getElements().map(this.findViewByModel, this); var method = opt.strict ? 'containsRect' : 'intersect'; return views.filter(function(view) { ...
[ "function", "(", "rect", ",", "opt", ")", "{", "opt", "=", "joint", ".", "util", ".", "defaults", "(", "opt", "||", "{", "}", ",", "{", "strict", ":", "false", "}", ")", ";", "rect", "=", "new", "g", ".", "Rect", "(", "rect", ")", ";", "var",...
Find all views in given area
[ "Find", "all", "views", "in", "given", "area" ]
99ba02fe6c64e407bdfff6ba595d2068422c3e76
https://github.com/clientIO/joint/blob/99ba02fe6c64e407bdfff6ba595d2068422c3e76/dist/joint.nowrap.js#L18249-L18260
train
clientIO/joint
dist/joint.nowrap.js
function(evt, view) { if (evt.type === 'mousedown' && evt.button === 2) { // handled as `contextmenu` type return true; } if (this.options.guard && this.options.guard(evt, view)) { return true; } if (evt.data && evt.data.guarded !== undefine...
javascript
function(evt, view) { if (evt.type === 'mousedown' && evt.button === 2) { // handled as `contextmenu` type return true; } if (this.options.guard && this.options.guard(evt, view)) { return true; } if (evt.data && evt.data.guarded !== undefine...
[ "function", "(", "evt", ",", "view", ")", "{", "if", "(", "evt", ".", "type", "===", "'mousedown'", "&&", "evt", ".", "button", "===", "2", ")", "{", "// handled as `contextmenu` type", "return", "true", ";", "}", "if", "(", "this", ".", "options", "."...
Guard the specified event. If the event is not interesting, guard returns `true`. Otherwise, it returns `false`.
[ "Guard", "the", "specified", "event", ".", "If", "the", "event", "is", "not", "interesting", "guard", "returns", "true", ".", "Otherwise", "it", "returns", "false", "." ]
99ba02fe6c64e407bdfff6ba595d2068422c3e76
https://github.com/clientIO/joint/blob/99ba02fe6c64e407bdfff6ba595d2068422c3e76/dist/joint.nowrap.js#L18828-L18852
train
clientIO/joint
dist/joint.nowrap.js
function() { var current = this.get('ports') || {}; var currentItemsMap = {}; util.toArray(current.items).forEach(function(item) { currentItemsMap[item.id] = true; }); var previous = this.previous('ports') || {}; var removed = {}...
javascript
function() { var current = this.get('ports') || {}; var currentItemsMap = {}; util.toArray(current.items).forEach(function(item) { currentItemsMap[item.id] = true; }); var previous = this.previous('ports') || {}; var removed = {}...
[ "function", "(", ")", "{", "var", "current", "=", "this", ".", "get", "(", "'ports'", ")", "||", "{", "}", ";", "var", "currentItemsMap", "=", "{", "}", ";", "util", ".", "toArray", "(", "current", ".", "items", ")", ".", "forEach", "(", "function"...
remove links tied wiht just removed element @private
[ "remove", "links", "tied", "wiht", "just", "removed", "element" ]
99ba02fe6c64e407bdfff6ba595d2068422c3e76
https://github.com/clientIO/joint/blob/99ba02fe6c64e407bdfff6ba595d2068422c3e76/dist/joint.nowrap.js#L19640-L19673
train
clientIO/joint
dist/joint.nowrap.js
function(port) { if (this._portElementsCache[port.id]) { return this._portElementsCache[port.id].portElement; } return this._createPortElement(port); }
javascript
function(port) { if (this._portElementsCache[port.id]) { return this._portElementsCache[port.id].portElement; } return this._createPortElement(port); }
[ "function", "(", "port", ")", "{", "if", "(", "this", ".", "_portElementsCache", "[", "port", ".", "id", "]", ")", "{", "return", "this", ".", "_portElementsCache", "[", "port", ".", "id", "]", ".", "portElement", ";", "}", "return", "this", ".", "_c...
Try to get element from cache, @param port @returns {*} @private
[ "Try", "to", "get", "element", "from", "cache" ]
99ba02fe6c64e407bdfff6ba595d2068422c3e76
https://github.com/clientIO/joint/blob/99ba02fe6c64e407bdfff6ba595d2068422c3e76/dist/joint.nowrap.js#L20063-L20069
train
clientIO/joint
dist/joint.nowrap.js
freeJoin
function freeJoin(p1, p2, bbox) { var p = new g.Point(p1.x, p2.y); if (bbox.containsPoint(p)) p = new g.Point(p2.x, p1.y); // kept for reference // if (bbox.containsPoint(p)) p = null; return p; }
javascript
function freeJoin(p1, p2, bbox) { var p = new g.Point(p1.x, p2.y); if (bbox.containsPoint(p)) p = new g.Point(p2.x, p1.y); // kept for reference // if (bbox.containsPoint(p)) p = null; return p; }
[ "function", "freeJoin", "(", "p1", ",", "p2", ",", "bbox", ")", "{", "var", "p", "=", "new", "g", ".", "Point", "(", "p1", ".", "x", ",", "p2", ".", "y", ")", ";", "if", "(", "bbox", ".", "containsPoint", "(", "p", ")", ")", "p", "=", "new"...
returns a point `p` where lines p,p1 and p,p2 are perpendicular and p is not contained in the given box
[ "returns", "a", "point", "p", "where", "lines", "p", "p1", "and", "p", "p2", "are", "perpendicular", "and", "p", "is", "not", "contained", "in", "the", "given", "box" ]
99ba02fe6c64e407bdfff6ba595d2068422c3e76
https://github.com/clientIO/joint/blob/99ba02fe6c64e407bdfff6ba595d2068422c3e76/dist/joint.nowrap.js#L22476-L22484
train
clientIO/joint
dist/joint.nowrap.js
insideElement
function insideElement(from, to, fromBBox, toBBox, bearing) { var route = {}; var boundary = fromBBox.union(toBBox).inflate(1); // start from the point which is closer to the boundary var reversed = boundary.center().distance(to) > boundary.center().distance(from); var start = ...
javascript
function insideElement(from, to, fromBBox, toBBox, bearing) { var route = {}; var boundary = fromBBox.union(toBBox).inflate(1); // start from the point which is closer to the boundary var reversed = boundary.center().distance(to) > boundary.center().distance(from); var start = ...
[ "function", "insideElement", "(", "from", ",", "to", ",", "fromBBox", ",", "toBBox", ",", "bearing", ")", "{", "var", "route", "=", "{", "}", ";", "var", "boundary", "=", "fromBBox", ".", "union", "(", "toBBox", ")", ".", "inflate", "(", "1", ")", ...
Finds route for situations where one element is inside the other. Typically the route is directed outside the outer element first and then back towards the inner element.
[ "Finds", "route", "for", "situations", "where", "one", "element", "is", "inside", "the", "other", ".", "Typically", "the", "route", "is", "directed", "outside", "the", "outer", "element", "first", "and", "then", "back", "towards", "the", "inner", "element", ...
99ba02fe6c64e407bdfff6ba595d2068422c3e76
https://github.com/clientIO/joint/blob/99ba02fe6c64e407bdfff6ba595d2068422c3e76/dist/joint.nowrap.js#L22640-L22677
train
clientIO/joint
dist/joint.nowrap.js
router
function router(vertices, opt, linkView) { var sourceBBox = getSourceBBox(linkView, opt); var targetBBox = getTargetBBox(linkView, opt); var sourceAnchor = getSourceAnchor(linkView, opt); var targetAnchor = getTargetAnchor(linkView, opt); // if anchor lies outside of bbox, the...
javascript
function router(vertices, opt, linkView) { var sourceBBox = getSourceBBox(linkView, opt); var targetBBox = getTargetBBox(linkView, opt); var sourceAnchor = getSourceAnchor(linkView, opt); var targetAnchor = getTargetAnchor(linkView, opt); // if anchor lies outside of bbox, the...
[ "function", "router", "(", "vertices", ",", "opt", ",", "linkView", ")", "{", "var", "sourceBBox", "=", "getSourceBBox", "(", "linkView", ",", "opt", ")", ";", "var", "targetBBox", "=", "getTargetBBox", "(", "linkView", ",", "opt", ")", ";", "var", "sour...
Return points through which a connection needs to be drawn in order to obtain an orthogonal link routing from source to target going through `vertices`.
[ "Return", "points", "through", "which", "a", "connection", "needs", "to", "be", "drawn", "in", "order", "to", "obtain", "an", "orthogonal", "link", "routing", "from", "source", "to", "target", "going", "through", "vertices", "." ]
99ba02fe6c64e407bdfff6ba595d2068422c3e76
https://github.com/clientIO/joint/blob/99ba02fe6c64e407bdfff6ba595d2068422c3e76/dist/joint.nowrap.js#L22683-L22769
train
clientIO/joint
dist/joint.nowrap.js
modelCenter
function modelCenter(view, magnet) { var model = view.model; var bbox = model.getBBox(); var center = bbox.center(); var angle = model.angle(); var portId = view.findAttribute('port', magnet); if (portId) { var portGroup = model.portProp(portId, 'group'); ...
javascript
function modelCenter(view, magnet) { var model = view.model; var bbox = model.getBBox(); var center = bbox.center(); var angle = model.angle(); var portId = view.findAttribute('port', magnet); if (portId) { var portGroup = model.portProp(portId, 'group'); ...
[ "function", "modelCenter", "(", "view", ",", "magnet", ")", "{", "var", "model", "=", "view", ".", "model", ";", "var", "bbox", "=", "model", ".", "getBBox", "(", ")", ";", "var", "center", "=", "bbox", ".", "center", "(", ")", ";", "var", "angle",...
Can find anchor from model, when there is no selector or the link end is connected to a port
[ "Can", "find", "anchor", "from", "model", "when", "there", "is", "no", "selector", "or", "the", "link", "end", "is", "connected", "to", "a", "port" ]
99ba02fe6c64e407bdfff6ba595d2068422c3e76
https://github.com/clientIO/joint/blob/99ba02fe6c64e407bdfff6ba595d2068422c3e76/dist/joint.nowrap.js#L23945-L23962
train
clientIO/joint
tutorials/js/pipes.js
function(ctx, from, to, width, gradient) { var innerWidth = width - 4; var outerWidth = width; var buttFrom = g.point(from).move(to, -outerWidth / 2); var buttTo = g.point(to).move(from, -outerWidth / 2); ctx.beginPath(); ctx.lineWidth = outerWidth; ctx.strokeSt...
javascript
function(ctx, from, to, width, gradient) { var innerWidth = width - 4; var outerWidth = width; var buttFrom = g.point(from).move(to, -outerWidth / 2); var buttTo = g.point(to).move(from, -outerWidth / 2); ctx.beginPath(); ctx.lineWidth = outerWidth; ctx.strokeSt...
[ "function", "(", "ctx", ",", "from", ",", "to", ",", "width", ",", "gradient", ")", "{", "var", "innerWidth", "=", "width", "-", "4", ";", "var", "outerWidth", "=", "width", ";", "var", "buttFrom", "=", "g", ".", "point", "(", "from", ")", ".", "...
A drawing function executed for all links segments.
[ "A", "drawing", "function", "executed", "for", "all", "links", "segments", "." ]
99ba02fe6c64e407bdfff6ba595d2068422c3e76
https://github.com/clientIO/joint/blob/99ba02fe6c64e407bdfff6ba595d2068422c3e76/tutorials/js/pipes.js#L143-L189
train
clientIO/joint
demo/chess/src/garbochess.js
SeeAddKnightAttacks
function SeeAddKnightAttacks(target, us, attacks) { var pieceIdx = (us | pieceKnight) << 4; var attackerSq = g_pieceList[pieceIdx++]; while (attackerSq != 0) { if (IsSquareOnPieceLine(target, attackerSq)) { attacks[attacks.length] = attackerSq; } attackerSq = g_pieceList...
javascript
function SeeAddKnightAttacks(target, us, attacks) { var pieceIdx = (us | pieceKnight) << 4; var attackerSq = g_pieceList[pieceIdx++]; while (attackerSq != 0) { if (IsSquareOnPieceLine(target, attackerSq)) { attacks[attacks.length] = attackerSq; } attackerSq = g_pieceList...
[ "function", "SeeAddKnightAttacks", "(", "target", ",", "us", ",", "attacks", ")", "{", "var", "pieceIdx", "=", "(", "us", "|", "pieceKnight", ")", "<<", "4", ";", "var", "attackerSq", "=", "g_pieceList", "[", "pieceIdx", "++", "]", ";", "while", "(", "...
target = attacking square, us = color of knights to look for, attacks = array to add squares to
[ "target", "=", "attacking", "square", "us", "=", "color", "of", "knights", "to", "look", "for", "attacks", "=", "array", "to", "add", "squares", "to" ]
99ba02fe6c64e407bdfff6ba595d2068422c3e76
https://github.com/clientIO/joint/blob/99ba02fe6c64e407bdfff6ba595d2068422c3e76/demo/chess/src/garbochess.js#L2446-L2456
train
clientIO/joint
src/geometry.js
function(p, opt) { opt = opt || {}; var precision = (opt.precision === undefined) ? this.PRECISION : opt.precision; var subdivisions = (opt.subdivisions === undefined) ? this.getSubdivisions({ precision: precision }) : opt.subdivisions; // does not use localOpt // identify the ...
javascript
function(p, opt) { opt = opt || {}; var precision = (opt.precision === undefined) ? this.PRECISION : opt.precision; var subdivisions = (opt.subdivisions === undefined) ? this.getSubdivisions({ precision: precision }) : opt.subdivisions; // does not use localOpt // identify the ...
[ "function", "(", "p", ",", "opt", ")", "{", "opt", "=", "opt", "||", "{", "}", ";", "var", "precision", "=", "(", "opt", ".", "precision", "===", "undefined", ")", "?", "this", ".", "PRECISION", ":", "opt", ".", "precision", ";", "var", "subdivisio...
Returns `t` of the point on the curve closest to point `p`
[ "Returns", "t", "of", "the", "point", "on", "the", "curve", "closest", "to", "point", "p" ]
99ba02fe6c64e407bdfff6ba595d2068422c3e76
https://github.com/clientIO/joint/blob/99ba02fe6c64e407bdfff6ba595d2068422c3e76/src/geometry.js#L484-L583
train
clientIO/joint
src/geometry.js
function(p) { var start = this.start; var end = this.end; if (start.cross(p, end) !== 0) return false; // else: cross product of 0 indicates that this line and the vector to `p` are collinear var length = this.length(); if ((new g.Line(start, p)).length() > length) ret...
javascript
function(p) { var start = this.start; var end = this.end; if (start.cross(p, end) !== 0) return false; // else: cross product of 0 indicates that this line and the vector to `p` are collinear var length = this.length(); if ((new g.Line(start, p)).length() > length) ret...
[ "function", "(", "p", ")", "{", "var", "start", "=", "this", ".", "start", ";", "var", "end", "=", "this", ".", "end", ";", "if", "(", "start", ".", "cross", "(", "p", ",", "end", ")", "!==", "0", ")", "return", "false", ";", "// else: cross prod...
Returns `true` if the point lies on the line.
[ "Returns", "true", "if", "the", "point", "lies", "on", "the", "line", "." ]
99ba02fe6c64e407bdfff6ba595d2068422c3e76
https://github.com/clientIO/joint/blob/99ba02fe6c64e407bdfff6ba595d2068422c3e76/src/geometry.js#L1402-L1416
train
clientIO/joint
src/geometry.js
function(ratio) { var dividerPoint = this.pointAt(ratio); // return array with two new lines return [ new Line(this.start, dividerPoint), new Line(dividerPoint, this.end) ]; }
javascript
function(ratio) { var dividerPoint = this.pointAt(ratio); // return array with two new lines return [ new Line(this.start, dividerPoint), new Line(dividerPoint, this.end) ]; }
[ "function", "(", "ratio", ")", "{", "var", "dividerPoint", "=", "this", ".", "pointAt", "(", "ratio", ")", ";", "// return array with two new lines", "return", "[", "new", "Line", "(", "this", ".", "start", ",", "dividerPoint", ")", ",", "new", "Line", "("...
Divides the line into two at requested `ratio` between 0 and 1.
[ "Divides", "the", "line", "into", "two", "at", "requested", "ratio", "between", "0", "and", "1", "." ]
99ba02fe6c64e407bdfff6ba595d2068422c3e76
https://github.com/clientIO/joint/blob/99ba02fe6c64e407bdfff6ba595d2068422c3e76/src/geometry.js#L1419-L1428
train
clientIO/joint
src/geometry.js
function(length) { var dividerPoint = this.pointAtLength(length); // return array with two new lines return [ new Line(this.start, dividerPoint), new Line(dividerPoint, this.end) ]; }
javascript
function(length) { var dividerPoint = this.pointAtLength(length); // return array with two new lines return [ new Line(this.start, dividerPoint), new Line(dividerPoint, this.end) ]; }
[ "function", "(", "length", ")", "{", "var", "dividerPoint", "=", "this", ".", "pointAtLength", "(", "length", ")", ";", "// return array with two new lines", "return", "[", "new", "Line", "(", "this", ".", "start", ",", "dividerPoint", ")", ",", "new", "Line...
Divides the line into two at requested `length`.
[ "Divides", "the", "line", "into", "two", "at", "requested", "length", "." ]
99ba02fe6c64e407bdfff6ba595d2068422c3e76
https://github.com/clientIO/joint/blob/99ba02fe6c64e407bdfff6ba595d2068422c3e76/src/geometry.js#L1431-L1440
train
clientIO/joint
src/geometry.js
function(ratio, opt) { var segments = this.segments; var numSegments = segments.length; if (numSegments === 0) return null; // if segments is an empty array if (ratio < 0) ratio = 0; if (ratio > 1) ratio = 1; opt = opt || {}; var precision = (opt.precision === ...
javascript
function(ratio, opt) { var segments = this.segments; var numSegments = segments.length; if (numSegments === 0) return null; // if segments is an empty array if (ratio < 0) ratio = 0; if (ratio > 1) ratio = 1; opt = opt || {}; var precision = (opt.precision === ...
[ "function", "(", "ratio", ",", "opt", ")", "{", "var", "segments", "=", "this", ".", "segments", ";", "var", "numSegments", "=", "segments", ".", "length", ";", "if", "(", "numSegments", "===", "0", ")", "return", "null", ";", "// if segments is an empty a...
Divides the path into two at requested `ratio` between 0 and 1 with precision better than `opt.precision`; optionally using `opt.subdivisions` provided.
[ "Divides", "the", "path", "into", "two", "at", "requested", "ratio", "between", "0", "and", "1", "with", "precision", "better", "than", "opt", ".", "precision", ";", "optionally", "using", "opt", ".", "subdivisions", "provided", "." ]
99ba02fe6c64e407bdfff6ba595d2068422c3e76
https://github.com/clientIO/joint/blob/99ba02fe6c64e407bdfff6ba595d2068422c3e76/src/geometry.js#L2027-L2045
train
clientIO/joint
src/geometry.js
function(index, arg) { var segments = this.segments; var numSegments = segments.length; if (numSegments === 0) throw new Error('Path has no segments.'); if (index < 0) index = numSegments + index; // convert negative indices to positive if (index >= numSegments || index < 0) th...
javascript
function(index, arg) { var segments = this.segments; var numSegments = segments.length; if (numSegments === 0) throw new Error('Path has no segments.'); if (index < 0) index = numSegments + index; // convert negative indices to positive if (index >= numSegments || index < 0) th...
[ "function", "(", "index", ",", "arg", ")", "{", "var", "segments", "=", "this", ".", "segments", ";", "var", "numSegments", "=", "segments", ".", "length", ";", "if", "(", "numSegments", "===", "0", ")", "throw", "new", "Error", "(", "'Path has no segmen...
Replace the segment at `index` with `arg`. Accepts negative indices, from `-1` to `-segments.length`. Accepts one segment or an array of segments as argument. Throws an error if path has no segments. Throws an error if index is out of range. Throws an error if argument is not a segment or an array of segments.
[ "Replace", "the", "segment", "at", "index", "with", "arg", ".", "Accepts", "negative", "indices", "from", "-", "1", "to", "-", "segments", ".", "length", ".", "Accepts", "one", "segment", "or", "an", "array", "of", "segments", "as", "argument", ".", "Thr...
99ba02fe6c64e407bdfff6ba595d2068422c3e76
https://github.com/clientIO/joint/blob/99ba02fe6c64e407bdfff6ba595d2068422c3e76/src/geometry.js#L2539-L2589
train
clientIO/joint
demo/expand/index.js
function(cell, portId) { console.assert(cell.isVisible()); console.assert(!cell.portProp(portId, 'collapsed'), 'port ' + portId + ' on ' + cell.id + ' should be expanded'); }
javascript
function(cell, portId) { console.assert(cell.isVisible()); console.assert(!cell.portProp(portId, 'collapsed'), 'port ' + portId + ' on ' + cell.id + ' should be expanded'); }
[ "function", "(", "cell", ",", "portId", ")", "{", "console", ".", "assert", "(", "cell", ".", "isVisible", "(", ")", ")", ";", "console", ".", "assert", "(", "!", "cell", ".", "portProp", "(", "portId", ",", "'collapsed'", ")", ",", "'port '", "+", ...
Simple unit testing
[ "Simple", "unit", "testing" ]
99ba02fe6c64e407bdfff6ba595d2068422c3e76
https://github.com/clientIO/joint/blob/99ba02fe6c64e407bdfff6ba595d2068422c3e76/demo/expand/index.js#L198-L202
train
Mikhus/canvas-gauges
lib/RadialGauge.js
displayValue
function displayValue(gauge) { if (gauge.options.animatedValue) { return gauge.options.value; } return gauge.value; }
javascript
function displayValue(gauge) { if (gauge.options.animatedValue) { return gauge.options.value; } return gauge.value; }
[ "function", "displayValue", "(", "gauge", ")", "{", "if", "(", "gauge", ".", "options", ".", "animatedValue", ")", "{", "return", "gauge", ".", "options", ".", "value", ";", "}", "return", "gauge", ".", "value", ";", "}" ]
Find and return gauge value to display @param {RadialGauge} gauge
[ "Find", "and", "return", "gauge", "value", "to", "display" ]
8f1a0936951be63f612e16443eb7b2235863679e
https://github.com/Mikhus/canvas-gauges/blob/8f1a0936951be63f612e16443eb7b2235863679e/lib/RadialGauge.js#L683-L689
train
Mikhus/canvas-gauges
lib/LinearGauge.js
drawLinearBar
function drawLinearBar(context, options, x, y, w, h) { drawLinearBarShape(context, options, '', x, y, w, h); }
javascript
function drawLinearBar(context, options, x, y, w, h) { drawLinearBarShape(context, options, '', x, y, w, h); }
[ "function", "drawLinearBar", "(", "context", ",", "options", ",", "x", ",", "y", ",", "w", ",", "h", ")", "{", "drawLinearBarShape", "(", "context", ",", "options", ",", "''", ",", "x", ",", "y", ",", "w", ",", "h", ")", ";", "}" ]
Draws gauge bar @param {Canvas2DContext} context @param {LinearGaugeOptions} options @param {number} x x-coordinate of the top-left corner of the gauge @param {number} y y-coordinate of the top-left corner of the gauge @param {number} w width of the gauge @param {number} h height of the gauge
[ "Draws", "gauge", "bar" ]
8f1a0936951be63f612e16443eb7b2235863679e
https://github.com/Mikhus/canvas-gauges/blob/8f1a0936951be63f612e16443eb7b2235863679e/lib/LinearGauge.js#L467-L469
train
Teradata/covalent
scripts/version-placeholders.js
replaceVersionPlaceholders
function replaceVersionPlaceholders(packageDir, projectVersion) { // Resolve files that contain version placeholders using Grep or Findstr since those are // extremely fast and also have a very simple usage. const files = findFilesWithPlaceholders(packageDir); // Walk through every file that contains version p...
javascript
function replaceVersionPlaceholders(packageDir, projectVersion) { // Resolve files that contain version placeholders using Grep or Findstr since those are // extremely fast and also have a very simple usage. const files = findFilesWithPlaceholders(packageDir); // Walk through every file that contains version p...
[ "function", "replaceVersionPlaceholders", "(", "packageDir", ",", "projectVersion", ")", "{", "// Resolve files that contain version placeholders using Grep or Findstr since those are", "// extremely fast and also have a very simple usage.", "const", "files", "=", "findFilesWithPlaceholder...
Walks through every file in a directory and replaces the version placeholders
[ "Walks", "through", "every", "file", "in", "a", "directory", "and", "replaces", "the", "version", "placeholders" ]
75e047408b21b95689b669b8851c41dd3f844204
https://github.com/Teradata/covalent/blob/75e047408b21b95689b669b8851c41dd3f844204/scripts/version-placeholders.js#L28-L43
train
Teradata/covalent
scripts/version-placeholders.js
findFilesWithPlaceholders
function findFilesWithPlaceholders(packageDir) { const findCommand = buildPlaceholderFindCommand(packageDir); return spawnSync(findCommand.binary, findCommand.args).stdout .toString() .split(/[\n\r]/) .filter(String); }
javascript
function findFilesWithPlaceholders(packageDir) { const findCommand = buildPlaceholderFindCommand(packageDir); return spawnSync(findCommand.binary, findCommand.args).stdout .toString() .split(/[\n\r]/) .filter(String); }
[ "function", "findFilesWithPlaceholders", "(", "packageDir", ")", "{", "const", "findCommand", "=", "buildPlaceholderFindCommand", "(", "packageDir", ")", ";", "return", "spawnSync", "(", "findCommand", ".", "binary", ",", "findCommand", ".", "args", ")", ".", "std...
Finds all files in the specified package dir where version placeholders are included.
[ "Finds", "all", "files", "in", "the", "specified", "package", "dir", "where", "version", "placeholders", "are", "included", "." ]
75e047408b21b95689b669b8851c41dd3f844204
https://github.com/Teradata/covalent/blob/75e047408b21b95689b669b8851c41dd3f844204/scripts/version-placeholders.js#L46-L52
train
Teradata/covalent
scripts/version-placeholders.js
buildPlaceholderFindCommand
function buildPlaceholderFindCommand(packageDir) { if (platform() === 'win32') { return { binary: 'findstr', args: ['/msi', `${materialVersionPlaceholderText} ${ngVersionPlaceholderText} ${versionPlaceholderText}`, `${packageDir}\\*`] }; } else { return { binary: 'grep', args: ['...
javascript
function buildPlaceholderFindCommand(packageDir) { if (platform() === 'win32') { return { binary: 'findstr', args: ['/msi', `${materialVersionPlaceholderText} ${ngVersionPlaceholderText} ${versionPlaceholderText}`, `${packageDir}\\*`] }; } else { return { binary: 'grep', args: ['...
[ "function", "buildPlaceholderFindCommand", "(", "packageDir", ")", "{", "if", "(", "platform", "(", ")", "===", "'win32'", ")", "{", "return", "{", "binary", ":", "'findstr'", ",", "args", ":", "[", "'/msi'", ",", "`", "${", "materialVersionPlaceholderText", ...
Builds the command that will be executed to find all files containing version placeholders.
[ "Builds", "the", "command", "that", "will", "be", "executed", "to", "find", "all", "files", "containing", "version", "placeholders", "." ]
75e047408b21b95689b669b8851c41dd3f844204
https://github.com/Teradata/covalent/blob/75e047408b21b95689b669b8851c41dd3f844204/scripts/version-placeholders.js#L55-L67
train
exokitxr/exokit
src/DOM.js
_cloneNode
function _cloneNode(deep, sourceNode, parentNode) { const clone = new sourceNode.constructor(sourceNode[symbols.windowSymbol]); clone.attrs = sourceNode.attrs; clone.tagName = sourceNode.tagName; clone.value = sourceNode.value; // Link the parent. if (parentNode) { clone.parentNode = parentNode; } // Co...
javascript
function _cloneNode(deep, sourceNode, parentNode) { const clone = new sourceNode.constructor(sourceNode[symbols.windowSymbol]); clone.attrs = sourceNode.attrs; clone.tagName = sourceNode.tagName; clone.value = sourceNode.value; // Link the parent. if (parentNode) { clone.parentNode = parentNode; } // Co...
[ "function", "_cloneNode", "(", "deep", ",", "sourceNode", ",", "parentNode", ")", "{", "const", "clone", "=", "new", "sourceNode", ".", "constructor", "(", "sourceNode", "[", "symbols", ".", "windowSymbol", "]", ")", ";", "clone", ".", "attrs", "=", "sourc...
Clone node. Internal function to not expose the `sourceNode` and `parentNode` args used to facilitate recursive cloning. @param {boolean} deep - Recursive. @param {object} sourceNode - Node to clone. @param {parentNode} parentNode - Used for recursive cloning to attach parent.
[ "Clone", "node", ".", "Internal", "function", "to", "not", "expose", "the", "sourceNode", "and", "parentNode", "args", "used", "to", "facilitate", "recursive", "cloning", "." ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/src/DOM.js#L270-L289
train
exokitxr/exokit
examples/FBXLoader.js
function () { var images = {}; var blobs = {}; if ( 'Video' in fbxTree.Objects ) { var videoNodes = fbxTree.Objects.Video; for ( var nodeID in videoNodes ) { var videoNode = videoNodes[ nodeID ]; var id = parseInt( nodeID ); images[ id ] = videoNode.RelativeFilename || videoNode.F...
javascript
function () { var images = {}; var blobs = {}; if ( 'Video' in fbxTree.Objects ) { var videoNodes = fbxTree.Objects.Video; for ( var nodeID in videoNodes ) { var videoNode = videoNodes[ nodeID ]; var id = parseInt( nodeID ); images[ id ] = videoNode.RelativeFilename || videoNode.F...
[ "function", "(", ")", "{", "var", "images", "=", "{", "}", ";", "var", "blobs", "=", "{", "}", ";", "if", "(", "'Video'", "in", "fbxTree", ".", "Objects", ")", "{", "var", "videoNodes", "=", "fbxTree", ".", "Objects", ".", "Video", ";", "for", "(...
Parse FBXTree.Objects.Video for embedded image data These images are connected to textures in FBXTree.Objects.Textures via FBXTree.Connections.
[ "Parse", "FBXTree", ".", "Objects", ".", "Video", "for", "embedded", "image", "data", "These", "images", "are", "connected", "to", "textures", "in", "FBXTree", ".", "Objects", ".", "Textures", "via", "FBXTree", ".", "Connections", "." ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L190-L238
train
exokitxr/exokit
examples/FBXLoader.js
function ( videoNode ) { var content = videoNode.Content; var fileName = videoNode.RelativeFilename || videoNode.Filename; var extension = fileName.slice( fileName.lastIndexOf( '.' ) + 1 ).toLowerCase(); var type; switch ( extension ) { case 'bmp': type = 'image/bmp'; break; case ...
javascript
function ( videoNode ) { var content = videoNode.Content; var fileName = videoNode.RelativeFilename || videoNode.Filename; var extension = fileName.slice( fileName.lastIndexOf( '.' ) + 1 ).toLowerCase(); var type; switch ( extension ) { case 'bmp': type = 'image/bmp'; break; case ...
[ "function", "(", "videoNode", ")", "{", "var", "content", "=", "videoNode", ".", "Content", ";", "var", "fileName", "=", "videoNode", ".", "RelativeFilename", "||", "videoNode", ".", "Filename", ";", "var", "extension", "=", "fileName", ".", "slice", "(", ...
Parse embedded image data in FBXTree.Video.Content
[ "Parse", "embedded", "image", "data", "in", "FBXTree", ".", "Video", ".", "Content" ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L241-L310
train
exokitxr/exokit
examples/FBXLoader.js
function ( images ) { var textureMap = new Map(); if ( 'Texture' in fbxTree.Objects ) { var textureNodes = fbxTree.Objects.Texture; for ( var nodeID in textureNodes ) { var texture = this.parseTexture( textureNodes[ nodeID ], images ); textureMap.set( parseInt( nodeID ), texture ); } ...
javascript
function ( images ) { var textureMap = new Map(); if ( 'Texture' in fbxTree.Objects ) { var textureNodes = fbxTree.Objects.Texture; for ( var nodeID in textureNodes ) { var texture = this.parseTexture( textureNodes[ nodeID ], images ); textureMap.set( parseInt( nodeID ), texture ); } ...
[ "function", "(", "images", ")", "{", "var", "textureMap", "=", "new", "Map", "(", ")", ";", "if", "(", "'Texture'", "in", "fbxTree", ".", "Objects", ")", "{", "var", "textureNodes", "=", "fbxTree", ".", "Objects", ".", "Texture", ";", "for", "(", "va...
Parse nodes in FBXTree.Objects.Texture These contain details such as UV scaling, cropping, rotation etc and are connected to images in FBXTree.Objects.Video
[ "Parse", "nodes", "in", "FBXTree", ".", "Objects", ".", "Texture", "These", "contain", "details", "such", "as", "UV", "scaling", "cropping", "rotation", "etc", "and", "are", "connected", "to", "images", "in", "FBXTree", ".", "Objects", ".", "Video" ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L315-L333
train
exokitxr/exokit
examples/FBXLoader.js
function ( textureNode, images ) { var texture = this.loadTexture( textureNode, images ); texture.ID = textureNode.id; texture.name = textureNode.attrName; var wrapModeU = textureNode.WrapModeU; var wrapModeV = textureNode.WrapModeV; var valueU = wrapModeU !== undefined ? wrapModeU.value : 0; ...
javascript
function ( textureNode, images ) { var texture = this.loadTexture( textureNode, images ); texture.ID = textureNode.id; texture.name = textureNode.attrName; var wrapModeU = textureNode.WrapModeU; var wrapModeV = textureNode.WrapModeV; var valueU = wrapModeU !== undefined ? wrapModeU.value : 0; ...
[ "function", "(", "textureNode", ",", "images", ")", "{", "var", "texture", "=", "this", ".", "loadTexture", "(", "textureNode", ",", "images", ")", ";", "texture", ".", "ID", "=", "textureNode", ".", "id", ";", "texture", ".", "name", "=", "textureNode",...
Parse individual node in FBXTree.Objects.Texture
[ "Parse", "individual", "node", "in", "FBXTree", ".", "Objects", ".", "Texture" ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L336-L367
train
exokitxr/exokit
examples/FBXLoader.js
function ( textureNode, images ) { var fileName; var currentPath = this.textureLoader.path; var children = connections.get( textureNode.id ).children; if ( children !== undefined && children.length > 0 && images[ children[ 0 ].ID ] !== undefined ) { fileName = images[ children[ 0 ].ID ]; if ( ...
javascript
function ( textureNode, images ) { var fileName; var currentPath = this.textureLoader.path; var children = connections.get( textureNode.id ).children; if ( children !== undefined && children.length > 0 && images[ children[ 0 ].ID ] !== undefined ) { fileName = images[ children[ 0 ].ID ]; if ( ...
[ "function", "(", "textureNode", ",", "images", ")", "{", "var", "fileName", ";", "var", "currentPath", "=", "this", ".", "textureLoader", ".", "path", ";", "var", "children", "=", "connections", ".", "get", "(", "textureNode", ".", "id", ")", ".", "child...
load a texture specified as a blob or data URI, or via an external URL using THREE.TextureLoader
[ "load", "a", "texture", "specified", "as", "a", "blob", "or", "data", "URI", "or", "via", "an", "external", "URL", "using", "THREE", ".", "TextureLoader" ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L370-L424
train
exokitxr/exokit
examples/FBXLoader.js
function ( textureMap ) { var materialMap = new Map(); if ( 'Material' in fbxTree.Objects ) { var materialNodes = fbxTree.Objects.Material; for ( var nodeID in materialNodes ) { var material = this.parseMaterial( materialNodes[ nodeID ], textureMap ); if ( material !== null ) materialMap.s...
javascript
function ( textureMap ) { var materialMap = new Map(); if ( 'Material' in fbxTree.Objects ) { var materialNodes = fbxTree.Objects.Material; for ( var nodeID in materialNodes ) { var material = this.parseMaterial( materialNodes[ nodeID ], textureMap ); if ( material !== null ) materialMap.s...
[ "function", "(", "textureMap", ")", "{", "var", "materialMap", "=", "new", "Map", "(", ")", ";", "if", "(", "'Material'", "in", "fbxTree", ".", "Objects", ")", "{", "var", "materialNodes", "=", "fbxTree", ".", "Objects", ".", "Material", ";", "for", "(...
Parse nodes in FBXTree.Objects.Material
[ "Parse", "nodes", "in", "FBXTree", ".", "Objects", ".", "Material" ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L427-L447
train
exokitxr/exokit
examples/FBXLoader.js
function ( materialNode, textureMap ) { var ID = materialNode.id; var name = materialNode.attrName; var type = materialNode.ShadingModel; // Case where FBX wraps shading model in property object. if ( typeof type === 'object' ) { type = type.value; } // Ignore unused materials which don't ...
javascript
function ( materialNode, textureMap ) { var ID = materialNode.id; var name = materialNode.attrName; var type = materialNode.ShadingModel; // Case where FBX wraps shading model in property object. if ( typeof type === 'object' ) { type = type.value; } // Ignore unused materials which don't ...
[ "function", "(", "materialNode", ",", "textureMap", ")", "{", "var", "ID", "=", "materialNode", ".", "id", ";", "var", "name", "=", "materialNode", ".", "attrName", ";", "var", "type", "=", "materialNode", ".", "ShadingModel", ";", "// Case where FBX wraps sha...
Parse single node in FBXTree.Objects.Material Materials are connected to texture maps in FBXTree.Objects.Textures FBX format currently only supports Lambert and Phong shading models
[ "Parse", "single", "node", "in", "FBXTree", ".", "Objects", ".", "Material", "Materials", "are", "connected", "to", "texture", "maps", "in", "FBXTree", ".", "Objects", ".", "Textures", "FBX", "format", "currently", "only", "supports", "Lambert", "and", "Phong"...
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L452-L492
train
exokitxr/exokit
examples/FBXLoader.js
function ( textureMap, id ) { // if the texture is a layered texture, just use the first layer and issue a warning if ( 'LayeredTexture' in fbxTree.Objects && id in fbxTree.Objects.LayeredTexture ) { console.warn( 'THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first lay...
javascript
function ( textureMap, id ) { // if the texture is a layered texture, just use the first layer and issue a warning if ( 'LayeredTexture' in fbxTree.Objects && id in fbxTree.Objects.LayeredTexture ) { console.warn( 'THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first lay...
[ "function", "(", "textureMap", ",", "id", ")", "{", "// if the texture is a layered texture, just use the first layer and issue a warning", "if", "(", "'LayeredTexture'", "in", "fbxTree", ".", "Objects", "&&", "id", "in", "fbxTree", ".", "Objects", ".", "LayeredTexture", ...
get a texture from the textureMap for use by a material.
[ "get", "a", "texture", "from", "the", "textureMap", "for", "use", "by", "a", "material", "." ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L625-L637
train
exokitxr/exokit
examples/FBXLoader.js
function () { var skeletons = {}; var morphTargets = {}; if ( 'Deformer' in fbxTree.Objects ) { var DeformerNodes = fbxTree.Objects.Deformer; for ( var nodeID in DeformerNodes ) { var deformerNode = DeformerNodes[ nodeID ]; var relationships = connections.get( parseInt( nodeID ) ); ...
javascript
function () { var skeletons = {}; var morphTargets = {}; if ( 'Deformer' in fbxTree.Objects ) { var DeformerNodes = fbxTree.Objects.Deformer; for ( var nodeID in DeformerNodes ) { var deformerNode = DeformerNodes[ nodeID ]; var relationships = connections.get( parseInt( nodeID ) ); ...
[ "function", "(", ")", "{", "var", "skeletons", "=", "{", "}", ";", "var", "morphTargets", "=", "{", "}", ";", "if", "(", "'Deformer'", "in", "fbxTree", ".", "Objects", ")", "{", "var", "DeformerNodes", "=", "fbxTree", ".", "Objects", ".", "Deformer", ...
Parse nodes in FBXTree.Objects.Deformer Deformer node can contain skinning or Vertex Cache animation data, however only skinning is supported here Generates map of Skeleton-like objects for use later when generating and binding skeletons.
[ "Parse", "nodes", "in", "FBXTree", ".", "Objects", ".", "Deformer", "Deformer", "node", "can", "contain", "skinning", "or", "Vertex", "Cache", "animation", "data", "however", "only", "skinning", "is", "supported", "here", "Generates", "map", "of", "Skeleton", ...
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L642-L693
train
exokitxr/exokit
examples/FBXLoader.js
function ( relationships, deformerNodes ) { var rawBones = []; relationships.children.forEach( function ( child ) { var boneNode = deformerNodes[ child.ID ]; if ( boneNode.attrType !== 'Cluster' ) return; var rawBone = { ID: child.ID, indices: [], weights: [], transform: new ...
javascript
function ( relationships, deformerNodes ) { var rawBones = []; relationships.children.forEach( function ( child ) { var boneNode = deformerNodes[ child.ID ]; if ( boneNode.attrType !== 'Cluster' ) return; var rawBone = { ID: child.ID, indices: [], weights: [], transform: new ...
[ "function", "(", "relationships", ",", "deformerNodes", ")", "{", "var", "rawBones", "=", "[", "]", ";", "relationships", ".", "children", ".", "forEach", "(", "function", "(", "child", ")", "{", "var", "boneNode", "=", "deformerNodes", "[", "child", ".", ...
Parse single nodes in FBXTree.Objects.Deformer The top level skeleton node has type 'Skin' and sub nodes have type 'Cluster' Each skin node represents a skeleton and each cluster node represents a bone
[ "Parse", "single", "nodes", "in", "FBXTree", ".", "Objects", ".", "Deformer", "The", "top", "level", "skeleton", "node", "has", "type", "Skin", "and", "sub", "nodes", "have", "type", "Cluster", "Each", "skin", "node", "represents", "a", "skeleton", "and", ...
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L698-L737
train
exokitxr/exokit
examples/FBXLoader.js
function ( relationships, deformerNodes ) { var rawMorphTargets = []; for ( var i = 0; i < relationships.children.length; i ++ ) { if ( i === 8 ) { console.warn( 'FBXLoader: maximum of 8 morph targets supported. Ignoring additional targets.' ); break; } var child = relationships.child...
javascript
function ( relationships, deformerNodes ) { var rawMorphTargets = []; for ( var i = 0; i < relationships.children.length; i ++ ) { if ( i === 8 ) { console.warn( 'FBXLoader: maximum of 8 morph targets supported. Ignoring additional targets.' ); break; } var child = relationships.child...
[ "function", "(", "relationships", ",", "deformerNodes", ")", "{", "var", "rawMorphTargets", "=", "[", "]", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "relationships", ".", "children", ".", "length", ";", "i", "++", ")", "{", "if", "(", "...
The top level morph deformer node has type "BlendShape" and sub nodes have type "BlendShapeChannel"
[ "The", "top", "level", "morph", "deformer", "node", "has", "type", "BlendShape", "and", "sub", "nodes", "have", "type", "BlendShapeChannel" ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L740-L783
train
exokitxr/exokit
examples/FBXLoader.js
function ( skeletons, geometryMap, materialMap ) { var modelMap = new Map(); var modelNodes = fbxTree.Objects.Model; for ( var nodeID in modelNodes ) { var id = parseInt( nodeID ); var node = modelNodes[ nodeID ]; var relationships = connections.get( id ); var model = this.buildSkeleton( re...
javascript
function ( skeletons, geometryMap, materialMap ) { var modelMap = new Map(); var modelNodes = fbxTree.Objects.Model; for ( var nodeID in modelNodes ) { var id = parseInt( nodeID ); var node = modelNodes[ nodeID ]; var relationships = connections.get( id ); var model = this.buildSkeleton( re...
[ "function", "(", "skeletons", ",", "geometryMap", ",", "materialMap", ")", "{", "var", "modelMap", "=", "new", "Map", "(", ")", ";", "var", "modelNodes", "=", "fbxTree", ".", "Objects", ".", "Model", ";", "for", "(", "var", "nodeID", "in", "modelNodes", ...
parse nodes in FBXTree.Objects.Model
[ "parse", "nodes", "in", "FBXTree", ".", "Objects", ".", "Model" ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L839-L888
train
exokitxr/exokit
examples/FBXLoader.js
function ( relationships ) { var model; var cameraAttribute; relationships.children.forEach( function ( child ) { var attr = fbxTree.Objects.NodeAttribute[ child.ID ]; if ( attr !== undefined ) { cameraAttribute = attr; } } ); if ( cameraAttribute === undefined ) { model = n...
javascript
function ( relationships ) { var model; var cameraAttribute; relationships.children.forEach( function ( child ) { var attr = fbxTree.Objects.NodeAttribute[ child.ID ]; if ( attr !== undefined ) { cameraAttribute = attr; } } ); if ( cameraAttribute === undefined ) { model = n...
[ "function", "(", "relationships", ")", "{", "var", "model", ";", "var", "cameraAttribute", ";", "relationships", ".", "children", ".", "forEach", "(", "function", "(", "child", ")", "{", "var", "attr", "=", "fbxTree", ".", "Objects", ".", "NodeAttribute", ...
create a THREE.PerspectiveCamera or THREE.OrthographicCamera
[ "create", "a", "THREE", ".", "PerspectiveCamera", "or", "THREE", ".", "OrthographicCamera" ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L935-L1023
train
exokitxr/exokit
examples/FBXLoader.js
function ( relationships ) { var model; var lightAttribute; relationships.children.forEach( function ( child ) { var attr = fbxTree.Objects.NodeAttribute[ child.ID ]; if ( attr !== undefined ) { lightAttribute = attr; } } ); if ( lightAttribute === undefined ) { model = new ...
javascript
function ( relationships ) { var model; var lightAttribute; relationships.children.forEach( function ( child ) { var attr = fbxTree.Objects.NodeAttribute[ child.ID ]; if ( attr !== undefined ) { lightAttribute = attr; } } ); if ( lightAttribute === undefined ) { model = new ...
[ "function", "(", "relationships", ")", "{", "var", "model", ";", "var", "lightAttribute", ";", "relationships", ".", "children", ".", "forEach", "(", "function", "(", "child", ")", "{", "var", "attr", "=", "fbxTree", ".", "Objects", ".", "NodeAttribute", "...
Create a THREE.DirectionalLight, THREE.PointLight or THREE.SpotLight
[ "Create", "a", "THREE", ".", "DirectionalLight", "THREE", ".", "PointLight", "or", "THREE", ".", "SpotLight" ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L1026-L1147
train
exokitxr/exokit
examples/FBXLoader.js
function ( deformers ) { var geometryMap = new Map(); if ( 'Geometry' in fbxTree.Objects ) { var geoNodes = fbxTree.Objects.Geometry; for ( var nodeID in geoNodes ) { var relationships = connections.get( parseInt( nodeID ) ); var geo = this.parseGeometry( relationships, geoNodes[ nodeID ], ...
javascript
function ( deformers ) { var geometryMap = new Map(); if ( 'Geometry' in fbxTree.Objects ) { var geoNodes = fbxTree.Objects.Geometry; for ( var nodeID in geoNodes ) { var relationships = connections.get( parseInt( nodeID ) ); var geo = this.parseGeometry( relationships, geoNodes[ nodeID ], ...
[ "function", "(", "deformers", ")", "{", "var", "geometryMap", "=", "new", "Map", "(", ")", ";", "if", "(", "'Geometry'", "in", "fbxTree", ".", "Objects", ")", "{", "var", "geoNodes", "=", "fbxTree", ".", "Objects", ".", "Geometry", ";", "for", "(", "...
Parse nodes in FBXTree.Objects.Geometry
[ "Parse", "nodes", "in", "FBXTree", ".", "Objects", ".", "Geometry" ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L1433-L1454
train
exokitxr/exokit
examples/FBXLoader.js
function ( relationships, geoNode, deformers ) { switch ( geoNode.attrType ) { case 'Mesh': return this.parseMeshGeometry( relationships, geoNode, deformers ); break; case 'NurbsCurve': return this.parseNurbsGeometry( geoNode ); break; } }
javascript
function ( relationships, geoNode, deformers ) { switch ( geoNode.attrType ) { case 'Mesh': return this.parseMeshGeometry( relationships, geoNode, deformers ); break; case 'NurbsCurve': return this.parseNurbsGeometry( geoNode ); break; } }
[ "function", "(", "relationships", ",", "geoNode", ",", "deformers", ")", "{", "switch", "(", "geoNode", ".", "attrType", ")", "{", "case", "'Mesh'", ":", "return", "this", ".", "parseMeshGeometry", "(", "relationships", ",", "geoNode", ",", "deformers", ")",...
Parse single node in FBXTree.Objects.Geometry
[ "Parse", "single", "node", "in", "FBXTree", ".", "Objects", ".", "Geometry" ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L1457-L1471
train
exokitxr/exokit
examples/FBXLoader.js
function ( relationships, geoNode, deformers ) { var skeletons = deformers.skeletons; var morphTargets = deformers.morphTargets; var modelNodes = relationships.parents.map( function ( parent ) { return fbxTree.Objects.Model[ parent.ID ]; } ); // don't create geometry if it is not associated with...
javascript
function ( relationships, geoNode, deformers ) { var skeletons = deformers.skeletons; var morphTargets = deformers.morphTargets; var modelNodes = relationships.parents.map( function ( parent ) { return fbxTree.Objects.Model[ parent.ID ]; } ); // don't create geometry if it is not associated with...
[ "function", "(", "relationships", ",", "geoNode", ",", "deformers", ")", "{", "var", "skeletons", "=", "deformers", ".", "skeletons", ";", "var", "morphTargets", "=", "deformers", ".", "morphTargets", ";", "var", "modelNodes", "=", "relationships", ".", "paren...
Parse single node mesh geometry in FBXTree.Objects.Geometry
[ "Parse", "single", "node", "mesh", "geometry", "in", "FBXTree", ".", "Objects", ".", "Geometry" ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L1474-L1522
train
exokitxr/exokit
examples/FBXLoader.js
function ( geoNode, skeleton, morphTarget, preTransform ) { var geo = new THREE.BufferGeometry(); if ( geoNode.attrName ) geo.name = geoNode.attrName; var geoInfo = this.parseGeoNode( geoNode, skeleton ); var buffers = this.genBuffers( geoInfo ); var positionAttribute = new THREE.Float32BufferAttribut...
javascript
function ( geoNode, skeleton, morphTarget, preTransform ) { var geo = new THREE.BufferGeometry(); if ( geoNode.attrName ) geo.name = geoNode.attrName; var geoInfo = this.parseGeoNode( geoNode, skeleton ); var buffers = this.genBuffers( geoInfo ); var positionAttribute = new THREE.Float32BufferAttribut...
[ "function", "(", "geoNode", ",", "skeleton", ",", "morphTarget", ",", "preTransform", ")", "{", "var", "geo", "=", "new", "THREE", ".", "BufferGeometry", "(", ")", ";", "if", "(", "geoNode", ".", "attrName", ")", "geo", ".", "name", "=", "geoNode", "."...
Generate a THREE.BufferGeometry from a node in FBXTree.Objects.Geometry
[ "Generate", "a", "THREE", ".", "BufferGeometry", "from", "a", "node", "in", "FBXTree", ".", "Objects", ".", "Geometry" ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L1525-L1630
train
exokitxr/exokit
examples/FBXLoader.js
function ( parentGeo, parentGeoNode, morphGeoNode, preTransform ) { var morphGeo = new THREE.BufferGeometry(); if ( morphGeoNode.attrName ) morphGeo.name = morphGeoNode.attrName; var vertexIndices = ( parentGeoNode.PolygonVertexIndex !== undefined ) ? parentGeoNode.PolygonVertexIndex.a : []; // make a co...
javascript
function ( parentGeo, parentGeoNode, morphGeoNode, preTransform ) { var morphGeo = new THREE.BufferGeometry(); if ( morphGeoNode.attrName ) morphGeo.name = morphGeoNode.attrName; var vertexIndices = ( parentGeoNode.PolygonVertexIndex !== undefined ) ? parentGeoNode.PolygonVertexIndex.a : []; // make a co...
[ "function", "(", "parentGeo", ",", "parentGeoNode", ",", "morphGeoNode", ",", "preTransform", ")", "{", "var", "morphGeo", "=", "new", "THREE", ".", "BufferGeometry", "(", ")", ";", "if", "(", "morphGeoNode", ".", "attrName", ")", "morphGeo", ".", "name", ...
a morph geometry node is similar to a standard node, and the node is also contained in FBXTree.Objects.Geometry, however it can only have attributes for position, normal and a special attribute Index defining which vertices of the original geometry are affected Normal and position attributes only have data for the ver...
[ "a", "morph", "geometry", "node", "is", "similar", "to", "a", "standard", "node", "and", "the", "node", "is", "also", "contained", "in", "FBXTree", ".", "Objects", ".", "Geometry", "however", "it", "can", "only", "have", "attributes", "for", "position", "n...
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L2025-L2065
train
exokitxr/exokit
examples/FBXLoader.js
function ( NormalNode ) { var mappingType = NormalNode.MappingInformationType; var referenceType = NormalNode.ReferenceInformationType; var buffer = NormalNode.Normals.a; var indexBuffer = []; if ( referenceType === 'IndexToDirect' ) { if ( 'NormalIndex' in NormalNode ) { indexBuffer = Normal...
javascript
function ( NormalNode ) { var mappingType = NormalNode.MappingInformationType; var referenceType = NormalNode.ReferenceInformationType; var buffer = NormalNode.Normals.a; var indexBuffer = []; if ( referenceType === 'IndexToDirect' ) { if ( 'NormalIndex' in NormalNode ) { indexBuffer = Normal...
[ "function", "(", "NormalNode", ")", "{", "var", "mappingType", "=", "NormalNode", ".", "MappingInformationType", ";", "var", "referenceType", "=", "NormalNode", ".", "ReferenceInformationType", ";", "var", "buffer", "=", "NormalNode", ".", "Normals", ".", "a", "...
Parse normal from FBXTree.Objects.Geometry.LayerElementNormal if it exists
[ "Parse", "normal", "from", "FBXTree", ".", "Objects", ".", "Geometry", ".", "LayerElementNormal", "if", "it", "exists" ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L2068-L2096
train
exokitxr/exokit
examples/FBXLoader.js
function ( UVNode ) { var mappingType = UVNode.MappingInformationType; var referenceType = UVNode.ReferenceInformationType; var buffer = UVNode.UV.a; var indexBuffer = []; if ( referenceType === 'IndexToDirect' ) { indexBuffer = UVNode.UVIndex.a; } return { dataSize: 2, buffer: buff...
javascript
function ( UVNode ) { var mappingType = UVNode.MappingInformationType; var referenceType = UVNode.ReferenceInformationType; var buffer = UVNode.UV.a; var indexBuffer = []; if ( referenceType === 'IndexToDirect' ) { indexBuffer = UVNode.UVIndex.a; } return { dataSize: 2, buffer: buff...
[ "function", "(", "UVNode", ")", "{", "var", "mappingType", "=", "UVNode", ".", "MappingInformationType", ";", "var", "referenceType", "=", "UVNode", ".", "ReferenceInformationType", ";", "var", "buffer", "=", "UVNode", ".", "UV", ".", "a", ";", "var", "index...
Parse UVs from FBXTree.Objects.Geometry.LayerElementUV if it exists
[ "Parse", "UVs", "from", "FBXTree", ".", "Objects", ".", "Geometry", ".", "LayerElementUV", "if", "it", "exists" ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L2099-L2119
train
exokitxr/exokit
examples/FBXLoader.js
function ( ColorNode ) { var mappingType = ColorNode.MappingInformationType; var referenceType = ColorNode.ReferenceInformationType; var buffer = ColorNode.Colors.a; var indexBuffer = []; if ( referenceType === 'IndexToDirect' ) { indexBuffer = ColorNode.ColorIndex.a; } return { dataSiz...
javascript
function ( ColorNode ) { var mappingType = ColorNode.MappingInformationType; var referenceType = ColorNode.ReferenceInformationType; var buffer = ColorNode.Colors.a; var indexBuffer = []; if ( referenceType === 'IndexToDirect' ) { indexBuffer = ColorNode.ColorIndex.a; } return { dataSiz...
[ "function", "(", "ColorNode", ")", "{", "var", "mappingType", "=", "ColorNode", ".", "MappingInformationType", ";", "var", "referenceType", "=", "ColorNode", ".", "ReferenceInformationType", ";", "var", "buffer", "=", "ColorNode", ".", "Colors", ".", "a", ";", ...
Parse Vertex Colors from FBXTree.Objects.Geometry.LayerElementColor if it exists
[ "Parse", "Vertex", "Colors", "from", "FBXTree", ".", "Objects", ".", "Geometry", ".", "LayerElementColor", "if", "it", "exists" ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L2122-L2142
train
exokitxr/exokit
examples/FBXLoader.js
function ( MaterialNode ) { var mappingType = MaterialNode.MappingInformationType; var referenceType = MaterialNode.ReferenceInformationType; if ( mappingType === 'NoMappingInformation' ) { return { dataSize: 1, buffer: [ 0 ], indices: [ 0 ], mappingType: 'AllSame', referenceTyp...
javascript
function ( MaterialNode ) { var mappingType = MaterialNode.MappingInformationType; var referenceType = MaterialNode.ReferenceInformationType; if ( mappingType === 'NoMappingInformation' ) { return { dataSize: 1, buffer: [ 0 ], indices: [ 0 ], mappingType: 'AllSame', referenceTyp...
[ "function", "(", "MaterialNode", ")", "{", "var", "mappingType", "=", "MaterialNode", ".", "MappingInformationType", ";", "var", "referenceType", "=", "MaterialNode", ".", "ReferenceInformationType", ";", "if", "(", "mappingType", "===", "'NoMappingInformation'", ")",...
Parse mapping and material data in FBXTree.Objects.Geometry.LayerElementMaterial if it exists
[ "Parse", "mapping", "and", "material", "data", "in", "FBXTree", ".", "Objects", ".", "Geometry", ".", "LayerElementMaterial", "if", "it", "exists" ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L2145-L2183
train
exokitxr/exokit
examples/FBXLoader.js
function ( geoNode ) { if ( THREE.NURBSCurve === undefined ) { console.error( 'THREE.FBXLoader: The loader relies on THREE.NURBSCurve for any nurbs present in the model. Nurbs will show up as empty geometry.' ); return new THREE.BufferGeometry(); } var order = parseInt( geoNode.Order ); if ( is...
javascript
function ( geoNode ) { if ( THREE.NURBSCurve === undefined ) { console.error( 'THREE.FBXLoader: The loader relies on THREE.NURBSCurve for any nurbs present in the model. Nurbs will show up as empty geometry.' ); return new THREE.BufferGeometry(); } var order = parseInt( geoNode.Order ); if ( is...
[ "function", "(", "geoNode", ")", "{", "if", "(", "THREE", ".", "NURBSCurve", "===", "undefined", ")", "{", "console", ".", "error", "(", "'THREE.FBXLoader: The loader relies on THREE.NURBSCurve for any nurbs present in the model. Nurbs will show up as empty geometry.'", ")", ...
Generate a NurbGeometry from a node in FBXTree.Objects.Geometry
[ "Generate", "a", "NurbGeometry", "from", "a", "node", "in", "FBXTree", ".", "Objects", ".", "Geometry" ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L2186-L2251
train
exokitxr/exokit
examples/FBXLoader.js
function () { var animationClips = []; var rawClips = this.parseClips(); if ( rawClips === undefined ) return; for ( var key in rawClips ) { var rawClip = rawClips[ key ]; var clip = this.addClip( rawClip ); animationClips.push( clip ); } return animationClips; }
javascript
function () { var animationClips = []; var rawClips = this.parseClips(); if ( rawClips === undefined ) return; for ( var key in rawClips ) { var rawClip = rawClips[ key ]; var clip = this.addClip( rawClip ); animationClips.push( clip ); } return animationClips; }
[ "function", "(", ")", "{", "var", "animationClips", "=", "[", "]", ";", "var", "rawClips", "=", "this", ".", "parseClips", "(", ")", ";", "if", "(", "rawClips", "===", "undefined", ")", "return", ";", "for", "(", "var", "key", "in", "rawClips", ")", ...
take raw animation clips and turn them into three.js animation clips
[ "take", "raw", "animation", "clips", "and", "turn", "them", "into", "three", ".", "js", "animation", "clips" ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L2263-L2284
train
exokitxr/exokit
examples/FBXLoader.js
function ( layersMap ) { var rawStacks = fbxTree.Objects.AnimationStack; // connect the stacks (clips) up to the layers var rawClips = {}; for ( var nodeID in rawStacks ) { var children = connections.get( parseInt( nodeID ) ).children; if ( children.length > 1 ) { // it seems like stacks ...
javascript
function ( layersMap ) { var rawStacks = fbxTree.Objects.AnimationStack; // connect the stacks (clips) up to the layers var rawClips = {}; for ( var nodeID in rawStacks ) { var children = connections.get( parseInt( nodeID ) ).children; if ( children.length > 1 ) { // it seems like stacks ...
[ "function", "(", "layersMap", ")", "{", "var", "rawStacks", "=", "fbxTree", ".", "Objects", ".", "AnimationStack", ";", "// connect the stacks (clips) up to the layers", "var", "rawClips", "=", "{", "}", ";", "for", "(", "var", "nodeID", "in", "rawStacks", ")", ...
parse nodes in FBXTree.Objects.AnimationStack. These are the top level node in the animation hierarchy. Each Stack node will be used to create a THREE.AnimationClip
[ "parse", "nodes", "in", "FBXTree", ".", "Objects", ".", "AnimationStack", ".", "These", "are", "the", "top", "level", "node", "in", "the", "animation", "hierarchy", ".", "Each", "Stack", "node", "will", "be", "used", "to", "create", "a", "THREE", ".", "A...
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L2525-L2557
train
exokitxr/exokit
examples/FBXLoader.js
function ( curves ) { var times = []; // first join together the times for each axis, if defined if ( curves.x !== undefined ) times = times.concat( curves.x.times ); if ( curves.y !== undefined ) times = times.concat( curves.y.times ); if ( curves.z !== undefined ) times = times.concat( curves.z.times...
javascript
function ( curves ) { var times = []; // first join together the times for each axis, if defined if ( curves.x !== undefined ) times = times.concat( curves.x.times ); if ( curves.y !== undefined ) times = times.concat( curves.y.times ); if ( curves.z !== undefined ) times = times.concat( curves.z.times...
[ "function", "(", "curves", ")", "{", "var", "times", "=", "[", "]", ";", "// first join together the times for each axis, if defined", "if", "(", "curves", ".", "x", "!==", "undefined", ")", "times", "=", "times", ".", "concat", "(", "curves", ".", "x", ".",...
For all animated objects, times are defined separately for each axis Here we'll combine the times into one sorted array without duplicates
[ "For", "all", "animated", "objects", "times", "are", "defined", "separately", "for", "each", "axis", "Here", "we", "ll", "combine", "the", "times", "into", "one", "sorted", "array", "without", "duplicates" ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L2712-L2734
train
exokitxr/exokit
examples/FBXLoader.js
function ( curve ) { for ( var i = 1; i < curve.values.length; i ++ ) { var initialValue = curve.values[ i - 1 ]; var valuesSpan = curve.values[ i ] - initialValue; var absoluteSpan = Math.abs( valuesSpan ); if ( absoluteSpan >= 180 ) { var numSubIntervals = absoluteSpan / 180; var st...
javascript
function ( curve ) { for ( var i = 1; i < curve.values.length; i ++ ) { var initialValue = curve.values[ i - 1 ]; var valuesSpan = curve.values[ i ] - initialValue; var absoluteSpan = Math.abs( valuesSpan ); if ( absoluteSpan >= 180 ) { var numSubIntervals = absoluteSpan / 180; var st...
[ "function", "(", "curve", ")", "{", "for", "(", "var", "i", "=", "1", ";", "i", "<", "curve", ".", "values", ".", "length", ";", "i", "++", ")", "{", "var", "initialValue", "=", "curve", ".", "values", "[", "i", "-", "1", "]", ";", "var", "va...
Rotations are defined as Euler angles which can have values of any size These will be converted to quaternions which don't support values greater than PI, so we'll interpolate large rotations
[ "Rotations", "are", "defined", "as", "Euler", "angles", "which", "can", "have", "values", "of", "any", "size", "These", "will", "be", "converted", "to", "quaternions", "which", "don", "t", "support", "values", "greater", "than", "PI", "so", "we", "ll", "in...
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L2799-L2840
train
exokitxr/exokit
examples/FBXLoader.js
function ( reader ) { // footer size: 160bytes + 16-byte alignment padding // - 16bytes: magic // - padding til 16-byte alignment (at least 1byte?) // (seems like some exporters embed fixed 15 or 16bytes?) // - 4bytes: magic // - 4bytes: version // - 120bytes: zero // - 16bytes: magic if ( r...
javascript
function ( reader ) { // footer size: 160bytes + 16-byte alignment padding // - 16bytes: magic // - padding til 16-byte alignment (at least 1byte?) // (seems like some exporters embed fixed 15 or 16bytes?) // - 4bytes: magic // - 4bytes: version // - 120bytes: zero // - 16bytes: magic if ( r...
[ "function", "(", "reader", ")", "{", "// footer size: 160bytes + 16-byte alignment padding", "// - 16bytes: magic", "// - padding til 16-byte alignment (at least 1byte?)", "//\t(seems like some exporters embed fixed 15 or 16bytes?)", "// - 4bytes: magic", "// - 4bytes: version", "// - 120bytes...
Check if reader has reached the end of content.
[ "Check", "if", "reader", "has", "reached", "the", "end", "of", "content", "." ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L3212-L3232
train
exokitxr/exokit
examples/FBXLoader.js
function ( reader, version ) { var node = {}; // The first three data sizes depends on version. var endOffset = ( version >= 7500 ) ? reader.getUint64() : reader.getUint32(); var numProperties = ( version >= 7500 ) ? reader.getUint64() : reader.getUint32(); // note: do not remove this even if you get ...
javascript
function ( reader, version ) { var node = {}; // The first three data sizes depends on version. var endOffset = ( version >= 7500 ) ? reader.getUint64() : reader.getUint32(); var numProperties = ( version >= 7500 ) ? reader.getUint64() : reader.getUint32(); // note: do not remove this even if you get ...
[ "function", "(", "reader", ",", "version", ")", "{", "var", "node", "=", "{", "}", ";", "// The first three data sizes depends on version.", "var", "endOffset", "=", "(", "version", ">=", "7500", ")", "?", "reader", ".", "getUint64", "(", ")", ":", "reader",...
recursively parse nodes until the end of the file is reached
[ "recursively", "parse", "nodes", "until", "the", "end", "of", "the", "file", "is", "reached" ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L3235-L3286
train
exokitxr/exokit
examples/FBXLoader.js
getData
function getData( polygonVertexIndex, polygonIndex, vertexIndex, infoObject ) { var index; switch ( infoObject.mappingType ) { case 'ByPolygonVertex' : index = polygonVertexIndex; break; case 'ByPolygon' : index = polygonIndex; break; case 'ByVertice' : index = vertexIndex; break...
javascript
function getData( polygonVertexIndex, polygonIndex, vertexIndex, infoObject ) { var index; switch ( infoObject.mappingType ) { case 'ByPolygonVertex' : index = polygonVertexIndex; break; case 'ByPolygon' : index = polygonIndex; break; case 'ByVertice' : index = vertexIndex; break...
[ "function", "getData", "(", "polygonVertexIndex", ",", "polygonIndex", ",", "vertexIndex", ",", "infoObject", ")", "{", "var", "index", ";", "switch", "(", "infoObject", ".", "mappingType", ")", "{", "case", "'ByPolygonVertex'", ":", "index", "=", "polygonVertex...
extracts the data from the correct position in the FBX array based on indexing type
[ "extracts", "the", "data", "from", "the", "correct", "position", "in", "the", "FBX", "array", "based", "on", "indexing", "type" ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L3836-L3866
train
exokitxr/exokit
examples/FBXLoader.js
parseNumberArray
function parseNumberArray( value ) { var array = value.split( ',' ).map( function ( val ) { return parseFloat( val ); } ); return array; }
javascript
function parseNumberArray( value ) { var array = value.split( ',' ).map( function ( val ) { return parseFloat( val ); } ); return array; }
[ "function", "parseNumberArray", "(", "value", ")", "{", "var", "array", "=", "value", ".", "split", "(", "','", ")", ".", "map", "(", "function", "(", "val", ")", "{", "return", "parseFloat", "(", "val", ")", ";", "}", ")", ";", "return", "array", ...
Parses comma separated list of numbers and returns them an array. Used internally by the TextParser
[ "Parses", "comma", "separated", "list", "of", "numbers", "and", "returns", "them", "an", "array", ".", "Used", "internally", "by", "the", "TextParser" ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L3963-L3973
train
exokitxr/exokit
examples/FBXLoader.js
inject
function inject( a1, index, a2 ) { return a1.slice( 0, index ).concat( a2 ).concat( a1.slice( index ) ); }
javascript
function inject( a1, index, a2 ) { return a1.slice( 0, index ).concat( a2 ).concat( a1.slice( index ) ); }
[ "function", "inject", "(", "a1", ",", "index", ",", "a2", ")", "{", "return", "a1", ".", "slice", "(", "0", ",", "index", ")", ".", "concat", "(", "a2", ")", ".", "concat", "(", "a1", ".", "slice", "(", "index", ")", ")", ";", "}" ]
inject array a2 into array a1 at index
[ "inject", "array", "a2", "into", "array", "a1", "at", "index" ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/FBXLoader.js#L4007-L4011
train
exokitxr/exokit
examples/svg-boundings.js
expandXBounds
function expandXBounds(bounds, value) { if (bounds[MIN_X] > value) bounds[MIN_X] = value;else if (bounds[MAX_X] < value) bounds[MAX_X] = value; }
javascript
function expandXBounds(bounds, value) { if (bounds[MIN_X] > value) bounds[MIN_X] = value;else if (bounds[MAX_X] < value) bounds[MAX_X] = value; }
[ "function", "expandXBounds", "(", "bounds", ",", "value", ")", "{", "if", "(", "bounds", "[", "MIN_X", "]", ">", "value", ")", "bounds", "[", "MIN_X", "]", "=", "value", ";", "else", "if", "(", "bounds", "[", "MAX_X", "]", "<", "value", ")", "bound...
expand the x-bounds, if the value lies outside the bounding box
[ "expand", "the", "x", "-", "bounds", "if", "the", "value", "lies", "outside", "the", "bounding", "box" ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/svg-boundings.js#L272-L274
train
exokitxr/exokit
examples/svg-boundings.js
expandYBounds
function expandYBounds(bounds, value) { if (bounds[MIN_Y] > value) bounds[MIN_Y] = value;else if (bounds[MAX_Y] < value) bounds[MAX_Y] = value; }
javascript
function expandYBounds(bounds, value) { if (bounds[MIN_Y] > value) bounds[MIN_Y] = value;else if (bounds[MAX_Y] < value) bounds[MAX_Y] = value; }
[ "function", "expandYBounds", "(", "bounds", ",", "value", ")", "{", "if", "(", "bounds", "[", "MIN_Y", "]", ">", "value", ")", "bounds", "[", "MIN_Y", "]", "=", "value", ";", "else", "if", "(", "bounds", "[", "MAX_Y", "]", "<", "value", ")", "bound...
expand the y-bounds, if the value lies outside the bounding box
[ "expand", "the", "y", "-", "bounds", "if", "the", "value", "lies", "outside", "the", "bounding", "box" ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/svg-boundings.js#L279-L281
train
exokitxr/exokit
examples/svg-boundings.js
calculateBezier
function calculateBezier(t, p0, p1, p2, p3) { var mt = 1 - t; return mt * mt * mt * p0 + 3 * mt * mt * t * p1 + 3 * mt * t * t * p2 + t * t * t * p3; }
javascript
function calculateBezier(t, p0, p1, p2, p3) { var mt = 1 - t; return mt * mt * mt * p0 + 3 * mt * mt * t * p1 + 3 * mt * t * t * p2 + t * t * t * p3; }
[ "function", "calculateBezier", "(", "t", ",", "p0", ",", "p1", ",", "p2", ",", "p3", ")", "{", "var", "mt", "=", "1", "-", "t", ";", "return", "mt", "*", "mt", "*", "mt", "*", "p0", "+", "3", "*", "mt", "*", "mt", "*", "t", "*", "p1", "+"...
Calculate the bezier value for one dimension at distance 't'
[ "Calculate", "the", "bezier", "value", "for", "one", "dimension", "at", "distance", "t" ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/svg-boundings.js#L286-L289
train
exokitxr/exokit
examples/svg-boundings.js
function (str) { var output = []; var idx = 0; var c, num; var nextNumber = function () { var chars = []; while (/[^-\d\.]/.test(str.charAt(idx))) { // skip the non-digit characters idx++; } if ('-' === str.charAt(idx)) { chars.push('-'); idx++;...
javascript
function (str) { var output = []; var idx = 0; var c, num; var nextNumber = function () { var chars = []; while (/[^-\d\.]/.test(str.charAt(idx))) { // skip the non-digit characters idx++; } if ('-' === str.charAt(idx)) { chars.push('-'); idx++;...
[ "function", "(", "str", ")", "{", "var", "output", "=", "[", "]", ";", "var", "idx", "=", "0", ";", "var", "c", ",", "num", ";", "var", "nextNumber", "=", "function", "(", ")", "{", "var", "chars", "=", "[", "]", ";", "while", "(", "/", "[^-\...
Helper - get arguments of a path drawing command
[ "Helper", "-", "get", "arguments", "of", "a", "path", "drawing", "command" ]
989c3068bc82d508fee16f3dea7ee37a73834f74
https://github.com/exokitxr/exokit/blob/989c3068bc82d508fee16f3dea7ee37a73834f74/examples/svg-boundings.js#L618-L647
train
fgnass/spin.js
Gruntfile.js
function (res, path) { let defaultSrc = "default-src 'self';"; let styleSrc = "style-src 'self' fonts.googleapis.com;"; let fontSrc = "font-src 'self' fonts.gstatic.com;"; let imgSrc = "img-src 'self' www.gravatar.com;"; res.setHeader('Cont...
javascript
function (res, path) { let defaultSrc = "default-src 'self';"; let styleSrc = "style-src 'self' fonts.googleapis.com;"; let fontSrc = "font-src 'self' fonts.gstatic.com;"; let imgSrc = "img-src 'self' www.gravatar.com;"; res.setHeader('Cont...
[ "function", "(", "res", ",", "path", ")", "{", "let", "defaultSrc", "=", "\"default-src 'self';\"", ";", "let", "styleSrc", "=", "\"style-src 'self' fonts.googleapis.com;\"", ";", "let", "fontSrc", "=", "\"font-src 'self' fonts.gstatic.com;\"", ";", "let", "imgSrc", "...
add CSP header to ensure spin.js supports it
[ "add", "CSP", "header", "to", "ensure", "spin", ".", "js", "supports", "it" ]
e693e4f933f0a5ade9498ffcbab6c1409be92681
https://github.com/fgnass/spin.js/blob/e693e4f933f0a5ade9498ffcbab6c1409be92681/Gruntfile.js#L14-L20
train
terkelg/prompts
lib/index.js
prompt
async function prompt(questions=[], { onSubmit=noop, onCancel=noop }={}) { const answers = {}; const override = prompt._override || {}; questions = [].concat(questions); let answer, question, quit, name, type; const getFormattedAnswer = async (question, answer, skipValidation = false) => { if (!skipValid...
javascript
async function prompt(questions=[], { onSubmit=noop, onCancel=noop }={}) { const answers = {}; const override = prompt._override || {}; questions = [].concat(questions); let answer, question, quit, name, type; const getFormattedAnswer = async (question, answer, skipValidation = false) => { if (!skipValid...
[ "async", "function", "prompt", "(", "questions", "=", "[", "]", ",", "{", "onSubmit", "=", "noop", ",", "onCancel", "=", "noop", "}", "=", "{", "}", ")", "{", "const", "answers", "=", "{", "}", ";", "const", "override", "=", "prompt", ".", "_overri...
Prompt for a series of questions @param {Array|Object} questions Single question object or Array of question objects @param {Function} [onSubmit] Callback function called on prompt submit @param {Function} [onCancel] Callback function called on cancel/abort @returns {Object} Object with values from user input
[ "Prompt", "for", "a", "series", "of", "questions" ]
496f58d4fecaf67f34685af932980b1907eda642
https://github.com/terkelg/prompts/blob/496f58d4fecaf67f34685af932980b1907eda642/lib/index.js#L15-L73
train
regl-project/regl
lib/texture.js
destroyTextures
function destroyTextures () { for (var i = 0; i < numTexUnits; ++i) { gl.activeTexture(GL_TEXTURE0 + i) gl.bindTexture(GL_TEXTURE_2D, null) textureUnits[i] = null } values(textureSet).forEach(destroy) stats.cubeCount = 0 stats.textureCount = 0 }
javascript
function destroyTextures () { for (var i = 0; i < numTexUnits; ++i) { gl.activeTexture(GL_TEXTURE0 + i) gl.bindTexture(GL_TEXTURE_2D, null) textureUnits[i] = null } values(textureSet).forEach(destroy) stats.cubeCount = 0 stats.textureCount = 0 }
[ "function", "destroyTextures", "(", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "numTexUnits", ";", "++", "i", ")", "{", "gl", ".", "activeTexture", "(", "GL_TEXTURE0", "+", "i", ")", "gl", ".", "bindTexture", "(", "GL_TEXTURE_2D", ","...
Called when regl is destroyed
[ "Called", "when", "regl", "is", "destroyed" ]
ca0a862c51622c2829a8b34ec79ed1650255185b
https://github.com/regl-project/regl/blob/ca0a862c51622c2829a8b34ec79ed1650255185b/lib/texture.js#L1592-L1602
train
regl-project/regl
example/line-primitives.js
createDrawCall
function createDrawCall (props) { return regl({ attributes: { position: props.position }, uniforms: { color: props.color, scale: props.scale, offset: props.offset, phase: props.phase, freq: props.freq }, lineWidth: lineWidth, count: props.position.length, ...
javascript
function createDrawCall (props) { return regl({ attributes: { position: props.position }, uniforms: { color: props.color, scale: props.scale, offset: props.offset, phase: props.phase, freq: props.freq }, lineWidth: lineWidth, count: props.position.length, ...
[ "function", "createDrawCall", "(", "props", ")", "{", "return", "regl", "(", "{", "attributes", ":", "{", "position", ":", "props", ".", "position", "}", ",", "uniforms", ":", "{", "color", ":", "props", ".", "color", ",", "scale", ":", "props", ".", ...
this creates a drawCall that allows you to do draw single line primitive.
[ "this", "creates", "a", "drawCall", "that", "allows", "you", "to", "do", "draw", "single", "line", "primitive", "." ]
ca0a862c51622c2829a8b34ec79ed1650255185b
https://github.com/regl-project/regl/blob/ca0a862c51622c2829a8b34ec79ed1650255185b/example/line-primitives.js#L69-L87
train
regl-project/regl
example/stencil-transition.js
centerMesh
function centerMesh (mesh) { var bb = boundingBox(mesh.positions) var _translate = [ -0.5 * (bb[0][0] + bb[1][0]), -0.5 * (bb[0][1] + bb[1][1]), -0.5 * (bb[0][2] + bb[1][2]) ] var translate = mat4.create() mat4.translate(translate, translate, _translate) mesh.positions = tform(mesh.positions, t...
javascript
function centerMesh (mesh) { var bb = boundingBox(mesh.positions) var _translate = [ -0.5 * (bb[0][0] + bb[1][0]), -0.5 * (bb[0][1] + bb[1][1]), -0.5 * (bb[0][2] + bb[1][2]) ] var translate = mat4.create() mat4.translate(translate, translate, _translate) mesh.positions = tform(mesh.positions, t...
[ "function", "centerMesh", "(", "mesh", ")", "{", "var", "bb", "=", "boundingBox", "(", "mesh", ".", "positions", ")", "var", "_translate", "=", "[", "-", "0.5", "*", "(", "bb", "[", "0", "]", "[", "0", "]", "+", "bb", "[", "1", "]", "[", "0", ...
center the rabbit mesh to the origin.
[ "center", "the", "rabbit", "mesh", "to", "the", "origin", "." ]
ca0a862c51622c2829a8b34ec79ed1650255185b
https://github.com/regl-project/regl/blob/ca0a862c51622c2829a8b34ec79ed1650255185b/example/stencil-transition.js#L27-L38
train
regl-project/regl
example/cloth.js
Constraint
function Constraint (i0, i1) { this.i0 = i0 this.i1 = i1 this.restLength = vec3.distance(position[i0], position[i1]) }
javascript
function Constraint (i0, i1) { this.i0 = i0 this.i1 = i1 this.restLength = vec3.distance(position[i0], position[i1]) }
[ "function", "Constraint", "(", "i0", ",", "i1", ")", "{", "this", ".", "i0", "=", "i0", "this", ".", "i1", "=", "i1", "this", ".", "restLength", "=", "vec3", ".", "distance", "(", "position", "[", "i0", "]", ",", "position", "[", "i1", "]", ")", ...
create a constraint between the vertices with the indices i0 and i1.
[ "create", "a", "constraint", "between", "the", "vertices", "with", "the", "indices", "i0", "and", "i1", "." ]
ca0a862c51622c2829a8b34ec79ed1650255185b
https://github.com/regl-project/regl/blob/ca0a862c51622c2829a8b34ec79ed1650255185b/example/cloth.js#L33-L38
train
regl-project/regl
example/graph.js
step
function step ({tick}) { setFBO({ framebuffer: FIELDS[0] }, () => { regl.clear({ color: [0, 0, 0, 1] }) splatMouse() splatVerts({ vertexState: VERTEX_STATE[(tick + 1) % 2] }) }) for (let i = 0; i < 2 * BLUR_PASSES; ++i) { blurPass({ dest: FIELDS[(i + 1) % 2], src: FIELDS[i % ...
javascript
function step ({tick}) { setFBO({ framebuffer: FIELDS[0] }, () => { regl.clear({ color: [0, 0, 0, 1] }) splatMouse() splatVerts({ vertexState: VERTEX_STATE[(tick + 1) % 2] }) }) for (let i = 0; i < 2 * BLUR_PASSES; ++i) { blurPass({ dest: FIELDS[(i + 1) % 2], src: FIELDS[i % ...
[ "function", "step", "(", "{", "tick", "}", ")", "{", "setFBO", "(", "{", "framebuffer", ":", "FIELDS", "[", "0", "]", "}", ",", "(", ")", "=>", "{", "regl", ".", "clear", "(", "{", "color", ":", "[", "0", ",", "0", ",", "0", ",", "1", "]", ...
Main integration loop
[ "Main", "integration", "loop" ]
ca0a862c51622c2829a8b34ec79ed1650255185b
https://github.com/regl-project/regl/blob/ca0a862c51622c2829a8b34ec79ed1650255185b/example/graph.js#L441-L469
train
regl-project/regl
example/physics.js
getModelMatrix
function getModelMatrix (rb) { var ms = rb.getMotionState() if (ms) { ms.getWorldTransform(transformTemp) var p = transformTemp.getOrigin() var q = transformTemp.getRotation() return mat4.fromRotationTranslation( [], [q.x(), q.y(), q.z(), q.w()], [p.x(), p.y(), p.z()]) } }
javascript
function getModelMatrix (rb) { var ms = rb.getMotionState() if (ms) { ms.getWorldTransform(transformTemp) var p = transformTemp.getOrigin() var q = transformTemp.getRotation() return mat4.fromRotationTranslation( [], [q.x(), q.y(), q.z(), q.w()], [p.x(), p.y(), p.z()]) } }
[ "function", "getModelMatrix", "(", "rb", ")", "{", "var", "ms", "=", "rb", ".", "getMotionState", "(", ")", "if", "(", "ms", ")", "{", "ms", ".", "getWorldTransform", "(", "transformTemp", ")", "var", "p", "=", "transformTemp", ".", "getOrigin", "(", "...
extracts the model matrix from a rigid body.
[ "extracts", "the", "model", "matrix", "from", "a", "rigid", "body", "." ]
ca0a862c51622c2829a8b34ec79ed1650255185b
https://github.com/regl-project/regl/blob/ca0a862c51622c2829a8b34ec79ed1650255185b/example/physics.js#L293-L304
train
regl-project/regl
example/pong.js
createAudioBuffer
function createAudioBuffer (length, createAudioDataCallback) { var channels = 2 var frameCount = context.sampleRate * length var audioBuffer = context.createBuffer(channels, frameCount, context.sampleRate) for (var channel = 0; channel < channels; channel++) { var channelData = audioBuffer.getChannelData(c...
javascript
function createAudioBuffer (length, createAudioDataCallback) { var channels = 2 var frameCount = context.sampleRate * length var audioBuffer = context.createBuffer(channels, frameCount, context.sampleRate) for (var channel = 0; channel < channels; channel++) { var channelData = audioBuffer.getChannelData(c...
[ "function", "createAudioBuffer", "(", "length", ",", "createAudioDataCallback", ")", "{", "var", "channels", "=", "2", "var", "frameCount", "=", "context", ".", "sampleRate", "*", "length", "var", "audioBuffer", "=", "context", ".", "createBuffer", "(", "channel...
create audio buffer that lasts `length` seconds, and `createAudioDataCallback` will will fill each of the two channels of the buffer with audio data.
[ "create", "audio", "buffer", "that", "lasts", "length", "seconds", "and", "createAudioDataCallback", "will", "will", "fill", "each", "of", "the", "two", "channels", "of", "the", "buffer", "with", "audio", "data", "." ]
ca0a862c51622c2829a8b34ec79ed1650255185b
https://github.com/regl-project/regl/blob/ca0a862c51622c2829a8b34ec79ed1650255185b/example/pong.js#L104-L114
train
regl-project/regl
lib/util/codegen.js
block
function block () { var code = [] function push () { code.push.apply(code, slice(arguments)) } var vars = [] function def () { var name = 'v' + (varCounter++) vars.push(name) if (arguments.length > 0) { code.push(name, '=') code.push.apply(code, slice(argume...
javascript
function block () { var code = [] function push () { code.push.apply(code, slice(arguments)) } var vars = [] function def () { var name = 'v' + (varCounter++) vars.push(name) if (arguments.length > 0) { code.push(name, '=') code.push.apply(code, slice(argume...
[ "function", "block", "(", ")", "{", "var", "code", "=", "[", "]", "function", "push", "(", ")", "{", "code", ".", "push", ".", "apply", "(", "code", ",", "slice", "(", "arguments", ")", ")", "}", "var", "vars", "=", "[", "]", "function", "def", ...
create a code block
[ "create", "a", "code", "block" ]
ca0a862c51622c2829a8b34ec79ed1650255185b
https://github.com/regl-project/regl/blob/ca0a862c51622c2829a8b34ec79ed1650255185b/lib/util/codegen.js#L34-L63
train
regl-project/regl
lib/core.js
sortState
function sortState (state) { return state.sort(function (a, b) { if (a === S_VIEWPORT) { return -1 } else if (b === S_VIEWPORT) { return 1 } return (a < b) ? -1 : 1 }) }
javascript
function sortState (state) { return state.sort(function (a, b) { if (a === S_VIEWPORT) { return -1 } else if (b === S_VIEWPORT) { return 1 } return (a < b) ? -1 : 1 }) }
[ "function", "sortState", "(", "state", ")", "{", "return", "state", ".", "sort", "(", "function", "(", "a", ",", "b", ")", "{", "if", "(", "a", "===", "S_VIEWPORT", ")", "{", "return", "-", "1", "}", "else", "if", "(", "b", "===", "S_VIEWPORT", "...
Make sure viewport is processed first
[ "Make", "sure", "viewport", "is", "processed", "first" ]
ca0a862c51622c2829a8b34ec79ed1650255185b
https://github.com/regl-project/regl/blob/ca0a862c51622c2829a8b34ec79ed1650255185b/lib/core.js#L226-L235
train
firebase/angularfire
src/storage/FirebaseStorage.js
_unwrapStorageSnapshot
function _unwrapStorageSnapshot(storageSnapshot) { return { bytesTransferred: storageSnapshot.bytesTransferred, downloadURL: storageSnapshot.downloadURL, metadata: storageSnapshot.metadata, ref: storageSnapshot.ref, state: storageSnapshot.state, task: storageSnapshot.task, ...
javascript
function _unwrapStorageSnapshot(storageSnapshot) { return { bytesTransferred: storageSnapshot.bytesTransferred, downloadURL: storageSnapshot.downloadURL, metadata: storageSnapshot.metadata, ref: storageSnapshot.ref, state: storageSnapshot.state, task: storageSnapshot.task, ...
[ "function", "_unwrapStorageSnapshot", "(", "storageSnapshot", ")", "{", "return", "{", "bytesTransferred", ":", "storageSnapshot", ".", "bytesTransferred", ",", "downloadURL", ":", "storageSnapshot", ".", "downloadURL", ",", "metadata", ":", "storageSnapshot", ".", "m...
Take a Storage snapshot and unwrap only the needed properties. @param snapshot @returns An object containing the unwrapped values.
[ "Take", "a", "Storage", "snapshot", "and", "unwrap", "only", "the", "needed", "properties", "." ]
b6dca6ea5a81b3edd44230fb1cb6ca62419f1926
https://github.com/firebase/angularfire/blob/b6dca6ea5a81b3edd44230fb1cb6ca62419f1926/src/storage/FirebaseStorage.js#L52-L62
train
firebase/angularfire
src/database/FirebaseObject.js
FirebaseObject
function FirebaseObject(ref) { if( !(this instanceof FirebaseObject) ) { return new FirebaseObject(ref); } var self = this; // These are private config props and functions used internally // they are collected here to reduce clutter in console.log and forEach th...
javascript
function FirebaseObject(ref) { if( !(this instanceof FirebaseObject) ) { return new FirebaseObject(ref); } var self = this; // These are private config props and functions used internally // they are collected here to reduce clutter in console.log and forEach th...
[ "function", "FirebaseObject", "(", "ref", ")", "{", "if", "(", "!", "(", "this", "instanceof", "FirebaseObject", ")", ")", "{", "return", "new", "FirebaseObject", "(", "ref", ")", ";", "}", "var", "self", "=", "this", ";", "// These are private config props ...
Creates a synchronized object with 2-way bindings between Angular and Firebase. @param {Firebase} ref @returns {FirebaseObject} @constructor
[ "Creates", "a", "synchronized", "object", "with", "2", "-", "way", "bindings", "between", "Angular", "and", "Firebase", "." ]
b6dca6ea5a81b3edd44230fb1cb6ca62419f1926
https://github.com/firebase/angularfire/blob/b6dca6ea5a81b3edd44230fb1cb6ca62419f1926/src/database/FirebaseObject.js#L35-L75
train
firebase/angularfire
src/database/FirebaseObject.js
function () { var self = this; var ref = self.$ref(); var def = $q.defer(); var dataJSON; try { dataJSON = $firebaseUtils.toJSON(self); } catch (e) { def.reject(e); } if (typeof dataJSON !== 'undefined') { ...
javascript
function () { var self = this; var ref = self.$ref(); var def = $q.defer(); var dataJSON; try { dataJSON = $firebaseUtils.toJSON(self); } catch (e) { def.reject(e); } if (typeof dataJSON !== 'undefined') { ...
[ "function", "(", ")", "{", "var", "self", "=", "this", ";", "var", "ref", "=", "self", ".", "$ref", "(", ")", ";", "var", "def", "=", "$q", ".", "defer", "(", ")", ";", "var", "dataJSON", ";", "try", "{", "dataJSON", "=", "$firebaseUtils", ".", ...
Saves all data on the FirebaseObject back to Firebase. @returns a promise which will resolve after the save is completed.
[ "Saves", "all", "data", "on", "the", "FirebaseObject", "back", "to", "Firebase", "." ]
b6dca6ea5a81b3edd44230fb1cb6ca62419f1926
https://github.com/firebase/angularfire/blob/b6dca6ea5a81b3edd44230fb1cb6ca62419f1926/src/database/FirebaseObject.js#L82-L102
train
firebase/angularfire
src/database/FirebaseObject.js
function() { var self = this; $firebaseUtils.trimKeys(self, {}); self.$value = null; return $firebaseUtils.doRemove(self.$ref()).then(function() { self.$$notify(); return self.$ref(); }); }
javascript
function() { var self = this; $firebaseUtils.trimKeys(self, {}); self.$value = null; return $firebaseUtils.doRemove(self.$ref()).then(function() { self.$$notify(); return self.$ref(); }); }
[ "function", "(", ")", "{", "var", "self", "=", "this", ";", "$firebaseUtils", ".", "trimKeys", "(", "self", ",", "{", "}", ")", ";", "self", ".", "$value", "=", "null", ";", "return", "$firebaseUtils", ".", "doRemove", "(", "self", ".", "$ref", "(", ...
Removes all keys from the FirebaseObject and also removes the remote data from the server. @returns a promise which will resolve after the op completes
[ "Removes", "all", "keys", "from", "the", "FirebaseObject", "and", "also", "removes", "the", "remote", "data", "from", "the", "server", "." ]
b6dca6ea5a81b3edd44230fb1cb6ca62419f1926
https://github.com/firebase/angularfire/blob/b6dca6ea5a81b3edd44230fb1cb6ca62419f1926/src/database/FirebaseObject.js#L110-L118
train
firebase/angularfire
src/database/FirebaseObject.js
function (scope, varName) { var self = this; return self.$loaded().then(function () { return self.$$conf.binding.bindTo(scope, varName); }); }
javascript
function (scope, varName) { var self = this; return self.$loaded().then(function () { return self.$$conf.binding.bindTo(scope, varName); }); }
[ "function", "(", "scope", ",", "varName", ")", "{", "var", "self", "=", "this", ";", "return", "self", ".", "$loaded", "(", ")", ".", "then", "(", "function", "(", ")", "{", "return", "self", ".", "$$conf", ".", "binding", ".", "bindTo", "(", "scop...
Creates a 3-way data sync between this object, the Firebase server, and a scope variable. This means that any changes made to the scope variable are pushed to Firebase, and vice versa. If scope emits a $destroy event, the binding is automatically severed. Otherwise, it is possible to unbind the scope variable by using...
[ "Creates", "a", "3", "-", "way", "data", "sync", "between", "this", "object", "the", "Firebase", "server", "and", "a", "scope", "variable", ".", "This", "means", "that", "any", "changes", "made", "to", "the", "scope", "variable", "are", "pushed", "to", "...
b6dca6ea5a81b3edd44230fb1cb6ca62419f1926
https://github.com/firebase/angularfire/blob/b6dca6ea5a81b3edd44230fb1cb6ca62419f1926/src/database/FirebaseObject.js#L165-L170
train
firebase/angularfire
src/auth/FirebaseAuth.js
function (stringOrProvider) { var provider; if (typeof stringOrProvider == "string") { var providerID = stringOrProvider.slice(0, 1).toUpperCase() + stringOrProvider.slice(1); provider = new firebase.auth[providerID+"AuthProvider"](); } else { provider = stringOrProvider; ...
javascript
function (stringOrProvider) { var provider; if (typeof stringOrProvider == "string") { var providerID = stringOrProvider.slice(0, 1).toUpperCase() + stringOrProvider.slice(1); provider = new firebase.auth[providerID+"AuthProvider"](); } else { provider = stringOrProvider; ...
[ "function", "(", "stringOrProvider", ")", "{", "var", "provider", ";", "if", "(", "typeof", "stringOrProvider", "==", "\"string\"", ")", "{", "var", "providerID", "=", "stringOrProvider", ".", "slice", "(", "0", ",", "1", ")", ".", "toUpperCase", "(", ")",...
Helper method to turn provider names into AuthProvider instances @param {object} stringOrProvider Provider ID string to AuthProvider instance @return {firebdase.auth.AuthProvider} A valid AuthProvider instance
[ "Helper", "method", "to", "turn", "provider", "names", "into", "AuthProvider", "instances" ]
b6dca6ea5a81b3edd44230fb1cb6ca62419f1926
https://github.com/firebase/angularfire/blob/b6dca6ea5a81b3edd44230fb1cb6ca62419f1926/src/auth/FirebaseAuth.js#L221-L230
train
firebase/angularfire
src/auth/FirebaseAuth.js
function() { var auth = this._auth; return this._q(function(resolve) { var off; function callback() { // Turn off this onAuthStateChanged() callback since we just needed to get the authentication data once. off(); resolve(); } off = auth.onAuthS...
javascript
function() { var auth = this._auth; return this._q(function(resolve) { var off; function callback() { // Turn off this onAuthStateChanged() callback since we just needed to get the authentication data once. off(); resolve(); } off = auth.onAuthS...
[ "function", "(", ")", "{", "var", "auth", "=", "this", ".", "_auth", ";", "return", "this", ".", "_q", "(", "function", "(", "resolve", ")", "{", "var", "off", ";", "function", "callback", "(", ")", "{", "// Turn off this onAuthStateChanged() callback since ...
Helper that returns a promise which resolves when the initial auth state has been fetched from the Firebase server. This never rejects and resolves to undefined. @return {Promise<Object>} A promise fulfilled when the server returns initial auth state.
[ "Helper", "that", "returns", "a", "promise", "which", "resolves", "when", "the", "initial", "auth", "state", "has", "been", "fetched", "from", "the", "Firebase", "server", ".", "This", "never", "rejects", "and", "resolves", "to", "undefined", "." ]
b6dca6ea5a81b3edd44230fb1cb6ca62419f1926
https://github.com/firebase/angularfire/blob/b6dca6ea5a81b3edd44230fb1cb6ca62419f1926/src/auth/FirebaseAuth.js#L238-L250
train
firebase/angularfire
src/database/FirebaseArray.js
function(indexOrItem) { this._assertNotDestroyed('$save'); var self = this; var item = self._resolveItem(indexOrItem); var key = self.$keyAt(item); var def = $q.defer(); if( key !== null ) { var ref = self.$ref().ref.child(key); var da...
javascript
function(indexOrItem) { this._assertNotDestroyed('$save'); var self = this; var item = self._resolveItem(indexOrItem); var key = self.$keyAt(item); var def = $q.defer(); if( key !== null ) { var ref = self.$ref().ref.child(key); var da...
[ "function", "(", "indexOrItem", ")", "{", "this", ".", "_assertNotDestroyed", "(", "'$save'", ")", ";", "var", "self", "=", "this", ";", "var", "item", "=", "self", ".", "_resolveItem", "(", "indexOrItem", ")", ";", "var", "key", "=", "self", ".", "$ke...
Pass either an item in the array or the index of an item and it will be saved back to Firebase. While the array is read-only and its structure should not be changed, it is okay to modify properties on the objects it contains and then save those back individually. Returns a future which is resolved when the data has su...
[ "Pass", "either", "an", "item", "in", "the", "array", "or", "the", "index", "of", "an", "item", "and", "it", "will", "be", "saved", "back", "to", "Firebase", ".", "While", "the", "array", "is", "read", "-", "only", "and", "its", "structure", "should", ...
b6dca6ea5a81b3edd44230fb1cb6ca62419f1926
https://github.com/firebase/angularfire/blob/b6dca6ea5a81b3edd44230fb1cb6ca62419f1926/src/database/FirebaseArray.js#L155-L184
train
firebase/angularfire
src/database/FirebaseArray.js
function(rec, prevChild) { var i; if( prevChild === null ) { i = 0; } else { i = this.$indexFor(prevChild)+1; if( i === 0 ) { i = this.$list.length; } } this.$list.splice(i, 0, rec); this._indexCache[this.$$getKey(...
javascript
function(rec, prevChild) { var i; if( prevChild === null ) { i = 0; } else { i = this.$indexFor(prevChild)+1; if( i === 0 ) { i = this.$list.length; } } this.$list.splice(i, 0, rec); this._indexCache[this.$$getKey(...
[ "function", "(", "rec", ",", "prevChild", ")", "{", "var", "i", ";", "if", "(", "prevChild", "===", "null", ")", "{", "i", "=", "0", ";", "}", "else", "{", "i", "=", "this", ".", "$indexFor", "(", "prevChild", ")", "+", "1", ";", "if", "(", "...
Used to insert a new record into the array at a specific position. If prevChild is null, is inserted first, if prevChild is not found, it is inserted last, otherwise, it goes immediately after prevChild. @param {object} rec @param {string|null} prevChild @private
[ "Used", "to", "insert", "a", "new", "record", "into", "the", "array", "at", "a", "specific", "position", ".", "If", "prevChild", "is", "null", "is", "inserted", "first", "if", "prevChild", "is", "not", "found", "it", "is", "inserted", "last", "otherwise", ...
b6dca6ea5a81b3edd44230fb1cb6ca62419f1926
https://github.com/firebase/angularfire/blob/b6dca6ea5a81b3edd44230fb1cb6ca62419f1926/src/database/FirebaseArray.js#L512-L524
train
firebase/angularfire
src/database/FirebaseArray.js
function(indexOrItem) { var list = this.$list; if( angular.isNumber(indexOrItem) && indexOrItem >= 0 && list.length >= indexOrItem ) { return list[indexOrItem]; } else if( angular.isObject(indexOrItem) ) { // it must be an item in this array; it's not suff...
javascript
function(indexOrItem) { var list = this.$list; if( angular.isNumber(indexOrItem) && indexOrItem >= 0 && list.length >= indexOrItem ) { return list[indexOrItem]; } else if( angular.isObject(indexOrItem) ) { // it must be an item in this array; it's not suff...
[ "function", "(", "indexOrItem", ")", "{", "var", "list", "=", "this", ".", "$list", ";", "if", "(", "angular", ".", "isNumber", "(", "indexOrItem", ")", "&&", "indexOrItem", ">=", "0", "&&", "list", ".", "length", ">=", "indexOrItem", ")", "{", "return...
Resolves a variable which may contain an integer or an item that exists in this array. Returns the item or null if it does not exist. @param indexOrItem @returns {*} @private
[ "Resolves", "a", "variable", "which", "may", "contain", "an", "integer", "or", "an", "item", "that", "exists", "in", "this", "array", ".", "Returns", "the", "item", "or", "null", "if", "it", "does", "not", "exist", "." ]
b6dca6ea5a81b3edd44230fb1cb6ca62419f1926
https://github.com/firebase/angularfire/blob/b6dca6ea5a81b3edd44230fb1cb6ca62419f1926/src/database/FirebaseArray.js#L551-L566
train
lance-gg/lance
src/physics/SimplePhysics/BruteForceCollisionDetection.js
getBox
function getBox(o) { return { xMin: o.position.x, xMax: o.position.x + o.width, yMin: o.position.y, yMax: o.position.y + o.height }; }
javascript
function getBox(o) { return { xMin: o.position.x, xMax: o.position.x + o.width, yMin: o.position.y, yMax: o.position.y + o.height }; }
[ "function", "getBox", "(", "o", ")", "{", "return", "{", "xMin", ":", "o", ".", "position", ".", "x", ",", "xMax", ":", "o", ".", "position", ".", "x", "+", "o", ".", "width", ",", "yMin", ":", "o", ".", "position", ".", "y", ",", "yMax", ":"...
get bounding box of object o
[ "get", "bounding", "box", "of", "object", "o" ]
af5dcaec10c9a2e3e373bf53528d4a1d0f57e3b6
https://github.com/lance-gg/lance/blob/af5dcaec10c9a2e3e373bf53528d4a1d0f57e3b6/src/physics/SimplePhysics/BruteForceCollisionDetection.js#L138-L145
train
expressjs/morgan
index.js
clfdate
function clfdate (dateTime) { var date = dateTime.getUTCDate() var hour = dateTime.getUTCHours() var mins = dateTime.getUTCMinutes() var secs = dateTime.getUTCSeconds() var year = dateTime.getUTCFullYear() var month = CLF_MONTH[dateTime.getUTCMonth()] return pad2(date) + '/' + month + '/' + year + '...
javascript
function clfdate (dateTime) { var date = dateTime.getUTCDate() var hour = dateTime.getUTCHours() var mins = dateTime.getUTCMinutes() var secs = dateTime.getUTCSeconds() var year = dateTime.getUTCFullYear() var month = CLF_MONTH[dateTime.getUTCMonth()] return pad2(date) + '/' + month + '/' + year + '...
[ "function", "clfdate", "(", "dateTime", ")", "{", "var", "date", "=", "dateTime", ".", "getUTCDate", "(", ")", "var", "hour", "=", "dateTime", ".", "getUTCHours", "(", ")", "var", "mins", "=", "dateTime", ".", "getUTCMinutes", "(", ")", "var", "secs", ...
Format a Date in the common log format. @private @param {Date} dateTime @return {string}
[ "Format", "a", "Date", "in", "the", "common", "log", "format", "." ]
12a48c5598d67f67bc09ceac393176200bf65865
https://github.com/expressjs/morgan/blob/12a48c5598d67f67bc09ceac393176200bf65865/index.js#L351-L363
train
expressjs/morgan
index.js
createBufferStream
function createBufferStream (stream, interval) { var buf = [] var timer = null // flush function function flush () { timer = null stream.write(buf.join('')) buf.length = 0 } // write function function write (str) { if (timer === null) { timer = setTimeout(flush, interval) } ...
javascript
function createBufferStream (stream, interval) { var buf = [] var timer = null // flush function function flush () { timer = null stream.write(buf.join('')) buf.length = 0 } // write function function write (str) { if (timer === null) { timer = setTimeout(flush, interval) } ...
[ "function", "createBufferStream", "(", "stream", ",", "interval", ")", "{", "var", "buf", "=", "[", "]", "var", "timer", "=", "null", "// flush function", "function", "flush", "(", ")", "{", "timer", "=", "null", "stream", ".", "write", "(", "buf", ".", ...
Create a basic buffering stream. @param {object} stream @param {number} interval @public
[ "Create", "a", "basic", "buffering", "stream", "." ]
12a48c5598d67f67bc09ceac393176200bf65865
https://github.com/expressjs/morgan/blob/12a48c5598d67f67bc09ceac393176200bf65865/index.js#L402-L424
train
expressjs/morgan
index.js
getFormatFunction
function getFormatFunction (name) { // lookup format var fmt = morgan[name] || name || morgan.default // return compiled format return typeof fmt !== 'function' ? compile(fmt) : fmt }
javascript
function getFormatFunction (name) { // lookup format var fmt = morgan[name] || name || morgan.default // return compiled format return typeof fmt !== 'function' ? compile(fmt) : fmt }
[ "function", "getFormatFunction", "(", "name", ")", "{", "// lookup format", "var", "fmt", "=", "morgan", "[", "name", "]", "||", "name", "||", "morgan", ".", "default", "// return compiled format", "return", "typeof", "fmt", "!==", "'function'", "?", "compile", ...
Lookup and compile a named format function. @param {string} name @return {function} @public
[ "Lookup", "and", "compile", "a", "named", "format", "function", "." ]
12a48c5598d67f67bc09ceac393176200bf65865
https://github.com/expressjs/morgan/blob/12a48c5598d67f67bc09ceac393176200bf65865/index.js#L447-L455
train
vuejs/vue-hot-reload-api
src/index.js
injectHook
function injectHook(options, name, hook) { const existing = options[name] options[name] = existing ? Array.isArray(existing) ? existing.concat(hook) : [existing, hook] : [hook] }
javascript
function injectHook(options, name, hook) { const existing = options[name] options[name] = existing ? Array.isArray(existing) ? existing.concat(hook) : [existing, hook] : [hook] }
[ "function", "injectHook", "(", "options", ",", "name", ",", "hook", ")", "{", "const", "existing", "=", "options", "[", "name", "]", "options", "[", "name", "]", "=", "existing", "?", "Array", ".", "isArray", "(", "existing", ")", "?", "existing", ".",...
Inject a hook to a hot reloadable component so that we can keep track of it. @param {Object} options @param {String} name @param {Function} hook
[ "Inject", "a", "hook", "to", "a", "hot", "reloadable", "component", "so", "that", "we", "can", "keep", "track", "of", "it", "." ]
5dc0e49332802fa0154de3fed7dde31437309698
https://github.com/vuejs/vue-hot-reload-api/blob/5dc0e49332802fa0154de3fed7dde31437309698/src/index.js#L109-L114
train
vuejs/vue-hot-reload-api
src/index.js
patchScopedSlots
function patchScopedSlots (instance) { if (!instance._u) return // https://github.com/vuejs/vue/blob/dev/src/core/instance/render-helpers/resolve-scoped-slots.js const original = instance._u instance._u = slots => { try { // 2.6.4 ~ 2.6.6 return original(slots, true) } catch (e) { // 2...
javascript
function patchScopedSlots (instance) { if (!instance._u) return // https://github.com/vuejs/vue/blob/dev/src/core/instance/render-helpers/resolve-scoped-slots.js const original = instance._u instance._u = slots => { try { // 2.6.4 ~ 2.6.6 return original(slots, true) } catch (e) { // 2...
[ "function", "patchScopedSlots", "(", "instance", ")", "{", "if", "(", "!", "instance", ".", "_u", ")", "return", "// https://github.com/vuejs/vue/blob/dev/src/core/instance/render-helpers/resolve-scoped-slots.js", "const", "original", "=", "instance", ".", "_u", "instance",...
2.6 optimizes template-compiled scoped slots and skips updates if child only uses scoped slots. We need to patch the scoped slots resolving helper to temporarily mark all scoped slots as unstable in order to force child updates.
[ "2", ".", "6", "optimizes", "template", "-", "compiled", "scoped", "slots", "and", "skips", "updates", "if", "child", "only", "uses", "scoped", "slots", ".", "We", "need", "to", "patch", "the", "scoped", "slots", "resolving", "helper", "to", "temporarily", ...
5dc0e49332802fa0154de3fed7dde31437309698
https://github.com/vuejs/vue-hot-reload-api/blob/5dc0e49332802fa0154de3fed7dde31437309698/src/index.js#L255-L271
train
alibaba/uirecorder
chrome-extension/js/mobile.js
getNodeInfo
function getNodeInfo(x, y){ var nodeInfo = {}; var bestNodeInfo = { node: null, boundSize: 0 }; getBestNode(appTree, x, y, bestNodeInfo); var bestNode = bestNodeInfo.node; if(bestNode){ var text = bestNode.text || bestNode.label; ...
javascript
function getNodeInfo(x, y){ var nodeInfo = {}; var bestNodeInfo = { node: null, boundSize: 0 }; getBestNode(appTree, x, y, bestNodeInfo); var bestNode = bestNodeInfo.node; if(bestNode){ var text = bestNode.text || bestNode.label; ...
[ "function", "getNodeInfo", "(", "x", ",", "y", ")", "{", "var", "nodeInfo", "=", "{", "}", ";", "var", "bestNodeInfo", "=", "{", "node", ":", "null", ",", "boundSize", ":", "0", "}", ";", "getBestNode", "(", "appTree", ",", "x", ",", "y", ",", "b...
get node info by x,y
[ "get", "node", "info", "by", "x", "y" ]
2b6ed319e75657eadbef2e80baca46c655a3ce94
https://github.com/alibaba/uirecorder/blob/2b6ed319e75657eadbef2e80baca46c655a3ce94/chrome-extension/js/mobile.js#L445-L469
train
alibaba/uirecorder
lib/start.js
getRootPath
function getRootPath(){ var rootPath = path.resolve('.'); while(rootPath){ if(fs.existsSync(rootPath + '/config.json')){ break; } rootPath = rootPath.substring(0, rootPath.lastIndexOf(path.sep)); } return rootPath; }
javascript
function getRootPath(){ var rootPath = path.resolve('.'); while(rootPath){ if(fs.existsSync(rootPath + '/config.json')){ break; } rootPath = rootPath.substring(0, rootPath.lastIndexOf(path.sep)); } return rootPath; }
[ "function", "getRootPath", "(", ")", "{", "var", "rootPath", "=", "path", ".", "resolve", "(", "'.'", ")", ";", "while", "(", "rootPath", ")", "{", "if", "(", "fs", ".", "existsSync", "(", "rootPath", "+", "'/config.json'", ")", ")", "{", "break", ";...
get test root
[ "get", "test", "root" ]
2b6ed319e75657eadbef2e80baca46c655a3ce94
https://github.com/alibaba/uirecorder/blob/2b6ed319e75657eadbef2e80baca46c655a3ce94/lib/start.js#L1618-L1627
train
alibaba/uirecorder
lib/start.js
startRecorderServer
function startRecorderServer(config, onReady, onCommand, onEnd){ var server = http.createServer(function(req, res){ if(req.url === '/proxy.pac'){ var wdproxy = config.wdproxy; if(wdproxy){ res.writeHead(200, { 'Content-Type': 'text/plain' }); var pacCo...
javascript
function startRecorderServer(config, onReady, onCommand, onEnd){ var server = http.createServer(function(req, res){ if(req.url === '/proxy.pac'){ var wdproxy = config.wdproxy; if(wdproxy){ res.writeHead(200, { 'Content-Type': 'text/plain' }); var pacCo...
[ "function", "startRecorderServer", "(", "config", ",", "onReady", ",", "onCommand", ",", "onEnd", ")", "{", "var", "server", "=", "http", ".", "createServer", "(", "function", "(", "req", ",", "res", ")", "{", "if", "(", "req", ".", "url", "===", "'/pr...
start recorder server
[ "start", "recorder", "server" ]
2b6ed319e75657eadbef2e80baca46c655a3ce94
https://github.com/alibaba/uirecorder/blob/2b6ed319e75657eadbef2e80baca46c655a3ce94/lib/start.js#L1635-L1701
train
alibaba/uirecorder
chrome-extension/js/foreground.js
getDomPath
function getDomPath(target, isAllDom){ var arrAllPaths = []; var node = target, path; while(node){ var nodeName = node.nodeName.toLowerCase(); if(/^#document/.test(nodeName)){ path = getRelativeDomPath(node, target, isAllDom); if(path){ ...
javascript
function getDomPath(target, isAllDom){ var arrAllPaths = []; var node = target, path; while(node){ var nodeName = node.nodeName.toLowerCase(); if(/^#document/.test(nodeName)){ path = getRelativeDomPath(node, target, isAllDom); if(path){ ...
[ "function", "getDomPath", "(", "target", ",", "isAllDom", ")", "{", "var", "arrAllPaths", "=", "[", "]", ";", "var", "node", "=", "target", ",", "path", ";", "while", "(", "node", ")", "{", "var", "nodeName", "=", "node", ".", "nodeName", ".", "toLow...
get selector path
[ "get", "selector", "path" ]
2b6ed319e75657eadbef2e80baca46c655a3ce94
https://github.com/alibaba/uirecorder/blob/2b6ed319e75657eadbef2e80baca46c655a3ce94/chrome-extension/js/foreground.js#L166-L184
train
alibaba/uirecorder
chrome-extension/js/foreground.js
getFrameId
function getFrameId(){ var frame = -1; if(isIframe){ try{ var frameElement = window.frameElement; if(frameElement !== null){ frame = getDomPath(frameElement) || -1; } else{ frame = '!'+loc...
javascript
function getFrameId(){ var frame = -1; if(isIframe){ try{ var frameElement = window.frameElement; if(frameElement !== null){ frame = getDomPath(frameElement) || -1; } else{ frame = '!'+loc...
[ "function", "getFrameId", "(", ")", "{", "var", "frame", "=", "-", "1", ";", "if", "(", "isIframe", ")", "{", "try", "{", "var", "frameElement", "=", "window", ".", "frameElement", ";", "if", "(", "frameElement", "!==", "null", ")", "{", "frame", "="...
get frame id
[ "get", "frame", "id" ]
2b6ed319e75657eadbef2e80baca46c655a3ce94
https://github.com/alibaba/uirecorder/blob/2b6ed319e75657eadbef2e80baca46c655a3ce94/chrome-extension/js/foreground.js#L436-L461
train
alibaba/uirecorder
chrome-extension/js/foreground.js
unsafeEval
function unsafeEval(str){ var head = document.getElementsByTagName("head")[0]; var script = document.createElement("script"); script.innerHTML = '('+str+')();'; head.appendChild(script); head.removeChild(script); }
javascript
function unsafeEval(str){ var head = document.getElementsByTagName("head")[0]; var script = document.createElement("script"); script.innerHTML = '('+str+')();'; head.appendChild(script); head.removeChild(script); }
[ "function", "unsafeEval", "(", "str", ")", "{", "var", "head", "=", "document", ".", "getElementsByTagName", "(", "\"head\"", ")", "[", "0", "]", ";", "var", "script", "=", "document", ".", "createElement", "(", "\"script\"", ")", ";", "script", ".", "in...
eval with unsafe window
[ "eval", "with", "unsafe", "window" ]
2b6ed319e75657eadbef2e80baca46c655a3ce94
https://github.com/alibaba/uirecorder/blob/2b6ed319e75657eadbef2e80baca46c655a3ce94/chrome-extension/js/foreground.js#L985-L991
train
alibaba/uirecorder
chrome-extension/js/foreground.js
hookAlertFunction
function hookAlertFunction(){ var rawAlert = window.alert; function sendAlertCmd(cmd, data){ var cmdInfo = { cmd: cmd, data: data || {} }; window.postMessage({ 'type': 'uiRecorderAlertComm...
javascript
function hookAlertFunction(){ var rawAlert = window.alert; function sendAlertCmd(cmd, data){ var cmdInfo = { cmd: cmd, data: data || {} }; window.postMessage({ 'type': 'uiRecorderAlertComm...
[ "function", "hookAlertFunction", "(", ")", "{", "var", "rawAlert", "=", "window", ".", "alert", ";", "function", "sendAlertCmd", "(", "cmd", ",", "data", ")", "{", "var", "cmdInfo", "=", "{", "cmd", ":", "cmd", ",", "data", ":", "data", "||", "{", "}...
hook alert, confirm, prompt
[ "hook", "alert", "confirm", "prompt" ]
2b6ed319e75657eadbef2e80baca46c655a3ce94
https://github.com/alibaba/uirecorder/blob/2b6ed319e75657eadbef2e80baca46c655a3ce94/chrome-extension/js/foreground.js#L994-L1054
train
alibaba/uirecorder
chrome-extension/js/foreground.js
getFixedParent
function getFixedParent(target){ var documentElement = document.documentElement; var node = target; var nodeName, path, offset, left, top, savedParent; var notFirstNode = false; // 当前点击控件以可见范围内进行定位,其它以全局定位(很多局部控件是不可见的) while(node !== null){ nod...
javascript
function getFixedParent(target){ var documentElement = document.documentElement; var node = target; var nodeName, path, offset, left, top, savedParent; var notFirstNode = false; // 当前点击控件以可见范围内进行定位,其它以全局定位(很多局部控件是不可见的) while(node !== null){ nod...
[ "function", "getFixedParent", "(", "target", ")", "{", "var", "documentElement", "=", "document", ".", "documentElement", ";", "var", "node", "=", "target", ";", "var", "nodeName", ",", "path", ",", "offset", ",", "left", ",", "top", ",", "savedParent", ";...
get the fixed offset parent
[ "get", "the", "fixed", "offset", "parent" ]
2b6ed319e75657eadbef2e80baca46c655a3ce94
https://github.com/alibaba/uirecorder/blob/2b6ed319e75657eadbef2e80baca46c655a3ce94/chrome-extension/js/foreground.js#L1352-L1396
train
alibaba/uirecorder
chrome-extension/js/background.js
setRecorderWork
function setRecorderWork(enable){ isWorking = enable; if(isWorking){ chrome.browserAction.setTitle({title: __('icon_record_tip')}); chrome.browserAction.setIcon({path: workIcon===1?ENABLE_ICON1:ENABLE_ICON2}); workIcon *= -1; workIconTimer = setTimeout(function(){ set...
javascript
function setRecorderWork(enable){ isWorking = enable; if(isWorking){ chrome.browserAction.setTitle({title: __('icon_record_tip')}); chrome.browserAction.setIcon({path: workIcon===1?ENABLE_ICON1:ENABLE_ICON2}); workIcon *= -1; workIconTimer = setTimeout(function(){ set...
[ "function", "setRecorderWork", "(", "enable", ")", "{", "isWorking", "=", "enable", ";", "if", "(", "isWorking", ")", "{", "chrome", ".", "browserAction", ".", "setTitle", "(", "{", "title", ":", "__", "(", "'icon_record_tip'", ")", "}", ")", ";", "chrom...
set recorder work status
[ "set", "recorder", "work", "status" ]
2b6ed319e75657eadbef2e80baca46c655a3ce94
https://github.com/alibaba/uirecorder/blob/2b6ed319e75657eadbef2e80baca46c655a3ce94/chrome-extension/js/background.js#L157-L172
train
alibaba/uirecorder
chrome-extension/js/background.js
saveCommand
function saveCommand(windowId, frame, cmd, data){ if(isModuleLoading){ return; } var cmdInfo = { window: windowId, frame: frame, cmd: cmd, data: data, fix: false }; checkLostKey(windowId); switch(cmd){ case 'keyDown': allKeyMa...
javascript
function saveCommand(windowId, frame, cmd, data){ if(isModuleLoading){ return; } var cmdInfo = { window: windowId, frame: frame, cmd: cmd, data: data, fix: false }; checkLostKey(windowId); switch(cmd){ case 'keyDown': allKeyMa...
[ "function", "saveCommand", "(", "windowId", ",", "frame", ",", "cmd", ",", "data", ")", "{", "if", "(", "isModuleLoading", ")", "{", "return", ";", "}", "var", "cmdInfo", "=", "{", "window", ":", "windowId", ",", "frame", ":", "frame", ",", "cmd", ":...
save recoreded command
[ "save", "recoreded", "command" ]
2b6ed319e75657eadbef2e80baca46c655a3ce94
https://github.com/alibaba/uirecorder/blob/2b6ed319e75657eadbef2e80baca46c655a3ce94/chrome-extension/js/background.js#L180-L210
train