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
|
---|---|---|---|---|---|---|---|---|---|---|---|
43,100 | neyric/webhookit | public/javascripts/yui/dragdrop/dragdrop-debug.js | function(e) {
//YAHOO.log("handlemousemove");
var dc = this.dragCurrent;
if (dc) {
// YAHOO.log("no current drag obj");
// var button = e.which || e.button;
// YAHOO.log("which: " + e.which + ", button: "+ e.button);
// check for IE mouseup outside of page boundary
if (YAHOO.util.Event.isIE && !e.button) {
YAHOO.log("button failure", "info", "DragDropMgr");
this.stopEvent(e);
return this.handleMouseUp(e);
} else {
if (e.clientX < 0 || e.clientY < 0) {
//This will stop the element from leaving the viewport in FF, Opera & Safari
//Not turned on yet
//YAHOO.log("Either clientX or clientY is negative, stop the event.", "info", "DragDropMgr");
//this.stopEvent(e);
//return false;
}
}
if (!this.dragThreshMet) {
var diffX = Math.abs(this.startX - YAHOO.util.Event.getPageX(e));
var diffY = Math.abs(this.startY - YAHOO.util.Event.getPageY(e));
// YAHOO.log("diffX: " + diffX + "diffY: " + diffY);
if (diffX > this.clickPixelThresh ||
diffY > this.clickPixelThresh) {
YAHOO.log("pixel threshold met", "info", "DragDropMgr");
this.startDrag(this.startX, this.startY);
}
}
if (this.dragThreshMet) {
if (dc && dc.events.b4Drag) {
dc.b4Drag(e);
dc.fireEvent('b4DragEvent', { e: e});
}
if (dc && dc.events.drag) {
dc.onDrag(e);
dc.fireEvent('dragEvent', { e: e});
}
if (dc) {
this.fireEvents(e, false);
}
}
this.stopEvent(e);
}
} | javascript | function(e) {
//YAHOO.log("handlemousemove");
var dc = this.dragCurrent;
if (dc) {
// YAHOO.log("no current drag obj");
// var button = e.which || e.button;
// YAHOO.log("which: " + e.which + ", button: "+ e.button);
// check for IE mouseup outside of page boundary
if (YAHOO.util.Event.isIE && !e.button) {
YAHOO.log("button failure", "info", "DragDropMgr");
this.stopEvent(e);
return this.handleMouseUp(e);
} else {
if (e.clientX < 0 || e.clientY < 0) {
//This will stop the element from leaving the viewport in FF, Opera & Safari
//Not turned on yet
//YAHOO.log("Either clientX or clientY is negative, stop the event.", "info", "DragDropMgr");
//this.stopEvent(e);
//return false;
}
}
if (!this.dragThreshMet) {
var diffX = Math.abs(this.startX - YAHOO.util.Event.getPageX(e));
var diffY = Math.abs(this.startY - YAHOO.util.Event.getPageY(e));
// YAHOO.log("diffX: " + diffX + "diffY: " + diffY);
if (diffX > this.clickPixelThresh ||
diffY > this.clickPixelThresh) {
YAHOO.log("pixel threshold met", "info", "DragDropMgr");
this.startDrag(this.startX, this.startY);
}
}
if (this.dragThreshMet) {
if (dc && dc.events.b4Drag) {
dc.b4Drag(e);
dc.fireEvent('b4DragEvent', { e: e});
}
if (dc && dc.events.drag) {
dc.onDrag(e);
dc.fireEvent('dragEvent', { e: e});
}
if (dc) {
this.fireEvents(e, false);
}
}
this.stopEvent(e);
}
} | [
"function",
"(",
"e",
")",
"{",
"//YAHOO.log(\"handlemousemove\");",
"var",
"dc",
"=",
"this",
".",
"dragCurrent",
";",
"if",
"(",
"dc",
")",
"{",
"// YAHOO.log(\"no current drag obj\");",
"// var button = e.which || e.button;",
"// YAHOO.log(\"which: \" + e.which + \", button: \"+ e.button);",
"// check for IE mouseup outside of page boundary",
"if",
"(",
"YAHOO",
".",
"util",
".",
"Event",
".",
"isIE",
"&&",
"!",
"e",
".",
"button",
")",
"{",
"YAHOO",
".",
"log",
"(",
"\"button failure\"",
",",
"\"info\"",
",",
"\"DragDropMgr\"",
")",
";",
"this",
".",
"stopEvent",
"(",
"e",
")",
";",
"return",
"this",
".",
"handleMouseUp",
"(",
"e",
")",
";",
"}",
"else",
"{",
"if",
"(",
"e",
".",
"clientX",
"<",
"0",
"||",
"e",
".",
"clientY",
"<",
"0",
")",
"{",
"//This will stop the element from leaving the viewport in FF, Opera & Safari",
"//Not turned on yet",
"//YAHOO.log(\"Either clientX or clientY is negative, stop the event.\", \"info\", \"DragDropMgr\");",
"//this.stopEvent(e);",
"//return false;",
"}",
"}",
"if",
"(",
"!",
"this",
".",
"dragThreshMet",
")",
"{",
"var",
"diffX",
"=",
"Math",
".",
"abs",
"(",
"this",
".",
"startX",
"-",
"YAHOO",
".",
"util",
".",
"Event",
".",
"getPageX",
"(",
"e",
")",
")",
";",
"var",
"diffY",
"=",
"Math",
".",
"abs",
"(",
"this",
".",
"startY",
"-",
"YAHOO",
".",
"util",
".",
"Event",
".",
"getPageY",
"(",
"e",
")",
")",
";",
"// YAHOO.log(\"diffX: \" + diffX + \"diffY: \" + diffY);",
"if",
"(",
"diffX",
">",
"this",
".",
"clickPixelThresh",
"||",
"diffY",
">",
"this",
".",
"clickPixelThresh",
")",
"{",
"YAHOO",
".",
"log",
"(",
"\"pixel threshold met\"",
",",
"\"info\"",
",",
"\"DragDropMgr\"",
")",
";",
"this",
".",
"startDrag",
"(",
"this",
".",
"startX",
",",
"this",
".",
"startY",
")",
";",
"}",
"}",
"if",
"(",
"this",
".",
"dragThreshMet",
")",
"{",
"if",
"(",
"dc",
"&&",
"dc",
".",
"events",
".",
"b4Drag",
")",
"{",
"dc",
".",
"b4Drag",
"(",
"e",
")",
";",
"dc",
".",
"fireEvent",
"(",
"'b4DragEvent'",
",",
"{",
"e",
":",
"e",
"}",
")",
";",
"}",
"if",
"(",
"dc",
"&&",
"dc",
".",
"events",
".",
"drag",
")",
"{",
"dc",
".",
"onDrag",
"(",
"e",
")",
";",
"dc",
".",
"fireEvent",
"(",
"'dragEvent'",
",",
"{",
"e",
":",
"e",
"}",
")",
";",
"}",
"if",
"(",
"dc",
")",
"{",
"this",
".",
"fireEvents",
"(",
"e",
",",
"false",
")",
";",
"}",
"}",
"this",
".",
"stopEvent",
"(",
"e",
")",
";",
"}",
"}"
]
| Internal function to handle the mousemove event. Will be invoked
from the context of the html element.
@TODO figure out what we can do about mouse events lost when the
user drags objects beyond the window boundary. Currently we can
detect this in internet explorer by verifying that the mouse is
down during the mousemove event. Firefox doesn't give us the
button state on the mousemove event.
@method handleMouseMove
@param {Event} e the event
@private
@static | [
"Internal",
"function",
"to",
"handle",
"the",
"mousemove",
"event",
".",
"Will",
"be",
"invoked",
"from",
"the",
"context",
"of",
"the",
"html",
"element",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/dragdrop/dragdrop-debug.js#L826-L878 |
|
43,101 | neyric/webhookit | public/javascripts/yui/dragdrop/dragdrop-debug.js | function(el) {
try {
if (el) {
var parent = el.offsetParent;
if (parent) {
return true;
}
}
} catch(e) {
YAHOO.log("detected problem with an element", "info", "DragDropMgr");
}
return false;
} | javascript | function(el) {
try {
if (el) {
var parent = el.offsetParent;
if (parent) {
return true;
}
}
} catch(e) {
YAHOO.log("detected problem with an element", "info", "DragDropMgr");
}
return false;
} | [
"function",
"(",
"el",
")",
"{",
"try",
"{",
"if",
"(",
"el",
")",
"{",
"var",
"parent",
"=",
"el",
".",
"offsetParent",
";",
"if",
"(",
"parent",
")",
"{",
"return",
"true",
";",
"}",
"}",
"}",
"catch",
"(",
"e",
")",
"{",
"YAHOO",
".",
"log",
"(",
"\"detected problem with an element\"",
",",
"\"info\"",
",",
"\"DragDropMgr\"",
")",
";",
"}",
"return",
"false",
";",
"}"
]
| This checks to make sure an element exists and is in the DOM. The
main purpose is to handle cases where innerHTML is used to remove
drag and drop objects from the DOM. IE provides an 'unspecified
error' when trying to access the offsetParent of such an element
@method verifyEl
@param {HTMLElement} el the element to check
@return {boolean} true if the element looks usable
@static | [
"This",
"checks",
"to",
"make",
"sure",
"an",
"element",
"exists",
"and",
"is",
"in",
"the",
"DOM",
".",
"The",
"main",
"purpose",
"is",
"to",
"handle",
"cases",
"where",
"innerHTML",
"is",
"used",
"to",
"remove",
"drag",
"and",
"drop",
"objects",
"from",
"the",
"DOM",
".",
"IE",
"provides",
"an",
"unspecified",
"error",
"when",
"trying",
"to",
"access",
"the",
"offsetParent",
"of",
"such",
"an",
"element"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/dragdrop/dragdrop-debug.js#L1135-L1148 |
|
43,102 | neyric/webhookit | public/javascripts/yui/dragdrop/dragdrop-debug.js | function(oDD) {
if (! this.isTypeOfDD(oDD)) {
YAHOO.log(oDD + " is not a DD obj", "info", "DragDropMgr");
return null;
}
var el = oDD.getEl(), pos, x1, x2, y1, y2, t, r, b, l;
try {
pos= YAHOO.util.Dom.getXY(el);
} catch (e) { }
if (!pos) {
YAHOO.log("getXY failed", "info", "DragDropMgr");
return null;
}
x1 = pos[0];
x2 = x1 + el.offsetWidth;
y1 = pos[1];
y2 = y1 + el.offsetHeight;
t = y1 - oDD.padding[0];
r = x2 + oDD.padding[1];
b = y2 + oDD.padding[2];
l = x1 - oDD.padding[3];
return new YAHOO.util.Region( t, r, b, l );
} | javascript | function(oDD) {
if (! this.isTypeOfDD(oDD)) {
YAHOO.log(oDD + " is not a DD obj", "info", "DragDropMgr");
return null;
}
var el = oDD.getEl(), pos, x1, x2, y1, y2, t, r, b, l;
try {
pos= YAHOO.util.Dom.getXY(el);
} catch (e) { }
if (!pos) {
YAHOO.log("getXY failed", "info", "DragDropMgr");
return null;
}
x1 = pos[0];
x2 = x1 + el.offsetWidth;
y1 = pos[1];
y2 = y1 + el.offsetHeight;
t = y1 - oDD.padding[0];
r = x2 + oDD.padding[1];
b = y2 + oDD.padding[2];
l = x1 - oDD.padding[3];
return new YAHOO.util.Region( t, r, b, l );
} | [
"function",
"(",
"oDD",
")",
"{",
"if",
"(",
"!",
"this",
".",
"isTypeOfDD",
"(",
"oDD",
")",
")",
"{",
"YAHOO",
".",
"log",
"(",
"oDD",
"+",
"\" is not a DD obj\"",
",",
"\"info\"",
",",
"\"DragDropMgr\"",
")",
";",
"return",
"null",
";",
"}",
"var",
"el",
"=",
"oDD",
".",
"getEl",
"(",
")",
",",
"pos",
",",
"x1",
",",
"x2",
",",
"y1",
",",
"y2",
",",
"t",
",",
"r",
",",
"b",
",",
"l",
";",
"try",
"{",
"pos",
"=",
"YAHOO",
".",
"util",
".",
"Dom",
".",
"getXY",
"(",
"el",
")",
";",
"}",
"catch",
"(",
"e",
")",
"{",
"}",
"if",
"(",
"!",
"pos",
")",
"{",
"YAHOO",
".",
"log",
"(",
"\"getXY failed\"",
",",
"\"info\"",
",",
"\"DragDropMgr\"",
")",
";",
"return",
"null",
";",
"}",
"x1",
"=",
"pos",
"[",
"0",
"]",
";",
"x2",
"=",
"x1",
"+",
"el",
".",
"offsetWidth",
";",
"y1",
"=",
"pos",
"[",
"1",
"]",
";",
"y2",
"=",
"y1",
"+",
"el",
".",
"offsetHeight",
";",
"t",
"=",
"y1",
"-",
"oDD",
".",
"padding",
"[",
"0",
"]",
";",
"r",
"=",
"x2",
"+",
"oDD",
".",
"padding",
"[",
"1",
"]",
";",
"b",
"=",
"y2",
"+",
"oDD",
".",
"padding",
"[",
"2",
"]",
";",
"l",
"=",
"x1",
"-",
"oDD",
".",
"padding",
"[",
"3",
"]",
";",
"return",
"new",
"YAHOO",
".",
"util",
".",
"Region",
"(",
"t",
",",
"r",
",",
"b",
",",
"l",
")",
";",
"}"
]
| Returns a Region object containing the drag and drop element's position
and size, including the padding configured for it
@method getLocation
@param {DragDrop} oDD the drag and drop object to get the
location for
@return {YAHOO.util.Region} a Region object representing the total area
the element occupies, including any padding
the instance is configured for.
@static | [
"Returns",
"a",
"Region",
"object",
"containing",
"the",
"drag",
"and",
"drop",
"element",
"s",
"position",
"and",
"size",
"including",
"the",
"padding",
"configured",
"for",
"it"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/dragdrop/dragdrop-debug.js#L1161-L1189 |
|
43,103 | neyric/webhookit | public/javascripts/yui/dragdrop/dragdrop-debug.js | function(pt, oTarget, intersect, curRegion) {
// use cache if available
var loc = this.locationCache[oTarget.id];
if (!loc || !this.useCache) {
YAHOO.log("cache not populated", "info", "DragDropMgr");
loc = this.getLocation(oTarget);
this.locationCache[oTarget.id] = loc;
YAHOO.log("cache: " + loc, "info", "DragDropMgr");
}
if (!loc) {
YAHOO.log("could not get the location of the element", "info", "DragDropMgr");
return false;
}
//YAHOO.log("loc: " + loc + ", pt: " + pt);
oTarget.cursorIsOver = loc.contains( pt );
// DragDrop is using this as a sanity check for the initial mousedown
// in this case we are done. In POINT mode, if the drag obj has no
// contraints, we are done. Otherwise we need to evaluate the
// region the target as occupies to determine if the dragged element
// overlaps with it.
var dc = this.dragCurrent;
if (!dc || (!intersect && !dc.constrainX && !dc.constrainY)) {
//if (oTarget.cursorIsOver) {
//YAHOO.log("over " + oTarget + ", " + loc + ", " + pt, "warn");
//}
return oTarget.cursorIsOver;
}
oTarget.overlap = null;
// Get the current location of the drag element, this is the
// location of the mouse event less the delta that represents
// where the original mousedown happened on the element. We
// need to consider constraints and ticks as well.
if (!curRegion) {
var pos = dc.getTargetCoord(pt.x, pt.y);
var el = dc.getDragEl();
curRegion = new YAHOO.util.Region( pos.y,
pos.x + el.offsetWidth,
pos.y + el.offsetHeight,
pos.x );
}
var overlap = curRegion.intersect(loc);
if (overlap) {
oTarget.overlap = overlap;
return (intersect) ? true : oTarget.cursorIsOver;
} else {
return false;
}
} | javascript | function(pt, oTarget, intersect, curRegion) {
// use cache if available
var loc = this.locationCache[oTarget.id];
if (!loc || !this.useCache) {
YAHOO.log("cache not populated", "info", "DragDropMgr");
loc = this.getLocation(oTarget);
this.locationCache[oTarget.id] = loc;
YAHOO.log("cache: " + loc, "info", "DragDropMgr");
}
if (!loc) {
YAHOO.log("could not get the location of the element", "info", "DragDropMgr");
return false;
}
//YAHOO.log("loc: " + loc + ", pt: " + pt);
oTarget.cursorIsOver = loc.contains( pt );
// DragDrop is using this as a sanity check for the initial mousedown
// in this case we are done. In POINT mode, if the drag obj has no
// contraints, we are done. Otherwise we need to evaluate the
// region the target as occupies to determine if the dragged element
// overlaps with it.
var dc = this.dragCurrent;
if (!dc || (!intersect && !dc.constrainX && !dc.constrainY)) {
//if (oTarget.cursorIsOver) {
//YAHOO.log("over " + oTarget + ", " + loc + ", " + pt, "warn");
//}
return oTarget.cursorIsOver;
}
oTarget.overlap = null;
// Get the current location of the drag element, this is the
// location of the mouse event less the delta that represents
// where the original mousedown happened on the element. We
// need to consider constraints and ticks as well.
if (!curRegion) {
var pos = dc.getTargetCoord(pt.x, pt.y);
var el = dc.getDragEl();
curRegion = new YAHOO.util.Region( pos.y,
pos.x + el.offsetWidth,
pos.y + el.offsetHeight,
pos.x );
}
var overlap = curRegion.intersect(loc);
if (overlap) {
oTarget.overlap = overlap;
return (intersect) ? true : oTarget.cursorIsOver;
} else {
return false;
}
} | [
"function",
"(",
"pt",
",",
"oTarget",
",",
"intersect",
",",
"curRegion",
")",
"{",
"// use cache if available",
"var",
"loc",
"=",
"this",
".",
"locationCache",
"[",
"oTarget",
".",
"id",
"]",
";",
"if",
"(",
"!",
"loc",
"||",
"!",
"this",
".",
"useCache",
")",
"{",
"YAHOO",
".",
"log",
"(",
"\"cache not populated\"",
",",
"\"info\"",
",",
"\"DragDropMgr\"",
")",
";",
"loc",
"=",
"this",
".",
"getLocation",
"(",
"oTarget",
")",
";",
"this",
".",
"locationCache",
"[",
"oTarget",
".",
"id",
"]",
"=",
"loc",
";",
"YAHOO",
".",
"log",
"(",
"\"cache: \"",
"+",
"loc",
",",
"\"info\"",
",",
"\"DragDropMgr\"",
")",
";",
"}",
"if",
"(",
"!",
"loc",
")",
"{",
"YAHOO",
".",
"log",
"(",
"\"could not get the location of the element\"",
",",
"\"info\"",
",",
"\"DragDropMgr\"",
")",
";",
"return",
"false",
";",
"}",
"//YAHOO.log(\"loc: \" + loc + \", pt: \" + pt);",
"oTarget",
".",
"cursorIsOver",
"=",
"loc",
".",
"contains",
"(",
"pt",
")",
";",
"// DragDrop is using this as a sanity check for the initial mousedown",
"// in this case we are done. In POINT mode, if the drag obj has no",
"// contraints, we are done. Otherwise we need to evaluate the ",
"// region the target as occupies to determine if the dragged element",
"// overlaps with it.",
"var",
"dc",
"=",
"this",
".",
"dragCurrent",
";",
"if",
"(",
"!",
"dc",
"||",
"(",
"!",
"intersect",
"&&",
"!",
"dc",
".",
"constrainX",
"&&",
"!",
"dc",
".",
"constrainY",
")",
")",
"{",
"//if (oTarget.cursorIsOver) {",
"//YAHOO.log(\"over \" + oTarget + \", \" + loc + \", \" + pt, \"warn\");",
"//}",
"return",
"oTarget",
".",
"cursorIsOver",
";",
"}",
"oTarget",
".",
"overlap",
"=",
"null",
";",
"// Get the current location of the drag element, this is the",
"// location of the mouse event less the delta that represents",
"// where the original mousedown happened on the element. We",
"// need to consider constraints and ticks as well.",
"if",
"(",
"!",
"curRegion",
")",
"{",
"var",
"pos",
"=",
"dc",
".",
"getTargetCoord",
"(",
"pt",
".",
"x",
",",
"pt",
".",
"y",
")",
";",
"var",
"el",
"=",
"dc",
".",
"getDragEl",
"(",
")",
";",
"curRegion",
"=",
"new",
"YAHOO",
".",
"util",
".",
"Region",
"(",
"pos",
".",
"y",
",",
"pos",
".",
"x",
"+",
"el",
".",
"offsetWidth",
",",
"pos",
".",
"y",
"+",
"el",
".",
"offsetHeight",
",",
"pos",
".",
"x",
")",
";",
"}",
"var",
"overlap",
"=",
"curRegion",
".",
"intersect",
"(",
"loc",
")",
";",
"if",
"(",
"overlap",
")",
"{",
"oTarget",
".",
"overlap",
"=",
"overlap",
";",
"return",
"(",
"intersect",
")",
"?",
"true",
":",
"oTarget",
".",
"cursorIsOver",
";",
"}",
"else",
"{",
"return",
"false",
";",
"}",
"}"
]
| Checks the cursor location to see if it over the target
@method isOverTarget
@param {YAHOO.util.Point} pt The point to evaluate
@param {DragDrop} oTarget the DragDrop object we are inspecting
@param {boolean} intersect true if we are in intersect mode
@param {YAHOO.util.Region} pre-cached location of the dragged element
@return {boolean} true if the mouse is over the target
@private
@static | [
"Checks",
"the",
"cursor",
"location",
"to",
"see",
"if",
"it",
"over",
"the",
"target"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/dragdrop/dragdrop-debug.js#L1202-L1261 |
|
43,104 | neyric/webhookit | public/javascripts/yui/dragdrop/dragdrop-debug.js | function(id) {
var oWrapper = this.elementCache[id];
if (!oWrapper || !oWrapper.el) {
oWrapper = this.elementCache[id] =
new this.ElementWrapper(YAHOO.util.Dom.get(id));
}
return oWrapper;
} | javascript | function(id) {
var oWrapper = this.elementCache[id];
if (!oWrapper || !oWrapper.el) {
oWrapper = this.elementCache[id] =
new this.ElementWrapper(YAHOO.util.Dom.get(id));
}
return oWrapper;
} | [
"function",
"(",
"id",
")",
"{",
"var",
"oWrapper",
"=",
"this",
".",
"elementCache",
"[",
"id",
"]",
";",
"if",
"(",
"!",
"oWrapper",
"||",
"!",
"oWrapper",
".",
"el",
")",
"{",
"oWrapper",
"=",
"this",
".",
"elementCache",
"[",
"id",
"]",
"=",
"new",
"this",
".",
"ElementWrapper",
"(",
"YAHOO",
".",
"util",
".",
"Dom",
".",
"get",
"(",
"id",
")",
")",
";",
"}",
"return",
"oWrapper",
";",
"}"
]
| Get the wrapper for the DOM element specified
@method getElWrapper
@param {String} id the id of the element to get
@return {YAHOO.util.DDM.ElementWrapper} the wrapped element
@private
@deprecated This wrapper isn't that useful
@static | [
"Get",
"the",
"wrapper",
"for",
"the",
"DOM",
"element",
"specified"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/dragdrop/dragdrop-debug.js#L1315-L1322 |
|
43,105 | neyric/webhookit | public/javascripts/yui/dragdrop/dragdrop-debug.js | function(n1, n2) {
if (n1.swapNode) {
n1.swapNode(n2);
} else {
var p = n2.parentNode;
var s = n2.nextSibling;
if (s == n1) {
p.insertBefore(n1, n2);
} else if (n2 == n1.nextSibling) {
p.insertBefore(n2, n1);
} else {
n1.parentNode.replaceChild(n2, n1);
p.insertBefore(n1, s);
}
}
} | javascript | function(n1, n2) {
if (n1.swapNode) {
n1.swapNode(n2);
} else {
var p = n2.parentNode;
var s = n2.nextSibling;
if (s == n1) {
p.insertBefore(n1, n2);
} else if (n2 == n1.nextSibling) {
p.insertBefore(n2, n1);
} else {
n1.parentNode.replaceChild(n2, n1);
p.insertBefore(n1, s);
}
}
} | [
"function",
"(",
"n1",
",",
"n2",
")",
"{",
"if",
"(",
"n1",
".",
"swapNode",
")",
"{",
"n1",
".",
"swapNode",
"(",
"n2",
")",
";",
"}",
"else",
"{",
"var",
"p",
"=",
"n2",
".",
"parentNode",
";",
"var",
"s",
"=",
"n2",
".",
"nextSibling",
";",
"if",
"(",
"s",
"==",
"n1",
")",
"{",
"p",
".",
"insertBefore",
"(",
"n1",
",",
"n2",
")",
";",
"}",
"else",
"if",
"(",
"n2",
"==",
"n1",
".",
"nextSibling",
")",
"{",
"p",
".",
"insertBefore",
"(",
"n2",
",",
"n1",
")",
";",
"}",
"else",
"{",
"n1",
".",
"parentNode",
".",
"replaceChild",
"(",
"n2",
",",
"n1",
")",
";",
"p",
".",
"insertBefore",
"(",
"n1",
",",
"s",
")",
";",
"}",
"}",
"}"
]
| Swap two nodes. In IE, we use the native method, for others we
emulate the IE behavior
@method swapNode
@param n1 the first node to swap
@param n2 the other node to swap
@static | [
"Swap",
"two",
"nodes",
".",
"In",
"IE",
"we",
"use",
"the",
"native",
"method",
"for",
"others",
"we",
"emulate",
"the",
"IE",
"behavior"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/dragdrop/dragdrop-debug.js#L1408-L1424 |
|
43,106 | neyric/webhookit | public/javascripts/yui/dragdrop/dragdrop-debug.js | function () {
var t, l, dde=document.documentElement, db=document.body;
if (dde && (dde.scrollTop || dde.scrollLeft)) {
t = dde.scrollTop;
l = dde.scrollLeft;
} else if (db) {
t = db.scrollTop;
l = db.scrollLeft;
} else {
YAHOO.log("could not get scroll property", "info", "DragDropMgr");
}
return { top: t, left: l };
} | javascript | function () {
var t, l, dde=document.documentElement, db=document.body;
if (dde && (dde.scrollTop || dde.scrollLeft)) {
t = dde.scrollTop;
l = dde.scrollLeft;
} else if (db) {
t = db.scrollTop;
l = db.scrollLeft;
} else {
YAHOO.log("could not get scroll property", "info", "DragDropMgr");
}
return { top: t, left: l };
} | [
"function",
"(",
")",
"{",
"var",
"t",
",",
"l",
",",
"dde",
"=",
"document",
".",
"documentElement",
",",
"db",
"=",
"document",
".",
"body",
";",
"if",
"(",
"dde",
"&&",
"(",
"dde",
".",
"scrollTop",
"||",
"dde",
".",
"scrollLeft",
")",
")",
"{",
"t",
"=",
"dde",
".",
"scrollTop",
";",
"l",
"=",
"dde",
".",
"scrollLeft",
";",
"}",
"else",
"if",
"(",
"db",
")",
"{",
"t",
"=",
"db",
".",
"scrollTop",
";",
"l",
"=",
"db",
".",
"scrollLeft",
";",
"}",
"else",
"{",
"YAHOO",
".",
"log",
"(",
"\"could not get scroll property\"",
",",
"\"info\"",
",",
"\"DragDropMgr\"",
")",
";",
"}",
"return",
"{",
"top",
":",
"t",
",",
"left",
":",
"l",
"}",
";",
"}"
]
| Returns the current scroll position
@method getScroll
@private
@static | [
"Returns",
"the",
"current",
"scroll",
"position"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/dragdrop/dragdrop-debug.js#L1432-L1444 |
|
43,107 | neyric/webhookit | public/javascripts/yui/dragdrop/dragdrop-debug.js | function() {
var DDM = YAHOO.util.DDM;
if ( YAHOO.util.Event && document ) {
DDM._onLoad();
} else {
if (DDM._timeoutCount > 2000) {
YAHOO.log("DragDrop requires the Event Utility", "error", "DragDropMgr");
} else {
setTimeout(DDM._addListeners, 10);
if (document && document.body) {
DDM._timeoutCount += 1;
}
}
}
} | javascript | function() {
var DDM = YAHOO.util.DDM;
if ( YAHOO.util.Event && document ) {
DDM._onLoad();
} else {
if (DDM._timeoutCount > 2000) {
YAHOO.log("DragDrop requires the Event Utility", "error", "DragDropMgr");
} else {
setTimeout(DDM._addListeners, 10);
if (document && document.body) {
DDM._timeoutCount += 1;
}
}
}
} | [
"function",
"(",
")",
"{",
"var",
"DDM",
"=",
"YAHOO",
".",
"util",
".",
"DDM",
";",
"if",
"(",
"YAHOO",
".",
"util",
".",
"Event",
"&&",
"document",
")",
"{",
"DDM",
".",
"_onLoad",
"(",
")",
";",
"}",
"else",
"{",
"if",
"(",
"DDM",
".",
"_timeoutCount",
">",
"2000",
")",
"{",
"YAHOO",
".",
"log",
"(",
"\"DragDrop requires the Event Utility\"",
",",
"\"error\"",
",",
"\"DragDropMgr\"",
")",
";",
"}",
"else",
"{",
"setTimeout",
"(",
"DDM",
".",
"_addListeners",
",",
"10",
")",
";",
"if",
"(",
"document",
"&&",
"document",
".",
"body",
")",
"{",
"DDM",
".",
"_timeoutCount",
"+=",
"1",
";",
"}",
"}",
"}",
"}"
]
| Trying to make the load order less important. Without this we get
an error if this file is loaded before the Event Utility.
@method _addListeners
@private
@static | [
"Trying",
"to",
"make",
"the",
"load",
"order",
"less",
"important",
".",
"Without",
"this",
"we",
"get",
"an",
"error",
"if",
"this",
"file",
"is",
"loaded",
"before",
"the",
"Event",
"Utility",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/dragdrop/dragdrop-debug.js#L1533-L1547 |
|
43,108 | neyric/webhookit | public/javascripts/yui/dragdrop/dragdrop-debug.js | function(node, id) {
if (this.isHandle(id, node.id)) {
YAHOO.log("clicked node is a handle", "info", "DragDropMgr");
return true;
} else {
// check to see if this is a text node child of the one we want
var p = node.parentNode;
// YAHOO.log("p: " + p);
while (p) {
if (this.isHandle(id, p.id)) {
return true;
} else {
YAHOO.log(p.id + " is not a handle", "info", "DragDropMgr");
p = p.parentNode;
}
}
}
return false;
} | javascript | function(node, id) {
if (this.isHandle(id, node.id)) {
YAHOO.log("clicked node is a handle", "info", "DragDropMgr");
return true;
} else {
// check to see if this is a text node child of the one we want
var p = node.parentNode;
// YAHOO.log("p: " + p);
while (p) {
if (this.isHandle(id, p.id)) {
return true;
} else {
YAHOO.log(p.id + " is not a handle", "info", "DragDropMgr");
p = p.parentNode;
}
}
}
return false;
} | [
"function",
"(",
"node",
",",
"id",
")",
"{",
"if",
"(",
"this",
".",
"isHandle",
"(",
"id",
",",
"node",
".",
"id",
")",
")",
"{",
"YAHOO",
".",
"log",
"(",
"\"clicked node is a handle\"",
",",
"\"info\"",
",",
"\"DragDropMgr\"",
")",
";",
"return",
"true",
";",
"}",
"else",
"{",
"// check to see if this is a text node child of the one we want",
"var",
"p",
"=",
"node",
".",
"parentNode",
";",
"// YAHOO.log(\"p: \" + p);",
"while",
"(",
"p",
")",
"{",
"if",
"(",
"this",
".",
"isHandle",
"(",
"id",
",",
"p",
".",
"id",
")",
")",
"{",
"return",
"true",
";",
"}",
"else",
"{",
"YAHOO",
".",
"log",
"(",
"p",
".",
"id",
"+",
"\" is not a handle\"",
",",
"\"info\"",
",",
"\"DragDropMgr\"",
")",
";",
"p",
"=",
"p",
".",
"parentNode",
";",
"}",
"}",
"}",
"return",
"false",
";",
"}"
]
| Recursively searches the immediate parent and all child nodes for
the handle element in order to determine wheter or not it was
clicked.
@method handleWasClicked
@param node the html element to inspect
@static | [
"Recursively",
"searches",
"the",
"immediate",
"parent",
"and",
"all",
"child",
"nodes",
"for",
"the",
"handle",
"element",
"in",
"order",
"to",
"determine",
"wheter",
"or",
"not",
"it",
"was",
"clicked",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/dragdrop/dragdrop-debug.js#L1557-L1577 |
|
43,109 | neyric/webhookit | public/javascripts/yui/dragdrop/dragdrop-debug.js | function(id, sGroup, config) {
this.initTarget(id, sGroup, config);
Event.on(this._domRef || this.id, "mousedown",
this.handleMouseDown, this, true);
// Event.on(this.id, "selectstart", Event.preventDefault);
for (var i in this.events) {
this.createEvent(i + 'Event');
}
} | javascript | function(id, sGroup, config) {
this.initTarget(id, sGroup, config);
Event.on(this._domRef || this.id, "mousedown",
this.handleMouseDown, this, true);
// Event.on(this.id, "selectstart", Event.preventDefault);
for (var i in this.events) {
this.createEvent(i + 'Event');
}
} | [
"function",
"(",
"id",
",",
"sGroup",
",",
"config",
")",
"{",
"this",
".",
"initTarget",
"(",
"id",
",",
"sGroup",
",",
"config",
")",
";",
"Event",
".",
"on",
"(",
"this",
".",
"_domRef",
"||",
"this",
".",
"id",
",",
"\"mousedown\"",
",",
"this",
".",
"handleMouseDown",
",",
"this",
",",
"true",
")",
";",
"// Event.on(this.id, \"selectstart\", Event.preventDefault);",
"for",
"(",
"var",
"i",
"in",
"this",
".",
"events",
")",
"{",
"this",
".",
"createEvent",
"(",
"i",
"+",
"'Event'",
")",
";",
"}",
"}"
]
| Sets up the DragDrop object. Must be called in the constructor of any
YAHOO.util.DragDrop subclass
@method init
@param id the id of the linked element
@param {String} sGroup the group of related items
@param {object} config configuration attributes | [
"Sets",
"up",
"the",
"DragDrop",
"object",
".",
"Must",
"be",
"called",
"in",
"the",
"constructor",
"of",
"any",
"YAHOO",
".",
"util",
".",
"DragDrop",
"subclass"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/dragdrop/dragdrop-debug.js#L2139-L2149 |
|
43,110 | neyric/webhookit | public/javascripts/yui/dragdrop/dragdrop-debug.js | function(id, sGroup, config) {
// configuration attributes
this.config = config || {};
this.events = {};
// create a local reference to the drag and drop manager
this.DDM = YAHOO.util.DDM;
// initialize the groups object
this.groups = {};
// assume that we have an element reference instead of an id if the
// parameter is not a string
if (typeof id !== "string") {
YAHOO.log("id is not a string, assuming it is an HTMLElement");
this._domRef = id;
id = Dom.generateId(id);
}
// set the id
this.id = id;
// add to an interaction group
this.addToGroup((sGroup) ? sGroup : "default");
// We don't want to register this as the handle with the manager
// so we just set the id rather than calling the setter.
this.handleElId = id;
Event.onAvailable(id, this.handleOnAvailable, this, true);
// create a logger instance
this.logger = (YAHOO.widget.LogWriter) ?
new YAHOO.widget.LogWriter(this.toString()) : YAHOO;
// the linked element is the element that gets dragged by default
this.setDragElId(id);
// by default, clicked anchors will not start drag operations.
// @TODO what else should be here? Probably form fields.
this.invalidHandleTypes = { A: "A" };
this.invalidHandleIds = {};
this.invalidHandleClasses = [];
this.applyConfig();
} | javascript | function(id, sGroup, config) {
// configuration attributes
this.config = config || {};
this.events = {};
// create a local reference to the drag and drop manager
this.DDM = YAHOO.util.DDM;
// initialize the groups object
this.groups = {};
// assume that we have an element reference instead of an id if the
// parameter is not a string
if (typeof id !== "string") {
YAHOO.log("id is not a string, assuming it is an HTMLElement");
this._domRef = id;
id = Dom.generateId(id);
}
// set the id
this.id = id;
// add to an interaction group
this.addToGroup((sGroup) ? sGroup : "default");
// We don't want to register this as the handle with the manager
// so we just set the id rather than calling the setter.
this.handleElId = id;
Event.onAvailable(id, this.handleOnAvailable, this, true);
// create a logger instance
this.logger = (YAHOO.widget.LogWriter) ?
new YAHOO.widget.LogWriter(this.toString()) : YAHOO;
// the linked element is the element that gets dragged by default
this.setDragElId(id);
// by default, clicked anchors will not start drag operations.
// @TODO what else should be here? Probably form fields.
this.invalidHandleTypes = { A: "A" };
this.invalidHandleIds = {};
this.invalidHandleClasses = [];
this.applyConfig();
} | [
"function",
"(",
"id",
",",
"sGroup",
",",
"config",
")",
"{",
"// configuration attributes ",
"this",
".",
"config",
"=",
"config",
"||",
"{",
"}",
";",
"this",
".",
"events",
"=",
"{",
"}",
";",
"// create a local reference to the drag and drop manager",
"this",
".",
"DDM",
"=",
"YAHOO",
".",
"util",
".",
"DDM",
";",
"// initialize the groups object",
"this",
".",
"groups",
"=",
"{",
"}",
";",
"// assume that we have an element reference instead of an id if the",
"// parameter is not a string",
"if",
"(",
"typeof",
"id",
"!==",
"\"string\"",
")",
"{",
"YAHOO",
".",
"log",
"(",
"\"id is not a string, assuming it is an HTMLElement\"",
")",
";",
"this",
".",
"_domRef",
"=",
"id",
";",
"id",
"=",
"Dom",
".",
"generateId",
"(",
"id",
")",
";",
"}",
"// set the id",
"this",
".",
"id",
"=",
"id",
";",
"// add to an interaction group",
"this",
".",
"addToGroup",
"(",
"(",
"sGroup",
")",
"?",
"sGroup",
":",
"\"default\"",
")",
";",
"// We don't want to register this as the handle with the manager",
"// so we just set the id rather than calling the setter.",
"this",
".",
"handleElId",
"=",
"id",
";",
"Event",
".",
"onAvailable",
"(",
"id",
",",
"this",
".",
"handleOnAvailable",
",",
"this",
",",
"true",
")",
";",
"// create a logger instance",
"this",
".",
"logger",
"=",
"(",
"YAHOO",
".",
"widget",
".",
"LogWriter",
")",
"?",
"new",
"YAHOO",
".",
"widget",
".",
"LogWriter",
"(",
"this",
".",
"toString",
"(",
")",
")",
":",
"YAHOO",
";",
"// the linked element is the element that gets dragged by default",
"this",
".",
"setDragElId",
"(",
"id",
")",
";",
"// by default, clicked anchors will not start drag operations. ",
"// @TODO what else should be here? Probably form fields.",
"this",
".",
"invalidHandleTypes",
"=",
"{",
"A",
":",
"\"A\"",
"}",
";",
"this",
".",
"invalidHandleIds",
"=",
"{",
"}",
";",
"this",
".",
"invalidHandleClasses",
"=",
"[",
"]",
";",
"this",
".",
"applyConfig",
"(",
")",
";",
"}"
]
| Initializes Targeting functionality only... the object does not
get a mousedown handler.
@method initTarget
@param id the id of the linked element
@param {String} sGroup the group of related items
@param {object} config configuration attributes | [
"Initializes",
"Targeting",
"functionality",
"only",
"...",
"the",
"object",
"does",
"not",
"get",
"a",
"mousedown",
"handler",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/dragdrop/dragdrop-debug.js#L2159-L2206 |
|
43,111 | neyric/webhookit | public/javascripts/yui/dragdrop/dragdrop-debug.js | function(diffX, diffY) {
var el = this.getEl();
if (!this.DDM.verifyEl(el)) {
if (el && el.style && (el.style.display == 'none')) {
this.logger.log(this.id + " can not get initial position, element style is display: none");
} else {
this.logger.log(this.id + " element is broken");
}
return;
}
var dx = diffX || 0;
var dy = diffY || 0;
var p = Dom.getXY( el );
this.initPageX = p[0] - dx;
this.initPageY = p[1] - dy;
this.lastPageX = p[0];
this.lastPageY = p[1];
this.logger.log(this.id + " initial position: " + this.initPageX +
", " + this.initPageY);
this.setStartPosition(p);
} | javascript | function(diffX, diffY) {
var el = this.getEl();
if (!this.DDM.verifyEl(el)) {
if (el && el.style && (el.style.display == 'none')) {
this.logger.log(this.id + " can not get initial position, element style is display: none");
} else {
this.logger.log(this.id + " element is broken");
}
return;
}
var dx = diffX || 0;
var dy = diffY || 0;
var p = Dom.getXY( el );
this.initPageX = p[0] - dx;
this.initPageY = p[1] - dy;
this.lastPageX = p[0];
this.lastPageY = p[1];
this.logger.log(this.id + " initial position: " + this.initPageX +
", " + this.initPageY);
this.setStartPosition(p);
} | [
"function",
"(",
"diffX",
",",
"diffY",
")",
"{",
"var",
"el",
"=",
"this",
".",
"getEl",
"(",
")",
";",
"if",
"(",
"!",
"this",
".",
"DDM",
".",
"verifyEl",
"(",
"el",
")",
")",
"{",
"if",
"(",
"el",
"&&",
"el",
".",
"style",
"&&",
"(",
"el",
".",
"style",
".",
"display",
"==",
"'none'",
")",
")",
"{",
"this",
".",
"logger",
".",
"log",
"(",
"this",
".",
"id",
"+",
"\" can not get initial position, element style is display: none\"",
")",
";",
"}",
"else",
"{",
"this",
".",
"logger",
".",
"log",
"(",
"this",
".",
"id",
"+",
"\" element is broken\"",
")",
";",
"}",
"return",
";",
"}",
"var",
"dx",
"=",
"diffX",
"||",
"0",
";",
"var",
"dy",
"=",
"diffY",
"||",
"0",
";",
"var",
"p",
"=",
"Dom",
".",
"getXY",
"(",
"el",
")",
";",
"this",
".",
"initPageX",
"=",
"p",
"[",
"0",
"]",
"-",
"dx",
";",
"this",
".",
"initPageY",
"=",
"p",
"[",
"1",
"]",
"-",
"dy",
";",
"this",
".",
"lastPageX",
"=",
"p",
"[",
"0",
"]",
";",
"this",
".",
"lastPageY",
"=",
"p",
"[",
"1",
"]",
";",
"this",
".",
"logger",
".",
"log",
"(",
"this",
".",
"id",
"+",
"\" initial position: \"",
"+",
"this",
".",
"initPageX",
"+",
"\", \"",
"+",
"this",
".",
"initPageY",
")",
";",
"this",
".",
"setStartPosition",
"(",
"p",
")",
";",
"}"
]
| Stores the initial placement of the linked element.
@method setInitialPosition
@param {int} diffX the X offset, default 0
@param {int} diffY the Y offset, default 0
@private | [
"Stores",
"the",
"initial",
"placement",
"of",
"the",
"linked",
"element",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/dragdrop/dragdrop-debug.js#L2298-L2326 |
|
43,112 | neyric/webhookit | public/javascripts/yui/dragdrop/dragdrop-debug.js | function(pos) {
var p = pos || Dom.getXY(this.getEl());
this.deltaSetXY = null;
this.startPageX = p[0];
this.startPageY = p[1];
} | javascript | function(pos) {
var p = pos || Dom.getXY(this.getEl());
this.deltaSetXY = null;
this.startPageX = p[0];
this.startPageY = p[1];
} | [
"function",
"(",
"pos",
")",
"{",
"var",
"p",
"=",
"pos",
"||",
"Dom",
".",
"getXY",
"(",
"this",
".",
"getEl",
"(",
")",
")",
";",
"this",
".",
"deltaSetXY",
"=",
"null",
";",
"this",
".",
"startPageX",
"=",
"p",
"[",
"0",
"]",
";",
"this",
".",
"startPageY",
"=",
"p",
"[",
"1",
"]",
";",
"}"
]
| Sets the start position of the element. This is set when the obj
is initialized, the reset when a drag is started.
@method setStartPosition
@param pos current position (from previous lookup)
@private | [
"Sets",
"the",
"start",
"position",
"of",
"the",
"element",
".",
"This",
"is",
"set",
"when",
"the",
"obj",
"is",
"initialized",
"the",
"reset",
"when",
"a",
"drag",
"is",
"started",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/dragdrop/dragdrop-debug.js#L2335-L2342 |
|
43,113 | neyric/webhookit | public/javascripts/yui/dragdrop/dragdrop-debug.js | function(sGroup) {
this.logger.log("Removing from group: " + sGroup);
if (this.groups[sGroup]) {
delete this.groups[sGroup];
}
this.DDM.removeDDFromGroup(this, sGroup);
} | javascript | function(sGroup) {
this.logger.log("Removing from group: " + sGroup);
if (this.groups[sGroup]) {
delete this.groups[sGroup];
}
this.DDM.removeDDFromGroup(this, sGroup);
} | [
"function",
"(",
"sGroup",
")",
"{",
"this",
".",
"logger",
".",
"log",
"(",
"\"Removing from group: \"",
"+",
"sGroup",
")",
";",
"if",
"(",
"this",
".",
"groups",
"[",
"sGroup",
"]",
")",
"{",
"delete",
"this",
".",
"groups",
"[",
"sGroup",
"]",
";",
"}",
"this",
".",
"DDM",
".",
"removeDDFromGroup",
"(",
"this",
",",
"sGroup",
")",
";",
"}"
]
| Remove's this instance from the supplied interaction group
@method removeFromGroup
@param {string} sGroup The group to drop | [
"Remove",
"s",
"this",
"instance",
"from",
"the",
"supplied",
"interaction",
"group"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/dragdrop/dragdrop-debug.js#L2361-L2368 |
|
43,114 | neyric/webhookit | public/javascripts/yui/dragdrop/dragdrop-debug.js | function(id) {
if (typeof id !== "string") {
YAHOO.log("id is not a string, assuming it is an HTMLElement");
id = Dom.generateId(id);
}
this.handleElId = id;
this.DDM.regHandle(this.id, id);
} | javascript | function(id) {
if (typeof id !== "string") {
YAHOO.log("id is not a string, assuming it is an HTMLElement");
id = Dom.generateId(id);
}
this.handleElId = id;
this.DDM.regHandle(this.id, id);
} | [
"function",
"(",
"id",
")",
"{",
"if",
"(",
"typeof",
"id",
"!==",
"\"string\"",
")",
"{",
"YAHOO",
".",
"log",
"(",
"\"id is not a string, assuming it is an HTMLElement\"",
")",
";",
"id",
"=",
"Dom",
".",
"generateId",
"(",
"id",
")",
";",
"}",
"this",
".",
"handleElId",
"=",
"id",
";",
"this",
".",
"DDM",
".",
"regHandle",
"(",
"this",
".",
"id",
",",
"id",
")",
";",
"}"
]
| Allows you to specify a child of the linked element that should be
used to initiate the drag operation. An example of this would be if
you have a content div with text and links. Clicking anywhere in the
content area would normally start the drag operation. Use this method
to specify that an element inside of the content div is the element
that starts the drag operation.
@method setHandleElId
@param id {string} the id of the element that will be used to
initiate the drag. | [
"Allows",
"you",
"to",
"specify",
"a",
"child",
"of",
"the",
"linked",
"element",
"that",
"should",
"be",
"used",
"to",
"initiate",
"the",
"drag",
"operation",
".",
"An",
"example",
"of",
"this",
"would",
"be",
"if",
"you",
"have",
"a",
"content",
"div",
"with",
"text",
"and",
"links",
".",
"Clicking",
"anywhere",
"in",
"the",
"content",
"area",
"would",
"normally",
"start",
"the",
"drag",
"operation",
".",
"Use",
"this",
"method",
"to",
"specify",
"that",
"an",
"element",
"inside",
"of",
"the",
"content",
"div",
"is",
"the",
"element",
"that",
"starts",
"the",
"drag",
"operation",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/dragdrop/dragdrop-debug.js#L2391-L2398 |
|
43,115 | neyric/webhookit | public/javascripts/yui/dragdrop/dragdrop-debug.js | function(id) {
if (typeof id !== "string") {
YAHOO.log("id is not a string, assuming it is an HTMLElement");
id = Dom.generateId(id);
}
this.logger.log("Adding outer handle event: " + id);
Event.on(id, "mousedown",
this.handleMouseDown, this, true);
this.setHandleElId(id);
this.hasOuterHandles = true;
} | javascript | function(id) {
if (typeof id !== "string") {
YAHOO.log("id is not a string, assuming it is an HTMLElement");
id = Dom.generateId(id);
}
this.logger.log("Adding outer handle event: " + id);
Event.on(id, "mousedown",
this.handleMouseDown, this, true);
this.setHandleElId(id);
this.hasOuterHandles = true;
} | [
"function",
"(",
"id",
")",
"{",
"if",
"(",
"typeof",
"id",
"!==",
"\"string\"",
")",
"{",
"YAHOO",
".",
"log",
"(",
"\"id is not a string, assuming it is an HTMLElement\"",
")",
";",
"id",
"=",
"Dom",
".",
"generateId",
"(",
"id",
")",
";",
"}",
"this",
".",
"logger",
".",
"log",
"(",
"\"Adding outer handle event: \"",
"+",
"id",
")",
";",
"Event",
".",
"on",
"(",
"id",
",",
"\"mousedown\"",
",",
"this",
".",
"handleMouseDown",
",",
"this",
",",
"true",
")",
";",
"this",
".",
"setHandleElId",
"(",
"id",
")",
";",
"this",
".",
"hasOuterHandles",
"=",
"true",
";",
"}"
]
| Allows you to set an element outside of the linked element as a drag
handle
@method setOuterHandleElId
@param id the id of the element that will be used to initiate the drag | [
"Allows",
"you",
"to",
"set",
"an",
"element",
"outside",
"of",
"the",
"linked",
"element",
"as",
"a",
"drag",
"handle"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/dragdrop/dragdrop-debug.js#L2406-L2417 |
|
43,116 | neyric/webhookit | public/javascripts/yui/dragdrop/dragdrop-debug.js | function() {
this.logger.log("DragDrop obj cleanup " + this.id);
Event.removeListener(this.id, "mousedown",
this.handleMouseDown);
this._domRef = null;
this.DDM._remove(this);
} | javascript | function() {
this.logger.log("DragDrop obj cleanup " + this.id);
Event.removeListener(this.id, "mousedown",
this.handleMouseDown);
this._domRef = null;
this.DDM._remove(this);
} | [
"function",
"(",
")",
"{",
"this",
".",
"logger",
".",
"log",
"(",
"\"DragDrop obj cleanup \"",
"+",
"this",
".",
"id",
")",
";",
"Event",
".",
"removeListener",
"(",
"this",
".",
"id",
",",
"\"mousedown\"",
",",
"this",
".",
"handleMouseDown",
")",
";",
"this",
".",
"_domRef",
"=",
"null",
";",
"this",
".",
"DDM",
".",
"_remove",
"(",
"this",
")",
";",
"}"
]
| Remove all drag and drop hooks for this element
@method unreg | [
"Remove",
"all",
"drag",
"and",
"drop",
"hooks",
"for",
"this",
"element"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/dragdrop/dragdrop-debug.js#L2423-L2429 |
|
43,117 | neyric/webhookit | public/javascripts/yui/dragdrop/dragdrop-debug.js | function(e, oDD) {
var button = e.which || e.button;
this.logger.log("button: " + button);
if (this.primaryButtonOnly && button > 1) {
this.logger.log("Mousedown was not produced by the primary button");
return;
}
if (this.isLocked()) {
this.logger.log("Drag and drop is disabled, aborting");
return;
}
this.logger.log("mousedown " + this.id);
this.logger.log("firing onMouseDown events");
// firing the mousedown events prior to calculating positions
var b4Return = this.b4MouseDown(e),
b4Return2 = true;
if (this.events.b4MouseDown) {
b4Return2 = this.fireEvent('b4MouseDownEvent', e);
}
var mDownReturn = this.onMouseDown(e),
mDownReturn2 = true;
if (this.events.mouseDown) {
mDownReturn2 = this.fireEvent('mouseDownEvent', e);
}
if ((b4Return === false) || (mDownReturn === false) || (b4Return2 === false) || (mDownReturn2 === false)) {
this.logger.log('b4MouseDown or onMouseDown returned false, exiting drag');
return;
}
this.DDM.refreshCache(this.groups);
// var self = this;
// setTimeout( function() { self.DDM.refreshCache(self.groups); }, 0);
// Only process the event if we really clicked within the linked
// element. The reason we make this check is that in the case that
// another element was moved between the clicked element and the
// cursor in the time between the mousedown and mouseup events. When
// this happens, the element gets the next mousedown event
// regardless of where on the screen it happened.
var pt = new YAHOO.util.Point(Event.getPageX(e), Event.getPageY(e));
if (!this.hasOuterHandles && !this.DDM.isOverTarget(pt, this) ) {
this.logger.log("Click was not over the element: " + this.id);
} else {
if (this.clickValidator(e)) {
this.logger.log("click was a valid handle");
// set the initial element position
this.setStartPosition();
// start tracking mousemove distance and mousedown time to
// determine when to start the actual drag
this.DDM.handleMouseDown(e, this);
// this mousedown is mine
this.DDM.stopEvent(e);
} else {
this.logger.log("clickValidator returned false, drag not initiated");
}
}
} | javascript | function(e, oDD) {
var button = e.which || e.button;
this.logger.log("button: " + button);
if (this.primaryButtonOnly && button > 1) {
this.logger.log("Mousedown was not produced by the primary button");
return;
}
if (this.isLocked()) {
this.logger.log("Drag and drop is disabled, aborting");
return;
}
this.logger.log("mousedown " + this.id);
this.logger.log("firing onMouseDown events");
// firing the mousedown events prior to calculating positions
var b4Return = this.b4MouseDown(e),
b4Return2 = true;
if (this.events.b4MouseDown) {
b4Return2 = this.fireEvent('b4MouseDownEvent', e);
}
var mDownReturn = this.onMouseDown(e),
mDownReturn2 = true;
if (this.events.mouseDown) {
mDownReturn2 = this.fireEvent('mouseDownEvent', e);
}
if ((b4Return === false) || (mDownReturn === false) || (b4Return2 === false) || (mDownReturn2 === false)) {
this.logger.log('b4MouseDown or onMouseDown returned false, exiting drag');
return;
}
this.DDM.refreshCache(this.groups);
// var self = this;
// setTimeout( function() { self.DDM.refreshCache(self.groups); }, 0);
// Only process the event if we really clicked within the linked
// element. The reason we make this check is that in the case that
// another element was moved between the clicked element and the
// cursor in the time between the mousedown and mouseup events. When
// this happens, the element gets the next mousedown event
// regardless of where on the screen it happened.
var pt = new YAHOO.util.Point(Event.getPageX(e), Event.getPageY(e));
if (!this.hasOuterHandles && !this.DDM.isOverTarget(pt, this) ) {
this.logger.log("Click was not over the element: " + this.id);
} else {
if (this.clickValidator(e)) {
this.logger.log("click was a valid handle");
// set the initial element position
this.setStartPosition();
// start tracking mousemove distance and mousedown time to
// determine when to start the actual drag
this.DDM.handleMouseDown(e, this);
// this mousedown is mine
this.DDM.stopEvent(e);
} else {
this.logger.log("clickValidator returned false, drag not initiated");
}
}
} | [
"function",
"(",
"e",
",",
"oDD",
")",
"{",
"var",
"button",
"=",
"e",
".",
"which",
"||",
"e",
".",
"button",
";",
"this",
".",
"logger",
".",
"log",
"(",
"\"button: \"",
"+",
"button",
")",
";",
"if",
"(",
"this",
".",
"primaryButtonOnly",
"&&",
"button",
">",
"1",
")",
"{",
"this",
".",
"logger",
".",
"log",
"(",
"\"Mousedown was not produced by the primary button\"",
")",
";",
"return",
";",
"}",
"if",
"(",
"this",
".",
"isLocked",
"(",
")",
")",
"{",
"this",
".",
"logger",
".",
"log",
"(",
"\"Drag and drop is disabled, aborting\"",
")",
";",
"return",
";",
"}",
"this",
".",
"logger",
".",
"log",
"(",
"\"mousedown \"",
"+",
"this",
".",
"id",
")",
";",
"this",
".",
"logger",
".",
"log",
"(",
"\"firing onMouseDown events\"",
")",
";",
"// firing the mousedown events prior to calculating positions",
"var",
"b4Return",
"=",
"this",
".",
"b4MouseDown",
"(",
"e",
")",
",",
"b4Return2",
"=",
"true",
";",
"if",
"(",
"this",
".",
"events",
".",
"b4MouseDown",
")",
"{",
"b4Return2",
"=",
"this",
".",
"fireEvent",
"(",
"'b4MouseDownEvent'",
",",
"e",
")",
";",
"}",
"var",
"mDownReturn",
"=",
"this",
".",
"onMouseDown",
"(",
"e",
")",
",",
"mDownReturn2",
"=",
"true",
";",
"if",
"(",
"this",
".",
"events",
".",
"mouseDown",
")",
"{",
"mDownReturn2",
"=",
"this",
".",
"fireEvent",
"(",
"'mouseDownEvent'",
",",
"e",
")",
";",
"}",
"if",
"(",
"(",
"b4Return",
"===",
"false",
")",
"||",
"(",
"mDownReturn",
"===",
"false",
")",
"||",
"(",
"b4Return2",
"===",
"false",
")",
"||",
"(",
"mDownReturn2",
"===",
"false",
")",
")",
"{",
"this",
".",
"logger",
".",
"log",
"(",
"'b4MouseDown or onMouseDown returned false, exiting drag'",
")",
";",
"return",
";",
"}",
"this",
".",
"DDM",
".",
"refreshCache",
"(",
"this",
".",
"groups",
")",
";",
"// var self = this;",
"// setTimeout( function() { self.DDM.refreshCache(self.groups); }, 0);",
"// Only process the event if we really clicked within the linked ",
"// element. The reason we make this check is that in the case that ",
"// another element was moved between the clicked element and the ",
"// cursor in the time between the mousedown and mouseup events. When ",
"// this happens, the element gets the next mousedown event ",
"// regardless of where on the screen it happened. ",
"var",
"pt",
"=",
"new",
"YAHOO",
".",
"util",
".",
"Point",
"(",
"Event",
".",
"getPageX",
"(",
"e",
")",
",",
"Event",
".",
"getPageY",
"(",
"e",
")",
")",
";",
"if",
"(",
"!",
"this",
".",
"hasOuterHandles",
"&&",
"!",
"this",
".",
"DDM",
".",
"isOverTarget",
"(",
"pt",
",",
"this",
")",
")",
"{",
"this",
".",
"logger",
".",
"log",
"(",
"\"Click was not over the element: \"",
"+",
"this",
".",
"id",
")",
";",
"}",
"else",
"{",
"if",
"(",
"this",
".",
"clickValidator",
"(",
"e",
")",
")",
"{",
"this",
".",
"logger",
".",
"log",
"(",
"\"click was a valid handle\"",
")",
";",
"// set the initial element position",
"this",
".",
"setStartPosition",
"(",
")",
";",
"// start tracking mousemove distance and mousedown time to",
"// determine when to start the actual drag",
"this",
".",
"DDM",
".",
"handleMouseDown",
"(",
"e",
",",
"this",
")",
";",
"// this mousedown is mine",
"this",
".",
"DDM",
".",
"stopEvent",
"(",
"e",
")",
";",
"}",
"else",
"{",
"this",
".",
"logger",
".",
"log",
"(",
"\"clickValidator returned false, drag not initiated\"",
")",
";",
"}",
"}",
"}"
]
| Fired when this object is clicked
@method handleMouseDown
@param {Event} e
@param {YAHOO.util.DragDrop} oDD the clicked dd object (this dd obj)
@private | [
"Fired",
"when",
"this",
"object",
"is",
"clicked"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/dragdrop/dragdrop-debug.js#L2449-L2519 |
|
43,118 | neyric/webhookit | public/javascripts/yui/dragdrop/dragdrop-debug.js | function(id) {
if (typeof id !== "string") {
YAHOO.log("id is not a string, assuming it is an HTMLElement");
id = Dom.generateId(id);
}
this.invalidHandleIds[id] = id;
} | javascript | function(id) {
if (typeof id !== "string") {
YAHOO.log("id is not a string, assuming it is an HTMLElement");
id = Dom.generateId(id);
}
this.invalidHandleIds[id] = id;
} | [
"function",
"(",
"id",
")",
"{",
"if",
"(",
"typeof",
"id",
"!==",
"\"string\"",
")",
"{",
"YAHOO",
".",
"log",
"(",
"\"id is not a string, assuming it is an HTMLElement\"",
")",
";",
"id",
"=",
"Dom",
".",
"generateId",
"(",
"id",
")",
";",
"}",
"this",
".",
"invalidHandleIds",
"[",
"id",
"]",
"=",
"id",
";",
"}"
]
| Lets you to specify an element id for a child of a drag handle
that should not initiate a drag
@method addInvalidHandleId
@param {string} id the element id of the element you wish to ignore | [
"Lets",
"you",
"to",
"specify",
"an",
"element",
"id",
"for",
"a",
"child",
"of",
"a",
"drag",
"handle",
"that",
"should",
"not",
"initiate",
"a",
"drag"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/dragdrop/dragdrop-debug.js#L2589-L2595 |
|
43,119 | neyric/webhookit | public/javascripts/yui/dragdrop/dragdrop-debug.js | function(cssClass) {
for (var i=0, len=this.invalidHandleClasses.length; i<len; ++i) {
if (this.invalidHandleClasses[i] == cssClass) {
delete this.invalidHandleClasses[i];
}
}
} | javascript | function(cssClass) {
for (var i=0, len=this.invalidHandleClasses.length; i<len; ++i) {
if (this.invalidHandleClasses[i] == cssClass) {
delete this.invalidHandleClasses[i];
}
}
} | [
"function",
"(",
"cssClass",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"len",
"=",
"this",
".",
"invalidHandleClasses",
".",
"length",
";",
"i",
"<",
"len",
";",
"++",
"i",
")",
"{",
"if",
"(",
"this",
".",
"invalidHandleClasses",
"[",
"i",
"]",
"==",
"cssClass",
")",
"{",
"delete",
"this",
".",
"invalidHandleClasses",
"[",
"i",
"]",
";",
"}",
"}",
"}"
]
| Unsets an invalid css class
@method removeInvalidHandleClass
@param {string} cssClass the class of the element(s) you wish to
re-enable | [
"Unsets",
"an",
"invalid",
"css",
"class"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/dragdrop/dragdrop-debug.js#L2637-L2643 |
|
43,120 | neyric/webhookit | public/javascripts/yui/dragdrop/dragdrop-debug.js | function(node) {
var valid = true;
// var n = (node.nodeName == "#text") ? node.parentNode : node;
var nodeName;
try {
nodeName = node.nodeName.toUpperCase();
} catch(e) {
nodeName = node.nodeName;
}
valid = valid && !this.invalidHandleTypes[nodeName];
valid = valid && !this.invalidHandleIds[node.id];
for (var i=0, len=this.invalidHandleClasses.length; valid && i<len; ++i) {
valid = !Dom.hasClass(node, this.invalidHandleClasses[i]);
}
this.logger.log("Valid handle? ... " + valid);
return valid;
} | javascript | function(node) {
var valid = true;
// var n = (node.nodeName == "#text") ? node.parentNode : node;
var nodeName;
try {
nodeName = node.nodeName.toUpperCase();
} catch(e) {
nodeName = node.nodeName;
}
valid = valid && !this.invalidHandleTypes[nodeName];
valid = valid && !this.invalidHandleIds[node.id];
for (var i=0, len=this.invalidHandleClasses.length; valid && i<len; ++i) {
valid = !Dom.hasClass(node, this.invalidHandleClasses[i]);
}
this.logger.log("Valid handle? ... " + valid);
return valid;
} | [
"function",
"(",
"node",
")",
"{",
"var",
"valid",
"=",
"true",
";",
"// var n = (node.nodeName == \"#text\") ? node.parentNode : node;",
"var",
"nodeName",
";",
"try",
"{",
"nodeName",
"=",
"node",
".",
"nodeName",
".",
"toUpperCase",
"(",
")",
";",
"}",
"catch",
"(",
"e",
")",
"{",
"nodeName",
"=",
"node",
".",
"nodeName",
";",
"}",
"valid",
"=",
"valid",
"&&",
"!",
"this",
".",
"invalidHandleTypes",
"[",
"nodeName",
"]",
";",
"valid",
"=",
"valid",
"&&",
"!",
"this",
".",
"invalidHandleIds",
"[",
"node",
".",
"id",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"len",
"=",
"this",
".",
"invalidHandleClasses",
".",
"length",
";",
"valid",
"&&",
"i",
"<",
"len",
";",
"++",
"i",
")",
"{",
"valid",
"=",
"!",
"Dom",
".",
"hasClass",
"(",
"node",
",",
"this",
".",
"invalidHandleClasses",
"[",
"i",
"]",
")",
";",
"}",
"this",
".",
"logger",
".",
"log",
"(",
"\"Valid handle? ... \"",
"+",
"valid",
")",
";",
"return",
"valid",
";",
"}"
]
| Checks the tag exclusion list to see if this click should be ignored
@method isValidHandleChild
@param {HTMLElement} node the HTMLElement to evaluate
@return {boolean} true if this is a valid tag type, false if not | [
"Checks",
"the",
"tag",
"exclusion",
"list",
"to",
"see",
"if",
"this",
"click",
"should",
"be",
"ignored"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/dragdrop/dragdrop-debug.js#L2651-L2672 |
|
43,121 | neyric/webhookit | public/javascripts/yui/dragdrop/dragdrop-debug.js | function(iLeft, iRight, iTickSize) {
this.leftConstraint = parseInt(iLeft, 10);
this.rightConstraint = parseInt(iRight, 10);
this.minX = this.initPageX - this.leftConstraint;
this.maxX = this.initPageX + this.rightConstraint;
if (iTickSize) { this.setXTicks(this.initPageX, iTickSize); }
this.constrainX = true;
this.logger.log("initPageX:" + this.initPageX + " minX:" + this.minX +
" maxX:" + this.maxX);
} | javascript | function(iLeft, iRight, iTickSize) {
this.leftConstraint = parseInt(iLeft, 10);
this.rightConstraint = parseInt(iRight, 10);
this.minX = this.initPageX - this.leftConstraint;
this.maxX = this.initPageX + this.rightConstraint;
if (iTickSize) { this.setXTicks(this.initPageX, iTickSize); }
this.constrainX = true;
this.logger.log("initPageX:" + this.initPageX + " minX:" + this.minX +
" maxX:" + this.maxX);
} | [
"function",
"(",
"iLeft",
",",
"iRight",
",",
"iTickSize",
")",
"{",
"this",
".",
"leftConstraint",
"=",
"parseInt",
"(",
"iLeft",
",",
"10",
")",
";",
"this",
".",
"rightConstraint",
"=",
"parseInt",
"(",
"iRight",
",",
"10",
")",
";",
"this",
".",
"minX",
"=",
"this",
".",
"initPageX",
"-",
"this",
".",
"leftConstraint",
";",
"this",
".",
"maxX",
"=",
"this",
".",
"initPageX",
"+",
"this",
".",
"rightConstraint",
";",
"if",
"(",
"iTickSize",
")",
"{",
"this",
".",
"setXTicks",
"(",
"this",
".",
"initPageX",
",",
"iTickSize",
")",
";",
"}",
"this",
".",
"constrainX",
"=",
"true",
";",
"this",
".",
"logger",
".",
"log",
"(",
"\"initPageX:\"",
"+",
"this",
".",
"initPageX",
"+",
"\" minX:\"",
"+",
"this",
".",
"minX",
"+",
"\" maxX:\"",
"+",
"this",
".",
"maxX",
")",
";",
"}"
]
| By default, the element can be dragged any place on the screen. Use
this method to limit the horizontal travel of the element. Pass in
0,0 for the parameters if you want to lock the drag to the y axis.
@method setXConstraint
@param {int} iLeft the number of pixels the element can move to the left
@param {int} iRight the number of pixels the element can move to the
right
@param {int} iTickSize optional parameter for specifying that the
element
should move iTickSize pixels at a time. | [
"By",
"default",
"the",
"element",
"can",
"be",
"dragged",
"any",
"place",
"on",
"the",
"screen",
".",
"Use",
"this",
"method",
"to",
"limit",
"the",
"horizontal",
"travel",
"of",
"the",
"element",
".",
"Pass",
"in",
"0",
"0",
"for",
"the",
"parameters",
"if",
"you",
"want",
"to",
"lock",
"the",
"drag",
"to",
"the",
"y",
"axis",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/dragdrop/dragdrop-debug.js#L2748-L2759 |
|
43,122 | neyric/webhookit | public/javascripts/yui/dragdrop/dragdrop-debug.js | function(iUp, iDown, iTickSize) {
this.logger.log("setYConstraint: " + iUp + "," + iDown + "," + iTickSize);
this.topConstraint = parseInt(iUp, 10);
this.bottomConstraint = parseInt(iDown, 10);
this.minY = this.initPageY - this.topConstraint;
this.maxY = this.initPageY + this.bottomConstraint;
if (iTickSize) { this.setYTicks(this.initPageY, iTickSize); }
this.constrainY = true;
this.logger.log("initPageY:" + this.initPageY + " minY:" + this.minY +
" maxY:" + this.maxY);
} | javascript | function(iUp, iDown, iTickSize) {
this.logger.log("setYConstraint: " + iUp + "," + iDown + "," + iTickSize);
this.topConstraint = parseInt(iUp, 10);
this.bottomConstraint = parseInt(iDown, 10);
this.minY = this.initPageY - this.topConstraint;
this.maxY = this.initPageY + this.bottomConstraint;
if (iTickSize) { this.setYTicks(this.initPageY, iTickSize); }
this.constrainY = true;
this.logger.log("initPageY:" + this.initPageY + " minY:" + this.minY +
" maxY:" + this.maxY);
} | [
"function",
"(",
"iUp",
",",
"iDown",
",",
"iTickSize",
")",
"{",
"this",
".",
"logger",
".",
"log",
"(",
"\"setYConstraint: \"",
"+",
"iUp",
"+",
"\",\"",
"+",
"iDown",
"+",
"\",\"",
"+",
"iTickSize",
")",
";",
"this",
".",
"topConstraint",
"=",
"parseInt",
"(",
"iUp",
",",
"10",
")",
";",
"this",
".",
"bottomConstraint",
"=",
"parseInt",
"(",
"iDown",
",",
"10",
")",
";",
"this",
".",
"minY",
"=",
"this",
".",
"initPageY",
"-",
"this",
".",
"topConstraint",
";",
"this",
".",
"maxY",
"=",
"this",
".",
"initPageY",
"+",
"this",
".",
"bottomConstraint",
";",
"if",
"(",
"iTickSize",
")",
"{",
"this",
".",
"setYTicks",
"(",
"this",
".",
"initPageY",
",",
"iTickSize",
")",
";",
"}",
"this",
".",
"constrainY",
"=",
"true",
";",
"this",
".",
"logger",
".",
"log",
"(",
"\"initPageY:\"",
"+",
"this",
".",
"initPageY",
"+",
"\" minY:\"",
"+",
"this",
".",
"minY",
"+",
"\" maxY:\"",
"+",
"this",
".",
"maxY",
")",
";",
"}"
]
| By default, the element can be dragged any place on the screen. Set
this to limit the vertical travel of the element. Pass in 0,0 for the
parameters if you want to lock the drag to the x axis.
@method setYConstraint
@param {int} iUp the number of pixels the element can move up
@param {int} iDown the number of pixels the element can move down
@param {int} iTickSize optional parameter for specifying that the
element should move iTickSize pixels at a time. | [
"By",
"default",
"the",
"element",
"can",
"be",
"dragged",
"any",
"place",
"on",
"the",
"screen",
".",
"Set",
"this",
"to",
"limit",
"the",
"vertical",
"travel",
"of",
"the",
"element",
".",
"Pass",
"in",
"0",
"0",
"for",
"the",
"parameters",
"if",
"you",
"want",
"to",
"lock",
"the",
"drag",
"to",
"the",
"x",
"axis",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/dragdrop/dragdrop-debug.js#L2795-L2808 |
|
43,123 | neyric/webhookit | public/javascripts/yui/dragdrop/dragdrop-debug.js | function(el, iPageX, iPageY) {
var oCoord = this.getTargetCoord(iPageX, iPageY);
// this.logger.log("****alignElWithMouse : " + el.id + ", " + aCoord + ", " + el.style.display);
if (!this.deltaSetXY) {
var aCoord = [oCoord.x, oCoord.y];
YAHOO.util.Dom.setXY(el, aCoord);
var newLeft = parseInt( YAHOO.util.Dom.getStyle(el, "left"), 10 );
var newTop = parseInt( YAHOO.util.Dom.getStyle(el, "top" ), 10 );
this.deltaSetXY = [ newLeft - oCoord.x, newTop - oCoord.y ];
} else {
YAHOO.util.Dom.setStyle(el, "left", (oCoord.x + this.deltaSetXY[0]) + "px");
YAHOO.util.Dom.setStyle(el, "top", (oCoord.y + this.deltaSetXY[1]) + "px");
}
this.cachePosition(oCoord.x, oCoord.y);
var self = this;
setTimeout(function() {
self.autoScroll.call(self, oCoord.x, oCoord.y, el.offsetHeight, el.offsetWidth);
}, 0);
} | javascript | function(el, iPageX, iPageY) {
var oCoord = this.getTargetCoord(iPageX, iPageY);
// this.logger.log("****alignElWithMouse : " + el.id + ", " + aCoord + ", " + el.style.display);
if (!this.deltaSetXY) {
var aCoord = [oCoord.x, oCoord.y];
YAHOO.util.Dom.setXY(el, aCoord);
var newLeft = parseInt( YAHOO.util.Dom.getStyle(el, "left"), 10 );
var newTop = parseInt( YAHOO.util.Dom.getStyle(el, "top" ), 10 );
this.deltaSetXY = [ newLeft - oCoord.x, newTop - oCoord.y ];
} else {
YAHOO.util.Dom.setStyle(el, "left", (oCoord.x + this.deltaSetXY[0]) + "px");
YAHOO.util.Dom.setStyle(el, "top", (oCoord.y + this.deltaSetXY[1]) + "px");
}
this.cachePosition(oCoord.x, oCoord.y);
var self = this;
setTimeout(function() {
self.autoScroll.call(self, oCoord.x, oCoord.y, el.offsetHeight, el.offsetWidth);
}, 0);
} | [
"function",
"(",
"el",
",",
"iPageX",
",",
"iPageY",
")",
"{",
"var",
"oCoord",
"=",
"this",
".",
"getTargetCoord",
"(",
"iPageX",
",",
"iPageY",
")",
";",
"// this.logger.log(\"****alignElWithMouse : \" + el.id + \", \" + aCoord + \", \" + el.style.display);",
"if",
"(",
"!",
"this",
".",
"deltaSetXY",
")",
"{",
"var",
"aCoord",
"=",
"[",
"oCoord",
".",
"x",
",",
"oCoord",
".",
"y",
"]",
";",
"YAHOO",
".",
"util",
".",
"Dom",
".",
"setXY",
"(",
"el",
",",
"aCoord",
")",
";",
"var",
"newLeft",
"=",
"parseInt",
"(",
"YAHOO",
".",
"util",
".",
"Dom",
".",
"getStyle",
"(",
"el",
",",
"\"left\"",
")",
",",
"10",
")",
";",
"var",
"newTop",
"=",
"parseInt",
"(",
"YAHOO",
".",
"util",
".",
"Dom",
".",
"getStyle",
"(",
"el",
",",
"\"top\"",
")",
",",
"10",
")",
";",
"this",
".",
"deltaSetXY",
"=",
"[",
"newLeft",
"-",
"oCoord",
".",
"x",
",",
"newTop",
"-",
"oCoord",
".",
"y",
"]",
";",
"}",
"else",
"{",
"YAHOO",
".",
"util",
".",
"Dom",
".",
"setStyle",
"(",
"el",
",",
"\"left\"",
",",
"(",
"oCoord",
".",
"x",
"+",
"this",
".",
"deltaSetXY",
"[",
"0",
"]",
")",
"+",
"\"px\"",
")",
";",
"YAHOO",
".",
"util",
".",
"Dom",
".",
"setStyle",
"(",
"el",
",",
"\"top\"",
",",
"(",
"oCoord",
".",
"y",
"+",
"this",
".",
"deltaSetXY",
"[",
"1",
"]",
")",
"+",
"\"px\"",
")",
";",
"}",
"this",
".",
"cachePosition",
"(",
"oCoord",
".",
"x",
",",
"oCoord",
".",
"y",
")",
";",
"var",
"self",
"=",
"this",
";",
"setTimeout",
"(",
"function",
"(",
")",
"{",
"self",
".",
"autoScroll",
".",
"call",
"(",
"self",
",",
"oCoord",
".",
"x",
",",
"oCoord",
".",
"y",
",",
"el",
".",
"offsetHeight",
",",
"el",
".",
"offsetWidth",
")",
";",
"}",
",",
"0",
")",
";",
"}"
]
| Sets the element to the location of the mousedown or click event,
maintaining the cursor location relative to the location on the element
that was clicked. Override this if you want to place the element in a
location other than where the cursor is.
@method alignElWithMouse
@param {HTMLElement} el the element to move
@param {int} iPageX the X coordinate of the mousedown or drag event
@param {int} iPageY the Y coordinate of the mousedown or drag event | [
"Sets",
"the",
"element",
"to",
"the",
"location",
"of",
"the",
"mousedown",
"or",
"click",
"event",
"maintaining",
"the",
"cursor",
"location",
"relative",
"to",
"the",
"location",
"on",
"the",
"element",
"that",
"was",
"clicked",
".",
"Override",
"this",
"if",
"you",
"want",
"to",
"place",
"the",
"element",
"in",
"a",
"location",
"other",
"than",
"where",
"the",
"cursor",
"is",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/dragdrop/dragdrop-debug.js#L3073-L3095 |
|
43,124 | neyric/webhookit | public/javascripts/yui/dragdrop/dragdrop-debug.js | function(iPageX, iPageY) {
if (iPageX) {
this.lastPageX = iPageX;
this.lastPageY = iPageY;
} else {
var aCoord = YAHOO.util.Dom.getXY(this.getEl());
this.lastPageX = aCoord[0];
this.lastPageY = aCoord[1];
}
} | javascript | function(iPageX, iPageY) {
if (iPageX) {
this.lastPageX = iPageX;
this.lastPageY = iPageY;
} else {
var aCoord = YAHOO.util.Dom.getXY(this.getEl());
this.lastPageX = aCoord[0];
this.lastPageY = aCoord[1];
}
} | [
"function",
"(",
"iPageX",
",",
"iPageY",
")",
"{",
"if",
"(",
"iPageX",
")",
"{",
"this",
".",
"lastPageX",
"=",
"iPageX",
";",
"this",
".",
"lastPageY",
"=",
"iPageY",
";",
"}",
"else",
"{",
"var",
"aCoord",
"=",
"YAHOO",
".",
"util",
".",
"Dom",
".",
"getXY",
"(",
"this",
".",
"getEl",
"(",
")",
")",
";",
"this",
".",
"lastPageX",
"=",
"aCoord",
"[",
"0",
"]",
";",
"this",
".",
"lastPageY",
"=",
"aCoord",
"[",
"1",
"]",
";",
"}",
"}"
]
| Saves the most recent position so that we can reset the constraints and
tick marks on-demand. We need to know this so that we can calculate the
number of pixels the element is offset from its original position.
@method cachePosition
@param iPageX the current x position (optional, this just makes it so we
don't have to look it up again)
@param iPageY the current y position (optional, this just makes it so we
don't have to look it up again) | [
"Saves",
"the",
"most",
"recent",
"position",
"so",
"that",
"we",
"can",
"reset",
"the",
"constraints",
"and",
"tick",
"marks",
"on",
"-",
"demand",
".",
"We",
"need",
"to",
"know",
"this",
"so",
"that",
"we",
"can",
"calculate",
"the",
"number",
"of",
"pixels",
"the",
"element",
"is",
"offset",
"from",
"its",
"original",
"position",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/dragdrop/dragdrop-debug.js#L3107-L3116 |
|
43,125 | neyric/webhookit | public/javascripts/yui/dragdrop/dragdrop-debug.js | function(x, y, h, w) {
if (this.scroll) {
// The client height
var clientH = this.DDM.getClientHeight();
// The client width
var clientW = this.DDM.getClientWidth();
// The amt scrolled down
var st = this.DDM.getScrollTop();
// The amt scrolled right
var sl = this.DDM.getScrollLeft();
// Location of the bottom of the element
var bot = h + y;
// Location of the right of the element
var right = w + x;
// The distance from the cursor to the bottom of the visible area,
// adjusted so that we don't scroll if the cursor is beyond the
// element drag constraints
var toBot = (clientH + st - y - this.deltaY);
// The distance from the cursor to the right of the visible area
var toRight = (clientW + sl - x - this.deltaX);
// this.logger.log( " x: " + x + " y: " + y + " h: " + h +
// " clientH: " + clientH + " clientW: " + clientW +
// " st: " + st + " sl: " + sl + " bot: " + bot +
// " right: " + right + " toBot: " + toBot + " toRight: " + toRight);
// How close to the edge the cursor must be before we scroll
// var thresh = (document.all) ? 100 : 40;
var thresh = 40;
// How many pixels to scroll per autoscroll op. This helps to reduce
// clunky scrolling. IE is more sensitive about this ... it needs this
// value to be higher.
var scrAmt = (document.all) ? 80 : 30;
// Scroll down if we are near the bottom of the visible page and the
// obj extends below the crease
if ( bot > clientH && toBot < thresh ) {
window.scrollTo(sl, st + scrAmt);
}
// Scroll up if the window is scrolled down and the top of the object
// goes above the top border
if ( y < st && st > 0 && y - st < thresh ) {
window.scrollTo(sl, st - scrAmt);
}
// Scroll right if the obj is beyond the right border and the cursor is
// near the border.
if ( right > clientW && toRight < thresh ) {
window.scrollTo(sl + scrAmt, st);
}
// Scroll left if the window has been scrolled to the right and the obj
// extends past the left border
if ( x < sl && sl > 0 && x - sl < thresh ) {
window.scrollTo(sl - scrAmt, st);
}
}
} | javascript | function(x, y, h, w) {
if (this.scroll) {
// The client height
var clientH = this.DDM.getClientHeight();
// The client width
var clientW = this.DDM.getClientWidth();
// The amt scrolled down
var st = this.DDM.getScrollTop();
// The amt scrolled right
var sl = this.DDM.getScrollLeft();
// Location of the bottom of the element
var bot = h + y;
// Location of the right of the element
var right = w + x;
// The distance from the cursor to the bottom of the visible area,
// adjusted so that we don't scroll if the cursor is beyond the
// element drag constraints
var toBot = (clientH + st - y - this.deltaY);
// The distance from the cursor to the right of the visible area
var toRight = (clientW + sl - x - this.deltaX);
// this.logger.log( " x: " + x + " y: " + y + " h: " + h +
// " clientH: " + clientH + " clientW: " + clientW +
// " st: " + st + " sl: " + sl + " bot: " + bot +
// " right: " + right + " toBot: " + toBot + " toRight: " + toRight);
// How close to the edge the cursor must be before we scroll
// var thresh = (document.all) ? 100 : 40;
var thresh = 40;
// How many pixels to scroll per autoscroll op. This helps to reduce
// clunky scrolling. IE is more sensitive about this ... it needs this
// value to be higher.
var scrAmt = (document.all) ? 80 : 30;
// Scroll down if we are near the bottom of the visible page and the
// obj extends below the crease
if ( bot > clientH && toBot < thresh ) {
window.scrollTo(sl, st + scrAmt);
}
// Scroll up if the window is scrolled down and the top of the object
// goes above the top border
if ( y < st && st > 0 && y - st < thresh ) {
window.scrollTo(sl, st - scrAmt);
}
// Scroll right if the obj is beyond the right border and the cursor is
// near the border.
if ( right > clientW && toRight < thresh ) {
window.scrollTo(sl + scrAmt, st);
}
// Scroll left if the window has been scrolled to the right and the obj
// extends past the left border
if ( x < sl && sl > 0 && x - sl < thresh ) {
window.scrollTo(sl - scrAmt, st);
}
}
} | [
"function",
"(",
"x",
",",
"y",
",",
"h",
",",
"w",
")",
"{",
"if",
"(",
"this",
".",
"scroll",
")",
"{",
"// The client height",
"var",
"clientH",
"=",
"this",
".",
"DDM",
".",
"getClientHeight",
"(",
")",
";",
"// The client width",
"var",
"clientW",
"=",
"this",
".",
"DDM",
".",
"getClientWidth",
"(",
")",
";",
"// The amt scrolled down",
"var",
"st",
"=",
"this",
".",
"DDM",
".",
"getScrollTop",
"(",
")",
";",
"// The amt scrolled right",
"var",
"sl",
"=",
"this",
".",
"DDM",
".",
"getScrollLeft",
"(",
")",
";",
"// Location of the bottom of the element",
"var",
"bot",
"=",
"h",
"+",
"y",
";",
"// Location of the right of the element",
"var",
"right",
"=",
"w",
"+",
"x",
";",
"// The distance from the cursor to the bottom of the visible area, ",
"// adjusted so that we don't scroll if the cursor is beyond the",
"// element drag constraints",
"var",
"toBot",
"=",
"(",
"clientH",
"+",
"st",
"-",
"y",
"-",
"this",
".",
"deltaY",
")",
";",
"// The distance from the cursor to the right of the visible area",
"var",
"toRight",
"=",
"(",
"clientW",
"+",
"sl",
"-",
"x",
"-",
"this",
".",
"deltaX",
")",
";",
"// this.logger.log( \" x: \" + x + \" y: \" + y + \" h: \" + h + ",
"// \" clientH: \" + clientH + \" clientW: \" + clientW + ",
"// \" st: \" + st + \" sl: \" + sl + \" bot: \" + bot + ",
"// \" right: \" + right + \" toBot: \" + toBot + \" toRight: \" + toRight);",
"// How close to the edge the cursor must be before we scroll",
"// var thresh = (document.all) ? 100 : 40;",
"var",
"thresh",
"=",
"40",
";",
"// How many pixels to scroll per autoscroll op. This helps to reduce ",
"// clunky scrolling. IE is more sensitive about this ... it needs this ",
"// value to be higher.",
"var",
"scrAmt",
"=",
"(",
"document",
".",
"all",
")",
"?",
"80",
":",
"30",
";",
"// Scroll down if we are near the bottom of the visible page and the ",
"// obj extends below the crease",
"if",
"(",
"bot",
">",
"clientH",
"&&",
"toBot",
"<",
"thresh",
")",
"{",
"window",
".",
"scrollTo",
"(",
"sl",
",",
"st",
"+",
"scrAmt",
")",
";",
"}",
"// Scroll up if the window is scrolled down and the top of the object",
"// goes above the top border",
"if",
"(",
"y",
"<",
"st",
"&&",
"st",
">",
"0",
"&&",
"y",
"-",
"st",
"<",
"thresh",
")",
"{",
"window",
".",
"scrollTo",
"(",
"sl",
",",
"st",
"-",
"scrAmt",
")",
";",
"}",
"// Scroll right if the obj is beyond the right border and the cursor is",
"// near the border.",
"if",
"(",
"right",
">",
"clientW",
"&&",
"toRight",
"<",
"thresh",
")",
"{",
"window",
".",
"scrollTo",
"(",
"sl",
"+",
"scrAmt",
",",
"st",
")",
";",
"}",
"// Scroll left if the window has been scrolled to the right and the obj",
"// extends past the left border",
"if",
"(",
"x",
"<",
"sl",
"&&",
"sl",
">",
"0",
"&&",
"x",
"-",
"sl",
"<",
"thresh",
")",
"{",
"window",
".",
"scrollTo",
"(",
"sl",
"-",
"scrAmt",
",",
"st",
")",
";",
"}",
"}",
"}"
]
| Auto-scroll the window if the dragged object has been moved beyond the
visible window boundary.
@method autoScroll
@param {int} x the drag element's x position
@param {int} y the drag element's y position
@param {int} h the height of the drag element
@param {int} w the width of the drag element
@private | [
"Auto",
"-",
"scroll",
"the",
"window",
"if",
"the",
"dragged",
"object",
"has",
"been",
"moved",
"beyond",
"the",
"visible",
"window",
"boundary",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/dragdrop/dragdrop-debug.js#L3128-L3195 |
|
43,126 | neyric/webhookit | public/javascripts/yui/dragdrop/dragdrop-debug.js | function(iPageX, iPageY) {
var el = this.getEl();
var dragEl = this.getDragEl();
var s = dragEl.style;
this._resizeProxy();
if (this.centerFrame) {
this.setDelta( Math.round(parseInt(s.width, 10)/2),
Math.round(parseInt(s.height, 10)/2) );
}
this.setDragElPos(iPageX, iPageY);
YAHOO.util.Dom.setStyle(dragEl, "visibility", "visible");
} | javascript | function(iPageX, iPageY) {
var el = this.getEl();
var dragEl = this.getDragEl();
var s = dragEl.style;
this._resizeProxy();
if (this.centerFrame) {
this.setDelta( Math.round(parseInt(s.width, 10)/2),
Math.round(parseInt(s.height, 10)/2) );
}
this.setDragElPos(iPageX, iPageY);
YAHOO.util.Dom.setStyle(dragEl, "visibility", "visible");
} | [
"function",
"(",
"iPageX",
",",
"iPageY",
")",
"{",
"var",
"el",
"=",
"this",
".",
"getEl",
"(",
")",
";",
"var",
"dragEl",
"=",
"this",
".",
"getDragEl",
"(",
")",
";",
"var",
"s",
"=",
"dragEl",
".",
"style",
";",
"this",
".",
"_resizeProxy",
"(",
")",
";",
"if",
"(",
"this",
".",
"centerFrame",
")",
"{",
"this",
".",
"setDelta",
"(",
"Math",
".",
"round",
"(",
"parseInt",
"(",
"s",
".",
"width",
",",
"10",
")",
"/",
"2",
")",
",",
"Math",
".",
"round",
"(",
"parseInt",
"(",
"s",
".",
"height",
",",
"10",
")",
"/",
"2",
")",
")",
";",
"}",
"this",
".",
"setDragElPos",
"(",
"iPageX",
",",
"iPageY",
")",
";",
"YAHOO",
".",
"util",
".",
"Dom",
".",
"setStyle",
"(",
"dragEl",
",",
"\"visibility\"",
",",
"\"visible\"",
")",
";",
"}"
]
| Resizes the drag frame to the dimensions of the clicked object, positions
it over the object, and finally displays it
@method showFrame
@param {int} iPageX X click position
@param {int} iPageY Y click position
@private | [
"Resizes",
"the",
"drag",
"frame",
"to",
"the",
"dimensions",
"of",
"the",
"clicked",
"object",
"positions",
"it",
"over",
"the",
"object",
"and",
"finally",
"displays",
"it"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/dragdrop/dragdrop-debug.js#L3486-L3501 |
|
43,127 | neyric/webhookit | public/javascripts/yui/dragdrop/dragdrop-debug.js | function() {
if (this.resizeFrame) {
var DOM = YAHOO.util.Dom;
var el = this.getEl();
var dragEl = this.getDragEl();
var bt = parseInt( DOM.getStyle(dragEl, "borderTopWidth" ), 10);
var br = parseInt( DOM.getStyle(dragEl, "borderRightWidth" ), 10);
var bb = parseInt( DOM.getStyle(dragEl, "borderBottomWidth" ), 10);
var bl = parseInt( DOM.getStyle(dragEl, "borderLeftWidth" ), 10);
if (isNaN(bt)) { bt = 0; }
if (isNaN(br)) { br = 0; }
if (isNaN(bb)) { bb = 0; }
if (isNaN(bl)) { bl = 0; }
this.logger.log("proxy size: " + bt + " " + br + " " + bb + " " + bl);
var newWidth = Math.max(0, el.offsetWidth - br - bl);
var newHeight = Math.max(0, el.offsetHeight - bt - bb);
this.logger.log("Resizing proxy element");
DOM.setStyle( dragEl, "width", newWidth + "px" );
DOM.setStyle( dragEl, "height", newHeight + "px" );
}
} | javascript | function() {
if (this.resizeFrame) {
var DOM = YAHOO.util.Dom;
var el = this.getEl();
var dragEl = this.getDragEl();
var bt = parseInt( DOM.getStyle(dragEl, "borderTopWidth" ), 10);
var br = parseInt( DOM.getStyle(dragEl, "borderRightWidth" ), 10);
var bb = parseInt( DOM.getStyle(dragEl, "borderBottomWidth" ), 10);
var bl = parseInt( DOM.getStyle(dragEl, "borderLeftWidth" ), 10);
if (isNaN(bt)) { bt = 0; }
if (isNaN(br)) { br = 0; }
if (isNaN(bb)) { bb = 0; }
if (isNaN(bl)) { bl = 0; }
this.logger.log("proxy size: " + bt + " " + br + " " + bb + " " + bl);
var newWidth = Math.max(0, el.offsetWidth - br - bl);
var newHeight = Math.max(0, el.offsetHeight - bt - bb);
this.logger.log("Resizing proxy element");
DOM.setStyle( dragEl, "width", newWidth + "px" );
DOM.setStyle( dragEl, "height", newHeight + "px" );
}
} | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"resizeFrame",
")",
"{",
"var",
"DOM",
"=",
"YAHOO",
".",
"util",
".",
"Dom",
";",
"var",
"el",
"=",
"this",
".",
"getEl",
"(",
")",
";",
"var",
"dragEl",
"=",
"this",
".",
"getDragEl",
"(",
")",
";",
"var",
"bt",
"=",
"parseInt",
"(",
"DOM",
".",
"getStyle",
"(",
"dragEl",
",",
"\"borderTopWidth\"",
")",
",",
"10",
")",
";",
"var",
"br",
"=",
"parseInt",
"(",
"DOM",
".",
"getStyle",
"(",
"dragEl",
",",
"\"borderRightWidth\"",
")",
",",
"10",
")",
";",
"var",
"bb",
"=",
"parseInt",
"(",
"DOM",
".",
"getStyle",
"(",
"dragEl",
",",
"\"borderBottomWidth\"",
")",
",",
"10",
")",
";",
"var",
"bl",
"=",
"parseInt",
"(",
"DOM",
".",
"getStyle",
"(",
"dragEl",
",",
"\"borderLeftWidth\"",
")",
",",
"10",
")",
";",
"if",
"(",
"isNaN",
"(",
"bt",
")",
")",
"{",
"bt",
"=",
"0",
";",
"}",
"if",
"(",
"isNaN",
"(",
"br",
")",
")",
"{",
"br",
"=",
"0",
";",
"}",
"if",
"(",
"isNaN",
"(",
"bb",
")",
")",
"{",
"bb",
"=",
"0",
";",
"}",
"if",
"(",
"isNaN",
"(",
"bl",
")",
")",
"{",
"bl",
"=",
"0",
";",
"}",
"this",
".",
"logger",
".",
"log",
"(",
"\"proxy size: \"",
"+",
"bt",
"+",
"\" \"",
"+",
"br",
"+",
"\" \"",
"+",
"bb",
"+",
"\" \"",
"+",
"bl",
")",
";",
"var",
"newWidth",
"=",
"Math",
".",
"max",
"(",
"0",
",",
"el",
".",
"offsetWidth",
"-",
"br",
"-",
"bl",
")",
";",
"var",
"newHeight",
"=",
"Math",
".",
"max",
"(",
"0",
",",
"el",
".",
"offsetHeight",
"-",
"bt",
"-",
"bb",
")",
";",
"this",
".",
"logger",
".",
"log",
"(",
"\"Resizing proxy element\"",
")",
";",
"DOM",
".",
"setStyle",
"(",
"dragEl",
",",
"\"width\"",
",",
"newWidth",
"+",
"\"px\"",
")",
";",
"DOM",
".",
"setStyle",
"(",
"dragEl",
",",
"\"height\"",
",",
"newHeight",
"+",
"\"px\"",
")",
";",
"}",
"}"
]
| The proxy is automatically resized to the dimensions of the linked
element when a drag is initiated, unless resizeFrame is set to false
@method _resizeProxy
@private | [
"The",
"proxy",
"is",
"automatically",
"resized",
"to",
"the",
"dimensions",
"of",
"the",
"linked",
"element",
"when",
"a",
"drag",
"is",
"initiated",
"unless",
"resizeFrame",
"is",
"set",
"to",
"false"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/dragdrop/dragdrop-debug.js#L3509-L3535 |
|
43,128 | neyric/webhookit | public/javascripts/yui/dragdrop/dragdrop-debug.js | function(e) {
this.setStartPosition();
var x = YAHOO.util.Event.getPageX(e);
var y = YAHOO.util.Event.getPageY(e);
this.autoOffset(x, y);
// This causes the autoscroll code to kick off, which means autoscroll can
// happen prior to the check for a valid drag handle.
// this.setDragElPos(x, y);
} | javascript | function(e) {
this.setStartPosition();
var x = YAHOO.util.Event.getPageX(e);
var y = YAHOO.util.Event.getPageY(e);
this.autoOffset(x, y);
// This causes the autoscroll code to kick off, which means autoscroll can
// happen prior to the check for a valid drag handle.
// this.setDragElPos(x, y);
} | [
"function",
"(",
"e",
")",
"{",
"this",
".",
"setStartPosition",
"(",
")",
";",
"var",
"x",
"=",
"YAHOO",
".",
"util",
".",
"Event",
".",
"getPageX",
"(",
"e",
")",
";",
"var",
"y",
"=",
"YAHOO",
".",
"util",
".",
"Event",
".",
"getPageY",
"(",
"e",
")",
";",
"this",
".",
"autoOffset",
"(",
"x",
",",
"y",
")",
";",
"// This causes the autoscroll code to kick off, which means autoscroll can",
"// happen prior to the check for a valid drag handle.",
"// this.setDragElPos(x, y);",
"}"
]
| overrides YAHOO.util.DragDrop | [
"overrides",
"YAHOO",
".",
"util",
".",
"DragDrop"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/dragdrop/dragdrop-debug.js#L3538-L3547 |
|
43,129 | neyric/webhookit | public/javascripts/yui/dragdrop/dragdrop-debug.js | function(e) {
var DOM = YAHOO.util.Dom;
this.logger.log(this.id + " endDrag");
var lel = this.getEl();
var del = this.getDragEl();
// Show the drag frame briefly so we can get its position
// del.style.visibility = "";
DOM.setStyle(del, "visibility", "");
// Hide the linked element before the move to get around a Safari
// rendering bug.
//lel.style.visibility = "hidden";
DOM.setStyle(lel, "visibility", "hidden");
YAHOO.util.DDM.moveToEl(lel, del);
//del.style.visibility = "hidden";
DOM.setStyle(del, "visibility", "hidden");
//lel.style.visibility = "";
DOM.setStyle(lel, "visibility", "");
} | javascript | function(e) {
var DOM = YAHOO.util.Dom;
this.logger.log(this.id + " endDrag");
var lel = this.getEl();
var del = this.getDragEl();
// Show the drag frame briefly so we can get its position
// del.style.visibility = "";
DOM.setStyle(del, "visibility", "");
// Hide the linked element before the move to get around a Safari
// rendering bug.
//lel.style.visibility = "hidden";
DOM.setStyle(lel, "visibility", "hidden");
YAHOO.util.DDM.moveToEl(lel, del);
//del.style.visibility = "hidden";
DOM.setStyle(del, "visibility", "hidden");
//lel.style.visibility = "";
DOM.setStyle(lel, "visibility", "");
} | [
"function",
"(",
"e",
")",
"{",
"var",
"DOM",
"=",
"YAHOO",
".",
"util",
".",
"Dom",
";",
"this",
".",
"logger",
".",
"log",
"(",
"this",
".",
"id",
"+",
"\" endDrag\"",
")",
";",
"var",
"lel",
"=",
"this",
".",
"getEl",
"(",
")",
";",
"var",
"del",
"=",
"this",
".",
"getDragEl",
"(",
")",
";",
"// Show the drag frame briefly so we can get its position",
"// del.style.visibility = \"\";",
"DOM",
".",
"setStyle",
"(",
"del",
",",
"\"visibility\"",
",",
"\"\"",
")",
";",
"// Hide the linked element before the move to get around a Safari ",
"// rendering bug.",
"//lel.style.visibility = \"hidden\";",
"DOM",
".",
"setStyle",
"(",
"lel",
",",
"\"visibility\"",
",",
"\"hidden\"",
")",
";",
"YAHOO",
".",
"util",
".",
"DDM",
".",
"moveToEl",
"(",
"lel",
",",
"del",
")",
";",
"//del.style.visibility = \"hidden\";",
"DOM",
".",
"setStyle",
"(",
"del",
",",
"\"visibility\"",
",",
"\"hidden\"",
")",
";",
"//lel.style.visibility = \"\";",
"DOM",
".",
"setStyle",
"(",
"lel",
",",
"\"visibility\"",
",",
"\"\"",
")",
";",
"}"
]
| overrides YAHOO.util.DragDrop By default we try to move the element to the last location of the frame. This is so that the default behavior mirrors that of YAHOO.util.DD. | [
"overrides",
"YAHOO",
".",
"util",
".",
"DragDrop",
"By",
"default",
"we",
"try",
"to",
"move",
"the",
"element",
"to",
"the",
"last",
"location",
"of",
"the",
"frame",
".",
"This",
"is",
"so",
"that",
"the",
"default",
"behavior",
"mirrors",
"that",
"of",
"YAHOO",
".",
"util",
".",
"DD",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/dragdrop/dragdrop-debug.js#L3565-L3584 |
|
43,130 | neyric/webhookit | public/javascripts/inputex/js/fields/Lens-beta.js | function(options) {
inputEx.Lens.superclass.setOptions.call(this, options);
var lens = "";
if( !lang.isString(options.lens) ) {
for(var i = 0 ; i < this.options.fields.length ; i++) {
lens += "<div class='field-"+this.options.fields[i].name+"'></div>";
}
}
this.options.lens = lang.isString(options.lens) ? options.lens : lens;
this.options.visus = options.visus;
} | javascript | function(options) {
inputEx.Lens.superclass.setOptions.call(this, options);
var lens = "";
if( !lang.isString(options.lens) ) {
for(var i = 0 ; i < this.options.fields.length ; i++) {
lens += "<div class='field-"+this.options.fields[i].name+"'></div>";
}
}
this.options.lens = lang.isString(options.lens) ? options.lens : lens;
this.options.visus = options.visus;
} | [
"function",
"(",
"options",
")",
"{",
"inputEx",
".",
"Lens",
".",
"superclass",
".",
"setOptions",
".",
"call",
"(",
"this",
",",
"options",
")",
";",
"var",
"lens",
"=",
"\"\"",
";",
"if",
"(",
"!",
"lang",
".",
"isString",
"(",
"options",
".",
"lens",
")",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"options",
".",
"fields",
".",
"length",
";",
"i",
"++",
")",
"{",
"lens",
"+=",
"\"<div class='field-\"",
"+",
"this",
".",
"options",
".",
"fields",
"[",
"i",
"]",
".",
"name",
"+",
"\"'></div>\"",
";",
"}",
"}",
"this",
".",
"options",
".",
"lens",
"=",
"lang",
".",
"isString",
"(",
"options",
".",
"lens",
")",
"?",
"options",
".",
"lens",
":",
"lens",
";",
"this",
".",
"options",
".",
"visus",
"=",
"options",
".",
"visus",
";",
"}"
]
| Set additional options | [
"Set",
"additional",
"options"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/inputex/js/fields/Lens-beta.js#L25-L37 |
|
43,131 | neyric/webhookit | public/javascripts/inputex/js/fields/Lens-beta.js | function(parentEl) {
parentEl.innerHTML = this.options.lens;
for(var i = 0 ; i < this.options.fields.length ; i++) {
var els = YAHOO.util.Dom.getElementsByClassName( "field-"+this.options.fields[i].name, "div", parentEl);
var el = els[0];
var params = { parentEl: el, editorField: this.options.fields[i], name: this.options.fields[i].name };
if(this.options.visus) {
params.visu = this.options.visus[i];
}
var field = new inputEx.InPlaceEdit(params);
this.inputs.push(field);
if(field.options.name) {
this.inputsNames[field.options.name] = field;
}
// Subscribe to the field "updated" event to send the group "updated" event
field.updatedEvt.subscribe(this.onChange, this, true);
}
} | javascript | function(parentEl) {
parentEl.innerHTML = this.options.lens;
for(var i = 0 ; i < this.options.fields.length ; i++) {
var els = YAHOO.util.Dom.getElementsByClassName( "field-"+this.options.fields[i].name, "div", parentEl);
var el = els[0];
var params = { parentEl: el, editorField: this.options.fields[i], name: this.options.fields[i].name };
if(this.options.visus) {
params.visu = this.options.visus[i];
}
var field = new inputEx.InPlaceEdit(params);
this.inputs.push(field);
if(field.options.name) {
this.inputsNames[field.options.name] = field;
}
// Subscribe to the field "updated" event to send the group "updated" event
field.updatedEvt.subscribe(this.onChange, this, true);
}
} | [
"function",
"(",
"parentEl",
")",
"{",
"parentEl",
".",
"innerHTML",
"=",
"this",
".",
"options",
".",
"lens",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"options",
".",
"fields",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
"els",
"=",
"YAHOO",
".",
"util",
".",
"Dom",
".",
"getElementsByClassName",
"(",
"\"field-\"",
"+",
"this",
".",
"options",
".",
"fields",
"[",
"i",
"]",
".",
"name",
",",
"\"div\"",
",",
"parentEl",
")",
";",
"var",
"el",
"=",
"els",
"[",
"0",
"]",
";",
"var",
"params",
"=",
"{",
"parentEl",
":",
"el",
",",
"editorField",
":",
"this",
".",
"options",
".",
"fields",
"[",
"i",
"]",
",",
"name",
":",
"this",
".",
"options",
".",
"fields",
"[",
"i",
"]",
".",
"name",
"}",
";",
"if",
"(",
"this",
".",
"options",
".",
"visus",
")",
"{",
"params",
".",
"visu",
"=",
"this",
".",
"options",
".",
"visus",
"[",
"i",
"]",
";",
"}",
"var",
"field",
"=",
"new",
"inputEx",
".",
"InPlaceEdit",
"(",
"params",
")",
";",
"this",
".",
"inputs",
".",
"push",
"(",
"field",
")",
";",
"if",
"(",
"field",
".",
"options",
".",
"name",
")",
"{",
"this",
".",
"inputsNames",
"[",
"field",
".",
"options",
".",
"name",
"]",
"=",
"field",
";",
"}",
"// Subscribe to the field \"updated\" event to send the group \"updated\" event",
"field",
".",
"updatedEvt",
".",
"subscribe",
"(",
"this",
".",
"onChange",
",",
"this",
",",
"true",
")",
";",
"}",
"}"
]
| Render each the fields in each div which class attribute is "field-"+fieldName | [
"Render",
"each",
"the",
"fields",
"in",
"each",
"div",
"which",
"class",
"attribute",
"is",
"field",
"-",
"+",
"fieldName"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/inputex/js/fields/Lens-beta.js#L42-L64 |
|
43,132 | neyric/webhookit | public/javascripts/yui/swfstore/swf.js | function (func, args)
{
if (this._swf[func]) {
return(this._swf[func].apply(this._swf, args));
} else {
return null;
}
} | javascript | function (func, args)
{
if (this._swf[func]) {
return(this._swf[func].apply(this._swf, args));
} else {
return null;
}
} | [
"function",
"(",
"func",
",",
"args",
")",
"{",
"if",
"(",
"this",
".",
"_swf",
"[",
"func",
"]",
")",
"{",
"return",
"(",
"this",
".",
"_swf",
"[",
"func",
"]",
".",
"apply",
"(",
"this",
".",
"_swf",
",",
"args",
")",
")",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}"
]
| Calls a specific function exposed by the SWF's
ExternalInterface.
@method callSWF
@param func {String} the name of the function to call
@param args {Object} the set of arguments to pass to the function. | [
"Calls",
"a",
"specific",
"function",
"exposed",
"by",
"the",
"SWF",
"s",
"ExternalInterface",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/swfstore/swf.js#L226-L233 |
|
43,133 | neyric/webhookit | public/javascripts/inputex/js/fields/MapField.js | function(options) {
inputEx.MapField.superclass.setOptions.call(this, options);
this.options.className = options.className || 'inputEx-Field inputEx-MapField';
this.options.width = options.width || '400px';
this.options.height = options.height || '400px';
this.options.loading = options.loading || 'loading....';
this.options.lat = options.lat || inputEx.MapFieldGlobals.lat;
this.options.lon = options.lon || inputEx.MapFieldGlobals.lon;
this.options.uzoom = options.uzoom || inputEx.MapFieldGlobals.uzoom;
this.options.api = options.api || inputEx.MapFieldGlobals.api;
this.options.api_key = options.api_key || inputEx.MapFieldGlobals.api_key;
} | javascript | function(options) {
inputEx.MapField.superclass.setOptions.call(this, options);
this.options.className = options.className || 'inputEx-Field inputEx-MapField';
this.options.width = options.width || '400px';
this.options.height = options.height || '400px';
this.options.loading = options.loading || 'loading....';
this.options.lat = options.lat || inputEx.MapFieldGlobals.lat;
this.options.lon = options.lon || inputEx.MapFieldGlobals.lon;
this.options.uzoom = options.uzoom || inputEx.MapFieldGlobals.uzoom;
this.options.api = options.api || inputEx.MapFieldGlobals.api;
this.options.api_key = options.api_key || inputEx.MapFieldGlobals.api_key;
} | [
"function",
"(",
"options",
")",
"{",
"inputEx",
".",
"MapField",
".",
"superclass",
".",
"setOptions",
".",
"call",
"(",
"this",
",",
"options",
")",
";",
"this",
".",
"options",
".",
"className",
"=",
"options",
".",
"className",
"||",
"'inputEx-Field inputEx-MapField'",
";",
"this",
".",
"options",
".",
"width",
"=",
"options",
".",
"width",
"||",
"'400px'",
";",
"this",
".",
"options",
".",
"height",
"=",
"options",
".",
"height",
"||",
"'400px'",
";",
"this",
".",
"options",
".",
"loading",
"=",
"options",
".",
"loading",
"||",
"'loading....'",
";",
"this",
".",
"options",
".",
"lat",
"=",
"options",
".",
"lat",
"||",
"inputEx",
".",
"MapFieldGlobals",
".",
"lat",
";",
"this",
".",
"options",
".",
"lon",
"=",
"options",
".",
"lon",
"||",
"inputEx",
".",
"MapFieldGlobals",
".",
"lon",
";",
"this",
".",
"options",
".",
"uzoom",
"=",
"options",
".",
"uzoom",
"||",
"inputEx",
".",
"MapFieldGlobals",
".",
"uzoom",
";",
"this",
".",
"options",
".",
"api",
"=",
"options",
".",
"api",
"||",
"inputEx",
".",
"MapFieldGlobals",
".",
"api",
";",
"this",
".",
"options",
".",
"api_key",
"=",
"options",
".",
"api_key",
"||",
"inputEx",
".",
"MapFieldGlobals",
".",
"api_key",
";",
"}"
]
| Adds the 'inputEx-MapField' default className | [
"Adds",
"the",
"inputEx",
"-",
"MapField",
"default",
"className"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/inputex/js/fields/MapField.js#L76-L89 |
|
43,134 | neyric/webhookit | public/javascripts/inputex/js/fields/MapField.js | function() {
if(inputEx.MapFieldsNumber == undefined) { inputEx.MapFieldsNumber = -1; }
inputEx.MapFieldsNumber += 1;
this.apid = this.virtualearth;
if (this.options.api == "virtualearth") {
this.apid = this.virtualearth;
} else if (this.options.api == "google") {
this.apid = this.google;
} else if (this.options.api == "yahoo") {
this.apid = this.yahoo;
} else {
alert("unknown API '" + this.options.api + "': using 'virtualearth'");
}
var id = "inputEx-MapField-"+inputEx.MapFieldsNumber;
var idWrapper = "inputEx-MapFieldWrapper-"+inputEx.MapFieldsNumber;
var idLat = "inputEx-MapFieldLat-"+inputEx.MapFieldsNumber;
var idLon = "inputEx-MapFieldLon-"+inputEx.MapFieldsNumber;
var idUZoom = "inputEx-MapFieldUZoom-"+inputEx.MapFieldsNumber;
var idNZoom = "inputEx-MapFieldNZoom-"+inputEx.MapFieldsNumber;
// the wrapper is needed for Virtual Earth
this.elWrapper = inputEx.cn('div',
{ id: idWrapper, style: "width: " + this.options.width + "; height: " + this.options.height },
null,
null
);
this.fieldContainer.appendChild(this.elWrapper);
this.el = inputEx.cn('div',
{ id: id, style: "position: relative; width: " + this.options.width + "; height: " + this.options.height },
null,
this.options.loading
);
this.elWrapper.appendChild(this.el);
this.elLat = inputEx.cn('input', { id: idLat, type: "hidden", value: this.options.lat });
this.fieldContainer.appendChild(this.elLat);
this.elLon = inputEx.cn('input', { id: idLon, type: "hidden", value: this.options.lon });
this.fieldContainer.appendChild(this.elLon);
this.elUZoom = inputEx.cn('input', { id: idUZoom, type: "hidden", value: this.options.uzoom });
this.fieldContainer.appendChild(this.elUZoom);
this.elNZoom = inputEx.cn('input', { id: idNZoom, type: "hidden", value: this.options.uzoom });
this.fieldContainer.appendChild(this.elNZoom);
if (this.apid.preload(this)) {
return;
} else {
this.wait_create();
}
} | javascript | function() {
if(inputEx.MapFieldsNumber == undefined) { inputEx.MapFieldsNumber = -1; }
inputEx.MapFieldsNumber += 1;
this.apid = this.virtualearth;
if (this.options.api == "virtualearth") {
this.apid = this.virtualearth;
} else if (this.options.api == "google") {
this.apid = this.google;
} else if (this.options.api == "yahoo") {
this.apid = this.yahoo;
} else {
alert("unknown API '" + this.options.api + "': using 'virtualearth'");
}
var id = "inputEx-MapField-"+inputEx.MapFieldsNumber;
var idWrapper = "inputEx-MapFieldWrapper-"+inputEx.MapFieldsNumber;
var idLat = "inputEx-MapFieldLat-"+inputEx.MapFieldsNumber;
var idLon = "inputEx-MapFieldLon-"+inputEx.MapFieldsNumber;
var idUZoom = "inputEx-MapFieldUZoom-"+inputEx.MapFieldsNumber;
var idNZoom = "inputEx-MapFieldNZoom-"+inputEx.MapFieldsNumber;
// the wrapper is needed for Virtual Earth
this.elWrapper = inputEx.cn('div',
{ id: idWrapper, style: "width: " + this.options.width + "; height: " + this.options.height },
null,
null
);
this.fieldContainer.appendChild(this.elWrapper);
this.el = inputEx.cn('div',
{ id: id, style: "position: relative; width: " + this.options.width + "; height: " + this.options.height },
null,
this.options.loading
);
this.elWrapper.appendChild(this.el);
this.elLat = inputEx.cn('input', { id: idLat, type: "hidden", value: this.options.lat });
this.fieldContainer.appendChild(this.elLat);
this.elLon = inputEx.cn('input', { id: idLon, type: "hidden", value: this.options.lon });
this.fieldContainer.appendChild(this.elLon);
this.elUZoom = inputEx.cn('input', { id: idUZoom, type: "hidden", value: this.options.uzoom });
this.fieldContainer.appendChild(this.elUZoom);
this.elNZoom = inputEx.cn('input', { id: idNZoom, type: "hidden", value: this.options.uzoom });
this.fieldContainer.appendChild(this.elNZoom);
if (this.apid.preload(this)) {
return;
} else {
this.wait_create();
}
} | [
"function",
"(",
")",
"{",
"if",
"(",
"inputEx",
".",
"MapFieldsNumber",
"==",
"undefined",
")",
"{",
"inputEx",
".",
"MapFieldsNumber",
"=",
"-",
"1",
";",
"}",
"inputEx",
".",
"MapFieldsNumber",
"+=",
"1",
";",
"this",
".",
"apid",
"=",
"this",
".",
"virtualearth",
";",
"if",
"(",
"this",
".",
"options",
".",
"api",
"==",
"\"virtualearth\"",
")",
"{",
"this",
".",
"apid",
"=",
"this",
".",
"virtualearth",
";",
"}",
"else",
"if",
"(",
"this",
".",
"options",
".",
"api",
"==",
"\"google\"",
")",
"{",
"this",
".",
"apid",
"=",
"this",
".",
"google",
";",
"}",
"else",
"if",
"(",
"this",
".",
"options",
".",
"api",
"==",
"\"yahoo\"",
")",
"{",
"this",
".",
"apid",
"=",
"this",
".",
"yahoo",
";",
"}",
"else",
"{",
"alert",
"(",
"\"unknown API '\"",
"+",
"this",
".",
"options",
".",
"api",
"+",
"\"': using 'virtualearth'\"",
")",
";",
"}",
"var",
"id",
"=",
"\"inputEx-MapField-\"",
"+",
"inputEx",
".",
"MapFieldsNumber",
";",
"var",
"idWrapper",
"=",
"\"inputEx-MapFieldWrapper-\"",
"+",
"inputEx",
".",
"MapFieldsNumber",
";",
"var",
"idLat",
"=",
"\"inputEx-MapFieldLat-\"",
"+",
"inputEx",
".",
"MapFieldsNumber",
";",
"var",
"idLon",
"=",
"\"inputEx-MapFieldLon-\"",
"+",
"inputEx",
".",
"MapFieldsNumber",
";",
"var",
"idUZoom",
"=",
"\"inputEx-MapFieldUZoom-\"",
"+",
"inputEx",
".",
"MapFieldsNumber",
";",
"var",
"idNZoom",
"=",
"\"inputEx-MapFieldNZoom-\"",
"+",
"inputEx",
".",
"MapFieldsNumber",
";",
"// the wrapper is needed for Virtual Earth",
"this",
".",
"elWrapper",
"=",
"inputEx",
".",
"cn",
"(",
"'div'",
",",
"{",
"id",
":",
"idWrapper",
",",
"style",
":",
"\"width: \"",
"+",
"this",
".",
"options",
".",
"width",
"+",
"\"; height: \"",
"+",
"this",
".",
"options",
".",
"height",
"}",
",",
"null",
",",
"null",
")",
";",
"this",
".",
"fieldContainer",
".",
"appendChild",
"(",
"this",
".",
"elWrapper",
")",
";",
"this",
".",
"el",
"=",
"inputEx",
".",
"cn",
"(",
"'div'",
",",
"{",
"id",
":",
"id",
",",
"style",
":",
"\"position: relative; width: \"",
"+",
"this",
".",
"options",
".",
"width",
"+",
"\"; height: \"",
"+",
"this",
".",
"options",
".",
"height",
"}",
",",
"null",
",",
"this",
".",
"options",
".",
"loading",
")",
";",
"this",
".",
"elWrapper",
".",
"appendChild",
"(",
"this",
".",
"el",
")",
";",
"this",
".",
"elLat",
"=",
"inputEx",
".",
"cn",
"(",
"'input'",
",",
"{",
"id",
":",
"idLat",
",",
"type",
":",
"\"hidden\"",
",",
"value",
":",
"this",
".",
"options",
".",
"lat",
"}",
")",
";",
"this",
".",
"fieldContainer",
".",
"appendChild",
"(",
"this",
".",
"elLat",
")",
";",
"this",
".",
"elLon",
"=",
"inputEx",
".",
"cn",
"(",
"'input'",
",",
"{",
"id",
":",
"idLon",
",",
"type",
":",
"\"hidden\"",
",",
"value",
":",
"this",
".",
"options",
".",
"lon",
"}",
")",
";",
"this",
".",
"fieldContainer",
".",
"appendChild",
"(",
"this",
".",
"elLon",
")",
";",
"this",
".",
"elUZoom",
"=",
"inputEx",
".",
"cn",
"(",
"'input'",
",",
"{",
"id",
":",
"idUZoom",
",",
"type",
":",
"\"hidden\"",
",",
"value",
":",
"this",
".",
"options",
".",
"uzoom",
"}",
")",
";",
"this",
".",
"fieldContainer",
".",
"appendChild",
"(",
"this",
".",
"elUZoom",
")",
";",
"this",
".",
"elNZoom",
"=",
"inputEx",
".",
"cn",
"(",
"'input'",
",",
"{",
"id",
":",
"idNZoom",
",",
"type",
":",
"\"hidden\"",
",",
"value",
":",
"this",
".",
"options",
".",
"uzoom",
"}",
")",
";",
"this",
".",
"fieldContainer",
".",
"appendChild",
"(",
"this",
".",
"elNZoom",
")",
";",
"if",
"(",
"this",
".",
"apid",
".",
"preload",
"(",
"this",
")",
")",
"{",
"return",
";",
"}",
"else",
"{",
"this",
".",
"wait_create",
"(",
")",
";",
"}",
"}"
]
| Render the field using the appropriate mapping function | [
"Render",
"the",
"field",
"using",
"the",
"appropriate",
"mapping",
"function"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/inputex/js/fields/MapField.js#L94-L148 |
|
43,135 | neyric/webhookit | public/javascripts/inputex/js/fields/MapField.js | function() {
if (!this.elLat) return {};
return {
lat : parseFloat(this.elLat.value),
lon : parseFloat(this.elLon.value),
uzoom : parseInt(this.elUZoom.value),
nzoom : parseInt(this.elNZoom.value)
};
} | javascript | function() {
if (!this.elLat) return {};
return {
lat : parseFloat(this.elLat.value),
lon : parseFloat(this.elLon.value),
uzoom : parseInt(this.elUZoom.value),
nzoom : parseInt(this.elNZoom.value)
};
} | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"elLat",
")",
"return",
"{",
"}",
";",
"return",
"{",
"lat",
":",
"parseFloat",
"(",
"this",
".",
"elLat",
".",
"value",
")",
",",
"lon",
":",
"parseFloat",
"(",
"this",
".",
"elLon",
".",
"value",
")",
",",
"uzoom",
":",
"parseInt",
"(",
"this",
".",
"elUZoom",
".",
"value",
")",
",",
"nzoom",
":",
"parseInt",
"(",
"this",
".",
"elNZoom",
".",
"value",
")",
"}",
";",
"}"
]
| return the same structure as setValue | [
"return",
"the",
"same",
"structure",
"as",
"setValue"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/inputex/js/fields/MapField.js#L182-L190 |
|
43,136 | neyric/webhookit | public/javascripts/inputex/js/fields/MapField.js | function(_this) {
if (this == window) {
_this.wait_create(_this);
return;
}
if (document.getElementById(this.el.id)) {
this.apid.create(this);
} else {
window.setTimeout(this.wait_create, 0.1, this);
}
} | javascript | function(_this) {
if (this == window) {
_this.wait_create(_this);
return;
}
if (document.getElementById(this.el.id)) {
this.apid.create(this);
} else {
window.setTimeout(this.wait_create, 0.1, this);
}
} | [
"function",
"(",
"_this",
")",
"{",
"if",
"(",
"this",
"==",
"window",
")",
"{",
"_this",
".",
"wait_create",
"(",
"_this",
")",
";",
"return",
";",
"}",
"if",
"(",
"document",
".",
"getElementById",
"(",
"this",
".",
"el",
".",
"id",
")",
")",
"{",
"this",
".",
"apid",
".",
"create",
"(",
"this",
")",
";",
"}",
"else",
"{",
"window",
".",
"setTimeout",
"(",
"this",
".",
"wait_create",
",",
"0.1",
",",
"this",
")",
";",
"}",
"}"
]
| This will wait until the DOM element appears before completion of map rendering | [
"This",
"will",
"wait",
"until",
"the",
"DOM",
"element",
"appears",
"before",
"completion",
"of",
"map",
"rendering"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/inputex/js/fields/MapField.js#L195-L206 |
|
43,137 | neyric/webhookit | public/javascripts/inputex/js/fields/MapField.js | function(superwrapper) {
if (window.VEMap) {
return;
}
var preloader = 'MapVEPreloader_' + inputEx.MapFieldsNumber;
inputEx[preloader] = function() {
superwrapper.wait_create();
};
/*
* Fixes the 'p_elSource.attachEvent is not a function' error
* http://www.google.ca/search?hl=en&q=p_elSource.attachEvent+is+not+a+function&btnG=Google+Search&meta=
*
*/
if (!window.attachEvent) {
var script = document.createElement("script");
script.src = "http://dev.virtualearth.net/mapcontrol/v6.2/js/atlascompat.js";
script.type = "text/javascript";
document.getElementsByTagName("head")[0].appendChild(script);
}
var script = document.createElement("script");
script.src = "http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.2&onScriptLoad=inputEx." + preloader;
script.type = "text/javascript";
document.getElementsByTagName("head")[0].appendChild(script);
return true;
} | javascript | function(superwrapper) {
if (window.VEMap) {
return;
}
var preloader = 'MapVEPreloader_' + inputEx.MapFieldsNumber;
inputEx[preloader] = function() {
superwrapper.wait_create();
};
/*
* Fixes the 'p_elSource.attachEvent is not a function' error
* http://www.google.ca/search?hl=en&q=p_elSource.attachEvent+is+not+a+function&btnG=Google+Search&meta=
*
*/
if (!window.attachEvent) {
var script = document.createElement("script");
script.src = "http://dev.virtualearth.net/mapcontrol/v6.2/js/atlascompat.js";
script.type = "text/javascript";
document.getElementsByTagName("head")[0].appendChild(script);
}
var script = document.createElement("script");
script.src = "http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.2&onScriptLoad=inputEx." + preloader;
script.type = "text/javascript";
document.getElementsByTagName("head")[0].appendChild(script);
return true;
} | [
"function",
"(",
"superwrapper",
")",
"{",
"if",
"(",
"window",
".",
"VEMap",
")",
"{",
"return",
";",
"}",
"var",
"preloader",
"=",
"'MapVEPreloader_'",
"+",
"inputEx",
".",
"MapFieldsNumber",
";",
"inputEx",
"[",
"preloader",
"]",
"=",
"function",
"(",
")",
"{",
"superwrapper",
".",
"wait_create",
"(",
")",
";",
"}",
";",
"/*\n\t\t\t *\tFixes the 'p_elSource.attachEvent is not a function' error\n\t\t \t *\thttp://www.google.ca/search?hl=en&q=p_elSource.attachEvent+is+not+a+function&btnG=Google+Search&meta=\n\t\t\t *\t\n\t\t\t */",
"if",
"(",
"!",
"window",
".",
"attachEvent",
")",
"{",
"var",
"script",
"=",
"document",
".",
"createElement",
"(",
"\"script\"",
")",
";",
"script",
".",
"src",
"=",
"\"http://dev.virtualearth.net/mapcontrol/v6.2/js/atlascompat.js\"",
";",
"script",
".",
"type",
"=",
"\"text/javascript\"",
";",
"document",
".",
"getElementsByTagName",
"(",
"\"head\"",
")",
"[",
"0",
"]",
".",
"appendChild",
"(",
"script",
")",
";",
"}",
"var",
"script",
"=",
"document",
".",
"createElement",
"(",
"\"script\"",
")",
";",
"script",
".",
"src",
"=",
"\"http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.2&onScriptLoad=inputEx.\"",
"+",
"preloader",
";",
"script",
".",
"type",
"=",
"\"text/javascript\"",
";",
"document",
".",
"getElementsByTagName",
"(",
"\"head\"",
")",
"[",
"0",
"]",
".",
"appendChild",
"(",
"script",
")",
";",
"return",
"true",
";",
"}"
]
| If Virtual Earth has not been added via script tag, this
will download it for you
http://soulsolutions.com.au/Blog/tabid/73/EntryID/519/Default.aspx
p_elSource.attachEvent is not a function | [
"If",
"Virtual",
"Earth",
"has",
"not",
"been",
"added",
"via",
"script",
"tag",
"this",
"will",
"download",
"it",
"for",
"you"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/inputex/js/fields/MapField.js#L396-L426 |
|
43,138 | neyric/webhookit | public/javascripts/inputex/js/fields/FileField.js | function(options) {
inputEx.FileField.superclass.setOptions.call(this, options);
this.options.size = options.size;
this.options.accept = options.accept;
} | javascript | function(options) {
inputEx.FileField.superclass.setOptions.call(this, options);
this.options.size = options.size;
this.options.accept = options.accept;
} | [
"function",
"(",
"options",
")",
"{",
"inputEx",
".",
"FileField",
".",
"superclass",
".",
"setOptions",
".",
"call",
"(",
"this",
",",
"options",
")",
";",
"this",
".",
"options",
".",
"size",
"=",
"options",
".",
"size",
";",
"this",
".",
"options",
".",
"accept",
"=",
"options",
".",
"accept",
";",
"}"
]
| Adds size and accept options
@param {Object} options Options object as passed to the constructor | [
"Adds",
"size",
"and",
"accept",
"options"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/inputex/js/fields/FileField.js#L23-L27 |
|
43,139 | neyric/webhookit | public/javascripts/inputex/js/widgets/dtInPlaceEdit.js | function() {
var columndefs = inputEx.widget.dtInPlaceEdit.superclass.setColumnDefs.call(this);
// index fields declaration by keys
var fieldsByKey = {};
for(var k = 0 ; k < this.options.fields.length ; k++) {
// Retro-compatibility with inputParms
if (lang.isObject(this.options.fields[k].inputParams)) {
fieldsByKey[this.options.fields[k].inputParams.name] = this.options.fields[k];
// New prefered way to use options of a field
} else {
fieldsByKey[this.options.fields[k].name] = this.options.fields[k];
}
}
for(var i = 0 ; i < columndefs.length ; i++) {
var columnDef = columndefs[i];
if( YAHOO.lang.isUndefined(columnDef.editor) && !!fieldsByKey[columnDef.key] ) {
columnDef.editor = new inputEx.widget.CellEditor(fieldsByKey[columnDef.key]);
}
}
return columndefs;
} | javascript | function() {
var columndefs = inputEx.widget.dtInPlaceEdit.superclass.setColumnDefs.call(this);
// index fields declaration by keys
var fieldsByKey = {};
for(var k = 0 ; k < this.options.fields.length ; k++) {
// Retro-compatibility with inputParms
if (lang.isObject(this.options.fields[k].inputParams)) {
fieldsByKey[this.options.fields[k].inputParams.name] = this.options.fields[k];
// New prefered way to use options of a field
} else {
fieldsByKey[this.options.fields[k].name] = this.options.fields[k];
}
}
for(var i = 0 ; i < columndefs.length ; i++) {
var columnDef = columndefs[i];
if( YAHOO.lang.isUndefined(columnDef.editor) && !!fieldsByKey[columnDef.key] ) {
columnDef.editor = new inputEx.widget.CellEditor(fieldsByKey[columnDef.key]);
}
}
return columndefs;
} | [
"function",
"(",
")",
"{",
"var",
"columndefs",
"=",
"inputEx",
".",
"widget",
".",
"dtInPlaceEdit",
".",
"superclass",
".",
"setColumnDefs",
".",
"call",
"(",
"this",
")",
";",
"// index fields declaration by keys",
"var",
"fieldsByKey",
"=",
"{",
"}",
";",
"for",
"(",
"var",
"k",
"=",
"0",
";",
"k",
"<",
"this",
".",
"options",
".",
"fields",
".",
"length",
";",
"k",
"++",
")",
"{",
"// Retro-compatibility with inputParms",
"if",
"(",
"lang",
".",
"isObject",
"(",
"this",
".",
"options",
".",
"fields",
"[",
"k",
"]",
".",
"inputParams",
")",
")",
"{",
"fieldsByKey",
"[",
"this",
".",
"options",
".",
"fields",
"[",
"k",
"]",
".",
"inputParams",
".",
"name",
"]",
"=",
"this",
".",
"options",
".",
"fields",
"[",
"k",
"]",
";",
"// New prefered way to use options of a field",
"}",
"else",
"{",
"fieldsByKey",
"[",
"this",
".",
"options",
".",
"fields",
"[",
"k",
"]",
".",
"name",
"]",
"=",
"this",
".",
"options",
".",
"fields",
"[",
"k",
"]",
";",
"}",
"}",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"columndefs",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
"columnDef",
"=",
"columndefs",
"[",
"i",
"]",
";",
"if",
"(",
"YAHOO",
".",
"lang",
".",
"isUndefined",
"(",
"columnDef",
".",
"editor",
")",
"&&",
"!",
"!",
"fieldsByKey",
"[",
"columnDef",
".",
"key",
"]",
")",
"{",
"columnDef",
".",
"editor",
"=",
"new",
"inputEx",
".",
"widget",
".",
"CellEditor",
"(",
"fieldsByKey",
"[",
"columnDef",
".",
"key",
"]",
")",
";",
"}",
"}",
"return",
"columndefs",
";",
"}"
]
| Modify the column definitions to add the inputEx CellEditor | [
"Modify",
"the",
"column",
"definitions",
"to",
"add",
"the",
"inputEx",
"CellEditor"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/inputex/js/widgets/dtInPlaceEdit.js#L67-L91 |
|
43,140 | neyric/webhookit | public/javascripts/inputex/js/widgets/dtInPlaceEdit.js | function(ev, rowIndex) {
// Get a particular CellEditor
var elCell = ev.target, oColumn;
elCell = this.datatable.getTdEl(elCell);
if(elCell) {
oColumn = this.datatable.getColumn(elCell);
if(oColumn && oColumn.editor) {
var oCellEditor = this.datatable._oCellEditor;
// Clean up active CellEditor
if(oCellEditor) {
// Return if field isn't validated
if( !oCellEditor._inputExField.validate() ) {
return;
}
}
}
}
// Only if the cell is inputEx valid
this.datatable.onEventShowCellEditor(ev);
} | javascript | function(ev, rowIndex) {
// Get a particular CellEditor
var elCell = ev.target, oColumn;
elCell = this.datatable.getTdEl(elCell);
if(elCell) {
oColumn = this.datatable.getColumn(elCell);
if(oColumn && oColumn.editor) {
var oCellEditor = this.datatable._oCellEditor;
// Clean up active CellEditor
if(oCellEditor) {
// Return if field isn't validated
if( !oCellEditor._inputExField.validate() ) {
return;
}
}
}
}
// Only if the cell is inputEx valid
this.datatable.onEventShowCellEditor(ev);
} | [
"function",
"(",
"ev",
",",
"rowIndex",
")",
"{",
"// Get a particular CellEditor",
"var",
"elCell",
"=",
"ev",
".",
"target",
",",
"oColumn",
";",
"elCell",
"=",
"this",
".",
"datatable",
".",
"getTdEl",
"(",
"elCell",
")",
";",
"if",
"(",
"elCell",
")",
"{",
"oColumn",
"=",
"this",
".",
"datatable",
".",
"getColumn",
"(",
"elCell",
")",
";",
"if",
"(",
"oColumn",
"&&",
"oColumn",
".",
"editor",
")",
"{",
"var",
"oCellEditor",
"=",
"this",
".",
"datatable",
".",
"_oCellEditor",
";",
"// Clean up active CellEditor",
"if",
"(",
"oCellEditor",
")",
"{",
"// Return if field isn't validated",
"if",
"(",
"!",
"oCellEditor",
".",
"_inputExField",
".",
"validate",
"(",
")",
")",
"{",
"return",
";",
"}",
"}",
"}",
"}",
"// Only if the cell is inputEx valid",
"this",
".",
"datatable",
".",
"onEventShowCellEditor",
"(",
"ev",
")",
";",
"}"
]
| Public handler - When clicking on one of the datatable's cells | [
"Public",
"handler",
"-",
"When",
"clicking",
"on",
"one",
"of",
"the",
"datatable",
"s",
"cells"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/inputex/js/widgets/dtInPlaceEdit.js#L113-L135 |
|
43,141 | neyric/webhookit | public/javascripts/inputex/js/widgets/dtInPlaceEdit.js | function(record,target){
var targetNode = target.childNodes[0];
// Only if the row has an id && isn't already being removed
if( !lang.isUndefined(record.getData('id')) && this.deleteLinkNode != targetNode ){
if (confirm(inputEx.messages.confirmDeletion)) {
this.deleteLinkNode = targetNode;
this.deleteLinkNode.innerHTML = '';
Dom.addClass(this.deleteLinkNode,'inputEx-dtInPlaceEdit-deleteLinkSpinner');
this.itemRemovedEvt.fire( record );
}
}
} | javascript | function(record,target){
var targetNode = target.childNodes[0];
// Only if the row has an id && isn't already being removed
if( !lang.isUndefined(record.getData('id')) && this.deleteLinkNode != targetNode ){
if (confirm(inputEx.messages.confirmDeletion)) {
this.deleteLinkNode = targetNode;
this.deleteLinkNode.innerHTML = '';
Dom.addClass(this.deleteLinkNode,'inputEx-dtInPlaceEdit-deleteLinkSpinner');
this.itemRemovedEvt.fire( record );
}
}
} | [
"function",
"(",
"record",
",",
"target",
")",
"{",
"var",
"targetNode",
"=",
"target",
".",
"childNodes",
"[",
"0",
"]",
";",
"// Only if the row has an id && isn't already being removed",
"if",
"(",
"!",
"lang",
".",
"isUndefined",
"(",
"record",
".",
"getData",
"(",
"'id'",
")",
")",
"&&",
"this",
".",
"deleteLinkNode",
"!=",
"targetNode",
")",
"{",
"if",
"(",
"confirm",
"(",
"inputEx",
".",
"messages",
".",
"confirmDeletion",
")",
")",
"{",
"this",
".",
"deleteLinkNode",
"=",
"targetNode",
";",
"this",
".",
"deleteLinkNode",
".",
"innerHTML",
"=",
"''",
";",
"Dom",
".",
"addClass",
"(",
"this",
".",
"deleteLinkNode",
",",
"'inputEx-dtInPlaceEdit-deleteLinkSpinner'",
")",
";",
"this",
".",
"itemRemovedEvt",
".",
"fire",
"(",
"record",
")",
";",
"}",
"}",
"}"
]
| When trying to delete a row | [
"When",
"trying",
"to",
"delete",
"a",
"row"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/inputex/js/widgets/dtInPlaceEdit.js#L140-L153 |
|
43,142 | neyric/webhookit | public/javascripts/inputex/js/widgets/dtInPlaceEdit.js | function(){
this.deleteLinkNode.innerHTML = inputEx.messages.deleteText;
Dom.removeClass(this.deleteLinkNode,'inputEx-dtInPlaceEdit-deleteLinkSpinner');
this.deleteLinkNode = null;
} | javascript | function(){
this.deleteLinkNode.innerHTML = inputEx.messages.deleteText;
Dom.removeClass(this.deleteLinkNode,'inputEx-dtInPlaceEdit-deleteLinkSpinner');
this.deleteLinkNode = null;
} | [
"function",
"(",
")",
"{",
"this",
".",
"deleteLinkNode",
".",
"innerHTML",
"=",
"inputEx",
".",
"messages",
".",
"deleteText",
";",
"Dom",
".",
"removeClass",
"(",
"this",
".",
"deleteLinkNode",
",",
"'inputEx-dtInPlaceEdit-deleteLinkSpinner'",
")",
";",
"this",
".",
"deleteLinkNode",
"=",
"null",
";",
"}"
]
| When failed to delete a row | [
"When",
"failed",
"to",
"delete",
"a",
"row"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/inputex/js/widgets/dtInPlaceEdit.js#L165-L169 |
|
43,143 | neyric/webhookit | public/javascripts/inputex/js/widgets/dtInPlaceEdit.js | function(e) {
// If insertWithDialog
if(this.options.insertWithDialog) {
inputEx.widget.dtInPlaceEdit.superclass.onInsertButton.call(this, e);
return;
}
var tbl = this.datatable;
// Insert a new row
tbl.addRow({});
// Select the new row
var lastRow = tbl.getLastTrEl();
tbl.selectRow(lastRow);
// Get the last cell's inner div node
var lastIndex = lastRow.childNodes.length - 1;
lastCell = lastRow.childNodes[lastIndex].childNodes[0];
// Empty the cell (removing "delete")
lastCell.innerHTML = '';
// Create an "Add" Button
this.addButton = inputEx.cn('input', {type:'button',value:inputEx.messages.addButtonText}, null, null);
Event.addListener(this.addButton, 'click', this.onAddButton, this, true);
lastCell.appendChild(this.addButton);
// Create a "Cancel" Button
this.deleteButton = inputEx.cn('input', {type:'button',value:inputEx.messages.cancelText}, null, null);
Event.addListener(this.deleteButton, 'click', this.onCancelButton, this, true);
lastCell.appendChild(this.deleteButton);
// Disable the "Insert Button"
this.insertButton.disabled = true ;
} | javascript | function(e) {
// If insertWithDialog
if(this.options.insertWithDialog) {
inputEx.widget.dtInPlaceEdit.superclass.onInsertButton.call(this, e);
return;
}
var tbl = this.datatable;
// Insert a new row
tbl.addRow({});
// Select the new row
var lastRow = tbl.getLastTrEl();
tbl.selectRow(lastRow);
// Get the last cell's inner div node
var lastIndex = lastRow.childNodes.length - 1;
lastCell = lastRow.childNodes[lastIndex].childNodes[0];
// Empty the cell (removing "delete")
lastCell.innerHTML = '';
// Create an "Add" Button
this.addButton = inputEx.cn('input', {type:'button',value:inputEx.messages.addButtonText}, null, null);
Event.addListener(this.addButton, 'click', this.onAddButton, this, true);
lastCell.appendChild(this.addButton);
// Create a "Cancel" Button
this.deleteButton = inputEx.cn('input', {type:'button',value:inputEx.messages.cancelText}, null, null);
Event.addListener(this.deleteButton, 'click', this.onCancelButton, this, true);
lastCell.appendChild(this.deleteButton);
// Disable the "Insert Button"
this.insertButton.disabled = true ;
} | [
"function",
"(",
"e",
")",
"{",
"// If insertWithDialog",
"if",
"(",
"this",
".",
"options",
".",
"insertWithDialog",
")",
"{",
"inputEx",
".",
"widget",
".",
"dtInPlaceEdit",
".",
"superclass",
".",
"onInsertButton",
".",
"call",
"(",
"this",
",",
"e",
")",
";",
"return",
";",
"}",
"var",
"tbl",
"=",
"this",
".",
"datatable",
";",
"// Insert a new row",
"tbl",
".",
"addRow",
"(",
"{",
"}",
")",
";",
"// Select the new row",
"var",
"lastRow",
"=",
"tbl",
".",
"getLastTrEl",
"(",
")",
";",
"tbl",
".",
"selectRow",
"(",
"lastRow",
")",
";",
"// Get the last cell's inner div node",
"var",
"lastIndex",
"=",
"lastRow",
".",
"childNodes",
".",
"length",
"-",
"1",
";",
"lastCell",
"=",
"lastRow",
".",
"childNodes",
"[",
"lastIndex",
"]",
".",
"childNodes",
"[",
"0",
"]",
";",
"// Empty the cell (removing \"delete\")",
"lastCell",
".",
"innerHTML",
"=",
"''",
";",
"// Create an \"Add\" Button",
"this",
".",
"addButton",
"=",
"inputEx",
".",
"cn",
"(",
"'input'",
",",
"{",
"type",
":",
"'button'",
",",
"value",
":",
"inputEx",
".",
"messages",
".",
"addButtonText",
"}",
",",
"null",
",",
"null",
")",
";",
"Event",
".",
"addListener",
"(",
"this",
".",
"addButton",
",",
"'click'",
",",
"this",
".",
"onAddButton",
",",
"this",
",",
"true",
")",
";",
"lastCell",
".",
"appendChild",
"(",
"this",
".",
"addButton",
")",
";",
"// Create a \"Cancel\" Button",
"this",
".",
"deleteButton",
"=",
"inputEx",
".",
"cn",
"(",
"'input'",
",",
"{",
"type",
":",
"'button'",
",",
"value",
":",
"inputEx",
".",
"messages",
".",
"cancelText",
"}",
",",
"null",
",",
"null",
")",
";",
"Event",
".",
"addListener",
"(",
"this",
".",
"deleteButton",
",",
"'click'",
",",
"this",
".",
"onCancelButton",
",",
"this",
",",
"true",
")",
";",
"lastCell",
".",
"appendChild",
"(",
"this",
".",
"deleteButton",
")",
";",
"// Disable the \"Insert Button\"",
"this",
".",
"insertButton",
".",
"disabled",
"=",
"true",
";",
"}"
]
| When clicking on the "insert" button to add a new row | [
"When",
"clicking",
"on",
"the",
"insert",
"button",
"to",
"add",
"a",
"new",
"row"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/inputex/js/widgets/dtInPlaceEdit.js#L174-L210 |
|
43,144 | neyric/webhookit | public/javascripts/inputex/js/widgets/dtInPlaceEdit.js | function(e) {
Event.stopEvent(e);
var target = Event.getTarget(e),
record = this.datatable.getRecord(target),
field, requiredFields = [];
for(var i=0, fieldsLength = this.options.fields.length; i<fieldsLength; i++){
field = this.options.fields[i];
// Retro-compatibility with inputParms
if (lang.isObject(field.inputParams)) {
if( !lang.isUndefined(field.inputParams.required) ){
if( lang.isUndefined(record.getData(field.inputParams.name)) ){
requiredFields.push(field.inputParams.label);
}
}
// New prefered way to set options of a field
} else {
if( !lang.isUndefined(field.required) ){
if( lang.isUndefined(record.getData(field.name)) ){
requiredFields.push(field.label);
}
}
}
}
//If not all the required fields are set
if(requiredFields.length > 0){
this.requiredFieldsEvt.fire(requiredFields);
return;
}
this.addButton.value = inputEx.messages.loadingText;
this.addButton.disabled = true;
this.itemAddedEvt.fire(record);
} | javascript | function(e) {
Event.stopEvent(e);
var target = Event.getTarget(e),
record = this.datatable.getRecord(target),
field, requiredFields = [];
for(var i=0, fieldsLength = this.options.fields.length; i<fieldsLength; i++){
field = this.options.fields[i];
// Retro-compatibility with inputParms
if (lang.isObject(field.inputParams)) {
if( !lang.isUndefined(field.inputParams.required) ){
if( lang.isUndefined(record.getData(field.inputParams.name)) ){
requiredFields.push(field.inputParams.label);
}
}
// New prefered way to set options of a field
} else {
if( !lang.isUndefined(field.required) ){
if( lang.isUndefined(record.getData(field.name)) ){
requiredFields.push(field.label);
}
}
}
}
//If not all the required fields are set
if(requiredFields.length > 0){
this.requiredFieldsEvt.fire(requiredFields);
return;
}
this.addButton.value = inputEx.messages.loadingText;
this.addButton.disabled = true;
this.itemAddedEvt.fire(record);
} | [
"function",
"(",
"e",
")",
"{",
"Event",
".",
"stopEvent",
"(",
"e",
")",
";",
"var",
"target",
"=",
"Event",
".",
"getTarget",
"(",
"e",
")",
",",
"record",
"=",
"this",
".",
"datatable",
".",
"getRecord",
"(",
"target",
")",
",",
"field",
",",
"requiredFields",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"fieldsLength",
"=",
"this",
".",
"options",
".",
"fields",
".",
"length",
";",
"i",
"<",
"fieldsLength",
";",
"i",
"++",
")",
"{",
"field",
"=",
"this",
".",
"options",
".",
"fields",
"[",
"i",
"]",
";",
"// Retro-compatibility with inputParms",
"if",
"(",
"lang",
".",
"isObject",
"(",
"field",
".",
"inputParams",
")",
")",
"{",
"if",
"(",
"!",
"lang",
".",
"isUndefined",
"(",
"field",
".",
"inputParams",
".",
"required",
")",
")",
"{",
"if",
"(",
"lang",
".",
"isUndefined",
"(",
"record",
".",
"getData",
"(",
"field",
".",
"inputParams",
".",
"name",
")",
")",
")",
"{",
"requiredFields",
".",
"push",
"(",
"field",
".",
"inputParams",
".",
"label",
")",
";",
"}",
"}",
"// New prefered way to set options of a field",
"}",
"else",
"{",
"if",
"(",
"!",
"lang",
".",
"isUndefined",
"(",
"field",
".",
"required",
")",
")",
"{",
"if",
"(",
"lang",
".",
"isUndefined",
"(",
"record",
".",
"getData",
"(",
"field",
".",
"name",
")",
")",
")",
"{",
"requiredFields",
".",
"push",
"(",
"field",
".",
"label",
")",
";",
"}",
"}",
"}",
"}",
"//If not all the required fields are set",
"if",
"(",
"requiredFields",
".",
"length",
">",
"0",
")",
"{",
"this",
".",
"requiredFieldsEvt",
".",
"fire",
"(",
"requiredFields",
")",
";",
"return",
";",
"}",
"this",
".",
"addButton",
".",
"value",
"=",
"inputEx",
".",
"messages",
".",
"loadingText",
";",
"this",
".",
"addButton",
".",
"disabled",
"=",
"true",
";",
"this",
".",
"itemAddedEvt",
".",
"fire",
"(",
"record",
")",
";",
"}"
]
| When clicking "Add" button to save a new row | [
"When",
"clicking",
"Add",
"button",
"to",
"save",
"a",
"new",
"row"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/inputex/js/widgets/dtInPlaceEdit.js#L245-L285 |
|
43,145 | neyric/webhookit | public/javascripts/inputex/js/widgets/dtInPlaceEdit.js | function(e) {
Event.stopEvent(e);
var target = Event.getTarget(e);
this.datatable.deleteRow(target);
this.insertButton.disabled = false ;
} | javascript | function(e) {
Event.stopEvent(e);
var target = Event.getTarget(e);
this.datatable.deleteRow(target);
this.insertButton.disabled = false ;
} | [
"function",
"(",
"e",
")",
"{",
"Event",
".",
"stopEvent",
"(",
"e",
")",
";",
"var",
"target",
"=",
"Event",
".",
"getTarget",
"(",
"e",
")",
";",
"this",
".",
"datatable",
".",
"deleteRow",
"(",
"target",
")",
";",
"this",
".",
"insertButton",
".",
"disabled",
"=",
"false",
";",
"}"
]
| When clicking "Cancel" button to cancel a new row | [
"When",
"clicking",
"Cancel",
"button",
"to",
"cancel",
"a",
"new",
"row"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/inputex/js/widgets/dtInPlaceEdit.js#L290-L295 |
|
43,146 | neyric/webhookit | public/javascripts/inputex/js/widgets/dtInPlaceEdit.js | function(){
if(this.options.insertWithDialog) {
this.datatable.deleteRow(this.selectedRecord);
return;
}
this.addButton.value = inputEx.messages.addButtonText;
this.addButton.disabled = false;
} | javascript | function(){
if(this.options.insertWithDialog) {
this.datatable.deleteRow(this.selectedRecord);
return;
}
this.addButton.value = inputEx.messages.addButtonText;
this.addButton.disabled = false;
} | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"options",
".",
"insertWithDialog",
")",
"{",
"this",
".",
"datatable",
".",
"deleteRow",
"(",
"this",
".",
"selectedRecord",
")",
";",
"return",
";",
"}",
"this",
".",
"addButton",
".",
"value",
"=",
"inputEx",
".",
"messages",
".",
"addButtonText",
";",
"this",
".",
"addButton",
".",
"disabled",
"=",
"false",
";",
"}"
]
| When Failed to Add Row | [
"When",
"Failed",
"to",
"Add",
"Row"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/inputex/js/widgets/dtInPlaceEdit.js#L327-L336 |
|
43,147 | neyric/webhookit | public/javascripts/inputex/js/widgets/dtInPlaceEdit.js | function(record, oArgs){
var itemContainer = oArgs.editor.getTdEl().childNodes[0];
// Add CSS
Dom.addClass(itemContainer, "inputEx-dtInPlaceEdit-onModifyItem");
this.itemModifiedEvt.fire(record);
} | javascript | function(record, oArgs){
var itemContainer = oArgs.editor.getTdEl().childNodes[0];
// Add CSS
Dom.addClass(itemContainer, "inputEx-dtInPlaceEdit-onModifyItem");
this.itemModifiedEvt.fire(record);
} | [
"function",
"(",
"record",
",",
"oArgs",
")",
"{",
"var",
"itemContainer",
"=",
"oArgs",
".",
"editor",
".",
"getTdEl",
"(",
")",
".",
"childNodes",
"[",
"0",
"]",
";",
"// Add CSS",
"Dom",
".",
"addClass",
"(",
"itemContainer",
",",
"\"inputEx-dtInPlaceEdit-onModifyItem\"",
")",
";",
"this",
".",
"itemModifiedEvt",
".",
"fire",
"(",
"record",
")",
";",
"}"
]
| When modifying a row | [
"When",
"modifying",
"a",
"row"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/inputex/js/widgets/dtInPlaceEdit.js#L341-L346 |
|
43,148 | neyric/webhookit | public/javascripts/inputex/js/widgets/dtInPlaceEdit.js | function(record, oData) {
var nodes = this.datatable.getElementsByClassName("inputEx-dtInPlaceEdit-onModifyItem");
// Remove CSS
for(i=0,nodesLength = nodes.length; i<nodesLength; i++){
Dom.removeClass(nodes[i], "inputEx-dtInPlaceEdit-onModifyItem");
}
// If we want to update additional columns
if( !lang.isUndefined(oData) ) {
// Update Row with new record
this.datatable.updateRow(record, oData);
}
} | javascript | function(record, oData) {
var nodes = this.datatable.getElementsByClassName("inputEx-dtInPlaceEdit-onModifyItem");
// Remove CSS
for(i=0,nodesLength = nodes.length; i<nodesLength; i++){
Dom.removeClass(nodes[i], "inputEx-dtInPlaceEdit-onModifyItem");
}
// If we want to update additional columns
if( !lang.isUndefined(oData) ) {
// Update Row with new record
this.datatable.updateRow(record, oData);
}
} | [
"function",
"(",
"record",
",",
"oData",
")",
"{",
"var",
"nodes",
"=",
"this",
".",
"datatable",
".",
"getElementsByClassName",
"(",
"\"inputEx-dtInPlaceEdit-onModifyItem\"",
")",
";",
"// Remove CSS",
"for",
"(",
"i",
"=",
"0",
",",
"nodesLength",
"=",
"nodes",
".",
"length",
";",
"i",
"<",
"nodesLength",
";",
"i",
"++",
")",
"{",
"Dom",
".",
"removeClass",
"(",
"nodes",
"[",
"i",
"]",
",",
"\"inputEx-dtInPlaceEdit-onModifyItem\"",
")",
";",
"}",
"// If we want to update additional columns",
"if",
"(",
"!",
"lang",
".",
"isUndefined",
"(",
"oData",
")",
")",
"{",
"// Update Row with new record",
"this",
".",
"datatable",
".",
"updateRow",
"(",
"record",
",",
"oData",
")",
";",
"}",
"}"
]
| When successfully modified a row | [
"When",
"successfully",
"modified",
"a",
"row"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/inputex/js/widgets/dtInPlaceEdit.js#L351-L365 |
|
43,149 | neyric/webhookit | public/javascripts/inputex/js/widgets/dtInPlaceEdit.js | function() {
// Build the inputEx field
this._inputExField = inputEx(this._inputExFieldDef);
this.getContainerEl().appendChild(this._inputExField.getEl());
// Locals for Save/Cancel Buttons
this.LABEL_SAVE = inputEx.messages.saveText;
this.LABEL_CANCEL = inputEx.messages.cancelText;
} | javascript | function() {
// Build the inputEx field
this._inputExField = inputEx(this._inputExFieldDef);
this.getContainerEl().appendChild(this._inputExField.getEl());
// Locals for Save/Cancel Buttons
this.LABEL_SAVE = inputEx.messages.saveText;
this.LABEL_CANCEL = inputEx.messages.cancelText;
} | [
"function",
"(",
")",
"{",
"// Build the inputEx field",
"this",
".",
"_inputExField",
"=",
"inputEx",
"(",
"this",
".",
"_inputExFieldDef",
")",
";",
"this",
".",
"getContainerEl",
"(",
")",
".",
"appendChild",
"(",
"this",
".",
"_inputExField",
".",
"getEl",
"(",
")",
")",
";",
"// Locals for Save/Cancel Buttons",
"this",
".",
"LABEL_SAVE",
"=",
"inputEx",
".",
"messages",
".",
"saveText",
";",
"this",
".",
"LABEL_CANCEL",
"=",
"inputEx",
".",
"messages",
".",
"cancelText",
";",
"}"
]
| Render the inputEx field editor | [
"Render",
"the",
"inputEx",
"field",
"editor"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/inputex/js/widgets/dtInPlaceEdit.js#L395-L403 |
|
43,150 | neyric/webhookit | public/javascripts/yui/selector/selector-debug.js | function(selector) {
var token = {}, // one token per simple selector (left selector holds combinator)
tokens = [], // array of tokens
id, // unique id for the simple selector (if found)
found = false, // whether or not any matches were found this pass
patterns = Y.Selector._patterns,
match; // the regex match
selector = Y.Selector._replaceShorthand(selector); // convert ID and CLASS shortcuts to attributes
/*
Search for selector patterns, store, and strip them from the selector string
until no patterns match (invalid selector) or we run out of chars.
Multiple attributes and pseudos are allowed, in any order.
for example:
'form:first-child[type=button]:not(button)[lang|=en]'
*/
do {
found = false; // reset after full pass
for (var re in patterns) {
if (YAHOO.lang.hasOwnProperty(patterns, re)) {
if (re != 'tag' && re != 'combinator') { // only one allowed
token[re] = token[re] || [];
}
if ( (match = patterns[re].exec(selector)) ) { // note assignment
found = true;
if (re != 'tag' && re != 'combinator') { // only one allowed
// capture ID for fast path to element
if (re === 'attributes' && match[1] === 'id') {
token.id = match[3];
}
token[re].push(match.slice(1));
} else { // single selector (tag, combinator)
token[re] = match[1];
}
selector = selector.replace(match[0], ''); // strip current match from selector
if (re === 'combinator' || !selector.length) { // next token or done
token.attributes = Y.Selector._fixAttributes(token.attributes);
token.pseudos = token.pseudos || [];
token.tag = token.tag ? token.tag.toUpperCase() : '*';
tokens.push(token);
token = { // prep next token
previous: token
};
}
}
}
}
} while (found);
return tokens;
} | javascript | function(selector) {
var token = {}, // one token per simple selector (left selector holds combinator)
tokens = [], // array of tokens
id, // unique id for the simple selector (if found)
found = false, // whether or not any matches were found this pass
patterns = Y.Selector._patterns,
match; // the regex match
selector = Y.Selector._replaceShorthand(selector); // convert ID and CLASS shortcuts to attributes
/*
Search for selector patterns, store, and strip them from the selector string
until no patterns match (invalid selector) or we run out of chars.
Multiple attributes and pseudos are allowed, in any order.
for example:
'form:first-child[type=button]:not(button)[lang|=en]'
*/
do {
found = false; // reset after full pass
for (var re in patterns) {
if (YAHOO.lang.hasOwnProperty(patterns, re)) {
if (re != 'tag' && re != 'combinator') { // only one allowed
token[re] = token[re] || [];
}
if ( (match = patterns[re].exec(selector)) ) { // note assignment
found = true;
if (re != 'tag' && re != 'combinator') { // only one allowed
// capture ID for fast path to element
if (re === 'attributes' && match[1] === 'id') {
token.id = match[3];
}
token[re].push(match.slice(1));
} else { // single selector (tag, combinator)
token[re] = match[1];
}
selector = selector.replace(match[0], ''); // strip current match from selector
if (re === 'combinator' || !selector.length) { // next token or done
token.attributes = Y.Selector._fixAttributes(token.attributes);
token.pseudos = token.pseudos || [];
token.tag = token.tag ? token.tag.toUpperCase() : '*';
tokens.push(token);
token = { // prep next token
previous: token
};
}
}
}
}
} while (found);
return tokens;
} | [
"function",
"(",
"selector",
")",
"{",
"var",
"token",
"=",
"{",
"}",
",",
"// one token per simple selector (left selector holds combinator)",
"tokens",
"=",
"[",
"]",
",",
"// array of tokens",
"id",
",",
"// unique id for the simple selector (if found)",
"found",
"=",
"false",
",",
"// whether or not any matches were found this pass",
"patterns",
"=",
"Y",
".",
"Selector",
".",
"_patterns",
",",
"match",
";",
"// the regex match",
"selector",
"=",
"Y",
".",
"Selector",
".",
"_replaceShorthand",
"(",
"selector",
")",
";",
"// convert ID and CLASS shortcuts to attributes",
"/*\n Search for selector patterns, store, and strip them from the selector string\n until no patterns match (invalid selector) or we run out of chars.\n\n Multiple attributes and pseudos are allowed, in any order.\n for example:\n 'form:first-child[type=button]:not(button)[lang|=en]'\n */",
"do",
"{",
"found",
"=",
"false",
";",
"// reset after full pass",
"for",
"(",
"var",
"re",
"in",
"patterns",
")",
"{",
"if",
"(",
"YAHOO",
".",
"lang",
".",
"hasOwnProperty",
"(",
"patterns",
",",
"re",
")",
")",
"{",
"if",
"(",
"re",
"!=",
"'tag'",
"&&",
"re",
"!=",
"'combinator'",
")",
"{",
"// only one allowed",
"token",
"[",
"re",
"]",
"=",
"token",
"[",
"re",
"]",
"||",
"[",
"]",
";",
"}",
"if",
"(",
"(",
"match",
"=",
"patterns",
"[",
"re",
"]",
".",
"exec",
"(",
"selector",
")",
")",
")",
"{",
"// note assignment",
"found",
"=",
"true",
";",
"if",
"(",
"re",
"!=",
"'tag'",
"&&",
"re",
"!=",
"'combinator'",
")",
"{",
"// only one allowed",
"// capture ID for fast path to element",
"if",
"(",
"re",
"===",
"'attributes'",
"&&",
"match",
"[",
"1",
"]",
"===",
"'id'",
")",
"{",
"token",
".",
"id",
"=",
"match",
"[",
"3",
"]",
";",
"}",
"token",
"[",
"re",
"]",
".",
"push",
"(",
"match",
".",
"slice",
"(",
"1",
")",
")",
";",
"}",
"else",
"{",
"// single selector (tag, combinator)",
"token",
"[",
"re",
"]",
"=",
"match",
"[",
"1",
"]",
";",
"}",
"selector",
"=",
"selector",
".",
"replace",
"(",
"match",
"[",
"0",
"]",
",",
"''",
")",
";",
"// strip current match from selector",
"if",
"(",
"re",
"===",
"'combinator'",
"||",
"!",
"selector",
".",
"length",
")",
"{",
"// next token or done",
"token",
".",
"attributes",
"=",
"Y",
".",
"Selector",
".",
"_fixAttributes",
"(",
"token",
".",
"attributes",
")",
";",
"token",
".",
"pseudos",
"=",
"token",
".",
"pseudos",
"||",
"[",
"]",
";",
"token",
".",
"tag",
"=",
"token",
".",
"tag",
"?",
"token",
".",
"tag",
".",
"toUpperCase",
"(",
")",
":",
"'*'",
";",
"tokens",
".",
"push",
"(",
"token",
")",
";",
"token",
"=",
"{",
"// prep next token",
"previous",
":",
"token",
"}",
";",
"}",
"}",
"}",
"}",
"}",
"while",
"(",
"found",
")",
";",
"return",
"tokens",
";",
"}"
]
| Break selector into token units per simple selector.
Combinator is attached to left-hand selector. | [
"Break",
"selector",
"into",
"token",
"units",
"per",
"simple",
"selector",
".",
"Combinator",
"is",
"attached",
"to",
"left",
"-",
"hand",
"selector",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/selector/selector-debug.js#L551-L605 |
|
43,151 | neyric/webhookit | public/javascripts/WireIt/js/CanvasContainer.js | function() {
WireIt.CanvasContainer.superclass.render.call(this);
this.canvasEl = new WireIt.CanvasElement(this.bodyEl);
this.canvasEl.SetCanvasRegion(0,0, this.width, this.height );
this.canvasWidth = this.width;
this.canvasHeight = this.height;
this.drawCanvas();
} | javascript | function() {
WireIt.CanvasContainer.superclass.render.call(this);
this.canvasEl = new WireIt.CanvasElement(this.bodyEl);
this.canvasEl.SetCanvasRegion(0,0, this.width, this.height );
this.canvasWidth = this.width;
this.canvasHeight = this.height;
this.drawCanvas();
} | [
"function",
"(",
")",
"{",
"WireIt",
".",
"CanvasContainer",
".",
"superclass",
".",
"render",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"canvasEl",
"=",
"new",
"WireIt",
".",
"CanvasElement",
"(",
"this",
".",
"bodyEl",
")",
";",
"this",
".",
"canvasEl",
".",
"SetCanvasRegion",
"(",
"0",
",",
"0",
",",
"this",
".",
"width",
",",
"this",
".",
"height",
")",
";",
"this",
".",
"canvasWidth",
"=",
"this",
".",
"width",
";",
"this",
".",
"canvasHeight",
"=",
"this",
".",
"height",
";",
"this",
".",
"drawCanvas",
"(",
")",
";",
"}"
]
| Add the image property as a background image for the container
@method render | [
"Add",
"the",
"image",
"property",
"as",
"a",
"background",
"image",
"for",
"the",
"container"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/WireIt/js/CanvasContainer.js#L61-L69 |
|
43,152 | neyric/webhookit | public/javascripts/WireIt/js/CanvasContainer.js | function(event, args) {
WireIt.CanvasContainer.superclass.onResize.call(this, event, args);
var size = args[0];
// resize the canvas
// TODO: do not hardcode those sizes !!
this.canvasWidth = (size[0]-14);
this.canvasHeight = (size[1]-( this.ddHandle ? 44 : 14) );
this.canvasEl.SetCanvasRegion(0,0, this.canvasWidth, this.canvasHeight );
this.drawCanvas();
} | javascript | function(event, args) {
WireIt.CanvasContainer.superclass.onResize.call(this, event, args);
var size = args[0];
// resize the canvas
// TODO: do not hardcode those sizes !!
this.canvasWidth = (size[0]-14);
this.canvasHeight = (size[1]-( this.ddHandle ? 44 : 14) );
this.canvasEl.SetCanvasRegion(0,0, this.canvasWidth, this.canvasHeight );
this.drawCanvas();
} | [
"function",
"(",
"event",
",",
"args",
")",
"{",
"WireIt",
".",
"CanvasContainer",
".",
"superclass",
".",
"onResize",
".",
"call",
"(",
"this",
",",
"event",
",",
"args",
")",
";",
"var",
"size",
"=",
"args",
"[",
"0",
"]",
";",
"// resize the canvas",
"// TODO: do not hardcode those sizes !!",
"this",
".",
"canvasWidth",
"=",
"(",
"size",
"[",
"0",
"]",
"-",
"14",
")",
";",
"this",
".",
"canvasHeight",
"=",
"(",
"size",
"[",
"1",
"]",
"-",
"(",
"this",
".",
"ddHandle",
"?",
"44",
":",
"14",
")",
")",
";",
"this",
".",
"canvasEl",
".",
"SetCanvasRegion",
"(",
"0",
",",
"0",
",",
"this",
".",
"canvasWidth",
",",
"this",
".",
"canvasHeight",
")",
";",
"this",
".",
"drawCanvas",
"(",
")",
";",
"}"
]
| On resize, resize the canvas element and redraw it | [
"On",
"resize",
"resize",
"the",
"canvas",
"element",
"and",
"redraw",
"it"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/WireIt/js/CanvasContainer.js#L74-L87 |
|
43,153 | neyric/webhookit | public/javascripts/WireIt/js/CanvasContainer.js | function() {
var ctx = this.canvasEl.getContext('2d');
ctx.strokeStyle = "#5B81AD";
ctx.lineWidth= 2;
ctx.save();
ctx.translate( this.canvasWidth/2, this.canvasHeight/2);
ctx.scale(this.canvasWidth/2-5, this.canvasHeight/2-5);
ctx.arc(0, 0, 1, 0, 2*Math.PI, false);
ctx.restore(); // restore so stroke() isn’t scaled
ctx.stroke();
ctx.fillStyle = "#DCE6F2";
ctx.fill();
} | javascript | function() {
var ctx = this.canvasEl.getContext('2d');
ctx.strokeStyle = "#5B81AD";
ctx.lineWidth= 2;
ctx.save();
ctx.translate( this.canvasWidth/2, this.canvasHeight/2);
ctx.scale(this.canvasWidth/2-5, this.canvasHeight/2-5);
ctx.arc(0, 0, 1, 0, 2*Math.PI, false);
ctx.restore(); // restore so stroke() isn’t scaled
ctx.stroke();
ctx.fillStyle = "#DCE6F2";
ctx.fill();
} | [
"function",
"(",
")",
"{",
"var",
"ctx",
"=",
"this",
".",
"canvasEl",
".",
"getContext",
"(",
"'2d'",
")",
";",
"ctx",
".",
"strokeStyle",
"=",
"\"#5B81AD\"",
";",
"ctx",
".",
"lineWidth",
"=",
"2",
";",
"ctx",
".",
"save",
"(",
")",
";",
"ctx",
".",
"translate",
"(",
"this",
".",
"canvasWidth",
"/",
"2",
",",
"this",
".",
"canvasHeight",
"/",
"2",
")",
";",
"ctx",
".",
"scale",
"(",
"this",
".",
"canvasWidth",
"/",
"2",
"-",
"5",
",",
"this",
".",
"canvasHeight",
"/",
"2",
"-",
"5",
")",
";",
"ctx",
".",
"arc",
"(",
"0",
",",
"0",
",",
"1",
",",
"0",
",",
"2",
"*",
"Math",
".",
"PI",
",",
"false",
")",
";",
"ctx",
".",
"restore",
"(",
")",
";",
"// restore so stroke() isn’t scaled",
"ctx",
".",
"stroke",
"(",
")",
";",
"ctx",
".",
"fillStyle",
"=",
"\"#DCE6F2\"",
";",
"ctx",
".",
"fill",
"(",
")",
";",
"}"
]
| Draw the canvas | [
"Draw",
"the",
"canvas"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/WireIt/js/CanvasContainer.js#L92-L109 |
|
43,154 | neyric/webhookit | lib/controllers/wirings.js | get_wiring_collection | function get_wiring_collection(req, res, next) {
app.db.collection('wirings', function(error, wiring_collection) {
if(error) { throw error; }
else {
req.wiring_collection = wiring_collection;
next();
}
});
} | javascript | function get_wiring_collection(req, res, next) {
app.db.collection('wirings', function(error, wiring_collection) {
if(error) { throw error; }
else {
req.wiring_collection = wiring_collection;
next();
}
});
} | [
"function",
"get_wiring_collection",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"app",
".",
"db",
".",
"collection",
"(",
"'wirings'",
",",
"function",
"(",
"error",
",",
"wiring_collection",
")",
"{",
"if",
"(",
"error",
")",
"{",
"throw",
"error",
";",
"}",
"else",
"{",
"req",
".",
"wiring_collection",
"=",
"wiring_collection",
";",
"next",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
]
| store the wiring collection into req.wiring_collection | [
"store",
"the",
"wiring",
"collection",
"into",
"req",
".",
"wiring_collection"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/lib/controllers/wirings.js#L9-L17 |
43,155 | neyric/webhookit | lib/controllers/wirings.js | get_wiring | function get_wiring( req, res, next) {
req.wiring_collection.findOne({
user_id: req.current_user._id,
_id: ObjectID.createFromHexString(req.param('id'))
}, function(error, wiring) {
if(error) { throw error; }
req.wiring = wiring;
next();
});
} | javascript | function get_wiring( req, res, next) {
req.wiring_collection.findOne({
user_id: req.current_user._id,
_id: ObjectID.createFromHexString(req.param('id'))
}, function(error, wiring) {
if(error) { throw error; }
req.wiring = wiring;
next();
});
} | [
"function",
"get_wiring",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"req",
".",
"wiring_collection",
".",
"findOne",
"(",
"{",
"user_id",
":",
"req",
".",
"current_user",
".",
"_id",
",",
"_id",
":",
"ObjectID",
".",
"createFromHexString",
"(",
"req",
".",
"param",
"(",
"'id'",
")",
")",
"}",
",",
"function",
"(",
"error",
",",
"wiring",
")",
"{",
"if",
"(",
"error",
")",
"{",
"throw",
"error",
";",
"}",
"req",
".",
"wiring",
"=",
"wiring",
";",
"next",
"(",
")",
";",
"}",
")",
";",
"}"
]
| store the wiring document into req.wiring | [
"store",
"the",
"wiring",
"document",
"into",
"req",
".",
"wiring"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/lib/controllers/wirings.js#L20-L29 |
43,156 | neyric/webhookit | lib/controllers/wirings.js | run_wiring | function run_wiring(wiring, req, res, format) {
var filteredParams = req.query;
// TODO
/*filteredParams = params.dup
filteredParams.delete("id")
filteredParams.delete("action")
filteredParams.delete("controller")
filteredParams.delete("callback")
filteredParams.delete("format")*/
mySimpleflowRunWithActivity(wiring, req.current_user._id, format, "web",
filteredParams, false, req.wiring_collection, function(results) {
if(format == "html") {
// Reder the template
if( !!wiring.template && !req.param("notemplate") ) {
res.header('Content-Type', wiring.template_content_type);
var output;
try {
output = ejs.render(wiring.template, {
locals: {
results: results,
params: filteredParams
}
});
} catch(ex) {
output = "Error in your template: "+ex.message;
}
res.send(output);
}
// Render the result of the "outputField" variable as a html document
else if( req.param('outputField') ) {
res.header('Content-Type', "text/html");
if(results.hasOwnProperty(req.param('outputField'))) {
res.send( results[req.param('outputField')] );
}
else {
res.send( "No field called "+req.param('outputField') );
}
}
else {
// render run.ejs
res.render('wirings/run', {
locals: {
title: "Wiring "+wiring.name,
action: "wirings",
wiring: wiring,
params: filteredParams,
results: results
}
});
}
}
/*else if(format == "xml") {
}*/
else if(format == "json") {
if(req.param("callback")) {
res.header('Content-Type', 'text/javascript');
res.send("if(typeof "+req.param("callback")+" == 'function') {"+
req.param("callback")+"("+JSON.stringify(results)+");} else {\n"+
"if (typeof console!== 'undefined' && typeof console.log !== 'undefined'){\n"+
"console.log('Error: Callback method not defined');} }");
}
else {
res.header('Content-Type', 'application/json');
res.send(JSON.stringify(results));
}
}
/*else if(format == "txt") {
if results.keys.size == 1
if results.values[0].is_a?(String)
render :text => results.values[0]
return
end
else
# TODO: check if param outputField
end
render :text => "blabla"
}*/
});
} | javascript | function run_wiring(wiring, req, res, format) {
var filteredParams = req.query;
// TODO
/*filteredParams = params.dup
filteredParams.delete("id")
filteredParams.delete("action")
filteredParams.delete("controller")
filteredParams.delete("callback")
filteredParams.delete("format")*/
mySimpleflowRunWithActivity(wiring, req.current_user._id, format, "web",
filteredParams, false, req.wiring_collection, function(results) {
if(format == "html") {
// Reder the template
if( !!wiring.template && !req.param("notemplate") ) {
res.header('Content-Type', wiring.template_content_type);
var output;
try {
output = ejs.render(wiring.template, {
locals: {
results: results,
params: filteredParams
}
});
} catch(ex) {
output = "Error in your template: "+ex.message;
}
res.send(output);
}
// Render the result of the "outputField" variable as a html document
else if( req.param('outputField') ) {
res.header('Content-Type', "text/html");
if(results.hasOwnProperty(req.param('outputField'))) {
res.send( results[req.param('outputField')] );
}
else {
res.send( "No field called "+req.param('outputField') );
}
}
else {
// render run.ejs
res.render('wirings/run', {
locals: {
title: "Wiring "+wiring.name,
action: "wirings",
wiring: wiring,
params: filteredParams,
results: results
}
});
}
}
/*else if(format == "xml") {
}*/
else if(format == "json") {
if(req.param("callback")) {
res.header('Content-Type', 'text/javascript');
res.send("if(typeof "+req.param("callback")+" == 'function') {"+
req.param("callback")+"("+JSON.stringify(results)+");} else {\n"+
"if (typeof console!== 'undefined' && typeof console.log !== 'undefined'){\n"+
"console.log('Error: Callback method not defined');} }");
}
else {
res.header('Content-Type', 'application/json');
res.send(JSON.stringify(results));
}
}
/*else if(format == "txt") {
if results.keys.size == 1
if results.values[0].is_a?(String)
render :text => results.values[0]
return
end
else
# TODO: check if param outputField
end
render :text => "blabla"
}*/
});
} | [
"function",
"run_wiring",
"(",
"wiring",
",",
"req",
",",
"res",
",",
"format",
")",
"{",
"var",
"filteredParams",
"=",
"req",
".",
"query",
";",
"// TODO",
"/*filteredParams = params.dup\n filteredParams.delete(\"id\")\n filteredParams.delete(\"action\")\n filteredParams.delete(\"controller\")\n filteredParams.delete(\"callback\")\n filteredParams.delete(\"format\")*/",
"mySimpleflowRunWithActivity",
"(",
"wiring",
",",
"req",
".",
"current_user",
".",
"_id",
",",
"format",
",",
"\"web\"",
",",
"filteredParams",
",",
"false",
",",
"req",
".",
"wiring_collection",
",",
"function",
"(",
"results",
")",
"{",
"if",
"(",
"format",
"==",
"\"html\"",
")",
"{",
"// Reder the template",
"if",
"(",
"!",
"!",
"wiring",
".",
"template",
"&&",
"!",
"req",
".",
"param",
"(",
"\"notemplate\"",
")",
")",
"{",
"res",
".",
"header",
"(",
"'Content-Type'",
",",
"wiring",
".",
"template_content_type",
")",
";",
"var",
"output",
";",
"try",
"{",
"output",
"=",
"ejs",
".",
"render",
"(",
"wiring",
".",
"template",
",",
"{",
"locals",
":",
"{",
"results",
":",
"results",
",",
"params",
":",
"filteredParams",
"}",
"}",
")",
";",
"}",
"catch",
"(",
"ex",
")",
"{",
"output",
"=",
"\"Error in your template: \"",
"+",
"ex",
".",
"message",
";",
"}",
"res",
".",
"send",
"(",
"output",
")",
";",
"}",
"// Render the result of the \"outputField\" variable as a html document",
"else",
"if",
"(",
"req",
".",
"param",
"(",
"'outputField'",
")",
")",
"{",
"res",
".",
"header",
"(",
"'Content-Type'",
",",
"\"text/html\"",
")",
";",
"if",
"(",
"results",
".",
"hasOwnProperty",
"(",
"req",
".",
"param",
"(",
"'outputField'",
")",
")",
")",
"{",
"res",
".",
"send",
"(",
"results",
"[",
"req",
".",
"param",
"(",
"'outputField'",
")",
"]",
")",
";",
"}",
"else",
"{",
"res",
".",
"send",
"(",
"\"No field called \"",
"+",
"req",
".",
"param",
"(",
"'outputField'",
")",
")",
";",
"}",
"}",
"else",
"{",
"// render run.ejs",
"res",
".",
"render",
"(",
"'wirings/run'",
",",
"{",
"locals",
":",
"{",
"title",
":",
"\"Wiring \"",
"+",
"wiring",
".",
"name",
",",
"action",
":",
"\"wirings\"",
",",
"wiring",
":",
"wiring",
",",
"params",
":",
"filteredParams",
",",
"results",
":",
"results",
"}",
"}",
")",
";",
"}",
"}",
"/*else if(format == \"xml\") {\n\t\t\t\t}*/",
"else",
"if",
"(",
"format",
"==",
"\"json\"",
")",
"{",
"if",
"(",
"req",
".",
"param",
"(",
"\"callback\"",
")",
")",
"{",
"res",
".",
"header",
"(",
"'Content-Type'",
",",
"'text/javascript'",
")",
";",
"res",
".",
"send",
"(",
"\"if(typeof \"",
"+",
"req",
".",
"param",
"(",
"\"callback\"",
")",
"+",
"\" == 'function') {\"",
"+",
"req",
".",
"param",
"(",
"\"callback\"",
")",
"+",
"\"(\"",
"+",
"JSON",
".",
"stringify",
"(",
"results",
")",
"+",
"\");} else {\\n\"",
"+",
"\"if (typeof console!== 'undefined' && typeof console.log !== 'undefined'){\\n\"",
"+",
"\"console.log('Error: Callback method not defined');}\t}\"",
")",
";",
"}",
"else",
"{",
"res",
".",
"header",
"(",
"'Content-Type'",
",",
"'application/json'",
")",
";",
"res",
".",
"send",
"(",
"JSON",
".",
"stringify",
"(",
"results",
")",
")",
";",
"}",
"}",
"/*else if(format == \"txt\") {\n\t\t\t\t\tif results.keys.size == 1\n\t\t\t\t\t\tif results.values[0].is_a?(String)\n\t\t\t\t\t\t\trender :text => results.values[0]\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\t# TODO: check if param outputField\n\t\t\t\t\tend\n\n\t\t\t\t\trender :text => \"blabla\"\n\t\t\t\t}*/",
"}",
")",
";",
"}"
]
| Run the wiring ! | [
"Run",
"the",
"wiring",
"!"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/lib/controllers/wirings.js#L292-L380 |
43,157 | 3rd-Eden/licenses | registry.js | parse | function parse(data, options, next) {
data = this.get(data);
if ('function' === typeof options) {
next = options;
options = {};
}
//
// We cannot detect a license so we call the callback without any arguments
// which symbolises a failed attempt.
//
if (!data) return next();
debug('found %s in the package contents', data);
// @TODO handle the edge case where people give us an URL instead of an
// actual license.
next(undefined, this.normalize(data));
} | javascript | function parse(data, options, next) {
data = this.get(data);
if ('function' === typeof options) {
next = options;
options = {};
}
//
// We cannot detect a license so we call the callback without any arguments
// which symbolises a failed attempt.
//
if (!data) return next();
debug('found %s in the package contents', data);
// @TODO handle the edge case where people give us an URL instead of an
// actual license.
next(undefined, this.normalize(data));
} | [
"function",
"parse",
"(",
"data",
",",
"options",
",",
"next",
")",
"{",
"data",
"=",
"this",
".",
"get",
"(",
"data",
")",
";",
"if",
"(",
"'function'",
"===",
"typeof",
"options",
")",
"{",
"next",
"=",
"options",
";",
"options",
"=",
"{",
"}",
";",
"}",
"//",
"// We cannot detect a license so we call the callback without any arguments",
"// which symbolises a failed attempt.",
"//",
"if",
"(",
"!",
"data",
")",
"return",
"next",
"(",
")",
";",
"debug",
"(",
"'found %s in the package contents'",
",",
"data",
")",
";",
"// @TODO handle the edge case where people give us an URL instead of an",
"// actual license.",
"next",
"(",
"undefined",
",",
"this",
".",
"normalize",
"(",
"data",
")",
")",
";",
"}"
]
| Parse the npm license information from the package.
@param {Object} data The package.json or npm package contents.
@param {Object} options Optional options.
@param {Function} next Continuation.
@api public | [
"Parse",
"the",
"npm",
"license",
"information",
"from",
"the",
"package",
"."
]
| 8f58b7700fd03de0e095cc408852fa12d1379c3f | https://github.com/3rd-Eden/licenses/blob/8f58b7700fd03de0e095cc408852fa12d1379c3f/registry.js#L28-L47 |
43,158 | 3rd-Eden/licenses | registry.js | licenses | function licenses(data) {
if ('string' === typeof data && data) return data;
if ('type' in data && data.type) return data.type;
//
// Common typo's
//
if ('type:' in data && data['type:']) return data['type:'];
return;
} | javascript | function licenses(data) {
if ('string' === typeof data && data) return data;
if ('type' in data && data.type) return data.type;
//
// Common typo's
//
if ('type:' in data && data['type:']) return data['type:'];
return;
} | [
"function",
"licenses",
"(",
"data",
")",
"{",
"if",
"(",
"'string'",
"===",
"typeof",
"data",
"&&",
"data",
")",
"return",
"data",
";",
"if",
"(",
"'type'",
"in",
"data",
"&&",
"data",
".",
"type",
")",
"return",
"data",
".",
"type",
";",
"//",
"// Common typo's",
"//",
"if",
"(",
"'type:'",
"in",
"data",
"&&",
"data",
"[",
"'type:'",
"]",
")",
"return",
"data",
"[",
"'type:'",
"]",
";",
"return",
";",
"}"
]
| Return the possible location of license information.
@param {Object} data The object that should contain the license.
@returns {String}
@api private | [
"Return",
"the",
"possible",
"location",
"of",
"license",
"information",
"."
]
| 8f58b7700fd03de0e095cc408852fa12d1379c3f | https://github.com/3rd-Eden/licenses/blob/8f58b7700fd03de0e095cc408852fa12d1379c3f/registry.js#L56-L66 |
43,159 | 3rd-Eden/licenses | registry.js | get | function get(data) {
var parser = this
, matches = [];
//
// Another npm oddity, it allows licenses to be specified in to different
// properties. Because why the fuck not?
//
['license', 'licenses'].forEach(function each(key) {
if ('string' === typeof data[key]) {
return matches.push(data[key]);
}
if (Array.isArray(data[key])) {
return Array.prototype.push.apply(
matches,
data[key].map(function map(item) {
return parser.license(item);
}).filter(Boolean)
);
}
if ('object' === typeof data[key] && parser.license(data[key])) {
return Array.prototype.push.apply(
matches,
[parser.license(data[key])]
);
}
});
if (matches.length) return matches;
} | javascript | function get(data) {
var parser = this
, matches = [];
//
// Another npm oddity, it allows licenses to be specified in to different
// properties. Because why the fuck not?
//
['license', 'licenses'].forEach(function each(key) {
if ('string' === typeof data[key]) {
return matches.push(data[key]);
}
if (Array.isArray(data[key])) {
return Array.prototype.push.apply(
matches,
data[key].map(function map(item) {
return parser.license(item);
}).filter(Boolean)
);
}
if ('object' === typeof data[key] && parser.license(data[key])) {
return Array.prototype.push.apply(
matches,
[parser.license(data[key])]
);
}
});
if (matches.length) return matches;
} | [
"function",
"get",
"(",
"data",
")",
"{",
"var",
"parser",
"=",
"this",
",",
"matches",
"=",
"[",
"]",
";",
"//",
"// Another npm oddity, it allows licenses to be specified in to different",
"// properties. Because why the fuck not?",
"//",
"[",
"'license'",
",",
"'licenses'",
"]",
".",
"forEach",
"(",
"function",
"each",
"(",
"key",
")",
"{",
"if",
"(",
"'string'",
"===",
"typeof",
"data",
"[",
"key",
"]",
")",
"{",
"return",
"matches",
".",
"push",
"(",
"data",
"[",
"key",
"]",
")",
";",
"}",
"if",
"(",
"Array",
".",
"isArray",
"(",
"data",
"[",
"key",
"]",
")",
")",
"{",
"return",
"Array",
".",
"prototype",
".",
"push",
".",
"apply",
"(",
"matches",
",",
"data",
"[",
"key",
"]",
".",
"map",
"(",
"function",
"map",
"(",
"item",
")",
"{",
"return",
"parser",
".",
"license",
"(",
"item",
")",
";",
"}",
")",
".",
"filter",
"(",
"Boolean",
")",
")",
";",
"}",
"if",
"(",
"'object'",
"===",
"typeof",
"data",
"[",
"key",
"]",
"&&",
"parser",
".",
"license",
"(",
"data",
"[",
"key",
"]",
")",
")",
"{",
"return",
"Array",
".",
"prototype",
".",
"push",
".",
"apply",
"(",
"matches",
",",
"[",
"parser",
".",
"license",
"(",
"data",
"[",
"key",
"]",
")",
"]",
")",
";",
"}",
"}",
")",
";",
"if",
"(",
"matches",
".",
"length",
")",
"return",
"matches",
";",
"}"
]
| Retrieve the possible locations of the license information.
@param {Object} data The package.json or npm package contents.
@returns {Array}
@api private | [
"Retrieve",
"the",
"possible",
"locations",
"of",
"the",
"license",
"information",
"."
]
| 8f58b7700fd03de0e095cc408852fa12d1379c3f | https://github.com/3rd-Eden/licenses/blob/8f58b7700fd03de0e095cc408852fa12d1379c3f/registry.js#L86-L117 |
43,160 | neyric/webhookit | public/javascripts/codemirror/js/editor.js | makeWhiteSpace | function makeWhiteSpace(n) {
var buffer = [], nb = true;
for (; n > 0; n--) {
buffer.push((nb || n == 1) ? nbsp : " ");
nb = !nb;
}
return buffer.join("");
} | javascript | function makeWhiteSpace(n) {
var buffer = [], nb = true;
for (; n > 0; n--) {
buffer.push((nb || n == 1) ? nbsp : " ");
nb = !nb;
}
return buffer.join("");
} | [
"function",
"makeWhiteSpace",
"(",
"n",
")",
"{",
"var",
"buffer",
"=",
"[",
"]",
",",
"nb",
"=",
"true",
";",
"for",
"(",
";",
"n",
">",
"0",
";",
"n",
"--",
")",
"{",
"buffer",
".",
"push",
"(",
"(",
"nb",
"||",
"n",
"==",
"1",
")",
"?",
"nbsp",
":",
"\" \"",
")",
";",
"nb",
"=",
"!",
"nb",
";",
"}",
"return",
"buffer",
".",
"join",
"(",
"\"\"",
")",
";",
"}"
]
| Make sure a string does not contain two consecutive 'collapseable' whitespace characters. | [
"Make",
"sure",
"a",
"string",
"does",
"not",
"contain",
"two",
"consecutive",
"collapseable",
"whitespace",
"characters",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/editor.js#L14-L21 |
43,161 | neyric/webhookit | public/javascripts/codemirror/js/editor.js | fixSpaces | function fixSpaces(string) {
if (string.charAt(0) == " ") string = nbsp + string.slice(1);
return string.replace(/\t/g, function(){return makeWhiteSpace(indentUnit);})
.replace(/[ \u00a0]{2,}/g, function(s) {return makeWhiteSpace(s.length);});
} | javascript | function fixSpaces(string) {
if (string.charAt(0) == " ") string = nbsp + string.slice(1);
return string.replace(/\t/g, function(){return makeWhiteSpace(indentUnit);})
.replace(/[ \u00a0]{2,}/g, function(s) {return makeWhiteSpace(s.length);});
} | [
"function",
"fixSpaces",
"(",
"string",
")",
"{",
"if",
"(",
"string",
".",
"charAt",
"(",
"0",
")",
"==",
"\" \"",
")",
"string",
"=",
"nbsp",
"+",
"string",
".",
"slice",
"(",
"1",
")",
";",
"return",
"string",
".",
"replace",
"(",
"/",
"\\t",
"/",
"g",
",",
"function",
"(",
")",
"{",
"return",
"makeWhiteSpace",
"(",
"indentUnit",
")",
";",
"}",
")",
".",
"replace",
"(",
"/",
"[ \\u00a0]{2,}",
"/",
"g",
",",
"function",
"(",
"s",
")",
"{",
"return",
"makeWhiteSpace",
"(",
"s",
".",
"length",
")",
";",
"}",
")",
";",
"}"
]
| Create a set of white-space characters that will not be collapsed by the browser, but will not break text-wrapping either. | [
"Create",
"a",
"set",
"of",
"white",
"-",
"space",
"characters",
"that",
"will",
"not",
"be",
"collapsed",
"by",
"the",
"browser",
"but",
"will",
"not",
"break",
"text",
"-",
"wrapping",
"either",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/editor.js#L25-L29 |
43,162 | neyric/webhookit | public/javascripts/codemirror/js/editor.js | makePartSpan | function makePartSpan(value, doc) {
var text = value;
if (value.nodeType == 3) text = value.nodeValue;
else value = doc.createTextNode(text);
var span = doc.createElement("SPAN");
span.isPart = true;
span.appendChild(value);
span.currentText = text;
return span;
} | javascript | function makePartSpan(value, doc) {
var text = value;
if (value.nodeType == 3) text = value.nodeValue;
else value = doc.createTextNode(text);
var span = doc.createElement("SPAN");
span.isPart = true;
span.appendChild(value);
span.currentText = text;
return span;
} | [
"function",
"makePartSpan",
"(",
"value",
",",
"doc",
")",
"{",
"var",
"text",
"=",
"value",
";",
"if",
"(",
"value",
".",
"nodeType",
"==",
"3",
")",
"text",
"=",
"value",
".",
"nodeValue",
";",
"else",
"value",
"=",
"doc",
".",
"createTextNode",
"(",
"text",
")",
";",
"var",
"span",
"=",
"doc",
".",
"createElement",
"(",
"\"SPAN\"",
")",
";",
"span",
".",
"isPart",
"=",
"true",
";",
"span",
".",
"appendChild",
"(",
"value",
")",
";",
"span",
".",
"currentText",
"=",
"text",
";",
"return",
"span",
";",
"}"
]
| Create a SPAN node with the expected properties for document part spans. | [
"Create",
"a",
"SPAN",
"node",
"with",
"the",
"expected",
"properties",
"for",
"document",
"part",
"spans",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/editor.js#L37-L47 |
43,163 | neyric/webhookit | public/javascripts/codemirror/js/editor.js | pointAt | function pointAt(node){
var parent = node.parentNode;
var next = node.nextSibling;
return function(newnode) {
parent.insertBefore(newnode, next);
};
} | javascript | function pointAt(node){
var parent = node.parentNode;
var next = node.nextSibling;
return function(newnode) {
parent.insertBefore(newnode, next);
};
} | [
"function",
"pointAt",
"(",
"node",
")",
"{",
"var",
"parent",
"=",
"node",
".",
"parentNode",
";",
"var",
"next",
"=",
"node",
".",
"nextSibling",
";",
"return",
"function",
"(",
"newnode",
")",
"{",
"parent",
".",
"insertBefore",
"(",
"newnode",
",",
"next",
")",
";",
"}",
";",
"}"
]
| Create a function that can be used to insert nodes after the one given as argument. | [
"Create",
"a",
"function",
"that",
"can",
"be",
"used",
"to",
"insert",
"nodes",
"after",
"the",
"one",
"given",
"as",
"argument",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/editor.js#L123-L129 |
43,164 | neyric/webhookit | public/javascripts/codemirror/js/editor.js | writeNode | function writeNode(node, c, end) {
var toYield = [];
forEach(simplifyDOM(node, end), function(part) {
toYield.push(insertPart(part));
});
return yield(toYield.join(""), c);
} | javascript | function writeNode(node, c, end) {
var toYield = [];
forEach(simplifyDOM(node, end), function(part) {
toYield.push(insertPart(part));
});
return yield(toYield.join(""), c);
} | [
"function",
"writeNode",
"(",
"node",
",",
"c",
",",
"end",
")",
"{",
"var",
"toYield",
"=",
"[",
"]",
";",
"forEach",
"(",
"simplifyDOM",
"(",
"node",
",",
"end",
")",
",",
"function",
"(",
"part",
")",
"{",
"toYield",
".",
"push",
"(",
"insertPart",
"(",
"part",
")",
")",
";",
"}",
")",
";",
"return",
"yield",
"(",
"toYield",
".",
"join",
"(",
"\"\"",
")",
",",
"c",
")",
";",
"}"
]
| Extract the text and newlines from a DOM node, insert them into the document, and yield the textual content. Used to replace non-normalized nodes. | [
"Extract",
"the",
"text",
"and",
"newlines",
"from",
"a",
"DOM",
"node",
"insert",
"them",
"into",
"the",
"document",
"and",
"yield",
"the",
"textual",
"content",
".",
"Used",
"to",
"replace",
"non",
"-",
"normalized",
"nodes",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/editor.js#L165-L171 |
43,165 | neyric/webhookit | public/javascripts/codemirror/js/editor.js | function() {
var line = cleanText(self.history.textAfter(self.line).slice(self.offset));
var match = (self.caseFold ? line.toLowerCase() : line).indexOf(string);
if (match > -1)
return {from: {node: self.line, offset: self.offset + match},
to: {node: self.line, offset: self.offset + match + string.length}};
} | javascript | function() {
var line = cleanText(self.history.textAfter(self.line).slice(self.offset));
var match = (self.caseFold ? line.toLowerCase() : line).indexOf(string);
if (match > -1)
return {from: {node: self.line, offset: self.offset + match},
to: {node: self.line, offset: self.offset + match + string.length}};
} | [
"function",
"(",
")",
"{",
"var",
"line",
"=",
"cleanText",
"(",
"self",
".",
"history",
".",
"textAfter",
"(",
"self",
".",
"line",
")",
".",
"slice",
"(",
"self",
".",
"offset",
")",
")",
";",
"var",
"match",
"=",
"(",
"self",
".",
"caseFold",
"?",
"line",
".",
"toLowerCase",
"(",
")",
":",
"line",
")",
".",
"indexOf",
"(",
"string",
")",
";",
"if",
"(",
"match",
">",
"-",
"1",
")",
"return",
"{",
"from",
":",
"{",
"node",
":",
"self",
".",
"line",
",",
"offset",
":",
"self",
".",
"offset",
"+",
"match",
"}",
",",
"to",
":",
"{",
"node",
":",
"self",
".",
"line",
",",
"offset",
":",
"self",
".",
"offset",
"+",
"match",
"+",
"string",
".",
"length",
"}",
"}",
";",
"}"
]
| For one-line strings, searching can be done simply by calling indexOf on the current line. | [
"For",
"one",
"-",
"line",
"strings",
"searching",
"can",
"be",
"done",
"simply",
"by",
"calling",
"indexOf",
"on",
"the",
"current",
"line",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/editor.js#L273-L279 |
|
43,166 | neyric/webhookit | public/javascripts/codemirror/js/editor.js | function() {
var firstLine = cleanText(self.history.textAfter(self.line).slice(self.offset));
var match = (self.caseFold ? firstLine.toLowerCase() : firstLine).lastIndexOf(target[0]);
if (match == -1 || match != firstLine.length - target[0].length)
return false;
var startOffset = self.offset + match;
var line = self.history.nodeAfter(self.line);
for (var i = 1; i < target.length - 1; i++) {
var line = cleanText(self.history.textAfter(line));
if ((self.caseFold ? line.toLowerCase() : line) != target[i])
return false;
line = self.history.nodeAfter(line);
}
var lastLine = cleanText(self.history.textAfter(line));
if ((self.caseFold ? lastLine.toLowerCase() : lastLine).indexOf(target[target.length - 1]) != 0)
return false;
return {from: {node: self.line, offset: startOffset},
to: {node: line, offset: target[target.length - 1].length}};
} | javascript | function() {
var firstLine = cleanText(self.history.textAfter(self.line).slice(self.offset));
var match = (self.caseFold ? firstLine.toLowerCase() : firstLine).lastIndexOf(target[0]);
if (match == -1 || match != firstLine.length - target[0].length)
return false;
var startOffset = self.offset + match;
var line = self.history.nodeAfter(self.line);
for (var i = 1; i < target.length - 1; i++) {
var line = cleanText(self.history.textAfter(line));
if ((self.caseFold ? line.toLowerCase() : line) != target[i])
return false;
line = self.history.nodeAfter(line);
}
var lastLine = cleanText(self.history.textAfter(line));
if ((self.caseFold ? lastLine.toLowerCase() : lastLine).indexOf(target[target.length - 1]) != 0)
return false;
return {from: {node: self.line, offset: startOffset},
to: {node: line, offset: target[target.length - 1].length}};
} | [
"function",
"(",
")",
"{",
"var",
"firstLine",
"=",
"cleanText",
"(",
"self",
".",
"history",
".",
"textAfter",
"(",
"self",
".",
"line",
")",
".",
"slice",
"(",
"self",
".",
"offset",
")",
")",
";",
"var",
"match",
"=",
"(",
"self",
".",
"caseFold",
"?",
"firstLine",
".",
"toLowerCase",
"(",
")",
":",
"firstLine",
")",
".",
"lastIndexOf",
"(",
"target",
"[",
"0",
"]",
")",
";",
"if",
"(",
"match",
"==",
"-",
"1",
"||",
"match",
"!=",
"firstLine",
".",
"length",
"-",
"target",
"[",
"0",
"]",
".",
"length",
")",
"return",
"false",
";",
"var",
"startOffset",
"=",
"self",
".",
"offset",
"+",
"match",
";",
"var",
"line",
"=",
"self",
".",
"history",
".",
"nodeAfter",
"(",
"self",
".",
"line",
")",
";",
"for",
"(",
"var",
"i",
"=",
"1",
";",
"i",
"<",
"target",
".",
"length",
"-",
"1",
";",
"i",
"++",
")",
"{",
"var",
"line",
"=",
"cleanText",
"(",
"self",
".",
"history",
".",
"textAfter",
"(",
"line",
")",
")",
";",
"if",
"(",
"(",
"self",
".",
"caseFold",
"?",
"line",
".",
"toLowerCase",
"(",
")",
":",
"line",
")",
"!=",
"target",
"[",
"i",
"]",
")",
"return",
"false",
";",
"line",
"=",
"self",
".",
"history",
".",
"nodeAfter",
"(",
"line",
")",
";",
"}",
"var",
"lastLine",
"=",
"cleanText",
"(",
"self",
".",
"history",
".",
"textAfter",
"(",
"line",
")",
")",
";",
"if",
"(",
"(",
"self",
".",
"caseFold",
"?",
"lastLine",
".",
"toLowerCase",
"(",
")",
":",
"lastLine",
")",
".",
"indexOf",
"(",
"target",
"[",
"target",
".",
"length",
"-",
"1",
"]",
")",
"!=",
"0",
")",
"return",
"false",
";",
"return",
"{",
"from",
":",
"{",
"node",
":",
"self",
".",
"line",
",",
"offset",
":",
"startOffset",
"}",
",",
"to",
":",
"{",
"node",
":",
"line",
",",
"offset",
":",
"target",
"[",
"target",
".",
"length",
"-",
"1",
"]",
".",
"length",
"}",
"}",
";",
"}"
]
| Multi-line strings require internal iteration over lines, and some clunky checks to make sure the first match ends at the end of the line and the last match starts at the start. | [
"Multi",
"-",
"line",
"strings",
"require",
"internal",
"iteration",
"over",
"lines",
"and",
"some",
"clunky",
"checks",
"to",
"make",
"sure",
"the",
"first",
"match",
"ends",
"at",
"the",
"end",
"of",
"the",
"line",
"and",
"the",
"last",
"match",
"starts",
"at",
"the",
"start",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/editor.js#L283-L304 |
|
43,167 | neyric/webhookit | public/javascripts/codemirror/js/editor.js | saveAfter | function saveAfter(pos) {
if (self.history.textAfter(pos.node).length > pos.offset) {
self.line = pos.node;
self.offset = pos.offset + 1;
}
else {
self.line = self.history.nodeAfter(pos.node);
self.offset = 0;
}
} | javascript | function saveAfter(pos) {
if (self.history.textAfter(pos.node).length > pos.offset) {
self.line = pos.node;
self.offset = pos.offset + 1;
}
else {
self.line = self.history.nodeAfter(pos.node);
self.offset = 0;
}
} | [
"function",
"saveAfter",
"(",
"pos",
")",
"{",
"if",
"(",
"self",
".",
"history",
".",
"textAfter",
"(",
"pos",
".",
"node",
")",
".",
"length",
">",
"pos",
".",
"offset",
")",
"{",
"self",
".",
"line",
"=",
"pos",
".",
"node",
";",
"self",
".",
"offset",
"=",
"pos",
".",
"offset",
"+",
"1",
";",
"}",
"else",
"{",
"self",
".",
"line",
"=",
"self",
".",
"history",
".",
"nodeAfter",
"(",
"pos",
".",
"node",
")",
";",
"self",
".",
"offset",
"=",
"0",
";",
"}",
"}"
]
| Set the cursor's position one character after the given position. | [
"Set",
"the",
"cursor",
"s",
"position",
"one",
"character",
"after",
"the",
"given",
"position",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/editor.js#L322-L331 |
43,168 | neyric/webhookit | public/javascripts/codemirror/js/editor.js | function() {
if (!this.container.firstChild)
return "";
var accum = [];
select.markSelection(this.win);
forEach(traverseDOM(this.container.firstChild), method(accum, "push"));
webkitLastLineHack(this.container);
select.selectMarked();
return cleanText(accum.join(""));
} | javascript | function() {
if (!this.container.firstChild)
return "";
var accum = [];
select.markSelection(this.win);
forEach(traverseDOM(this.container.firstChild), method(accum, "push"));
webkitLastLineHack(this.container);
select.selectMarked();
return cleanText(accum.join(""));
} | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"container",
".",
"firstChild",
")",
"return",
"\"\"",
";",
"var",
"accum",
"=",
"[",
"]",
";",
"select",
".",
"markSelection",
"(",
"this",
".",
"win",
")",
";",
"forEach",
"(",
"traverseDOM",
"(",
"this",
".",
"container",
".",
"firstChild",
")",
",",
"method",
"(",
"accum",
",",
"\"push\"",
")",
")",
";",
"webkitLastLineHack",
"(",
"this",
".",
"container",
")",
";",
"select",
".",
"selectMarked",
"(",
")",
";",
"return",
"cleanText",
"(",
"accum",
".",
"join",
"(",
"\"\"",
")",
")",
";",
"}"
]
| Extract the code from the editor. | [
"Extract",
"the",
"code",
"from",
"the",
"editor",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/editor.js#L472-L482 |
|
43,169 | neyric/webhookit | public/javascripts/codemirror/js/editor.js | function() {
var h = this.history;
h.commit();
var start = select.cursorPos(this.container, true),
end = select.cursorPos(this.container, false);
if (!start || !end) return "";
if (start.node == end.node)
return h.textAfter(start.node).slice(start.offset, end.offset);
var text = [h.textAfter(start.node).slice(start.offset)];
for (var pos = h.nodeAfter(start.node); pos != end.node; pos = h.nodeAfter(pos))
text.push(h.textAfter(pos));
text.push(h.textAfter(end.node).slice(0, end.offset));
return cleanText(text.join("\n"));
} | javascript | function() {
var h = this.history;
h.commit();
var start = select.cursorPos(this.container, true),
end = select.cursorPos(this.container, false);
if (!start || !end) return "";
if (start.node == end.node)
return h.textAfter(start.node).slice(start.offset, end.offset);
var text = [h.textAfter(start.node).slice(start.offset)];
for (var pos = h.nodeAfter(start.node); pos != end.node; pos = h.nodeAfter(pos))
text.push(h.textAfter(pos));
text.push(h.textAfter(end.node).slice(0, end.offset));
return cleanText(text.join("\n"));
} | [
"function",
"(",
")",
"{",
"var",
"h",
"=",
"this",
".",
"history",
";",
"h",
".",
"commit",
"(",
")",
";",
"var",
"start",
"=",
"select",
".",
"cursorPos",
"(",
"this",
".",
"container",
",",
"true",
")",
",",
"end",
"=",
"select",
".",
"cursorPos",
"(",
"this",
".",
"container",
",",
"false",
")",
";",
"if",
"(",
"!",
"start",
"||",
"!",
"end",
")",
"return",
"\"\"",
";",
"if",
"(",
"start",
".",
"node",
"==",
"end",
".",
"node",
")",
"return",
"h",
".",
"textAfter",
"(",
"start",
".",
"node",
")",
".",
"slice",
"(",
"start",
".",
"offset",
",",
"end",
".",
"offset",
")",
";",
"var",
"text",
"=",
"[",
"h",
".",
"textAfter",
"(",
"start",
".",
"node",
")",
".",
"slice",
"(",
"start",
".",
"offset",
")",
"]",
";",
"for",
"(",
"var",
"pos",
"=",
"h",
".",
"nodeAfter",
"(",
"start",
".",
"node",
")",
";",
"pos",
"!=",
"end",
".",
"node",
";",
"pos",
"=",
"h",
".",
"nodeAfter",
"(",
"pos",
")",
")",
"text",
".",
"push",
"(",
"h",
".",
"textAfter",
"(",
"pos",
")",
")",
";",
"text",
".",
"push",
"(",
"h",
".",
"textAfter",
"(",
"end",
".",
"node",
")",
".",
"slice",
"(",
"0",
",",
"end",
".",
"offset",
")",
")",
";",
"return",
"cleanText",
"(",
"text",
".",
"join",
"(",
"\"\\n\"",
")",
")",
";",
"}"
]
| Retrieve the selected text. | [
"Retrieve",
"the",
"selected",
"text",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/editor.js#L589-L605 |
|
43,170 | neyric/webhookit | public/javascripts/codemirror/js/editor.js | function(text) {
this.history.commit();
var start = select.cursorPos(this.container, true),
end = select.cursorPos(this.container, false);
if (!start || !end) return;
end = this.replaceRange(start, end, text);
select.setCursorPos(this.container, end);
webkitLastLineHack(this.container);
} | javascript | function(text) {
this.history.commit();
var start = select.cursorPos(this.container, true),
end = select.cursorPos(this.container, false);
if (!start || !end) return;
end = this.replaceRange(start, end, text);
select.setCursorPos(this.container, end);
webkitLastLineHack(this.container);
} | [
"function",
"(",
"text",
")",
"{",
"this",
".",
"history",
".",
"commit",
"(",
")",
";",
"var",
"start",
"=",
"select",
".",
"cursorPos",
"(",
"this",
".",
"container",
",",
"true",
")",
",",
"end",
"=",
"select",
".",
"cursorPos",
"(",
"this",
".",
"container",
",",
"false",
")",
";",
"if",
"(",
"!",
"start",
"||",
"!",
"end",
")",
"return",
";",
"end",
"=",
"this",
".",
"replaceRange",
"(",
"start",
",",
"end",
",",
"text",
")",
";",
"select",
".",
"setCursorPos",
"(",
"this",
".",
"container",
",",
"end",
")",
";",
"webkitLastLineHack",
"(",
"this",
".",
"container",
")",
";",
"}"
]
| Replace the selection with another piece of text. | [
"Replace",
"the",
"selection",
"with",
"another",
"piece",
"of",
"text",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/editor.js#L608-L618 |
|
43,171 | neyric/webhookit | public/javascripts/codemirror/js/editor.js | function(event) {
var electric = Editor.Parser.electricChars, self = this;
// Hack for Opera, and Firefox on OS X, in which stopping a
// keydown event does not prevent the associated keypress event
// from happening, so we have to cancel enter and tab again
// here.
if ((this.frozen && (!this.keyFilter || this.keyFilter(event.keyCode))) ||
event.code == 13 || (event.code == 9 && this.options.tabMode != "default") ||
(event.keyCode == 32 && event.shiftKey && this.options.tabMode == "default"))
event.stop();
else if (electric && electric.indexOf(event.character) != -1)
this.parent.setTimeout(function(){self.indentAtCursor(null);}, 0);
else if ((event.character == "v" || event.character == "V")
&& (event.ctrlKey || event.metaKey) && !event.altKey) // ctrl-V
this.reroutePasteEvent();
} | javascript | function(event) {
var electric = Editor.Parser.electricChars, self = this;
// Hack for Opera, and Firefox on OS X, in which stopping a
// keydown event does not prevent the associated keypress event
// from happening, so we have to cancel enter and tab again
// here.
if ((this.frozen && (!this.keyFilter || this.keyFilter(event.keyCode))) ||
event.code == 13 || (event.code == 9 && this.options.tabMode != "default") ||
(event.keyCode == 32 && event.shiftKey && this.options.tabMode == "default"))
event.stop();
else if (electric && electric.indexOf(event.character) != -1)
this.parent.setTimeout(function(){self.indentAtCursor(null);}, 0);
else if ((event.character == "v" || event.character == "V")
&& (event.ctrlKey || event.metaKey) && !event.altKey) // ctrl-V
this.reroutePasteEvent();
} | [
"function",
"(",
"event",
")",
"{",
"var",
"electric",
"=",
"Editor",
".",
"Parser",
".",
"electricChars",
",",
"self",
"=",
"this",
";",
"// Hack for Opera, and Firefox on OS X, in which stopping a",
"// keydown event does not prevent the associated keypress event",
"// from happening, so we have to cancel enter and tab again",
"// here.",
"if",
"(",
"(",
"this",
".",
"frozen",
"&&",
"(",
"!",
"this",
".",
"keyFilter",
"||",
"this",
".",
"keyFilter",
"(",
"event",
".",
"keyCode",
")",
")",
")",
"||",
"event",
".",
"code",
"==",
"13",
"||",
"(",
"event",
".",
"code",
"==",
"9",
"&&",
"this",
".",
"options",
".",
"tabMode",
"!=",
"\"default\"",
")",
"||",
"(",
"event",
".",
"keyCode",
"==",
"32",
"&&",
"event",
".",
"shiftKey",
"&&",
"this",
".",
"options",
".",
"tabMode",
"==",
"\"default\"",
")",
")",
"event",
".",
"stop",
"(",
")",
";",
"else",
"if",
"(",
"electric",
"&&",
"electric",
".",
"indexOf",
"(",
"event",
".",
"character",
")",
"!=",
"-",
"1",
")",
"this",
".",
"parent",
".",
"setTimeout",
"(",
"function",
"(",
")",
"{",
"self",
".",
"indentAtCursor",
"(",
"null",
")",
";",
"}",
",",
"0",
")",
";",
"else",
"if",
"(",
"(",
"event",
".",
"character",
"==",
"\"v\"",
"||",
"event",
".",
"character",
"==",
"\"V\"",
")",
"&&",
"(",
"event",
".",
"ctrlKey",
"||",
"event",
".",
"metaKey",
")",
"&&",
"!",
"event",
".",
"altKey",
")",
"// ctrl-V",
"this",
".",
"reroutePasteEvent",
"(",
")",
";",
"}"
]
| Check for characters that should re-indent the current line, and prevent Opera from handling enter and tab anyway. | [
"Check",
"for",
"characters",
"that",
"should",
"re",
"-",
"indent",
"the",
"current",
"line",
"and",
"prevent",
"Opera",
"from",
"handling",
"enter",
"and",
"tab",
"anyway",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/editor.js#L781-L796 |
|
43,172 | neyric/webhookit | public/javascripts/codemirror/js/editor.js | function() {
var pos = select.selectionTopNode(this.container, true);
var to = select.selectionTopNode(this.container, false);
if (pos === false || to === false) return;
select.markSelection(this.win);
if (this.highlight(pos, endOfLine(to, this.container), true, 20) === false)
return false;
select.selectMarked();
return true;
} | javascript | function() {
var pos = select.selectionTopNode(this.container, true);
var to = select.selectionTopNode(this.container, false);
if (pos === false || to === false) return;
select.markSelection(this.win);
if (this.highlight(pos, endOfLine(to, this.container), true, 20) === false)
return false;
select.selectMarked();
return true;
} | [
"function",
"(",
")",
"{",
"var",
"pos",
"=",
"select",
".",
"selectionTopNode",
"(",
"this",
".",
"container",
",",
"true",
")",
";",
"var",
"to",
"=",
"select",
".",
"selectionTopNode",
"(",
"this",
".",
"container",
",",
"false",
")",
";",
"if",
"(",
"pos",
"===",
"false",
"||",
"to",
"===",
"false",
")",
"return",
";",
"select",
".",
"markSelection",
"(",
"this",
".",
"win",
")",
";",
"if",
"(",
"this",
".",
"highlight",
"(",
"pos",
",",
"endOfLine",
"(",
"to",
",",
"this",
".",
"container",
")",
",",
"true",
",",
"20",
")",
"===",
"false",
")",
"return",
"false",
";",
"select",
".",
"selectMarked",
"(",
")",
";",
"return",
"true",
";",
"}"
]
| Re-highlight the selected part of the document. | [
"Re",
"-",
"highlight",
"the",
"selected",
"part",
"of",
"the",
"document",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/editor.js#L865-L875 |
|
43,173 | neyric/webhookit | public/javascripts/codemirror/js/editor.js | function() {
var cur = select.selectionTopNode(this.container, true), start = cur;
if (cur === false || !(!cur || cur.isPart || isBR(cur)) || !this.container.firstChild)
return false;
while (cur && !isBR(cur)) cur = cur.previousSibling;
var next = cur ? cur.nextSibling : this.container.firstChild;
if (next && next != start && next.isPart && hasClass(next, "whitespace"))
select.focusAfterNode(next, this.container);
else
select.focusAfterNode(cur, this.container);
select.scrollToCursor(this.container);
return true;
} | javascript | function() {
var cur = select.selectionTopNode(this.container, true), start = cur;
if (cur === false || !(!cur || cur.isPart || isBR(cur)) || !this.container.firstChild)
return false;
while (cur && !isBR(cur)) cur = cur.previousSibling;
var next = cur ? cur.nextSibling : this.container.firstChild;
if (next && next != start && next.isPart && hasClass(next, "whitespace"))
select.focusAfterNode(next, this.container);
else
select.focusAfterNode(cur, this.container);
select.scrollToCursor(this.container);
return true;
} | [
"function",
"(",
")",
"{",
"var",
"cur",
"=",
"select",
".",
"selectionTopNode",
"(",
"this",
".",
"container",
",",
"true",
")",
",",
"start",
"=",
"cur",
";",
"if",
"(",
"cur",
"===",
"false",
"||",
"!",
"(",
"!",
"cur",
"||",
"cur",
".",
"isPart",
"||",
"isBR",
"(",
"cur",
")",
")",
"||",
"!",
"this",
".",
"container",
".",
"firstChild",
")",
"return",
"false",
";",
"while",
"(",
"cur",
"&&",
"!",
"isBR",
"(",
"cur",
")",
")",
"cur",
"=",
"cur",
".",
"previousSibling",
";",
"var",
"next",
"=",
"cur",
"?",
"cur",
".",
"nextSibling",
":",
"this",
".",
"container",
".",
"firstChild",
";",
"if",
"(",
"next",
"&&",
"next",
"!=",
"start",
"&&",
"next",
".",
"isPart",
"&&",
"hasClass",
"(",
"next",
",",
"\"whitespace\"",
")",
")",
"select",
".",
"focusAfterNode",
"(",
"next",
",",
"this",
".",
"container",
")",
";",
"else",
"select",
".",
"focusAfterNode",
"(",
"cur",
",",
"this",
".",
"container",
")",
";",
"select",
".",
"scrollToCursor",
"(",
"this",
".",
"container",
")",
";",
"return",
"true",
";",
"}"
]
| Custom home behaviour that doesn't land the cursor in front of leading whitespace unless pressed twice. | [
"Custom",
"home",
"behaviour",
"that",
"doesn",
"t",
"land",
"the",
"cursor",
"in",
"front",
"of",
"leading",
"whitespace",
"unless",
"pressed",
"twice",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/editor.js#L889-L903 |
|
43,174 | neyric/webhookit | public/javascripts/codemirror/js/editor.js | highlight | function highlight(node, ok) {
if (!node) return;
if (self.options.markParen) {
self.options.markParen(node, ok);
}
else {
node.style.fontWeight = "bold";
node.style.color = ok ? "#8F8" : "#F88";
}
} | javascript | function highlight(node, ok) {
if (!node) return;
if (self.options.markParen) {
self.options.markParen(node, ok);
}
else {
node.style.fontWeight = "bold";
node.style.color = ok ? "#8F8" : "#F88";
}
} | [
"function",
"highlight",
"(",
"node",
",",
"ok",
")",
"{",
"if",
"(",
"!",
"node",
")",
"return",
";",
"if",
"(",
"self",
".",
"options",
".",
"markParen",
")",
"{",
"self",
".",
"options",
".",
"markParen",
"(",
"node",
",",
"ok",
")",
";",
"}",
"else",
"{",
"node",
".",
"style",
".",
"fontWeight",
"=",
"\"bold\"",
";",
"node",
".",
"style",
".",
"color",
"=",
"ok",
"?",
"\"#8F8\"",
":",
"\"#F88\"",
";",
"}",
"}"
]
| give the relevant nodes a colour. | [
"give",
"the",
"relevant",
"nodes",
"a",
"colour",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/editor.js#L931-L940 |
43,175 | neyric/webhookit | public/javascripts/codemirror/js/editor.js | paren | function paren(node) {
if (node.currentText) {
var match = node.currentText.match(/^[\s\u00a0]*([\(\)\[\]{}])[\s\u00a0]*$/);
return match && match[1];
}
} | javascript | function paren(node) {
if (node.currentText) {
var match = node.currentText.match(/^[\s\u00a0]*([\(\)\[\]{}])[\s\u00a0]*$/);
return match && match[1];
}
} | [
"function",
"paren",
"(",
"node",
")",
"{",
"if",
"(",
"node",
".",
"currentText",
")",
"{",
"var",
"match",
"=",
"node",
".",
"currentText",
".",
"match",
"(",
"/",
"^[\\s\\u00a0]*([\\(\\)\\[\\]{}])[\\s\\u00a0]*$",
"/",
")",
";",
"return",
"match",
"&&",
"match",
"[",
"1",
"]",
";",
"}",
"}"
]
| Extract a 'paren' from a piece of text. | [
"Extract",
"a",
"paren",
"from",
"a",
"piece",
"of",
"text",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/editor.js#L962-L967 |
43,176 | neyric/webhookit | public/javascripts/codemirror/js/editor.js | tryFindMatch | function tryFindMatch() {
var stack = [], ch, ok = true;;
for (var runner = cursor; runner; runner = dir ? runner.nextSibling : runner.previousSibling) {
if (runner.className == className && isSpan(runner) && (ch = paren(runner))) {
if (forward(ch) == dir)
stack.push(ch);
else if (!stack.length)
ok = false;
else if (stack.pop() != matching[ch])
ok = false;
if (!stack.length) break;
}
else if (runner.dirty || !isSpan(runner) && !isBR(runner)) {
return {node: runner, status: "dirty"};
}
}
return {node: runner, status: runner && ok};
} | javascript | function tryFindMatch() {
var stack = [], ch, ok = true;;
for (var runner = cursor; runner; runner = dir ? runner.nextSibling : runner.previousSibling) {
if (runner.className == className && isSpan(runner) && (ch = paren(runner))) {
if (forward(ch) == dir)
stack.push(ch);
else if (!stack.length)
ok = false;
else if (stack.pop() != matching[ch])
ok = false;
if (!stack.length) break;
}
else if (runner.dirty || !isSpan(runner) && !isBR(runner)) {
return {node: runner, status: "dirty"};
}
}
return {node: runner, status: runner && ok};
} | [
"function",
"tryFindMatch",
"(",
")",
"{",
"var",
"stack",
"=",
"[",
"]",
",",
"ch",
",",
"ok",
"=",
"true",
";",
";",
"for",
"(",
"var",
"runner",
"=",
"cursor",
";",
"runner",
";",
"runner",
"=",
"dir",
"?",
"runner",
".",
"nextSibling",
":",
"runner",
".",
"previousSibling",
")",
"{",
"if",
"(",
"runner",
".",
"className",
"==",
"className",
"&&",
"isSpan",
"(",
"runner",
")",
"&&",
"(",
"ch",
"=",
"paren",
"(",
"runner",
")",
")",
")",
"{",
"if",
"(",
"forward",
"(",
"ch",
")",
"==",
"dir",
")",
"stack",
".",
"push",
"(",
"ch",
")",
";",
"else",
"if",
"(",
"!",
"stack",
".",
"length",
")",
"ok",
"=",
"false",
";",
"else",
"if",
"(",
"stack",
".",
"pop",
"(",
")",
"!=",
"matching",
"[",
"ch",
"]",
")",
"ok",
"=",
"false",
";",
"if",
"(",
"!",
"stack",
".",
"length",
")",
"break",
";",
"}",
"else",
"if",
"(",
"runner",
".",
"dirty",
"||",
"!",
"isSpan",
"(",
"runner",
")",
"&&",
"!",
"isBR",
"(",
"runner",
")",
")",
"{",
"return",
"{",
"node",
":",
"runner",
",",
"status",
":",
"\"dirty\"",
"}",
";",
"}",
"}",
"return",
"{",
"node",
":",
"runner",
",",
"status",
":",
"runner",
"&&",
"ok",
"}",
";",
"}"
]
| Since parts of the document might not have been properly highlighted, and it is hard to know in advance which part we have to scan, we just try, and when we find dirty nodes we abort, parse them, and re-try. | [
"Since",
"parts",
"of",
"the",
"document",
"might",
"not",
"have",
"been",
"properly",
"highlighted",
"and",
"it",
"is",
"hard",
"to",
"know",
"in",
"advance",
"which",
"part",
"we",
"have",
"to",
"scan",
"we",
"just",
"try",
"and",
"when",
"we",
"find",
"dirty",
"nodes",
"we",
"abort",
"parse",
"them",
"and",
"re",
"-",
"try",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/editor.js#L985-L1002 |
43,177 | neyric/webhookit | public/javascripts/codemirror/js/editor.js | function(direction) {
if (!this.container.firstChild) return;
// The line has to have up-to-date lexical information, so we
// highlight it first.
if (!this.highlightAtCursor()) return;
var cursor = select.selectionTopNode(this.container, false);
// If we couldn't determine the place of the cursor,
// there's nothing to indent.
if (cursor === false)
return;
var lineStart = startOfLine(cursor);
var whiteSpace = this.indentLineAfter(lineStart, direction);
if (cursor == lineStart && whiteSpace)
cursor = whiteSpace;
// This means the indentation has probably messed up the cursor.
if (cursor == whiteSpace)
select.focusAfterNode(cursor, this.container);
} | javascript | function(direction) {
if (!this.container.firstChild) return;
// The line has to have up-to-date lexical information, so we
// highlight it first.
if (!this.highlightAtCursor()) return;
var cursor = select.selectionTopNode(this.container, false);
// If we couldn't determine the place of the cursor,
// there's nothing to indent.
if (cursor === false)
return;
var lineStart = startOfLine(cursor);
var whiteSpace = this.indentLineAfter(lineStart, direction);
if (cursor == lineStart && whiteSpace)
cursor = whiteSpace;
// This means the indentation has probably messed up the cursor.
if (cursor == whiteSpace)
select.focusAfterNode(cursor, this.container);
} | [
"function",
"(",
"direction",
")",
"{",
"if",
"(",
"!",
"this",
".",
"container",
".",
"firstChild",
")",
"return",
";",
"// The line has to have up-to-date lexical information, so we",
"// highlight it first.",
"if",
"(",
"!",
"this",
".",
"highlightAtCursor",
"(",
")",
")",
"return",
";",
"var",
"cursor",
"=",
"select",
".",
"selectionTopNode",
"(",
"this",
".",
"container",
",",
"false",
")",
";",
"// If we couldn't determine the place of the cursor,",
"// there's nothing to indent.",
"if",
"(",
"cursor",
"===",
"false",
")",
"return",
";",
"var",
"lineStart",
"=",
"startOfLine",
"(",
"cursor",
")",
";",
"var",
"whiteSpace",
"=",
"this",
".",
"indentLineAfter",
"(",
"lineStart",
",",
"direction",
")",
";",
"if",
"(",
"cursor",
"==",
"lineStart",
"&&",
"whiteSpace",
")",
"cursor",
"=",
"whiteSpace",
";",
"// This means the indentation has probably messed up the cursor.",
"if",
"(",
"cursor",
"==",
"whiteSpace",
")",
"select",
".",
"focusAfterNode",
"(",
"cursor",
",",
"this",
".",
"container",
")",
";",
"}"
]
| Adjust the amount of whitespace at the start of the line that the cursor is on so that it is indented properly. | [
"Adjust",
"the",
"amount",
"of",
"whitespace",
"at",
"the",
"start",
"of",
"the",
"line",
"that",
"the",
"cursor",
"is",
"on",
"so",
"that",
"it",
"is",
"indented",
"properly",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/editor.js#L1029-L1046 |
|
43,178 | neyric/webhookit | public/javascripts/codemirror/js/editor.js | function(start, end, direction) {
var current = (start = startOfLine(start)), before = start && startOfLine(start.previousSibling);
if (!isBR(end)) end = endOfLine(end, this.container);
this.addDirtyNode(start);
do {
var next = endOfLine(current, this.container);
if (current) this.highlight(before, next, true);
this.indentLineAfter(current, direction);
before = current;
current = next;
} while (current != end);
select.setCursorPos(this.container, {node: start, offset: 0}, {node: end, offset: 0});
} | javascript | function(start, end, direction) {
var current = (start = startOfLine(start)), before = start && startOfLine(start.previousSibling);
if (!isBR(end)) end = endOfLine(end, this.container);
this.addDirtyNode(start);
do {
var next = endOfLine(current, this.container);
if (current) this.highlight(before, next, true);
this.indentLineAfter(current, direction);
before = current;
current = next;
} while (current != end);
select.setCursorPos(this.container, {node: start, offset: 0}, {node: end, offset: 0});
} | [
"function",
"(",
"start",
",",
"end",
",",
"direction",
")",
"{",
"var",
"current",
"=",
"(",
"start",
"=",
"startOfLine",
"(",
"start",
")",
")",
",",
"before",
"=",
"start",
"&&",
"startOfLine",
"(",
"start",
".",
"previousSibling",
")",
";",
"if",
"(",
"!",
"isBR",
"(",
"end",
")",
")",
"end",
"=",
"endOfLine",
"(",
"end",
",",
"this",
".",
"container",
")",
";",
"this",
".",
"addDirtyNode",
"(",
"start",
")",
";",
"do",
"{",
"var",
"next",
"=",
"endOfLine",
"(",
"current",
",",
"this",
".",
"container",
")",
";",
"if",
"(",
"current",
")",
"this",
".",
"highlight",
"(",
"before",
",",
"next",
",",
"true",
")",
";",
"this",
".",
"indentLineAfter",
"(",
"current",
",",
"direction",
")",
";",
"before",
"=",
"current",
";",
"current",
"=",
"next",
";",
"}",
"while",
"(",
"current",
"!=",
"end",
")",
";",
"select",
".",
"setCursorPos",
"(",
"this",
".",
"container",
",",
"{",
"node",
":",
"start",
",",
"offset",
":",
"0",
"}",
",",
"{",
"node",
":",
"end",
",",
"offset",
":",
"0",
"}",
")",
";",
"}"
]
| Indent all lines whose start falls inside of the current selection. | [
"Indent",
"all",
"lines",
"whose",
"start",
"falls",
"inside",
"of",
"the",
"current",
"selection",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/editor.js#L1050-L1063 |
|
43,179 | neyric/webhookit | public/javascripts/codemirror/js/editor.js | function(safe) {
// pagehide event hack above
if (this.unloaded) {
this.win.document.designMode = "off";
this.win.document.designMode = "on";
this.unloaded = false;
}
if (internetExplorer) {
this.container.createTextRange().execCommand("unlink");
this.selectionSnapshot = select.getBookmark(this.container);
}
var activity = this.options.cursorActivity;
if (!safe || activity) {
var cursor = select.selectionTopNode(this.container, false);
if (cursor === false || !this.container.firstChild) return;
cursor = cursor || this.container.firstChild;
if (activity) activity(cursor);
if (!safe) {
this.scheduleHighlight();
this.addDirtyNode(cursor);
}
}
} | javascript | function(safe) {
// pagehide event hack above
if (this.unloaded) {
this.win.document.designMode = "off";
this.win.document.designMode = "on";
this.unloaded = false;
}
if (internetExplorer) {
this.container.createTextRange().execCommand("unlink");
this.selectionSnapshot = select.getBookmark(this.container);
}
var activity = this.options.cursorActivity;
if (!safe || activity) {
var cursor = select.selectionTopNode(this.container, false);
if (cursor === false || !this.container.firstChild) return;
cursor = cursor || this.container.firstChild;
if (activity) activity(cursor);
if (!safe) {
this.scheduleHighlight();
this.addDirtyNode(cursor);
}
}
} | [
"function",
"(",
"safe",
")",
"{",
"// pagehide event hack above",
"if",
"(",
"this",
".",
"unloaded",
")",
"{",
"this",
".",
"win",
".",
"document",
".",
"designMode",
"=",
"\"off\"",
";",
"this",
".",
"win",
".",
"document",
".",
"designMode",
"=",
"\"on\"",
";",
"this",
".",
"unloaded",
"=",
"false",
";",
"}",
"if",
"(",
"internetExplorer",
")",
"{",
"this",
".",
"container",
".",
"createTextRange",
"(",
")",
".",
"execCommand",
"(",
"\"unlink\"",
")",
";",
"this",
".",
"selectionSnapshot",
"=",
"select",
".",
"getBookmark",
"(",
"this",
".",
"container",
")",
";",
"}",
"var",
"activity",
"=",
"this",
".",
"options",
".",
"cursorActivity",
";",
"if",
"(",
"!",
"safe",
"||",
"activity",
")",
"{",
"var",
"cursor",
"=",
"select",
".",
"selectionTopNode",
"(",
"this",
".",
"container",
",",
"false",
")",
";",
"if",
"(",
"cursor",
"===",
"false",
"||",
"!",
"this",
".",
"container",
".",
"firstChild",
")",
"return",
";",
"cursor",
"=",
"cursor",
"||",
"this",
".",
"container",
".",
"firstChild",
";",
"if",
"(",
"activity",
")",
"activity",
"(",
"cursor",
")",
";",
"if",
"(",
"!",
"safe",
")",
"{",
"this",
".",
"scheduleHighlight",
"(",
")",
";",
"this",
".",
"addDirtyNode",
"(",
"cursor",
")",
";",
"}",
"}",
"}"
]
| Find the node that the cursor is in, mark it as dirty, and make sure a highlight pass is scheduled. | [
"Find",
"the",
"node",
"that",
"the",
"cursor",
"is",
"in",
"mark",
"it",
"as",
"dirty",
"and",
"make",
"sure",
"a",
"highlight",
"pass",
"is",
"scheduled",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/editor.js#L1067-L1091 |
|
43,180 | neyric/webhookit | public/javascripts/codemirror/js/editor.js | function(node) {
node = node || this.container.firstChild;
if (!node) return;
for (var i = 0; i < this.dirty.length; i++)
if (this.dirty[i] == node) return;
if (node.nodeType != 3)
node.dirty = true;
this.dirty.push(node);
} | javascript | function(node) {
node = node || this.container.firstChild;
if (!node) return;
for (var i = 0; i < this.dirty.length; i++)
if (this.dirty[i] == node) return;
if (node.nodeType != 3)
node.dirty = true;
this.dirty.push(node);
} | [
"function",
"(",
"node",
")",
"{",
"node",
"=",
"node",
"||",
"this",
".",
"container",
".",
"firstChild",
";",
"if",
"(",
"!",
"node",
")",
"return",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"dirty",
".",
"length",
";",
"i",
"++",
")",
"if",
"(",
"this",
".",
"dirty",
"[",
"i",
"]",
"==",
"node",
")",
"return",
";",
"if",
"(",
"node",
".",
"nodeType",
"!=",
"3",
")",
"node",
".",
"dirty",
"=",
"true",
";",
"this",
".",
"dirty",
".",
"push",
"(",
"node",
")",
";",
"}"
]
| Add a node to the set of dirty nodes, if it isn't already in there. | [
"Add",
"a",
"node",
"to",
"the",
"set",
"of",
"dirty",
"nodes",
"if",
"it",
"isn",
"t",
"already",
"in",
"there",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/editor.js#L1101-L1111 |
|
43,181 | neyric/webhookit | public/javascripts/codemirror/js/editor.js | function() {
// Timeouts are routed through the parent window, because on
// some browsers designMode windows do not fire timeouts.
var self = this;
this.parent.clearTimeout(this.highlightTimeout);
this.highlightTimeout = this.parent.setTimeout(function(){self.highlightDirty();}, this.options.passDelay);
} | javascript | function() {
// Timeouts are routed through the parent window, because on
// some browsers designMode windows do not fire timeouts.
var self = this;
this.parent.clearTimeout(this.highlightTimeout);
this.highlightTimeout = this.parent.setTimeout(function(){self.highlightDirty();}, this.options.passDelay);
} | [
"function",
"(",
")",
"{",
"// Timeouts are routed through the parent window, because on",
"// some browsers designMode windows do not fire timeouts.",
"var",
"self",
"=",
"this",
";",
"this",
".",
"parent",
".",
"clearTimeout",
"(",
"this",
".",
"highlightTimeout",
")",
";",
"this",
".",
"highlightTimeout",
"=",
"this",
".",
"parent",
".",
"setTimeout",
"(",
"function",
"(",
")",
"{",
"self",
".",
"highlightDirty",
"(",
")",
";",
"}",
",",
"this",
".",
"options",
".",
"passDelay",
")",
";",
"}"
]
| Cause a highlight pass to happen in options.passDelay milliseconds. Clear the existing timeout, if one exists. This way, the passes do not happen while the user is typing, and should as unobtrusive as possible. | [
"Cause",
"a",
"highlight",
"pass",
"to",
"happen",
"in",
"options",
".",
"passDelay",
"milliseconds",
".",
"Clear",
"the",
"existing",
"timeout",
"if",
"one",
"exists",
".",
"This",
"way",
"the",
"passes",
"do",
"not",
"happen",
"while",
"the",
"user",
"is",
"typing",
"and",
"should",
"as",
"unobtrusive",
"as",
"possible",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/editor.js#L1121-L1127 |
|
43,182 | neyric/webhookit | public/javascripts/codemirror/js/editor.js | function() {
while (this.dirty.length > 0) {
var found = this.dirty.pop();
// IE8 sometimes throws an unexplainable 'invalid argument'
// exception for found.parentNode
try {
// If the node has been coloured in the meantime, or is no
// longer in the document, it should not be returned.
while (found && found.parentNode != this.container)
found = found.parentNode;
if (found && (found.dirty || found.nodeType == 3))
return found;
} catch (e) {}
}
return null;
} | javascript | function() {
while (this.dirty.length > 0) {
var found = this.dirty.pop();
// IE8 sometimes throws an unexplainable 'invalid argument'
// exception for found.parentNode
try {
// If the node has been coloured in the meantime, or is no
// longer in the document, it should not be returned.
while (found && found.parentNode != this.container)
found = found.parentNode;
if (found && (found.dirty || found.nodeType == 3))
return found;
} catch (e) {}
}
return null;
} | [
"function",
"(",
")",
"{",
"while",
"(",
"this",
".",
"dirty",
".",
"length",
">",
"0",
")",
"{",
"var",
"found",
"=",
"this",
".",
"dirty",
".",
"pop",
"(",
")",
";",
"// IE8 sometimes throws an unexplainable 'invalid argument'",
"// exception for found.parentNode",
"try",
"{",
"// If the node has been coloured in the meantime, or is no",
"// longer in the document, it should not be returned.",
"while",
"(",
"found",
"&&",
"found",
".",
"parentNode",
"!=",
"this",
".",
"container",
")",
"found",
"=",
"found",
".",
"parentNode",
";",
"if",
"(",
"found",
"&&",
"(",
"found",
".",
"dirty",
"||",
"found",
".",
"nodeType",
"==",
"3",
")",
")",
"return",
"found",
";",
"}",
"catch",
"(",
"e",
")",
"{",
"}",
"}",
"return",
"null",
";",
"}"
]
| Fetch one dirty node, and remove it from the dirty set. | [
"Fetch",
"one",
"dirty",
"node",
"and",
"remove",
"it",
"from",
"the",
"dirty",
"set",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/editor.js#L1130-L1145 |
|
43,183 | neyric/webhookit | public/javascripts/codemirror/js/editor.js | function(force) {
// Prevent FF from raising an error when it is firing timeouts
// on a page that's no longer loaded.
if (!window.select) return;
if (!this.options.readOnly) select.markSelection(this.win);
var start, endTime = force ? null : time() + this.options.passTime;
while ((time() < endTime || force) && (start = this.getDirtyNode())) {
var result = this.highlight(start, endTime);
if (result && result.node && result.dirty)
this.addDirtyNode(result.node);
}
if (!this.options.readOnly) select.selectMarked();
if (start) this.scheduleHighlight();
return this.dirty.length == 0;
} | javascript | function(force) {
// Prevent FF from raising an error when it is firing timeouts
// on a page that's no longer loaded.
if (!window.select) return;
if (!this.options.readOnly) select.markSelection(this.win);
var start, endTime = force ? null : time() + this.options.passTime;
while ((time() < endTime || force) && (start = this.getDirtyNode())) {
var result = this.highlight(start, endTime);
if (result && result.node && result.dirty)
this.addDirtyNode(result.node);
}
if (!this.options.readOnly) select.selectMarked();
if (start) this.scheduleHighlight();
return this.dirty.length == 0;
} | [
"function",
"(",
"force",
")",
"{",
"// Prevent FF from raising an error when it is firing timeouts",
"// on a page that's no longer loaded.",
"if",
"(",
"!",
"window",
".",
"select",
")",
"return",
";",
"if",
"(",
"!",
"this",
".",
"options",
".",
"readOnly",
")",
"select",
".",
"markSelection",
"(",
"this",
".",
"win",
")",
";",
"var",
"start",
",",
"endTime",
"=",
"force",
"?",
"null",
":",
"time",
"(",
")",
"+",
"this",
".",
"options",
".",
"passTime",
";",
"while",
"(",
"(",
"time",
"(",
")",
"<",
"endTime",
"||",
"force",
")",
"&&",
"(",
"start",
"=",
"this",
".",
"getDirtyNode",
"(",
")",
")",
")",
"{",
"var",
"result",
"=",
"this",
".",
"highlight",
"(",
"start",
",",
"endTime",
")",
";",
"if",
"(",
"result",
"&&",
"result",
".",
"node",
"&&",
"result",
".",
"dirty",
")",
"this",
".",
"addDirtyNode",
"(",
"result",
".",
"node",
")",
";",
"}",
"if",
"(",
"!",
"this",
".",
"options",
".",
"readOnly",
")",
"select",
".",
"selectMarked",
"(",
")",
";",
"if",
"(",
"start",
")",
"this",
".",
"scheduleHighlight",
"(",
")",
";",
"return",
"this",
".",
"dirty",
".",
"length",
"==",
"0",
";",
"}"
]
| Pick dirty nodes, and highlight them, until options.passTime milliseconds have gone by. The highlight method will continue to next lines as long as it finds dirty nodes. It returns information about the place where it stopped. If there are dirty nodes left after this function has spent all its lines, it shedules another highlight to finish the job. | [
"Pick",
"dirty",
"nodes",
"and",
"highlight",
"them",
"until",
"options",
".",
"passTime",
"milliseconds",
"have",
"gone",
"by",
".",
"The",
"highlight",
"method",
"will",
"continue",
"to",
"next",
"lines",
"as",
"long",
"as",
"it",
"finds",
"dirty",
"nodes",
".",
"It",
"returns",
"information",
"about",
"the",
"place",
"where",
"it",
"stopped",
".",
"If",
"there",
"are",
"dirty",
"nodes",
"left",
"after",
"this",
"function",
"has",
"spent",
"all",
"its",
"lines",
"it",
"shedules",
"another",
"highlight",
"to",
"finish",
"the",
"job",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/editor.js#L1153-L1168 |
|
43,184 | neyric/webhookit | public/javascripts/codemirror/js/editor.js | function(passTime) {
var self = this, pos = null;
return function() {
// FF timeout weirdness workaround.
if (!window.select) return;
// If the current node is no longer in the document... oh
// well, we start over.
if (pos && pos.parentNode != self.container)
pos = null;
select.markSelection(self.win);
var result = self.highlight(pos, time() + passTime, true);
select.selectMarked();
var newPos = result ? (result.node && result.node.nextSibling) : null;
pos = (pos == newPos) ? null : newPos;
self.delayScanning();
};
} | javascript | function(passTime) {
var self = this, pos = null;
return function() {
// FF timeout weirdness workaround.
if (!window.select) return;
// If the current node is no longer in the document... oh
// well, we start over.
if (pos && pos.parentNode != self.container)
pos = null;
select.markSelection(self.win);
var result = self.highlight(pos, time() + passTime, true);
select.selectMarked();
var newPos = result ? (result.node && result.node.nextSibling) : null;
pos = (pos == newPos) ? null : newPos;
self.delayScanning();
};
} | [
"function",
"(",
"passTime",
")",
"{",
"var",
"self",
"=",
"this",
",",
"pos",
"=",
"null",
";",
"return",
"function",
"(",
")",
"{",
"// FF timeout weirdness workaround.",
"if",
"(",
"!",
"window",
".",
"select",
")",
"return",
";",
"// If the current node is no longer in the document... oh",
"// well, we start over.",
"if",
"(",
"pos",
"&&",
"pos",
".",
"parentNode",
"!=",
"self",
".",
"container",
")",
"pos",
"=",
"null",
";",
"select",
".",
"markSelection",
"(",
"self",
".",
"win",
")",
";",
"var",
"result",
"=",
"self",
".",
"highlight",
"(",
"pos",
",",
"time",
"(",
")",
"+",
"passTime",
",",
"true",
")",
";",
"select",
".",
"selectMarked",
"(",
")",
";",
"var",
"newPos",
"=",
"result",
"?",
"(",
"result",
".",
"node",
"&&",
"result",
".",
"node",
".",
"nextSibling",
")",
":",
"null",
";",
"pos",
"=",
"(",
"pos",
"==",
"newPos",
")",
"?",
"null",
":",
"newPos",
";",
"self",
".",
"delayScanning",
"(",
")",
";",
"}",
";",
"}"
]
| Creates a function that, when called through a timeout, will continuously re-parse the document. | [
"Creates",
"a",
"function",
"that",
"when",
"called",
"through",
"a",
"timeout",
"will",
"continuously",
"re",
"-",
"parse",
"the",
"document",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/editor.js#L1172-L1188 |
|
43,185 | neyric/webhookit | public/javascripts/codemirror/js/editor.js | function() {
if (this.scanner) {
this.parent.clearTimeout(this.documentScan);
this.documentScan = this.parent.setTimeout(this.scanner, this.options.continuousScanning);
}
} | javascript | function() {
if (this.scanner) {
this.parent.clearTimeout(this.documentScan);
this.documentScan = this.parent.setTimeout(this.scanner, this.options.continuousScanning);
}
} | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"scanner",
")",
"{",
"this",
".",
"parent",
".",
"clearTimeout",
"(",
"this",
".",
"documentScan",
")",
";",
"this",
".",
"documentScan",
"=",
"this",
".",
"parent",
".",
"setTimeout",
"(",
"this",
".",
"scanner",
",",
"this",
".",
"options",
".",
"continuousScanning",
")",
";",
"}",
"}"
]
| Starts the continuous scanning process for this document after a given interval. | [
"Starts",
"the",
"continuous",
"scanning",
"process",
"for",
"this",
"document",
"after",
"a",
"given",
"interval",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/editor.js#L1192-L1197 |
|
43,186 | neyric/webhookit | public/javascripts/codemirror/js/editor.js | tokenPart | function tokenPart(token){
var part = makePartSpan(token.value, self.doc);
part.className = token.style;
return part;
} | javascript | function tokenPart(token){
var part = makePartSpan(token.value, self.doc);
part.className = token.style;
return part;
} | [
"function",
"tokenPart",
"(",
"token",
")",
"{",
"var",
"part",
"=",
"makePartSpan",
"(",
"token",
".",
"value",
",",
"self",
".",
"doc",
")",
";",
"part",
".",
"className",
"=",
"token",
".",
"style",
";",
"return",
"part",
";",
"}"
]
| Create a part corresponding to a given token. | [
"Create",
"a",
"part",
"corresponding",
"to",
"a",
"given",
"token",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/editor.js#L1246-L1250 |
43,187 | neyric/webhookit | public/javascripts/codemirror/js/editor.js | function(){
var part = this.get();
// Allow empty nodes when they are alone on a line, needed
// for the FF cursor bug workaround (see select.js,
// insertNewlineAtCursor).
while (part && isSpan(part) && part.currentText == "") {
// Leave empty nodes that are alone on a line alone in
// Opera, since that browsers doesn't deal well with
// having 2 BRs in a row.
if (window.opera && surroundedByBRs(part)) {
this.next();
part = this.get();
}
else {
var old = part;
this.remove();
part = this.get();
// Adjust selection information, if any. See select.js for details.
select.snapshotMove(old.firstChild, part && (part.firstChild || part), 0);
}
}
return part;
} | javascript | function(){
var part = this.get();
// Allow empty nodes when they are alone on a line, needed
// for the FF cursor bug workaround (see select.js,
// insertNewlineAtCursor).
while (part && isSpan(part) && part.currentText == "") {
// Leave empty nodes that are alone on a line alone in
// Opera, since that browsers doesn't deal well with
// having 2 BRs in a row.
if (window.opera && surroundedByBRs(part)) {
this.next();
part = this.get();
}
else {
var old = part;
this.remove();
part = this.get();
// Adjust selection information, if any. See select.js for details.
select.snapshotMove(old.firstChild, part && (part.firstChild || part), 0);
}
}
return part;
} | [
"function",
"(",
")",
"{",
"var",
"part",
"=",
"this",
".",
"get",
"(",
")",
";",
"// Allow empty nodes when they are alone on a line, needed",
"// for the FF cursor bug workaround (see select.js,",
"// insertNewlineAtCursor).",
"while",
"(",
"part",
"&&",
"isSpan",
"(",
"part",
")",
"&&",
"part",
".",
"currentText",
"==",
"\"\"",
")",
"{",
"// Leave empty nodes that are alone on a line alone in",
"// Opera, since that browsers doesn't deal well with",
"// having 2 BRs in a row.",
"if",
"(",
"window",
".",
"opera",
"&&",
"surroundedByBRs",
"(",
"part",
")",
")",
"{",
"this",
".",
"next",
"(",
")",
";",
"part",
"=",
"this",
".",
"get",
"(",
")",
";",
"}",
"else",
"{",
"var",
"old",
"=",
"part",
";",
"this",
".",
"remove",
"(",
")",
";",
"part",
"=",
"this",
".",
"get",
"(",
")",
";",
"// Adjust selection information, if any. See select.js for details.",
"select",
".",
"snapshotMove",
"(",
"old",
".",
"firstChild",
",",
"part",
"&&",
"(",
"part",
".",
"firstChild",
"||",
"part",
")",
",",
"0",
")",
";",
"}",
"}",
"return",
"part",
";",
"}"
]
| Advance to the next part that is not empty, discarding empty parts. | [
"Advance",
"to",
"the",
"next",
"part",
"that",
"is",
"not",
"empty",
"discarding",
"empty",
"parts",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/editor.js#L1304-L1327 |
|
43,188 | neyric/webhookit | public/javascripts/WireIt/plugins/layout/js/Layout.js | function() {
this.nodes = [];
this.edges = [];
// Extract wires
for(var i = 0 ; i < this.layer.wires.length ; i++) {
var wire = this.layer.wires[i];
this.edges.push([this.layer.containers.indexOf(wire.terminal1.container), this.layer.containers.indexOf(wire.terminal2.container) ]);
}
} | javascript | function() {
this.nodes = [];
this.edges = [];
// Extract wires
for(var i = 0 ; i < this.layer.wires.length ; i++) {
var wire = this.layer.wires[i];
this.edges.push([this.layer.containers.indexOf(wire.terminal1.container), this.layer.containers.indexOf(wire.terminal2.container) ]);
}
} | [
"function",
"(",
")",
"{",
"this",
".",
"nodes",
"=",
"[",
"]",
";",
"this",
".",
"edges",
"=",
"[",
"]",
";",
"// Extract wires",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"layer",
".",
"wires",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
"wire",
"=",
"this",
".",
"layer",
".",
"wires",
"[",
"i",
"]",
";",
"this",
".",
"edges",
".",
"push",
"(",
"[",
"this",
".",
"layer",
".",
"containers",
".",
"indexOf",
"(",
"wire",
".",
"terminal1",
".",
"container",
")",
",",
"this",
".",
"layer",
".",
"containers",
".",
"indexOf",
"(",
"wire",
".",
"terminal2",
".",
"container",
")",
"]",
")",
";",
"}",
"}"
]
| Init the default structure | [
"Init",
"the",
"default",
"structure"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/WireIt/plugins/layout/js/Layout.js#L99-L110 |
|
43,189 | neyric/webhookit | public/javascripts/inputex/js/fields/IPv4Field.js | function(options) {
inputEx.IPv4Field.superclass.setOptions.call(this, options);
this.options.messages.invalid = inputEx.messages.invalidIPv4;
this.options.regexp = /^(?:1\d?\d?|2(?:[0-4]\d?|[6789]|5[0-5]?)?|[3-9]\d?|0)(?:\.(?:1\d?\d?|2(?:[0-4]\d?|[6789]|5[0-5]?)?|[3-9]\d?|0)){3}$/;
} | javascript | function(options) {
inputEx.IPv4Field.superclass.setOptions.call(this, options);
this.options.messages.invalid = inputEx.messages.invalidIPv4;
this.options.regexp = /^(?:1\d?\d?|2(?:[0-4]\d?|[6789]|5[0-5]?)?|[3-9]\d?|0)(?:\.(?:1\d?\d?|2(?:[0-4]\d?|[6789]|5[0-5]?)?|[3-9]\d?|0)){3}$/;
} | [
"function",
"(",
"options",
")",
"{",
"inputEx",
".",
"IPv4Field",
".",
"superclass",
".",
"setOptions",
".",
"call",
"(",
"this",
",",
"options",
")",
";",
"this",
".",
"options",
".",
"messages",
".",
"invalid",
"=",
"inputEx",
".",
"messages",
".",
"invalidIPv4",
";",
"this",
".",
"options",
".",
"regexp",
"=",
"/",
"^(?:1\\d?\\d?|2(?:[0-4]\\d?|[6789]|5[0-5]?)?|[3-9]\\d?|0)(?:\\.(?:1\\d?\\d?|2(?:[0-4]\\d?|[6789]|5[0-5]?)?|[3-9]\\d?|0)){3}$",
"/",
";",
"}"
]
| set IPv4 regexp and invalid string
@param {Object} options Options object as passed to the constructor | [
"set",
"IPv4",
"regexp",
"and",
"invalid",
"string"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/inputex/js/fields/IPv4Field.js#L19-L23 |
|
43,190 | neyric/webhookit | public/javascripts/yui/calendar/calendar-debug.js | function(id, container, config) {
// Normalize 2.4.0, pre 2.4.0 args
var nArgs = this._parseArgs(arguments);
id = nArgs.id;
container = nArgs.container;
config = nArgs.config;
this.oDomContainer = Dom.get(container);
if (!this.oDomContainer) { this.logger.log("Container not found in document.", "error"); }
if (!this.oDomContainer.id) {
this.oDomContainer.id = Dom.generateId();
}
if (!id) {
id = this.oDomContainer.id + "_t";
}
/**
* The unique id associated with the CalendarGroup
* @property id
* @type String
*/
this.id = id;
/**
* The unique id associated with the CalendarGroup container
* @property containerId
* @type String
*/
this.containerId = this.oDomContainer.id;
this.logger = new YAHOO.widget.LogWriter("CalendarGroup " + this.id);
this.initEvents();
this.initStyles();
/**
* The collection of Calendar pages contained within the CalendarGroup
* @property pages
* @type YAHOO.widget.Calendar[]
*/
this.pages = [];
Dom.addClass(this.oDomContainer, CalendarGroup.CSS_CONTAINER);
Dom.addClass(this.oDomContainer, CalendarGroup.CSS_MULTI_UP);
/**
* The Config object used to hold the configuration variables for the CalendarGroup
* @property cfg
* @type YAHOO.util.Config
*/
this.cfg = new YAHOO.util.Config(this);
/**
* The local object which contains the CalendarGroup's options
* @property Options
* @type Object
*/
this.Options = {};
/**
* The local object which contains the CalendarGroup's locale settings
* @property Locale
* @type Object
*/
this.Locale = {};
this.setupConfig();
if (config) {
this.cfg.applyConfig(config, true);
}
this.cfg.fireQueue();
// OPERA HACK FOR MISWRAPPED FLOATS
if (YAHOO.env.ua.opera){
this.renderEvent.subscribe(this._fixWidth, this, true);
this.showEvent.subscribe(this._fixWidth, this, true);
}
this.logger.log("Initialized " + this.pages.length + "-page CalendarGroup", "info");
} | javascript | function(id, container, config) {
// Normalize 2.4.0, pre 2.4.0 args
var nArgs = this._parseArgs(arguments);
id = nArgs.id;
container = nArgs.container;
config = nArgs.config;
this.oDomContainer = Dom.get(container);
if (!this.oDomContainer) { this.logger.log("Container not found in document.", "error"); }
if (!this.oDomContainer.id) {
this.oDomContainer.id = Dom.generateId();
}
if (!id) {
id = this.oDomContainer.id + "_t";
}
/**
* The unique id associated with the CalendarGroup
* @property id
* @type String
*/
this.id = id;
/**
* The unique id associated with the CalendarGroup container
* @property containerId
* @type String
*/
this.containerId = this.oDomContainer.id;
this.logger = new YAHOO.widget.LogWriter("CalendarGroup " + this.id);
this.initEvents();
this.initStyles();
/**
* The collection of Calendar pages contained within the CalendarGroup
* @property pages
* @type YAHOO.widget.Calendar[]
*/
this.pages = [];
Dom.addClass(this.oDomContainer, CalendarGroup.CSS_CONTAINER);
Dom.addClass(this.oDomContainer, CalendarGroup.CSS_MULTI_UP);
/**
* The Config object used to hold the configuration variables for the CalendarGroup
* @property cfg
* @type YAHOO.util.Config
*/
this.cfg = new YAHOO.util.Config(this);
/**
* The local object which contains the CalendarGroup's options
* @property Options
* @type Object
*/
this.Options = {};
/**
* The local object which contains the CalendarGroup's locale settings
* @property Locale
* @type Object
*/
this.Locale = {};
this.setupConfig();
if (config) {
this.cfg.applyConfig(config, true);
}
this.cfg.fireQueue();
// OPERA HACK FOR MISWRAPPED FLOATS
if (YAHOO.env.ua.opera){
this.renderEvent.subscribe(this._fixWidth, this, true);
this.showEvent.subscribe(this._fixWidth, this, true);
}
this.logger.log("Initialized " + this.pages.length + "-page CalendarGroup", "info");
} | [
"function",
"(",
"id",
",",
"container",
",",
"config",
")",
"{",
"// Normalize 2.4.0, pre 2.4.0 args",
"var",
"nArgs",
"=",
"this",
".",
"_parseArgs",
"(",
"arguments",
")",
";",
"id",
"=",
"nArgs",
".",
"id",
";",
"container",
"=",
"nArgs",
".",
"container",
";",
"config",
"=",
"nArgs",
".",
"config",
";",
"this",
".",
"oDomContainer",
"=",
"Dom",
".",
"get",
"(",
"container",
")",
";",
"if",
"(",
"!",
"this",
".",
"oDomContainer",
")",
"{",
"this",
".",
"logger",
".",
"log",
"(",
"\"Container not found in document.\"",
",",
"\"error\"",
")",
";",
"}",
"if",
"(",
"!",
"this",
".",
"oDomContainer",
".",
"id",
")",
"{",
"this",
".",
"oDomContainer",
".",
"id",
"=",
"Dom",
".",
"generateId",
"(",
")",
";",
"}",
"if",
"(",
"!",
"id",
")",
"{",
"id",
"=",
"this",
".",
"oDomContainer",
".",
"id",
"+",
"\"_t\"",
";",
"}",
"/**\n * The unique id associated with the CalendarGroup\n * @property id\n * @type String\n */",
"this",
".",
"id",
"=",
"id",
";",
"/**\n * The unique id associated with the CalendarGroup container\n * @property containerId\n * @type String\n */",
"this",
".",
"containerId",
"=",
"this",
".",
"oDomContainer",
".",
"id",
";",
"this",
".",
"logger",
"=",
"new",
"YAHOO",
".",
"widget",
".",
"LogWriter",
"(",
"\"CalendarGroup \"",
"+",
"this",
".",
"id",
")",
";",
"this",
".",
"initEvents",
"(",
")",
";",
"this",
".",
"initStyles",
"(",
")",
";",
"/**\n * The collection of Calendar pages contained within the CalendarGroup\n * @property pages\n * @type YAHOO.widget.Calendar[]\n */",
"this",
".",
"pages",
"=",
"[",
"]",
";",
"Dom",
".",
"addClass",
"(",
"this",
".",
"oDomContainer",
",",
"CalendarGroup",
".",
"CSS_CONTAINER",
")",
";",
"Dom",
".",
"addClass",
"(",
"this",
".",
"oDomContainer",
",",
"CalendarGroup",
".",
"CSS_MULTI_UP",
")",
";",
"/**\n * The Config object used to hold the configuration variables for the CalendarGroup\n * @property cfg\n * @type YAHOO.util.Config\n */",
"this",
".",
"cfg",
"=",
"new",
"YAHOO",
".",
"util",
".",
"Config",
"(",
"this",
")",
";",
"/**\n * The local object which contains the CalendarGroup's options\n * @property Options\n * @type Object\n */",
"this",
".",
"Options",
"=",
"{",
"}",
";",
"/**\n * The local object which contains the CalendarGroup's locale settings\n * @property Locale\n * @type Object\n */",
"this",
".",
"Locale",
"=",
"{",
"}",
";",
"this",
".",
"setupConfig",
"(",
")",
";",
"if",
"(",
"config",
")",
"{",
"this",
".",
"cfg",
".",
"applyConfig",
"(",
"config",
",",
"true",
")",
";",
"}",
"this",
".",
"cfg",
".",
"fireQueue",
"(",
")",
";",
"// OPERA HACK FOR MISWRAPPED FLOATS",
"if",
"(",
"YAHOO",
".",
"env",
".",
"ua",
".",
"opera",
")",
"{",
"this",
".",
"renderEvent",
".",
"subscribe",
"(",
"this",
".",
"_fixWidth",
",",
"this",
",",
"true",
")",
";",
"this",
".",
"showEvent",
".",
"subscribe",
"(",
"this",
".",
"_fixWidth",
",",
"this",
",",
"true",
")",
";",
"}",
"this",
".",
"logger",
".",
"log",
"(",
"\"Initialized \"",
"+",
"this",
".",
"pages",
".",
"length",
"+",
"\"-page CalendarGroup\"",
",",
"\"info\"",
")",
";",
"}"
]
| Initializes the calendar group. All subclasses must call this method in order for the
group to be initialized properly.
@method init
@param {String} id optional The id of the table element that will represent the CalendarGroup widget. As of 2.4.0, this argument is optional.
@param {String | HTMLElement} container The id of the container div element that will wrap the CalendarGroup table, or a reference to a DIV element which exists in the document.
@param {Object} config optional The configuration object containing the initial configuration values for the CalendarGroup. | [
"Initializes",
"the",
"calendar",
"group",
".",
"All",
"subclasses",
"must",
"call",
"this",
"method",
"in",
"order",
"for",
"the",
"group",
"to",
"be",
"initialized",
"properly",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/calendar/calendar-debug.js#L4712-L4795 |
|
43,191 | neyric/webhookit | public/javascripts/inputex/js/fields/TreeField.js | function() {
// Add element button
this.addButton = inputEx.cn('img', {src: inputEx.spacerUrl, className: 'inputEx-ListField-addButton'});
Dom.setStyle(this.addButton, 'float', 'left');
this.fieldContainer.appendChild(this.addButton);
// Instanciate the new subField
this.subField = inputEx(this.options.elementType,this);
var subFieldEl = this.subField.getEl();
Dom.setStyle(subFieldEl, 'margin-left', '4px');
Dom.setStyle(subFieldEl, 'float', 'left');
this.fieldContainer.appendChild( subFieldEl );
// Line breaker
this.fieldContainer.appendChild( inputEx.cn('div', null, {clear: "both"}, this.options.listLabel) );
// Div element to contain the children
this.childContainer = inputEx.cn('div', {className: 'inputEx-ListField-childContainer'});
this.fieldContainer.appendChild(this.childContainer);
} | javascript | function() {
// Add element button
this.addButton = inputEx.cn('img', {src: inputEx.spacerUrl, className: 'inputEx-ListField-addButton'});
Dom.setStyle(this.addButton, 'float', 'left');
this.fieldContainer.appendChild(this.addButton);
// Instanciate the new subField
this.subField = inputEx(this.options.elementType,this);
var subFieldEl = this.subField.getEl();
Dom.setStyle(subFieldEl, 'margin-left', '4px');
Dom.setStyle(subFieldEl, 'float', 'left');
this.fieldContainer.appendChild( subFieldEl );
// Line breaker
this.fieldContainer.appendChild( inputEx.cn('div', null, {clear: "both"}, this.options.listLabel) );
// Div element to contain the children
this.childContainer = inputEx.cn('div', {className: 'inputEx-ListField-childContainer'});
this.fieldContainer.appendChild(this.childContainer);
} | [
"function",
"(",
")",
"{",
"// Add element button",
"this",
".",
"addButton",
"=",
"inputEx",
".",
"cn",
"(",
"'img'",
",",
"{",
"src",
":",
"inputEx",
".",
"spacerUrl",
",",
"className",
":",
"'inputEx-ListField-addButton'",
"}",
")",
";",
"Dom",
".",
"setStyle",
"(",
"this",
".",
"addButton",
",",
"'float'",
",",
"'left'",
")",
";",
"this",
".",
"fieldContainer",
".",
"appendChild",
"(",
"this",
".",
"addButton",
")",
";",
"// Instanciate the new subField",
"this",
".",
"subField",
"=",
"inputEx",
"(",
"this",
".",
"options",
".",
"elementType",
",",
"this",
")",
";",
"var",
"subFieldEl",
"=",
"this",
".",
"subField",
".",
"getEl",
"(",
")",
";",
"Dom",
".",
"setStyle",
"(",
"subFieldEl",
",",
"'margin-left'",
",",
"'4px'",
")",
";",
"Dom",
".",
"setStyle",
"(",
"subFieldEl",
",",
"'float'",
",",
"'left'",
")",
";",
"this",
".",
"fieldContainer",
".",
"appendChild",
"(",
"subFieldEl",
")",
";",
"// Line breaker",
"this",
".",
"fieldContainer",
".",
"appendChild",
"(",
"inputEx",
".",
"cn",
"(",
"'div'",
",",
"null",
",",
"{",
"clear",
":",
"\"both\"",
"}",
",",
"this",
".",
"options",
".",
"listLabel",
")",
")",
";",
"// Div element to contain the children",
"this",
".",
"childContainer",
"=",
"inputEx",
".",
"cn",
"(",
"'div'",
",",
"{",
"className",
":",
"'inputEx-ListField-childContainer'",
"}",
")",
";",
"this",
".",
"fieldContainer",
".",
"appendChild",
"(",
"this",
".",
"childContainer",
")",
";",
"}"
]
| Render the addButton and childContainer | [
"Render",
"the",
"addButton",
"and",
"childContainer"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/inputex/js/fields/TreeField.js#L53-L75 |
|
43,192 | neyric/webhookit | public/javascripts/WireIt/plugins/composable/examples/jsBox/jsBox.js | function() {
jsBox.WiringEditor.superclass.renderButtons.call(this);
// Add the run button to the toolbar
var toolbar = YAHOO.util.Dom.get('toolbar');
var runButton = new YAHOO.widget.Button({ label:"Run", id:"WiringEditor-runButton", container: toolbar });
runButton.on("click", jsBox.run, jsBox, true);
} | javascript | function() {
jsBox.WiringEditor.superclass.renderButtons.call(this);
// Add the run button to the toolbar
var toolbar = YAHOO.util.Dom.get('toolbar');
var runButton = new YAHOO.widget.Button({ label:"Run", id:"WiringEditor-runButton", container: toolbar });
runButton.on("click", jsBox.run, jsBox, true);
} | [
"function",
"(",
")",
"{",
"jsBox",
".",
"WiringEditor",
".",
"superclass",
".",
"renderButtons",
".",
"call",
"(",
"this",
")",
";",
"// Add the run button to the toolbar",
"var",
"toolbar",
"=",
"YAHOO",
".",
"util",
".",
"Dom",
".",
"get",
"(",
"'toolbar'",
")",
";",
"var",
"runButton",
"=",
"new",
"YAHOO",
".",
"widget",
".",
"Button",
"(",
"{",
"label",
":",
"\"Run\"",
",",
"id",
":",
"\"WiringEditor-runButton\"",
",",
"container",
":",
"toolbar",
"}",
")",
";",
"runButton",
".",
"on",
"(",
"\"click\"",
",",
"jsBox",
".",
"run",
",",
"jsBox",
",",
"true",
")",
";",
"}"
]
| Add the "run" button | [
"Add",
"the",
"run",
"button"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/WireIt/plugins/composable/examples/jsBox/jsBox.js#L98-L105 |
|
43,193 | neyric/webhookit | public/javascripts/yui/menu/menu-debug.js | function (p_sType, p_aArgs, p_oItem) {
var sText = p_aArgs[0],
oConfig = this.cfg,
oAnchor = this._oAnchor,
sHelpText = oConfig.getProperty(_HELP_TEXT),
sHelpTextHTML = _EMPTY_STRING,
sEmphasisStartTag = _EMPTY_STRING,
sEmphasisEndTag = _EMPTY_STRING;
if (sText) {
if (sHelpText) {
sHelpTextHTML = _START_HELP_TEXT + sHelpText + _END_EM;
}
if (oConfig.getProperty(_EMPHASIS)) {
sEmphasisStartTag = _START_EM;
sEmphasisEndTag = _END_EM;
}
if (oConfig.getProperty(_STRONG_EMPHASIS)) {
sEmphasisStartTag = _START_STRONG;
sEmphasisEndTag = _END_STRONG;
}
oAnchor.innerHTML = (sEmphasisStartTag + sText + sEmphasisEndTag + sHelpTextHTML);
}
} | javascript | function (p_sType, p_aArgs, p_oItem) {
var sText = p_aArgs[0],
oConfig = this.cfg,
oAnchor = this._oAnchor,
sHelpText = oConfig.getProperty(_HELP_TEXT),
sHelpTextHTML = _EMPTY_STRING,
sEmphasisStartTag = _EMPTY_STRING,
sEmphasisEndTag = _EMPTY_STRING;
if (sText) {
if (sHelpText) {
sHelpTextHTML = _START_HELP_TEXT + sHelpText + _END_EM;
}
if (oConfig.getProperty(_EMPHASIS)) {
sEmphasisStartTag = _START_EM;
sEmphasisEndTag = _END_EM;
}
if (oConfig.getProperty(_STRONG_EMPHASIS)) {
sEmphasisStartTag = _START_STRONG;
sEmphasisEndTag = _END_STRONG;
}
oAnchor.innerHTML = (sEmphasisStartTag + sText + sEmphasisEndTag + sHelpTextHTML);
}
} | [
"function",
"(",
"p_sType",
",",
"p_aArgs",
",",
"p_oItem",
")",
"{",
"var",
"sText",
"=",
"p_aArgs",
"[",
"0",
"]",
",",
"oConfig",
"=",
"this",
".",
"cfg",
",",
"oAnchor",
"=",
"this",
".",
"_oAnchor",
",",
"sHelpText",
"=",
"oConfig",
".",
"getProperty",
"(",
"_HELP_TEXT",
")",
",",
"sHelpTextHTML",
"=",
"_EMPTY_STRING",
",",
"sEmphasisStartTag",
"=",
"_EMPTY_STRING",
",",
"sEmphasisEndTag",
"=",
"_EMPTY_STRING",
";",
"if",
"(",
"sText",
")",
"{",
"if",
"(",
"sHelpText",
")",
"{",
"sHelpTextHTML",
"=",
"_START_HELP_TEXT",
"+",
"sHelpText",
"+",
"_END_EM",
";",
"}",
"if",
"(",
"oConfig",
".",
"getProperty",
"(",
"_EMPHASIS",
")",
")",
"{",
"sEmphasisStartTag",
"=",
"_START_EM",
";",
"sEmphasisEndTag",
"=",
"_END_EM",
";",
"}",
"if",
"(",
"oConfig",
".",
"getProperty",
"(",
"_STRONG_EMPHASIS",
")",
")",
"{",
"sEmphasisStartTag",
"=",
"_START_STRONG",
";",
"sEmphasisEndTag",
"=",
"_END_STRONG",
";",
"}",
"oAnchor",
".",
"innerHTML",
"=",
"(",
"sEmphasisStartTag",
"+",
"sText",
"+",
"sEmphasisEndTag",
"+",
"sHelpTextHTML",
")",
";",
"}",
"}"
]
| Event handlers for configuration properties
@method configText
@description Event handler for when the "text" configuration property of
the menu item changes.
@param {String} p_sType String representing the name of the event that
was fired.
@param {Array} p_aArgs Array of arguments sent when the event was fired.
@param {YAHOO.widget.MenuItem} p_oItem Object representing the menu item
that fired the event. | [
"Event",
"handlers",
"for",
"configuration",
"properties"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/menu/menu-debug.js#L7361-L7402 |
|
43,194 | neyric/webhookit | public/javascripts/inputex/js/widgets/json-tree-inspector.js | function() {
// Remove from DOM
if(Dom.inDocument(this.el)) {
this.el.parentNode.removeChild(this.el);
}
// recursively purge element
Event.purgeElement(this.el, true);
} | javascript | function() {
// Remove from DOM
if(Dom.inDocument(this.el)) {
this.el.parentNode.removeChild(this.el);
}
// recursively purge element
Event.purgeElement(this.el, true);
} | [
"function",
"(",
")",
"{",
"// Remove from DOM",
"if",
"(",
"Dom",
".",
"inDocument",
"(",
"this",
".",
"el",
")",
")",
"{",
"this",
".",
"el",
".",
"parentNode",
".",
"removeChild",
"(",
"this",
".",
"el",
")",
";",
"}",
"// recursively purge element",
"Event",
".",
"purgeElement",
"(",
"this",
".",
"el",
",",
"true",
")",
";",
"}"
]
| Destroy the widget | [
"Destroy",
"the",
"widget"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/inputex/js/widgets/json-tree-inspector.js#L35-L44 |
|
43,195 | neyric/webhookit | public/javascripts/inputex/js/widgets/json-tree-inspector.js | function(obj,parentEl) {
var ul = inputEx.cn('ul', {className: 'inputEx-JsonTreeInspector'});
for(var key in obj) {
if(obj.hasOwnProperty(key)) {
var value = obj[key];
var id = Dom.generateId();
var li = inputEx.cn('li', {id: id}, null, key+':');
this.hash[id] = {value: value, expanded: false};
if( lang.isObject(value) || lang.isArray(value) ) {
if(lang.isArray(value)) {
li.appendChild( inputEx.cn('span', null, null, "[ "+value.length+" element"+(value.length > 1 ? 's':'')+"]" ) );
}
Dom.addClass(li,'collapsed');
Event.addListener(li, 'click', this.onItemClick, this, true);
}
else {
var spanContent = '';
if( lang.isString(value) ) {
spanContent = '"'+inputEx.htmlEntities(value)+'"';
}
else {
if(value === null) {
spanContent = "null";
}
else {
spanContent = value.toString();
}
}
li.appendChild( inputEx.cn('span', {className: 'type-'+(value === null ? "null" : (typeof value))}, null, spanContent ) );
}
ul.appendChild(li);
}
}
parentEl.appendChild(ul);
return ul;
} | javascript | function(obj,parentEl) {
var ul = inputEx.cn('ul', {className: 'inputEx-JsonTreeInspector'});
for(var key in obj) {
if(obj.hasOwnProperty(key)) {
var value = obj[key];
var id = Dom.generateId();
var li = inputEx.cn('li', {id: id}, null, key+':');
this.hash[id] = {value: value, expanded: false};
if( lang.isObject(value) || lang.isArray(value) ) {
if(lang.isArray(value)) {
li.appendChild( inputEx.cn('span', null, null, "[ "+value.length+" element"+(value.length > 1 ? 's':'')+"]" ) );
}
Dom.addClass(li,'collapsed');
Event.addListener(li, 'click', this.onItemClick, this, true);
}
else {
var spanContent = '';
if( lang.isString(value) ) {
spanContent = '"'+inputEx.htmlEntities(value)+'"';
}
else {
if(value === null) {
spanContent = "null";
}
else {
spanContent = value.toString();
}
}
li.appendChild( inputEx.cn('span', {className: 'type-'+(value === null ? "null" : (typeof value))}, null, spanContent ) );
}
ul.appendChild(li);
}
}
parentEl.appendChild(ul);
return ul;
} | [
"function",
"(",
"obj",
",",
"parentEl",
")",
"{",
"var",
"ul",
"=",
"inputEx",
".",
"cn",
"(",
"'ul'",
",",
"{",
"className",
":",
"'inputEx-JsonTreeInspector'",
"}",
")",
";",
"for",
"(",
"var",
"key",
"in",
"obj",
")",
"{",
"if",
"(",
"obj",
".",
"hasOwnProperty",
"(",
"key",
")",
")",
"{",
"var",
"value",
"=",
"obj",
"[",
"key",
"]",
";",
"var",
"id",
"=",
"Dom",
".",
"generateId",
"(",
")",
";",
"var",
"li",
"=",
"inputEx",
".",
"cn",
"(",
"'li'",
",",
"{",
"id",
":",
"id",
"}",
",",
"null",
",",
"key",
"+",
"':'",
")",
";",
"this",
".",
"hash",
"[",
"id",
"]",
"=",
"{",
"value",
":",
"value",
",",
"expanded",
":",
"false",
"}",
";",
"if",
"(",
"lang",
".",
"isObject",
"(",
"value",
")",
"||",
"lang",
".",
"isArray",
"(",
"value",
")",
")",
"{",
"if",
"(",
"lang",
".",
"isArray",
"(",
"value",
")",
")",
"{",
"li",
".",
"appendChild",
"(",
"inputEx",
".",
"cn",
"(",
"'span'",
",",
"null",
",",
"null",
",",
"\"[ \"",
"+",
"value",
".",
"length",
"+",
"\" element\"",
"+",
"(",
"value",
".",
"length",
">",
"1",
"?",
"'s'",
":",
"''",
")",
"+",
"\"]\"",
")",
")",
";",
"}",
"Dom",
".",
"addClass",
"(",
"li",
",",
"'collapsed'",
")",
";",
"Event",
".",
"addListener",
"(",
"li",
",",
"'click'",
",",
"this",
".",
"onItemClick",
",",
"this",
",",
"true",
")",
";",
"}",
"else",
"{",
"var",
"spanContent",
"=",
"''",
";",
"if",
"(",
"lang",
".",
"isString",
"(",
"value",
")",
")",
"{",
"spanContent",
"=",
"'\"'",
"+",
"inputEx",
".",
"htmlEntities",
"(",
"value",
")",
"+",
"'\"'",
";",
"}",
"else",
"{",
"if",
"(",
"value",
"===",
"null",
")",
"{",
"spanContent",
"=",
"\"null\"",
";",
"}",
"else",
"{",
"spanContent",
"=",
"value",
".",
"toString",
"(",
")",
";",
"}",
"}",
"li",
".",
"appendChild",
"(",
"inputEx",
".",
"cn",
"(",
"'span'",
",",
"{",
"className",
":",
"'type-'",
"+",
"(",
"value",
"===",
"null",
"?",
"\"null\"",
":",
"(",
"typeof",
"value",
")",
")",
"}",
",",
"null",
",",
"spanContent",
")",
")",
";",
"}",
"ul",
".",
"appendChild",
"(",
"li",
")",
";",
"}",
"}",
"parentEl",
".",
"appendChild",
"(",
"ul",
")",
";",
"return",
"ul",
";",
"}"
]
| Build the sub-branch for obj | [
"Build",
"the",
"sub",
"-",
"branch",
"for",
"obj"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/inputex/js/widgets/json-tree-inspector.js#L49-L93 |
|
43,196 | neyric/webhookit | public/javascripts/inputex/js/widgets/json-tree-inspector.js | function(e, params) {
Event.stopEvent(e);
var tgt = Event.getTarget(e);
if( Dom.hasClass(tgt, 'expanded') || Dom.hasClass(tgt, 'collapsed') ) {
this.expandElement(tgt);
}
} | javascript | function(e, params) {
Event.stopEvent(e);
var tgt = Event.getTarget(e);
if( Dom.hasClass(tgt, 'expanded') || Dom.hasClass(tgt, 'collapsed') ) {
this.expandElement(tgt);
}
} | [
"function",
"(",
"e",
",",
"params",
")",
"{",
"Event",
".",
"stopEvent",
"(",
"e",
")",
";",
"var",
"tgt",
"=",
"Event",
".",
"getTarget",
"(",
"e",
")",
";",
"if",
"(",
"Dom",
".",
"hasClass",
"(",
"tgt",
",",
"'expanded'",
")",
"||",
"Dom",
".",
"hasClass",
"(",
"tgt",
",",
"'collapsed'",
")",
")",
"{",
"this",
".",
"expandElement",
"(",
"tgt",
")",
";",
"}",
"}"
]
| When the user click on a node | [
"When",
"the",
"user",
"click",
"on",
"a",
"node"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/inputex/js/widgets/json-tree-inspector.js#L99-L106 |
|
43,197 | neyric/webhookit | public/javascripts/inputex/js/widgets/json-tree-inspector.js | function(li) {
var isExpanded = Dom.hasClass(li, 'expanded');
Dom.replaceClass(li, isExpanded ? 'expanded' : 'collapsed' , isExpanded ? 'collapsed':'expanded');
var h = this.hash[li.id];
if(isExpanded) {
// hide the sub-branch
h.expanded.style.display = 'none';
}
else {
if(h.expanded === false) {
// generate the sub-branch
h.expanded = this.buildBranch(h.value, li);
}
// show the sub-branch
h.expanded.style.display = '';
}
} | javascript | function(li) {
var isExpanded = Dom.hasClass(li, 'expanded');
Dom.replaceClass(li, isExpanded ? 'expanded' : 'collapsed' , isExpanded ? 'collapsed':'expanded');
var h = this.hash[li.id];
if(isExpanded) {
// hide the sub-branch
h.expanded.style.display = 'none';
}
else {
if(h.expanded === false) {
// generate the sub-branch
h.expanded = this.buildBranch(h.value, li);
}
// show the sub-branch
h.expanded.style.display = '';
}
} | [
"function",
"(",
"li",
")",
"{",
"var",
"isExpanded",
"=",
"Dom",
".",
"hasClass",
"(",
"li",
",",
"'expanded'",
")",
";",
"Dom",
".",
"replaceClass",
"(",
"li",
",",
"isExpanded",
"?",
"'expanded'",
":",
"'collapsed'",
",",
"isExpanded",
"?",
"'collapsed'",
":",
"'expanded'",
")",
";",
"var",
"h",
"=",
"this",
".",
"hash",
"[",
"li",
".",
"id",
"]",
";",
"if",
"(",
"isExpanded",
")",
"{",
"// hide the sub-branch",
"h",
".",
"expanded",
".",
"style",
".",
"display",
"=",
"'none'",
";",
"}",
"else",
"{",
"if",
"(",
"h",
".",
"expanded",
"===",
"false",
")",
"{",
"// generate the sub-branch",
"h",
".",
"expanded",
"=",
"this",
".",
"buildBranch",
"(",
"h",
".",
"value",
",",
"li",
")",
";",
"}",
"// show the sub-branch",
"h",
".",
"expanded",
".",
"style",
".",
"display",
"=",
"''",
";",
"}",
"}"
]
| expand the node given the li element | [
"expand",
"the",
"node",
"given",
"the",
"li",
"element"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/inputex/js/widgets/json-tree-inspector.js#L112-L131 |
|
43,198 | neyric/webhookit | public/javascripts/inputex/js/widgets/json-tree-inspector.js | function(li,maxLevel) {
this.expandElement(li);
var sub = Dom.getChildrenBy(li, function(c) {return c.tagName == "UL";})[0].childNodes;
for(var j = 0 ; j < sub.length ; j++) {
var s = sub[j];
if(Dom.hasClass(s,"collapsed") && maxLevel != 0) {
this.expandBranch(s,maxLevel-1);
}
}
} | javascript | function(li,maxLevel) {
this.expandElement(li);
var sub = Dom.getChildrenBy(li, function(c) {return c.tagName == "UL";})[0].childNodes;
for(var j = 0 ; j < sub.length ; j++) {
var s = sub[j];
if(Dom.hasClass(s,"collapsed") && maxLevel != 0) {
this.expandBranch(s,maxLevel-1);
}
}
} | [
"function",
"(",
"li",
",",
"maxLevel",
")",
"{",
"this",
".",
"expandElement",
"(",
"li",
")",
";",
"var",
"sub",
"=",
"Dom",
".",
"getChildrenBy",
"(",
"li",
",",
"function",
"(",
"c",
")",
"{",
"return",
"c",
".",
"tagName",
"==",
"\"UL\"",
";",
"}",
")",
"[",
"0",
"]",
".",
"childNodes",
";",
"for",
"(",
"var",
"j",
"=",
"0",
";",
"j",
"<",
"sub",
".",
"length",
";",
"j",
"++",
")",
"{",
"var",
"s",
"=",
"sub",
"[",
"j",
"]",
";",
"if",
"(",
"Dom",
".",
"hasClass",
"(",
"s",
",",
"\"collapsed\"",
")",
"&&",
"maxLevel",
"!=",
"0",
")",
"{",
"this",
".",
"expandBranch",
"(",
"s",
",",
"maxLevel",
"-",
"1",
")",
";",
"}",
"}",
"}"
]
| Expand a branch given a li element
@param {HTMLElement} li
@param {Integer} maxLevel | [
"Expand",
"a",
"branch",
"given",
"a",
"li",
"element"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/inputex/js/widgets/json-tree-inspector.js#L138-L147 |
|
43,199 | neyric/webhookit | public/javascripts/inputex/js/widgets/json-tree-inspector.js | function(maxLevel) {
var ul = this.el.childNodes[0];
var liEls = ul.childNodes;
for(var i = 0 ; i < liEls.length ; i++) {
var li = liEls[i];
this.expandBranch(li,maxLevel);
}
} | javascript | function(maxLevel) {
var ul = this.el.childNodes[0];
var liEls = ul.childNodes;
for(var i = 0 ; i < liEls.length ; i++) {
var li = liEls[i];
this.expandBranch(li,maxLevel);
}
} | [
"function",
"(",
"maxLevel",
")",
"{",
"var",
"ul",
"=",
"this",
".",
"el",
".",
"childNodes",
"[",
"0",
"]",
";",
"var",
"liEls",
"=",
"ul",
".",
"childNodes",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"liEls",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
"li",
"=",
"liEls",
"[",
"i",
"]",
";",
"this",
".",
"expandBranch",
"(",
"li",
",",
"maxLevel",
")",
";",
"}",
"}"
]
| Expand the root node
@param {Integer} maxLevel | [
"Expand",
"the",
"root",
"node"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/inputex/js/widgets/json-tree-inspector.js#L153-L160 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.