id int32 0 58k | 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
11,400 | MrSwitch/hello.js | demos/Collage/fabric.js | function (url, callback, options) {
return fabric.util.loadImage(url, function(img) {
this.backgroundImage = img;
if (options && ('backgroundImageOpacity' in options)) {
this.backgroundImageOpacity = options.backgroundImageOpacity;
}
if (options && ('backgroundImageStre... | javascript | function (url, callback, options) {
return fabric.util.loadImage(url, function(img) {
this.backgroundImage = img;
if (options && ('backgroundImageOpacity' in options)) {
this.backgroundImageOpacity = options.backgroundImageOpacity;
}
if (options && ('backgroundImageStre... | [
"function",
"(",
"url",
",",
"callback",
",",
"options",
")",
"{",
"return",
"fabric",
".",
"util",
".",
"loadImage",
"(",
"url",
",",
"function",
"(",
"img",
")",
"{",
"this",
".",
"backgroundImage",
"=",
"img",
";",
"if",
"(",
"options",
"&&",
"(",... | Sets background image for this canvas
@method setBackgroundImage
@param {String} url url of an image to set background to
@param {Function} callback callback to invoke when image is loaded and set as background
@param {Object} options optional options to set for the background image
@return {fabric.Canvas} thisArg
@cha... | [
"Sets",
"background",
"image",
"for",
"this",
"canvas"
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/demos/Collage/fabric.js#L5031-L5042 | |
11,401 | MrSwitch/hello.js | demos/Collage/fabric.js | function (canvasEl) {
this.lowerCanvasEl = fabric.util.getById(canvasEl) || this._createCanvasElement();
this._initCanvasElement(this.lowerCanvasEl);
fabric.util.addClass(this.lowerCanvasEl, 'lower-canvas');
if (this.interactive) {
this._applyCanvasStyle(this.lowerCanvasEl);
}
... | javascript | function (canvasEl) {
this.lowerCanvasEl = fabric.util.getById(canvasEl) || this._createCanvasElement();
this._initCanvasElement(this.lowerCanvasEl);
fabric.util.addClass(this.lowerCanvasEl, 'lower-canvas');
if (this.interactive) {
this._applyCanvasStyle(this.lowerCanvasEl);
}
... | [
"function",
"(",
"canvasEl",
")",
"{",
"this",
".",
"lowerCanvasEl",
"=",
"fabric",
".",
"util",
".",
"getById",
"(",
"canvasEl",
")",
"||",
"this",
".",
"_createCanvasElement",
"(",
")",
";",
"this",
".",
"_initCanvasElement",
"(",
"this",
".",
"lowerCanv... | Creates a secondary canvas
@method _createLowerCanvas | [
"Creates",
"a",
"secondary",
"canvas"
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/demos/Collage/fabric.js#L5095-L5106 | |
11,402 | MrSwitch/hello.js | demos/Collage/fabric.js | function (ctx, object) {
if (!object) return;
if (this.controlsAboveOverlay) {
var hasBorders = object.hasBorders, hasCorners = object.hasCorners;
object.hasBorders = object.hasCorners = false;
object.render(ctx);
object.hasBorders = hasBorders;
object.hasCorners = h... | javascript | function (ctx, object) {
if (!object) return;
if (this.controlsAboveOverlay) {
var hasBorders = object.hasBorders, hasCorners = object.hasCorners;
object.hasBorders = object.hasCorners = false;
object.render(ctx);
object.hasBorders = hasBorders;
object.hasCorners = h... | [
"function",
"(",
"ctx",
",",
"object",
")",
"{",
"if",
"(",
"!",
"object",
")",
"return",
";",
"if",
"(",
"this",
".",
"controlsAboveOverlay",
")",
"{",
"var",
"hasBorders",
"=",
"object",
".",
"hasBorders",
",",
"hasCorners",
"=",
"object",
".",
"hasC... | Given a context, renders an object on that context
@param ctx {Object} context to render object on
@param object {Object} object to render
@private | [
"Given",
"a",
"context",
"renders",
"an",
"object",
"on",
"that",
"context"
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/demos/Collage/fabric.js#L5217-L5230 | |
11,403 | MrSwitch/hello.js | demos/Collage/fabric.js | function (allOnTop) {
var canvasToDrawOn = this[(allOnTop === true && this.interactive) ? 'contextTop' : 'contextContainer'];
if (this.contextTop) {
this.clearContext(this.contextTop);
}
if (allOnTop === false || (typeof allOnTop === 'undefined')) {
this.clearContext(canvasToD... | javascript | function (allOnTop) {
var canvasToDrawOn = this[(allOnTop === true && this.interactive) ? 'contextTop' : 'contextContainer'];
if (this.contextTop) {
this.clearContext(this.contextTop);
}
if (allOnTop === false || (typeof allOnTop === 'undefined')) {
this.clearContext(canvasToD... | [
"function",
"(",
"allOnTop",
")",
"{",
"var",
"canvasToDrawOn",
"=",
"this",
"[",
"(",
"allOnTop",
"===",
"true",
"&&",
"this",
".",
"interactive",
")",
"?",
"'contextTop'",
":",
"'contextContainer'",
"]",
";",
"if",
"(",
"this",
".",
"contextTop",
")",
... | Renders both the top canvas and the secondary container canvas.
@method renderAll
@param allOnTop {Boolean} optional Whether we want to force all images to be rendered on the top canvas
@return {fabric.Canvas} instance
@chainable | [
"Renders",
"both",
"the",
"top",
"canvas",
"and",
"the",
"secondary",
"container",
"canvas",
"."
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/demos/Collage/fabric.js#L5334-L5407 | |
11,404 | MrSwitch/hello.js | demos/Collage/fabric.js | function () {
this.clearContext(this.contextTop || this.contextContainer);
if (this.overlayImage) {
this.contextContainer.drawImage(this.overlayImage, 0, 0);
}
// we render the top context - last object
if (this.selection && this._groupSelector) {
this._drawSelection();
... | javascript | function () {
this.clearContext(this.contextTop || this.contextContainer);
if (this.overlayImage) {
this.contextContainer.drawImage(this.overlayImage, 0, 0);
}
// we render the top context - last object
if (this.selection && this._groupSelector) {
this._drawSelection();
... | [
"function",
"(",
")",
"{",
"this",
".",
"clearContext",
"(",
"this",
".",
"contextTop",
"||",
"this",
".",
"contextContainer",
")",
";",
"if",
"(",
"this",
".",
"overlayImage",
")",
"{",
"this",
".",
"contextContainer",
".",
"drawImage",
"(",
"this",
"."... | Method to render only the top canvas.
Also used to render the group selection box.
@method renderTop
@return {fabric.Canvas} thisArg
@chainable | [
"Method",
"to",
"render",
"only",
"the",
"top",
"canvas",
".",
"Also",
"used",
"to",
"render",
"the",
"group",
"selection",
"box",
"."
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/demos/Collage/fabric.js#L5416-L5438 | |
11,405 | MrSwitch/hello.js | demos/Collage/fabric.js | function (format, quality) {
var canvasEl = this.upperCanvasEl || this.lowerCanvasEl;
this.renderAll(true);
var data = (fabric.StaticCanvas.supports('toDataURLWithQuality'))
? canvasEl.toDataURL('image/' + format, quality)
: canvasEl.toDataURL('image/' + format);... | javascript | function (format, quality) {
var canvasEl = this.upperCanvasEl || this.lowerCanvasEl;
this.renderAll(true);
var data = (fabric.StaticCanvas.supports('toDataURLWithQuality'))
? canvasEl.toDataURL('image/' + format, quality)
: canvasEl.toDataURL('image/' + format);... | [
"function",
"(",
"format",
",",
"quality",
")",
"{",
"var",
"canvasEl",
"=",
"this",
".",
"upperCanvasEl",
"||",
"this",
".",
"lowerCanvasEl",
";",
"this",
".",
"renderAll",
"(",
"true",
")",
";",
"var",
"data",
"=",
"(",
"fabric",
".",
"StaticCanvas",
... | Exports canvas element to a dataurl image.
@method toDataURL
@param {String} format the format of the output image. Either "jpeg" or "png".
@param {Number} quality quality level (0..1)
@return {String} | [
"Exports",
"canvas",
"element",
"to",
"a",
"dataurl",
"image",
"."
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/demos/Collage/fabric.js#L5472-L5481 | |
11,406 | MrSwitch/hello.js | demos/Collage/fabric.js | function() {
var markup = [
'<?xml version="1.0" standalone="no" ?>',
'<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN" ',
'"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">',
'<svg ',
'xmlns="http://www.w3.org/2000/svg" ',
'xmlns:xlink=... | javascript | function() {
var markup = [
'<?xml version="1.0" standalone="no" ?>',
'<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN" ',
'"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">',
'<svg ',
'xmlns="http://www.w3.org/2000/svg" ',
'xmlns:xlink=... | [
"function",
"(",
")",
"{",
"var",
"markup",
"=",
"[",
"'<?xml version=\"1.0\" standalone=\"no\" ?>'",
",",
"'<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 20010904//EN\" '",
",",
"'\"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd\">'",
",",
"'<svg '",
",",
"'xmlns=\"http://www.w3.... | Returns SVG representation of canvas
@function
@method toSVG
@return {String} | [
"Returns",
"SVG",
"representation",
"of",
"canvas"
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/demos/Collage/fabric.js#L5667-L5701 | |
11,407 | MrSwitch/hello.js | demos/Collage/fabric.js | function (object) {
removeFromArray(this._objects, object);
if (this.getActiveObject() === object) {
// removing active object should fire "selection:cleared" events
this.fire('before:selection:cleared', { target: object });
this.discardActiveObject();
this.fire('selection:c... | javascript | function (object) {
removeFromArray(this._objects, object);
if (this.getActiveObject() === object) {
// removing active object should fire "selection:cleared" events
this.fire('before:selection:cleared', { target: object });
this.discardActiveObject();
this.fire('selection:c... | [
"function",
"(",
"object",
")",
"{",
"removeFromArray",
"(",
"this",
".",
"_objects",
",",
"object",
")",
";",
"if",
"(",
"this",
".",
"getActiveObject",
"(",
")",
"===",
"object",
")",
"{",
"// removing active object should fire \"selection:cleared\" events",
"th... | Removes an object from canvas and returns it
@method remove
@param object {Object} Object to remove
@return {Object} removed object | [
"Removes",
"an",
"object",
"from",
"canvas",
"and",
"returns",
"it"
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/demos/Collage/fabric.js#L5718-L5729 | |
11,408 | MrSwitch/hello.js | demos/Collage/fabric.js | function (object) {
var idx = this._objects.indexOf(object),
nextIntersectingIdx = idx;
// if object is not on the bottom of stack
if (idx !== 0) {
// traverse down the stack looking for the nearest intersecting object
for (var i=idx-1; i>=0; --i) {
if (object.int... | javascript | function (object) {
var idx = this._objects.indexOf(object),
nextIntersectingIdx = idx;
// if object is not on the bottom of stack
if (idx !== 0) {
// traverse down the stack looking for the nearest intersecting object
for (var i=idx-1; i>=0; --i) {
if (object.int... | [
"function",
"(",
"object",
")",
"{",
"var",
"idx",
"=",
"this",
".",
"_objects",
".",
"indexOf",
"(",
"object",
")",
",",
"nextIntersectingIdx",
"=",
"idx",
";",
"// if object is not on the bottom of stack",
"if",
"(",
"idx",
"!==",
"0",
")",
"{",
"// traver... | Moves an object one level down in stack of drawn objects
@method sendBackwards
@param object {fabric.Object} Object to send
@return {fabric.Canvas} thisArg
@chainable | [
"Moves",
"an",
"object",
"one",
"level",
"down",
"in",
"stack",
"of",
"drawn",
"objects"
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/demos/Collage/fabric.js#L5764-L5782 | |
11,409 | MrSwitch/hello.js | demos/Collage/fabric.js | function (object) {
var objects = this.getObjects(),
idx = objects.indexOf(object),
nextIntersectingIdx = idx;
// if object is not on top of stack (last item in an array)
if (idx !== objects.length-1) {
// traverse up the stack looking for the nearest intersecting object... | javascript | function (object) {
var objects = this.getObjects(),
idx = objects.indexOf(object),
nextIntersectingIdx = idx;
// if object is not on top of stack (last item in an array)
if (idx !== objects.length-1) {
// traverse up the stack looking for the nearest intersecting object... | [
"function",
"(",
"object",
")",
"{",
"var",
"objects",
"=",
"this",
".",
"getObjects",
"(",
")",
",",
"idx",
"=",
"objects",
".",
"indexOf",
"(",
"object",
")",
",",
"nextIntersectingIdx",
"=",
"idx",
";",
"// if object is not on top of stack (last item in an ar... | Moves an object one level up in stack of drawn objects
@method bringForward
@param object {fabric.Object} Object to send
@return {fabric.Canvas} thisArg
@chainable | [
"Moves",
"an",
"object",
"one",
"level",
"up",
"in",
"stack",
"of",
"drawn",
"objects"
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/demos/Collage/fabric.js#L5791-L5811 | |
11,410 | MrSwitch/hello.js | demos/Collage/fabric.js | function () {
return this.getObjects().reduce(function (memo, current) {
memo += current.complexity ? current.complexity() : 0;
return memo;
}, 0);
} | javascript | function () {
return this.getObjects().reduce(function (memo, current) {
memo += current.complexity ? current.complexity() : 0;
return memo;
}, 0);
} | [
"function",
"(",
")",
"{",
"return",
"this",
".",
"getObjects",
"(",
")",
".",
"reduce",
"(",
"function",
"(",
"memo",
",",
"current",
")",
"{",
"memo",
"+=",
"current",
".",
"complexity",
"?",
"current",
".",
"complexity",
"(",
")",
":",
"0",
";",
... | Returns number representation of an instance complexity
@method complexity
@return {Number} complexity | [
"Returns",
"number",
"representation",
"of",
"an",
"instance",
"complexity"
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/demos/Collage/fabric.js#L5828-L5833 | |
11,411 | MrSwitch/hello.js | demos/Collage/fabric.js | function(callback, context) {
var objects = this.getObjects(),
i = objects.length;
while (i--) {
callback.call(context, objects[i], i, objects);
}
return this;
} | javascript | function(callback, context) {
var objects = this.getObjects(),
i = objects.length;
while (i--) {
callback.call(context, objects[i], i, objects);
}
return this;
} | [
"function",
"(",
"callback",
",",
"context",
")",
"{",
"var",
"objects",
"=",
"this",
".",
"getObjects",
"(",
")",
",",
"i",
"=",
"objects",
".",
"length",
";",
"while",
"(",
"i",
"--",
")",
"{",
"callback",
".",
"call",
"(",
"context",
",",
"objec... | Iterates over all objects, invoking callback for each one of them
@method forEachObject
@return {fabric.Canvas} thisArg | [
"Iterates",
"over",
"all",
"objects",
"invoking",
"callback",
"for",
"each",
"one",
"of",
"them"
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/demos/Collage/fabric.js#L5840-L5847 | |
11,412 | MrSwitch/hello.js | demos/Collage/fabric.js | function () {
this.clear();
if (this.interactive) {
removeListener(this.upperCanvasEl, 'mousedown', this._onMouseDown);
removeListener(this.upperCanvasEl, 'mousemove', this._onMouseMove);
removeListener(fabric.window, 'resize', this._onResize);
}
return this;
} | javascript | function () {
this.clear();
if (this.interactive) {
removeListener(this.upperCanvasEl, 'mousedown', this._onMouseDown);
removeListener(this.upperCanvasEl, 'mousemove', this._onMouseMove);
removeListener(fabric.window, 'resize', this._onResize);
}
return this;
} | [
"function",
"(",
")",
"{",
"this",
".",
"clear",
"(",
")",
";",
"if",
"(",
"this",
".",
"interactive",
")",
"{",
"removeListener",
"(",
"this",
".",
"upperCanvasEl",
",",
"'mousedown'",
",",
"this",
".",
"_onMouseDown",
")",
";",
"removeListener",
"(",
... | Clears a canvas element and removes all event handlers.
@method dispose
@return {fabric.Canvas} thisArg
@chainable | [
"Clears",
"a",
"canvas",
"element",
"and",
"removes",
"all",
"event",
"handlers",
"."
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/demos/Collage/fabric.js#L5855-L5863 | |
11,413 | MrSwitch/hello.js | demos/Collage/fabric.js | function () {
var _this = this;
this._onMouseDown = function (e) {
_this.__onMouseDown(e);
addListener(fabric.document, 'mouseup', _this._onMouseUp);
fabric.isTouchSupported && addListener(fabric.document, 'touchend', _this._onMouseUp);
addListener(fabric.document, 'mousem... | javascript | function () {
var _this = this;
this._onMouseDown = function (e) {
_this.__onMouseDown(e);
addListener(fabric.document, 'mouseup', _this._onMouseUp);
fabric.isTouchSupported && addListener(fabric.document, 'touchend', _this._onMouseUp);
addListener(fabric.document, 'mousem... | [
"function",
"(",
")",
"{",
"var",
"_this",
"=",
"this",
";",
"this",
".",
"_onMouseDown",
"=",
"function",
"(",
"e",
")",
"{",
"_this",
".",
"__onMouseDown",
"(",
"e",
")",
";",
"addListener",
"(",
"fabric",
".",
"document",
",",
"'mouseup'",
",",
"_... | Adds mouse listeners to canvas
@method _initEvents
@private
See configuration documentation for more details. | [
"Adds",
"mouse",
"listeners",
"to",
"canvas"
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/demos/Collage/fabric.js#L6144-L6193 | |
11,414 | MrSwitch/hello.js | demos/Collage/fabric.js | function (e, target) {
var pointer = this.getPointer(e),
xy = this._normalizePointer(target, pointer),
x = xy.x,
y = xy.y;
// http://www.geog.ubc.ca/courses/klink/gis.notes/ncgia/u32.html
// http://idav.ucdavis.edu/~okreylos/TAship/Spring2000/PointInPolygon.html
/... | javascript | function (e, target) {
var pointer = this.getPointer(e),
xy = this._normalizePointer(target, pointer),
x = xy.x,
y = xy.y;
// http://www.geog.ubc.ca/courses/klink/gis.notes/ncgia/u32.html
// http://idav.ucdavis.edu/~okreylos/TAship/Spring2000/PointInPolygon.html
/... | [
"function",
"(",
"e",
",",
"target",
")",
"{",
"var",
"pointer",
"=",
"this",
".",
"getPointer",
"(",
"e",
")",
",",
"xy",
"=",
"this",
".",
"_normalizePointer",
"(",
"target",
",",
"pointer",
")",
",",
"x",
"=",
"xy",
".",
"x",
",",
"y",
"=",
... | Applies one implementation of 'point inside polygon' algorithm
@method containsPoint
@param e { Event } event object
@param target { fabric.Object } object to test against
@return {Boolean} true if point contains within area of given object | [
"Applies",
"one",
"implementation",
"of",
"point",
"inside",
"polygon",
"algorithm"
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/demos/Collage/fabric.js#L6471-L6490 | |
11,415 | MrSwitch/hello.js | demos/Collage/fabric.js | function (x, y) {
var t = this._currentTransform,
o = this._offset;
if (t.target.lockRotation) return;
var lastAngle = atan2(t.ey - t.top - o.top, t.ex - t.left - o.left),
curAngle = atan2(y - t.top - o.top, x - t.left - o.left);
t.target._theta = (curAngle - lastAngle) +... | javascript | function (x, y) {
var t = this._currentTransform,
o = this._offset;
if (t.target.lockRotation) return;
var lastAngle = atan2(t.ey - t.top - o.top, t.ex - t.left - o.left),
curAngle = atan2(y - t.top - o.top, x - t.left - o.left);
t.target._theta = (curAngle - lastAngle) +... | [
"function",
"(",
"x",
",",
"y",
")",
"{",
"var",
"t",
"=",
"this",
".",
"_currentTransform",
",",
"o",
"=",
"this",
".",
"_offset",
";",
"if",
"(",
"t",
".",
"target",
".",
"lockRotation",
")",
"return",
";",
"var",
"lastAngle",
"=",
"atan2",
"(",
... | Rotates object by invoking its rotate method
@method _rotateObject
@param x {Number} pointer's x coordinate
@param y {Number} pointer's y coordinate | [
"Rotates",
"object",
"by",
"invoking",
"its",
"rotate",
"method"
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/demos/Collage/fabric.js#L6801-L6812 | |
11,416 | MrSwitch/hello.js | demos/Collage/fabric.js | function (e, skipGroup) {
var target,
pointer = this.getPointer(e);
// first check current group (if one exists)
var activeGroup = this.getActiveGroup();
if (activeGroup && !skipGroup && this.containsPoint(e, activeGroup)) {
target = activeGroup;
return target;
... | javascript | function (e, skipGroup) {
var target,
pointer = this.getPointer(e);
// first check current group (if one exists)
var activeGroup = this.getActiveGroup();
if (activeGroup && !skipGroup && this.containsPoint(e, activeGroup)) {
target = activeGroup;
return target;
... | [
"function",
"(",
"e",
",",
"skipGroup",
")",
"{",
"var",
"target",
",",
"pointer",
"=",
"this",
".",
"getPointer",
"(",
"e",
")",
";",
"// first check current group (if one exists)",
"var",
"activeGroup",
"=",
"this",
".",
"getActiveGroup",
"(",
")",
";",
"i... | Method that determines what object we are clicking on
@method findTarget
@param {Event} e mouse event
@param {Boolean} skipGroup when true, group is skipped and only objects are traversed through | [
"Method",
"that",
"determines",
"what",
"object",
"we",
"are",
"clicking",
"on"
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/demos/Collage/fabric.js#L6936-L6976 | |
11,417 | MrSwitch/hello.js | demos/Collage/fabric.js | function (e) {
var pointer = getPointer(e);
return {
x: pointer.x - this._offset.left,
y: pointer.y - this._offset.top
};
} | javascript | function (e) {
var pointer = getPointer(e);
return {
x: pointer.x - this._offset.left,
y: pointer.y - this._offset.top
};
} | [
"function",
"(",
"e",
")",
"{",
"var",
"pointer",
"=",
"getPointer",
"(",
"e",
")",
";",
"return",
"{",
"x",
":",
"pointer",
".",
"x",
"-",
"this",
".",
"_offset",
".",
"left",
",",
"y",
":",
"pointer",
".",
"y",
"-",
"this",
".",
"_offset",
".... | Returns pointer coordinates relative to canvas.
@method getPointer
@return {Object} object with "x" and "y" number values | [
"Returns",
"pointer",
"coordinates",
"relative",
"to",
"canvas",
"."
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/demos/Collage/fabric.js#L6983-L6989 | |
11,418 | MrSwitch/hello.js | demos/Collage/fabric.js | function (object, e) {
if (this._activeObject) {
this._activeObject.setActive(false);
}
this._activeObject = object;
object.setActive(true);
this.renderAll();
this.fire('object:selected', { target: object, e: e });
object.fire('selected', { e: e });
return this;... | javascript | function (object, e) {
if (this._activeObject) {
this._activeObject.setActive(false);
}
this._activeObject = object;
object.setActive(true);
this.renderAll();
this.fire('object:selected', { target: object, e: e });
object.fire('selected', { e: e });
return this;... | [
"function",
"(",
"object",
",",
"e",
")",
"{",
"if",
"(",
"this",
".",
"_activeObject",
")",
"{",
"this",
".",
"_activeObject",
".",
"setActive",
"(",
"false",
")",
";",
"}",
"this",
".",
"_activeObject",
"=",
"object",
";",
"object",
".",
"setActive",... | Sets given object as active
@method setActiveObject
@param object {fabric.Object} Object to set as an active one
@return {fabric.Canvas} thisArg
@chainable | [
"Sets",
"given",
"object",
"as",
"active"
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/demos/Collage/fabric.js#L7077-L7089 | |
11,419 | MrSwitch/hello.js | demos/Collage/fabric.js | function () {
var activeObject = this.getActiveGroup() || this.getActiveObject();
if (activeObject) {
this.fire('before:selection:cleared', { target: activeObject });
}
this.deactivateAll();
if (activeObject) {
this.fire('selection:cleared');
}
return this;
... | javascript | function () {
var activeObject = this.getActiveGroup() || this.getActiveObject();
if (activeObject) {
this.fire('before:selection:cleared', { target: activeObject });
}
this.deactivateAll();
if (activeObject) {
this.fire('selection:cleared');
}
return this;
... | [
"function",
"(",
")",
"{",
"var",
"activeObject",
"=",
"this",
".",
"getActiveGroup",
"(",
")",
"||",
"this",
".",
"getActiveObject",
"(",
")",
";",
"if",
"(",
"activeObject",
")",
"{",
"this",
".",
"fire",
"(",
"'before:selection:cleared'",
",",
"{",
"t... | Deactivates all objects and dispatches appropriate events
@method deactivateAllWithDispatch
@return {fabric.Canvas} thisArg | [
"Deactivates",
"all",
"objects",
"and",
"dispatches",
"appropriate",
"events"
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/demos/Collage/fabric.js#L7171-L7181 | |
11,420 | MrSwitch/hello.js | demos/Collage/fabric.js | function (object, callbacks) {
callbacks = callbacks || { };
var empty = function() { },
onComplete = callbacks.onComplete || empty,
onChange = callbacks.onChange || empty,
_this = this;
fabric.util.animate({
startValue: object.get('left'),
endValue: this.getCenter().le... | javascript | function (object, callbacks) {
callbacks = callbacks || { };
var empty = function() { },
onComplete = callbacks.onComplete || empty,
onChange = callbacks.onChange || empty,
_this = this;
fabric.util.animate({
startValue: object.get('left'),
endValue: this.getCenter().le... | [
"function",
"(",
"object",
",",
"callbacks",
")",
"{",
"callbacks",
"=",
"callbacks",
"||",
"{",
"}",
";",
"var",
"empty",
"=",
"function",
"(",
")",
"{",
"}",
",",
"onComplete",
"=",
"callbacks",
".",
"onComplete",
"||",
"empty",
",",
"onChange",
"=",... | Centers object horizontally with animation.
@method fxCenterObjectH
@param {fabric.Object} object Object to center
@param {Object} [callbacks] Callbacks object with optional "onComplete" and/or "onChange" properties
@return {fabric.Canvas} thisArg
@chainable | [
"Centers",
"object",
"horizontally",
"with",
"animation",
"."
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/demos/Collage/fabric.js#L7219-L7243 | |
11,421 | MrSwitch/hello.js | demos/Collage/fabric.js | function (callback) {
var data = JSON.stringify(this);
this.cloneWithoutData(function(clone) {
clone.loadFromJSON(data, function() {
callback && callback(clone);
});
});
} | javascript | function (callback) {
var data = JSON.stringify(this);
this.cloneWithoutData(function(clone) {
clone.loadFromJSON(data, function() {
callback && callback(clone);
});
});
} | [
"function",
"(",
"callback",
")",
"{",
"var",
"data",
"=",
"JSON",
".",
"stringify",
"(",
"this",
")",
";",
"this",
".",
"cloneWithoutData",
"(",
"function",
"(",
"clone",
")",
"{",
"clone",
".",
"loadFromJSON",
"(",
"data",
",",
"function",
"(",
")",
... | Clones canvas instance
@method clone
@param {Object} [callback] Receives cloned instance as a first argument | [
"Clones",
"canvas",
"instance"
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/demos/Collage/fabric.js#L7546-L7553 | |
11,422 | MrSwitch/hello.js | demos/Collage/fabric.js | function() {
var NUM_FRACTION_DIGITS = fabric.Object.NUM_FRACTION_DIGITS;
var object = {
type: this.type,
left: toFixed(this.left, NUM_FRACTION_DIGITS),
top: toFixed(this.top, NUM_FRACTION_DIGITS),
width: toFixed(this.width, N... | javascript | function() {
var NUM_FRACTION_DIGITS = fabric.Object.NUM_FRACTION_DIGITS;
var object = {
type: this.type,
left: toFixed(this.left, NUM_FRACTION_DIGITS),
top: toFixed(this.top, NUM_FRACTION_DIGITS),
width: toFixed(this.width, N... | [
"function",
"(",
")",
"{",
"var",
"NUM_FRACTION_DIGITS",
"=",
"fabric",
".",
"Object",
".",
"NUM_FRACTION_DIGITS",
";",
"var",
"object",
"=",
"{",
"type",
":",
"this",
".",
"type",
",",
"left",
":",
"toFixed",
"(",
"this",
".",
"left",
",",
"NUM_FRACTION... | Returns an object representation of an instance
@method toObject
@return {Object} | [
"Returns",
"an",
"object",
"representation",
"of",
"an",
"instance"
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/demos/Collage/fabric.js#L7882-L7916 | |
11,423 | MrSwitch/hello.js | demos/Collage/fabric.js | function() {
return [
"stroke: ", (this.stroke ? this.stroke : 'none'), "; ",
"stroke-width: ", (this.strokeWidth ? this.strokeWidth : '0'), "; ",
"stroke-dasharray: ", (this.strokeDashArray ? this.strokeDashArray.join(' ') : "; "),
"fill: ", (this.fill ? this.fill : 'none'), "; ",... | javascript | function() {
return [
"stroke: ", (this.stroke ? this.stroke : 'none'), "; ",
"stroke-width: ", (this.strokeWidth ? this.strokeWidth : '0'), "; ",
"stroke-dasharray: ", (this.strokeDashArray ? this.strokeDashArray.join(' ') : "; "),
"fill: ", (this.fill ? this.fill : 'none'), "; ",... | [
"function",
"(",
")",
"{",
"return",
"[",
"\"stroke: \"",
",",
"(",
"this",
".",
"stroke",
"?",
"this",
".",
"stroke",
":",
"'none'",
")",
",",
"\"; \"",
",",
"\"stroke-width: \"",
",",
"(",
"this",
".",
"strokeWidth",
"?",
"this",
".",
"strokeWidth",
... | Returns styles-string for svg-export
@method getSvgStyles
@return {string} | [
"Returns",
"styles",
"-",
"string",
"for",
"svg",
"-",
"export"
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/demos/Collage/fabric.js#L7932-L7940 | |
11,424 | MrSwitch/hello.js | demos/Collage/fabric.js | function() {
var angle = this.getAngle();
return [
"translate(", toFixed(this.left, 2), " ", toFixed(this.top, 2), ")",
angle !== 0 ? (" rotate(" + toFixed(angle, 2) + ")") : '',
(this.scaleX === 1 && this.scaleY === 1) ? '' : (" scale(" + toFixed(this.scaleX, 2) + " " + toFixed(this... | javascript | function() {
var angle = this.getAngle();
return [
"translate(", toFixed(this.left, 2), " ", toFixed(this.top, 2), ")",
angle !== 0 ? (" rotate(" + toFixed(angle, 2) + ")") : '',
(this.scaleX === 1 && this.scaleY === 1) ? '' : (" scale(" + toFixed(this.scaleX, 2) + " " + toFixed(this... | [
"function",
"(",
")",
"{",
"var",
"angle",
"=",
"this",
".",
"getAngle",
"(",
")",
";",
"return",
"[",
"\"translate(\"",
",",
"toFixed",
"(",
"this",
".",
"left",
",",
"2",
")",
",",
"\" \"",
",",
"toFixed",
"(",
"this",
".",
"top",
",",
"2",
")"... | Returns transform-string for svg-export
@method getSvgTransform
@return {string} | [
"Returns",
"transform",
"-",
"string",
"for",
"svg",
"-",
"export"
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/demos/Collage/fabric.js#L7947-L7954 | |
11,425 | MrSwitch/hello.js | demos/Collage/fabric.js | function(key, value) {
if (typeof key === 'object') {
for (var prop in key) {
this._set(prop, key[prop]);
}
}
else {
if (typeof value === 'function') {
this._set(key, value(this.get(key)));
}
else {
this._set(key, value);
}
... | javascript | function(key, value) {
if (typeof key === 'object') {
for (var prop in key) {
this._set(prop, key[prop]);
}
}
else {
if (typeof value === 'function') {
this._set(key, value(this.get(key)));
}
else {
this._set(key, value);
}
... | [
"function",
"(",
"key",
",",
"value",
")",
"{",
"if",
"(",
"typeof",
"key",
"===",
"'object'",
")",
"{",
"for",
"(",
"var",
"prop",
"in",
"key",
")",
"{",
"this",
".",
"_set",
"(",
"prop",
",",
"key",
"[",
"prop",
"]",
")",
";",
"}",
"}",
"el... | Sets property to a given value
@method set
@param {String} name
@param {Object|Function} value
@return {fabric.Group} thisArg
@chainable | [
"Sets",
"property",
"to",
"a",
"given",
"value"
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/demos/Collage/fabric.js#L8007-L8022 | |
11,426 | MrSwitch/hello.js | demos/Collage/fabric.js | function() {
this.oCoords || this.setCoords();
var xCoords = [this.oCoords.tl.x, this.oCoords.tr.x, this.oCoords.br.x, this.oCoords.bl.x];
var minX = fabric.util.array.min(xCoords);
var maxX = fabric.util.array.max(xCoords);
return Math.abs(minX - maxX);
} | javascript | function() {
this.oCoords || this.setCoords();
var xCoords = [this.oCoords.tl.x, this.oCoords.tr.x, this.oCoords.br.x, this.oCoords.bl.x];
var minX = fabric.util.array.min(xCoords);
var maxX = fabric.util.array.max(xCoords);
return Math.abs(minX - maxX);
} | [
"function",
"(",
")",
"{",
"this",
".",
"oCoords",
"||",
"this",
".",
"setCoords",
"(",
")",
";",
"var",
"xCoords",
"=",
"[",
"this",
".",
"oCoords",
".",
"tl",
".",
"x",
",",
"this",
".",
"oCoords",
".",
"tr",
".",
"x",
",",
"this",
".",
"oCoo... | Returns width of an object's bounding rectangle
@method getBoundingRectWidth
@return {Number} width value | [
"Returns",
"width",
"of",
"an",
"object",
"s",
"bounding",
"rectangle"
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/demos/Collage/fabric.js#L8309-L8315 | |
11,427 | MrSwitch/hello.js | demos/Collage/fabric.js | function() {
this.oCoords || this.setCoords();
var yCoords = [this.oCoords.tl.y, this.oCoords.tr.y, this.oCoords.br.y, this.oCoords.bl.y];
var minY = fabric.util.array.min(yCoords);
var maxY = fabric.util.array.max(yCoords);
return Math.abs(minY - maxY);
} | javascript | function() {
this.oCoords || this.setCoords();
var yCoords = [this.oCoords.tl.y, this.oCoords.tr.y, this.oCoords.br.y, this.oCoords.bl.y];
var minY = fabric.util.array.min(yCoords);
var maxY = fabric.util.array.max(yCoords);
return Math.abs(minY - maxY);
} | [
"function",
"(",
")",
"{",
"this",
".",
"oCoords",
"||",
"this",
".",
"setCoords",
"(",
")",
";",
"var",
"yCoords",
"=",
"[",
"this",
".",
"oCoords",
".",
"tl",
".",
"y",
",",
"this",
".",
"oCoords",
".",
"tr",
".",
"y",
",",
"this",
".",
"oCoo... | Returns height of an object's bounding rectangle
@method getBoundingRectHeight
@return {Number} height value | [
"Returns",
"height",
"of",
"an",
"object",
"s",
"bounding",
"rectangle"
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/demos/Collage/fabric.js#L8322-L8328 | |
11,428 | MrSwitch/hello.js | demos/Collage/fabric.js | function(options) {
if (this.constructor.fromObject) {
return this.constructor.fromObject(this.toObject(), options);
}
return new fabric.Object(this.toObject());
} | javascript | function(options) {
if (this.constructor.fromObject) {
return this.constructor.fromObject(this.toObject(), options);
}
return new fabric.Object(this.toObject());
} | [
"function",
"(",
"options",
")",
"{",
"if",
"(",
"this",
".",
"constructor",
".",
"fromObject",
")",
"{",
"return",
"this",
".",
"constructor",
".",
"fromObject",
"(",
"this",
".",
"toObject",
"(",
")",
",",
"options",
")",
";",
"}",
"return",
"new",
... | Clones an instance
@method clone
@param {Object} options object
@return {fabric.Object} clone of an instance | [
"Clones",
"an",
"instance"
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/demos/Collage/fabric.js#L8567-L8572 | |
11,429 | MrSwitch/hello.js | demos/Collage/fabric.js | function(callback) {
if (fabric.Image) {
var i = new Image();
/** @ignore */
i.onload = function() {
if (callback) {
callback(new fabric.Image(i), orig);
}
i = i.onload = null;
};
var orig = {
angle: this.get('angle'),
... | javascript | function(callback) {
if (fabric.Image) {
var i = new Image();
/** @ignore */
i.onload = function() {
if (callback) {
callback(new fabric.Image(i), orig);
}
i = i.onload = null;
};
var orig = {
angle: this.get('angle'),
... | [
"function",
"(",
"callback",
")",
"{",
"if",
"(",
"fabric",
".",
"Image",
")",
"{",
"var",
"i",
"=",
"new",
"Image",
"(",
")",
";",
"/** @ignore */",
"i",
".",
"onload",
"=",
"function",
"(",
")",
"{",
"if",
"(",
"callback",
")",
"{",
"callback",
... | Creates an instance of fabric.Image out of an object
@method cloneAsImage
@param callback {Function} callback, invoked with an instance as a first argument
@return {fabric.Object} thisArg
@chainable | [
"Creates",
"an",
"instance",
"of",
"fabric",
".",
"Image",
"out",
"of",
"an",
"object"
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/demos/Collage/fabric.js#L8581-L8606 | |
11,430 | MrSwitch/hello.js | demos/Collage/fabric.js | function(callback) {
var el = fabric.document.createElement('canvas');
if (!el.getContext && typeof G_vmlCanvasManager != 'undefined') {
G_vmlCanvasManager.initElement(el);
}
el.width = this.getBoundingRectWidth();
el.height = this.getBoundingRectHeight();
fabric.util.wrapE... | javascript | function(callback) {
var el = fabric.document.createElement('canvas');
if (!el.getContext && typeof G_vmlCanvasManager != 'undefined') {
G_vmlCanvasManager.initElement(el);
}
el.width = this.getBoundingRectWidth();
el.height = this.getBoundingRectHeight();
fabric.util.wrapE... | [
"function",
"(",
"callback",
")",
"{",
"var",
"el",
"=",
"fabric",
".",
"document",
".",
"createElement",
"(",
"'canvas'",
")",
";",
"if",
"(",
"!",
"el",
".",
"getContext",
"&&",
"typeof",
"G_vmlCanvasManager",
"!=",
"'undefined'",
")",
"{",
"G_vmlCanvasM... | Converts an object into a data-url-like string
@method toDataURL
@return {String} string of data | [
"Converts",
"an",
"object",
"into",
"a",
"data",
"-",
"url",
"-",
"like",
"string"
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/demos/Collage/fabric.js#L8613-L8649 | |
11,431 | MrSwitch/hello.js | demos/Collage/fabric.js | function(selectionTL, selectionBR) {
var oCoords = this.oCoords,
tl = new fabric.Point(oCoords.tl.x, oCoords.tl.y),
tr = new fabric.Point(oCoords.tr.x, oCoords.tr.y),
bl = new fabric.Point(oCoords.bl.x, oCoords.bl.y),
br = new fabric.Point(oCoords.br.x, oCoords.br.y);
... | javascript | function(selectionTL, selectionBR) {
var oCoords = this.oCoords,
tl = new fabric.Point(oCoords.tl.x, oCoords.tl.y),
tr = new fabric.Point(oCoords.tr.x, oCoords.tr.y),
bl = new fabric.Point(oCoords.bl.x, oCoords.bl.y),
br = new fabric.Point(oCoords.br.x, oCoords.br.y);
... | [
"function",
"(",
"selectionTL",
",",
"selectionBR",
")",
"{",
"var",
"oCoords",
"=",
"this",
".",
"oCoords",
",",
"tl",
"=",
"new",
"fabric",
".",
"Point",
"(",
"oCoords",
".",
"tl",
".",
"x",
",",
"oCoords",
".",
"tl",
".",
"y",
")",
",",
"tr",
... | Returns true if object intersects with an area formed by 2 points
@method intersectsWithRect
@param {Object} selectionTL
@param {Object} selectionBR
@return {Boolean} | [
"Returns",
"true",
"if",
"object",
"intersects",
"with",
"an",
"area",
"formed",
"by",
"2",
"points"
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/demos/Collage/fabric.js#L8688-L8701 | |
11,432 | MrSwitch/hello.js | demos/Collage/fabric.js | function(other) {
// extracts coords
function getCoords(oCoords) {
return {
tl: new fabric.Point(oCoords.tl.x, oCoords.tl.y),
tr: new fabric.Point(oCoords.tr.x, oCoords.tr.y),
bl: new fabric.Point(oCoords.bl.x, oCoords.bl.y),
br: new fabric.Point(oCoords.br.x,... | javascript | function(other) {
// extracts coords
function getCoords(oCoords) {
return {
tl: new fabric.Point(oCoords.tl.x, oCoords.tl.y),
tr: new fabric.Point(oCoords.tr.x, oCoords.tr.y),
bl: new fabric.Point(oCoords.bl.x, oCoords.bl.y),
br: new fabric.Point(oCoords.br.x,... | [
"function",
"(",
"other",
")",
"{",
"// extracts coords",
"function",
"getCoords",
"(",
"oCoords",
")",
"{",
"return",
"{",
"tl",
":",
"new",
"fabric",
".",
"Point",
"(",
"oCoords",
".",
"tl",
".",
"x",
",",
"oCoords",
".",
"tl",
".",
"y",
")",
",",
... | Returns true if object intersects with another object
@method intersectsWithObject
@param {Object} other Object to test
@return {Boolean} | [
"Returns",
"true",
"if",
"object",
"intersects",
"with",
"another",
"object"
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/demos/Collage/fabric.js#L8709-L8728 | |
11,433 | MrSwitch/hello.js | demos/Collage/fabric.js | function(selectionTL, selectionBR) {
var oCoords = this.oCoords,
tl = new fabric.Point(oCoords.tl.x, oCoords.tl.y),
tr = new fabric.Point(oCoords.tr.x, oCoords.tr.y),
bl = new fabric.Point(oCoords.bl.x, oCoords.bl.y),
br = new fabric.Point(oCoords.br.x, oCoords.br.y);
... | javascript | function(selectionTL, selectionBR) {
var oCoords = this.oCoords,
tl = new fabric.Point(oCoords.tl.x, oCoords.tl.y),
tr = new fabric.Point(oCoords.tr.x, oCoords.tr.y),
bl = new fabric.Point(oCoords.bl.x, oCoords.bl.y),
br = new fabric.Point(oCoords.br.x, oCoords.br.y);
... | [
"function",
"(",
"selectionTL",
",",
"selectionBR",
")",
"{",
"var",
"oCoords",
"=",
"this",
".",
"oCoords",
",",
"tl",
"=",
"new",
"fabric",
".",
"Point",
"(",
"oCoords",
".",
"tl",
".",
"x",
",",
"oCoords",
".",
"tl",
".",
"y",
")",
",",
"tr",
... | Returns true if object is fully contained within area formed by 2 points
@method isContainedWithinRect
@param {Object} selectionTL
@param {Object} selectionBR
@return {Boolean} | [
"Returns",
"true",
"if",
"object",
"is",
"fully",
"contained",
"within",
"area",
"formed",
"by",
"2",
"points"
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/demos/Collage/fabric.js#L8747-L8758 | |
11,434 | MrSwitch/hello.js | demos/Collage/fabric.js | function(e, offset) {
if (!this.hasControls || !this.active) return false;
var pointer = getPointer(e),
ex = pointer.x - offset.left,
ey = pointer.y - offset.top,
xpoints,
lines;
for (var i in this.oCoords) {
if (i === 'mtr' && !this.hasRotatingPoint)... | javascript | function(e, offset) {
if (!this.hasControls || !this.active) return false;
var pointer = getPointer(e),
ex = pointer.x - offset.left,
ey = pointer.y - offset.top,
xpoints,
lines;
for (var i in this.oCoords) {
if (i === 'mtr' && !this.hasRotatingPoint)... | [
"function",
"(",
"e",
",",
"offset",
")",
"{",
"if",
"(",
"!",
"this",
".",
"hasControls",
"||",
"!",
"this",
".",
"active",
")",
"return",
"false",
";",
"var",
"pointer",
"=",
"getPointer",
"(",
"e",
")",
",",
"ex",
"=",
"pointer",
".",
"x",
"-"... | Determines which one of the four corners has been clicked
@method _findTargetCorner
@private
@param e {Event} event object
@param offset {Object} canvas offset
@return {String|Boolean} corner code (tl, tr, bl, br, etc.), or false if nothing is found | [
"Determines",
"which",
"one",
"of",
"the",
"four",
"corners",
"has",
"been",
"clicked"
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/demos/Collage/fabric.js#L8777-L8819 | |
11,435 | MrSwitch/hello.js | demos/Collage/fabric.js | function(ex, ey, oCoords) {
var b1, b2, a1, a2, xi, yi,
xcount = 0,
iLine;
for (var lineKey in oCoords) {
iLine = oCoords[lineKey];
// optimisation 1: line below dot. no cross
if ((iLine.o.y < ey) && (iLine.d.y < ey)) {
continue;
}
// op... | javascript | function(ex, ey, oCoords) {
var b1, b2, a1, a2, xi, yi,
xcount = 0,
iLine;
for (var lineKey in oCoords) {
iLine = oCoords[lineKey];
// optimisation 1: line below dot. no cross
if ((iLine.o.y < ey) && (iLine.d.y < ey)) {
continue;
}
// op... | [
"function",
"(",
"ex",
",",
"ey",
",",
"oCoords",
")",
"{",
"var",
"b1",
",",
"b2",
",",
"a1",
",",
"a2",
",",
"xi",
",",
"yi",
",",
"xcount",
"=",
"0",
",",
"iLine",
";",
"for",
"(",
"var",
"lineKey",
"in",
"oCoords",
")",
"{",
"iLine",
"=",... | Helper method to determine how many cross points are between the 4 image edges
and the horizontal line determined by the position of our mouse when clicked on canvas
@method _findCrossPoints
@private
@param ex {Number} x coordinate of the mouse
@param ey {Number} y coordinate of the mouse
@param oCoords {Object} Coordi... | [
"Helper",
"method",
"to",
"determine",
"how",
"many",
"cross",
"points",
"are",
"between",
"the",
"4",
"image",
"edges",
"and",
"the",
"horizontal",
"line",
"determined",
"by",
"the",
"position",
"of",
"our",
"mouse",
"when",
"clicked",
"on",
"canvas"
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/demos/Collage/fabric.js#L8830-L8870 | |
11,436 | MrSwitch/hello.js | demos/Collage/fabric.js | function(oCoords, i) {
return {
topline: {
o: oCoords.tl,
d: oCoords.tr
},
rightline: {
o: oCoords.tr,
d: oCoords.br
},
bottomline: {
o: oCoords.br,
d: oCoords.bl
},
leftline: {
o: oCoords... | javascript | function(oCoords, i) {
return {
topline: {
o: oCoords.tl,
d: oCoords.tr
},
rightline: {
o: oCoords.tr,
d: oCoords.br
},
bottomline: {
o: oCoords.br,
d: oCoords.bl
},
leftline: {
o: oCoords... | [
"function",
"(",
"oCoords",
",",
"i",
")",
"{",
"return",
"{",
"topline",
":",
"{",
"o",
":",
"oCoords",
".",
"tl",
",",
"d",
":",
"oCoords",
".",
"tr",
"}",
",",
"rightline",
":",
"{",
"o",
":",
"oCoords",
".",
"tr",
",",
"d",
":",
"oCoords",
... | Method that returns an object with the image lines in it given the coordinates of the corners
@method _getImageLines
@private
@param oCoords {Object} coordinates of the image corners | [
"Method",
"that",
"returns",
"an",
"object",
"with",
"the",
"image",
"lines",
"in",
"it",
"given",
"the",
"coordinates",
"of",
"the",
"corners"
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/demos/Collage/fabric.js#L8878-L8897 | |
11,437 | MrSwitch/hello.js | demos/Collage/fabric.js | function(parsedAttributes) {
if (parsedAttributes.left) {
this.set('left', parsedAttributes.left + this.getWidth() / 2);
}
this.set('x', parsedAttributes.left || 0);
if (parsedAttributes.top) {
this.set('top', parsedAttributes.top + this.getHeight() / 2);
}
this.set('... | javascript | function(parsedAttributes) {
if (parsedAttributes.left) {
this.set('left', parsedAttributes.left + this.getWidth() / 2);
}
this.set('x', parsedAttributes.left || 0);
if (parsedAttributes.top) {
this.set('top', parsedAttributes.top + this.getHeight() / 2);
}
this.set('... | [
"function",
"(",
"parsedAttributes",
")",
"{",
"if",
"(",
"parsedAttributes",
".",
"left",
")",
"{",
"this",
".",
"set",
"(",
"'left'",
",",
"parsedAttributes",
".",
"left",
"+",
"this",
".",
"getWidth",
"(",
")",
"/",
"2",
")",
";",
"}",
"this",
"."... | since our coordinate system differs from that of SVG | [
"since",
"our",
"coordinate",
"system",
"differs",
"from",
"that",
"of",
"SVG"
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/demos/Collage/fabric.js#L10067-L10077 | |
11,438 | MrSwitch/hello.js | demos/Collage/fabric.js | function(ctx, noTransform) {
ctx.save();
var m = this.transformMatrix;
if (m) {
ctx.transform(m[0], m[1], m[2], m[3], m[4], m[5]);
}
if (!noTransform) {
this.transform(ctx);
}
// ctx.globalCompositeOperation = this.fillRule;
if (this.overlayFill) {
... | javascript | function(ctx, noTransform) {
ctx.save();
var m = this.transformMatrix;
if (m) {
ctx.transform(m[0], m[1], m[2], m[3], m[4], m[5]);
}
if (!noTransform) {
this.transform(ctx);
}
// ctx.globalCompositeOperation = this.fillRule;
if (this.overlayFill) {
... | [
"function",
"(",
"ctx",
",",
"noTransform",
")",
"{",
"ctx",
".",
"save",
"(",
")",
";",
"var",
"m",
"=",
"this",
".",
"transformMatrix",
";",
"if",
"(",
"m",
")",
"{",
"ctx",
".",
"transform",
"(",
"m",
"[",
"0",
"]",
",",
"m",
"[",
"1",
"]"... | Renders path on a specified context
@method render
@param {CanvasRenderingContext2D} ctx context to render path on
@param {Boolean} noTransform When true, context is not transformed | [
"Renders",
"path",
"on",
"a",
"specified",
"context"
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/demos/Collage/fabric.js#L10995-L11036 | |
11,439 | MrSwitch/hello.js | demos/Collage/fabric.js | function(ctx) {
ctx.save();
var m = this.transformMatrix;
if (m) {
ctx.transform(m[0], m[1], m[2], m[3], m[4], m[5]);
}
this.transform(ctx);
for (var i = 0, l = this.paths.length; i < l; ++i) {
this.paths[i].render(ctx, true);
}
if (this.active) {
... | javascript | function(ctx) {
ctx.save();
var m = this.transformMatrix;
if (m) {
ctx.transform(m[0], m[1], m[2], m[3], m[4], m[5]);
}
this.transform(ctx);
for (var i = 0, l = this.paths.length; i < l; ++i) {
this.paths[i].render(ctx, true);
}
if (this.active) {
... | [
"function",
"(",
"ctx",
")",
"{",
"ctx",
".",
"save",
"(",
")",
";",
"var",
"m",
"=",
"this",
".",
"transformMatrix",
";",
"if",
"(",
"m",
")",
"{",
"ctx",
".",
"transform",
"(",
"m",
"[",
"0",
"]",
",",
"m",
"[",
"1",
"]",
",",
"m",
"[",
... | Renders this group on a specified context
@method render
@param {CanvasRenderingContext2D} ctx Context to render this instance on | [
"Renders",
"this",
"group",
"on",
"a",
"specified",
"context"
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/demos/Collage/fabric.js#L11321-L11338 | |
11,440 | MrSwitch/hello.js | demos/Collage/fabric.js | function(prop, value) {
if ((prop === 'fill' || prop === 'overlayFill') && value && this.isSameColor()) {
var i = this.paths.length;
while (i--) {
this.paths[i]._set(prop, value);
}
}
return this.callSuper('_set', prop, value);
} | javascript | function(prop, value) {
if ((prop === 'fill' || prop === 'overlayFill') && value && this.isSameColor()) {
var i = this.paths.length;
while (i--) {
this.paths[i]._set(prop, value);
}
}
return this.callSuper('_set', prop, value);
} | [
"function",
"(",
"prop",
",",
"value",
")",
"{",
"if",
"(",
"(",
"prop",
"===",
"'fill'",
"||",
"prop",
"===",
"'overlayFill'",
")",
"&&",
"value",
"&&",
"this",
".",
"isSameColor",
"(",
")",
")",
"{",
"var",
"i",
"=",
"this",
".",
"paths",
".",
... | Sets certain property to a certain value
@method _set
@param {String} prop
@param {Any} value
@return {fabric.PathGroup} thisArg | [
"Sets",
"certain",
"property",
"to",
"a",
"certain",
"value"
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/demos/Collage/fabric.js#L11347-L11357 | |
11,441 | MrSwitch/hello.js | demos/Collage/fabric.js | function() {
return this.paths.reduce(function(total, path) {
return total + ((path && path.complexity) ? path.complexity() : 0);
}, 0);
} | javascript | function() {
return this.paths.reduce(function(total, path) {
return total + ((path && path.complexity) ? path.complexity() : 0);
}, 0);
} | [
"function",
"(",
")",
"{",
"return",
"this",
".",
"paths",
".",
"reduce",
"(",
"function",
"(",
"total",
",",
"path",
")",
"{",
"return",
"total",
"+",
"(",
"(",
"path",
"&&",
"path",
".",
"complexity",
")",
"?",
"path",
".",
"complexity",
"(",
")"... | Returns number representation of object's complexity
@method complexity
@return {Number} complexity | [
"Returns",
"number",
"representation",
"of",
"object",
"s",
"complexity"
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/demos/Collage/fabric.js#L11435-L11439 | |
11,442 | MrSwitch/hello.js | demos/Collage/fabric.js | function(object) {
this._restoreObjectsState();
removeFromArray(this.objects, object);
object.setActive(false);
this._calcBounds();
this._updateObjectsCoords();
return this;
} | javascript | function(object) {
this._restoreObjectsState();
removeFromArray(this.objects, object);
object.setActive(false);
this._calcBounds();
this._updateObjectsCoords();
return this;
} | [
"function",
"(",
"object",
")",
"{",
"this",
".",
"_restoreObjectsState",
"(",
")",
";",
"removeFromArray",
"(",
"this",
".",
"objects",
",",
"object",
")",
";",
"object",
".",
"setActive",
"(",
"false",
")",
";",
"this",
".",
"_calcBounds",
"(",
")",
... | Removes an object from a group; Then recalculates group's dimension, position.
@method removeWithUpdate
@param {Object} object
@return {fabric.Group} thisArg
@chainable | [
"Removes",
"an",
"object",
"from",
"a",
"group",
";",
"Then",
"recalculates",
"group",
"s",
"dimension",
"position",
"."
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/demos/Collage/fabric.js#L11612-L11619 | |
11,443 | MrSwitch/hello.js | demos/Collage/fabric.js | function(ctx, noTransform) {
ctx.save();
this.transform(ctx);
var groupScaleFactor = Math.max(this.scaleX, this.scaleY);
for (var i = 0, len = this.objects.length, object; object = this.objects[i]; i++) {
var originalScaleFactor = object.borderScaleFactor;
object.borderScaleFac... | javascript | function(ctx, noTransform) {
ctx.save();
this.transform(ctx);
var groupScaleFactor = Math.max(this.scaleX, this.scaleY);
for (var i = 0, len = this.objects.length, object; object = this.objects[i]; i++) {
var originalScaleFactor = object.borderScaleFactor;
object.borderScaleFac... | [
"function",
"(",
"ctx",
",",
"noTransform",
")",
"{",
"ctx",
".",
"save",
"(",
")",
";",
"this",
".",
"transform",
"(",
"ctx",
")",
";",
"var",
"groupScaleFactor",
"=",
"Math",
".",
"max",
"(",
"this",
".",
"scaleX",
",",
"this",
".",
"scaleY",
")"... | Renders instance on a given context
@method render
@param {CanvasRenderingContext2D} ctx context to render instance on | [
"Renders",
"instance",
"on",
"a",
"given",
"context"
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/demos/Collage/fabric.js#L11695-L11713 | |
11,444 | MrSwitch/hello.js | demos/Collage/fabric.js | function() {
return this.getObjects().reduce(function(total, object) {
total += (typeof object.complexity == 'function') ? object.complexity() : 0;
return total;
}, 0);
} | javascript | function() {
return this.getObjects().reduce(function(total, object) {
total += (typeof object.complexity == 'function') ? object.complexity() : 0;
return total;
}, 0);
} | [
"function",
"(",
")",
"{",
"return",
"this",
".",
"getObjects",
"(",
")",
".",
"reduce",
"(",
"function",
"(",
"total",
",",
"object",
")",
"{",
"total",
"+=",
"(",
"typeof",
"object",
".",
"complexity",
"==",
"'function'",
")",
"?",
"object",
".",
"... | Returns complexity of an instance
@method complexity
@return {Number} complexity | [
"Returns",
"complexity",
"of",
"an",
"instance"
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/demos/Collage/fabric.js#L11730-L11735 | |
11,445 | MrSwitch/hello.js | demos/Collage/fabric.js | function(object) {
var groupLeft = this.get('left'),
groupTop = this.get('top'),
groupAngle = this.getAngle() * (Math.PI / 180),
objectLeft = object.get('originalLeft'),
objectTop = object.get('originalTop'),
rotatedTop = Math.cos(groupAngle) * object.get('top') ... | javascript | function(object) {
var groupLeft = this.get('left'),
groupTop = this.get('top'),
groupAngle = this.getAngle() * (Math.PI / 180),
objectLeft = object.get('originalLeft'),
objectTop = object.get('originalTop'),
rotatedTop = Math.cos(groupAngle) * object.get('top') ... | [
"function",
"(",
"object",
")",
"{",
"var",
"groupLeft",
"=",
"this",
".",
"get",
"(",
"'left'",
")",
",",
"groupTop",
"=",
"this",
".",
"get",
"(",
"'top'",
")",
",",
"groupAngle",
"=",
"this",
".",
"getAngle",
"(",
")",
"*",
"(",
"Math",
".",
"... | Restores original state of a specified object in group
@private
@method _restoreObjectState
@param {fabric.Object} object
@return {fabric.Group} thisArg | [
"Restores",
"original",
"state",
"of",
"a",
"specified",
"object",
"in",
"group"
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/demos/Collage/fabric.js#L11756-L11780 | |
11,446 | MrSwitch/hello.js | demos/Collage/fabric.js | function(point) {
var halfWidth = this.get('width') / 2,
halfHeight = this.get('height') / 2,
centerX = this.get('left'),
centerY = this.get('top');
return centerX - halfWidth < point.x &&
centerX + halfWidth > point.x &&
centerY - halfHeight < po... | javascript | function(point) {
var halfWidth = this.get('width') / 2,
halfHeight = this.get('height') / 2,
centerX = this.get('left'),
centerY = this.get('top');
return centerX - halfWidth < point.x &&
centerX + halfWidth > point.x &&
centerY - halfHeight < po... | [
"function",
"(",
"point",
")",
"{",
"var",
"halfWidth",
"=",
"this",
".",
"get",
"(",
"'width'",
")",
"/",
"2",
",",
"halfHeight",
"=",
"this",
".",
"get",
"(",
"'height'",
")",
"/",
"2",
",",
"centerX",
"=",
"this",
".",
"get",
"(",
"'left'",
")... | Checks if point is contained within the group
@method containsPoint
@param {fabric.Point} point point with `x` and `y` properties
@return {Boolean} true if point is contained within group | [
"Checks",
"if",
"point",
"is",
"contained",
"within",
"the",
"group"
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/demos/Collage/fabric.js#L11915-L11926 | |
11,447 | MrSwitch/hello.js | demos/Collage/fabric.js | function(ctx, noTransform) {
ctx.save();
var m = this.transformMatrix;
this._resetWidthHeight();
if (this.group) {
ctx.translate(-this.group.width/2 + this.width/2, -this.group.height/2 + this.height/2);
}
if (m) {
ctx.transform(m[0], m[1], m[2], m[3], m[4], m[5]);
... | javascript | function(ctx, noTransform) {
ctx.save();
var m = this.transformMatrix;
this._resetWidthHeight();
if (this.group) {
ctx.translate(-this.group.width/2 + this.width/2, -this.group.height/2 + this.height/2);
}
if (m) {
ctx.transform(m[0], m[1], m[2], m[3], m[4], m[5]);
... | [
"function",
"(",
"ctx",
",",
"noTransform",
")",
"{",
"ctx",
".",
"save",
"(",
")",
";",
"var",
"m",
"=",
"this",
".",
"transformMatrix",
";",
"this",
".",
"_resetWidthHeight",
"(",
")",
";",
"if",
"(",
"this",
".",
"group",
")",
"{",
"ctx",
".",
... | Renders image on a specified context
@method render
@param {CanvasRenderingContext2D} ctx Context to render on | [
"Renders",
"image",
"on",
"a",
"specified",
"context"
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/demos/Collage/fabric.js#L12106-L12125 | |
11,448 | MrSwitch/hello.js | demos/Collage/fabric.js | function(element) {
this.setElement(fabric.util.getById(element));
fabric.util.addClass(this.getElement(), fabric.Image.CSS_CANVAS);
} | javascript | function(element) {
this.setElement(fabric.util.getById(element));
fabric.util.addClass(this.getElement(), fabric.Image.CSS_CANVAS);
} | [
"function",
"(",
"element",
")",
"{",
"this",
".",
"setElement",
"(",
"fabric",
".",
"util",
".",
"getById",
"(",
"element",
")",
")",
";",
"fabric",
".",
"util",
".",
"addClass",
"(",
"this",
".",
"getElement",
"(",
")",
",",
"fabric",
".",
"Image",... | The Image class's initialization method. This method is automatically
called by the constructor.
@method _initElement
@param {HTMLImageElement|String} el The element representing the image | [
"The",
"Image",
"class",
"s",
"initialization",
"method",
".",
"This",
"method",
"is",
"automatically",
"called",
"by",
"the",
"constructor",
"."
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/demos/Collage/fabric.js#L12283-L12286 | |
11,449 | MrSwitch/hello.js | demos/Collage/fabric.js | function() {
var canvasEl = fabric.document.createElement('canvas');
if (!canvasEl.getContext && typeof G_vmlCanvasManager != 'undefined') {
G_vmlCanvasManager.initElement(canvasEl);
}
this._render(canvasEl.getContext('2d'));
} | javascript | function() {
var canvasEl = fabric.document.createElement('canvas');
if (!canvasEl.getContext && typeof G_vmlCanvasManager != 'undefined') {
G_vmlCanvasManager.initElement(canvasEl);
}
this._render(canvasEl.getContext('2d'));
} | [
"function",
"(",
")",
"{",
"var",
"canvasEl",
"=",
"fabric",
".",
"document",
".",
"createElement",
"(",
"'canvas'",
")",
";",
"if",
"(",
"!",
"canvasEl",
".",
"getContext",
"&&",
"typeof",
"G_vmlCanvasManager",
"!=",
"'undefined'",
")",
"{",
"G_vmlCanvasMan... | Renders text object on offscreen canvas, so that it would get dimensions
@private
@method _initDimensions | [
"Renders",
"text",
"object",
"on",
"offscreen",
"canvas",
"so",
"that",
"it",
"would",
"get",
"dimensions"
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/demos/Collage/fabric.js#L13168-L13176 | |
11,450 | MrSwitch/hello.js | demos/Collage/fabric.js | function(ctx, noTransform) {
ctx.save();
this._render(ctx);
if (!noTransform && this.active) {
this.drawBorders(ctx);
this.hideCorners || this.drawCorners(ctx);
}
ctx.restore();
} | javascript | function(ctx, noTransform) {
ctx.save();
this._render(ctx);
if (!noTransform && this.active) {
this.drawBorders(ctx);
this.hideCorners || this.drawCorners(ctx);
}
ctx.restore();
} | [
"function",
"(",
"ctx",
",",
"noTransform",
")",
"{",
"ctx",
".",
"save",
"(",
")",
";",
"this",
".",
"_render",
"(",
"ctx",
")",
";",
"if",
"(",
"!",
"noTransform",
"&&",
"this",
".",
"active",
")",
"{",
"this",
".",
"drawBorders",
"(",
"ctx",
"... | Renders text instance on a specified context
@method render
@param ctx {CanvasRenderingContext2D} context to render on | [
"Renders",
"text",
"instance",
"on",
"a",
"specified",
"context"
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/demos/Collage/fabric.js#L13554-L13562 | |
11,451 | MrSwitch/hello.js | demos/Collage/fabric.js | function(name, value) {
if (name === 'fontFamily' && this.path) {
this.path = this.path.replace(/(.*?)([^\/]*)(\.font\.js)/, '$1' + value + '$3');
}
this.callSuper('_set', name, value);
} | javascript | function(name, value) {
if (name === 'fontFamily' && this.path) {
this.path = this.path.replace(/(.*?)([^\/]*)(\.font\.js)/, '$1' + value + '$3');
}
this.callSuper('_set', name, value);
} | [
"function",
"(",
"name",
",",
"value",
")",
"{",
"if",
"(",
"name",
"===",
"'fontFamily'",
"&&",
"this",
".",
"path",
")",
"{",
"this",
".",
"path",
"=",
"this",
".",
"path",
".",
"replace",
"(",
"/",
"(.*?)([^\\/]*)(\\.font\\.js)",
"/",
",",
"'$1'",
... | Sets specified property to a specified value
@method set
@param {String} name
@param {Any} value
@return {fabric.Text} thisArg
@chainable | [
"Sets",
"specified",
"property",
"to",
"a",
"specified",
"value"
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/demos/Collage/fabric.js#L13776-L13781 | |
11,452 | MrSwitch/hello.js | assets/knockout/src/subscribables/subscribable.js | limitNotifySubscribers | function limitNotifySubscribers(value, event) {
if (!event || event === defaultEvent) {
this._limitChange(value);
} else if (event === 'beforeChange') {
this._limitBeforeChange(value);
} else {
this._origNotifySubscribers(value, event);
}
} | javascript | function limitNotifySubscribers(value, event) {
if (!event || event === defaultEvent) {
this._limitChange(value);
} else if (event === 'beforeChange') {
this._limitBeforeChange(value);
} else {
this._origNotifySubscribers(value, event);
}
} | [
"function",
"limitNotifySubscribers",
"(",
"value",
",",
"event",
")",
"{",
"if",
"(",
"!",
"event",
"||",
"event",
"===",
"defaultEvent",
")",
"{",
"this",
".",
"_limitChange",
"(",
"value",
")",
";",
"}",
"else",
"if",
"(",
"event",
"===",
"'beforeChan... | Moved out of "limit" to avoid the extra closure | [
"Moved",
"out",
"of",
"limit",
"to",
"avoid",
"the",
"extra",
"closure"
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/assets/knockout/src/subscribables/subscribable.js#L22-L30 |
11,453 | MrSwitch/hello.js | assets/knockout/src/binding/bindingAttributeSyntax.js | makeAccessorsFromFunction | function makeAccessorsFromFunction(callback) {
return ko.utils.objectMap(ko.dependencyDetection.ignore(callback), function(value, key) {
return function() {
return callback()[key];
};
});
} | javascript | function makeAccessorsFromFunction(callback) {
return ko.utils.objectMap(ko.dependencyDetection.ignore(callback), function(value, key) {
return function() {
return callback()[key];
};
});
} | [
"function",
"makeAccessorsFromFunction",
"(",
"callback",
")",
"{",
"return",
"ko",
".",
"utils",
".",
"objectMap",
"(",
"ko",
".",
"dependencyDetection",
".",
"ignore",
"(",
"callback",
")",
",",
"function",
"(",
"value",
",",
"key",
")",
"{",
"return",
"... | Given a function that returns bindings, create and return a new object that contains binding value-accessors functions. Each accessor function calls the original function so that it always gets the latest value and all dependencies are captured. This is used by ko.applyBindingsToNode and getBindingsAndMakeAccessors. | [
"Given",
"a",
"function",
"that",
"returns",
"bindings",
"create",
"and",
"return",
"a",
"new",
"object",
"that",
"contains",
"binding",
"value",
"-",
"accessors",
"functions",
".",
"Each",
"accessor",
"function",
"calls",
"the",
"original",
"function",
"so",
... | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/assets/knockout/src/binding/bindingAttributeSyntax.js#L158-L164 |
11,454 | MrSwitch/hello.js | assets/css-social-buttons/site/html5slider.js | update | function update() {
min = isAttrNum(slider.min) ? +slider.min : 0;
max = isAttrNum(slider.max) ? +slider.max : 100;
if (max < min)
max = min > 100 ? min : 100;
step = isAttrNum(slider.step) && slider.step > 0 ? +slider.step : 1;
range = max - min;
draw(true);
} | javascript | function update() {
min = isAttrNum(slider.min) ? +slider.min : 0;
max = isAttrNum(slider.max) ? +slider.max : 100;
if (max < min)
max = min > 100 ? min : 100;
step = isAttrNum(slider.step) && slider.step > 0 ? +slider.step : 1;
range = max - min;
draw(true);
} | [
"function",
"update",
"(",
")",
"{",
"min",
"=",
"isAttrNum",
"(",
"slider",
".",
"min",
")",
"?",
"+",
"slider",
".",
"min",
":",
"0",
";",
"max",
"=",
"isAttrNum",
"(",
"slider",
".",
"max",
")",
"?",
"+",
"slider",
".",
"max",
":",
"100",
";... | validates min, max, and step attributes and redraws | [
"validates",
"min",
"max",
"and",
"step",
"attributes",
"and",
"redraws"
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/assets/css-social-buttons/site/html5slider.js#L220-L228 |
11,455 | MrSwitch/hello.js | assets/css-social-buttons/site/html5slider.js | calc | function calc() {
if (!isValueSet && !areAttrsSet)
value = slider.getAttribute('value');
if (!isAttrNum(value))
value = (min + max) / 2;;
// snap to step intervals (WebKit sometimes does not - bug?)
value = Math.round((value - min) / step) * step + min;
if (value < min)
value = min... | javascript | function calc() {
if (!isValueSet && !areAttrsSet)
value = slider.getAttribute('value');
if (!isAttrNum(value))
value = (min + max) / 2;;
// snap to step intervals (WebKit sometimes does not - bug?)
value = Math.round((value - min) / step) * step + min;
if (value < min)
value = min... | [
"function",
"calc",
"(",
")",
"{",
"if",
"(",
"!",
"isValueSet",
"&&",
"!",
"areAttrsSet",
")",
"value",
"=",
"slider",
".",
"getAttribute",
"(",
"'value'",
")",
";",
"if",
"(",
"!",
"isAttrNum",
"(",
"value",
")",
")",
"value",
"=",
"(",
"min",
"+... | recalculates value property | [
"recalculates",
"value",
"property"
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/assets/css-social-buttons/site/html5slider.js#L231-L242 |
11,456 | MrSwitch/hello.js | assets/css-social-buttons/site/html5slider.js | draw | function draw(attrsModified) {
calc();
if (isChanged && value != prevValue)
slider.dispatchEvent(onChange);
isChanged = false;
if (!attrsModified && value == prevValue)
return;
prevValue = value;
var position = range ? (value - min) / range * 100 : 0;
var bg = '-moz-element(#__sl... | javascript | function draw(attrsModified) {
calc();
if (isChanged && value != prevValue)
slider.dispatchEvent(onChange);
isChanged = false;
if (!attrsModified && value == prevValue)
return;
prevValue = value;
var position = range ? (value - min) / range * 100 : 0;
var bg = '-moz-element(#__sl... | [
"function",
"draw",
"(",
"attrsModified",
")",
"{",
"calc",
"(",
")",
";",
"if",
"(",
"isChanged",
"&&",
"value",
"!=",
"prevValue",
")",
"slider",
".",
"dispatchEvent",
"(",
"onChange",
")",
";",
"isChanged",
"=",
"false",
";",
"if",
"(",
"!",
"attrsM... | renders slider using CSS background ;) | [
"renders",
"slider",
"using",
"CSS",
"background",
";",
")"
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/assets/css-social-buttons/site/html5slider.js#L245-L256 |
11,457 | MrSwitch/hello.js | assets/index.js | before_photo_post | function before_photo_post(test, callback){
hello(test.network)
.api("me/albums")
.then(function(r){
for(var i=0;i<r.data.length;i++){
if(r.data[i].name === "TestAlbum"){
var id = r.data[i].id;
test.data.id = id;
return callback();
}
}
callback("Failed to setup: Could not find the album 'Test... | javascript | function before_photo_post(test, callback){
hello(test.network)
.api("me/albums")
.then(function(r){
for(var i=0;i<r.data.length;i++){
if(r.data[i].name === "TestAlbum"){
var id = r.data[i].id;
test.data.id = id;
return callback();
}
}
callback("Failed to setup: Could not find the album 'Test... | [
"function",
"before_photo_post",
"(",
"test",
",",
"callback",
")",
"{",
"hello",
"(",
"test",
".",
"network",
")",
".",
"api",
"(",
"\"me/albums\"",
")",
".",
"then",
"(",
"function",
"(",
"r",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",... | Get the ID of the test album | [
"Get",
"the",
"ID",
"of",
"the",
"test",
"album"
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/assets/index.js#L772-L787 |
11,458 | MrSwitch/hello.js | assets/index.js | DictionaryItem | function DictionaryItem(key, value) {
this.key = ko.observable(key);
this.options = [];
if(value instanceof Array){
this.options = value;
value = value[0];
}
this.value = (typeof(value)==='function')? value : ko.observable(value);
} | javascript | function DictionaryItem(key, value) {
this.key = ko.observable(key);
this.options = [];
if(value instanceof Array){
this.options = value;
value = value[0];
}
this.value = (typeof(value)==='function')? value : ko.observable(value);
} | [
"function",
"DictionaryItem",
"(",
"key",
",",
"value",
")",
"{",
"this",
".",
"key",
"=",
"ko",
".",
"observable",
"(",
"key",
")",
";",
"this",
".",
"options",
"=",
"[",
"]",
";",
"if",
"(",
"value",
"instanceof",
"Array",
")",
"{",
"this",
".",
... | Turn an object of Key => Value into mutable stores | [
"Turn",
"an",
"object",
"of",
"Key",
"=",
">",
"Value",
"into",
"mutable",
"stores"
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/assets/index.js#L1185-L1193 |
11,459 | MrSwitch/hello.js | assets/index.js | Dictionary | function Dictionary(data) {
this.items = ko.observableArray([]);
for (var field in data) {
if (data.hasOwnProperty(field)) {
this.items.push(new DictionaryItem(field, data[field]));
}
}
this.addItem = function() {
this.items.push(new DictionaryItem());
}.bind(thi... | javascript | function Dictionary(data) {
this.items = ko.observableArray([]);
for (var field in data) {
if (data.hasOwnProperty(field)) {
this.items.push(new DictionaryItem(field, data[field]));
}
}
this.addItem = function() {
this.items.push(new DictionaryItem());
}.bind(thi... | [
"function",
"Dictionary",
"(",
"data",
")",
"{",
"this",
".",
"items",
"=",
"ko",
".",
"observableArray",
"(",
"[",
"]",
")",
";",
"for",
"(",
"var",
"field",
"in",
"data",
")",
"{",
"if",
"(",
"data",
".",
"hasOwnProperty",
"(",
"field",
")",
")",... | Custom Dictionary observable in Knockout represent the dictionary object | [
"Custom",
"Dictionary",
"observable",
"in",
"Knockout",
"represent",
"the",
"dictionary",
"object"
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/assets/index.js#L1200-L1224 |
11,460 | MrSwitch/hello.js | assets/index.js | _indexOf | function _indexOf(a,s){
// Do we need the hack?
if(a.indexOf){
return a.indexOf(s);
}
for(var j=0;j<a.length;j++){
if(a[j]===s){
return j;
}
}
return -1;
} | javascript | function _indexOf(a,s){
// Do we need the hack?
if(a.indexOf){
return a.indexOf(s);
}
for(var j=0;j<a.length;j++){
if(a[j]===s){
return j;
}
}
return -1;
} | [
"function",
"_indexOf",
"(",
"a",
",",
"s",
")",
"{",
"// Do we need the hack?",
"if",
"(",
"a",
".",
"indexOf",
")",
"{",
"return",
"a",
".",
"indexOf",
"(",
"s",
")",
";",
"}",
"for",
"(",
"var",
"j",
"=",
"0",
";",
"j",
"<",
"a",
".",
"lengt... | indexOf IE hack Array.indexOf doesn't exist prior to IE9 | [
"indexOf",
"IE",
"hack",
"Array",
".",
"indexOf",
"doesn",
"t",
"exist",
"prior",
"to",
"IE9"
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/assets/index.js#L1258-L1270 |
11,461 | MrSwitch/hello.js | assets/expect/index.js | every | function every (arr, fn, thisObj) {
var scope = thisObj || global;
for (var i = 0, j = arr.length; i < j; ++i) {
if (!fn.call(scope, arr[i], i, arr)) {
return false;
}
}
return true;
} | javascript | function every (arr, fn, thisObj) {
var scope = thisObj || global;
for (var i = 0, j = arr.length; i < j; ++i) {
if (!fn.call(scope, arr[i], i, arr)) {
return false;
}
}
return true;
} | [
"function",
"every",
"(",
"arr",
",",
"fn",
",",
"thisObj",
")",
"{",
"var",
"scope",
"=",
"thisObj",
"||",
"global",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"j",
"=",
"arr",
".",
"length",
";",
"i",
"<",
"j",
";",
"++",
"i",
")",
"{",
... | Array every compatibility
@see bit.ly/5Fq1N2
@api public | [
"Array",
"every",
"compatibility"
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/assets/expect/index.js#L510-L518 |
11,462 | MrSwitch/hello.js | demos/helper/uiProfile.js | img_xhr | function img_xhr(img, url) {
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.responseType = 'blob';
xhr.onload = function(e) {
img.src = window.URL.createObjectURL(this.response);
};
xhr.send();
} | javascript | function img_xhr(img, url) {
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.responseType = 'blob';
xhr.onload = function(e) {
img.src = window.URL.createObjectURL(this.response);
};
xhr.send();
} | [
"function",
"img_xhr",
"(",
"img",
",",
"url",
")",
"{",
"var",
"xhr",
"=",
"new",
"XMLHttpRequest",
"(",
")",
";",
"xhr",
".",
"open",
"(",
"'GET'",
",",
"url",
",",
"true",
")",
";",
"xhr",
".",
"responseType",
"=",
"'blob'",
";",
"xhr",
".",
"... | Utility for loading the thumbnail in chromeapp | [
"Utility",
"for",
"loading",
"the",
"thumbnail",
"in",
"chromeapp"
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/demos/helper/uiProfile.js#L42-L50 |
11,463 | MrSwitch/hello.js | demos/FilePicker/filePicker.js | fileRef | function fileRef(item, network, bucket, selected){
this.els = [];
this.selected = false;
this.item = {};
// Item contents change
this.update = function(item){
if(!item){
return this.item;
}
else {
// Merge the two together
this.item = hello.utils.merge(this.item, item);
}
// Loo... | javascript | function fileRef(item, network, bucket, selected){
this.els = [];
this.selected = false;
this.item = {};
// Item contents change
this.update = function(item){
if(!item){
return this.item;
}
else {
// Merge the two together
this.item = hello.utils.merge(this.item, item);
}
// Loo... | [
"function",
"fileRef",
"(",
"item",
",",
"network",
",",
"bucket",
",",
"selected",
")",
"{",
"this",
".",
"els",
"=",
"[",
"]",
";",
"this",
".",
"selected",
"=",
"false",
";",
"this",
".",
"item",
"=",
"{",
"}",
";",
"// Item contents change",
"thi... | Each item is stored as a fileRef instance in the ref array This function controls the element which it is applied upon. Controlling when the elements update for generated content | [
"Each",
"item",
"is",
"stored",
"as",
"a",
"fileRef",
"instance",
"in",
"the",
"ref",
"array",
"This",
"function",
"controls",
"the",
"element",
"which",
"it",
"is",
"applied",
"upon",
".",
"Controlling",
"when",
"the",
"elements",
"update",
"for",
"generate... | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/demos/FilePicker/filePicker.js#L387-L486 |
11,464 | MrSwitch/hello.js | demos/FilePicker/filePicker.js | uploadFileList | function uploadFileList(files){
// FileList
if(!("FileList" in window) || (files instanceof File) || (files instanceof Blob)){
// Make an Array
files = [files];
}
var max = 20, len = files.length;
if(len>max){
var bool = confirm("You man only upload "+max+" files at a time");
if(!bool){
ret... | javascript | function uploadFileList(files){
// FileList
if(!("FileList" in window) || (files instanceof File) || (files instanceof Blob)){
// Make an Array
files = [files];
}
var max = 20, len = files.length;
if(len>max){
var bool = confirm("You man only upload "+max+" files at a time");
if(!bool){
ret... | [
"function",
"uploadFileList",
"(",
"files",
")",
"{",
"// FileList",
"if",
"(",
"!",
"(",
"\"FileList\"",
"in",
"window",
")",
"||",
"(",
"files",
"instanceof",
"File",
")",
"||",
"(",
"files",
"instanceof",
"Blob",
")",
")",
"{",
"// Make an Array",
"file... | Upload file list Take all the photos in the FileList and create items with them | [
"Upload",
"file",
"list",
"Take",
"all",
"the",
"photos",
"in",
"the",
"FileList",
"and",
"create",
"items",
"with",
"them"
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/demos/FilePicker/filePicker.js#L491-L513 |
11,465 | MrSwitch/hello.js | demos/FilePicker/filePicker.js | createRef | function createRef(file){
// Create a new fileRef
var pointer = new fileRef({
name : file.name,
type : file.type,
file : file
}, current_network, current_bucket, true);
ref.push( pointer );
if(current_folder==="local"){
readFile(file, function(dataURL){
// Update list
pointer.update({
... | javascript | function createRef(file){
// Create a new fileRef
var pointer = new fileRef({
name : file.name,
type : file.type,
file : file
}, current_network, current_bucket, true);
ref.push( pointer );
if(current_folder==="local"){
readFile(file, function(dataURL){
// Update list
pointer.update({
... | [
"function",
"createRef",
"(",
"file",
")",
"{",
"// Create a new fileRef",
"var",
"pointer",
"=",
"new",
"fileRef",
"(",
"{",
"name",
":",
"file",
".",
"name",
",",
"type",
":",
"file",
".",
"type",
",",
"file",
":",
"file",
"}",
",",
"current_network",
... | Do we upload them to the endpoint? Or load them into the page? | [
"Do",
"we",
"upload",
"them",
"to",
"the",
"endpoint?",
"Or",
"load",
"them",
"into",
"the",
"page?"
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/demos/FilePicker/filePicker.js#L516-L548 |
11,466 | MrSwitch/hello.js | demos/FilePicker/filePicker.js | readFile | function readFile(file, callback){
// Run this sequentially
sync(function(){
// Create a new FileReader Object
var reader = new FileReader();
// Set an onload handler because we load files into it Asynchronously
reader.onload = function(e){
// Print onto Canvas
callback( this.result );
/... | javascript | function readFile(file, callback){
// Run this sequentially
sync(function(){
// Create a new FileReader Object
var reader = new FileReader();
// Set an onload handler because we load files into it Asynchronously
reader.onload = function(e){
// Print onto Canvas
callback( this.result );
/... | [
"function",
"readFile",
"(",
"file",
",",
"callback",
")",
"{",
"// Run this sequentially",
"sync",
"(",
"function",
"(",
")",
"{",
"// Create a new FileReader Object",
"var",
"reader",
"=",
"new",
"FileReader",
"(",
")",
";",
"// Set an onload handler because we load... | readFile Perform one operation at a time, to get a nice gradule load | [
"readFile",
"Perform",
"one",
"operation",
"at",
"a",
"time",
"to",
"get",
"a",
"nice",
"gradule",
"load"
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/demos/FilePicker/filePicker.js#L552-L571 |
11,467 | MrSwitch/hello.js | src/modules/tumblr.js | query | function query(p, callback) {
if (p.data) {
extend(p.query, p.data);
p.data = null;
}
callback(p.path);
} | javascript | function query(p, callback) {
if (p.data) {
extend(p.query, p.data);
p.data = null;
}
callback(p.path);
} | [
"function",
"query",
"(",
"p",
",",
"callback",
")",
"{",
"if",
"(",
"p",
".",
"data",
")",
"{",
"extend",
"(",
"p",
".",
"query",
",",
"p",
".",
"data",
")",
";",
"p",
".",
"data",
"=",
"null",
";",
"}",
"callback",
"(",
"p",
".",
"path",
... | Converts post parameters to query | [
"Converts",
"post",
"parameters",
"to",
"query"
] | 50b2b792d758774fc08e8da911fd4415ea3831ba | https://github.com/MrSwitch/hello.js/blob/50b2b792d758774fc08e8da911fd4415ea3831ba/src/modules/tumblr.js#L93-L100 |
11,468 | rtfeldman/seamless-immutable | seamless-immutable.development.js | without | function without(remove) {
// Calling .without() with no arguments is a no-op. Don't bother cloning.
if (typeof remove === "undefined" && arguments.length === 0) {
return this;
}
if (typeof remove !== "function") {
// If we weren't given an array, use the arguments list.
var keysToRem... | javascript | function without(remove) {
// Calling .without() with no arguments is a no-op. Don't bother cloning.
if (typeof remove === "undefined" && arguments.length === 0) {
return this;
}
if (typeof remove !== "function") {
// If we weren't given an array, use the arguments list.
var keysToRem... | [
"function",
"without",
"(",
"remove",
")",
"{",
"// Calling .without() with no arguments is a no-op. Don't bother cloning.",
"if",
"(",
"typeof",
"remove",
"===",
"\"undefined\"",
"&&",
"arguments",
".",
"length",
"===",
"0",
")",
"{",
"return",
"this",
";",
"}",
"i... | Returns an Immutable copy of the object without the given keys included.
@param {array} keysToRemove - A list of strings representing the keys to exclude in the return value. Instead of providing a single array, this method can also be called by passing multiple strings as separate arguments. | [
"Returns",
"an",
"Immutable",
"copy",
"of",
"the",
"object",
"without",
"the",
"given",
"keys",
"included",
"."
] | 2d870b14a01e222493c686a7644181185f859558 | https://github.com/rtfeldman/seamless-immutable/blob/2d870b14a01e222493c686a7644181185f859558/seamless-immutable.development.js#L265-L298 |
11,469 | rtfeldman/seamless-immutable | seamless-immutable.development.js | merge | function merge(other, config) {
// Calling .merge() with no arguments is a no-op. Don't bother cloning.
if (arguments.length === 0) {
return this;
}
if (other === null || (typeof other !== "object")) {
throw new TypeError("Immutable#merge can only be invoked with objects or arrays, not " + ... | javascript | function merge(other, config) {
// Calling .merge() with no arguments is a no-op. Don't bother cloning.
if (arguments.length === 0) {
return this;
}
if (other === null || (typeof other !== "object")) {
throw new TypeError("Immutable#merge can only be invoked with objects or arrays, not " + ... | [
"function",
"merge",
"(",
"other",
",",
"config",
")",
"{",
"// Calling .merge() with no arguments is a no-op. Don't bother cloning.",
"if",
"(",
"arguments",
".",
"length",
"===",
"0",
")",
"{",
"return",
"this",
";",
"}",
"if",
"(",
"other",
"===",
"null",
"||... | Returns an Immutable Object containing the properties and values of both
this object and the provided object, prioritizing the provided object's
values whenever the same key is present in both objects.
@param {object} other - The other object to merge. Multiple objects can be passed as an array. In such a case, the la... | [
"Returns",
"an",
"Immutable",
"Object",
"containing",
"the",
"properties",
"and",
"values",
"of",
"both",
"this",
"object",
"and",
"the",
"provided",
"object",
"prioritizing",
"the",
"provided",
"object",
"s",
"values",
"whenever",
"the",
"same",
"key",
"is",
... | 2d870b14a01e222493c686a7644181185f859558 | https://github.com/rtfeldman/seamless-immutable/blob/2d870b14a01e222493c686a7644181185f859558/seamless-immutable.development.js#L374-L467 |
11,470 | rtfeldman/seamless-immutable | seamless-immutable.development.js | addToResult | function addToResult(currentObj, otherObj, key) {
var immutableValue = Immutable(otherObj[key]);
var mergerResult = merger && merger(currentObj[key], immutableValue, config);
var currentValue = currentObj[key];
if ((result !== undefined) ||
(mergerResult !== undefined) ||
(!curr... | javascript | function addToResult(currentObj, otherObj, key) {
var immutableValue = Immutable(otherObj[key]);
var mergerResult = merger && merger(currentObj[key], immutableValue, config);
var currentValue = currentObj[key];
if ((result !== undefined) ||
(mergerResult !== undefined) ||
(!curr... | [
"function",
"addToResult",
"(",
"currentObj",
",",
"otherObj",
",",
"key",
")",
"{",
"var",
"immutableValue",
"=",
"Immutable",
"(",
"otherObj",
"[",
"key",
"]",
")",
";",
"var",
"mergerResult",
"=",
"merger",
"&&",
"merger",
"(",
"currentObj",
"[",
"key",... | Use the given key to extract a value from the given object, then place that value in the result object under the same key. If that resulted in a change from this object's value at that key, set anyChanges = true. | [
"Use",
"the",
"given",
"key",
"to",
"extract",
"a",
"value",
"from",
"the",
"given",
"object",
"then",
"place",
"that",
"value",
"in",
"the",
"result",
"object",
"under",
"the",
"same",
"key",
".",
"If",
"that",
"resulted",
"in",
"a",
"change",
"from",
... | 2d870b14a01e222493c686a7644181185f859558 | https://github.com/rtfeldman/seamless-immutable/blob/2d870b14a01e222493c686a7644181185f859558/seamless-immutable.development.js#L393-L422 |
11,471 | rtfeldman/seamless-immutable | seamless-immutable.development.js | makeImmutableObject | function makeImmutableObject(obj) {
if (!globalConfig.use_static) {
addPropertyTo(obj, "merge", merge);
addPropertyTo(obj, "replace", objectReplace);
addPropertyTo(obj, "without", without);
addPropertyTo(obj, "asMutable", asMutableObject);
addPropertyTo(obj, "set", objectSet);
ad... | javascript | function makeImmutableObject(obj) {
if (!globalConfig.use_static) {
addPropertyTo(obj, "merge", merge);
addPropertyTo(obj, "replace", objectReplace);
addPropertyTo(obj, "without", without);
addPropertyTo(obj, "asMutable", asMutableObject);
addPropertyTo(obj, "set", objectSet);
ad... | [
"function",
"makeImmutableObject",
"(",
"obj",
")",
"{",
"if",
"(",
"!",
"globalConfig",
".",
"use_static",
")",
"{",
"addPropertyTo",
"(",
"obj",
",",
"\"merge\"",
",",
"merge",
")",
";",
"addPropertyTo",
"(",
"obj",
",",
"\"replace\"",
",",
"objectReplace"... | Finalizes an object with immutable methods, freezes it, and returns it. | [
"Finalizes",
"an",
"object",
"with",
"immutable",
"methods",
"freezes",
"it",
"and",
"returns",
"it",
"."
] | 2d870b14a01e222493c686a7644181185f859558 | https://github.com/rtfeldman/seamless-immutable/blob/2d870b14a01e222493c686a7644181185f859558/seamless-immutable.development.js#L586-L600 |
11,472 | rtfeldman/seamless-immutable | seamless-immutable.development.js | toStatic | function toStatic(fn) {
function staticWrapper() {
var args = [].slice.call(arguments);
var self = args.shift();
return fn.apply(self, args);
}
return staticWrapper;
} | javascript | function toStatic(fn) {
function staticWrapper() {
var args = [].slice.call(arguments);
var self = args.shift();
return fn.apply(self, args);
}
return staticWrapper;
} | [
"function",
"toStatic",
"(",
"fn",
")",
"{",
"function",
"staticWrapper",
"(",
")",
"{",
"var",
"args",
"=",
"[",
"]",
".",
"slice",
".",
"call",
"(",
"arguments",
")",
";",
"var",
"self",
"=",
"args",
".",
"shift",
"(",
")",
";",
"return",
"fn",
... | Wrapper to allow the use of object methods as static methods of Immutable. | [
"Wrapper",
"to",
"allow",
"the",
"use",
"of",
"object",
"methods",
"as",
"static",
"methods",
"of",
"Immutable",
"."
] | 2d870b14a01e222493c686a7644181185f859558 | https://github.com/rtfeldman/seamless-immutable/blob/2d870b14a01e222493c686a7644181185f859558/seamless-immutable.development.js#L670-L678 |
11,473 | rtfeldman/seamless-immutable | seamless-immutable.development.js | toStaticObjectOrArray | function toStaticObjectOrArray(fnObject, fnArray) {
function staticWrapper() {
var args = [].slice.call(arguments);
var self = args.shift();
if (Array.isArray(self)) {
return fnArray.apply(self, args);
} else {
return fnObject.apply(self, args);
}
}
return ... | javascript | function toStaticObjectOrArray(fnObject, fnArray) {
function staticWrapper() {
var args = [].slice.call(arguments);
var self = args.shift();
if (Array.isArray(self)) {
return fnArray.apply(self, args);
} else {
return fnObject.apply(self, args);
}
}
return ... | [
"function",
"toStaticObjectOrArray",
"(",
"fnObject",
",",
"fnArray",
")",
"{",
"function",
"staticWrapper",
"(",
")",
"{",
"var",
"args",
"=",
"[",
"]",
".",
"slice",
".",
"call",
"(",
"arguments",
")",
";",
"var",
"self",
"=",
"args",
".",
"shift",
"... | Wrapper to allow the use of object methods as static methods of Immutable. with the additional condition of choosing which function to call depending if argument is an array or an object. | [
"Wrapper",
"to",
"allow",
"the",
"use",
"of",
"object",
"methods",
"as",
"static",
"methods",
"of",
"Immutable",
".",
"with",
"the",
"additional",
"condition",
"of",
"choosing",
"which",
"function",
"to",
"call",
"depending",
"if",
"argument",
"is",
"an",
"a... | 2d870b14a01e222493c686a7644181185f859558 | https://github.com/rtfeldman/seamless-immutable/blob/2d870b14a01e222493c686a7644181185f859558/seamless-immutable.development.js#L683-L695 |
11,474 | angular-ui/ui-select | src/uiSelectController.js | function(){
var origSrc = originalSource($scope);
$scope.$uisSource = Object.keys(origSrc).map(function(v){
var result = {};
result[ctrl.parserResult.keyName] = v;
result.value = origSrc[v];
return result;
});
} | javascript | function(){
var origSrc = originalSource($scope);
$scope.$uisSource = Object.keys(origSrc).map(function(v){
var result = {};
result[ctrl.parserResult.keyName] = v;
result.value = origSrc[v];
return result;
});
} | [
"function",
"(",
")",
"{",
"var",
"origSrc",
"=",
"originalSource",
"(",
"$scope",
")",
";",
"$scope",
".",
"$uisSource",
"=",
"Object",
".",
"keys",
"(",
"origSrc",
")",
".",
"map",
"(",
"function",
"(",
"v",
")",
"{",
"var",
"result",
"=",
"{",
"... | When an object is used as source, we better create an array and use it as 'source' | [
"When",
"an",
"object",
"is",
"used",
"as",
"source",
"we",
"better",
"create",
"an",
"array",
"and",
"use",
"it",
"as",
"source"
] | d8fed304ab7f7f8dfde1e8424ee2a572e31c7488 | https://github.com/angular-ui/ui-select/blob/d8fed304ab7f7f8dfde1e8424ee2a572e31c7488/src/uiSelectController.js#L231-L239 | |
11,475 | angular-ui/ui-select | src/uiSelectMultipleDirective.js | _handleMatchSelection | function _handleMatchSelection(key){
var caretPosition = _getCaretPosition($select.searchInput[0]),
length = $select.selected.length,
// none = -1,
first = 0,
last = length-1,
curr = $selectMultiple.activeMatchIndex,
next = $selectMulti... | javascript | function _handleMatchSelection(key){
var caretPosition = _getCaretPosition($select.searchInput[0]),
length = $select.selected.length,
// none = -1,
first = 0,
last = length-1,
curr = $selectMultiple.activeMatchIndex,
next = $selectMulti... | [
"function",
"_handleMatchSelection",
"(",
"key",
")",
"{",
"var",
"caretPosition",
"=",
"_getCaretPosition",
"(",
"$select",
".",
"searchInput",
"[",
"0",
"]",
")",
",",
"length",
"=",
"$select",
".",
"selected",
".",
"length",
",",
"// none = -1,",
"first",
... | Handles selected options in "multiple" mode | [
"Handles",
"selected",
"options",
"in",
"multiple",
"mode"
] | d8fed304ab7f7f8dfde1e8424ee2a572e31c7488 | https://github.com/angular-ui/ui-select/blob/d8fed304ab7f7f8dfde1e8424ee2a572e31c7488/src/uiSelectMultipleDirective.js#L218-L280 |
11,476 | jedfoster/Readmore.js | jquery.mockjax.js | parseXML | function parseXML(xml) {
if ( window.DOMParser == undefined && window.ActiveXObject ) {
DOMParser = function() { };
DOMParser.prototype.parseFromString = function( xmlString ) {
var doc = new ActiveXObject('Microsoft.XMLDOM');
doc.async = 'false';
doc.loadXML( xmlString );
return doc;
};
}
... | javascript | function parseXML(xml) {
if ( window.DOMParser == undefined && window.ActiveXObject ) {
DOMParser = function() { };
DOMParser.prototype.parseFromString = function( xmlString ) {
var doc = new ActiveXObject('Microsoft.XMLDOM');
doc.async = 'false';
doc.loadXML( xmlString );
return doc;
};
}
... | [
"function",
"parseXML",
"(",
"xml",
")",
"{",
"if",
"(",
"window",
".",
"DOMParser",
"==",
"undefined",
"&&",
"window",
".",
"ActiveXObject",
")",
"{",
"DOMParser",
"=",
"function",
"(",
")",
"{",
"}",
";",
"DOMParser",
".",
"prototype",
".",
"parseFromS... | Parse the given XML string. | [
"Parse",
"the",
"given",
"XML",
"string",
"."
] | d7fe38b8214fc5804219736008c8470953b082c0 | https://github.com/jedfoster/Readmore.js/blob/d7fe38b8214fc5804219736008c8470953b082c0/jquery.mockjax.js#L26-L53 |
11,477 | jedfoster/Readmore.js | jquery.mockjax.js | isMockDataEqual | function isMockDataEqual( mock, live ) {
var identical = true;
// Test for situations where the data is a querystring (not an object)
if (typeof live === 'string') {
// Querystring may be a regex
return $.isFunction( mock.test ) ? mock.test(live) : mock == live;
}
$.each(mock, function(k) {
if ( live... | javascript | function isMockDataEqual( mock, live ) {
var identical = true;
// Test for situations where the data is a querystring (not an object)
if (typeof live === 'string') {
// Querystring may be a regex
return $.isFunction( mock.test ) ? mock.test(live) : mock == live;
}
$.each(mock, function(k) {
if ( live... | [
"function",
"isMockDataEqual",
"(",
"mock",
",",
"live",
")",
"{",
"var",
"identical",
"=",
"true",
";",
"// Test for situations where the data is a querystring (not an object)",
"if",
"(",
"typeof",
"live",
"===",
"'string'",
")",
"{",
"// Querystring may be a regex",
... | Check if the data field on the mock handler and the request match. This can be used to restrict a mock handler to being used only when a certain set of data is passed to it. | [
"Check",
"if",
"the",
"data",
"field",
"on",
"the",
"mock",
"handler",
"and",
"the",
"request",
"match",
".",
"This",
"can",
"be",
"used",
"to",
"restrict",
"a",
"mock",
"handler",
"to",
"being",
"used",
"only",
"when",
"a",
"certain",
"set",
"of",
"da... | d7fe38b8214fc5804219736008c8470953b082c0 | https://github.com/jedfoster/Readmore.js/blob/d7fe38b8214fc5804219736008c8470953b082c0/jquery.mockjax.js#L58-L86 |
11,478 | jedfoster/Readmore.js | jquery.mockjax.js | getMockForRequest | function getMockForRequest( handler, requestSettings ) {
// If the mock was registered with a function, let the function decide if we
// want to mock this request
if ( $.isFunction(handler) ) {
return handler( requestSettings );
}
// Inspect the URL of the request and check if the mock handler's url
// ... | javascript | function getMockForRequest( handler, requestSettings ) {
// If the mock was registered with a function, let the function decide if we
// want to mock this request
if ( $.isFunction(handler) ) {
return handler( requestSettings );
}
// Inspect the URL of the request and check if the mock handler's url
// ... | [
"function",
"getMockForRequest",
"(",
"handler",
",",
"requestSettings",
")",
"{",
"// If the mock was registered with a function, let the function decide if we",
"// want to mock this request",
"if",
"(",
"$",
".",
"isFunction",
"(",
"handler",
")",
")",
"{",
"return",
"ha... | Check the given handler should mock the given request | [
"Check",
"the",
"given",
"handler",
"should",
"mock",
"the",
"given",
"request"
] | d7fe38b8214fc5804219736008c8470953b082c0 | https://github.com/jedfoster/Readmore.js/blob/d7fe38b8214fc5804219736008c8470953b082c0/jquery.mockjax.js#L94-L132 |
11,479 | jedfoster/Readmore.js | jquery.mockjax.js | xhr | function xhr(mockHandler, requestSettings, origSettings, origHandler) {
// Extend with our default mockjax settings
mockHandler = $.extend(true, {}, $.mockjaxSettings, mockHandler);
if (typeof mockHandler.headers === 'undefined') {
mockHandler.headers = {};
}
if (typeof requestSettings.headers === 'undefi... | javascript | function xhr(mockHandler, requestSettings, origSettings, origHandler) {
// Extend with our default mockjax settings
mockHandler = $.extend(true, {}, $.mockjaxSettings, mockHandler);
if (typeof mockHandler.headers === 'undefined') {
mockHandler.headers = {};
}
if (typeof requestSettings.headers === 'undefi... | [
"function",
"xhr",
"(",
"mockHandler",
",",
"requestSettings",
",",
"origSettings",
",",
"origHandler",
")",
"{",
"// Extend with our default mockjax settings",
"mockHandler",
"=",
"$",
".",
"extend",
"(",
"true",
",",
"{",
"}",
",",
"$",
".",
"mockjaxSettings",
... | Construct a mocked XHR Object | [
"Construct",
"a",
"mocked",
"XHR",
"Object"
] | d7fe38b8214fc5804219736008c8470953b082c0 | https://github.com/jedfoster/Readmore.js/blob/d7fe38b8214fc5804219736008c8470953b082c0/jquery.mockjax.js#L252-L306 |
11,480 | jedfoster/Readmore.js | jquery.mockjax.js | processJsonpMock | function processJsonpMock( requestSettings, mockHandler, origSettings ) {
// Handle JSONP Parameter Callbacks, we need to replicate some of the jQuery core here
// because there isn't an easy hook for the cross domain script tag of jsonp
processJsonpUrl( requestSettings );
requestSettings.dataType = "json";
... | javascript | function processJsonpMock( requestSettings, mockHandler, origSettings ) {
// Handle JSONP Parameter Callbacks, we need to replicate some of the jQuery core here
// because there isn't an easy hook for the cross domain script tag of jsonp
processJsonpUrl( requestSettings );
requestSettings.dataType = "json";
... | [
"function",
"processJsonpMock",
"(",
"requestSettings",
",",
"mockHandler",
",",
"origSettings",
")",
"{",
"// Handle JSONP Parameter Callbacks, we need to replicate some of the jQuery core here",
"// because there isn't an easy hook for the cross domain script tag of jsonp",
"processJsonpUr... | Process a JSONP mock request. | [
"Process",
"a",
"JSONP",
"mock",
"request",
"."
] | d7fe38b8214fc5804219736008c8470953b082c0 | https://github.com/jedfoster/Readmore.js/blob/d7fe38b8214fc5804219736008c8470953b082c0/jquery.mockjax.js#L309-L340 |
11,481 | jedfoster/Readmore.js | jquery.mockjax.js | processJsonpUrl | function processJsonpUrl( requestSettings ) {
if ( requestSettings.type.toUpperCase() === "GET" ) {
if ( !CALLBACK_REGEX.test( requestSettings.url ) ) {
requestSettings.url += (/\?/.test( requestSettings.url ) ? "&" : "?") +
(requestSettings.jsonp || "callback") + "=?";
}
} else if ( !requestSettings... | javascript | function processJsonpUrl( requestSettings ) {
if ( requestSettings.type.toUpperCase() === "GET" ) {
if ( !CALLBACK_REGEX.test( requestSettings.url ) ) {
requestSettings.url += (/\?/.test( requestSettings.url ) ? "&" : "?") +
(requestSettings.jsonp || "callback") + "=?";
}
} else if ( !requestSettings... | [
"function",
"processJsonpUrl",
"(",
"requestSettings",
")",
"{",
"if",
"(",
"requestSettings",
".",
"type",
".",
"toUpperCase",
"(",
")",
"===",
"\"GET\"",
")",
"{",
"if",
"(",
"!",
"CALLBACK_REGEX",
".",
"test",
"(",
"requestSettings",
".",
"url",
")",
")... | Append the required callback parameter to the end of the request URL, for a JSONP request | [
"Append",
"the",
"required",
"callback",
"parameter",
"to",
"the",
"end",
"of",
"the",
"request",
"URL",
"for",
"a",
"JSONP",
"request"
] | d7fe38b8214fc5804219736008c8470953b082c0 | https://github.com/jedfoster/Readmore.js/blob/d7fe38b8214fc5804219736008c8470953b082c0/jquery.mockjax.js#L343-L352 |
11,482 | jedfoster/Readmore.js | jquery.mockjax.js | processJsonpRequest | function processJsonpRequest( requestSettings, mockHandler, origSettings ) {
// Synthesize the mock request for adding a script tag
var callbackContext = origSettings && origSettings.context || requestSettings,
newMock = null;
// If the response handler on the moock is a function, call it
if ( mockHandler.... | javascript | function processJsonpRequest( requestSettings, mockHandler, origSettings ) {
// Synthesize the mock request for adding a script tag
var callbackContext = origSettings && origSettings.context || requestSettings,
newMock = null;
// If the response handler on the moock is a function, call it
if ( mockHandler.... | [
"function",
"processJsonpRequest",
"(",
"requestSettings",
",",
"mockHandler",
",",
"origSettings",
")",
"{",
"// Synthesize the mock request for adding a script tag",
"var",
"callbackContext",
"=",
"origSettings",
"&&",
"origSettings",
".",
"context",
"||",
"requestSettings"... | Process a JSONP request by evaluating the mocked response text | [
"Process",
"a",
"JSONP",
"request",
"by",
"evaluating",
"the",
"mocked",
"response",
"text"
] | d7fe38b8214fc5804219736008c8470953b082c0 | https://github.com/jedfoster/Readmore.js/blob/d7fe38b8214fc5804219736008c8470953b082c0/jquery.mockjax.js#L355-L391 |
11,483 | jedfoster/Readmore.js | jquery.mockjax.js | createJsonpCallback | function createJsonpCallback( requestSettings, mockHandler, origSettings ) {
var callbackContext = origSettings && origSettings.context || requestSettings;
var jsonp = requestSettings.jsonpCallback || ("jsonp" + jsc++);
// Replace the =? sequence both in the query string and the data
if ( requestSettings.data ... | javascript | function createJsonpCallback( requestSettings, mockHandler, origSettings ) {
var callbackContext = origSettings && origSettings.context || requestSettings;
var jsonp = requestSettings.jsonpCallback || ("jsonp" + jsc++);
// Replace the =? sequence both in the query string and the data
if ( requestSettings.data ... | [
"function",
"createJsonpCallback",
"(",
"requestSettings",
",",
"mockHandler",
",",
"origSettings",
")",
"{",
"var",
"callbackContext",
"=",
"origSettings",
"&&",
"origSettings",
".",
"context",
"||",
"requestSettings",
";",
"var",
"jsonp",
"=",
"requestSettings",
"... | Create the required JSONP callback function for the request | [
"Create",
"the",
"required",
"JSONP",
"callback",
"function",
"for",
"the",
"request"
] | d7fe38b8214fc5804219736008c8470953b082c0 | https://github.com/jedfoster/Readmore.js/blob/d7fe38b8214fc5804219736008c8470953b082c0/jquery.mockjax.js#L395-L423 |
11,484 | jedfoster/Readmore.js | jquery.mockjax.js | jsonpSuccess | function jsonpSuccess(requestSettings, callbackContext, mockHandler) {
// If a local callback was specified, fire it and pass it the data
if ( requestSettings.success ) {
requestSettings.success.call( callbackContext, mockHandler.responseText || "", status, {} );
}
// Fire the global callback
if ( request... | javascript | function jsonpSuccess(requestSettings, callbackContext, mockHandler) {
// If a local callback was specified, fire it and pass it the data
if ( requestSettings.success ) {
requestSettings.success.call( callbackContext, mockHandler.responseText || "", status, {} );
}
// Fire the global callback
if ( request... | [
"function",
"jsonpSuccess",
"(",
"requestSettings",
",",
"callbackContext",
",",
"mockHandler",
")",
"{",
"// If a local callback was specified, fire it and pass it the data",
"if",
"(",
"requestSettings",
".",
"success",
")",
"{",
"requestSettings",
".",
"success",
".",
... | The JSONP request was successful | [
"The",
"JSONP",
"request",
"was",
"successful"
] | d7fe38b8214fc5804219736008c8470953b082c0 | https://github.com/jedfoster/Readmore.js/blob/d7fe38b8214fc5804219736008c8470953b082c0/jquery.mockjax.js#L426-L436 |
11,485 | jedfoster/Readmore.js | jquery.mockjax.js | jsonpComplete | function jsonpComplete(requestSettings, callbackContext) {
// Process result
if ( requestSettings.complete ) {
requestSettings.complete.call( callbackContext, {} , status );
}
// The request was completed
if ( requestSettings.global ) {
(requestSettings.context ? $(requestSettings.context) : $.event).t... | javascript | function jsonpComplete(requestSettings, callbackContext) {
// Process result
if ( requestSettings.complete ) {
requestSettings.complete.call( callbackContext, {} , status );
}
// The request was completed
if ( requestSettings.global ) {
(requestSettings.context ? $(requestSettings.context) : $.event).t... | [
"function",
"jsonpComplete",
"(",
"requestSettings",
",",
"callbackContext",
")",
"{",
"// Process result",
"if",
"(",
"requestSettings",
".",
"complete",
")",
"{",
"requestSettings",
".",
"complete",
".",
"call",
"(",
"callbackContext",
",",
"{",
"}",
",",
"sta... | The JSONP request was completed | [
"The",
"JSONP",
"request",
"was",
"completed"
] | d7fe38b8214fc5804219736008c8470953b082c0 | https://github.com/jedfoster/Readmore.js/blob/d7fe38b8214fc5804219736008c8470953b082c0/jquery.mockjax.js#L439-L454 |
11,486 | jedfoster/Readmore.js | jquery.mockjax.js | copyUrlParameters | function copyUrlParameters(mockHandler, origSettings) {
//parameters aren't captured if the URL isn't a RegExp
if (!(mockHandler.url instanceof RegExp)) {
return;
}
//if no URL params were defined on the handler, don't attempt a capture
if (!mockHandler.hasOwnProperty('urlParams')) {
return;
}
var c... | javascript | function copyUrlParameters(mockHandler, origSettings) {
//parameters aren't captured if the URL isn't a RegExp
if (!(mockHandler.url instanceof RegExp)) {
return;
}
//if no URL params were defined on the handler, don't attempt a capture
if (!mockHandler.hasOwnProperty('urlParams')) {
return;
}
var c... | [
"function",
"copyUrlParameters",
"(",
"mockHandler",
",",
"origSettings",
")",
"{",
"//parameters aren't captured if the URL isn't a RegExp",
"if",
"(",
"!",
"(",
"mockHandler",
".",
"url",
"instanceof",
"RegExp",
")",
")",
"{",
"return",
";",
"}",
"//if no URL params... | Copies URL parameter values if they were captured by a regular expression
@param {Object} mockHandler
@param {Object} origSettings | [
"Copies",
"URL",
"parameter",
"values",
"if",
"they",
"were",
"captured",
"by",
"a",
"regular",
"expression"
] | d7fe38b8214fc5804219736008c8470953b082c0 | https://github.com/jedfoster/Readmore.js/blob/d7fe38b8214fc5804219736008c8470953b082c0/jquery.mockjax.js#L572-L599 |
11,487 | marceljuenemann/angular-drag-and-drop-lists | angular-drag-and-drop-lists.js | getMimeType | function getMimeType(types) {
if (!types) return MSIE_MIME_TYPE; // IE 9 workaround.
for (var i = 0; i < types.length; i++) {
if (types[i] == MSIE_MIME_TYPE || types[i] == EDGE_MIME_TYPE ||
types[i].substr(0, MIME_TYPE.length) == MIME_TYPE) {
return types[i];
... | javascript | function getMimeType(types) {
if (!types) return MSIE_MIME_TYPE; // IE 9 workaround.
for (var i = 0; i < types.length; i++) {
if (types[i] == MSIE_MIME_TYPE || types[i] == EDGE_MIME_TYPE ||
types[i].substr(0, MIME_TYPE.length) == MIME_TYPE) {
return types[i];
... | [
"function",
"getMimeType",
"(",
"types",
")",
"{",
"if",
"(",
"!",
"types",
")",
"return",
"MSIE_MIME_TYPE",
";",
"// IE 9 workaround.",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"types",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"... | Given the types array from the DataTransfer object, returns the first valid mime type.
A type is valid if it starts with MIME_TYPE, or it equals MSIE_MIME_TYPE or EDGE_MIME_TYPE. | [
"Given",
"the",
"types",
"array",
"from",
"the",
"DataTransfer",
"object",
"returns",
"the",
"first",
"valid",
"mime",
"type",
".",
"A",
"type",
"is",
"valid",
"if",
"it",
"starts",
"with",
"MIME_TYPE",
"or",
"it",
"equals",
"MSIE_MIME_TYPE",
"or",
"EDGE_MIM... | 7e98e194a8d66fa735bf6dc7c3e39886287b914e | https://github.com/marceljuenemann/angular-drag-and-drop-lists/blob/7e98e194a8d66fa735bf6dc7c3e39886287b914e/angular-drag-and-drop-lists.js#L454-L463 |
11,488 | marceljuenemann/angular-drag-and-drop-lists | angular-drag-and-drop-lists.js | getItemType | function getItemType(mimeType) {
if (dndState.isDragging) return dndState.itemType || undefined;
if (mimeType == MSIE_MIME_TYPE || mimeType == EDGE_MIME_TYPE) return null;
return (mimeType && mimeType.substr(MIME_TYPE.length + 1)) || undefined;
} | javascript | function getItemType(mimeType) {
if (dndState.isDragging) return dndState.itemType || undefined;
if (mimeType == MSIE_MIME_TYPE || mimeType == EDGE_MIME_TYPE) return null;
return (mimeType && mimeType.substr(MIME_TYPE.length + 1)) || undefined;
} | [
"function",
"getItemType",
"(",
"mimeType",
")",
"{",
"if",
"(",
"dndState",
".",
"isDragging",
")",
"return",
"dndState",
".",
"itemType",
"||",
"undefined",
";",
"if",
"(",
"mimeType",
"==",
"MSIE_MIME_TYPE",
"||",
"mimeType",
"==",
"EDGE_MIME_TYPE",
")",
... | Determines the type of the item from the dndState, or from the mime type for items from
external sources. Returns undefined if no item type was set and null if the item type could
not be determined. | [
"Determines",
"the",
"type",
"of",
"the",
"item",
"from",
"the",
"dndState",
"or",
"from",
"the",
"mime",
"type",
"for",
"items",
"from",
"external",
"sources",
".",
"Returns",
"undefined",
"if",
"no",
"item",
"type",
"was",
"set",
"and",
"null",
"if",
"... | 7e98e194a8d66fa735bf6dc7c3e39886287b914e | https://github.com/marceljuenemann/angular-drag-and-drop-lists/blob/7e98e194a8d66fa735bf6dc7c3e39886287b914e/angular-drag-and-drop-lists.js#L470-L474 |
11,489 | marceljuenemann/angular-drag-and-drop-lists | angular-drag-and-drop-lists.js | getPlaceholderElement | function getPlaceholderElement() {
var placeholder;
angular.forEach(element.children(), function(childNode) {
var child = angular.element(childNode);
if (child.hasClass('dndPlaceholder')) {
placeholder = child;
}
});
return placeholder || angular... | javascript | function getPlaceholderElement() {
var placeholder;
angular.forEach(element.children(), function(childNode) {
var child = angular.element(childNode);
if (child.hasClass('dndPlaceholder')) {
placeholder = child;
}
});
return placeholder || angular... | [
"function",
"getPlaceholderElement",
"(",
")",
"{",
"var",
"placeholder",
";",
"angular",
".",
"forEach",
"(",
"element",
".",
"children",
"(",
")",
",",
"function",
"(",
"childNode",
")",
"{",
"var",
"child",
"=",
"angular",
".",
"element",
"(",
"childNod... | Tries to find a child element that has the dndPlaceholder class set. If none was found, a
new li element is created. | [
"Tries",
"to",
"find",
"a",
"child",
"element",
"that",
"has",
"the",
"dndPlaceholder",
"class",
"set",
".",
"If",
"none",
"was",
"found",
"a",
"new",
"li",
"element",
"is",
"created",
"."
] | 7e98e194a8d66fa735bf6dc7c3e39886287b914e | https://github.com/marceljuenemann/angular-drag-and-drop-lists/blob/7e98e194a8d66fa735bf6dc7c3e39886287b914e/angular-drag-and-drop-lists.js#L553-L562 |
11,490 | marceljuenemann/angular-drag-and-drop-lists | angular-drag-and-drop-lists.js | filterEffects | function filterEffects(effects, effectAllowed) {
if (effectAllowed == 'all') return effects;
return effects.filter(function(effect) {
return effectAllowed.toLowerCase().indexOf(effect) != -1;
});
} | javascript | function filterEffects(effects, effectAllowed) {
if (effectAllowed == 'all') return effects;
return effects.filter(function(effect) {
return effectAllowed.toLowerCase().indexOf(effect) != -1;
});
} | [
"function",
"filterEffects",
"(",
"effects",
",",
"effectAllowed",
")",
"{",
"if",
"(",
"effectAllowed",
"==",
"'all'",
")",
"return",
"effects",
";",
"return",
"effects",
".",
"filter",
"(",
"function",
"(",
"effect",
")",
"{",
"return",
"effectAllowed",
".... | Filters an array of drop effects using a HTML5 effectAllowed string. | [
"Filters",
"an",
"array",
"of",
"drop",
"effects",
"using",
"a",
"HTML5",
"effectAllowed",
"string",
"."
] | 7e98e194a8d66fa735bf6dc7c3e39886287b914e | https://github.com/marceljuenemann/angular-drag-and-drop-lists/blob/7e98e194a8d66fa735bf6dc7c3e39886287b914e/angular-drag-and-drop-lists.js#L629-L634 |
11,491 | wilix-team/iohook | install.js | install | function install(runtime, abi, platform, arch, cb) {
const essential = runtime + '-v' + abi + '-' + platform + '-' + arch;
const pkgVersion = pkg.version;
const currentPlatform = pkg.name + '-v' + pkgVersion + '-' + essential;
console.log('Downloading prebuild for platform:', currentPlatform);
let downloadUr... | javascript | function install(runtime, abi, platform, arch, cb) {
const essential = runtime + '-v' + abi + '-' + platform + '-' + arch;
const pkgVersion = pkg.version;
const currentPlatform = pkg.name + '-v' + pkgVersion + '-' + essential;
console.log('Downloading prebuild for platform:', currentPlatform);
let downloadUr... | [
"function",
"install",
"(",
"runtime",
",",
"abi",
",",
"platform",
",",
"arch",
",",
"cb",
")",
"{",
"const",
"essential",
"=",
"runtime",
"+",
"'-v'",
"+",
"abi",
"+",
"'-'",
"+",
"platform",
"+",
"'-'",
"+",
"arch",
";",
"const",
"pkgVersion",
"="... | Download and Install prebuild
@param runtime
@param abi
@param platform
@param arch
@param cb Callback | [
"Download",
"and",
"Install",
"prebuild"
] | 7a298ab49afb5bfd75f74ab94b1fce220150d396 | https://github.com/wilix-team/iohook/blob/7a298ab49afb5bfd75f74ab94b1fce220150d396/install.js#L25-L78 |
11,492 | wilix-team/iohook | install.js | optionsFromPackage | function optionsFromPackage(attempts) {
attempts = attempts || 2;
if (attempts > 5) {
console.log('Can\'t resolve main package.json file');
return {
targets: [],
platforms: [process.platform],
arches: [process.arch]
}
}
let mainPath = Array(attempts).join("../");
try {
const ... | javascript | function optionsFromPackage(attempts) {
attempts = attempts || 2;
if (attempts > 5) {
console.log('Can\'t resolve main package.json file');
return {
targets: [],
platforms: [process.platform],
arches: [process.arch]
}
}
let mainPath = Array(attempts).join("../");
try {
const ... | [
"function",
"optionsFromPackage",
"(",
"attempts",
")",
"{",
"attempts",
"=",
"attempts",
"||",
"2",
";",
"if",
"(",
"attempts",
">",
"5",
")",
"{",
"console",
".",
"log",
"(",
"'Can\\'t resolve main package.json file'",
")",
";",
"return",
"{",
"targets",
"... | Return options for iohook from package.json
@return {Object} | [
"Return",
"options",
"for",
"iohook",
"from",
"package",
".",
"json"
] | 7a298ab49afb5bfd75f74ab94b1fce220150d396 | https://github.com/wilix-team/iohook/blob/7a298ab49afb5bfd75f74ab94b1fce220150d396/install.js#L84-L108 |
11,493 | govau/design-system-components | packages/main-nav/src/js/module.js | listenHandler | function listenHandler( event ) {
var handler = rawHandler.apply( this, arguments );
if ( handler === false) {
event.stopPropagation();
event.preventDefault();
}
return( handler );
} | javascript | function listenHandler( event ) {
var handler = rawHandler.apply( this, arguments );
if ( handler === false) {
event.stopPropagation();
event.preventDefault();
}
return( handler );
} | [
"function",
"listenHandler",
"(",
"event",
")",
"{",
"var",
"handler",
"=",
"rawHandler",
".",
"apply",
"(",
"this",
",",
"arguments",
")",
";",
"if",
"(",
"handler",
"===",
"false",
")",
"{",
"event",
".",
"stopPropagation",
"(",
")",
";",
"event",
".... | Using local functions instead of anonymous for event handler | [
"Using",
"local",
"functions",
"instead",
"of",
"anonymous",
"for",
"event",
"handler"
] | 38aa8c127e1469a7835dea5513f1d6e2aff05186 | https://github.com/govau/design-system-components/blob/38aa8c127e1469a7835dea5513f1d6e2aff05186/packages/main-nav/src/js/module.js#L96-L103 |
11,494 | govau/design-system-components | packages/main-nav/src/js/module.js | attachHandler | function attachHandler() {
var handler = rawHandler.call( element, window.event );
if ( handler === false ) {
window.event.returnValue = false;
window.event.cancelBubble = true;
}
return( handler );
} | javascript | function attachHandler() {
var handler = rawHandler.call( element, window.event );
if ( handler === false ) {
window.event.returnValue = false;
window.event.cancelBubble = true;
}
return( handler );
} | [
"function",
"attachHandler",
"(",
")",
"{",
"var",
"handler",
"=",
"rawHandler",
".",
"call",
"(",
"element",
",",
"window",
".",
"event",
")",
";",
"if",
"(",
"handler",
"===",
"false",
")",
"{",
"window",
".",
"event",
".",
"returnValue",
"=",
"false... | Make sure attachHandler is also going to work | [
"Make",
"sure",
"attachHandler",
"is",
"also",
"going",
"to",
"work"
] | 38aa8c127e1469a7835dea5513f1d6e2aff05186 | https://github.com/govau/design-system-components/blob/38aa8c127e1469a7835dea5513f1d6e2aff05186/packages/main-nav/src/js/module.js#L106-L113 |
11,495 | govau/design-system-components | packages/main-nav/src/js/module.js | removeEvent | function removeEvent( token ) {
if ( token.element.removeEventListener ) {
token.element.removeEventListener( token.event, token.handler );
} else {
token.element.detachEvent( 'on' + token.event, token.handler );
}
} | javascript | function removeEvent( token ) {
if ( token.element.removeEventListener ) {
token.element.removeEventListener( token.event, token.handler );
} else {
token.element.detachEvent( 'on' + token.event, token.handler );
}
} | [
"function",
"removeEvent",
"(",
"token",
")",
"{",
"if",
"(",
"token",
".",
"element",
".",
"removeEventListener",
")",
"{",
"token",
".",
"element",
".",
"removeEventListener",
"(",
"token",
".",
"event",
",",
"token",
".",
"handler",
")",
";",
"}",
"el... | PRIVATE
IE8 compatible function for removing an event
@param {object} token - The token from the add listener function | [
"PRIVATE",
"IE8",
"compatible",
"function",
"for",
"removing",
"an",
"event"
] | 38aa8c127e1469a7835dea5513f1d6e2aff05186 | https://github.com/govau/design-system-components/blob/38aa8c127e1469a7835dea5513f1d6e2aff05186/packages/main-nav/src/js/module.js#L140-L146 |
11,496 | govau/design-system-components | packages/main-nav/src/js/module.js | getStyle | function getStyle( element, property ) {
return (
typeof getComputedStyle !== 'undefined'
? getComputedStyle( element, null)
: element.currentStyle
)[ property ]; // avoid getPropertyValue altogether
} | javascript | function getStyle( element, property ) {
return (
typeof getComputedStyle !== 'undefined'
? getComputedStyle( element, null)
: element.currentStyle
)[ property ]; // avoid getPropertyValue altogether
} | [
"function",
"getStyle",
"(",
"element",
",",
"property",
")",
"{",
"return",
"(",
"typeof",
"getComputedStyle",
"!==",
"'undefined'",
"?",
"getComputedStyle",
"(",
"element",
",",
"null",
")",
":",
"element",
".",
"currentStyle",
")",
"[",
"property",
"]",
"... | PRIVATE
IE8 compatible function for getting elements style
@param {object} element - element to check style
@param {object} property - property to return value | [
"PRIVATE",
"IE8",
"compatible",
"function",
"for",
"getting",
"elements",
"style"
] | 38aa8c127e1469a7835dea5513f1d6e2aff05186 | https://github.com/govau/design-system-components/blob/38aa8c127e1469a7835dea5513f1d6e2aff05186/packages/main-nav/src/js/module.js#L156-L162 |
11,497 | govau/design-system-components | packages/accordion/src/js/module.js | toggleClasses | function toggleClasses( element, state, openingClass, closingClass ) {
if( state === 'opening' || state === 'open' ) {
var oldClass = openingClass || 'au-accordion--closed';
var newClass = closingClass || 'au-accordion--open';
}
else {
var oldClass = closingClass || 'au-accordion--open';
var newClass... | javascript | function toggleClasses( element, state, openingClass, closingClass ) {
if( state === 'opening' || state === 'open' ) {
var oldClass = openingClass || 'au-accordion--closed';
var newClass = closingClass || 'au-accordion--open';
}
else {
var oldClass = closingClass || 'au-accordion--open';
var newClass... | [
"function",
"toggleClasses",
"(",
"element",
",",
"state",
",",
"openingClass",
",",
"closingClass",
")",
"{",
"if",
"(",
"state",
"===",
"'opening'",
"||",
"state",
"===",
"'open'",
")",
"{",
"var",
"oldClass",
"=",
"openingClass",
"||",
"'au-accordion--close... | PRIVATE
IE8 compatible function for replacing classes on a DOM node
@param {object} element - The DOM element we want to toggle classes on
@param {object} target - The DOM element we want to toggle classes on
@param {object} state - The current state of the animation on the element
@param {string... | [
"PRIVATE",
"IE8",
"compatible",
"function",
"for",
"replacing",
"classes",
"on",
"a",
"DOM",
"node"
] | 38aa8c127e1469a7835dea5513f1d6e2aff05186 | https://github.com/govau/design-system-components/blob/38aa8c127e1469a7835dea5513f1d6e2aff05186/packages/accordion/src/js/module.js#L52-L65 |
11,498 | govau/design-system-components | scripts/helper.js | ExitHandler | function ExitHandler( exiting, error ) {
if( error ) {
if( error.stack ) {
console.error( error.stack );
}
process.exit( 1 );
}
if( exiting.now ) {
process.exit( 0 ); // exit now
}
console.log('\n');
process.exit( 0 ); // now exit with a smile :)
} | javascript | function ExitHandler( exiting, error ) {
if( error ) {
if( error.stack ) {
console.error( error.stack );
}
process.exit( 1 );
}
if( exiting.now ) {
process.exit( 0 ); // exit now
}
console.log('\n');
process.exit( 0 ); // now exit with a smile :)
} | [
"function",
"ExitHandler",
"(",
"exiting",
",",
"error",
")",
"{",
"if",
"(",
"error",
")",
"{",
"if",
"(",
"error",
".",
"stack",
")",
"{",
"console",
".",
"error",
"(",
"error",
".",
"stack",
")",
";",
"}",
"process",
".",
"exit",
"(",
"1",
")"... | Handle exiting of program
@param {null} exiting - null for bind
@param {object} error - Object to distinguish between closing events | [
"Handle",
"exiting",
"of",
"program"
] | 38aa8c127e1469a7835dea5513f1d6e2aff05186 | https://github.com/govau/design-system-components/blob/38aa8c127e1469a7835dea5513f1d6e2aff05186/scripts/helper.js#L1266-L1282 |
11,499 | nordnet/cordova-hot-code-push | scripts/beforePluginInstallHook.js | checkCliDependency | function checkCliDependency(ctx) {
var result = spawnSync('cordova-hcp', [], { cwd: './plugins/' + ctx.opts.plugin.id });
if (!result.error) {
return;
}
suggestCliInstallation();
} | javascript | function checkCliDependency(ctx) {
var result = spawnSync('cordova-hcp', [], { cwd: './plugins/' + ctx.opts.plugin.id });
if (!result.error) {
return;
}
suggestCliInstallation();
} | [
"function",
"checkCliDependency",
"(",
"ctx",
")",
"{",
"var",
"result",
"=",
"spawnSync",
"(",
"'cordova-hcp'",
",",
"[",
"]",
",",
"{",
"cwd",
":",
"'./plugins/'",
"+",
"ctx",
".",
"opts",
".",
"plugin",
".",
"id",
"}",
")",
";",
"if",
"(",
"!",
... | region CLI specific
Check if cordova-hcp utility is installed. If not - suggest user to install it. | [
"region",
"CLI",
"specific",
"Check",
"if",
"cordova",
"-",
"hcp",
"utility",
"is",
"installed",
".",
"If",
"not",
"-",
"suggest",
"user",
"to",
"install",
"it",
"."
] | 0163767206f4cf97f49257e2ad599bf0ba61f43d | https://github.com/nordnet/cordova-hot-code-push/blob/0163767206f4cf97f49257e2ad599bf0ba61f43d/scripts/beforePluginInstallHook.js#L19-L26 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.