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
|
---|---|---|---|---|---|---|---|---|---|---|---|
42,200 | neyric/webhookit | public/javascripts/yui/container/container.js | function() {
var e = document.createElement("button");
e.style.height = "1px";
e.style.width = "1px";
e.style.position = "absolute";
e.style.left = "-10000em";
e.style.opacity = 0;
e.tabIndex = -1;
this.innerElement.appendChild(e);
this._modalFocus = e;
} | javascript | function() {
var e = document.createElement("button");
e.style.height = "1px";
e.style.width = "1px";
e.style.position = "absolute";
e.style.left = "-10000em";
e.style.opacity = 0;
e.tabIndex = -1;
this.innerElement.appendChild(e);
this._modalFocus = e;
} | [
"function",
"(",
")",
"{",
"var",
"e",
"=",
"document",
".",
"createElement",
"(",
"\"button\"",
")",
";",
"e",
".",
"style",
".",
"height",
"=",
"\"1px\"",
";",
"e",
".",
"style",
".",
"width",
"=",
"\"1px\"",
";",
"e",
".",
"style",
".",
"position",
"=",
"\"absolute\"",
";",
"e",
".",
"style",
".",
"left",
"=",
"\"-10000em\"",
";",
"e",
".",
"style",
".",
"opacity",
"=",
"0",
";",
"e",
".",
"tabIndex",
"=",
"-",
"1",
";",
"this",
".",
"innerElement",
".",
"appendChild",
"(",
"e",
")",
";",
"this",
".",
"_modalFocus",
"=",
"e",
";",
"}"
]
| Creates a hidden focusable element, used to focus on,
to enforce modality for browsers in which focus cannot
be applied to the container box.
@method _createHiddenFocusElement
@private | [
"Creates",
"a",
"hidden",
"focusable",
"element",
"used",
"to",
"focus",
"on",
"to",
"enforce",
"modality",
"for",
"browsers",
"in",
"which",
"focus",
"cannot",
"be",
"applied",
"to",
"the",
"container",
"box",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/container/container.js#L5928-L5938 |
|
42,201 | neyric/webhookit | public/javascripts/yui/container/container.js | function (type, args, obj) {
var el = this.lastElement;
if (args && args[1]) {
Event.stopEvent(args[1]);
}
if (el) {
try {
el.focus();
} catch(err) {
// Ignore
}
}
} | javascript | function (type, args, obj) {
var el = this.lastElement;
if (args && args[1]) {
Event.stopEvent(args[1]);
}
if (el) {
try {
el.focus();
} catch(err) {
// Ignore
}
}
} | [
"function",
"(",
"type",
",",
"args",
",",
"obj",
")",
"{",
"var",
"el",
"=",
"this",
".",
"lastElement",
";",
"if",
"(",
"args",
"&&",
"args",
"[",
"1",
"]",
")",
"{",
"Event",
".",
"stopEvent",
"(",
"args",
"[",
"1",
"]",
")",
";",
"}",
"if",
"(",
"el",
")",
"{",
"try",
"{",
"el",
".",
"focus",
"(",
")",
";",
"}",
"catch",
"(",
"err",
")",
"{",
"// Ignore",
"}",
"}",
"}"
]
| Sets focus to the last element in the Panel.
@method focusLast | [
"Sets",
"focus",
"to",
"the",
"last",
"element",
"in",
"the",
"Panel",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/container/container.js#L5984-L5998 |
|
42,202 | neyric/webhookit | public/javascripts/yui/container/container.js | function(root) {
root = root || this.innerElement;
var focusable = {};
for (var i = 0; i < Panel.FOCUSABLE.length; i++) {
focusable[Panel.FOCUSABLE[i]] = true;
}
function isFocusable(el) {
if (el.focus && el.type !== "hidden" && !el.disabled && focusable[el.tagName.toLowerCase()]) {
return true;
}
return false;
}
// Not looking by Tag, since we want elements in DOM order
return Dom.getElementsBy(isFocusable, null, root);
} | javascript | function(root) {
root = root || this.innerElement;
var focusable = {};
for (var i = 0; i < Panel.FOCUSABLE.length; i++) {
focusable[Panel.FOCUSABLE[i]] = true;
}
function isFocusable(el) {
if (el.focus && el.type !== "hidden" && !el.disabled && focusable[el.tagName.toLowerCase()]) {
return true;
}
return false;
}
// Not looking by Tag, since we want elements in DOM order
return Dom.getElementsBy(isFocusable, null, root);
} | [
"function",
"(",
"root",
")",
"{",
"root",
"=",
"root",
"||",
"this",
".",
"innerElement",
";",
"var",
"focusable",
"=",
"{",
"}",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"Panel",
".",
"FOCUSABLE",
".",
"length",
";",
"i",
"++",
")",
"{",
"focusable",
"[",
"Panel",
".",
"FOCUSABLE",
"[",
"i",
"]",
"]",
"=",
"true",
";",
"}",
"function",
"isFocusable",
"(",
"el",
")",
"{",
"if",
"(",
"el",
".",
"focus",
"&&",
"el",
".",
"type",
"!==",
"\"hidden\"",
"&&",
"!",
"el",
".",
"disabled",
"&&",
"focusable",
"[",
"el",
".",
"tagName",
".",
"toLowerCase",
"(",
")",
"]",
")",
"{",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}",
"// Not looking by Tag, since we want elements in DOM order",
"return",
"Dom",
".",
"getElementsBy",
"(",
"isFocusable",
",",
"null",
",",
"root",
")",
";",
"}"
]
| Returns an array of the currently focusable items which reside within
Panel. The set of focusable elements the method looks for are defined
in the Panel.FOCUSABLE static property
@method getFocusableElements
@param {HTMLElement} root element to start from. | [
"Returns",
"an",
"array",
"of",
"the",
"currently",
"focusable",
"items",
"which",
"reside",
"within",
"Panel",
".",
"The",
"set",
"of",
"focusable",
"elements",
"the",
"method",
"looks",
"for",
"are",
"defined",
"in",
"the",
"Panel",
".",
"FOCUSABLE",
"static",
"property"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/container/container.js#L6060-L6078 |
|
42,203 | neyric/webhookit | public/javascripts/yui/container/container.js | function() {
this.firstElement = null;
this.lastElement = null;
var elements = this.getFocusableElements();
this.focusableElements = elements;
if (elements.length > 0) {
this.firstElement = elements[0];
this.lastElement = elements[elements.length - 1];
}
if (this.cfg.getProperty("modal")) {
this.setTabLoop(this.firstElement, this.lastElement);
}
} | javascript | function() {
this.firstElement = null;
this.lastElement = null;
var elements = this.getFocusableElements();
this.focusableElements = elements;
if (elements.length > 0) {
this.firstElement = elements[0];
this.lastElement = elements[elements.length - 1];
}
if (this.cfg.getProperty("modal")) {
this.setTabLoop(this.firstElement, this.lastElement);
}
} | [
"function",
"(",
")",
"{",
"this",
".",
"firstElement",
"=",
"null",
";",
"this",
".",
"lastElement",
"=",
"null",
";",
"var",
"elements",
"=",
"this",
".",
"getFocusableElements",
"(",
")",
";",
"this",
".",
"focusableElements",
"=",
"elements",
";",
"if",
"(",
"elements",
".",
"length",
">",
"0",
")",
"{",
"this",
".",
"firstElement",
"=",
"elements",
"[",
"0",
"]",
";",
"this",
".",
"lastElement",
"=",
"elements",
"[",
"elements",
".",
"length",
"-",
"1",
"]",
";",
"}",
"if",
"(",
"this",
".",
"cfg",
".",
"getProperty",
"(",
"\"modal\"",
")",
")",
"{",
"this",
".",
"setTabLoop",
"(",
"this",
".",
"firstElement",
",",
"this",
".",
"lastElement",
")",
";",
"}",
"}"
]
| Sets the firstElement and lastElement instance properties
to the first and last focusable elements in the Panel.
@method setFirstLastFocusable | [
"Sets",
"the",
"firstElement",
"and",
"lastElement",
"instance",
"properties",
"to",
"the",
"first",
"and",
"last",
"focusable",
"elements",
"in",
"the",
"Panel",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/container/container.js#L6086-L6102 |
|
42,204 | neyric/webhookit | public/javascripts/yui/container/container.js | function (type, args, obj) {
var val = args[0];
if (val) {
if (!Util.DD) {
this.cfg.setProperty("draggable", false);
return;
}
if (this.header) {
Dom.setStyle(this.header, "cursor", "move");
this.registerDragDrop();
}
this.subscribe("beforeShow", setWidthToOffsetWidth);
} else {
if (this.dd) {
this.dd.unreg();
}
if (this.header) {
Dom.setStyle(this.header,"cursor","auto");
}
this.unsubscribe("beforeShow", setWidthToOffsetWidth);
}
} | javascript | function (type, args, obj) {
var val = args[0];
if (val) {
if (!Util.DD) {
this.cfg.setProperty("draggable", false);
return;
}
if (this.header) {
Dom.setStyle(this.header, "cursor", "move");
this.registerDragDrop();
}
this.subscribe("beforeShow", setWidthToOffsetWidth);
} else {
if (this.dd) {
this.dd.unreg();
}
if (this.header) {
Dom.setStyle(this.header,"cursor","auto");
}
this.unsubscribe("beforeShow", setWidthToOffsetWidth);
}
} | [
"function",
"(",
"type",
",",
"args",
",",
"obj",
")",
"{",
"var",
"val",
"=",
"args",
"[",
"0",
"]",
";",
"if",
"(",
"val",
")",
"{",
"if",
"(",
"!",
"Util",
".",
"DD",
")",
"{",
"this",
".",
"cfg",
".",
"setProperty",
"(",
"\"draggable\"",
",",
"false",
")",
";",
"return",
";",
"}",
"if",
"(",
"this",
".",
"header",
")",
"{",
"Dom",
".",
"setStyle",
"(",
"this",
".",
"header",
",",
"\"cursor\"",
",",
"\"move\"",
")",
";",
"this",
".",
"registerDragDrop",
"(",
")",
";",
"}",
"this",
".",
"subscribe",
"(",
"\"beforeShow\"",
",",
"setWidthToOffsetWidth",
")",
";",
"}",
"else",
"{",
"if",
"(",
"this",
".",
"dd",
")",
"{",
"this",
".",
"dd",
".",
"unreg",
"(",
")",
";",
"}",
"if",
"(",
"this",
".",
"header",
")",
"{",
"Dom",
".",
"setStyle",
"(",
"this",
".",
"header",
",",
"\"cursor\"",
",",
"\"auto\"",
")",
";",
"}",
"this",
".",
"unsubscribe",
"(",
"\"beforeShow\"",
",",
"setWidthToOffsetWidth",
")",
";",
"}",
"}"
]
| The default event handler fired when the "draggable" property
is changed.
@method configDraggable
@param {String} type The CustomEvent type (usually the property name)
@param {Object[]} args The CustomEvent arguments. For configuration
handlers, args[0] will equal the newly applied value for the property.
@param {Object} obj The scope object. For configuration handlers,
this will usually equal the owner. | [
"The",
"default",
"event",
"handler",
"fired",
"when",
"the",
"draggable",
"property",
"is",
"changed",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/container/container.js#L6350-L6378 |
|
42,205 | neyric/webhookit | public/javascripts/yui/container/container.js | function (type, args, obj) {
var modal = args[0];
if (modal) {
if (!this._hasModalityEventListeners) {
this.subscribe("beforeShow", this.buildMask);
this.subscribe("beforeShow", this.bringToTop);
this.subscribe("beforeShow", this.showMask);
this.subscribe("hide", this.hideMask);
Overlay.windowResizeEvent.subscribe(this.sizeMask,
this, true);
this._hasModalityEventListeners = true;
}
} else {
if (this._hasModalityEventListeners) {
if (this.cfg.getProperty("visible")) {
this.hideMask();
this.removeMask();
}
this.unsubscribe("beforeShow", this.buildMask);
this.unsubscribe("beforeShow", this.bringToTop);
this.unsubscribe("beforeShow", this.showMask);
this.unsubscribe("hide", this.hideMask);
Overlay.windowResizeEvent.unsubscribe(this.sizeMask, this);
this._hasModalityEventListeners = false;
}
}
} | javascript | function (type, args, obj) {
var modal = args[0];
if (modal) {
if (!this._hasModalityEventListeners) {
this.subscribe("beforeShow", this.buildMask);
this.subscribe("beforeShow", this.bringToTop);
this.subscribe("beforeShow", this.showMask);
this.subscribe("hide", this.hideMask);
Overlay.windowResizeEvent.subscribe(this.sizeMask,
this, true);
this._hasModalityEventListeners = true;
}
} else {
if (this._hasModalityEventListeners) {
if (this.cfg.getProperty("visible")) {
this.hideMask();
this.removeMask();
}
this.unsubscribe("beforeShow", this.buildMask);
this.unsubscribe("beforeShow", this.bringToTop);
this.unsubscribe("beforeShow", this.showMask);
this.unsubscribe("hide", this.hideMask);
Overlay.windowResizeEvent.unsubscribe(this.sizeMask, this);
this._hasModalityEventListeners = false;
}
}
} | [
"function",
"(",
"type",
",",
"args",
",",
"obj",
")",
"{",
"var",
"modal",
"=",
"args",
"[",
"0",
"]",
";",
"if",
"(",
"modal",
")",
"{",
"if",
"(",
"!",
"this",
".",
"_hasModalityEventListeners",
")",
"{",
"this",
".",
"subscribe",
"(",
"\"beforeShow\"",
",",
"this",
".",
"buildMask",
")",
";",
"this",
".",
"subscribe",
"(",
"\"beforeShow\"",
",",
"this",
".",
"bringToTop",
")",
";",
"this",
".",
"subscribe",
"(",
"\"beforeShow\"",
",",
"this",
".",
"showMask",
")",
";",
"this",
".",
"subscribe",
"(",
"\"hide\"",
",",
"this",
".",
"hideMask",
")",
";",
"Overlay",
".",
"windowResizeEvent",
".",
"subscribe",
"(",
"this",
".",
"sizeMask",
",",
"this",
",",
"true",
")",
";",
"this",
".",
"_hasModalityEventListeners",
"=",
"true",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"this",
".",
"_hasModalityEventListeners",
")",
"{",
"if",
"(",
"this",
".",
"cfg",
".",
"getProperty",
"(",
"\"visible\"",
")",
")",
"{",
"this",
".",
"hideMask",
"(",
")",
";",
"this",
".",
"removeMask",
"(",
")",
";",
"}",
"this",
".",
"unsubscribe",
"(",
"\"beforeShow\"",
",",
"this",
".",
"buildMask",
")",
";",
"this",
".",
"unsubscribe",
"(",
"\"beforeShow\"",
",",
"this",
".",
"bringToTop",
")",
";",
"this",
".",
"unsubscribe",
"(",
"\"beforeShow\"",
",",
"this",
".",
"showMask",
")",
";",
"this",
".",
"unsubscribe",
"(",
"\"hide\"",
",",
"this",
".",
"hideMask",
")",
";",
"Overlay",
".",
"windowResizeEvent",
".",
"unsubscribe",
"(",
"this",
".",
"sizeMask",
",",
"this",
")",
";",
"this",
".",
"_hasModalityEventListeners",
"=",
"false",
";",
"}",
"}",
"}"
]
| The default event handler fired when the "modal" property is
changed. This handler subscribes or unsubscribes to the show and hide
events to handle the display or hide of the modality mask.
@method configModal
@param {String} type The CustomEvent type (usually the property name)
@param {Object[]} args The CustomEvent arguments. For configuration
handlers, args[0] will equal the newly applied value for the property.
@param {Object} obj The scope object. For configuration handlers,
this will usually equal the owner. | [
"The",
"default",
"event",
"handler",
"fired",
"when",
"the",
"modal",
"property",
"is",
"changed",
".",
"This",
"handler",
"subscribes",
"or",
"unsubscribes",
"to",
"the",
"show",
"and",
"hide",
"events",
"to",
"handle",
"the",
"display",
"or",
"hide",
"of",
"the",
"modality",
"mask",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/container/container.js#L6503-L6537 |
|
42,206 | neyric/webhookit | public/javascripts/yui/container/container.js | function () {
var oMask = this.mask,
oParentNode;
if (oMask) {
/*
Hide the mask before destroying it to ensure that DOM
event handlers on focusable elements get removed.
*/
this.hideMask();
oParentNode = oMask.parentNode;
if (oParentNode) {
oParentNode.removeChild(oMask);
}
this.mask = null;
}
} | javascript | function () {
var oMask = this.mask,
oParentNode;
if (oMask) {
/*
Hide the mask before destroying it to ensure that DOM
event handlers on focusable elements get removed.
*/
this.hideMask();
oParentNode = oMask.parentNode;
if (oParentNode) {
oParentNode.removeChild(oMask);
}
this.mask = null;
}
} | [
"function",
"(",
")",
"{",
"var",
"oMask",
"=",
"this",
".",
"mask",
",",
"oParentNode",
";",
"if",
"(",
"oMask",
")",
"{",
"/*\n Hide the mask before destroying it to ensure that DOM\n event handlers on focusable elements get removed.\n */",
"this",
".",
"hideMask",
"(",
")",
";",
"oParentNode",
"=",
"oMask",
".",
"parentNode",
";",
"if",
"(",
"oParentNode",
")",
"{",
"oParentNode",
".",
"removeChild",
"(",
"oMask",
")",
";",
"}",
"this",
".",
"mask",
"=",
"null",
";",
"}",
"}"
]
| Removes the modality mask.
@method removeMask | [
"Removes",
"the",
"modality",
"mask",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/container/container.js#L6543-L6562 |
|
42,207 | neyric/webhookit | public/javascripts/yui/container/container.js | function (type, args, obj) {
var listeners = args[0],
listener,
nListeners,
i;
if (listeners) {
if (listeners instanceof Array) {
nListeners = listeners.length;
for (i = 0; i < nListeners; i++) {
listener = listeners[i];
if (!Config.alreadySubscribed(this.showEvent,
listener.enable, listener)) {
this.showEvent.subscribe(listener.enable,
listener, true);
}
if (!Config.alreadySubscribed(this.hideEvent,
listener.disable, listener)) {
this.hideEvent.subscribe(listener.disable,
listener, true);
this.destroyEvent.subscribe(listener.disable,
listener, true);
}
}
} else {
if (!Config.alreadySubscribed(this.showEvent,
listeners.enable, listeners)) {
this.showEvent.subscribe(listeners.enable,
listeners, true);
}
if (!Config.alreadySubscribed(this.hideEvent,
listeners.disable, listeners)) {
this.hideEvent.subscribe(listeners.disable,
listeners, true);
this.destroyEvent.subscribe(listeners.disable,
listeners, true);
}
}
}
} | javascript | function (type, args, obj) {
var listeners = args[0],
listener,
nListeners,
i;
if (listeners) {
if (listeners instanceof Array) {
nListeners = listeners.length;
for (i = 0; i < nListeners; i++) {
listener = listeners[i];
if (!Config.alreadySubscribed(this.showEvent,
listener.enable, listener)) {
this.showEvent.subscribe(listener.enable,
listener, true);
}
if (!Config.alreadySubscribed(this.hideEvent,
listener.disable, listener)) {
this.hideEvent.subscribe(listener.disable,
listener, true);
this.destroyEvent.subscribe(listener.disable,
listener, true);
}
}
} else {
if (!Config.alreadySubscribed(this.showEvent,
listeners.enable, listeners)) {
this.showEvent.subscribe(listeners.enable,
listeners, true);
}
if (!Config.alreadySubscribed(this.hideEvent,
listeners.disable, listeners)) {
this.hideEvent.subscribe(listeners.disable,
listeners, true);
this.destroyEvent.subscribe(listeners.disable,
listeners, true);
}
}
}
} | [
"function",
"(",
"type",
",",
"args",
",",
"obj",
")",
"{",
"var",
"listeners",
"=",
"args",
"[",
"0",
"]",
",",
"listener",
",",
"nListeners",
",",
"i",
";",
"if",
"(",
"listeners",
")",
"{",
"if",
"(",
"listeners",
"instanceof",
"Array",
")",
"{",
"nListeners",
"=",
"listeners",
".",
"length",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"nListeners",
";",
"i",
"++",
")",
"{",
"listener",
"=",
"listeners",
"[",
"i",
"]",
";",
"if",
"(",
"!",
"Config",
".",
"alreadySubscribed",
"(",
"this",
".",
"showEvent",
",",
"listener",
".",
"enable",
",",
"listener",
")",
")",
"{",
"this",
".",
"showEvent",
".",
"subscribe",
"(",
"listener",
".",
"enable",
",",
"listener",
",",
"true",
")",
";",
"}",
"if",
"(",
"!",
"Config",
".",
"alreadySubscribed",
"(",
"this",
".",
"hideEvent",
",",
"listener",
".",
"disable",
",",
"listener",
")",
")",
"{",
"this",
".",
"hideEvent",
".",
"subscribe",
"(",
"listener",
".",
"disable",
",",
"listener",
",",
"true",
")",
";",
"this",
".",
"destroyEvent",
".",
"subscribe",
"(",
"listener",
".",
"disable",
",",
"listener",
",",
"true",
")",
";",
"}",
"}",
"}",
"else",
"{",
"if",
"(",
"!",
"Config",
".",
"alreadySubscribed",
"(",
"this",
".",
"showEvent",
",",
"listeners",
".",
"enable",
",",
"listeners",
")",
")",
"{",
"this",
".",
"showEvent",
".",
"subscribe",
"(",
"listeners",
".",
"enable",
",",
"listeners",
",",
"true",
")",
";",
"}",
"if",
"(",
"!",
"Config",
".",
"alreadySubscribed",
"(",
"this",
".",
"hideEvent",
",",
"listeners",
".",
"disable",
",",
"listeners",
")",
")",
"{",
"this",
".",
"hideEvent",
".",
"subscribe",
"(",
"listeners",
".",
"disable",
",",
"listeners",
",",
"true",
")",
";",
"this",
".",
"destroyEvent",
".",
"subscribe",
"(",
"listeners",
".",
"disable",
",",
"listeners",
",",
"true",
")",
";",
"}",
"}",
"}",
"}"
]
| The default event handler fired when the "keylisteners" property
is changed.
@method configKeyListeners
@param {String} type The CustomEvent type (usually the property name)
@param {Object[]} args The CustomEvent arguments. For configuration
handlers, args[0] will equal the newly applied value for the property.
@param {Object} obj The scope object. For configuration handlers,
this will usually equal the owner. | [
"The",
"default",
"event",
"handler",
"fired",
"when",
"the",
"keylisteners",
"property",
"is",
"changed",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/container/container.js#L6574-L6634 |
|
42,208 | neyric/webhookit | public/javascripts/yui/container/container.js | function(type, args, obj) {
var val = Lang.merge(DEFAULT_CONFIG.STRINGS.value, args[0]);
this.cfg.setProperty(DEFAULT_CONFIG.STRINGS.key, val, true);
} | javascript | function(type, args, obj) {
var val = Lang.merge(DEFAULT_CONFIG.STRINGS.value, args[0]);
this.cfg.setProperty(DEFAULT_CONFIG.STRINGS.key, val, true);
} | [
"function",
"(",
"type",
",",
"args",
",",
"obj",
")",
"{",
"var",
"val",
"=",
"Lang",
".",
"merge",
"(",
"DEFAULT_CONFIG",
".",
"STRINGS",
".",
"value",
",",
"args",
"[",
"0",
"]",
")",
";",
"this",
".",
"cfg",
".",
"setProperty",
"(",
"DEFAULT_CONFIG",
".",
"STRINGS",
".",
"key",
",",
"val",
",",
"true",
")",
";",
"}"
]
| The default handler for the "strings" property
@method configStrings | [
"The",
"default",
"handler",
"for",
"the",
"strings",
"property"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/container/container.js#L6640-L6643 |
|
42,209 | neyric/webhookit | public/javascripts/yui/container/container.js | function(type, args, el) {
Panel.superclass._autoFillOnHeightChange.apply(this, arguments);
if (bIEQuirks) {
var panel = this;
setTimeout(function() {
panel.sizeUnderlay();
},0);
}
} | javascript | function(type, args, el) {
Panel.superclass._autoFillOnHeightChange.apply(this, arguments);
if (bIEQuirks) {
var panel = this;
setTimeout(function() {
panel.sizeUnderlay();
},0);
}
} | [
"function",
"(",
"type",
",",
"args",
",",
"el",
")",
"{",
"Panel",
".",
"superclass",
".",
"_autoFillOnHeightChange",
".",
"apply",
"(",
"this",
",",
"arguments",
")",
";",
"if",
"(",
"bIEQuirks",
")",
"{",
"var",
"panel",
"=",
"this",
";",
"setTimeout",
"(",
"function",
"(",
")",
"{",
"panel",
".",
"sizeUnderlay",
"(",
")",
";",
"}",
",",
"0",
")",
";",
"}",
"}"
]
| The default custom event handler executed when the Panel's height is changed,
if the autofillheight property has been set.
@method _autoFillOnHeightChange
@protected
@param {String} type The event type
@param {Array} args The array of arguments passed to event subscribers
@param {HTMLElement} el The header, body or footer element which is to be resized to fill
out the containers height | [
"The",
"default",
"custom",
"event",
"handler",
"executed",
"when",
"the",
"Panel",
"s",
"height",
"is",
"changed",
"if",
"the",
"autofillheight",
"property",
"has",
"been",
"set",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/container/container.js#L6673-L6681 |
|
42,210 | neyric/webhookit | public/javascripts/yui/container/container.js | function () {
var oUnderlay = this.underlay,
oElement;
if (oUnderlay) {
oElement = this.element;
oUnderlay.style.width = oElement.offsetWidth + "px";
oUnderlay.style.height = oElement.offsetHeight + "px";
}
} | javascript | function () {
var oUnderlay = this.underlay,
oElement;
if (oUnderlay) {
oElement = this.element;
oUnderlay.style.width = oElement.offsetWidth + "px";
oUnderlay.style.height = oElement.offsetHeight + "px";
}
} | [
"function",
"(",
")",
"{",
"var",
"oUnderlay",
"=",
"this",
".",
"underlay",
",",
"oElement",
";",
"if",
"(",
"oUnderlay",
")",
"{",
"oElement",
"=",
"this",
".",
"element",
";",
"oUnderlay",
".",
"style",
".",
"width",
"=",
"oElement",
".",
"offsetWidth",
"+",
"\"px\"",
";",
"oUnderlay",
".",
"style",
".",
"height",
"=",
"oElement",
".",
"offsetHeight",
"+",
"\"px\"",
";",
"}",
"}"
]
| Adjusts the size of the shadow based on the size of the element.
@method sizeUnderlay | [
"Adjusts",
"the",
"size",
"of",
"the",
"shadow",
"based",
"on",
"the",
"size",
"of",
"the",
"element",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/container/container.js#L6763-L6772 |
|
42,211 | neyric/webhookit | public/javascripts/yui/container/container.js | function () {
var oMask = this.mask;
if (!oMask) {
if (!m_oMaskTemplate) {
m_oMaskTemplate = document.createElement("div");
m_oMaskTemplate.className = "mask";
m_oMaskTemplate.innerHTML = " ";
}
oMask = m_oMaskTemplate.cloneNode(true);
oMask.id = this.id + "_mask";
document.body.insertBefore(oMask, document.body.firstChild);
this.mask = oMask;
if (YAHOO.env.ua.gecko && this.platform == "mac") {
Dom.addClass(this.mask, "block-scrollbars");
}
// Stack mask based on the element zindex
this.stackMask();
}
} | javascript | function () {
var oMask = this.mask;
if (!oMask) {
if (!m_oMaskTemplate) {
m_oMaskTemplate = document.createElement("div");
m_oMaskTemplate.className = "mask";
m_oMaskTemplate.innerHTML = " ";
}
oMask = m_oMaskTemplate.cloneNode(true);
oMask.id = this.id + "_mask";
document.body.insertBefore(oMask, document.body.firstChild);
this.mask = oMask;
if (YAHOO.env.ua.gecko && this.platform == "mac") {
Dom.addClass(this.mask, "block-scrollbars");
}
// Stack mask based on the element zindex
this.stackMask();
}
} | [
"function",
"(",
")",
"{",
"var",
"oMask",
"=",
"this",
".",
"mask",
";",
"if",
"(",
"!",
"oMask",
")",
"{",
"if",
"(",
"!",
"m_oMaskTemplate",
")",
"{",
"m_oMaskTemplate",
"=",
"document",
".",
"createElement",
"(",
"\"div\"",
")",
";",
"m_oMaskTemplate",
".",
"className",
"=",
"\"mask\"",
";",
"m_oMaskTemplate",
".",
"innerHTML",
"=",
"\" \"",
";",
"}",
"oMask",
"=",
"m_oMaskTemplate",
".",
"cloneNode",
"(",
"true",
")",
";",
"oMask",
".",
"id",
"=",
"this",
".",
"id",
"+",
"\"_mask\"",
";",
"document",
".",
"body",
".",
"insertBefore",
"(",
"oMask",
",",
"document",
".",
"body",
".",
"firstChild",
")",
";",
"this",
".",
"mask",
"=",
"oMask",
";",
"if",
"(",
"YAHOO",
".",
"env",
".",
"ua",
".",
"gecko",
"&&",
"this",
".",
"platform",
"==",
"\"mac\"",
")",
"{",
"Dom",
".",
"addClass",
"(",
"this",
".",
"mask",
",",
"\"block-scrollbars\"",
")",
";",
"}",
"// Stack mask based on the element zindex",
"this",
".",
"stackMask",
"(",
")",
";",
"}",
"}"
]
| Builds the mask that is laid over the document when the Panel is
configured to be modal.
@method buildMask | [
"Builds",
"the",
"mask",
"that",
"is",
"laid",
"over",
"the",
"document",
"when",
"the",
"Panel",
"is",
"configured",
"to",
"be",
"modal",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/container/container.js#L6887-L6909 |
|
42,212 | neyric/webhookit | public/javascripts/yui/container/container.js | function () {
if (this.mask) {
// Shrink mask first, so it doesn't affect the document size.
var mask = this.mask,
viewWidth = Dom.getViewportWidth(),
viewHeight = Dom.getViewportHeight();
if (mask.offsetHeight > viewHeight) {
mask.style.height = viewHeight + "px";
}
if (mask.offsetWidth > viewWidth) {
mask.style.width = viewWidth + "px";
}
// Then size it to the document
mask.style.height = Dom.getDocumentHeight() + "px";
mask.style.width = Dom.getDocumentWidth() + "px";
}
} | javascript | function () {
if (this.mask) {
// Shrink mask first, so it doesn't affect the document size.
var mask = this.mask,
viewWidth = Dom.getViewportWidth(),
viewHeight = Dom.getViewportHeight();
if (mask.offsetHeight > viewHeight) {
mask.style.height = viewHeight + "px";
}
if (mask.offsetWidth > viewWidth) {
mask.style.width = viewWidth + "px";
}
// Then size it to the document
mask.style.height = Dom.getDocumentHeight() + "px";
mask.style.width = Dom.getDocumentWidth() + "px";
}
} | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"mask",
")",
"{",
"// Shrink mask first, so it doesn't affect the document size.",
"var",
"mask",
"=",
"this",
".",
"mask",
",",
"viewWidth",
"=",
"Dom",
".",
"getViewportWidth",
"(",
")",
",",
"viewHeight",
"=",
"Dom",
".",
"getViewportHeight",
"(",
")",
";",
"if",
"(",
"mask",
".",
"offsetHeight",
">",
"viewHeight",
")",
"{",
"mask",
".",
"style",
".",
"height",
"=",
"viewHeight",
"+",
"\"px\"",
";",
"}",
"if",
"(",
"mask",
".",
"offsetWidth",
">",
"viewWidth",
")",
"{",
"mask",
".",
"style",
".",
"width",
"=",
"viewWidth",
"+",
"\"px\"",
";",
"}",
"// Then size it to the document",
"mask",
".",
"style",
".",
"height",
"=",
"Dom",
".",
"getDocumentHeight",
"(",
")",
"+",
"\"px\"",
";",
"mask",
".",
"style",
".",
"width",
"=",
"Dom",
".",
"getDocumentWidth",
"(",
")",
"+",
"\"px\"",
";",
"}",
"}"
]
| Sets the size of the modality mask to cover the entire scrollable
area of the document
@method sizeMask | [
"Sets",
"the",
"size",
"of",
"the",
"modality",
"mask",
"to",
"cover",
"the",
"entire",
"scrollable",
"area",
"of",
"the",
"document"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/container/container.js#L6941-L6961 |
|
42,213 | neyric/webhookit | public/javascripts/yui/container/container.js | function() {
if (this.mask) {
var panelZ = Dom.getStyle(this.element, "zIndex");
if (!YAHOO.lang.isUndefined(panelZ) && !isNaN(panelZ)) {
Dom.setStyle(this.mask, "zIndex", panelZ - 1);
}
}
} | javascript | function() {
if (this.mask) {
var panelZ = Dom.getStyle(this.element, "zIndex");
if (!YAHOO.lang.isUndefined(panelZ) && !isNaN(panelZ)) {
Dom.setStyle(this.mask, "zIndex", panelZ - 1);
}
}
} | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"mask",
")",
"{",
"var",
"panelZ",
"=",
"Dom",
".",
"getStyle",
"(",
"this",
".",
"element",
",",
"\"zIndex\"",
")",
";",
"if",
"(",
"!",
"YAHOO",
".",
"lang",
".",
"isUndefined",
"(",
"panelZ",
")",
"&&",
"!",
"isNaN",
"(",
"panelZ",
")",
")",
"{",
"Dom",
".",
"setStyle",
"(",
"this",
".",
"mask",
",",
"\"zIndex\"",
",",
"panelZ",
"-",
"1",
")",
";",
"}",
"}",
"}"
]
| Sets the zindex of the mask, if it exists, based on the zindex of
the Panel element. The zindex of the mask is set to be one less
than the Panel element's zindex.
<p>NOTE: This method will not bump up the zindex of the Panel
to ensure that the mask has a non-negative zindex. If you require the
mask zindex to be 0 or higher, the zindex of the Panel
should be set to a value higher than 0, before this method is called.
</p>
@method stackMask | [
"Sets",
"the",
"zindex",
"of",
"the",
"mask",
"if",
"it",
"exists",
"based",
"on",
"the",
"zindex",
"of",
"the",
"Panel",
"element",
".",
"The",
"zindex",
"of",
"the",
"mask",
"is",
"set",
"to",
"be",
"one",
"less",
"than",
"the",
"Panel",
"element",
"s",
"zindex",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/container/container.js#L6975-L6982 |
|
42,214 | neyric/webhookit | public/javascripts/yui/container/container.js | function () {
Dialog.superclass.initEvents.call(this);
var SIGNATURE = CustomEvent.LIST;
/**
* CustomEvent fired prior to submission
* @event beforeSubmitEvent
*/
this.beforeSubmitEvent =
this.createEvent(EVENT_TYPES.BEFORE_SUBMIT);
this.beforeSubmitEvent.signature = SIGNATURE;
/**
* CustomEvent fired after submission
* @event submitEvent
*/
this.submitEvent = this.createEvent(EVENT_TYPES.SUBMIT);
this.submitEvent.signature = SIGNATURE;
/**
* CustomEvent fired for manual submission, before the generic submit event is fired
* @event manualSubmitEvent
*/
this.manualSubmitEvent =
this.createEvent(EVENT_TYPES.MANUAL_SUBMIT);
this.manualSubmitEvent.signature = SIGNATURE;
/**
* CustomEvent fired after asynchronous submission, before the generic submit event is fired
*
* @event asyncSubmitEvent
* @param {Object} conn The connection object, returned by YAHOO.util.Connect.asyncRequest
*/
this.asyncSubmitEvent = this.createEvent(EVENT_TYPES.ASYNC_SUBMIT);
this.asyncSubmitEvent.signature = SIGNATURE;
/**
* CustomEvent fired after form-based submission, before the generic submit event is fired
* @event formSubmitEvent
*/
this.formSubmitEvent = this.createEvent(EVENT_TYPES.FORM_SUBMIT);
this.formSubmitEvent.signature = SIGNATURE;
/**
* CustomEvent fired after cancel
* @event cancelEvent
*/
this.cancelEvent = this.createEvent(EVENT_TYPES.CANCEL);
this.cancelEvent.signature = SIGNATURE;
} | javascript | function () {
Dialog.superclass.initEvents.call(this);
var SIGNATURE = CustomEvent.LIST;
/**
* CustomEvent fired prior to submission
* @event beforeSubmitEvent
*/
this.beforeSubmitEvent =
this.createEvent(EVENT_TYPES.BEFORE_SUBMIT);
this.beforeSubmitEvent.signature = SIGNATURE;
/**
* CustomEvent fired after submission
* @event submitEvent
*/
this.submitEvent = this.createEvent(EVENT_TYPES.SUBMIT);
this.submitEvent.signature = SIGNATURE;
/**
* CustomEvent fired for manual submission, before the generic submit event is fired
* @event manualSubmitEvent
*/
this.manualSubmitEvent =
this.createEvent(EVENT_TYPES.MANUAL_SUBMIT);
this.manualSubmitEvent.signature = SIGNATURE;
/**
* CustomEvent fired after asynchronous submission, before the generic submit event is fired
*
* @event asyncSubmitEvent
* @param {Object} conn The connection object, returned by YAHOO.util.Connect.asyncRequest
*/
this.asyncSubmitEvent = this.createEvent(EVENT_TYPES.ASYNC_SUBMIT);
this.asyncSubmitEvent.signature = SIGNATURE;
/**
* CustomEvent fired after form-based submission, before the generic submit event is fired
* @event formSubmitEvent
*/
this.formSubmitEvent = this.createEvent(EVENT_TYPES.FORM_SUBMIT);
this.formSubmitEvent.signature = SIGNATURE;
/**
* CustomEvent fired after cancel
* @event cancelEvent
*/
this.cancelEvent = this.createEvent(EVENT_TYPES.CANCEL);
this.cancelEvent.signature = SIGNATURE;
} | [
"function",
"(",
")",
"{",
"Dialog",
".",
"superclass",
".",
"initEvents",
".",
"call",
"(",
"this",
")",
";",
"var",
"SIGNATURE",
"=",
"CustomEvent",
".",
"LIST",
";",
"/**\n * CustomEvent fired prior to submission\n * @event beforeSubmitEvent\n */",
"this",
".",
"beforeSubmitEvent",
"=",
"this",
".",
"createEvent",
"(",
"EVENT_TYPES",
".",
"BEFORE_SUBMIT",
")",
";",
"this",
".",
"beforeSubmitEvent",
".",
"signature",
"=",
"SIGNATURE",
";",
"/**\n * CustomEvent fired after submission\n * @event submitEvent\n */",
"this",
".",
"submitEvent",
"=",
"this",
".",
"createEvent",
"(",
"EVENT_TYPES",
".",
"SUBMIT",
")",
";",
"this",
".",
"submitEvent",
".",
"signature",
"=",
"SIGNATURE",
";",
"/**\n * CustomEvent fired for manual submission, before the generic submit event is fired\n * @event manualSubmitEvent\n */",
"this",
".",
"manualSubmitEvent",
"=",
"this",
".",
"createEvent",
"(",
"EVENT_TYPES",
".",
"MANUAL_SUBMIT",
")",
";",
"this",
".",
"manualSubmitEvent",
".",
"signature",
"=",
"SIGNATURE",
";",
"/**\n * CustomEvent fired after asynchronous submission, before the generic submit event is fired\n *\n * @event asyncSubmitEvent\n * @param {Object} conn The connection object, returned by YAHOO.util.Connect.asyncRequest\n */",
"this",
".",
"asyncSubmitEvent",
"=",
"this",
".",
"createEvent",
"(",
"EVENT_TYPES",
".",
"ASYNC_SUBMIT",
")",
";",
"this",
".",
"asyncSubmitEvent",
".",
"signature",
"=",
"SIGNATURE",
";",
"/**\n * CustomEvent fired after form-based submission, before the generic submit event is fired\n * @event formSubmitEvent\n */",
"this",
".",
"formSubmitEvent",
"=",
"this",
".",
"createEvent",
"(",
"EVENT_TYPES",
".",
"FORM_SUBMIT",
")",
";",
"this",
".",
"formSubmitEvent",
".",
"signature",
"=",
"SIGNATURE",
";",
"/**\n * CustomEvent fired after cancel\n * @event cancelEvent\n */",
"this",
".",
"cancelEvent",
"=",
"this",
".",
"createEvent",
"(",
"EVENT_TYPES",
".",
"CANCEL",
")",
";",
"this",
".",
"cancelEvent",
".",
"signature",
"=",
"SIGNATURE",
";",
"}"
]
| Initializes the custom events for Dialog which are fired
automatically at appropriate times by the Dialog class.
@method initEvents | [
"Initializes",
"the",
"custom",
"events",
"for",
"Dialog",
"which",
"are",
"fired",
"automatically",
"at",
"appropriate",
"times",
"by",
"the",
"Dialog",
"class",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/container/container.js#L7402-L7453 |
|
42,215 | neyric/webhookit | public/javascripts/yui/container/container.js | function (el, userConfig) {
/*
Note that we don't pass the user config in here yet because
we only want it executed once, at the lowest subclass level
*/
Dialog.superclass.init.call(this, el/*, userConfig*/);
this.beforeInitEvent.fire(Dialog);
Dom.addClass(this.element, Dialog.CSS_DIALOG);
this.cfg.setProperty("visible", false);
if (userConfig) {
this.cfg.applyConfig(userConfig, true);
}
this.showEvent.subscribe(this.focusFirst, this, true);
this.beforeHideEvent.subscribe(this.blurButtons, this, true);
this.subscribe("changeBody", this.registerForm);
this.initEvent.fire(Dialog);
} | javascript | function (el, userConfig) {
/*
Note that we don't pass the user config in here yet because
we only want it executed once, at the lowest subclass level
*/
Dialog.superclass.init.call(this, el/*, userConfig*/);
this.beforeInitEvent.fire(Dialog);
Dom.addClass(this.element, Dialog.CSS_DIALOG);
this.cfg.setProperty("visible", false);
if (userConfig) {
this.cfg.applyConfig(userConfig, true);
}
this.showEvent.subscribe(this.focusFirst, this, true);
this.beforeHideEvent.subscribe(this.blurButtons, this, true);
this.subscribe("changeBody", this.registerForm);
this.initEvent.fire(Dialog);
} | [
"function",
"(",
"el",
",",
"userConfig",
")",
"{",
"/*\n Note that we don't pass the user config in here yet because \n we only want it executed once, at the lowest subclass level\n */",
"Dialog",
".",
"superclass",
".",
"init",
".",
"call",
"(",
"this",
",",
"el",
"/*, userConfig*/",
")",
";",
"this",
".",
"beforeInitEvent",
".",
"fire",
"(",
"Dialog",
")",
";",
"Dom",
".",
"addClass",
"(",
"this",
".",
"element",
",",
"Dialog",
".",
"CSS_DIALOG",
")",
";",
"this",
".",
"cfg",
".",
"setProperty",
"(",
"\"visible\"",
",",
"false",
")",
";",
"if",
"(",
"userConfig",
")",
"{",
"this",
".",
"cfg",
".",
"applyConfig",
"(",
"userConfig",
",",
"true",
")",
";",
"}",
"this",
".",
"showEvent",
".",
"subscribe",
"(",
"this",
".",
"focusFirst",
",",
"this",
",",
"true",
")",
";",
"this",
".",
"beforeHideEvent",
".",
"subscribe",
"(",
"this",
".",
"blurButtons",
",",
"this",
",",
"true",
")",
";",
"this",
".",
"subscribe",
"(",
"\"changeBody\"",
",",
"this",
".",
"registerForm",
")",
";",
"this",
".",
"initEvent",
".",
"fire",
"(",
"Dialog",
")",
";",
"}"
]
| The Dialog initialization method, which is executed for Dialog and
all of its subclasses. This method is automatically called by the
constructor, and sets up all DOM references for pre-existing markup,
and creates required markup if it is not already present.
@method init
@param {String} el The element ID representing the Dialog <em>OR</em>
@param {HTMLElement} el The element representing the Dialog
@param {Object} userConfig The configuration object literal
containing the configuration that should be set for this Dialog.
See configuration documentation for more details. | [
"The",
"Dialog",
"initialization",
"method",
"which",
"is",
"executed",
"for",
"Dialog",
"and",
"all",
"of",
"its",
"subclasses",
".",
"This",
"method",
"is",
"automatically",
"called",
"by",
"the",
"constructor",
"and",
"sets",
"up",
"all",
"DOM",
"references",
"for",
"pre",
"-",
"existing",
"markup",
"and",
"creates",
"required",
"markup",
"if",
"it",
"is",
"not",
"already",
"present",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/container/container.js#L7468-L7493 |
|
42,216 | neyric/webhookit | public/javascripts/yui/container/container.js | function() {
var form = this.element.getElementsByTagName("form")[0];
if (this.form) {
if (this.form == form && Dom.isAncestor(this.element, this.form)) {
return;
} else {
Event.purgeElement(this.form);
this.form = null;
}
}
if (!form) {
form = document.createElement("form");
form.name = "frm_" + this.id;
this.body.appendChild(form);
}
if (form) {
this.form = form;
Event.on(form, "submit", this._submitHandler, this, true);
}
} | javascript | function() {
var form = this.element.getElementsByTagName("form")[0];
if (this.form) {
if (this.form == form && Dom.isAncestor(this.element, this.form)) {
return;
} else {
Event.purgeElement(this.form);
this.form = null;
}
}
if (!form) {
form = document.createElement("form");
form.name = "frm_" + this.id;
this.body.appendChild(form);
}
if (form) {
this.form = form;
Event.on(form, "submit", this._submitHandler, this, true);
}
} | [
"function",
"(",
")",
"{",
"var",
"form",
"=",
"this",
".",
"element",
".",
"getElementsByTagName",
"(",
"\"form\"",
")",
"[",
"0",
"]",
";",
"if",
"(",
"this",
".",
"form",
")",
"{",
"if",
"(",
"this",
".",
"form",
"==",
"form",
"&&",
"Dom",
".",
"isAncestor",
"(",
"this",
".",
"element",
",",
"this",
".",
"form",
")",
")",
"{",
"return",
";",
"}",
"else",
"{",
"Event",
".",
"purgeElement",
"(",
"this",
".",
"form",
")",
";",
"this",
".",
"form",
"=",
"null",
";",
"}",
"}",
"if",
"(",
"!",
"form",
")",
"{",
"form",
"=",
"document",
".",
"createElement",
"(",
"\"form\"",
")",
";",
"form",
".",
"name",
"=",
"\"frm_\"",
"+",
"this",
".",
"id",
";",
"this",
".",
"body",
".",
"appendChild",
"(",
"form",
")",
";",
"}",
"if",
"(",
"form",
")",
"{",
"this",
".",
"form",
"=",
"form",
";",
"Event",
".",
"on",
"(",
"form",
",",
"\"submit\"",
",",
"this",
".",
"_submitHandler",
",",
"this",
",",
"true",
")",
";",
"}",
"}"
]
| Prepares the Dialog's internal FORM object, creating one if one is
not currently present.
@method registerForm | [
"Prepares",
"the",
"Dialog",
"s",
"internal",
"FORM",
"object",
"creating",
"one",
"if",
"one",
"is",
"not",
"currently",
"present",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/container/container.js#L7611-L7634 |
|
42,217 | neyric/webhookit | public/javascripts/yui/container/container.js | function() {
Dialog.superclass.setFirstLastFocusable.call(this);
var i, l, el, elements = this.focusableElements;
this.firstFormElement = null;
this.lastFormElement = null;
if (this.form && elements && elements.length > 0) {
l = elements.length;
for (i = 0; i < l; ++i) {
el = elements[i];
if (this.form === el.form) {
this.firstFormElement = el;
break;
}
}
for (i = l-1; i >= 0; --i) {
el = elements[i];
if (this.form === el.form) {
this.lastFormElement = el;
break;
}
}
}
} | javascript | function() {
Dialog.superclass.setFirstLastFocusable.call(this);
var i, l, el, elements = this.focusableElements;
this.firstFormElement = null;
this.lastFormElement = null;
if (this.form && elements && elements.length > 0) {
l = elements.length;
for (i = 0; i < l; ++i) {
el = elements[i];
if (this.form === el.form) {
this.firstFormElement = el;
break;
}
}
for (i = l-1; i >= 0; --i) {
el = elements[i];
if (this.form === el.form) {
this.lastFormElement = el;
break;
}
}
}
} | [
"function",
"(",
")",
"{",
"Dialog",
".",
"superclass",
".",
"setFirstLastFocusable",
".",
"call",
"(",
"this",
")",
";",
"var",
"i",
",",
"l",
",",
"el",
",",
"elements",
"=",
"this",
".",
"focusableElements",
";",
"this",
".",
"firstFormElement",
"=",
"null",
";",
"this",
".",
"lastFormElement",
"=",
"null",
";",
"if",
"(",
"this",
".",
"form",
"&&",
"elements",
"&&",
"elements",
".",
"length",
">",
"0",
")",
"{",
"l",
"=",
"elements",
".",
"length",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"l",
";",
"++",
"i",
")",
"{",
"el",
"=",
"elements",
"[",
"i",
"]",
";",
"if",
"(",
"this",
".",
"form",
"===",
"el",
".",
"form",
")",
"{",
"this",
".",
"firstFormElement",
"=",
"el",
";",
"break",
";",
"}",
"}",
"for",
"(",
"i",
"=",
"l",
"-",
"1",
";",
"i",
">=",
"0",
";",
"--",
"i",
")",
"{",
"el",
"=",
"elements",
"[",
"i",
"]",
";",
"if",
"(",
"this",
".",
"form",
"===",
"el",
".",
"form",
")",
"{",
"this",
".",
"lastFormElement",
"=",
"el",
";",
"break",
";",
"}",
"}",
"}",
"}"
]
| Configures instance properties, pointing to the
first and last focusable elements in the Dialog's form.
@method setFirstLastFocusable | [
"Configures",
"instance",
"properties",
"pointing",
"to",
"the",
"first",
"and",
"last",
"focusable",
"elements",
"in",
"the",
"Dialog",
"s",
"form",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/container/container.js#L7673-L7701 |
|
42,218 | neyric/webhookit | public/javascripts/yui/container/container.js | function (type, args, obj) {
var aButtons = this.cfg.getProperty("buttons"),
el = this.lastFormElement;
if (args && args[1]) {
Event.stopEvent(args[1]);
}
if (aButtons && Lang.isArray(aButtons)) {
this.focusLastButton();
} else {
if (el) {
try {
el.focus();
} catch(oException) {
// Ignore
}
}
}
} | javascript | function (type, args, obj) {
var aButtons = this.cfg.getProperty("buttons"),
el = this.lastFormElement;
if (args && args[1]) {
Event.stopEvent(args[1]);
}
if (aButtons && Lang.isArray(aButtons)) {
this.focusLastButton();
} else {
if (el) {
try {
el.focus();
} catch(oException) {
// Ignore
}
}
}
} | [
"function",
"(",
"type",
",",
"args",
",",
"obj",
")",
"{",
"var",
"aButtons",
"=",
"this",
".",
"cfg",
".",
"getProperty",
"(",
"\"buttons\"",
")",
",",
"el",
"=",
"this",
".",
"lastFormElement",
";",
"if",
"(",
"args",
"&&",
"args",
"[",
"1",
"]",
")",
"{",
"Event",
".",
"stopEvent",
"(",
"args",
"[",
"1",
"]",
")",
";",
"}",
"if",
"(",
"aButtons",
"&&",
"Lang",
".",
"isArray",
"(",
"aButtons",
")",
")",
"{",
"this",
".",
"focusLastButton",
"(",
")",
";",
"}",
"else",
"{",
"if",
"(",
"el",
")",
"{",
"try",
"{",
"el",
".",
"focus",
"(",
")",
";",
"}",
"catch",
"(",
"oException",
")",
"{",
"// Ignore",
"}",
"}",
"}",
"}"
]
| Sets focus to the last element in the Dialog's form or the last
button defined via the "buttons" configuration property.
@method focusLast | [
"Sets",
"focus",
"to",
"the",
"last",
"element",
"in",
"the",
"Dialog",
"s",
"form",
"or",
"the",
"last",
"button",
"defined",
"via",
"the",
"buttons",
"configuration",
"property",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/container/container.js#L7918-L7938 |
|
42,219 | neyric/webhookit | public/javascripts/yui/container/container.js | function(button) {
var Button = YAHOO.widget.Button;
// If we have an HTML button and YUI Button is on the page,
// get the YUI Button reference if available.
if (Button && button && button.nodeName && button.id) {
button = Button.getButton(button.id) || button;
}
return button;
} | javascript | function(button) {
var Button = YAHOO.widget.Button;
// If we have an HTML button and YUI Button is on the page,
// get the YUI Button reference if available.
if (Button && button && button.nodeName && button.id) {
button = Button.getButton(button.id) || button;
}
return button;
} | [
"function",
"(",
"button",
")",
"{",
"var",
"Button",
"=",
"YAHOO",
".",
"widget",
".",
"Button",
";",
"// If we have an HTML button and YUI Button is on the page, ",
"// get the YUI Button reference if available.",
"if",
"(",
"Button",
"&&",
"button",
"&&",
"button",
".",
"nodeName",
"&&",
"button",
".",
"id",
")",
"{",
"button",
"=",
"Button",
".",
"getButton",
"(",
"button",
".",
"id",
")",
"||",
"button",
";",
"}",
"return",
"button",
";",
"}"
]
| Helper method to normalize button references. It either returns the
YUI Button instance for the given element if found,
or the passes back the HTMLElement reference if a corresponding YUI Button
reference is not found or YAHOO.widget.Button does not exist on the page.
@method _getButton
@private
@param {HTMLElement} button
@return {YAHOO.widget.Button|HTMLElement} | [
"Helper",
"method",
"to",
"normalize",
"button",
"references",
".",
"It",
"either",
"returns",
"the",
"YUI",
"Button",
"instance",
"for",
"the",
"given",
"element",
"if",
"found",
"or",
"the",
"passes",
"back",
"the",
"HTMLElement",
"reference",
"if",
"a",
"corresponding",
"YUI",
"Button",
"reference",
"is",
"not",
"found",
"or",
"YAHOO",
".",
"widget",
".",
"Button",
"does",
"not",
"exist",
"on",
"the",
"page",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/container/container.js#L7951-L7961 |
|
42,220 | neyric/webhookit | public/javascripts/yui/container/container.js | function () {
var aButtons = this.cfg.getProperty("buttons"),
oButton,
oElement;
if (aButtons && Lang.isArray(aButtons)) {
oButton = aButtons[0];
if (oButton) {
oElement = this._getButton(oButton.htmlButton);
if (oElement) {
/*
Place the call to the "focus" method inside a
try/catch block to prevent IE from throwing
JavaScript errors if the element is disabled
or hidden.
*/
try {
oElement.focus();
} catch(oException) {
// ignore
}
}
}
}
} | javascript | function () {
var aButtons = this.cfg.getProperty("buttons"),
oButton,
oElement;
if (aButtons && Lang.isArray(aButtons)) {
oButton = aButtons[0];
if (oButton) {
oElement = this._getButton(oButton.htmlButton);
if (oElement) {
/*
Place the call to the "focus" method inside a
try/catch block to prevent IE from throwing
JavaScript errors if the element is disabled
or hidden.
*/
try {
oElement.focus();
} catch(oException) {
// ignore
}
}
}
}
} | [
"function",
"(",
")",
"{",
"var",
"aButtons",
"=",
"this",
".",
"cfg",
".",
"getProperty",
"(",
"\"buttons\"",
")",
",",
"oButton",
",",
"oElement",
";",
"if",
"(",
"aButtons",
"&&",
"Lang",
".",
"isArray",
"(",
"aButtons",
")",
")",
"{",
"oButton",
"=",
"aButtons",
"[",
"0",
"]",
";",
"if",
"(",
"oButton",
")",
"{",
"oElement",
"=",
"this",
".",
"_getButton",
"(",
"oButton",
".",
"htmlButton",
")",
";",
"if",
"(",
"oElement",
")",
"{",
"/*\n Place the call to the \"focus\" method inside a \n try/catch block to prevent IE from throwing \n JavaScript errors if the element is disabled \n or hidden.\n */",
"try",
"{",
"oElement",
".",
"focus",
"(",
")",
";",
"}",
"catch",
"(",
"oException",
")",
"{",
"// ignore",
"}",
"}",
"}",
"}",
"}"
]
| Sets the focus to the first button created via the "buttons"
configuration property.
@method focusFirstButton | [
"Sets",
"the",
"focus",
"to",
"the",
"first",
"button",
"created",
"via",
"the",
"buttons",
"configuration",
"property",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/container/container.js#L8029-L8054 |
|
42,221 | neyric/webhookit | public/javascripts/yui/container/container.js | function () {
if (this.validate()) {
if (this.beforeSubmitEvent.fire()) {
this.doSubmit();
this.submitEvent.fire();
if (this.cfg.getProperty("hideaftersubmit")) {
this.hide();
}
return true;
} else {
return false;
}
} else {
return false;
}
} | javascript | function () {
if (this.validate()) {
if (this.beforeSubmitEvent.fire()) {
this.doSubmit();
this.submitEvent.fire();
if (this.cfg.getProperty("hideaftersubmit")) {
this.hide();
}
return true;
} else {
return false;
}
} else {
return false;
}
} | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"validate",
"(",
")",
")",
"{",
"if",
"(",
"this",
".",
"beforeSubmitEvent",
".",
"fire",
"(",
")",
")",
"{",
"this",
".",
"doSubmit",
"(",
")",
";",
"this",
".",
"submitEvent",
".",
"fire",
"(",
")",
";",
"if",
"(",
"this",
".",
"cfg",
".",
"getProperty",
"(",
"\"hideaftersubmit\"",
")",
")",
"{",
"this",
".",
"hide",
"(",
")",
";",
"}",
"return",
"true",
";",
"}",
"else",
"{",
"return",
"false",
";",
"}",
"}",
"else",
"{",
"return",
"false",
";",
"}",
"}"
]
| Executes a submit of the Dialog if validation
is successful. By default the Dialog is hidden
after submission, but you can set the "hideaftersubmit"
configuration property to false, to prevent the Dialog
from being hidden.
@method submit | [
"Executes",
"a",
"submit",
"of",
"the",
"Dialog",
"if",
"validation",
"is",
"successful",
".",
"By",
"default",
"the",
"Dialog",
"is",
"hidden",
"after",
"submission",
"but",
"you",
"can",
"set",
"the",
"hideaftersubmit",
"configuration",
"property",
"to",
"false",
"to",
"prevent",
"the",
"Dialog",
"from",
"being",
"hidden",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/container/container.js#L8130-L8147 |
|
42,222 | neyric/webhookit | public/javascripts/yui/container/container.js | function () {
var oForm = this.form,
aElements,
nTotalElements,
oData,
sName,
oElement,
nElements,
sType,
sTagName,
aOptions,
nOptions,
aValues,
oOption,
oRadio,
oCheckbox,
valueAttr,
i,
n;
function isFormElement(p_oElement) {
var sTag = p_oElement.tagName.toUpperCase();
return ((sTag == "INPUT" || sTag == "TEXTAREA" ||
sTag == "SELECT") && p_oElement.name == sName);
}
if (oForm) {
aElements = oForm.elements;
nTotalElements = aElements.length;
oData = {};
for (i = 0; i < nTotalElements; i++) {
sName = aElements[i].name;
/*
Using "Dom.getElementsBy" to safeguard user from JS
errors that result from giving a form field (or set of
fields) the same name as a native method of a form
(like "submit") or a DOM collection (such as the "item"
method). Originally tried accessing fields via the
"namedItem" method of the "element" collection, but
discovered that it won't return a collection of fields
in Gecko.
*/
oElement = Dom.getElementsBy(isFormElement, "*", oForm);
nElements = oElement.length;
if (nElements > 0) {
if (nElements == 1) {
oElement = oElement[0];
sType = oElement.type;
sTagName = oElement.tagName.toUpperCase();
switch (sTagName) {
case "INPUT":
if (sType == "checkbox") {
oData[sName] = oElement.checked;
} else if (sType != "radio") {
oData[sName] = oElement.value;
}
break;
case "TEXTAREA":
oData[sName] = oElement.value;
break;
case "SELECT":
aOptions = oElement.options;
nOptions = aOptions.length;
aValues = [];
for (n = 0; n < nOptions; n++) {
oOption = aOptions[n];
if (oOption.selected) {
valueAttr = oOption.attributes.value;
aValues[aValues.length] = (valueAttr && valueAttr.specified) ? oOption.value : oOption.text;
}
}
oData[sName] = aValues;
break;
}
} else {
sType = oElement[0].type;
switch (sType) {
case "radio":
for (n = 0; n < nElements; n++) {
oRadio = oElement[n];
if (oRadio.checked) {
oData[sName] = oRadio.value;
break;
}
}
break;
case "checkbox":
aValues = [];
for (n = 0; n < nElements; n++) {
oCheckbox = oElement[n];
if (oCheckbox.checked) {
aValues[aValues.length] = oCheckbox.value;
}
}
oData[sName] = aValues;
break;
}
}
}
}
}
return oData;
} | javascript | function () {
var oForm = this.form,
aElements,
nTotalElements,
oData,
sName,
oElement,
nElements,
sType,
sTagName,
aOptions,
nOptions,
aValues,
oOption,
oRadio,
oCheckbox,
valueAttr,
i,
n;
function isFormElement(p_oElement) {
var sTag = p_oElement.tagName.toUpperCase();
return ((sTag == "INPUT" || sTag == "TEXTAREA" ||
sTag == "SELECT") && p_oElement.name == sName);
}
if (oForm) {
aElements = oForm.elements;
nTotalElements = aElements.length;
oData = {};
for (i = 0; i < nTotalElements; i++) {
sName = aElements[i].name;
/*
Using "Dom.getElementsBy" to safeguard user from JS
errors that result from giving a form field (or set of
fields) the same name as a native method of a form
(like "submit") or a DOM collection (such as the "item"
method). Originally tried accessing fields via the
"namedItem" method of the "element" collection, but
discovered that it won't return a collection of fields
in Gecko.
*/
oElement = Dom.getElementsBy(isFormElement, "*", oForm);
nElements = oElement.length;
if (nElements > 0) {
if (nElements == 1) {
oElement = oElement[0];
sType = oElement.type;
sTagName = oElement.tagName.toUpperCase();
switch (sTagName) {
case "INPUT":
if (sType == "checkbox") {
oData[sName] = oElement.checked;
} else if (sType != "radio") {
oData[sName] = oElement.value;
}
break;
case "TEXTAREA":
oData[sName] = oElement.value;
break;
case "SELECT":
aOptions = oElement.options;
nOptions = aOptions.length;
aValues = [];
for (n = 0; n < nOptions; n++) {
oOption = aOptions[n];
if (oOption.selected) {
valueAttr = oOption.attributes.value;
aValues[aValues.length] = (valueAttr && valueAttr.specified) ? oOption.value : oOption.text;
}
}
oData[sName] = aValues;
break;
}
} else {
sType = oElement[0].type;
switch (sType) {
case "radio":
for (n = 0; n < nElements; n++) {
oRadio = oElement[n];
if (oRadio.checked) {
oData[sName] = oRadio.value;
break;
}
}
break;
case "checkbox":
aValues = [];
for (n = 0; n < nElements; n++) {
oCheckbox = oElement[n];
if (oCheckbox.checked) {
aValues[aValues.length] = oCheckbox.value;
}
}
oData[sName] = aValues;
break;
}
}
}
}
}
return oData;
} | [
"function",
"(",
")",
"{",
"var",
"oForm",
"=",
"this",
".",
"form",
",",
"aElements",
",",
"nTotalElements",
",",
"oData",
",",
"sName",
",",
"oElement",
",",
"nElements",
",",
"sType",
",",
"sTagName",
",",
"aOptions",
",",
"nOptions",
",",
"aValues",
",",
"oOption",
",",
"oRadio",
",",
"oCheckbox",
",",
"valueAttr",
",",
"i",
",",
"n",
";",
"function",
"isFormElement",
"(",
"p_oElement",
")",
"{",
"var",
"sTag",
"=",
"p_oElement",
".",
"tagName",
".",
"toUpperCase",
"(",
")",
";",
"return",
"(",
"(",
"sTag",
"==",
"\"INPUT\"",
"||",
"sTag",
"==",
"\"TEXTAREA\"",
"||",
"sTag",
"==",
"\"SELECT\"",
")",
"&&",
"p_oElement",
".",
"name",
"==",
"sName",
")",
";",
"}",
"if",
"(",
"oForm",
")",
"{",
"aElements",
"=",
"oForm",
".",
"elements",
";",
"nTotalElements",
"=",
"aElements",
".",
"length",
";",
"oData",
"=",
"{",
"}",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"nTotalElements",
";",
"i",
"++",
")",
"{",
"sName",
"=",
"aElements",
"[",
"i",
"]",
".",
"name",
";",
"/*\n Using \"Dom.getElementsBy\" to safeguard user from JS \n errors that result from giving a form field (or set of \n fields) the same name as a native method of a form \n (like \"submit\") or a DOM collection (such as the \"item\"\n method). Originally tried accessing fields via the \n \"namedItem\" method of the \"element\" collection, but \n discovered that it won't return a collection of fields \n in Gecko.\n */",
"oElement",
"=",
"Dom",
".",
"getElementsBy",
"(",
"isFormElement",
",",
"\"*\"",
",",
"oForm",
")",
";",
"nElements",
"=",
"oElement",
".",
"length",
";",
"if",
"(",
"nElements",
">",
"0",
")",
"{",
"if",
"(",
"nElements",
"==",
"1",
")",
"{",
"oElement",
"=",
"oElement",
"[",
"0",
"]",
";",
"sType",
"=",
"oElement",
".",
"type",
";",
"sTagName",
"=",
"oElement",
".",
"tagName",
".",
"toUpperCase",
"(",
")",
";",
"switch",
"(",
"sTagName",
")",
"{",
"case",
"\"INPUT\"",
":",
"if",
"(",
"sType",
"==",
"\"checkbox\"",
")",
"{",
"oData",
"[",
"sName",
"]",
"=",
"oElement",
".",
"checked",
";",
"}",
"else",
"if",
"(",
"sType",
"!=",
"\"radio\"",
")",
"{",
"oData",
"[",
"sName",
"]",
"=",
"oElement",
".",
"value",
";",
"}",
"break",
";",
"case",
"\"TEXTAREA\"",
":",
"oData",
"[",
"sName",
"]",
"=",
"oElement",
".",
"value",
";",
"break",
";",
"case",
"\"SELECT\"",
":",
"aOptions",
"=",
"oElement",
".",
"options",
";",
"nOptions",
"=",
"aOptions",
".",
"length",
";",
"aValues",
"=",
"[",
"]",
";",
"for",
"(",
"n",
"=",
"0",
";",
"n",
"<",
"nOptions",
";",
"n",
"++",
")",
"{",
"oOption",
"=",
"aOptions",
"[",
"n",
"]",
";",
"if",
"(",
"oOption",
".",
"selected",
")",
"{",
"valueAttr",
"=",
"oOption",
".",
"attributes",
".",
"value",
";",
"aValues",
"[",
"aValues",
".",
"length",
"]",
"=",
"(",
"valueAttr",
"&&",
"valueAttr",
".",
"specified",
")",
"?",
"oOption",
".",
"value",
":",
"oOption",
".",
"text",
";",
"}",
"}",
"oData",
"[",
"sName",
"]",
"=",
"aValues",
";",
"break",
";",
"}",
"}",
"else",
"{",
"sType",
"=",
"oElement",
"[",
"0",
"]",
".",
"type",
";",
"switch",
"(",
"sType",
")",
"{",
"case",
"\"radio\"",
":",
"for",
"(",
"n",
"=",
"0",
";",
"n",
"<",
"nElements",
";",
"n",
"++",
")",
"{",
"oRadio",
"=",
"oElement",
"[",
"n",
"]",
";",
"if",
"(",
"oRadio",
".",
"checked",
")",
"{",
"oData",
"[",
"sName",
"]",
"=",
"oRadio",
".",
"value",
";",
"break",
";",
"}",
"}",
"break",
";",
"case",
"\"checkbox\"",
":",
"aValues",
"=",
"[",
"]",
";",
"for",
"(",
"n",
"=",
"0",
";",
"n",
"<",
"nElements",
";",
"n",
"++",
")",
"{",
"oCheckbox",
"=",
"oElement",
"[",
"n",
"]",
";",
"if",
"(",
"oCheckbox",
".",
"checked",
")",
"{",
"aValues",
"[",
"aValues",
".",
"length",
"]",
"=",
"oCheckbox",
".",
"value",
";",
"}",
"}",
"oData",
"[",
"sName",
"]",
"=",
"aValues",
";",
"break",
";",
"}",
"}",
"}",
"}",
"}",
"return",
"oData",
";",
"}"
]
| Returns a JSON-compatible data structure representing the data
currently contained in the form.
@method getData
@return {Object} A JSON object reprsenting the data of the
current form. | [
"Returns",
"a",
"JSON",
"-",
"compatible",
"data",
"structure",
"representing",
"the",
"data",
"currently",
"contained",
"in",
"the",
"form",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/container/container.js#L8165-L8281 |
|
42,223 | neyric/webhookit | public/javascripts/yui/container/container.js | function (el, userConfig) {
/*
Note that we don't pass the user config in here yet because we
only want it executed once, at the lowest subclass level
*/
SimpleDialog.superclass.init.call(this, el/*, userConfig*/);
this.beforeInitEvent.fire(SimpleDialog);
Dom.addClass(this.element, SimpleDialog.CSS_SIMPLEDIALOG);
this.cfg.queueProperty("postmethod", "manual");
if (userConfig) {
this.cfg.applyConfig(userConfig, true);
}
this.beforeRenderEvent.subscribe(function () {
if (! this.body) {
this.setBody("");
}
}, this, true);
this.initEvent.fire(SimpleDialog);
} | javascript | function (el, userConfig) {
/*
Note that we don't pass the user config in here yet because we
only want it executed once, at the lowest subclass level
*/
SimpleDialog.superclass.init.call(this, el/*, userConfig*/);
this.beforeInitEvent.fire(SimpleDialog);
Dom.addClass(this.element, SimpleDialog.CSS_SIMPLEDIALOG);
this.cfg.queueProperty("postmethod", "manual");
if (userConfig) {
this.cfg.applyConfig(userConfig, true);
}
this.beforeRenderEvent.subscribe(function () {
if (! this.body) {
this.setBody("");
}
}, this, true);
this.initEvent.fire(SimpleDialog);
} | [
"function",
"(",
"el",
",",
"userConfig",
")",
"{",
"/*\n Note that we don't pass the user config in here yet because we \n only want it executed once, at the lowest subclass level\n */",
"SimpleDialog",
".",
"superclass",
".",
"init",
".",
"call",
"(",
"this",
",",
"el",
"/*, userConfig*/",
")",
";",
"this",
".",
"beforeInitEvent",
".",
"fire",
"(",
"SimpleDialog",
")",
";",
"Dom",
".",
"addClass",
"(",
"this",
".",
"element",
",",
"SimpleDialog",
".",
"CSS_SIMPLEDIALOG",
")",
";",
"this",
".",
"cfg",
".",
"queueProperty",
"(",
"\"postmethod\"",
",",
"\"manual\"",
")",
";",
"if",
"(",
"userConfig",
")",
"{",
"this",
".",
"cfg",
".",
"applyConfig",
"(",
"userConfig",
",",
"true",
")",
";",
"}",
"this",
".",
"beforeRenderEvent",
".",
"subscribe",
"(",
"function",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"body",
")",
"{",
"this",
".",
"setBody",
"(",
"\"\"",
")",
";",
"}",
"}",
",",
"this",
",",
"true",
")",
";",
"this",
".",
"initEvent",
".",
"fire",
"(",
"SimpleDialog",
")",
";",
"}"
]
| The SimpleDialog initialization method, which is executed for
SimpleDialog and all of its subclasses. This method is automatically
called by the constructor, and sets up all DOM references for
pre-existing markup, and creates required markup if it is not
already present.
@method init
@param {String} el The element ID representing the SimpleDialog
<em>OR</em>
@param {HTMLElement} el The element representing the SimpleDialog
@param {Object} userConfig The configuration object literal
containing the configuration that should be set for this
SimpleDialog. See configuration documentation for more details. | [
"The",
"SimpleDialog",
"initialization",
"method",
"which",
"is",
"executed",
"for",
"SimpleDialog",
"and",
"all",
"of",
"its",
"subclasses",
".",
"This",
"method",
"is",
"automatically",
"called",
"by",
"the",
"constructor",
"and",
"sets",
"up",
"all",
"DOM",
"references",
"for",
"pre",
"-",
"existing",
"markup",
"and",
"creates",
"required",
"markup",
"if",
"it",
"is",
"not",
"already",
"present",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/container/container.js#L8503-L8530 |
|
42,224 | neyric/webhookit | public/javascripts/yui/container/container.js | function (type,args,obj) {
var text = args[0];
if (text) {
this.setBody(text);
this.cfg.refireEvent("icon");
}
} | javascript | function (type,args,obj) {
var text = args[0];
if (text) {
this.setBody(text);
this.cfg.refireEvent("icon");
}
} | [
"function",
"(",
"type",
",",
"args",
",",
"obj",
")",
"{",
"var",
"text",
"=",
"args",
"[",
"0",
"]",
";",
"if",
"(",
"text",
")",
"{",
"this",
".",
"setBody",
"(",
"text",
")",
";",
"this",
".",
"cfg",
".",
"refireEvent",
"(",
"\"icon\"",
")",
";",
"}",
"}"
]
| Fired when the "text" property is set.
@method configText
@param {String} type The CustomEvent type (usually the property name)
@param {Object[]} args The CustomEvent arguments. For configuration
handlers, args[0] will equal the newly applied value for the property.
@param {Object} obj The scope object. For configuration handlers,
this will usually equal the owner. | [
"Fired",
"when",
"the",
"text",
"property",
"is",
"set",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/container/container.js#L8620-L8626 |
|
42,225 | neyric/webhookit | public/javascripts/inputex/js/fields/UpperCaseField.js | function(val, sendUpdatedEvt) {
// don't always rewrite the value to able selections with Ctrl+A
var uppered = val.toUpperCase();
if(uppered != this.getValue()) {
inputEx.UpperCaseField.superclass.setValue.call(this, uppered, sendUpdatedEvt);
}
} | javascript | function(val, sendUpdatedEvt) {
// don't always rewrite the value to able selections with Ctrl+A
var uppered = val.toUpperCase();
if(uppered != this.getValue()) {
inputEx.UpperCaseField.superclass.setValue.call(this, uppered, sendUpdatedEvt);
}
} | [
"function",
"(",
"val",
",",
"sendUpdatedEvt",
")",
"{",
"// don't always rewrite the value to able selections with Ctrl+A",
"var",
"uppered",
"=",
"val",
".",
"toUpperCase",
"(",
")",
";",
"if",
"(",
"uppered",
"!=",
"this",
".",
"getValue",
"(",
")",
")",
"{",
"inputEx",
".",
"UpperCaseField",
".",
"superclass",
".",
"setValue",
".",
"call",
"(",
"this",
",",
"uppered",
",",
"sendUpdatedEvt",
")",
";",
"}",
"}"
]
| Set the value and call toUpperCase
@param {String} val The string
@param {boolean} [sendUpdatedEvt] (optional) Wether this setValue should fire the updatedEvt or not (default is true, pass false to NOT send the event) | [
"Set",
"the",
"value",
"and",
"call",
"toUpperCase"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/inputex/js/fields/UpperCaseField.js#L20-L26 |
|
42,226 | neyric/webhookit | public/javascripts/inputex/js/fields/UpperCaseField.js | function(e) {
inputEx.UpperCaseField.superclass.onKeyPress.call(this,e);
// Re-Apply a toUpperCase method
YAHOO.lang.later(0,this,function() {this.setValue( (this.getValue()) );});
} | javascript | function(e) {
inputEx.UpperCaseField.superclass.onKeyPress.call(this,e);
// Re-Apply a toUpperCase method
YAHOO.lang.later(0,this,function() {this.setValue( (this.getValue()) );});
} | [
"function",
"(",
"e",
")",
"{",
"inputEx",
".",
"UpperCaseField",
".",
"superclass",
".",
"onKeyPress",
".",
"call",
"(",
"this",
",",
"e",
")",
";",
"// Re-Apply a toUpperCase method",
"YAHOO",
".",
"lang",
".",
"later",
"(",
"0",
",",
"this",
",",
"function",
"(",
")",
"{",
"this",
".",
"setValue",
"(",
"(",
"this",
".",
"getValue",
"(",
")",
")",
")",
";",
"}",
")",
";",
"}"
]
| Call setvalue on input to update the field with upper case value
@param {Event} e The original 'input' event | [
"Call",
"setvalue",
"on",
"input",
"to",
"update",
"the",
"field",
"with",
"upper",
"case",
"value"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/inputex/js/fields/UpperCaseField.js#L32-L37 |
|
42,227 | neyric/webhookit | public/javascripts/WireIt/plugins/editor/lib/accordionview/accordionview.js | function(el, oAttr) {
el = YUD.get(el);
// some sensible defaults
oAttr = oAttr || {};
if(!el) {
el = document.createElement(this.CONFIG.TAG_NAME);
}
if (el.id) {oAttr.id = el.id; }
YAHOO.widget.AccordionView.superclass.constructor.call(this, el, oAttr);
this.initList(el, oAttr);
// This refresh forces all defaults to be set
this.refresh(['id', 'width','hoverActivated'],true);
} | javascript | function(el, oAttr) {
el = YUD.get(el);
// some sensible defaults
oAttr = oAttr || {};
if(!el) {
el = document.createElement(this.CONFIG.TAG_NAME);
}
if (el.id) {oAttr.id = el.id; }
YAHOO.widget.AccordionView.superclass.constructor.call(this, el, oAttr);
this.initList(el, oAttr);
// This refresh forces all defaults to be set
this.refresh(['id', 'width','hoverActivated'],true);
} | [
"function",
"(",
"el",
",",
"oAttr",
")",
"{",
"el",
"=",
"YUD",
".",
"get",
"(",
"el",
")",
";",
"// some sensible defaults",
"oAttr",
"=",
"oAttr",
"||",
"{",
"}",
";",
"if",
"(",
"!",
"el",
")",
"{",
"el",
"=",
"document",
".",
"createElement",
"(",
"this",
".",
"CONFIG",
".",
"TAG_NAME",
")",
";",
"}",
"if",
"(",
"el",
".",
"id",
")",
"{",
"oAttr",
".",
"id",
"=",
"el",
".",
"id",
";",
"}",
"YAHOO",
".",
"widget",
".",
"AccordionView",
".",
"superclass",
".",
"constructor",
".",
"call",
"(",
"this",
",",
"el",
",",
"oAttr",
")",
";",
"this",
".",
"initList",
"(",
"el",
",",
"oAttr",
")",
";",
"// This refresh forces all defaults to be set",
"this",
".",
"refresh",
"(",
"[",
"'id'",
",",
"'width'",
",",
"'hoverActivated'",
"]",
",",
"true",
")",
";",
"}"
]
| A widget to control accordion views.
@namespace YAHOO.widget
@class AccordionView
@extends YAHOO.util.Element
@constructor
@param {HTMLElement | String} el The id of the html element that represents the AccordionView.
@param {Object} oAttr (optional) A key map of the AccordionView's
initial oAttributes. | [
"A",
"widget",
"to",
"control",
"accordion",
"views",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/WireIt/plugins/editor/lib/accordionview/accordionview.js#L35-L54 |
|
42,228 | neyric/webhookit | public/javascripts/WireIt/plugins/editor/lib/accordionview/accordionview.js | function (oAttr) {
AccordionView.superclass.initAttributes.call(this, oAttr);
var bAnimate = (YAHOO.env.modules.animation) ? true : false;
this.setAttributeConfig('id', {
writeOnce: true,
validator: function (value) {
return (/^[a-zA-Z][\w0-9\-_.:]*$/.test(value));
},
value: YUD.generateId(),
method: function (value) {
this.get('element').id = value;
}
});
this.setAttributeConfig('width', {
value: '400px',
method: function (value) {
this.setStyle('width', value);
}
}
);
this.setAttributeConfig('animationSpeed', {
value: 0.7
}
);
this.setAttributeConfig('animate', {
value: bAnimate,
validator: YAHOO.lang.isBoolean
}
);
this.setAttributeConfig('collapsible', {
value: false,
validator: YAHOO.lang.isBoolean
}
);
this.setAttributeConfig('expandable', {
value: false,
validator: YAHOO.lang.isBoolean
}
);
this.setAttributeConfig('effect', {
value: YAHOO.util.Easing.easeBoth,
validator: YAHOO.lang.isString
}
);
this.setAttributeConfig('hoverActivated', {
value: false,
validator: YAHOO.lang.isBoolean,
method: function (value) {
if (value) {
YUE.on(this, 'mouseover', this._onMouseOver, this, true);
} else {
YUE.removeListener(this, 'mouseover', this._onMouseOver);
}
}
});
this.setAttributeConfig('_hoverTimeout', {
value: 500,
validator: YAHOO.lang.isInteger
}
);
} | javascript | function (oAttr) {
AccordionView.superclass.initAttributes.call(this, oAttr);
var bAnimate = (YAHOO.env.modules.animation) ? true : false;
this.setAttributeConfig('id', {
writeOnce: true,
validator: function (value) {
return (/^[a-zA-Z][\w0-9\-_.:]*$/.test(value));
},
value: YUD.generateId(),
method: function (value) {
this.get('element').id = value;
}
});
this.setAttributeConfig('width', {
value: '400px',
method: function (value) {
this.setStyle('width', value);
}
}
);
this.setAttributeConfig('animationSpeed', {
value: 0.7
}
);
this.setAttributeConfig('animate', {
value: bAnimate,
validator: YAHOO.lang.isBoolean
}
);
this.setAttributeConfig('collapsible', {
value: false,
validator: YAHOO.lang.isBoolean
}
);
this.setAttributeConfig('expandable', {
value: false,
validator: YAHOO.lang.isBoolean
}
);
this.setAttributeConfig('effect', {
value: YAHOO.util.Easing.easeBoth,
validator: YAHOO.lang.isString
}
);
this.setAttributeConfig('hoverActivated', {
value: false,
validator: YAHOO.lang.isBoolean,
method: function (value) {
if (value) {
YUE.on(this, 'mouseover', this._onMouseOver, this, true);
} else {
YUE.removeListener(this, 'mouseover', this._onMouseOver);
}
}
});
this.setAttributeConfig('_hoverTimeout', {
value: 500,
validator: YAHOO.lang.isInteger
}
);
} | [
"function",
"(",
"oAttr",
")",
"{",
"AccordionView",
".",
"superclass",
".",
"initAttributes",
".",
"call",
"(",
"this",
",",
"oAttr",
")",
";",
"var",
"bAnimate",
"=",
"(",
"YAHOO",
".",
"env",
".",
"modules",
".",
"animation",
")",
"?",
"true",
":",
"false",
";",
"this",
".",
"setAttributeConfig",
"(",
"'id'",
",",
"{",
"writeOnce",
":",
"true",
",",
"validator",
":",
"function",
"(",
"value",
")",
"{",
"return",
"(",
"/",
"^[a-zA-Z][\\w0-9\\-_.:]*$",
"/",
".",
"test",
"(",
"value",
")",
")",
";",
"}",
",",
"value",
":",
"YUD",
".",
"generateId",
"(",
")",
",",
"method",
":",
"function",
"(",
"value",
")",
"{",
"this",
".",
"get",
"(",
"'element'",
")",
".",
"id",
"=",
"value",
";",
"}",
"}",
")",
";",
"this",
".",
"setAttributeConfig",
"(",
"'width'",
",",
"{",
"value",
":",
"'400px'",
",",
"method",
":",
"function",
"(",
"value",
")",
"{",
"this",
".",
"setStyle",
"(",
"'width'",
",",
"value",
")",
";",
"}",
"}",
")",
";",
"this",
".",
"setAttributeConfig",
"(",
"'animationSpeed'",
",",
"{",
"value",
":",
"0.7",
"}",
")",
";",
"this",
".",
"setAttributeConfig",
"(",
"'animate'",
",",
"{",
"value",
":",
"bAnimate",
",",
"validator",
":",
"YAHOO",
".",
"lang",
".",
"isBoolean",
"}",
")",
";",
"this",
".",
"setAttributeConfig",
"(",
"'collapsible'",
",",
"{",
"value",
":",
"false",
",",
"validator",
":",
"YAHOO",
".",
"lang",
".",
"isBoolean",
"}",
")",
";",
"this",
".",
"setAttributeConfig",
"(",
"'expandable'",
",",
"{",
"value",
":",
"false",
",",
"validator",
":",
"YAHOO",
".",
"lang",
".",
"isBoolean",
"}",
")",
";",
"this",
".",
"setAttributeConfig",
"(",
"'effect'",
",",
"{",
"value",
":",
"YAHOO",
".",
"util",
".",
"Easing",
".",
"easeBoth",
",",
"validator",
":",
"YAHOO",
".",
"lang",
".",
"isString",
"}",
")",
";",
"this",
".",
"setAttributeConfig",
"(",
"'hoverActivated'",
",",
"{",
"value",
":",
"false",
",",
"validator",
":",
"YAHOO",
".",
"lang",
".",
"isBoolean",
",",
"method",
":",
"function",
"(",
"value",
")",
"{",
"if",
"(",
"value",
")",
"{",
"YUE",
".",
"on",
"(",
"this",
",",
"'mouseover'",
",",
"this",
".",
"_onMouseOver",
",",
"this",
",",
"true",
")",
";",
"}",
"else",
"{",
"YUE",
".",
"removeListener",
"(",
"this",
",",
"'mouseover'",
",",
"this",
".",
"_onMouseOver",
")",
";",
"}",
"}",
"}",
")",
";",
"this",
".",
"setAttributeConfig",
"(",
"'_hoverTimeout'",
",",
"{",
"value",
":",
"500",
",",
"validator",
":",
"YAHOO",
".",
"lang",
".",
"isInteger",
"}",
")",
";",
"}"
]
| Initialize attributes for the Accordion
@param {Object} oAttr attributes key map
@method initAttributes | [
"Initialize",
"attributes",
"for",
"the",
"Accordion"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/WireIt/plugins/editor/lib/accordionview/accordionview.js#L128-L189 |
|
42,229 | neyric/webhookit | public/javascripts/WireIt/plugins/editor/lib/accordionview/accordionview.js | function() {
if(true === this.get('hoverActivated')) {
this.on('mouseover', this._onMouseOver, this, true);
this.on('mouseout', this._onMouseOut, this, true);
}
this.on('click', this._onClick, this, true);
this.on('keydown', this._onKeydown, this, true);
// set this._opening and this._closing before open/close operations begin
this.on('panelOpen', function(){this._opening = true;}, this, true);
this.on('panelClose', function(){this._closing = true;}, this, true);
// This makes sure that this._fixTabindexes is called after a change has
// fully completed
this.on('afterPanelClose', function(){
this._closing = false;
if(!this._closing && !this._opening) {
this._fixTabIndexes();
}
}, this, true);
this.on('afterPanelOpen', function(){
this._opening = false;
if(!this._closing && !this._opening) {
this._fixTabIndexes();
}
}, this, true);
/*
This is needed when the hrefs are removed from links
to be able to still hit enter to follow the link
We only do this when we have ARIA support
*/
if(this._ARIACapable) {
this.on('keypress', function(ev){
var eCurrentPanel = YUD.getAncestorByClassName(YUE.getTarget(ev), this.CLASSES.PANEL);
var keyCode = YUE.getCharCode(ev);
if(keyCode === 13) {
this._onClick(eCurrentPanel.firstChild);
return false;
}
});
}
} | javascript | function() {
if(true === this.get('hoverActivated')) {
this.on('mouseover', this._onMouseOver, this, true);
this.on('mouseout', this._onMouseOut, this, true);
}
this.on('click', this._onClick, this, true);
this.on('keydown', this._onKeydown, this, true);
// set this._opening and this._closing before open/close operations begin
this.on('panelOpen', function(){this._opening = true;}, this, true);
this.on('panelClose', function(){this._closing = true;}, this, true);
// This makes sure that this._fixTabindexes is called after a change has
// fully completed
this.on('afterPanelClose', function(){
this._closing = false;
if(!this._closing && !this._opening) {
this._fixTabIndexes();
}
}, this, true);
this.on('afterPanelOpen', function(){
this._opening = false;
if(!this._closing && !this._opening) {
this._fixTabIndexes();
}
}, this, true);
/*
This is needed when the hrefs are removed from links
to be able to still hit enter to follow the link
We only do this when we have ARIA support
*/
if(this._ARIACapable) {
this.on('keypress', function(ev){
var eCurrentPanel = YUD.getAncestorByClassName(YUE.getTarget(ev), this.CLASSES.PANEL);
var keyCode = YUE.getCharCode(ev);
if(keyCode === 13) {
this._onClick(eCurrentPanel.firstChild);
return false;
}
});
}
} | [
"function",
"(",
")",
"{",
"if",
"(",
"true",
"===",
"this",
".",
"get",
"(",
"'hoverActivated'",
")",
")",
"{",
"this",
".",
"on",
"(",
"'mouseover'",
",",
"this",
".",
"_onMouseOver",
",",
"this",
",",
"true",
")",
";",
"this",
".",
"on",
"(",
"'mouseout'",
",",
"this",
".",
"_onMouseOut",
",",
"this",
",",
"true",
")",
";",
"}",
"this",
".",
"on",
"(",
"'click'",
",",
"this",
".",
"_onClick",
",",
"this",
",",
"true",
")",
";",
"this",
".",
"on",
"(",
"'keydown'",
",",
"this",
".",
"_onKeydown",
",",
"this",
",",
"true",
")",
";",
"// set this._opening and this._closing before open/close operations begin",
"this",
".",
"on",
"(",
"'panelOpen'",
",",
"function",
"(",
")",
"{",
"this",
".",
"_opening",
"=",
"true",
";",
"}",
",",
"this",
",",
"true",
")",
";",
"this",
".",
"on",
"(",
"'panelClose'",
",",
"function",
"(",
")",
"{",
"this",
".",
"_closing",
"=",
"true",
";",
"}",
",",
"this",
",",
"true",
")",
";",
"// This makes sure that this._fixTabindexes is called after a change has",
"// fully completed",
"this",
".",
"on",
"(",
"'afterPanelClose'",
",",
"function",
"(",
")",
"{",
"this",
".",
"_closing",
"=",
"false",
";",
"if",
"(",
"!",
"this",
".",
"_closing",
"&&",
"!",
"this",
".",
"_opening",
")",
"{",
"this",
".",
"_fixTabIndexes",
"(",
")",
";",
"}",
"}",
",",
"this",
",",
"true",
")",
";",
"this",
".",
"on",
"(",
"'afterPanelOpen'",
",",
"function",
"(",
")",
"{",
"this",
".",
"_opening",
"=",
"false",
";",
"if",
"(",
"!",
"this",
".",
"_closing",
"&&",
"!",
"this",
".",
"_opening",
")",
"{",
"this",
".",
"_fixTabIndexes",
"(",
")",
";",
"}",
"}",
",",
"this",
",",
"true",
")",
";",
"/*\n This is needed when the hrefs are removed from links\n to be able to still hit enter to follow the link\n We only do this when we have ARIA support\n */",
"if",
"(",
"this",
".",
"_ARIACapable",
")",
"{",
"this",
".",
"on",
"(",
"'keypress'",
",",
"function",
"(",
"ev",
")",
"{",
"var",
"eCurrentPanel",
"=",
"YUD",
".",
"getAncestorByClassName",
"(",
"YUE",
".",
"getTarget",
"(",
"ev",
")",
",",
"this",
".",
"CLASSES",
".",
"PANEL",
")",
";",
"var",
"keyCode",
"=",
"YUE",
".",
"getCharCode",
"(",
"ev",
")",
";",
"if",
"(",
"keyCode",
"===",
"13",
")",
"{",
"this",
".",
"_onClick",
"(",
"eCurrentPanel",
".",
"firstChild",
")",
";",
"return",
"false",
";",
"}",
"}",
")",
";",
"}",
"}"
]
| Attach all event listeners
@method initEvents
@public | [
"Attach",
"all",
"event",
"listeners"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/WireIt/plugins/editor/lib/accordionview/accordionview.js#L363-L410 |
|
42,230 | neyric/webhookit | public/javascripts/WireIt/plugins/editor/lib/accordionview/accordionview.js | function() {
YUD.batch(this._panels, function(e) {
var elContent = this.firstChild.nextSibling;
if(elContent) {
YUD.removeClass(e.firstChild, this.CLASSES.ACTIVE);
YUD.addClass(elContent, this.CLASSES.HIDDEN);
this._setARIA(elContent, 'aria-hidden', 'true');
}
}, this);
} | javascript | function() {
YUD.batch(this._panels, function(e) {
var elContent = this.firstChild.nextSibling;
if(elContent) {
YUD.removeClass(e.firstChild, this.CLASSES.ACTIVE);
YUD.addClass(elContent, this.CLASSES.HIDDEN);
this._setARIA(elContent, 'aria-hidden', 'true');
}
}, this);
} | [
"function",
"(",
")",
"{",
"YUD",
".",
"batch",
"(",
"this",
".",
"_panels",
",",
"function",
"(",
"e",
")",
"{",
"var",
"elContent",
"=",
"this",
".",
"firstChild",
".",
"nextSibling",
";",
"if",
"(",
"elContent",
")",
"{",
"YUD",
".",
"removeClass",
"(",
"e",
".",
"firstChild",
",",
"this",
".",
"CLASSES",
".",
"ACTIVE",
")",
";",
"YUD",
".",
"addClass",
"(",
"elContent",
",",
"this",
".",
"CLASSES",
".",
"HIDDEN",
")",
";",
"this",
".",
"_setARIA",
"(",
"elContent",
",",
"'aria-hidden'",
",",
"'true'",
")",
";",
"}",
"}",
",",
"this",
")",
";",
"}"
]
| Closes all panels
@method _collapseAccordion
@private | [
"Closes",
"all",
"panels"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/WireIt/plugins/editor/lib/accordionview/accordionview.js#L435-L444 |
|
42,231 | neyric/webhookit | public/javascripts/WireIt/plugins/editor/lib/accordionview/accordionview.js | function() {
var aLength = this._panels.length;
var bAllClosed = true;
for(var i=0;i<aLength;i++) {
if(YUD.hasClass(this._panels[i].firstChild, this.CLASSES.ACTIVE)) {
this._panels[i].firstChild.tabIndex = 0;
bAllClosed = false;
}
else {
this._panels[i].firstChild.tabIndex = -1;
}
}
if(bAllClosed) {
this._panels[0].firstChild.tabIndex = 0;
}
// now everything is done so we can fire the stateChanged event
this.fireEvent(stateChangedEvent);
} | javascript | function() {
var aLength = this._panels.length;
var bAllClosed = true;
for(var i=0;i<aLength;i++) {
if(YUD.hasClass(this._panels[i].firstChild, this.CLASSES.ACTIVE)) {
this._panels[i].firstChild.tabIndex = 0;
bAllClosed = false;
}
else {
this._panels[i].firstChild.tabIndex = -1;
}
}
if(bAllClosed) {
this._panels[0].firstChild.tabIndex = 0;
}
// now everything is done so we can fire the stateChanged event
this.fireEvent(stateChangedEvent);
} | [
"function",
"(",
")",
"{",
"var",
"aLength",
"=",
"this",
".",
"_panels",
".",
"length",
";",
"var",
"bAllClosed",
"=",
"true",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"aLength",
";",
"i",
"++",
")",
"{",
"if",
"(",
"YUD",
".",
"hasClass",
"(",
"this",
".",
"_panels",
"[",
"i",
"]",
".",
"firstChild",
",",
"this",
".",
"CLASSES",
".",
"ACTIVE",
")",
")",
"{",
"this",
".",
"_panels",
"[",
"i",
"]",
".",
"firstChild",
".",
"tabIndex",
"=",
"0",
";",
"bAllClosed",
"=",
"false",
";",
"}",
"else",
"{",
"this",
".",
"_panels",
"[",
"i",
"]",
".",
"firstChild",
".",
"tabIndex",
"=",
"-",
"1",
";",
"}",
"}",
"if",
"(",
"bAllClosed",
")",
"{",
"this",
".",
"_panels",
"[",
"0",
"]",
".",
"firstChild",
".",
"tabIndex",
"=",
"0",
";",
"}",
"// now everything is done so we can fire the stateChanged event",
"this",
".",
"fireEvent",
"(",
"stateChangedEvent",
")",
";",
"}"
]
| Set tabIndex to 0 on the first item in case all panels are closed
or active. Otherwise set it to -1
@method _fixTabIndexes
@private | [
"Set",
"tabIndex",
"to",
"0",
"on",
"the",
"first",
"item",
"in",
"case",
"all",
"panels",
"are",
"closed",
"or",
"active",
".",
"Otherwise",
"set",
"it",
"to",
"-",
"1"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/WireIt/plugins/editor/lib/accordionview/accordionview.js#L453-L470 |
|
42,232 | neyric/webhookit | public/javascripts/WireIt/plugins/editor/lib/accordionview/accordionview.js | function(index) {
this.removeChild(YUD.getElementsByClassName(this.CLASSES.PANEL, this.CONFIG.ITEM_WRAPPER_TAG_NAME, this)[index]);
var aNewPanels = [];
var nLength = this._panels.length;
for(var i=0;i<nLength;i++) {
if(i !== index) {
aNewPanels.push(this._panels[i]);
}
}
this._panels = aNewPanels;
var t= YAHOO.lang.later(0, this, function(){this._fixTabIndexes();this.fireEvent(stateChangedEvent);});
} | javascript | function(index) {
this.removeChild(YUD.getElementsByClassName(this.CLASSES.PANEL, this.CONFIG.ITEM_WRAPPER_TAG_NAME, this)[index]);
var aNewPanels = [];
var nLength = this._panels.length;
for(var i=0;i<nLength;i++) {
if(i !== index) {
aNewPanels.push(this._panels[i]);
}
}
this._panels = aNewPanels;
var t= YAHOO.lang.later(0, this, function(){this._fixTabIndexes();this.fireEvent(stateChangedEvent);});
} | [
"function",
"(",
"index",
")",
"{",
"this",
".",
"removeChild",
"(",
"YUD",
".",
"getElementsByClassName",
"(",
"this",
".",
"CLASSES",
".",
"PANEL",
",",
"this",
".",
"CONFIG",
".",
"ITEM_WRAPPER_TAG_NAME",
",",
"this",
")",
"[",
"index",
"]",
")",
";",
"var",
"aNewPanels",
"=",
"[",
"]",
";",
"var",
"nLength",
"=",
"this",
".",
"_panels",
".",
"length",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"nLength",
";",
"i",
"++",
")",
"{",
"if",
"(",
"i",
"!==",
"index",
")",
"{",
"aNewPanels",
".",
"push",
"(",
"this",
".",
"_panels",
"[",
"i",
"]",
")",
";",
"}",
"}",
"this",
".",
"_panels",
"=",
"aNewPanels",
";",
"var",
"t",
"=",
"YAHOO",
".",
"lang",
".",
"later",
"(",
"0",
",",
"this",
",",
"function",
"(",
")",
"{",
"this",
".",
"_fixTabIndexes",
"(",
")",
";",
"this",
".",
"fireEvent",
"(",
"stateChangedEvent",
")",
";",
"}",
")",
";",
"}"
]
| Removes the specified Panel from the AccordionView.
@method removePanel
@param {Integer} index of the panel to be removed | [
"Removes",
"the",
"specified",
"Panel",
"from",
"the",
"AccordionView",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/WireIt/plugins/editor/lib/accordionview/accordionview.js#L581-L592 |
|
42,233 | neyric/webhookit | public/javascripts/WireIt/plugins/editor/lib/accordionview/accordionview.js | function(nIndex) {
var ePanelNode = this._panels[nIndex];
if(!ePanelNode) {return false;} // invalid node
if(YUD.hasClass(ePanelNode.firstChild, this.CLASSES.ACTIVE)) {return false;} // already open
this._onClick(ePanelNode.firstChild);
return true;
} | javascript | function(nIndex) {
var ePanelNode = this._panels[nIndex];
if(!ePanelNode) {return false;} // invalid node
if(YUD.hasClass(ePanelNode.firstChild, this.CLASSES.ACTIVE)) {return false;} // already open
this._onClick(ePanelNode.firstChild);
return true;
} | [
"function",
"(",
"nIndex",
")",
"{",
"var",
"ePanelNode",
"=",
"this",
".",
"_panels",
"[",
"nIndex",
"]",
";",
"if",
"(",
"!",
"ePanelNode",
")",
"{",
"return",
"false",
";",
"}",
"// invalid node",
"if",
"(",
"YUD",
".",
"hasClass",
"(",
"ePanelNode",
".",
"firstChild",
",",
"this",
".",
"CLASSES",
".",
"ACTIVE",
")",
")",
"{",
"return",
"false",
";",
"}",
"// already open",
"this",
".",
"_onClick",
"(",
"ePanelNode",
".",
"firstChild",
")",
";",
"return",
"true",
";",
"}"
]
| Open a panel
@method openPanel
@param {Integer} nIndex The position of the Panel.
@return {Boolean} whether action resulted in opening a panel
that was previously closed | [
"Open",
"a",
"panel"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/WireIt/plugins/editor/lib/accordionview/accordionview.js#L623-L629 |
|
42,234 | neyric/webhookit | public/javascripts/WireIt/plugins/editor/lib/accordionview/accordionview.js | function(ev) {
var eCurrentPanel = YUD.getAncestorByClassName(YUE.getTarget(ev), this.CLASSES.PANEL);
var nKeyCode = YUE.getCharCode(ev);
var nLength = this._panels.length;
if(nKeyCode === 37 || nKeyCode === 38) {
for(var i=0;i<nLength;i++) {
if((eCurrentPanel === this._panels[i]) && i>0) {
this._panels[i-1].firstChild.focus();
return;
}
}
}
if(nKeyCode === 39 || nKeyCode === 40) {
for(var i=0;i<nLength;i++) {
if((eCurrentPanel === this._panels[i]) && i<nLength-1) {
this._panels[i+1].firstChild.focus();
return;
}
}
}
} | javascript | function(ev) {
var eCurrentPanel = YUD.getAncestorByClassName(YUE.getTarget(ev), this.CLASSES.PANEL);
var nKeyCode = YUE.getCharCode(ev);
var nLength = this._panels.length;
if(nKeyCode === 37 || nKeyCode === 38) {
for(var i=0;i<nLength;i++) {
if((eCurrentPanel === this._panels[i]) && i>0) {
this._panels[i-1].firstChild.focus();
return;
}
}
}
if(nKeyCode === 39 || nKeyCode === 40) {
for(var i=0;i<nLength;i++) {
if((eCurrentPanel === this._panels[i]) && i<nLength-1) {
this._panels[i+1].firstChild.focus();
return;
}
}
}
} | [
"function",
"(",
"ev",
")",
"{",
"var",
"eCurrentPanel",
"=",
"YUD",
".",
"getAncestorByClassName",
"(",
"YUE",
".",
"getTarget",
"(",
"ev",
")",
",",
"this",
".",
"CLASSES",
".",
"PANEL",
")",
";",
"var",
"nKeyCode",
"=",
"YUE",
".",
"getCharCode",
"(",
"ev",
")",
";",
"var",
"nLength",
"=",
"this",
".",
"_panels",
".",
"length",
";",
"if",
"(",
"nKeyCode",
"===",
"37",
"||",
"nKeyCode",
"===",
"38",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"nLength",
";",
"i",
"++",
")",
"{",
"if",
"(",
"(",
"eCurrentPanel",
"===",
"this",
".",
"_panels",
"[",
"i",
"]",
")",
"&&",
"i",
">",
"0",
")",
"{",
"this",
".",
"_panels",
"[",
"i",
"-",
"1",
"]",
".",
"firstChild",
".",
"focus",
"(",
")",
";",
"return",
";",
"}",
"}",
"}",
"if",
"(",
"nKeyCode",
"===",
"39",
"||",
"nKeyCode",
"===",
"40",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"nLength",
";",
"i",
"++",
")",
"{",
"if",
"(",
"(",
"eCurrentPanel",
"===",
"this",
".",
"_panels",
"[",
"i",
"]",
")",
"&&",
"i",
"<",
"nLength",
"-",
"1",
")",
"{",
"this",
".",
"_panels",
"[",
"i",
"+",
"1",
"]",
".",
"firstChild",
".",
"focus",
"(",
")",
";",
"return",
";",
"}",
"}",
"}",
"}"
]
| Keyboard event handler for keyboard control of the widget
@method _onKeydown
@param {Event} ev The Dom event
@private | [
"Keyboard",
"event",
"handler",
"for",
"keyboard",
"control",
"of",
"the",
"widget"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/WireIt/plugins/editor/lib/accordionview/accordionview.js#L674-L694 |
|
42,235 | neyric/webhookit | public/javascripts/WireIt/plugins/editor/lib/accordionview/accordionview.js | function(ev) {
YUE.stopPropagation(ev);
// must provide the TARGET or IE will destroy the event before we can
// use it. Thanks Nicholas Zakas for pointing this out to me
var target = YUE.getTarget(ev);
this._hoverTimer = YAHOO.lang.later(this.get('_hoverTimeout'), this, function(){
this._onClick(target);
});
} | javascript | function(ev) {
YUE.stopPropagation(ev);
// must provide the TARGET or IE will destroy the event before we can
// use it. Thanks Nicholas Zakas for pointing this out to me
var target = YUE.getTarget(ev);
this._hoverTimer = YAHOO.lang.later(this.get('_hoverTimeout'), this, function(){
this._onClick(target);
});
} | [
"function",
"(",
"ev",
")",
"{",
"YUE",
".",
"stopPropagation",
"(",
"ev",
")",
";",
"// must provide the TARGET or IE will destroy the event before we can",
"// use it. Thanks Nicholas Zakas for pointing this out to me",
"var",
"target",
"=",
"YUE",
".",
"getTarget",
"(",
"ev",
")",
";",
"this",
".",
"_hoverTimer",
"=",
"YAHOO",
".",
"lang",
".",
"later",
"(",
"this",
".",
"get",
"(",
"'_hoverTimeout'",
")",
",",
"this",
",",
"function",
"(",
")",
"{",
"this",
".",
"_onClick",
"(",
"target",
")",
";",
"}",
")",
";",
"}"
]
| Mouseover event handler
@method _onMouseOver
@param {Event} ev The Dom event
@private | [
"Mouseover",
"event",
"handler"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/WireIt/plugins/editor/lib/accordionview/accordionview.js#L703-L711 |
|
42,236 | neyric/webhookit | public/javascripts/yui/dom/dom-debug.js | function(el) {
var id, nodes, c, i, len, attr;
if (el) {
if (el[NODE_TYPE] || el.item) { // Node, or NodeList
return el;
}
if (typeof el === 'string') { // id
id = el;
el = document.getElementById(el);
attr = (el) ? el.attributes : null;
if (el && attr && attr.id && attr.id.value === id) { // IE: avoid false match on "name" attribute
return el;
} else if (el && document.all) { // filter by name
el = null;
nodes = document.all[id];
for (i = 0, len = nodes.length; i < len; ++i) {
if (nodes[i].id === id) {
return nodes[i];
}
}
}
return el;
}
if (YAHOO.util.Element && el instanceof YAHOO.util.Element) {
el = el.get('element');
}
if ('length' in el) { // array-like
c = [];
for (i = 0, len = el.length; i < len; ++i) {
c[c.length] = Y.Dom.get(el[i]);
}
return c;
}
return el; // some other object, just pass it back
}
return null;
} | javascript | function(el) {
var id, nodes, c, i, len, attr;
if (el) {
if (el[NODE_TYPE] || el.item) { // Node, or NodeList
return el;
}
if (typeof el === 'string') { // id
id = el;
el = document.getElementById(el);
attr = (el) ? el.attributes : null;
if (el && attr && attr.id && attr.id.value === id) { // IE: avoid false match on "name" attribute
return el;
} else if (el && document.all) { // filter by name
el = null;
nodes = document.all[id];
for (i = 0, len = nodes.length; i < len; ++i) {
if (nodes[i].id === id) {
return nodes[i];
}
}
}
return el;
}
if (YAHOO.util.Element && el instanceof YAHOO.util.Element) {
el = el.get('element');
}
if ('length' in el) { // array-like
c = [];
for (i = 0, len = el.length; i < len; ++i) {
c[c.length] = Y.Dom.get(el[i]);
}
return c;
}
return el; // some other object, just pass it back
}
return null;
} | [
"function",
"(",
"el",
")",
"{",
"var",
"id",
",",
"nodes",
",",
"c",
",",
"i",
",",
"len",
",",
"attr",
";",
"if",
"(",
"el",
")",
"{",
"if",
"(",
"el",
"[",
"NODE_TYPE",
"]",
"||",
"el",
".",
"item",
")",
"{",
"// Node, or NodeList",
"return",
"el",
";",
"}",
"if",
"(",
"typeof",
"el",
"===",
"'string'",
")",
"{",
"// id",
"id",
"=",
"el",
";",
"el",
"=",
"document",
".",
"getElementById",
"(",
"el",
")",
";",
"attr",
"=",
"(",
"el",
")",
"?",
"el",
".",
"attributes",
":",
"null",
";",
"if",
"(",
"el",
"&&",
"attr",
"&&",
"attr",
".",
"id",
"&&",
"attr",
".",
"id",
".",
"value",
"===",
"id",
")",
"{",
"// IE: avoid false match on \"name\" attribute",
"return",
"el",
";",
"}",
"else",
"if",
"(",
"el",
"&&",
"document",
".",
"all",
")",
"{",
"// filter by name",
"el",
"=",
"null",
";",
"nodes",
"=",
"document",
".",
"all",
"[",
"id",
"]",
";",
"for",
"(",
"i",
"=",
"0",
",",
"len",
"=",
"nodes",
".",
"length",
";",
"i",
"<",
"len",
";",
"++",
"i",
")",
"{",
"if",
"(",
"nodes",
"[",
"i",
"]",
".",
"id",
"===",
"id",
")",
"{",
"return",
"nodes",
"[",
"i",
"]",
";",
"}",
"}",
"}",
"return",
"el",
";",
"}",
"if",
"(",
"YAHOO",
".",
"util",
".",
"Element",
"&&",
"el",
"instanceof",
"YAHOO",
".",
"util",
".",
"Element",
")",
"{",
"el",
"=",
"el",
".",
"get",
"(",
"'element'",
")",
";",
"}",
"if",
"(",
"'length'",
"in",
"el",
")",
"{",
"// array-like ",
"c",
"=",
"[",
"]",
";",
"for",
"(",
"i",
"=",
"0",
",",
"len",
"=",
"el",
".",
"length",
";",
"i",
"<",
"len",
";",
"++",
"i",
")",
"{",
"c",
"[",
"c",
".",
"length",
"]",
"=",
"Y",
".",
"Dom",
".",
"get",
"(",
"el",
"[",
"i",
"]",
")",
";",
"}",
"return",
"c",
";",
"}",
"return",
"el",
";",
"// some other object, just pass it back",
"}",
"return",
"null",
";",
"}"
]
| Returns an HTMLElement reference.
@method get
@param {String | HTMLElement |Array} el Accepts a string to use as an ID for getting a DOM reference, an actual DOM reference, or an Array of IDs and/or HTMLElements.
@return {HTMLElement | Array} A DOM reference to an HTML element or an array of HTMLElements. | [
"Returns",
"an",
"HTMLElement",
"reference",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/dom/dom-debug.js#L94-L137 |
|
42,237 | neyric/webhookit | public/javascripts/yui/dom/dom-debug.js | function(el, property) {
return Y.Dom.batch(el, Y.Dom._getStyle, property);
} | javascript | function(el, property) {
return Y.Dom.batch(el, Y.Dom._getStyle, property);
} | [
"function",
"(",
"el",
",",
"property",
")",
"{",
"return",
"Y",
".",
"Dom",
".",
"batch",
"(",
"el",
",",
"Y",
".",
"Dom",
".",
"_getStyle",
",",
"property",
")",
";",
"}"
]
| Normalizes currentStyle and ComputedStyle.
@method getStyle
@param {String | HTMLElement |Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.
@param {String} property The style property whose value is returned.
@return {String | Array} The current value of the style property for the element(s). | [
"Normalizes",
"currentStyle",
"and",
"ComputedStyle",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/dom/dom-debug.js#L154-L156 |
|
42,238 | neyric/webhookit | public/javascripts/yui/dom/dom-debug.js | function(el, property, val) {
Y.Dom.batch(el, Y.Dom._setStyle, { prop: property, val: val });
} | javascript | function(el, property, val) {
Y.Dom.batch(el, Y.Dom._setStyle, { prop: property, val: val });
} | [
"function",
"(",
"el",
",",
"property",
",",
"val",
")",
"{",
"Y",
".",
"Dom",
".",
"batch",
"(",
"el",
",",
"Y",
".",
"Dom",
".",
"_setStyle",
",",
"{",
"prop",
":",
"property",
",",
"val",
":",
"val",
"}",
")",
";",
"}"
]
| Wrapper for setting style properties of HTMLElements. Normalizes "opacity" across modern browsers.
@method setStyle
@param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.
@param {String} property The style property to be set.
@param {String} val The value to apply to the given property. | [
"Wrapper",
"for",
"setting",
"style",
"properties",
"of",
"HTMLElements",
".",
"Normalizes",
"opacity",
"across",
"modern",
"browsers",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/dom/dom-debug.js#L214-L216 |
|
42,239 | neyric/webhookit | public/javascripts/yui/dom/dom-debug.js | function(el, className) {
return Y.Dom.batch(el, Y.Dom._hasClass, className);
} | javascript | function(el, className) {
return Y.Dom.batch(el, Y.Dom._hasClass, className);
} | [
"function",
"(",
"el",
",",
"className",
")",
"{",
"return",
"Y",
".",
"Dom",
".",
"batch",
"(",
"el",
",",
"Y",
".",
"Dom",
".",
"_hasClass",
",",
"className",
")",
";",
"}"
]
| Determines whether an HTMLElement has the given className.
@method hasClass
@param {String | HTMLElement | Array} el The element or collection to test
@param {String} className the class name to search for
@return {Boolean | Array} A boolean value or array of boolean values | [
"Determines",
"whether",
"an",
"HTMLElement",
"has",
"the",
"given",
"className",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/dom/dom-debug.js#L608-L610 |
|
42,240 | neyric/webhookit | public/javascripts/yui/dom/dom-debug.js | function(el, className) {
return Y.Dom.batch(el, Y.Dom._addClass, className);
} | javascript | function(el, className) {
return Y.Dom.batch(el, Y.Dom._addClass, className);
} | [
"function",
"(",
"el",
",",
"className",
")",
"{",
"return",
"Y",
".",
"Dom",
".",
"batch",
"(",
"el",
",",
"Y",
".",
"Dom",
".",
"_addClass",
",",
"className",
")",
";",
"}"
]
| Adds a class name to a given element or collection of elements.
@method addClass
@param {String | HTMLElement | Array} el The element or collection to add the class to
@param {String} className the class name to add to the class attribute
@return {Boolean | Array} A pass/fail boolean or array of booleans | [
"Adds",
"a",
"class",
"name",
"to",
"a",
"given",
"element",
"or",
"collection",
"of",
"elements",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/dom/dom-debug.js#L638-L640 |
|
42,241 | neyric/webhookit | public/javascripts/yui/dom/dom-debug.js | function(el, className) {
return Y.Dom.batch(el, Y.Dom._removeClass, className);
} | javascript | function(el, className) {
return Y.Dom.batch(el, Y.Dom._removeClass, className);
} | [
"function",
"(",
"el",
",",
"className",
")",
"{",
"return",
"Y",
".",
"Dom",
".",
"batch",
"(",
"el",
",",
"Y",
".",
"Dom",
".",
"_removeClass",
",",
"className",
")",
";",
"}"
]
| Removes a class name from a given element or collection of elements.
@method removeClass
@param {String | HTMLElement | Array} el The element or collection to remove the class from
@param {String} className the class name to remove from the class attribute
@return {Boolean | Array} A pass/fail boolean or array of booleans | [
"Removes",
"a",
"class",
"name",
"from",
"a",
"given",
"element",
"or",
"collection",
"of",
"elements",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/dom/dom-debug.js#L666-L668 |
|
42,242 | neyric/webhookit | public/javascripts/yui/dom/dom-debug.js | function(el, oldClassName, newClassName) {
return Y.Dom.batch(el, Y.Dom._replaceClass, { from: oldClassName, to: newClassName });
} | javascript | function(el, oldClassName, newClassName) {
return Y.Dom.batch(el, Y.Dom._replaceClass, { from: oldClassName, to: newClassName });
} | [
"function",
"(",
"el",
",",
"oldClassName",
",",
"newClassName",
")",
"{",
"return",
"Y",
".",
"Dom",
".",
"batch",
"(",
"el",
",",
"Y",
".",
"Dom",
".",
"_replaceClass",
",",
"{",
"from",
":",
"oldClassName",
",",
"to",
":",
"newClassName",
"}",
")",
";",
"}"
]
| Replace a class with another class for a given element or collection of elements.
If no oldClassName is present, the newClassName is simply added.
@method replaceClass
@param {String | HTMLElement | Array} el The element or collection to remove the class from
@param {String} oldClassName the class name to be replaced
@param {String} newClassName the class name that will be replacing the old class name
@return {Boolean | Array} A pass/fail boolean or array of booleans | [
"Replace",
"a",
"class",
"with",
"another",
"class",
"for",
"a",
"given",
"element",
"or",
"collection",
"of",
"elements",
".",
"If",
"no",
"oldClassName",
"is",
"present",
"the",
"newClassName",
"is",
"simply",
"added",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/dom/dom-debug.js#L708-L710 |
|
42,243 | neyric/webhookit | public/javascripts/yui/dom/dom-debug.js | function(el, prefix) {
prefix = prefix || 'yui-gen';
var f = function(el) {
if (el && el.id) { // do not override existing ID
YAHOO.log('generateId returning existing id ' + el.id, 'info', 'Dom');
return el.id;
}
var id = prefix + YAHOO.env._id_counter++;
YAHOO.log('generateId generating ' + id, 'info', 'Dom');
if (el) {
if (el[OWNER_DOCUMENT] && el[OWNER_DOCUMENT].getElementById(id)) { // in case one already exists
// use failed id plus prefix to help ensure uniqueness
return Y.Dom.generateId(el, id + prefix);
}
el.id = id;
}
return id;
};
// batch fails when no element, so just generate and return single ID
return Y.Dom.batch(el, f, Y.Dom, true) || f.apply(Y.Dom, arguments);
} | javascript | function(el, prefix) {
prefix = prefix || 'yui-gen';
var f = function(el) {
if (el && el.id) { // do not override existing ID
YAHOO.log('generateId returning existing id ' + el.id, 'info', 'Dom');
return el.id;
}
var id = prefix + YAHOO.env._id_counter++;
YAHOO.log('generateId generating ' + id, 'info', 'Dom');
if (el) {
if (el[OWNER_DOCUMENT] && el[OWNER_DOCUMENT].getElementById(id)) { // in case one already exists
// use failed id plus prefix to help ensure uniqueness
return Y.Dom.generateId(el, id + prefix);
}
el.id = id;
}
return id;
};
// batch fails when no element, so just generate and return single ID
return Y.Dom.batch(el, f, Y.Dom, true) || f.apply(Y.Dom, arguments);
} | [
"function",
"(",
"el",
",",
"prefix",
")",
"{",
"prefix",
"=",
"prefix",
"||",
"'yui-gen'",
";",
"var",
"f",
"=",
"function",
"(",
"el",
")",
"{",
"if",
"(",
"el",
"&&",
"el",
".",
"id",
")",
"{",
"// do not override existing ID",
"YAHOO",
".",
"log",
"(",
"'generateId returning existing id '",
"+",
"el",
".",
"id",
",",
"'info'",
",",
"'Dom'",
")",
";",
"return",
"el",
".",
"id",
";",
"}",
"var",
"id",
"=",
"prefix",
"+",
"YAHOO",
".",
"env",
".",
"_id_counter",
"++",
";",
"YAHOO",
".",
"log",
"(",
"'generateId generating '",
"+",
"id",
",",
"'info'",
",",
"'Dom'",
")",
";",
"if",
"(",
"el",
")",
"{",
"if",
"(",
"el",
"[",
"OWNER_DOCUMENT",
"]",
"&&",
"el",
"[",
"OWNER_DOCUMENT",
"]",
".",
"getElementById",
"(",
"id",
")",
")",
"{",
"// in case one already exists",
"// use failed id plus prefix to help ensure uniqueness",
"return",
"Y",
".",
"Dom",
".",
"generateId",
"(",
"el",
",",
"id",
"+",
"prefix",
")",
";",
"}",
"el",
".",
"id",
"=",
"id",
";",
"}",
"return",
"id",
";",
"}",
";",
"// batch fails when no element, so just generate and return single ID",
"return",
"Y",
".",
"Dom",
".",
"batch",
"(",
"el",
",",
"f",
",",
"Y",
".",
"Dom",
",",
"true",
")",
"||",
"f",
".",
"apply",
"(",
"Y",
".",
"Dom",
",",
"arguments",
")",
";",
"}"
]
| Returns an ID and applies it to the element "el", if provided.
@method generateId
@param {String | HTMLElement | Array} el (optional) An optional element array of elements to add an ID to (no ID is added if one is already present).
@param {String} prefix (optional) an optional prefix to use (defaults to "yui-gen").
@return {String | Array} The generated ID, or array of generated IDs (or original ID if already present on an element) | [
"Returns",
"an",
"ID",
"and",
"applies",
"it",
"to",
"the",
"element",
"el",
"if",
"provided",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/dom/dom-debug.js#L752-L777 |
|
42,244 | neyric/webhookit | public/javascripts/yui/dom/dom-debug.js | function(haystack, needle) {
haystack = Y.Dom.get(haystack);
needle = Y.Dom.get(needle);
var ret = false;
if ( (haystack && needle) && (haystack[NODE_TYPE] && needle[NODE_TYPE]) ) {
if (haystack.contains && haystack !== needle) { // contains returns true when equal
ret = haystack.contains(needle);
}
else if (haystack.compareDocumentPosition) { // gecko
ret = !!(haystack.compareDocumentPosition(needle) & 16);
}
} else {
YAHOO.log('isAncestor failed; invalid input: ' + haystack + ',' + needle, 'error', 'Dom');
}
YAHOO.log('isAncestor(' + haystack + ',' + needle + ' returning ' + ret, 'info', 'Dom');
return ret;
} | javascript | function(haystack, needle) {
haystack = Y.Dom.get(haystack);
needle = Y.Dom.get(needle);
var ret = false;
if ( (haystack && needle) && (haystack[NODE_TYPE] && needle[NODE_TYPE]) ) {
if (haystack.contains && haystack !== needle) { // contains returns true when equal
ret = haystack.contains(needle);
}
else if (haystack.compareDocumentPosition) { // gecko
ret = !!(haystack.compareDocumentPosition(needle) & 16);
}
} else {
YAHOO.log('isAncestor failed; invalid input: ' + haystack + ',' + needle, 'error', 'Dom');
}
YAHOO.log('isAncestor(' + haystack + ',' + needle + ' returning ' + ret, 'info', 'Dom');
return ret;
} | [
"function",
"(",
"haystack",
",",
"needle",
")",
"{",
"haystack",
"=",
"Y",
".",
"Dom",
".",
"get",
"(",
"haystack",
")",
";",
"needle",
"=",
"Y",
".",
"Dom",
".",
"get",
"(",
"needle",
")",
";",
"var",
"ret",
"=",
"false",
";",
"if",
"(",
"(",
"haystack",
"&&",
"needle",
")",
"&&",
"(",
"haystack",
"[",
"NODE_TYPE",
"]",
"&&",
"needle",
"[",
"NODE_TYPE",
"]",
")",
")",
"{",
"if",
"(",
"haystack",
".",
"contains",
"&&",
"haystack",
"!==",
"needle",
")",
"{",
"// contains returns true when equal",
"ret",
"=",
"haystack",
".",
"contains",
"(",
"needle",
")",
";",
"}",
"else",
"if",
"(",
"haystack",
".",
"compareDocumentPosition",
")",
"{",
"// gecko",
"ret",
"=",
"!",
"!",
"(",
"haystack",
".",
"compareDocumentPosition",
"(",
"needle",
")",
"&",
"16",
")",
";",
"}",
"}",
"else",
"{",
"YAHOO",
".",
"log",
"(",
"'isAncestor failed; invalid input: '",
"+",
"haystack",
"+",
"','",
"+",
"needle",
",",
"'error'",
",",
"'Dom'",
")",
";",
"}",
"YAHOO",
".",
"log",
"(",
"'isAncestor('",
"+",
"haystack",
"+",
"','",
"+",
"needle",
"+",
"' returning '",
"+",
"ret",
",",
"'info'",
",",
"'Dom'",
")",
";",
"return",
"ret",
";",
"}"
]
| Determines whether an HTMLElement is an ancestor of another HTML element in the DOM hierarchy.
@method isAncestor
@param {String | HTMLElement} haystack The possible ancestor
@param {String | HTMLElement} needle The possible descendent
@return {Boolean} Whether or not the haystack is an ancestor of needle | [
"Determines",
"whether",
"an",
"HTMLElement",
"is",
"an",
"ancestor",
"of",
"another",
"HTML",
"element",
"in",
"the",
"DOM",
"hierarchy",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/dom/dom-debug.js#L786-L804 |
|
42,245 | neyric/webhookit | public/javascripts/yui/dom/dom-debug.js | function(el, doc) {
return Y.Dom._inDoc(Y.Dom.get(el), doc);
} | javascript | function(el, doc) {
return Y.Dom._inDoc(Y.Dom.get(el), doc);
} | [
"function",
"(",
"el",
",",
"doc",
")",
"{",
"return",
"Y",
".",
"Dom",
".",
"_inDoc",
"(",
"Y",
".",
"Dom",
".",
"get",
"(",
"el",
")",
",",
"doc",
")",
";",
"}"
]
| Determines whether an HTMLElement is present in the current document.
@method inDocument
@param {String | HTMLElement} el The element to search for
@param {Object} doc An optional document to search, defaults to element's owner document
@return {Boolean} Whether or not the element is present in the current document | [
"Determines",
"whether",
"an",
"HTMLElement",
"is",
"present",
"in",
"the",
"current",
"document",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/dom/dom-debug.js#L813-L815 |
|
42,246 | neyric/webhookit | public/javascripts/yui/dom/dom-debug.js | function(method, tag, root) {
return Y.Dom.getElementsBy(method, tag, root, null, null, null, true);
} | javascript | function(method, tag, root) {
return Y.Dom.getElementsBy(method, tag, root, null, null, null, true);
} | [
"function",
"(",
"method",
",",
"tag",
",",
"root",
")",
"{",
"return",
"Y",
".",
"Dom",
".",
"getElementsBy",
"(",
"method",
",",
"tag",
",",
"root",
",",
"null",
",",
"null",
",",
"null",
",",
"true",
")",
";",
"}"
]
| Returns the first HTMLElement that passes the test applied by the supplied boolean method.
@method getElementBy
@param {Function} method - A boolean method for testing elements which receives the element as its only argument.
@param {String} tag (optional) The tag name of the elements being collected
@param {String | HTMLElement} root (optional) The HTMLElement or an ID to use as the starting point
@return {HTMLElement} | [
"Returns",
"the",
"first",
"HTMLElement",
"that",
"passes",
"the",
"test",
"applied",
"by",
"the",
"supplied",
"boolean",
"method",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/dom/dom-debug.js#L883-L885 |
|
42,247 | neyric/webhookit | public/javascripts/yui/dom/dom-debug.js | function() {
var height = self.innerHeight, // Safari, Opera
mode = document[COMPAT_MODE];
if ( (mode || isIE) && !isOpera ) { // IE, Gecko
height = (mode == CSS1_COMPAT) ?
documentElement.clientHeight : // Standards
document.body.clientHeight; // Quirks
}
YAHOO.log('getViewportHeight returning ' + height, 'info', 'Dom');
return height;
} | javascript | function() {
var height = self.innerHeight, // Safari, Opera
mode = document[COMPAT_MODE];
if ( (mode || isIE) && !isOpera ) { // IE, Gecko
height = (mode == CSS1_COMPAT) ?
documentElement.clientHeight : // Standards
document.body.clientHeight; // Quirks
}
YAHOO.log('getViewportHeight returning ' + height, 'info', 'Dom');
return height;
} | [
"function",
"(",
")",
"{",
"var",
"height",
"=",
"self",
".",
"innerHeight",
",",
"// Safari, Opera",
"mode",
"=",
"document",
"[",
"COMPAT_MODE",
"]",
";",
"if",
"(",
"(",
"mode",
"||",
"isIE",
")",
"&&",
"!",
"isOpera",
")",
"{",
"// IE, Gecko",
"height",
"=",
"(",
"mode",
"==",
"CSS1_COMPAT",
")",
"?",
"documentElement",
".",
"clientHeight",
":",
"// Standards",
"document",
".",
"body",
".",
"clientHeight",
";",
"// Quirks",
"}",
"YAHOO",
".",
"log",
"(",
"'getViewportHeight returning '",
"+",
"height",
",",
"'info'",
",",
"'Dom'",
")",
";",
"return",
"height",
";",
"}"
]
| Returns the current height of the viewport.
@method getViewportHeight
@return {Int} The height of the viewable area of the page (excludes scrollbars). | [
"Returns",
"the",
"current",
"height",
"of",
"the",
"viewport",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/dom/dom-debug.js#L947-L959 |
|
42,248 | neyric/webhookit | public/javascripts/yui/dom/dom-debug.js | function(node, method) {
while (node) {
node = node.previousSibling;
if ( Y.Dom._testElement(node, method) ) {
return node;
}
}
return null;
} | javascript | function(node, method) {
while (node) {
node = node.previousSibling;
if ( Y.Dom._testElement(node, method) ) {
return node;
}
}
return null;
} | [
"function",
"(",
"node",
",",
"method",
")",
"{",
"while",
"(",
"node",
")",
"{",
"node",
"=",
"node",
".",
"previousSibling",
";",
"if",
"(",
"Y",
".",
"Dom",
".",
"_testElement",
"(",
"node",
",",
"method",
")",
")",
"{",
"return",
"node",
";",
"}",
"}",
"return",
"null",
";",
"}"
]
| Returns the previous sibling that is an HTMLElement.
For performance reasons, IDs are not accepted and argument validation omitted.
Returns the nearest HTMLElement sibling if no method provided.
@method getPreviousSiblingBy
@param {HTMLElement} node The HTMLElement to use as the starting point
@param {Function} method A boolean function used to test siblings
that receives the sibling node being tested as its only argument
@return {Object} HTMLElement or null if not found | [
"Returns",
"the",
"previous",
"sibling",
"that",
"is",
"an",
"HTMLElement",
".",
"For",
"performance",
"reasons",
"IDs",
"are",
"not",
"accepted",
"and",
"argument",
"validation",
"omitted",
".",
"Returns",
"the",
"nearest",
"HTMLElement",
"sibling",
"if",
"no",
"method",
"provided",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/dom/dom-debug.js#L1047-L1055 |
|
42,249 | neyric/webhookit | public/javascripts/yui/dom/dom-debug.js | function(node, method) {
while (node) {
node = node.nextSibling;
if ( Y.Dom._testElement(node, method) ) {
return node;
}
}
return null;
} | javascript | function(node, method) {
while (node) {
node = node.nextSibling;
if ( Y.Dom._testElement(node, method) ) {
return node;
}
}
return null;
} | [
"function",
"(",
"node",
",",
"method",
")",
"{",
"while",
"(",
"node",
")",
"{",
"node",
"=",
"node",
".",
"nextSibling",
";",
"if",
"(",
"Y",
".",
"Dom",
".",
"_testElement",
"(",
"node",
",",
"method",
")",
")",
"{",
"return",
"node",
";",
"}",
"}",
"return",
"null",
";",
"}"
]
| Returns the next HTMLElement sibling that passes the boolean method.
For performance reasons, IDs are not accepted and argument validation omitted.
Returns the nearest HTMLElement sibling if no method provided.
@method getNextSiblingBy
@param {HTMLElement} node The HTMLElement to use as the starting point
@param {Function} method A boolean function used to test siblings
that receives the sibling node being tested as its only argument
@return {Object} HTMLElement or null if not found | [
"Returns",
"the",
"next",
"HTMLElement",
"sibling",
"that",
"passes",
"the",
"boolean",
"method",
".",
"For",
"performance",
"reasons",
"IDs",
"are",
"not",
"accepted",
"and",
"argument",
"validation",
"omitted",
".",
"Returns",
"the",
"nearest",
"HTMLElement",
"sibling",
"if",
"no",
"method",
"provided",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/dom/dom-debug.js#L1083-L1091 |
|
42,250 | neyric/webhookit | public/javascripts/yui/dom/dom-debug.js | function(node, method) {
var child = ( Y.Dom._testElement(node.firstChild, method) ) ? node.firstChild : null;
return child || Y.Dom.getNextSiblingBy(node.firstChild, method);
} | javascript | function(node, method) {
var child = ( Y.Dom._testElement(node.firstChild, method) ) ? node.firstChild : null;
return child || Y.Dom.getNextSiblingBy(node.firstChild, method);
} | [
"function",
"(",
"node",
",",
"method",
")",
"{",
"var",
"child",
"=",
"(",
"Y",
".",
"Dom",
".",
"_testElement",
"(",
"node",
".",
"firstChild",
",",
"method",
")",
")",
"?",
"node",
".",
"firstChild",
":",
"null",
";",
"return",
"child",
"||",
"Y",
".",
"Dom",
".",
"getNextSiblingBy",
"(",
"node",
".",
"firstChild",
",",
"method",
")",
";",
"}"
]
| Returns the first HTMLElement child that passes the test method.
@method getFirstChildBy
@param {HTMLElement} node The HTMLElement to use as the starting point
@param {Function} method A boolean function used to test children
that receives the node being tested as its only argument
@return {Object} HTMLElement or null if not found | [
"Returns",
"the",
"first",
"HTMLElement",
"child",
"that",
"passes",
"the",
"test",
"method",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/dom/dom-debug.js#L1117-L1120 |
|
42,251 | neyric/webhookit | public/javascripts/yui/dom/dom-debug.js | function(node, method) {
if (!node) {
YAHOO.log('getLastChild failed: invalid node argument', 'error', 'Dom');
return null;
}
var child = ( Y.Dom._testElement(node.lastChild, method) ) ? node.lastChild : null;
return child || Y.Dom.getPreviousSiblingBy(node.lastChild, method);
} | javascript | function(node, method) {
if (!node) {
YAHOO.log('getLastChild failed: invalid node argument', 'error', 'Dom');
return null;
}
var child = ( Y.Dom._testElement(node.lastChild, method) ) ? node.lastChild : null;
return child || Y.Dom.getPreviousSiblingBy(node.lastChild, method);
} | [
"function",
"(",
"node",
",",
"method",
")",
"{",
"if",
"(",
"!",
"node",
")",
"{",
"YAHOO",
".",
"log",
"(",
"'getLastChild failed: invalid node argument'",
",",
"'error'",
",",
"'Dom'",
")",
";",
"return",
"null",
";",
"}",
"var",
"child",
"=",
"(",
"Y",
".",
"Dom",
".",
"_testElement",
"(",
"node",
".",
"lastChild",
",",
"method",
")",
")",
"?",
"node",
".",
"lastChild",
":",
"null",
";",
"return",
"child",
"||",
"Y",
".",
"Dom",
".",
"getPreviousSiblingBy",
"(",
"node",
".",
"lastChild",
",",
"method",
")",
";",
"}"
]
| Returns the last HTMLElement child that passes the test method.
@method getLastChildBy
@param {HTMLElement} node The HTMLElement to use as the starting point
@param {Function} method A boolean function used to test children
that receives the node being tested as its only argument
@return {Object} HTMLElement or null if not found | [
"Returns",
"the",
"last",
"HTMLElement",
"child",
"that",
"passes",
"the",
"test",
"method",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/dom/dom-debug.js#L1145-L1152 |
|
42,252 | neyric/webhookit | public/javascripts/yui/dom/dom-debug.js | function(node) {
node = Y.Dom.get(node);
return Y.Dom.getLastChildBy(node);
} | javascript | function(node) {
node = Y.Dom.get(node);
return Y.Dom.getLastChildBy(node);
} | [
"function",
"(",
"node",
")",
"{",
"node",
"=",
"Y",
".",
"Dom",
".",
"get",
"(",
"node",
")",
";",
"return",
"Y",
".",
"Dom",
".",
"getLastChildBy",
"(",
"node",
")",
";",
"}"
]
| Returns the last HTMLElement child.
@method getLastChild
@param {String | HTMLElement} node The HTMLElement or an ID to use as the starting point
@return {Object} HTMLElement or null if not found | [
"Returns",
"the",
"last",
"HTMLElement",
"child",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/dom/dom-debug.js#L1160-L1163 |
|
42,253 | neyric/webhookit | public/javascripts/yui/dom/dom-debug.js | function(node, method) {
var child = Y.Dom.getFirstChildBy(node, method),
children = child ? [child] : [];
Y.Dom.getNextSiblingBy(child, function(node) {
if ( !method || method(node) ) {
children[children.length] = node;
}
return false; // fail test to collect all children
});
return children;
} | javascript | function(node, method) {
var child = Y.Dom.getFirstChildBy(node, method),
children = child ? [child] : [];
Y.Dom.getNextSiblingBy(child, function(node) {
if ( !method || method(node) ) {
children[children.length] = node;
}
return false; // fail test to collect all children
});
return children;
} | [
"function",
"(",
"node",
",",
"method",
")",
"{",
"var",
"child",
"=",
"Y",
".",
"Dom",
".",
"getFirstChildBy",
"(",
"node",
",",
"method",
")",
",",
"children",
"=",
"child",
"?",
"[",
"child",
"]",
":",
"[",
"]",
";",
"Y",
".",
"Dom",
".",
"getNextSiblingBy",
"(",
"child",
",",
"function",
"(",
"node",
")",
"{",
"if",
"(",
"!",
"method",
"||",
"method",
"(",
"node",
")",
")",
"{",
"children",
"[",
"children",
".",
"length",
"]",
"=",
"node",
";",
"}",
"return",
"false",
";",
"// fail test to collect all children",
"}",
")",
";",
"return",
"children",
";",
"}"
]
| Returns an array of HTMLElement childNodes that pass the test method.
@method getChildrenBy
@param {HTMLElement} node The HTMLElement to start from
@param {Function} method A boolean function used to test children
that receives the node being tested as its only argument
@return {Array} A static array of HTMLElements | [
"Returns",
"an",
"array",
"of",
"HTMLElement",
"childNodes",
"that",
"pass",
"the",
"test",
"method",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/dom/dom-debug.js#L1173-L1185 |
|
42,254 | neyric/webhookit | public/javascripts/yui/dom/dom-debug.js | function(doc) {
doc = doc || document;
return Math.max(doc[DOCUMENT_ELEMENT].scrollLeft, doc.body.scrollLeft);
} | javascript | function(doc) {
doc = doc || document;
return Math.max(doc[DOCUMENT_ELEMENT].scrollLeft, doc.body.scrollLeft);
} | [
"function",
"(",
"doc",
")",
"{",
"doc",
"=",
"doc",
"||",
"document",
";",
"return",
"Math",
".",
"max",
"(",
"doc",
"[",
"DOCUMENT_ELEMENT",
"]",
".",
"scrollLeft",
",",
"doc",
".",
"body",
".",
"scrollLeft",
")",
";",
"}"
]
| Returns the left scroll value of the document
@method getDocumentScrollLeft
@param {HTMLDocument} document (optional) The document to get the scroll value of
@return {Int} The amount that the document is scrolled to the left | [
"Returns",
"the",
"left",
"scroll",
"value",
"of",
"the",
"document"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/dom/dom-debug.js#L1208-L1211 |
|
42,255 | neyric/webhookit | public/javascripts/yui/dom/dom-debug.js | function(doc) {
doc = doc || document;
return Math.max(doc[DOCUMENT_ELEMENT].scrollTop, doc.body.scrollTop);
} | javascript | function(doc) {
doc = doc || document;
return Math.max(doc[DOCUMENT_ELEMENT].scrollTop, doc.body.scrollTop);
} | [
"function",
"(",
"doc",
")",
"{",
"doc",
"=",
"doc",
"||",
"document",
";",
"return",
"Math",
".",
"max",
"(",
"doc",
"[",
"DOCUMENT_ELEMENT",
"]",
".",
"scrollTop",
",",
"doc",
".",
"body",
".",
"scrollTop",
")",
";",
"}"
]
| Returns the top scroll value of the document
@method getDocumentScrollTop
@param {HTMLDocument} document (optional) The document to get the scroll value of
@return {Int} The amount that the document is scrolled to the top | [
"Returns",
"the",
"top",
"scroll",
"value",
"of",
"the",
"document"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/dom/dom-debug.js#L1219-L1222 |
|
42,256 | neyric/webhookit | public/javascripts/yui/dom/dom-debug.js | function() {
var t = Y.Dom.getDocumentScrollTop(),
l = Y.Dom.getDocumentScrollLeft(),
r = Y.Dom.getViewportWidth() + l,
b = Y.Dom.getViewportHeight() + t;
return new Y.Region(t, r, b, l);
} | javascript | function() {
var t = Y.Dom.getDocumentScrollTop(),
l = Y.Dom.getDocumentScrollLeft(),
r = Y.Dom.getViewportWidth() + l,
b = Y.Dom.getViewportHeight() + t;
return new Y.Region(t, r, b, l);
} | [
"function",
"(",
")",
"{",
"var",
"t",
"=",
"Y",
".",
"Dom",
".",
"getDocumentScrollTop",
"(",
")",
",",
"l",
"=",
"Y",
".",
"Dom",
".",
"getDocumentScrollLeft",
"(",
")",
",",
"r",
"=",
"Y",
".",
"Dom",
".",
"getViewportWidth",
"(",
")",
"+",
"l",
",",
"b",
"=",
"Y",
".",
"Dom",
".",
"getViewportHeight",
"(",
")",
"+",
"t",
";",
"return",
"new",
"Y",
".",
"Region",
"(",
"t",
",",
"r",
",",
"b",
",",
"l",
")",
";",
"}"
]
| Creates a Region based on the viewport relative to the document.
@method getClientRegion
@return {Region} A Region object representing the viewport which accounts for document scroll | [
"Creates",
"a",
"Region",
"based",
"on",
"the",
"viewport",
"relative",
"to",
"the",
"document",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/dom/dom-debug.js#L1271-L1278 |
|
42,257 | neyric/webhookit | public/javascripts/yui/datasource/datasource-debug.js | function(oData) {
var date = null;
//Convert to date
if(!(oData instanceof Date)) {
date = new Date(oData);
}
else {
return oData;
}
// Validate
if(date instanceof Date) {
return date;
}
else {
YAHOO.log("Could not convert data " + lang.dump(oData) + " to type Date", "warn", this.toString());
return null;
}
} | javascript | function(oData) {
var date = null;
//Convert to date
if(!(oData instanceof Date)) {
date = new Date(oData);
}
else {
return oData;
}
// Validate
if(date instanceof Date) {
return date;
}
else {
YAHOO.log("Could not convert data " + lang.dump(oData) + " to type Date", "warn", this.toString());
return null;
}
} | [
"function",
"(",
"oData",
")",
"{",
"var",
"date",
"=",
"null",
";",
"//Convert to date",
"if",
"(",
"!",
"(",
"oData",
"instanceof",
"Date",
")",
")",
"{",
"date",
"=",
"new",
"Date",
"(",
"oData",
")",
";",
"}",
"else",
"{",
"return",
"oData",
";",
"}",
"// Validate",
"if",
"(",
"date",
"instanceof",
"Date",
")",
"{",
"return",
"date",
";",
"}",
"else",
"{",
"YAHOO",
".",
"log",
"(",
"\"Could not convert data \"",
"+",
"lang",
".",
"dump",
"(",
"oData",
")",
"+",
"\" to type Date\"",
",",
"\"warn\"",
",",
"this",
".",
"toString",
"(",
")",
")",
";",
"return",
"null",
";",
"}",
"}"
]
| Converts data to type Date.
@method DataSourceBase.parseDate
@param oData {Date | String | Number} Data to convert.
@return {Date} A Date instance.
@static | [
"Converts",
"data",
"to",
"type",
"Date",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/datasource/datasource-debug.js#L462-L481 |
|
42,258 | neyric/webhookit | public/javascripts/yui/datasource/datasource-debug.js | function(nMsec, oRequest, oCallback, oCaller) {
if(lang.isNumber(nMsec) && (nMsec >= 0)) {
YAHOO.log("Enabling polling to live data for \"" + oRequest + "\" at interval " + nMsec, "info", this.toString());
var oSelf = this;
var nId = setInterval(function() {
oSelf.makeConnection(oRequest, oCallback, oCaller);
}, nMsec);
this._aIntervals.push(nId);
return nId;
}
else {
YAHOO.log("Could not enable polling to live data for \"" + oRequest + "\" at interval " + nMsec, "info", this.toString());
}
} | javascript | function(nMsec, oRequest, oCallback, oCaller) {
if(lang.isNumber(nMsec) && (nMsec >= 0)) {
YAHOO.log("Enabling polling to live data for \"" + oRequest + "\" at interval " + nMsec, "info", this.toString());
var oSelf = this;
var nId = setInterval(function() {
oSelf.makeConnection(oRequest, oCallback, oCaller);
}, nMsec);
this._aIntervals.push(nId);
return nId;
}
else {
YAHOO.log("Could not enable polling to live data for \"" + oRequest + "\" at interval " + nMsec, "info", this.toString());
}
} | [
"function",
"(",
"nMsec",
",",
"oRequest",
",",
"oCallback",
",",
"oCaller",
")",
"{",
"if",
"(",
"lang",
".",
"isNumber",
"(",
"nMsec",
")",
"&&",
"(",
"nMsec",
">=",
"0",
")",
")",
"{",
"YAHOO",
".",
"log",
"(",
"\"Enabling polling to live data for \\\"\"",
"+",
"oRequest",
"+",
"\"\\\" at interval \"",
"+",
"nMsec",
",",
"\"info\"",
",",
"this",
".",
"toString",
"(",
")",
")",
";",
"var",
"oSelf",
"=",
"this",
";",
"var",
"nId",
"=",
"setInterval",
"(",
"function",
"(",
")",
"{",
"oSelf",
".",
"makeConnection",
"(",
"oRequest",
",",
"oCallback",
",",
"oCaller",
")",
";",
"}",
",",
"nMsec",
")",
";",
"this",
".",
"_aIntervals",
".",
"push",
"(",
"nId",
")",
";",
"return",
"nId",
";",
"}",
"else",
"{",
"YAHOO",
".",
"log",
"(",
"\"Could not enable polling to live data for \\\"\"",
"+",
"oRequest",
"+",
"\"\\\" at interval \"",
"+",
"nMsec",
",",
"\"info\"",
",",
"this",
".",
"toString",
"(",
")",
")",
";",
"}",
"}"
]
| Sets up a polling mechanism to send requests at set intervals and forward
responses to given callback.
@method setInterval
@param nMsec {Number} Length of interval in milliseconds.
@param oRequest {Object} Request object.
@param oCallback {Function} Handler function to receive the response.
@param oCaller {Object} (deprecated) Use oCallback.scope.
@return {Number} Interval ID. | [
"Sets",
"up",
"a",
"polling",
"mechanism",
"to",
"send",
"requests",
"at",
"set",
"intervals",
"and",
"forward",
"responses",
"to",
"given",
"callback",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/datasource/datasource-debug.js#L798-L811 |
|
42,259 | neyric/webhookit | public/javascripts/yui/datasource/datasource-debug.js | function(nId) {
// Remove from tracker if there
var tracker = this._aIntervals || [];
for(var i=tracker.length-1; i>-1; i--) {
if(tracker[i] === nId) {
tracker.splice(i,1);
clearInterval(nId);
}
}
} | javascript | function(nId) {
// Remove from tracker if there
var tracker = this._aIntervals || [];
for(var i=tracker.length-1; i>-1; i--) {
if(tracker[i] === nId) {
tracker.splice(i,1);
clearInterval(nId);
}
}
} | [
"function",
"(",
"nId",
")",
"{",
"// Remove from tracker if there",
"var",
"tracker",
"=",
"this",
".",
"_aIntervals",
"||",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"tracker",
".",
"length",
"-",
"1",
";",
"i",
">",
"-",
"1",
";",
"i",
"--",
")",
"{",
"if",
"(",
"tracker",
"[",
"i",
"]",
"===",
"nId",
")",
"{",
"tracker",
".",
"splice",
"(",
"i",
",",
"1",
")",
";",
"clearInterval",
"(",
"nId",
")",
";",
"}",
"}",
"}"
]
| Disables polling mechanism associated with the given interval ID.
@method clearInterval
@param nId {Number} Interval ID. | [
"Disables",
"polling",
"mechanism",
"associated",
"with",
"the",
"given",
"interval",
"ID",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/datasource/datasource-debug.js#L819-L828 |
|
42,260 | neyric/webhookit | public/javascripts/yui/datasource/datasource-debug.js | function(oRequest, oCallback, oCaller) {
var tId = DS._nTransactionId++;
this.fireEvent("requestEvent", {tId:tId, request:oRequest,callback:oCallback,caller:oCaller});
/* accounts for the following cases:
YAHOO.util.DataSourceBase.TYPE_UNKNOWN
YAHOO.util.DataSourceBase.TYPE_JSARRAY
YAHOO.util.DataSourceBase.TYPE_JSON
YAHOO.util.DataSourceBase.TYPE_HTMLTABLE
YAHOO.util.DataSourceBase.TYPE_XML
YAHOO.util.DataSourceBase.TYPE_TEXT
*/
var oRawResponse = this.liveData;
this.handleResponse(oRequest, oRawResponse, oCallback, oCaller, tId);
return tId;
} | javascript | function(oRequest, oCallback, oCaller) {
var tId = DS._nTransactionId++;
this.fireEvent("requestEvent", {tId:tId, request:oRequest,callback:oCallback,caller:oCaller});
/* accounts for the following cases:
YAHOO.util.DataSourceBase.TYPE_UNKNOWN
YAHOO.util.DataSourceBase.TYPE_JSARRAY
YAHOO.util.DataSourceBase.TYPE_JSON
YAHOO.util.DataSourceBase.TYPE_HTMLTABLE
YAHOO.util.DataSourceBase.TYPE_XML
YAHOO.util.DataSourceBase.TYPE_TEXT
*/
var oRawResponse = this.liveData;
this.handleResponse(oRequest, oRawResponse, oCallback, oCaller, tId);
return tId;
} | [
"function",
"(",
"oRequest",
",",
"oCallback",
",",
"oCaller",
")",
"{",
"var",
"tId",
"=",
"DS",
".",
"_nTransactionId",
"++",
";",
"this",
".",
"fireEvent",
"(",
"\"requestEvent\"",
",",
"{",
"tId",
":",
"tId",
",",
"request",
":",
"oRequest",
",",
"callback",
":",
"oCallback",
",",
"caller",
":",
"oCaller",
"}",
")",
";",
"/* accounts for the following cases:\n YAHOO.util.DataSourceBase.TYPE_UNKNOWN\n YAHOO.util.DataSourceBase.TYPE_JSARRAY\n YAHOO.util.DataSourceBase.TYPE_JSON\n YAHOO.util.DataSourceBase.TYPE_HTMLTABLE\n YAHOO.util.DataSourceBase.TYPE_XML\n YAHOO.util.DataSourceBase.TYPE_TEXT\n */",
"var",
"oRawResponse",
"=",
"this",
".",
"liveData",
";",
"this",
".",
"handleResponse",
"(",
"oRequest",
",",
"oRawResponse",
",",
"oCallback",
",",
"oCaller",
",",
"tId",
")",
";",
"return",
"tId",
";",
"}"
]
| Overridable default method generates a unique transaction ID and passes
the live data reference directly to the handleResponse function. This
method should be implemented by subclasses to achieve more complex behavior
or to access remote data.
@method makeConnection
@param oRequest {Object} Request object.
@param oCallback {Object} Callback object literal.
@param oCaller {Object} (deprecated) Use oCallback.scope.
@return {Number} Transaction ID. | [
"Overridable",
"default",
"method",
"generates",
"a",
"unique",
"transaction",
"ID",
"and",
"passes",
"the",
"live",
"data",
"reference",
"directly",
"to",
"the",
"handleResponse",
"function",
".",
"This",
"method",
"should",
"be",
"implemented",
"by",
"subclasses",
"to",
"achieve",
"more",
"complex",
"behavior",
"or",
"to",
"access",
"remote",
"data",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/datasource/datasource-debug.js#L909-L925 |
|
42,261 | neyric/webhookit | public/javascripts/yui/datasource/datasource-debug.js | function(oRequest, oFullResponse) {
if(lang.isValue(oFullResponse)) {
var oParsedResponse = {results:oFullResponse,meta:{}};
YAHOO.log("Parsed generic data is " +
lang.dump(oParsedResponse), "info", this.toString());
return oParsedResponse;
}
YAHOO.log("Generic data could not be parsed: " + lang.dump(oFullResponse),
"error", this.toString());
return null;
} | javascript | function(oRequest, oFullResponse) {
if(lang.isValue(oFullResponse)) {
var oParsedResponse = {results:oFullResponse,meta:{}};
YAHOO.log("Parsed generic data is " +
lang.dump(oParsedResponse), "info", this.toString());
return oParsedResponse;
}
YAHOO.log("Generic data could not be parsed: " + lang.dump(oFullResponse),
"error", this.toString());
return null;
} | [
"function",
"(",
"oRequest",
",",
"oFullResponse",
")",
"{",
"if",
"(",
"lang",
".",
"isValue",
"(",
"oFullResponse",
")",
")",
"{",
"var",
"oParsedResponse",
"=",
"{",
"results",
":",
"oFullResponse",
",",
"meta",
":",
"{",
"}",
"}",
";",
"YAHOO",
".",
"log",
"(",
"\"Parsed generic data is \"",
"+",
"lang",
".",
"dump",
"(",
"oParsedResponse",
")",
",",
"\"info\"",
",",
"this",
".",
"toString",
"(",
")",
")",
";",
"return",
"oParsedResponse",
";",
"}",
"YAHOO",
".",
"log",
"(",
"\"Generic data could not be parsed: \"",
"+",
"lang",
".",
"dump",
"(",
"oFullResponse",
")",
",",
"\"error\"",
",",
"this",
".",
"toString",
"(",
")",
")",
";",
"return",
"null",
";",
"}"
]
| Overridable method parses data of generic RESPONSE_TYPE into a response object.
@method parseData
@param oRequest {Object} Request object.
@param oFullResponse {Object} The full Array from the live database.
@return {Object} Parsed response object with the following properties:<br>
- results {Array} Array of parsed data results<br>
- meta {Object} Object literal of meta values<br>
- error {Boolean} (optional) True if there was an error<br> | [
"Overridable",
"method",
"parses",
"data",
"of",
"generic",
"RESPONSE_TYPE",
"into",
"a",
"response",
"object",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/datasource/datasource-debug.js#L1196-L1207 |
|
42,262 | neyric/webhookit | public/javascripts/yui/datasource/datasource-debug.js | function(result) {
var oResult = {},
schema = this.responseSchema;
try {
// Loop through each data field in each result using the schema
for(var m = schema.fields.length-1; m >= 0 ; m--) {
var field = schema.fields[m];
var key = (lang.isValue(field.key)) ? field.key : field;
var data = null;
if(this.useXPath) {
data = YAHOO.util.DataSource._getLocationValue(field, result);
}
else {
// Values may be held in an attribute...
var xmlAttr = result.attributes.getNamedItem(key);
if(xmlAttr) {
data = xmlAttr.value;
}
// ...or in a node
else {
var xmlNode = result.getElementsByTagName(key);
if(xmlNode && xmlNode.item(0)) {
var item = xmlNode.item(0);
// For IE, then DOM...
data = (item) ? ((item.text) ? item.text : (item.textContent) ? item.textContent : null) : null;
// ...then fallback, but check for multiple child nodes
if(!data) {
var datapieces = [];
for(var j=0, len=item.childNodes.length; j<len; j++) {
if(item.childNodes[j].nodeValue) {
datapieces[datapieces.length] = item.childNodes[j].nodeValue;
}
}
if(datapieces.length > 0) {
data = datapieces.join("");
}
}
}
}
}
// Safety net
if(data === null) {
data = "";
}
// Backward compatibility
if(!field.parser && field.converter) {
field.parser = field.converter;
YAHOO.log("The field property converter has been deprecated" +
" in favor of parser", "warn", this.toString());
}
var parser = (typeof field.parser === 'function') ?
field.parser :
DS.Parser[field.parser+''];
if(parser) {
data = parser.call(this, data);
}
// Safety measure
if(data === undefined) {
data = null;
}
oResult[key] = data;
}
}
catch(e) {
YAHOO.log("Error while parsing XML result: " + e.message);
}
return oResult;
} | javascript | function(result) {
var oResult = {},
schema = this.responseSchema;
try {
// Loop through each data field in each result using the schema
for(var m = schema.fields.length-1; m >= 0 ; m--) {
var field = schema.fields[m];
var key = (lang.isValue(field.key)) ? field.key : field;
var data = null;
if(this.useXPath) {
data = YAHOO.util.DataSource._getLocationValue(field, result);
}
else {
// Values may be held in an attribute...
var xmlAttr = result.attributes.getNamedItem(key);
if(xmlAttr) {
data = xmlAttr.value;
}
// ...or in a node
else {
var xmlNode = result.getElementsByTagName(key);
if(xmlNode && xmlNode.item(0)) {
var item = xmlNode.item(0);
// For IE, then DOM...
data = (item) ? ((item.text) ? item.text : (item.textContent) ? item.textContent : null) : null;
// ...then fallback, but check for multiple child nodes
if(!data) {
var datapieces = [];
for(var j=0, len=item.childNodes.length; j<len; j++) {
if(item.childNodes[j].nodeValue) {
datapieces[datapieces.length] = item.childNodes[j].nodeValue;
}
}
if(datapieces.length > 0) {
data = datapieces.join("");
}
}
}
}
}
// Safety net
if(data === null) {
data = "";
}
// Backward compatibility
if(!field.parser && field.converter) {
field.parser = field.converter;
YAHOO.log("The field property converter has been deprecated" +
" in favor of parser", "warn", this.toString());
}
var parser = (typeof field.parser === 'function') ?
field.parser :
DS.Parser[field.parser+''];
if(parser) {
data = parser.call(this, data);
}
// Safety measure
if(data === undefined) {
data = null;
}
oResult[key] = data;
}
}
catch(e) {
YAHOO.log("Error while parsing XML result: " + e.message);
}
return oResult;
} | [
"function",
"(",
"result",
")",
"{",
"var",
"oResult",
"=",
"{",
"}",
",",
"schema",
"=",
"this",
".",
"responseSchema",
";",
"try",
"{",
"// Loop through each data field in each result using the schema",
"for",
"(",
"var",
"m",
"=",
"schema",
".",
"fields",
".",
"length",
"-",
"1",
";",
"m",
">=",
"0",
";",
"m",
"--",
")",
"{",
"var",
"field",
"=",
"schema",
".",
"fields",
"[",
"m",
"]",
";",
"var",
"key",
"=",
"(",
"lang",
".",
"isValue",
"(",
"field",
".",
"key",
")",
")",
"?",
"field",
".",
"key",
":",
"field",
";",
"var",
"data",
"=",
"null",
";",
"if",
"(",
"this",
".",
"useXPath",
")",
"{",
"data",
"=",
"YAHOO",
".",
"util",
".",
"DataSource",
".",
"_getLocationValue",
"(",
"field",
",",
"result",
")",
";",
"}",
"else",
"{",
"// Values may be held in an attribute...",
"var",
"xmlAttr",
"=",
"result",
".",
"attributes",
".",
"getNamedItem",
"(",
"key",
")",
";",
"if",
"(",
"xmlAttr",
")",
"{",
"data",
"=",
"xmlAttr",
".",
"value",
";",
"}",
"// ...or in a node",
"else",
"{",
"var",
"xmlNode",
"=",
"result",
".",
"getElementsByTagName",
"(",
"key",
")",
";",
"if",
"(",
"xmlNode",
"&&",
"xmlNode",
".",
"item",
"(",
"0",
")",
")",
"{",
"var",
"item",
"=",
"xmlNode",
".",
"item",
"(",
"0",
")",
";",
"// For IE, then DOM...",
"data",
"=",
"(",
"item",
")",
"?",
"(",
"(",
"item",
".",
"text",
")",
"?",
"item",
".",
"text",
":",
"(",
"item",
".",
"textContent",
")",
"?",
"item",
".",
"textContent",
":",
"null",
")",
":",
"null",
";",
"// ...then fallback, but check for multiple child nodes",
"if",
"(",
"!",
"data",
")",
"{",
"var",
"datapieces",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"j",
"=",
"0",
",",
"len",
"=",
"item",
".",
"childNodes",
".",
"length",
";",
"j",
"<",
"len",
";",
"j",
"++",
")",
"{",
"if",
"(",
"item",
".",
"childNodes",
"[",
"j",
"]",
".",
"nodeValue",
")",
"{",
"datapieces",
"[",
"datapieces",
".",
"length",
"]",
"=",
"item",
".",
"childNodes",
"[",
"j",
"]",
".",
"nodeValue",
";",
"}",
"}",
"if",
"(",
"datapieces",
".",
"length",
">",
"0",
")",
"{",
"data",
"=",
"datapieces",
".",
"join",
"(",
"\"\"",
")",
";",
"}",
"}",
"}",
"}",
"}",
"// Safety net",
"if",
"(",
"data",
"===",
"null",
")",
"{",
"data",
"=",
"\"\"",
";",
"}",
"// Backward compatibility",
"if",
"(",
"!",
"field",
".",
"parser",
"&&",
"field",
".",
"converter",
")",
"{",
"field",
".",
"parser",
"=",
"field",
".",
"converter",
";",
"YAHOO",
".",
"log",
"(",
"\"The field property converter has been deprecated\"",
"+",
"\" in favor of parser\"",
",",
"\"warn\"",
",",
"this",
".",
"toString",
"(",
")",
")",
";",
"}",
"var",
"parser",
"=",
"(",
"typeof",
"field",
".",
"parser",
"===",
"'function'",
")",
"?",
"field",
".",
"parser",
":",
"DS",
".",
"Parser",
"[",
"field",
".",
"parser",
"+",
"''",
"]",
";",
"if",
"(",
"parser",
")",
"{",
"data",
"=",
"parser",
".",
"call",
"(",
"this",
",",
"data",
")",
";",
"}",
"// Safety measure",
"if",
"(",
"data",
"===",
"undefined",
")",
"{",
"data",
"=",
"null",
";",
"}",
"oResult",
"[",
"key",
"]",
"=",
"data",
";",
"}",
"}",
"catch",
"(",
"e",
")",
"{",
"YAHOO",
".",
"log",
"(",
"\"Error while parsing XML result: \"",
"+",
"e",
".",
"message",
")",
";",
"}",
"return",
"oResult",
";",
"}"
]
| Overridable method parses XML data for one result into an object literal.
@method parseXMLResult
@param result {XML} XML for one result.
@return {Object} Object literal of data for one result. | [
"Overridable",
"method",
"parses",
"XML",
"data",
"for",
"one",
"result",
"into",
"an",
"object",
"literal",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/datasource/datasource-debug.js#L1407-L1479 |
|
42,263 | neyric/webhookit | public/javascripts/yui/datasource/datasource-debug.js | function(oRequest, oFullResponse) {
var bError = false,
schema = this.responseSchema,
oParsedResponse = {meta:{}},
xmlList = null,
metaNode = schema.metaNode,
metaLocators = schema.metaFields || {},
i,k,loc,v;
// In case oFullResponse is something funky
try {
// Pull any meta identified
if(this.useXPath) {
for (k in metaLocators) {
oParsedResponse.meta[k] = YAHOO.util.DataSource._getLocationValue(metaLocators[k], oFullResponse);
}
}
else {
metaNode = metaNode ? oFullResponse.getElementsByTagName(metaNode)[0] :
oFullResponse;
if (metaNode) {
for (k in metaLocators) {
if (lang.hasOwnProperty(metaLocators, k)) {
loc = metaLocators[k];
// Look for a node
v = metaNode.getElementsByTagName(loc)[0];
if (v) {
v = v.firstChild.nodeValue;
} else {
// Look for an attribute
v = metaNode.attributes.getNamedItem(loc);
if (v) {
v = v.value;
}
}
if (lang.isValue(v)) {
oParsedResponse.meta[k] = v;
}
}
}
}
}
// For result data
xmlList = (schema.resultNode) ?
oFullResponse.getElementsByTagName(schema.resultNode) :
null;
}
catch(e) {
YAHOO.log("Error while parsing XML data: " + e.message);
}
if(!xmlList || !lang.isArray(schema.fields)) {
bError = true;
}
// Loop through each result
else {
oParsedResponse.results = [];
for(i = xmlList.length-1; i >= 0 ; --i) {
var oResult = this.parseXMLResult(xmlList.item(i));
// Capture each array of values into an array of results
oParsedResponse.results[i] = oResult;
}
}
if(bError) {
YAHOO.log("XML data could not be parsed: " +
lang.dump(oFullResponse), "error", this.toString());
oParsedResponse.error = true;
}
else {
YAHOO.log("Parsed XML data is " +
lang.dump(oParsedResponse), "info", this.toString());
}
return oParsedResponse;
} | javascript | function(oRequest, oFullResponse) {
var bError = false,
schema = this.responseSchema,
oParsedResponse = {meta:{}},
xmlList = null,
metaNode = schema.metaNode,
metaLocators = schema.metaFields || {},
i,k,loc,v;
// In case oFullResponse is something funky
try {
// Pull any meta identified
if(this.useXPath) {
for (k in metaLocators) {
oParsedResponse.meta[k] = YAHOO.util.DataSource._getLocationValue(metaLocators[k], oFullResponse);
}
}
else {
metaNode = metaNode ? oFullResponse.getElementsByTagName(metaNode)[0] :
oFullResponse;
if (metaNode) {
for (k in metaLocators) {
if (lang.hasOwnProperty(metaLocators, k)) {
loc = metaLocators[k];
// Look for a node
v = metaNode.getElementsByTagName(loc)[0];
if (v) {
v = v.firstChild.nodeValue;
} else {
// Look for an attribute
v = metaNode.attributes.getNamedItem(loc);
if (v) {
v = v.value;
}
}
if (lang.isValue(v)) {
oParsedResponse.meta[k] = v;
}
}
}
}
}
// For result data
xmlList = (schema.resultNode) ?
oFullResponse.getElementsByTagName(schema.resultNode) :
null;
}
catch(e) {
YAHOO.log("Error while parsing XML data: " + e.message);
}
if(!xmlList || !lang.isArray(schema.fields)) {
bError = true;
}
// Loop through each result
else {
oParsedResponse.results = [];
for(i = xmlList.length-1; i >= 0 ; --i) {
var oResult = this.parseXMLResult(xmlList.item(i));
// Capture each array of values into an array of results
oParsedResponse.results[i] = oResult;
}
}
if(bError) {
YAHOO.log("XML data could not be parsed: " +
lang.dump(oFullResponse), "error", this.toString());
oParsedResponse.error = true;
}
else {
YAHOO.log("Parsed XML data is " +
lang.dump(oParsedResponse), "info", this.toString());
}
return oParsedResponse;
} | [
"function",
"(",
"oRequest",
",",
"oFullResponse",
")",
"{",
"var",
"bError",
"=",
"false",
",",
"schema",
"=",
"this",
".",
"responseSchema",
",",
"oParsedResponse",
"=",
"{",
"meta",
":",
"{",
"}",
"}",
",",
"xmlList",
"=",
"null",
",",
"metaNode",
"=",
"schema",
".",
"metaNode",
",",
"metaLocators",
"=",
"schema",
".",
"metaFields",
"||",
"{",
"}",
",",
"i",
",",
"k",
",",
"loc",
",",
"v",
";",
"// In case oFullResponse is something funky",
"try",
"{",
"// Pull any meta identified",
"if",
"(",
"this",
".",
"useXPath",
")",
"{",
"for",
"(",
"k",
"in",
"metaLocators",
")",
"{",
"oParsedResponse",
".",
"meta",
"[",
"k",
"]",
"=",
"YAHOO",
".",
"util",
".",
"DataSource",
".",
"_getLocationValue",
"(",
"metaLocators",
"[",
"k",
"]",
",",
"oFullResponse",
")",
";",
"}",
"}",
"else",
"{",
"metaNode",
"=",
"metaNode",
"?",
"oFullResponse",
".",
"getElementsByTagName",
"(",
"metaNode",
")",
"[",
"0",
"]",
":",
"oFullResponse",
";",
"if",
"(",
"metaNode",
")",
"{",
"for",
"(",
"k",
"in",
"metaLocators",
")",
"{",
"if",
"(",
"lang",
".",
"hasOwnProperty",
"(",
"metaLocators",
",",
"k",
")",
")",
"{",
"loc",
"=",
"metaLocators",
"[",
"k",
"]",
";",
"// Look for a node",
"v",
"=",
"metaNode",
".",
"getElementsByTagName",
"(",
"loc",
")",
"[",
"0",
"]",
";",
"if",
"(",
"v",
")",
"{",
"v",
"=",
"v",
".",
"firstChild",
".",
"nodeValue",
";",
"}",
"else",
"{",
"// Look for an attribute",
"v",
"=",
"metaNode",
".",
"attributes",
".",
"getNamedItem",
"(",
"loc",
")",
";",
"if",
"(",
"v",
")",
"{",
"v",
"=",
"v",
".",
"value",
";",
"}",
"}",
"if",
"(",
"lang",
".",
"isValue",
"(",
"v",
")",
")",
"{",
"oParsedResponse",
".",
"meta",
"[",
"k",
"]",
"=",
"v",
";",
"}",
"}",
"}",
"}",
"}",
"// For result data",
"xmlList",
"=",
"(",
"schema",
".",
"resultNode",
")",
"?",
"oFullResponse",
".",
"getElementsByTagName",
"(",
"schema",
".",
"resultNode",
")",
":",
"null",
";",
"}",
"catch",
"(",
"e",
")",
"{",
"YAHOO",
".",
"log",
"(",
"\"Error while parsing XML data: \"",
"+",
"e",
".",
"message",
")",
";",
"}",
"if",
"(",
"!",
"xmlList",
"||",
"!",
"lang",
".",
"isArray",
"(",
"schema",
".",
"fields",
")",
")",
"{",
"bError",
"=",
"true",
";",
"}",
"// Loop through each result",
"else",
"{",
"oParsedResponse",
".",
"results",
"=",
"[",
"]",
";",
"for",
"(",
"i",
"=",
"xmlList",
".",
"length",
"-",
"1",
";",
"i",
">=",
"0",
";",
"--",
"i",
")",
"{",
"var",
"oResult",
"=",
"this",
".",
"parseXMLResult",
"(",
"xmlList",
".",
"item",
"(",
"i",
")",
")",
";",
"// Capture each array of values into an array of results",
"oParsedResponse",
".",
"results",
"[",
"i",
"]",
"=",
"oResult",
";",
"}",
"}",
"if",
"(",
"bError",
")",
"{",
"YAHOO",
".",
"log",
"(",
"\"XML data could not be parsed: \"",
"+",
"lang",
".",
"dump",
"(",
"oFullResponse",
")",
",",
"\"error\"",
",",
"this",
".",
"toString",
"(",
")",
")",
";",
"oParsedResponse",
".",
"error",
"=",
"true",
";",
"}",
"else",
"{",
"YAHOO",
".",
"log",
"(",
"\"Parsed XML data is \"",
"+",
"lang",
".",
"dump",
"(",
"oParsedResponse",
")",
",",
"\"info\"",
",",
"this",
".",
"toString",
"(",
")",
")",
";",
"}",
"return",
"oParsedResponse",
";",
"}"
]
| Overridable method parses XML data into a response object.
@method parseXMLData
@param oRequest {Object} Request object.
@param oFullResponse {Object} The full XML response from the live database.
@return {Object} Parsed response object with the following properties<br>
- results (Array) Array of parsed data results<br>
- error (Boolean) True if there was an error | [
"Overridable",
"method",
"parses",
"XML",
"data",
"into",
"a",
"response",
"object",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/datasource/datasource-debug.js#L1493-L1569 |
|
42,264 | neyric/webhookit | public/javascripts/yui/datasource/datasource-debug.js | function(oResponse) {
// If response ID does not match last made request ID,
// silently fail and wait for the next response
if(oResponse && (this.connXhrMode == "ignoreStaleResponses") &&
(oResponse.tId != oQueue.conn.tId)) {
YAHOO.log("Ignored stale response", "warn", this.toString());
return null;
}
// Error if no response
else if(!oResponse) {
this.fireEvent("dataErrorEvent", {request:oRequest, response:null,
callback:oCallback, caller:oCaller,
message:DS.ERROR_DATANULL});
YAHOO.log(DS.ERROR_DATANULL, "error", this.toString());
// Send error response back to the caller with the error flag on
DS.issueCallback(oCallback,[oRequest, {error:true}], true, oCaller);
return null;
}
// Forward to handler
else {
// Try to sniff data type if it has not been defined
if(this.responseType === DS.TYPE_UNKNOWN) {
var ctype = (oResponse.getResponseHeader) ? oResponse.getResponseHeader["Content-Type"] : null;
if(ctype) {
// xml
if(ctype.indexOf("text/xml") > -1) {
this.responseType = DS.TYPE_XML;
}
else if(ctype.indexOf("application/json") > -1) { // json
this.responseType = DS.TYPE_JSON;
}
else if(ctype.indexOf("text/plain") > -1) { // text
this.responseType = DS.TYPE_TEXT;
}
}
}
this.handleResponse(oRequest, oResponse, oCallback, oCaller, tId);
}
} | javascript | function(oResponse) {
// If response ID does not match last made request ID,
// silently fail and wait for the next response
if(oResponse && (this.connXhrMode == "ignoreStaleResponses") &&
(oResponse.tId != oQueue.conn.tId)) {
YAHOO.log("Ignored stale response", "warn", this.toString());
return null;
}
// Error if no response
else if(!oResponse) {
this.fireEvent("dataErrorEvent", {request:oRequest, response:null,
callback:oCallback, caller:oCaller,
message:DS.ERROR_DATANULL});
YAHOO.log(DS.ERROR_DATANULL, "error", this.toString());
// Send error response back to the caller with the error flag on
DS.issueCallback(oCallback,[oRequest, {error:true}], true, oCaller);
return null;
}
// Forward to handler
else {
// Try to sniff data type if it has not been defined
if(this.responseType === DS.TYPE_UNKNOWN) {
var ctype = (oResponse.getResponseHeader) ? oResponse.getResponseHeader["Content-Type"] : null;
if(ctype) {
// xml
if(ctype.indexOf("text/xml") > -1) {
this.responseType = DS.TYPE_XML;
}
else if(ctype.indexOf("application/json") > -1) { // json
this.responseType = DS.TYPE_JSON;
}
else if(ctype.indexOf("text/plain") > -1) { // text
this.responseType = DS.TYPE_TEXT;
}
}
}
this.handleResponse(oRequest, oResponse, oCallback, oCaller, tId);
}
} | [
"function",
"(",
"oResponse",
")",
"{",
"// If response ID does not match last made request ID,",
"// silently fail and wait for the next response",
"if",
"(",
"oResponse",
"&&",
"(",
"this",
".",
"connXhrMode",
"==",
"\"ignoreStaleResponses\"",
")",
"&&",
"(",
"oResponse",
".",
"tId",
"!=",
"oQueue",
".",
"conn",
".",
"tId",
")",
")",
"{",
"YAHOO",
".",
"log",
"(",
"\"Ignored stale response\"",
",",
"\"warn\"",
",",
"this",
".",
"toString",
"(",
")",
")",
";",
"return",
"null",
";",
"}",
"// Error if no response",
"else",
"if",
"(",
"!",
"oResponse",
")",
"{",
"this",
".",
"fireEvent",
"(",
"\"dataErrorEvent\"",
",",
"{",
"request",
":",
"oRequest",
",",
"response",
":",
"null",
",",
"callback",
":",
"oCallback",
",",
"caller",
":",
"oCaller",
",",
"message",
":",
"DS",
".",
"ERROR_DATANULL",
"}",
")",
";",
"YAHOO",
".",
"log",
"(",
"DS",
".",
"ERROR_DATANULL",
",",
"\"error\"",
",",
"this",
".",
"toString",
"(",
")",
")",
";",
"// Send error response back to the caller with the error flag on",
"DS",
".",
"issueCallback",
"(",
"oCallback",
",",
"[",
"oRequest",
",",
"{",
"error",
":",
"true",
"}",
"]",
",",
"true",
",",
"oCaller",
")",
";",
"return",
"null",
";",
"}",
"// Forward to handler",
"else",
"{",
"// Try to sniff data type if it has not been defined",
"if",
"(",
"this",
".",
"responseType",
"===",
"DS",
".",
"TYPE_UNKNOWN",
")",
"{",
"var",
"ctype",
"=",
"(",
"oResponse",
".",
"getResponseHeader",
")",
"?",
"oResponse",
".",
"getResponseHeader",
"[",
"\"Content-Type\"",
"]",
":",
"null",
";",
"if",
"(",
"ctype",
")",
"{",
"// xml",
"if",
"(",
"ctype",
".",
"indexOf",
"(",
"\"text/xml\"",
")",
">",
"-",
"1",
")",
"{",
"this",
".",
"responseType",
"=",
"DS",
".",
"TYPE_XML",
";",
"}",
"else",
"if",
"(",
"ctype",
".",
"indexOf",
"(",
"\"application/json\"",
")",
">",
"-",
"1",
")",
"{",
"// json",
"this",
".",
"responseType",
"=",
"DS",
".",
"TYPE_JSON",
";",
"}",
"else",
"if",
"(",
"ctype",
".",
"indexOf",
"(",
"\"text/plain\"",
")",
">",
"-",
"1",
")",
"{",
"// text",
"this",
".",
"responseType",
"=",
"DS",
".",
"TYPE_TEXT",
";",
"}",
"}",
"}",
"this",
".",
"handleResponse",
"(",
"oRequest",
",",
"oResponse",
",",
"oCallback",
",",
"oCaller",
",",
"tId",
")",
";",
"}",
"}"
]
| Define Connection Manager success handler
@method _xhrSuccess
@param oResponse {Object} HTTPXMLRequest object
@private | [
"Define",
"Connection",
"Manager",
"success",
"handler"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/datasource/datasource-debug.js#L2347-L2387 |
|
42,265 | neyric/webhookit | public/javascripts/yui/datasource/datasource-debug.js | function(oResponse) {
this.fireEvent("dataErrorEvent", {request:oRequest, response: oResponse,
callback:oCallback, caller:oCaller,
message:DS.ERROR_DATAINVALID});
YAHOO.log(DS.ERROR_DATAINVALID + ": " +
oResponse.statusText, "error", this.toString());
// Backward compatibility
if(lang.isString(this.liveData) && lang.isString(oRequest) &&
(this.liveData.lastIndexOf("?") !== this.liveData.length-1) &&
(oRequest.indexOf("?") !== 0)){
YAHOO.log("DataSources using XHR no longer automatically supply " +
"a \"?\" between the host and query parameters" +
" -- please check that the request URL is correct", "warn", this.toString());
}
// Send failure response back to the caller with the error flag on
oResponse = oResponse || {};
oResponse.error = true;
DS.issueCallback(oCallback,[oRequest,oResponse],true, oCaller);
return null;
} | javascript | function(oResponse) {
this.fireEvent("dataErrorEvent", {request:oRequest, response: oResponse,
callback:oCallback, caller:oCaller,
message:DS.ERROR_DATAINVALID});
YAHOO.log(DS.ERROR_DATAINVALID + ": " +
oResponse.statusText, "error", this.toString());
// Backward compatibility
if(lang.isString(this.liveData) && lang.isString(oRequest) &&
(this.liveData.lastIndexOf("?") !== this.liveData.length-1) &&
(oRequest.indexOf("?") !== 0)){
YAHOO.log("DataSources using XHR no longer automatically supply " +
"a \"?\" between the host and query parameters" +
" -- please check that the request URL is correct", "warn", this.toString());
}
// Send failure response back to the caller with the error flag on
oResponse = oResponse || {};
oResponse.error = true;
DS.issueCallback(oCallback,[oRequest,oResponse],true, oCaller);
return null;
} | [
"function",
"(",
"oResponse",
")",
"{",
"this",
".",
"fireEvent",
"(",
"\"dataErrorEvent\"",
",",
"{",
"request",
":",
"oRequest",
",",
"response",
":",
"oResponse",
",",
"callback",
":",
"oCallback",
",",
"caller",
":",
"oCaller",
",",
"message",
":",
"DS",
".",
"ERROR_DATAINVALID",
"}",
")",
";",
"YAHOO",
".",
"log",
"(",
"DS",
".",
"ERROR_DATAINVALID",
"+",
"\": \"",
"+",
"oResponse",
".",
"statusText",
",",
"\"error\"",
",",
"this",
".",
"toString",
"(",
")",
")",
";",
"// Backward compatibility",
"if",
"(",
"lang",
".",
"isString",
"(",
"this",
".",
"liveData",
")",
"&&",
"lang",
".",
"isString",
"(",
"oRequest",
")",
"&&",
"(",
"this",
".",
"liveData",
".",
"lastIndexOf",
"(",
"\"?\"",
")",
"!==",
"this",
".",
"liveData",
".",
"length",
"-",
"1",
")",
"&&",
"(",
"oRequest",
".",
"indexOf",
"(",
"\"?\"",
")",
"!==",
"0",
")",
")",
"{",
"YAHOO",
".",
"log",
"(",
"\"DataSources using XHR no longer automatically supply \"",
"+",
"\"a \\\"?\\\" between the host and query parameters\"",
"+",
"\" -- please check that the request URL is correct\"",
",",
"\"warn\"",
",",
"this",
".",
"toString",
"(",
")",
")",
";",
"}",
"// Send failure response back to the caller with the error flag on",
"oResponse",
"=",
"oResponse",
"||",
"{",
"}",
";",
"oResponse",
".",
"error",
"=",
"true",
";",
"DS",
".",
"issueCallback",
"(",
"oCallback",
",",
"[",
"oRequest",
",",
"oResponse",
"]",
",",
"true",
",",
"oCaller",
")",
";",
"return",
"null",
";",
"}"
]
| Define Connection Manager failure handler
@method _xhrFailure
@param oResponse {Object} HTTPXMLRequest object
@private | [
"Define",
"Connection",
"Manager",
"failure",
"handler"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/datasource/datasource-debug.js#L2396-L2418 |
|
42,266 | neyric/webhookit | public/javascripts/yui/datasource/datasource-debug.js | function (oDate, oConfig, sLocale) {
oConfig = oConfig || {};
if(!(oDate instanceof Date)) {
return YAHOO.lang.isValue(oDate) ? oDate : "";
}
var format = oConfig.format || "%m/%d/%Y";
// Be backwards compatible, support strings that are
// exactly equal to YYYY/MM/DD, DD/MM/YYYY and MM/DD/YYYY
if(format === 'YYYY/MM/DD') {
format = '%Y/%m/%d';
} else if(format === 'DD/MM/YYYY') {
format = '%d/%m/%Y';
} else if(format === 'MM/DD/YYYY') {
format = '%m/%d/%Y';
}
// end backwards compatibility block
sLocale = sLocale || "en";
// Make sure we have a definition for the requested locale, or default to en.
if(!(sLocale in YAHOO.util.DateLocale)) {
if(sLocale.replace(/-[a-zA-Z]+$/, '') in YAHOO.util.DateLocale) {
sLocale = sLocale.replace(/-[a-zA-Z]+$/, '');
} else {
sLocale = "en";
}
}
var aLocale = YAHOO.util.DateLocale[sLocale];
var replace_aggs = function (m0, m1) {
var f = Dt.aggregates[m1];
return (f === 'locale' ? aLocale[m1] : f);
};
var replace_formats = function (m0, m1) {
var f = Dt.formats[m1];
if(typeof f === 'string') { // string => built in date function
return oDate[f]();
} else if(typeof f === 'function') { // function => our own function
return f.call(oDate, oDate, aLocale);
} else if(typeof f === 'object' && typeof f[0] === 'string') { // built in function with padding
return xPad(oDate[f[0]](), f[1]);
} else {
return m1;
}
};
// First replace aggregates (run in a loop because an agg may be made up of other aggs)
while(format.match(/%[cDFhnrRtTxX]/)) {
format = format.replace(/%([cDFhnrRtTxX])/g, replace_aggs);
}
// Now replace formats (do not run in a loop otherwise %%a will be replace with the value of %a)
var str = format.replace(/%([aAbBCdegGHIjklmMpPsSuUVwWyYzZ%])/g, replace_formats);
replace_aggs = replace_formats = undefined;
return str;
} | javascript | function (oDate, oConfig, sLocale) {
oConfig = oConfig || {};
if(!(oDate instanceof Date)) {
return YAHOO.lang.isValue(oDate) ? oDate : "";
}
var format = oConfig.format || "%m/%d/%Y";
// Be backwards compatible, support strings that are
// exactly equal to YYYY/MM/DD, DD/MM/YYYY and MM/DD/YYYY
if(format === 'YYYY/MM/DD') {
format = '%Y/%m/%d';
} else if(format === 'DD/MM/YYYY') {
format = '%d/%m/%Y';
} else if(format === 'MM/DD/YYYY') {
format = '%m/%d/%Y';
}
// end backwards compatibility block
sLocale = sLocale || "en";
// Make sure we have a definition for the requested locale, or default to en.
if(!(sLocale in YAHOO.util.DateLocale)) {
if(sLocale.replace(/-[a-zA-Z]+$/, '') in YAHOO.util.DateLocale) {
sLocale = sLocale.replace(/-[a-zA-Z]+$/, '');
} else {
sLocale = "en";
}
}
var aLocale = YAHOO.util.DateLocale[sLocale];
var replace_aggs = function (m0, m1) {
var f = Dt.aggregates[m1];
return (f === 'locale' ? aLocale[m1] : f);
};
var replace_formats = function (m0, m1) {
var f = Dt.formats[m1];
if(typeof f === 'string') { // string => built in date function
return oDate[f]();
} else if(typeof f === 'function') { // function => our own function
return f.call(oDate, oDate, aLocale);
} else if(typeof f === 'object' && typeof f[0] === 'string') { // built in function with padding
return xPad(oDate[f[0]](), f[1]);
} else {
return m1;
}
};
// First replace aggregates (run in a loop because an agg may be made up of other aggs)
while(format.match(/%[cDFhnrRtTxX]/)) {
format = format.replace(/%([cDFhnrRtTxX])/g, replace_aggs);
}
// Now replace formats (do not run in a loop otherwise %%a will be replace with the value of %a)
var str = format.replace(/%([aAbBCdegGHIjklmMpPsSuUVwWyYzZ%])/g, replace_formats);
replace_aggs = replace_formats = undefined;
return str;
} | [
"function",
"(",
"oDate",
",",
"oConfig",
",",
"sLocale",
")",
"{",
"oConfig",
"=",
"oConfig",
"||",
"{",
"}",
";",
"if",
"(",
"!",
"(",
"oDate",
"instanceof",
"Date",
")",
")",
"{",
"return",
"YAHOO",
".",
"lang",
".",
"isValue",
"(",
"oDate",
")",
"?",
"oDate",
":",
"\"\"",
";",
"}",
"var",
"format",
"=",
"oConfig",
".",
"format",
"||",
"\"%m/%d/%Y\"",
";",
"// Be backwards compatible, support strings that are",
"// exactly equal to YYYY/MM/DD, DD/MM/YYYY and MM/DD/YYYY",
"if",
"(",
"format",
"===",
"'YYYY/MM/DD'",
")",
"{",
"format",
"=",
"'%Y/%m/%d'",
";",
"}",
"else",
"if",
"(",
"format",
"===",
"'DD/MM/YYYY'",
")",
"{",
"format",
"=",
"'%d/%m/%Y'",
";",
"}",
"else",
"if",
"(",
"format",
"===",
"'MM/DD/YYYY'",
")",
"{",
"format",
"=",
"'%m/%d/%Y'",
";",
"}",
"// end backwards compatibility block",
"sLocale",
"=",
"sLocale",
"||",
"\"en\"",
";",
"// Make sure we have a definition for the requested locale, or default to en.",
"if",
"(",
"!",
"(",
"sLocale",
"in",
"YAHOO",
".",
"util",
".",
"DateLocale",
")",
")",
"{",
"if",
"(",
"sLocale",
".",
"replace",
"(",
"/",
"-[a-zA-Z]+$",
"/",
",",
"''",
")",
"in",
"YAHOO",
".",
"util",
".",
"DateLocale",
")",
"{",
"sLocale",
"=",
"sLocale",
".",
"replace",
"(",
"/",
"-[a-zA-Z]+$",
"/",
",",
"''",
")",
";",
"}",
"else",
"{",
"sLocale",
"=",
"\"en\"",
";",
"}",
"}",
"var",
"aLocale",
"=",
"YAHOO",
".",
"util",
".",
"DateLocale",
"[",
"sLocale",
"]",
";",
"var",
"replace_aggs",
"=",
"function",
"(",
"m0",
",",
"m1",
")",
"{",
"var",
"f",
"=",
"Dt",
".",
"aggregates",
"[",
"m1",
"]",
";",
"return",
"(",
"f",
"===",
"'locale'",
"?",
"aLocale",
"[",
"m1",
"]",
":",
"f",
")",
";",
"}",
";",
"var",
"replace_formats",
"=",
"function",
"(",
"m0",
",",
"m1",
")",
"{",
"var",
"f",
"=",
"Dt",
".",
"formats",
"[",
"m1",
"]",
";",
"if",
"(",
"typeof",
"f",
"===",
"'string'",
")",
"{",
"// string => built in date function",
"return",
"oDate",
"[",
"f",
"]",
"(",
")",
";",
"}",
"else",
"if",
"(",
"typeof",
"f",
"===",
"'function'",
")",
"{",
"// function => our own function",
"return",
"f",
".",
"call",
"(",
"oDate",
",",
"oDate",
",",
"aLocale",
")",
";",
"}",
"else",
"if",
"(",
"typeof",
"f",
"===",
"'object'",
"&&",
"typeof",
"f",
"[",
"0",
"]",
"===",
"'string'",
")",
"{",
"// built in function with padding",
"return",
"xPad",
"(",
"oDate",
"[",
"f",
"[",
"0",
"]",
"]",
"(",
")",
",",
"f",
"[",
"1",
"]",
")",
";",
"}",
"else",
"{",
"return",
"m1",
";",
"}",
"}",
";",
"// First replace aggregates (run in a loop because an agg may be made up of other aggs)",
"while",
"(",
"format",
".",
"match",
"(",
"/",
"%[cDFhnrRtTxX]",
"/",
")",
")",
"{",
"format",
"=",
"format",
".",
"replace",
"(",
"/",
"%([cDFhnrRtTxX])",
"/",
"g",
",",
"replace_aggs",
")",
";",
"}",
"// Now replace formats (do not run in a loop otherwise %%a will be replace with the value of %a)",
"var",
"str",
"=",
"format",
".",
"replace",
"(",
"/",
"%([aAbBCdegGHIjklmMpPsSuUVwWyYzZ%])",
"/",
"g",
",",
"replace_formats",
")",
";",
"replace_aggs",
"=",
"replace_formats",
"=",
"undefined",
";",
"return",
"str",
";",
"}"
]
| Takes a native JavaScript Date and formats to string for display to user.
@method format
@param oDate {Date} Date.
@param oConfig {Object} (Optional) Object literal of configuration values:
<dl>
<dt>format <String></dt>
<dd>
<p>
Any strftime string is supported, such as "%I:%M:%S %p". strftime has several format specifiers defined by the Open group at
<a href="http://www.opengroup.org/onlinepubs/007908799/xsh/strftime.html">http://www.opengroup.org/onlinepubs/007908799/xsh/strftime.html</a>
</p>
<p>
PHP added a few of its own, defined at <a href="http://www.php.net/strftime">http://www.php.net/strftime</a>
</p>
<p>
This javascript implementation supports all the PHP specifiers and a few more. The full list is below:
</p>
<dl>
<dt>%a</dt> <dd>abbreviated weekday name according to the current locale</dd>
<dt>%A</dt> <dd>full weekday name according to the current locale</dd>
<dt>%b</dt> <dd>abbreviated month name according to the current locale</dd>
<dt>%B</dt> <dd>full month name according to the current locale</dd>
<dt>%c</dt> <dd>preferred date and time representation for the current locale</dd>
<dt>%C</dt> <dd>century number (the year divided by 100 and truncated to an integer, range 00 to 99)</dd>
<dt>%d</dt> <dd>day of the month as a decimal number (range 01 to 31)</dd>
<dt>%D</dt> <dd>same as %m/%d/%y</dd>
<dt>%e</dt> <dd>day of the month as a decimal number, a single digit is preceded by a space (range ' 1' to '31')</dd>
<dt>%F</dt> <dd>same as %Y-%m-%d (ISO 8601 date format)</dd>
<dt>%g</dt> <dd>like %G, but without the century</dd>
<dt>%G</dt> <dd>The 4-digit year corresponding to the ISO week number</dd>
<dt>%h</dt> <dd>same as %b</dd>
<dt>%H</dt> <dd>hour as a decimal number using a 24-hour clock (range 00 to 23)</dd>
<dt>%I</dt> <dd>hour as a decimal number using a 12-hour clock (range 01 to 12)</dd>
<dt>%j</dt> <dd>day of the year as a decimal number (range 001 to 366)</dd>
<dt>%k</dt> <dd>hour as a decimal number using a 24-hour clock (range 0 to 23); single digits are preceded by a blank. (See also %H.)</dd>
<dt>%l</dt> <dd>hour as a decimal number using a 12-hour clock (range 1 to 12); single digits are preceded by a blank. (See also %I.) </dd>
<dt>%m</dt> <dd>month as a decimal number (range 01 to 12)</dd>
<dt>%M</dt> <dd>minute as a decimal number</dd>
<dt>%n</dt> <dd>newline character</dd>
<dt>%p</dt> <dd>either `AM' or `PM' according to the given time value, or the corresponding strings for the current locale</dd>
<dt>%P</dt> <dd>like %p, but lower case</dd>
<dt>%r</dt> <dd>time in a.m. and p.m. notation equal to %I:%M:%S %p</dd>
<dt>%R</dt> <dd>time in 24 hour notation equal to %H:%M</dd>
<dt>%s</dt> <dd>number of seconds since the Epoch, ie, since 1970-01-01 00:00:00 UTC</dd>
<dt>%S</dt> <dd>second as a decimal number</dd>
<dt>%t</dt> <dd>tab character</dd>
<dt>%T</dt> <dd>current time, equal to %H:%M:%S</dd>
<dt>%u</dt> <dd>weekday as a decimal number [1,7], with 1 representing Monday</dd>
<dt>%U</dt> <dd>week number of the current year as a decimal number, starting with the
first Sunday as the first day of the first week</dd>
<dt>%V</dt> <dd>The ISO 8601:1988 week number of the current year as a decimal number,
range 01 to 53, where week 1 is the first week that has at least 4 days
in the current year, and with Monday as the first day of the week.</dd>
<dt>%w</dt> <dd>day of the week as a decimal, Sunday being 0</dd>
<dt>%W</dt> <dd>week number of the current year as a decimal number, starting with the
first Monday as the first day of the first week</dd>
<dt>%x</dt> <dd>preferred date representation for the current locale without the time</dd>
<dt>%X</dt> <dd>preferred time representation for the current locale without the date</dd>
<dt>%y</dt> <dd>year as a decimal number without a century (range 00 to 99)</dd>
<dt>%Y</dt> <dd>year as a decimal number including the century</dd>
<dt>%z</dt> <dd>numerical time zone representation</dd>
<dt>%Z</dt> <dd>time zone name or abbreviation</dd>
<dt>%%</dt> <dd>a literal `%' character</dd>
</dl>
</dd>
</dl>
@param sLocale {String} (Optional) The locale to use when displaying days of week,
months of the year, and other locale specific strings. The following locales are
built in:
<dl>
<dt>en</dt>
<dd>English</dd>
<dt>en-US</dt>
<dd>US English</dd>
<dt>en-GB</dt>
<dd>British English</dd>
<dt>en-AU</dt>
<dd>Australian English (identical to British English)</dd>
</dl>
More locales may be added by subclassing of YAHOO.util.DateLocale.
See YAHOO.util.DateLocale for more information.
@return {String} Formatted date for display.
@sa YAHOO.util.DateLocale | [
"Takes",
"a",
"native",
"JavaScript",
"Date",
"and",
"formats",
"to",
"string",
"for",
"display",
"to",
"user",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/datasource/datasource-debug.js#L2906-L2968 |
|
42,267 | kurko/ember-json-api | dist/ember-json-api.js | function(typeName, id, snapshot) {
// FIXME If there is a record, try and look up the self link
// - Need to use the function from the serializer to build the self key
// TODO: this basically only works in the simplest of scenarios
var route = this.getRoute(typeName, id, snapshot);
if(!route) {
return this._super(typeName, id, snapshot);
}
var url = [];
var host = get(this, 'host');
var prefix = this.urlPrefix();
var param = /\{(.*?)\}/g;
if (id) {
if (param.test(route)) {
url.push(route.replace(param, id));
} else {
url.push(route);
}
} else {
url.push(route.replace(param, ''));
}
if (prefix) {
url.unshift(prefix);
}
url = url.join('/');
if (!host && url) {
url = '/' + url;
}
return url;
} | javascript | function(typeName, id, snapshot) {
// FIXME If there is a record, try and look up the self link
// - Need to use the function from the serializer to build the self key
// TODO: this basically only works in the simplest of scenarios
var route = this.getRoute(typeName, id, snapshot);
if(!route) {
return this._super(typeName, id, snapshot);
}
var url = [];
var host = get(this, 'host');
var prefix = this.urlPrefix();
var param = /\{(.*?)\}/g;
if (id) {
if (param.test(route)) {
url.push(route.replace(param, id));
} else {
url.push(route);
}
} else {
url.push(route.replace(param, ''));
}
if (prefix) {
url.unshift(prefix);
}
url = url.join('/');
if (!host && url) {
url = '/' + url;
}
return url;
} | [
"function",
"(",
"typeName",
",",
"id",
",",
"snapshot",
")",
"{",
"// FIXME If there is a record, try and look up the self link",
"// - Need to use the function from the serializer to build the self key",
"// TODO: this basically only works in the simplest of scenarios",
"var",
"route",
"=",
"this",
".",
"getRoute",
"(",
"typeName",
",",
"id",
",",
"snapshot",
")",
";",
"if",
"(",
"!",
"route",
")",
"{",
"return",
"this",
".",
"_super",
"(",
"typeName",
",",
"id",
",",
"snapshot",
")",
";",
"}",
"var",
"url",
"=",
"[",
"]",
";",
"var",
"host",
"=",
"get",
"(",
"this",
",",
"'host'",
")",
";",
"var",
"prefix",
"=",
"this",
".",
"urlPrefix",
"(",
")",
";",
"var",
"param",
"=",
"/",
"\\{(.*?)\\}",
"/",
"g",
";",
"if",
"(",
"id",
")",
"{",
"if",
"(",
"param",
".",
"test",
"(",
"route",
")",
")",
"{",
"url",
".",
"push",
"(",
"route",
".",
"replace",
"(",
"param",
",",
"id",
")",
")",
";",
"}",
"else",
"{",
"url",
".",
"push",
"(",
"route",
")",
";",
"}",
"}",
"else",
"{",
"url",
".",
"push",
"(",
"route",
".",
"replace",
"(",
"param",
",",
"''",
")",
")",
";",
"}",
"if",
"(",
"prefix",
")",
"{",
"url",
".",
"unshift",
"(",
"prefix",
")",
";",
"}",
"url",
"=",
"url",
".",
"join",
"(",
"'/'",
")",
";",
"if",
"(",
"!",
"host",
"&&",
"url",
")",
"{",
"url",
"=",
"'/'",
"+",
"url",
";",
"}",
"return",
"url",
";",
"}"
]
| Look up routes based on top-level links. | [
"Look",
"up",
"routes",
"based",
"on",
"top",
"-",
"level",
"links",
"."
]
| 752003a26df5e5cb6ddfcce3526f9925d7cdb3d9 | https://github.com/kurko/ember-json-api/blob/752003a26df5e5cb6ddfcce3526f9925d7cdb3d9/dist/ember-json-api.js#L44-L79 |
|
42,268 | kurko/ember-json-api | dist/ember-json-api.js | function(store, type, ids, snapshots) {
return this.ajax(this.buildURL(type.modelName, ids.join(','), snapshots, 'findMany'), 'GET');
} | javascript | function(store, type, ids, snapshots) {
return this.ajax(this.buildURL(type.modelName, ids.join(','), snapshots, 'findMany'), 'GET');
} | [
"function",
"(",
"store",
",",
"type",
",",
"ids",
",",
"snapshots",
")",
"{",
"return",
"this",
".",
"ajax",
"(",
"this",
".",
"buildURL",
"(",
"type",
".",
"modelName",
",",
"ids",
".",
"join",
"(",
"','",
")",
",",
"snapshots",
",",
"'findMany'",
")",
",",
"'GET'",
")",
";",
"}"
]
| Fix query URL. | [
"Fix",
"query",
"URL",
"."
]
| 752003a26df5e5cb6ddfcce3526f9925d7cdb3d9 | https://github.com/kurko/ember-json-api/blob/752003a26df5e5cb6ddfcce3526f9925d7cdb3d9/dist/ember-json-api.js#L84-L86 |
|
42,269 | kurko/ember-json-api | dist/ember-json-api.js | function(payload) {
if(!payload) {
return {};
}
var data = payload[this.primaryRecordKey];
if (data) {
if (Ember.isArray(data)) {
this.extractArrayData(data, payload);
} else {
this.extractSingleData(data, payload);
}
delete payload[this.primaryRecordKey];
}
if (payload.meta) {
this.extractMeta(payload.meta);
delete payload.meta;
}
if (payload.links) {
// FIXME Need to handle top level links, like pagination
delete payload.links;
}
if (payload[this.sideloadedRecordsKey]) {
this.extractSideloaded(payload[this.sideloadedRecordsKey]);
delete payload[this.sideloadedRecordsKey];
}
return payload;
} | javascript | function(payload) {
if(!payload) {
return {};
}
var data = payload[this.primaryRecordKey];
if (data) {
if (Ember.isArray(data)) {
this.extractArrayData(data, payload);
} else {
this.extractSingleData(data, payload);
}
delete payload[this.primaryRecordKey];
}
if (payload.meta) {
this.extractMeta(payload.meta);
delete payload.meta;
}
if (payload.links) {
// FIXME Need to handle top level links, like pagination
delete payload.links;
}
if (payload[this.sideloadedRecordsKey]) {
this.extractSideloaded(payload[this.sideloadedRecordsKey]);
delete payload[this.sideloadedRecordsKey];
}
return payload;
} | [
"function",
"(",
"payload",
")",
"{",
"if",
"(",
"!",
"payload",
")",
"{",
"return",
"{",
"}",
";",
"}",
"var",
"data",
"=",
"payload",
"[",
"this",
".",
"primaryRecordKey",
"]",
";",
"if",
"(",
"data",
")",
"{",
"if",
"(",
"Ember",
".",
"isArray",
"(",
"data",
")",
")",
"{",
"this",
".",
"extractArrayData",
"(",
"data",
",",
"payload",
")",
";",
"}",
"else",
"{",
"this",
".",
"extractSingleData",
"(",
"data",
",",
"payload",
")",
";",
"}",
"delete",
"payload",
"[",
"this",
".",
"primaryRecordKey",
"]",
";",
"}",
"if",
"(",
"payload",
".",
"meta",
")",
"{",
"this",
".",
"extractMeta",
"(",
"payload",
".",
"meta",
")",
";",
"delete",
"payload",
".",
"meta",
";",
"}",
"if",
"(",
"payload",
".",
"links",
")",
"{",
"// FIXME Need to handle top level links, like pagination",
"delete",
"payload",
".",
"links",
";",
"}",
"if",
"(",
"payload",
"[",
"this",
".",
"sideloadedRecordsKey",
"]",
")",
"{",
"this",
".",
"extractSideloaded",
"(",
"payload",
"[",
"this",
".",
"sideloadedRecordsKey",
"]",
")",
";",
"delete",
"payload",
"[",
"this",
".",
"sideloadedRecordsKey",
"]",
";",
"}",
"return",
"payload",
";",
"}"
]
| Extract top-level "meta" & "links" before normalizing. | [
"Extract",
"top",
"-",
"level",
"meta",
"&",
"links",
"before",
"normalizing",
"."
]
| 752003a26df5e5cb6ddfcce3526f9925d7cdb3d9 | https://github.com/kurko/ember-json-api/blob/752003a26df5e5cb6ddfcce3526f9925d7cdb3d9/dist/ember-json-api.js#L270-L298 |
|
42,270 | kurko/ember-json-api | dist/ember-json-api.js | function(sideloaded) {
var store = get(this, 'store');
var models = {};
var serializer = this;
sideloaded.forEach(function(link) {
var type = link.type;
if (link.relationships) {
serializer.extractRelationships(link.relationships, link);
}
delete link.type;
if (!models[type]) {
models[type] = [];
}
models[type].push(link);
});
this.pushPayload(store, models);
} | javascript | function(sideloaded) {
var store = get(this, 'store');
var models = {};
var serializer = this;
sideloaded.forEach(function(link) {
var type = link.type;
if (link.relationships) {
serializer.extractRelationships(link.relationships, link);
}
delete link.type;
if (!models[type]) {
models[type] = [];
}
models[type].push(link);
});
this.pushPayload(store, models);
} | [
"function",
"(",
"sideloaded",
")",
"{",
"var",
"store",
"=",
"get",
"(",
"this",
",",
"'store'",
")",
";",
"var",
"models",
"=",
"{",
"}",
";",
"var",
"serializer",
"=",
"this",
";",
"sideloaded",
".",
"forEach",
"(",
"function",
"(",
"link",
")",
"{",
"var",
"type",
"=",
"link",
".",
"type",
";",
"if",
"(",
"link",
".",
"relationships",
")",
"{",
"serializer",
".",
"extractRelationships",
"(",
"link",
".",
"relationships",
",",
"link",
")",
";",
"}",
"delete",
"link",
".",
"type",
";",
"if",
"(",
"!",
"models",
"[",
"type",
"]",
")",
"{",
"models",
"[",
"type",
"]",
"=",
"[",
"]",
";",
"}",
"models",
"[",
"type",
"]",
".",
"push",
"(",
"link",
")",
";",
"}",
")",
";",
"this",
".",
"pushPayload",
"(",
"store",
",",
"models",
")",
";",
"}"
]
| Extract top-level "included" containing associated objects | [
"Extract",
"top",
"-",
"level",
"included",
"containing",
"associated",
"objects"
]
| 752003a26df5e5cb6ddfcce3526f9925d7cdb3d9 | https://github.com/kurko/ember-json-api/blob/752003a26df5e5cb6ddfcce3526f9925d7cdb3d9/dist/ember-json-api.js#L336-L354 |
|
42,271 | kurko/ember-json-api | dist/ember-json-api.js | function(links, resource) {
var link, association, id, route, relationshipLink, cleanedRoute;
// Clear the old format
resource.links = {};
for (link in links) {
association = links[link];
link = Ember.String.camelize(link.split('.').pop());
if(!association) {
continue;
}
if (typeof association === 'string') {
if (association.indexOf('/') > -1) {
route = association;
id = null;
} else { // This is no longer valid in JSON API. Potentially remove.
route = null;
id = association;
}
relationshipLink = null;
} else {
if (association.links) {
relationshipLink = association.links[this.relationshipKey];
route = association.links[this.relatedResourceKey];
}
id = getLinkageId(association.data);
}
if (route) {
cleanedRoute = this.removeHost(route);
resource.links[link] = cleanedRoute;
// Need clarification on how this is used
if (cleanedRoute.indexOf('{') > -1) {
DS._routes[link] = cleanedRoute.replace(/^\//, '');
}
}
if (id) {
resource[link] = id;
}
}
return resource.links;
} | javascript | function(links, resource) {
var link, association, id, route, relationshipLink, cleanedRoute;
// Clear the old format
resource.links = {};
for (link in links) {
association = links[link];
link = Ember.String.camelize(link.split('.').pop());
if(!association) {
continue;
}
if (typeof association === 'string') {
if (association.indexOf('/') > -1) {
route = association;
id = null;
} else { // This is no longer valid in JSON API. Potentially remove.
route = null;
id = association;
}
relationshipLink = null;
} else {
if (association.links) {
relationshipLink = association.links[this.relationshipKey];
route = association.links[this.relatedResourceKey];
}
id = getLinkageId(association.data);
}
if (route) {
cleanedRoute = this.removeHost(route);
resource.links[link] = cleanedRoute;
// Need clarification on how this is used
if (cleanedRoute.indexOf('{') > -1) {
DS._routes[link] = cleanedRoute.replace(/^\//, '');
}
}
if (id) {
resource[link] = id;
}
}
return resource.links;
} | [
"function",
"(",
"links",
",",
"resource",
")",
"{",
"var",
"link",
",",
"association",
",",
"id",
",",
"route",
",",
"relationshipLink",
",",
"cleanedRoute",
";",
"// Clear the old format",
"resource",
".",
"links",
"=",
"{",
"}",
";",
"for",
"(",
"link",
"in",
"links",
")",
"{",
"association",
"=",
"links",
"[",
"link",
"]",
";",
"link",
"=",
"Ember",
".",
"String",
".",
"camelize",
"(",
"link",
".",
"split",
"(",
"'.'",
")",
".",
"pop",
"(",
")",
")",
";",
"if",
"(",
"!",
"association",
")",
"{",
"continue",
";",
"}",
"if",
"(",
"typeof",
"association",
"===",
"'string'",
")",
"{",
"if",
"(",
"association",
".",
"indexOf",
"(",
"'/'",
")",
">",
"-",
"1",
")",
"{",
"route",
"=",
"association",
";",
"id",
"=",
"null",
";",
"}",
"else",
"{",
"// This is no longer valid in JSON API. Potentially remove.",
"route",
"=",
"null",
";",
"id",
"=",
"association",
";",
"}",
"relationshipLink",
"=",
"null",
";",
"}",
"else",
"{",
"if",
"(",
"association",
".",
"links",
")",
"{",
"relationshipLink",
"=",
"association",
".",
"links",
"[",
"this",
".",
"relationshipKey",
"]",
";",
"route",
"=",
"association",
".",
"links",
"[",
"this",
".",
"relatedResourceKey",
"]",
";",
"}",
"id",
"=",
"getLinkageId",
"(",
"association",
".",
"data",
")",
";",
"}",
"if",
"(",
"route",
")",
"{",
"cleanedRoute",
"=",
"this",
".",
"removeHost",
"(",
"route",
")",
";",
"resource",
".",
"links",
"[",
"link",
"]",
"=",
"cleanedRoute",
";",
"// Need clarification on how this is used",
"if",
"(",
"cleanedRoute",
".",
"indexOf",
"(",
"'{'",
")",
">",
"-",
"1",
")",
"{",
"DS",
".",
"_routes",
"[",
"link",
"]",
"=",
"cleanedRoute",
".",
"replace",
"(",
"/",
"^\\/",
"/",
",",
"''",
")",
";",
"}",
"}",
"if",
"(",
"id",
")",
"{",
"resource",
"[",
"link",
"]",
"=",
"id",
";",
"}",
"}",
"return",
"resource",
".",
"links",
";",
"}"
]
| Parse the top-level "links" object. | [
"Parse",
"the",
"top",
"-",
"level",
"links",
"object",
"."
]
| 752003a26df5e5cb6ddfcce3526f9925d7cdb3d9 | https://github.com/kurko/ember-json-api/blob/752003a26df5e5cb6ddfcce3526f9925d7cdb3d9/dist/ember-json-api.js#L359-L404 |
|
42,272 | kurko/ember-json-api | dist/ember-json-api.js | function(record, json, relationship) {
var attr = relationship.key;
var belongsTo = record.belongsTo(attr);
var type, key;
if (isNone(belongsTo)) {
return;
}
type = this.keyForSnapshot(belongsTo);
key = this.keyForRelationship(attr);
if (!json.links) {
json.links = json.relationships || {};
}
json.links[key] = belongsToLink(key, type, get(belongsTo, 'id'));
} | javascript | function(record, json, relationship) {
var attr = relationship.key;
var belongsTo = record.belongsTo(attr);
var type, key;
if (isNone(belongsTo)) {
return;
}
type = this.keyForSnapshot(belongsTo);
key = this.keyForRelationship(attr);
if (!json.links) {
json.links = json.relationships || {};
}
json.links[key] = belongsToLink(key, type, get(belongsTo, 'id'));
} | [
"function",
"(",
"record",
",",
"json",
",",
"relationship",
")",
"{",
"var",
"attr",
"=",
"relationship",
".",
"key",
";",
"var",
"belongsTo",
"=",
"record",
".",
"belongsTo",
"(",
"attr",
")",
";",
"var",
"type",
",",
"key",
";",
"if",
"(",
"isNone",
"(",
"belongsTo",
")",
")",
"{",
"return",
";",
"}",
"type",
"=",
"this",
".",
"keyForSnapshot",
"(",
"belongsTo",
")",
";",
"key",
"=",
"this",
".",
"keyForRelationship",
"(",
"attr",
")",
";",
"if",
"(",
"!",
"json",
".",
"links",
")",
"{",
"json",
".",
"links",
"=",
"json",
".",
"relationships",
"||",
"{",
"}",
";",
"}",
"json",
".",
"links",
"[",
"key",
"]",
"=",
"belongsToLink",
"(",
"key",
",",
"type",
",",
"get",
"(",
"belongsTo",
",",
"'id'",
")",
")",
";",
"}"
]
| Use "links" key, remove support for polymorphic type | [
"Use",
"links",
"key",
"remove",
"support",
"for",
"polymorphic",
"type"
]
| 752003a26df5e5cb6ddfcce3526f9925d7cdb3d9 | https://github.com/kurko/ember-json-api/blob/752003a26df5e5cb6ddfcce3526f9925d7cdb3d9/dist/ember-json-api.js#L463-L479 |
|
42,273 | kurko/ember-json-api | dist/ember-json-api.js | function(record, json, relationship) {
var attr = relationship.key;
var type = this.keyForRelationship(relationship.type);
var key = this.keyForRelationship(attr);
if (relationship.kind === 'hasMany') {
json.relationships = json.relationships || {};
json.relationships[key] = hasManyLink(key, type, record, attr);
}
} | javascript | function(record, json, relationship) {
var attr = relationship.key;
var type = this.keyForRelationship(relationship.type);
var key = this.keyForRelationship(attr);
if (relationship.kind === 'hasMany') {
json.relationships = json.relationships || {};
json.relationships[key] = hasManyLink(key, type, record, attr);
}
} | [
"function",
"(",
"record",
",",
"json",
",",
"relationship",
")",
"{",
"var",
"attr",
"=",
"relationship",
".",
"key",
";",
"var",
"type",
"=",
"this",
".",
"keyForRelationship",
"(",
"relationship",
".",
"type",
")",
";",
"var",
"key",
"=",
"this",
".",
"keyForRelationship",
"(",
"attr",
")",
";",
"if",
"(",
"relationship",
".",
"kind",
"===",
"'hasMany'",
")",
"{",
"json",
".",
"relationships",
"=",
"json",
".",
"relationships",
"||",
"{",
"}",
";",
"json",
".",
"relationships",
"[",
"key",
"]",
"=",
"hasManyLink",
"(",
"key",
",",
"type",
",",
"record",
",",
"attr",
")",
";",
"}",
"}"
]
| Use "links" key | [
"Use",
"links",
"key"
]
| 752003a26df5e5cb6ddfcce3526f9925d7cdb3d9 | https://github.com/kurko/ember-json-api/blob/752003a26df5e5cb6ddfcce3526f9925d7cdb3d9/dist/ember-json-api.js#L484-L493 |
|
42,274 | bengfarrell/nuimotion | quickstart/websocketquickstart.js | onSkeletonUpdate | function onSkeletonUpdate(skeleton) {
for (var c in connections) {
connections[c].sendUTF(JSON.stringify(skeleton));
}
} | javascript | function onSkeletonUpdate(skeleton) {
for (var c in connections) {
connections[c].sendUTF(JSON.stringify(skeleton));
}
} | [
"function",
"onSkeletonUpdate",
"(",
"skeleton",
")",
"{",
"for",
"(",
"var",
"c",
"in",
"connections",
")",
"{",
"connections",
"[",
"c",
"]",
".",
"sendUTF",
"(",
"JSON",
".",
"stringify",
"(",
"skeleton",
")",
")",
";",
"}",
"}"
]
| skeleton update callback
@param skeleton | [
"skeleton",
"update",
"callback"
]
| 7117c251389b68e2e5d1b8fb8fb1ccd0550b5a77 | https://github.com/bengfarrell/nuimotion/blob/7117c251389b68e2e5d1b8fb8fb1ccd0550b5a77/quickstart/websocketquickstart.js#L30-L34 |
42,275 | bengfarrell/nuimotion | quickstart/websocketquickstart.js | onMessage | function onMessage(data) {
if (data.type == "utf8") {
message = JSON.parse(data.utf8Data);
switch (message.command) {
case "setJoints":
console.log("Client has request to add joints: " + message.data);
nuimotion.jointsTracking = message.data;
break;
case "addListener":
console.log("Client has request to add events: " + message.data);
if (!nuimotion._eventCallbackDict[message.data]) {
nuimotion.addListener(message.data, onEvent);
}
break;
case "addGesture":
console.log("Client has request to add gestures: " + message.data);
if (!nuimotion._gestureCallbackDict[message.data]) {
nuimotion.addGesture(message.data, onEvent);
}
break;
}
}
} | javascript | function onMessage(data) {
if (data.type == "utf8") {
message = JSON.parse(data.utf8Data);
switch (message.command) {
case "setJoints":
console.log("Client has request to add joints: " + message.data);
nuimotion.jointsTracking = message.data;
break;
case "addListener":
console.log("Client has request to add events: " + message.data);
if (!nuimotion._eventCallbackDict[message.data]) {
nuimotion.addListener(message.data, onEvent);
}
break;
case "addGesture":
console.log("Client has request to add gestures: " + message.data);
if (!nuimotion._gestureCallbackDict[message.data]) {
nuimotion.addGesture(message.data, onEvent);
}
break;
}
}
} | [
"function",
"onMessage",
"(",
"data",
")",
"{",
"if",
"(",
"data",
".",
"type",
"==",
"\"utf8\"",
")",
"{",
"message",
"=",
"JSON",
".",
"parse",
"(",
"data",
".",
"utf8Data",
")",
";",
"switch",
"(",
"message",
".",
"command",
")",
"{",
"case",
"\"setJoints\"",
":",
"console",
".",
"log",
"(",
"\"Client has request to add joints: \"",
"+",
"message",
".",
"data",
")",
";",
"nuimotion",
".",
"jointsTracking",
"=",
"message",
".",
"data",
";",
"break",
";",
"case",
"\"addListener\"",
":",
"console",
".",
"log",
"(",
"\"Client has request to add events: \"",
"+",
"message",
".",
"data",
")",
";",
"if",
"(",
"!",
"nuimotion",
".",
"_eventCallbackDict",
"[",
"message",
".",
"data",
"]",
")",
"{",
"nuimotion",
".",
"addListener",
"(",
"message",
".",
"data",
",",
"onEvent",
")",
";",
"}",
"break",
";",
"case",
"\"addGesture\"",
":",
"console",
".",
"log",
"(",
"\"Client has request to add gestures: \"",
"+",
"message",
".",
"data",
")",
";",
"if",
"(",
"!",
"nuimotion",
".",
"_gestureCallbackDict",
"[",
"message",
".",
"data",
"]",
")",
"{",
"nuimotion",
".",
"addGesture",
"(",
"message",
".",
"data",
",",
"onEvent",
")",
";",
"}",
"break",
";",
"}",
"}",
"}"
]
| on message recieved from client
@param data | [
"on",
"message",
"recieved",
"from",
"client"
]
| 7117c251389b68e2e5d1b8fb8fb1ccd0550b5a77 | https://github.com/bengfarrell/nuimotion/blob/7117c251389b68e2e5d1b8fb8fb1ccd0550b5a77/quickstart/websocketquickstart.js#L55-L79 |
42,276 | neyric/webhookit | public/javascripts/WireIt/plugins/grouping/examples/sawire/xslt.js | xsltChildNodes | function xsltChildNodes(input, template, output) {
// Clone input context to keep variables declared here local to the
// siblings of the children.
var context = input.clone();
for (var i = 0; i < template.childNodes.length; ++i) {
xsltProcessContext(context, template.childNodes[i], output);
}
} | javascript | function xsltChildNodes(input, template, output) {
// Clone input context to keep variables declared here local to the
// siblings of the children.
var context = input.clone();
for (var i = 0; i < template.childNodes.length; ++i) {
xsltProcessContext(context, template.childNodes[i], output);
}
} | [
"function",
"xsltChildNodes",
"(",
"input",
",",
"template",
",",
"output",
")",
"{",
"// Clone input context to keep variables declared here local to the",
"// siblings of the children.",
"var",
"context",
"=",
"input",
".",
"clone",
"(",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"template",
".",
"childNodes",
".",
"length",
";",
"++",
"i",
")",
"{",
"xsltProcessContext",
"(",
"context",
",",
"template",
".",
"childNodes",
"[",
"i",
"]",
",",
"output",
")",
";",
"}",
"}"
]
| Traverses the template node tree. Calls the main processing function with the current input context for every child node of the current template node. | [
"Traverses",
"the",
"template",
"node",
"tree",
".",
"Calls",
"the",
"main",
"processing",
"function",
"with",
"the",
"current",
"input",
"context",
"for",
"every",
"child",
"node",
"of",
"the",
"current",
"template",
"node",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/WireIt/plugins/grouping/examples/sawire/xslt.js#L406-L413 |
42,277 | neyric/webhookit | public/javascripts/codemirror/js/undo.js | function() {
// Make sure pending changes have been committed.
this.commit();
if (this.history.length) {
// Take the top diff from the history, apply it, and store its
// shadow in the redo history.
var item = this.history.pop();
this.redoHistory.push(this.updateTo(item, "applyChain"));
this.notifyEnvironment();
return this.chainNode(item);
}
} | javascript | function() {
// Make sure pending changes have been committed.
this.commit();
if (this.history.length) {
// Take the top diff from the history, apply it, and store its
// shadow in the redo history.
var item = this.history.pop();
this.redoHistory.push(this.updateTo(item, "applyChain"));
this.notifyEnvironment();
return this.chainNode(item);
}
} | [
"function",
"(",
")",
"{",
"// Make sure pending changes have been committed.",
"this",
".",
"commit",
"(",
")",
";",
"if",
"(",
"this",
".",
"history",
".",
"length",
")",
"{",
"// Take the top diff from the history, apply it, and store its",
"// shadow in the redo history.",
"var",
"item",
"=",
"this",
".",
"history",
".",
"pop",
"(",
")",
";",
"this",
".",
"redoHistory",
".",
"push",
"(",
"this",
".",
"updateTo",
"(",
"item",
",",
"\"applyChain\"",
")",
")",
";",
"this",
".",
"notifyEnvironment",
"(",
")",
";",
"return",
"this",
".",
"chainNode",
"(",
"item",
")",
";",
"}",
"}"
]
| Undo the last change. | [
"Undo",
"the",
"last",
"change",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/undo.js#L66-L78 |
|
42,278 | neyric/webhookit | public/javascripts/codemirror/js/undo.js | function() {
this.commit();
if (this.redoHistory.length) {
// The inverse of undo, basically.
var item = this.redoHistory.pop();
this.addUndoLevel(this.updateTo(item, "applyChain"));
this.notifyEnvironment();
return this.chainNode(item);
}
} | javascript | function() {
this.commit();
if (this.redoHistory.length) {
// The inverse of undo, basically.
var item = this.redoHistory.pop();
this.addUndoLevel(this.updateTo(item, "applyChain"));
this.notifyEnvironment();
return this.chainNode(item);
}
} | [
"function",
"(",
")",
"{",
"this",
".",
"commit",
"(",
")",
";",
"if",
"(",
"this",
".",
"redoHistory",
".",
"length",
")",
"{",
"// The inverse of undo, basically.",
"var",
"item",
"=",
"this",
".",
"redoHistory",
".",
"pop",
"(",
")",
";",
"this",
".",
"addUndoLevel",
"(",
"this",
".",
"updateTo",
"(",
"item",
",",
"\"applyChain\"",
")",
")",
";",
"this",
".",
"notifyEnvironment",
"(",
")",
";",
"return",
"this",
".",
"chainNode",
"(",
"item",
")",
";",
"}",
"}"
]
| Redo the last undone change. | [
"Redo",
"the",
"last",
"undone",
"change",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/undo.js#L81-L90 |
|
42,279 | neyric/webhookit | public/javascripts/codemirror/js/undo.js | function(from, to, lines) {
var chain = [];
for (var i = 0; i < lines.length; i++) {
var end = (i == lines.length - 1) ? to : this.container.ownerDocument.createElement("BR");
chain.push({from: from, to: end, text: cleanText(lines[i])});
from = end;
}
this.pushChains([chain], from == null && to == null);
this.notifyEnvironment();
} | javascript | function(from, to, lines) {
var chain = [];
for (var i = 0; i < lines.length; i++) {
var end = (i == lines.length - 1) ? to : this.container.ownerDocument.createElement("BR");
chain.push({from: from, to: end, text: cleanText(lines[i])});
from = end;
}
this.pushChains([chain], from == null && to == null);
this.notifyEnvironment();
} | [
"function",
"(",
"from",
",",
"to",
",",
"lines",
")",
"{",
"var",
"chain",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"lines",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
"end",
"=",
"(",
"i",
"==",
"lines",
".",
"length",
"-",
"1",
")",
"?",
"to",
":",
"this",
".",
"container",
".",
"ownerDocument",
".",
"createElement",
"(",
"\"BR\"",
")",
";",
"chain",
".",
"push",
"(",
"{",
"from",
":",
"from",
",",
"to",
":",
"end",
",",
"text",
":",
"cleanText",
"(",
"lines",
"[",
"i",
"]",
")",
"}",
")",
";",
"from",
"=",
"end",
";",
"}",
"this",
".",
"pushChains",
"(",
"[",
"chain",
"]",
",",
"from",
"==",
"null",
"&&",
"to",
"==",
"null",
")",
";",
"this",
".",
"notifyEnvironment",
"(",
")",
";",
"}"
]
| Push a changeset into the document. | [
"Push",
"a",
"changeset",
"into",
"the",
"document",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/undo.js#L103-L112 |
|
42,280 | neyric/webhookit | public/javascripts/codemirror/js/undo.js | function(doNotHighlight) {
this.parent.clearTimeout(this.commitTimeout);
// Make sure there are no pending dirty nodes.
if (!doNotHighlight) this.editor.highlightDirty(true);
// Build set of chains.
var chains = this.touchedChains(), self = this;
if (chains.length) {
this.addUndoLevel(this.updateTo(chains, "linkChain"));
this.redoHistory = [];
this.notifyEnvironment();
}
} | javascript | function(doNotHighlight) {
this.parent.clearTimeout(this.commitTimeout);
// Make sure there are no pending dirty nodes.
if (!doNotHighlight) this.editor.highlightDirty(true);
// Build set of chains.
var chains = this.touchedChains(), self = this;
if (chains.length) {
this.addUndoLevel(this.updateTo(chains, "linkChain"));
this.redoHistory = [];
this.notifyEnvironment();
}
} | [
"function",
"(",
"doNotHighlight",
")",
"{",
"this",
".",
"parent",
".",
"clearTimeout",
"(",
"this",
".",
"commitTimeout",
")",
";",
"// Make sure there are no pending dirty nodes.",
"if",
"(",
"!",
"doNotHighlight",
")",
"this",
".",
"editor",
".",
"highlightDirty",
"(",
"true",
")",
";",
"// Build set of chains.",
"var",
"chains",
"=",
"this",
".",
"touchedChains",
"(",
")",
",",
"self",
"=",
"this",
";",
"if",
"(",
"chains",
".",
"length",
")",
"{",
"this",
".",
"addUndoLevel",
"(",
"this",
".",
"updateTo",
"(",
"chains",
",",
"\"linkChain\"",
")",
")",
";",
"this",
".",
"redoHistory",
"=",
"[",
"]",
";",
"this",
".",
"notifyEnvironment",
"(",
")",
";",
"}",
"}"
]
| Check whether the touched nodes hold any changes, if so, commit them. | [
"Check",
"whether",
"the",
"touched",
"nodes",
"hold",
"any",
"changes",
"if",
"so",
"commit",
"them",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/undo.js#L155-L167 |
|
42,281 | neyric/webhookit | public/javascripts/codemirror/js/undo.js | function(chains, updateFunc) {
var shadows = [], dirty = [];
for (var i = 0; i < chains.length; i++) {
shadows.push(this.shadowChain(chains[i]));
dirty.push(this[updateFunc](chains[i]));
}
if (updateFunc == "applyChain")
this.notifyDirty(dirty);
return shadows;
} | javascript | function(chains, updateFunc) {
var shadows = [], dirty = [];
for (var i = 0; i < chains.length; i++) {
shadows.push(this.shadowChain(chains[i]));
dirty.push(this[updateFunc](chains[i]));
}
if (updateFunc == "applyChain")
this.notifyDirty(dirty);
return shadows;
} | [
"function",
"(",
"chains",
",",
"updateFunc",
")",
"{",
"var",
"shadows",
"=",
"[",
"]",
",",
"dirty",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"chains",
".",
"length",
";",
"i",
"++",
")",
"{",
"shadows",
".",
"push",
"(",
"this",
".",
"shadowChain",
"(",
"chains",
"[",
"i",
"]",
")",
")",
";",
"dirty",
".",
"push",
"(",
"this",
"[",
"updateFunc",
"]",
"(",
"chains",
"[",
"i",
"]",
")",
")",
";",
"}",
"if",
"(",
"updateFunc",
"==",
"\"applyChain\"",
")",
"this",
".",
"notifyDirty",
"(",
"dirty",
")",
";",
"return",
"shadows",
";",
"}"
]
| Update the document with a given set of chains, return its shadow. updateFunc should be "applyChain" or "linkChain". In the second case, the chains are taken to correspond the the current document, and only the state of the line data is updated. In the first case, the content of the chains is also pushed iinto the document. | [
"Update",
"the",
"document",
"with",
"a",
"given",
"set",
"of",
"chains",
"return",
"its",
"shadow",
".",
"updateFunc",
"should",
"be",
"applyChain",
"or",
"linkChain",
".",
"In",
"the",
"second",
"case",
"the",
"chains",
"are",
"taken",
"to",
"correspond",
"the",
"the",
"current",
"document",
"and",
"only",
"the",
"state",
"of",
"the",
"line",
"data",
"is",
"updated",
".",
"In",
"the",
"first",
"case",
"the",
"content",
"of",
"the",
"chains",
"is",
"also",
"pushed",
"iinto",
"the",
"document",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/undo.js#L177-L186 |
|
42,282 | neyric/webhookit | public/javascripts/codemirror/js/undo.js | function(node) {
if (node) {
if (!node.historyTouched) {
this.touched.push(node);
node.historyTouched = true;
}
}
else {
this.firstTouched = true;
}
} | javascript | function(node) {
if (node) {
if (!node.historyTouched) {
this.touched.push(node);
node.historyTouched = true;
}
}
else {
this.firstTouched = true;
}
} | [
"function",
"(",
"node",
")",
"{",
"if",
"(",
"node",
")",
"{",
"if",
"(",
"!",
"node",
".",
"historyTouched",
")",
"{",
"this",
".",
"touched",
".",
"push",
"(",
"node",
")",
";",
"node",
".",
"historyTouched",
"=",
"true",
";",
"}",
"}",
"else",
"{",
"this",
".",
"firstTouched",
"=",
"true",
";",
"}",
"}"
]
| Mark a node as touched if it has not already been marked. | [
"Mark",
"a",
"node",
"as",
"touched",
"if",
"it",
"has",
"not",
"already",
"been",
"marked",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/undo.js#L222-L232 |
|
42,283 | neyric/webhookit | public/javascripts/codemirror/js/undo.js | function(chain) {
var shadows = [], next = this.after(chain[0].from), end = chain[chain.length - 1].to;
while (true) {
shadows.push(next);
var nextNode = next.to;
if (!nextNode || nextNode == end)
break;
else
next = nextNode.historyAfter || this.before(end);
// (The this.before(end) is a hack -- FF sometimes removes
// properties from BR nodes, in which case the best we can hope
// for is to not break.)
}
return shadows;
} | javascript | function(chain) {
var shadows = [], next = this.after(chain[0].from), end = chain[chain.length - 1].to;
while (true) {
shadows.push(next);
var nextNode = next.to;
if (!nextNode || nextNode == end)
break;
else
next = nextNode.historyAfter || this.before(end);
// (The this.before(end) is a hack -- FF sometimes removes
// properties from BR nodes, in which case the best we can hope
// for is to not break.)
}
return shadows;
} | [
"function",
"(",
"chain",
")",
"{",
"var",
"shadows",
"=",
"[",
"]",
",",
"next",
"=",
"this",
".",
"after",
"(",
"chain",
"[",
"0",
"]",
".",
"from",
")",
",",
"end",
"=",
"chain",
"[",
"chain",
".",
"length",
"-",
"1",
"]",
".",
"to",
";",
"while",
"(",
"true",
")",
"{",
"shadows",
".",
"push",
"(",
"next",
")",
";",
"var",
"nextNode",
"=",
"next",
".",
"to",
";",
"if",
"(",
"!",
"nextNode",
"||",
"nextNode",
"==",
"end",
")",
"break",
";",
"else",
"next",
"=",
"nextNode",
".",
"historyAfter",
"||",
"this",
".",
"before",
"(",
"end",
")",
";",
"// (The this.before(end) is a hack -- FF sometimes removes",
"// properties from BR nodes, in which case the best we can hope",
"// for is to not break.)",
"}",
"return",
"shadows",
";",
"}"
]
| Find the 'shadow' of a given chain by following the links in the DOM nodes at its start and end. | [
"Find",
"the",
"shadow",
"of",
"a",
"given",
"chain",
"by",
"following",
"the",
"links",
"in",
"the",
"DOM",
"nodes",
"at",
"its",
"start",
"and",
"end",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/undo.js#L335-L349 |
|
42,284 | neyric/webhookit | public/javascripts/codemirror/js/undo.js | function(chain) {
// Some attempt is made to prevent the cursor from jumping
// randomly when an undo or redo happens. It still behaves a bit
// strange sometimes.
var cursor = select.cursorPos(this.container, false), self = this;
// Remove all nodes in the DOM tree between from and to (null for
// start/end of container).
function removeRange(from, to) {
var pos = from ? from.nextSibling : self.container.firstChild;
while (pos != to) {
var temp = pos.nextSibling;
removeElement(pos);
pos = temp;
}
}
var start = chain[0].from, end = chain[chain.length - 1].to;
// Clear the space where this change has to be made.
removeRange(start, end);
// Insert the content specified by the chain into the DOM tree.
for (var i = 0; i < chain.length; i++) {
var line = chain[i];
// The start and end of the space are already correct, but BR
// tags inside it have to be put back.
if (i > 0)
self.container.insertBefore(line.from, end);
// Add the text.
var node = makePartSpan(fixSpaces(line.text), this.container.ownerDocument);
self.container.insertBefore(node, end);
// See if the cursor was on this line. Put it back, adjusting
// for changed line length, if it was.
if (cursor && cursor.node == line.from) {
var cursordiff = 0;
var prev = this.after(line.from);
if (prev && i == chain.length - 1) {
// Only adjust if the cursor is after the unchanged part of
// the line.
for (var match = 0; match < cursor.offset &&
line.text.charAt(match) == prev.text.charAt(match); match++);
if (cursor.offset > match)
cursordiff = line.text.length - prev.text.length;
}
select.setCursorPos(this.container, {node: line.from, offset: Math.max(0, cursor.offset + cursordiff)});
}
// Cursor was in removed line, this is last new line.
else if (cursor && (i == chain.length - 1) && cursor.node && cursor.node.parentNode != this.container) {
select.setCursorPos(this.container, {node: line.from, offset: line.text.length});
}
}
// Anchor the chain in the DOM tree.
this.linkChain(chain);
return start;
} | javascript | function(chain) {
// Some attempt is made to prevent the cursor from jumping
// randomly when an undo or redo happens. It still behaves a bit
// strange sometimes.
var cursor = select.cursorPos(this.container, false), self = this;
// Remove all nodes in the DOM tree between from and to (null for
// start/end of container).
function removeRange(from, to) {
var pos = from ? from.nextSibling : self.container.firstChild;
while (pos != to) {
var temp = pos.nextSibling;
removeElement(pos);
pos = temp;
}
}
var start = chain[0].from, end = chain[chain.length - 1].to;
// Clear the space where this change has to be made.
removeRange(start, end);
// Insert the content specified by the chain into the DOM tree.
for (var i = 0; i < chain.length; i++) {
var line = chain[i];
// The start and end of the space are already correct, but BR
// tags inside it have to be put back.
if (i > 0)
self.container.insertBefore(line.from, end);
// Add the text.
var node = makePartSpan(fixSpaces(line.text), this.container.ownerDocument);
self.container.insertBefore(node, end);
// See if the cursor was on this line. Put it back, adjusting
// for changed line length, if it was.
if (cursor && cursor.node == line.from) {
var cursordiff = 0;
var prev = this.after(line.from);
if (prev && i == chain.length - 1) {
// Only adjust if the cursor is after the unchanged part of
// the line.
for (var match = 0; match < cursor.offset &&
line.text.charAt(match) == prev.text.charAt(match); match++);
if (cursor.offset > match)
cursordiff = line.text.length - prev.text.length;
}
select.setCursorPos(this.container, {node: line.from, offset: Math.max(0, cursor.offset + cursordiff)});
}
// Cursor was in removed line, this is last new line.
else if (cursor && (i == chain.length - 1) && cursor.node && cursor.node.parentNode != this.container) {
select.setCursorPos(this.container, {node: line.from, offset: line.text.length});
}
}
// Anchor the chain in the DOM tree.
this.linkChain(chain);
return start;
} | [
"function",
"(",
"chain",
")",
"{",
"// Some attempt is made to prevent the cursor from jumping",
"// randomly when an undo or redo happens. It still behaves a bit",
"// strange sometimes.",
"var",
"cursor",
"=",
"select",
".",
"cursorPos",
"(",
"this",
".",
"container",
",",
"false",
")",
",",
"self",
"=",
"this",
";",
"// Remove all nodes in the DOM tree between from and to (null for",
"// start/end of container).",
"function",
"removeRange",
"(",
"from",
",",
"to",
")",
"{",
"var",
"pos",
"=",
"from",
"?",
"from",
".",
"nextSibling",
":",
"self",
".",
"container",
".",
"firstChild",
";",
"while",
"(",
"pos",
"!=",
"to",
")",
"{",
"var",
"temp",
"=",
"pos",
".",
"nextSibling",
";",
"removeElement",
"(",
"pos",
")",
";",
"pos",
"=",
"temp",
";",
"}",
"}",
"var",
"start",
"=",
"chain",
"[",
"0",
"]",
".",
"from",
",",
"end",
"=",
"chain",
"[",
"chain",
".",
"length",
"-",
"1",
"]",
".",
"to",
";",
"// Clear the space where this change has to be made.",
"removeRange",
"(",
"start",
",",
"end",
")",
";",
"// Insert the content specified by the chain into the DOM tree.",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"chain",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
"line",
"=",
"chain",
"[",
"i",
"]",
";",
"// The start and end of the space are already correct, but BR",
"// tags inside it have to be put back.",
"if",
"(",
"i",
">",
"0",
")",
"self",
".",
"container",
".",
"insertBefore",
"(",
"line",
".",
"from",
",",
"end",
")",
";",
"// Add the text.",
"var",
"node",
"=",
"makePartSpan",
"(",
"fixSpaces",
"(",
"line",
".",
"text",
")",
",",
"this",
".",
"container",
".",
"ownerDocument",
")",
";",
"self",
".",
"container",
".",
"insertBefore",
"(",
"node",
",",
"end",
")",
";",
"// See if the cursor was on this line. Put it back, adjusting",
"// for changed line length, if it was.",
"if",
"(",
"cursor",
"&&",
"cursor",
".",
"node",
"==",
"line",
".",
"from",
")",
"{",
"var",
"cursordiff",
"=",
"0",
";",
"var",
"prev",
"=",
"this",
".",
"after",
"(",
"line",
".",
"from",
")",
";",
"if",
"(",
"prev",
"&&",
"i",
"==",
"chain",
".",
"length",
"-",
"1",
")",
"{",
"// Only adjust if the cursor is after the unchanged part of",
"// the line.",
"for",
"(",
"var",
"match",
"=",
"0",
";",
"match",
"<",
"cursor",
".",
"offset",
"&&",
"line",
".",
"text",
".",
"charAt",
"(",
"match",
")",
"==",
"prev",
".",
"text",
".",
"charAt",
"(",
"match",
")",
";",
"match",
"++",
")",
";",
"if",
"(",
"cursor",
".",
"offset",
">",
"match",
")",
"cursordiff",
"=",
"line",
".",
"text",
".",
"length",
"-",
"prev",
".",
"text",
".",
"length",
";",
"}",
"select",
".",
"setCursorPos",
"(",
"this",
".",
"container",
",",
"{",
"node",
":",
"line",
".",
"from",
",",
"offset",
":",
"Math",
".",
"max",
"(",
"0",
",",
"cursor",
".",
"offset",
"+",
"cursordiff",
")",
"}",
")",
";",
"}",
"// Cursor was in removed line, this is last new line.",
"else",
"if",
"(",
"cursor",
"&&",
"(",
"i",
"==",
"chain",
".",
"length",
"-",
"1",
")",
"&&",
"cursor",
".",
"node",
"&&",
"cursor",
".",
"node",
".",
"parentNode",
"!=",
"this",
".",
"container",
")",
"{",
"select",
".",
"setCursorPos",
"(",
"this",
".",
"container",
",",
"{",
"node",
":",
"line",
".",
"from",
",",
"offset",
":",
"line",
".",
"text",
".",
"length",
"}",
")",
";",
"}",
"}",
"// Anchor the chain in the DOM tree.",
"this",
".",
"linkChain",
"(",
"chain",
")",
";",
"return",
"start",
";",
"}"
]
| Update the DOM tree to contain the lines specified in a given chain, link this chain into the DOM nodes. | [
"Update",
"the",
"DOM",
"tree",
"to",
"contain",
"the",
"lines",
"specified",
"in",
"a",
"given",
"chain",
"link",
"this",
"chain",
"into",
"the",
"DOM",
"nodes",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/undo.js#L353-L409 |
|
42,285 | neyric/webhookit | public/javascripts/yui/cookie/cookie.js | function (hash /*:Object*/) /*:String*/ {
//shortcuts
var lang = YAHOO.lang;
if (!lang.isObject(hash)){
throw new TypeError("Cookie._createCookieHashString(): Argument must be an object.");
}
var text /*:Array*/ = [];
for (var key in hash){
if (lang.hasOwnProperty(hash, key) && !lang.isFunction(hash[key]) && !lang.isUndefined(hash[key])){
text.push(encodeURIComponent(key) + "=" + encodeURIComponent(String(hash[key])));
}
}
return text.join("&");
} | javascript | function (hash /*:Object*/) /*:String*/ {
//shortcuts
var lang = YAHOO.lang;
if (!lang.isObject(hash)){
throw new TypeError("Cookie._createCookieHashString(): Argument must be an object.");
}
var text /*:Array*/ = [];
for (var key in hash){
if (lang.hasOwnProperty(hash, key) && !lang.isFunction(hash[key]) && !lang.isUndefined(hash[key])){
text.push(encodeURIComponent(key) + "=" + encodeURIComponent(String(hash[key])));
}
}
return text.join("&");
} | [
"function",
"(",
"hash",
"/*:Object*/",
")",
"/*:String*/",
"{",
"//shortcuts",
"var",
"lang",
"=",
"YAHOO",
".",
"lang",
";",
"if",
"(",
"!",
"lang",
".",
"isObject",
"(",
"hash",
")",
")",
"{",
"throw",
"new",
"TypeError",
"(",
"\"Cookie._createCookieHashString(): Argument must be an object.\"",
")",
";",
"}",
"var",
"text",
"/*:Array*/",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"key",
"in",
"hash",
")",
"{",
"if",
"(",
"lang",
".",
"hasOwnProperty",
"(",
"hash",
",",
"key",
")",
"&&",
"!",
"lang",
".",
"isFunction",
"(",
"hash",
"[",
"key",
"]",
")",
"&&",
"!",
"lang",
".",
"isUndefined",
"(",
"hash",
"[",
"key",
"]",
")",
")",
"{",
"text",
".",
"push",
"(",
"encodeURIComponent",
"(",
"key",
")",
"+",
"\"=\"",
"+",
"encodeURIComponent",
"(",
"String",
"(",
"hash",
"[",
"key",
"]",
")",
")",
")",
";",
"}",
"}",
"return",
"text",
".",
"join",
"(",
"\"&\"",
")",
";",
"}"
]
| Formats a cookie value for an object containing multiple values.
@param {Object} hash An object of key-value pairs to create a string for.
@return {String} A string suitable for use as a cookie value.
@method _createCookieHashString
@private
@static | [
"Formats",
"a",
"cookie",
"value",
"for",
"an",
"object",
"containing",
"multiple",
"values",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/cookie/cookie.js#L76-L94 |
|
42,286 | neyric/webhookit | public/javascripts/yui/cookie/cookie.js | function (text /*:String*/) /*:Object*/ {
var hashParts /*:Array*/ = text.split("&"),
hashPart /*:Array*/ = null,
hash /*:Object*/ = {};
if (text.length > 0){
for (var i=0, len=hashParts.length; i < len; i++){
hashPart = hashParts[i].split("=");
hash[decodeURIComponent(hashPart[0])] = decodeURIComponent(hashPart[1]);
}
}
return hash;
} | javascript | function (text /*:String*/) /*:Object*/ {
var hashParts /*:Array*/ = text.split("&"),
hashPart /*:Array*/ = null,
hash /*:Object*/ = {};
if (text.length > 0){
for (var i=0, len=hashParts.length; i < len; i++){
hashPart = hashParts[i].split("=");
hash[decodeURIComponent(hashPart[0])] = decodeURIComponent(hashPart[1]);
}
}
return hash;
} | [
"function",
"(",
"text",
"/*:String*/",
")",
"/*:Object*/",
"{",
"var",
"hashParts",
"/*:Array*/",
"=",
"text",
".",
"split",
"(",
"\"&\"",
")",
",",
"hashPart",
"/*:Array*/",
"=",
"null",
",",
"hash",
"/*:Object*/",
"=",
"{",
"}",
";",
"if",
"(",
"text",
".",
"length",
">",
"0",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"len",
"=",
"hashParts",
".",
"length",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"hashPart",
"=",
"hashParts",
"[",
"i",
"]",
".",
"split",
"(",
"\"=\"",
")",
";",
"hash",
"[",
"decodeURIComponent",
"(",
"hashPart",
"[",
"0",
"]",
")",
"]",
"=",
"decodeURIComponent",
"(",
"hashPart",
"[",
"1",
"]",
")",
";",
"}",
"}",
"return",
"hash",
";",
"}"
]
| Parses a cookie hash string into an object.
@param {String} text The cookie hash string to parse. The string should already be URL-decoded.
@return {Object} An object containing entries for each cookie value.
@method _parseCookieHash
@private
@static | [
"Parses",
"a",
"cookie",
"hash",
"string",
"into",
"an",
"object",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/cookie/cookie.js#L104-L118 |
|
42,287 | neyric/webhookit | public/javascripts/yui/cookie/cookie.js | function (text /*:String*/, decode /*:Boolean*/) /*:Object*/ {
var cookies /*:Object*/ = {};
if (YAHOO.lang.isString(text) && text.length > 0) {
var decodeValue = (decode === false ? function(s){return s;} : decodeURIComponent);
//if (/[^=]+=[^=;]?(?:; [^=]+=[^=]?)?/.test(text)){
var cookieParts /*:Array*/ = text.split(/;\s/g),
cookieName /*:String*/ = null,
cookieValue /*:String*/ = null,
cookieNameValue /*:Array*/ = null;
for (var i=0, len=cookieParts.length; i < len; i++){
//check for normally-formatted cookie (name-value)
cookieNameValue = cookieParts[i].match(/([^=]+)=/i);
if (cookieNameValue instanceof Array){
try {
cookieName = decodeURIComponent(cookieNameValue[1]);
cookieValue = decodeValue(cookieParts[i].substring(cookieNameValue[1].length+1));
} catch (ex){
//ignore the entire cookie - encoding is likely invalid
}
} else {
//means the cookie does not have an "=", so treat it as a boolean flag
cookieName = decodeURIComponent(cookieParts[i]);
cookieValue = "";
}
cookies[cookieName] = cookieValue;
}
//}
}
return cookies;
} | javascript | function (text /*:String*/, decode /*:Boolean*/) /*:Object*/ {
var cookies /*:Object*/ = {};
if (YAHOO.lang.isString(text) && text.length > 0) {
var decodeValue = (decode === false ? function(s){return s;} : decodeURIComponent);
//if (/[^=]+=[^=;]?(?:; [^=]+=[^=]?)?/.test(text)){
var cookieParts /*:Array*/ = text.split(/;\s/g),
cookieName /*:String*/ = null,
cookieValue /*:String*/ = null,
cookieNameValue /*:Array*/ = null;
for (var i=0, len=cookieParts.length; i < len; i++){
//check for normally-formatted cookie (name-value)
cookieNameValue = cookieParts[i].match(/([^=]+)=/i);
if (cookieNameValue instanceof Array){
try {
cookieName = decodeURIComponent(cookieNameValue[1]);
cookieValue = decodeValue(cookieParts[i].substring(cookieNameValue[1].length+1));
} catch (ex){
//ignore the entire cookie - encoding is likely invalid
}
} else {
//means the cookie does not have an "=", so treat it as a boolean flag
cookieName = decodeURIComponent(cookieParts[i]);
cookieValue = "";
}
cookies[cookieName] = cookieValue;
}
//}
}
return cookies;
} | [
"function",
"(",
"text",
"/*:String*/",
",",
"decode",
"/*:Boolean*/",
")",
"/*:Object*/",
"{",
"var",
"cookies",
"/*:Object*/",
"=",
"{",
"}",
";",
"if",
"(",
"YAHOO",
".",
"lang",
".",
"isString",
"(",
"text",
")",
"&&",
"text",
".",
"length",
">",
"0",
")",
"{",
"var",
"decodeValue",
"=",
"(",
"decode",
"===",
"false",
"?",
"function",
"(",
"s",
")",
"{",
"return",
"s",
";",
"}",
":",
"decodeURIComponent",
")",
";",
"//if (/[^=]+=[^=;]?(?:; [^=]+=[^=]?)?/.test(text)){",
"var",
"cookieParts",
"/*:Array*/",
"=",
"text",
".",
"split",
"(",
"/",
";\\s",
"/",
"g",
")",
",",
"cookieName",
"/*:String*/",
"=",
"null",
",",
"cookieValue",
"/*:String*/",
"=",
"null",
",",
"cookieNameValue",
"/*:Array*/",
"=",
"null",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"len",
"=",
"cookieParts",
".",
"length",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"//check for normally-formatted cookie (name-value)",
"cookieNameValue",
"=",
"cookieParts",
"[",
"i",
"]",
".",
"match",
"(",
"/",
"([^=]+)=",
"/",
"i",
")",
";",
"if",
"(",
"cookieNameValue",
"instanceof",
"Array",
")",
"{",
"try",
"{",
"cookieName",
"=",
"decodeURIComponent",
"(",
"cookieNameValue",
"[",
"1",
"]",
")",
";",
"cookieValue",
"=",
"decodeValue",
"(",
"cookieParts",
"[",
"i",
"]",
".",
"substring",
"(",
"cookieNameValue",
"[",
"1",
"]",
".",
"length",
"+",
"1",
")",
")",
";",
"}",
"catch",
"(",
"ex",
")",
"{",
"//ignore the entire cookie - encoding is likely invalid",
"}",
"}",
"else",
"{",
"//means the cookie does not have an \"=\", so treat it as a boolean flag",
"cookieName",
"=",
"decodeURIComponent",
"(",
"cookieParts",
"[",
"i",
"]",
")",
";",
"cookieValue",
"=",
"\"\"",
";",
"}",
"cookies",
"[",
"cookieName",
"]",
"=",
"cookieValue",
";",
"}",
"//}",
"}",
"return",
"cookies",
";",
"}"
]
| Parses a cookie string into an object representing all accessible cookies.
@param {String} text The cookie string to parse.
@param {Boolean} decode (Optional) Indicates if the cookie values should be decoded or not. Default is true.
@return {Object} An object containing entries for each accessible cookie.
@method _parseCookieString
@private
@static | [
"Parses",
"a",
"cookie",
"string",
"into",
"an",
"object",
"representing",
"all",
"accessible",
"cookies",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/cookie/cookie.js#L129-L165 |
|
42,288 | neyric/webhookit | public/javascripts/yui/cookie/cookie.js | function (name /*:String*/, options /*:Variant*/) /*:Variant*/{
var lang = YAHOO.lang,
converter;
if (lang.isFunction(options)) {
converter = options;
options = {};
} else if (lang.isObject(options)) {
converter = options.converter;
} else {
options = {};
}
var cookies /*:Object*/ = this._parseCookieString(document.cookie, !options.raw);
if (!lang.isString(name) || name === ""){
throw new TypeError("Cookie.get(): Cookie name must be a non-empty string.");
}
if (lang.isUndefined(cookies[name])) {
return null;
}
if (!lang.isFunction(converter)){
return cookies[name];
} else {
return converter(cookies[name]);
}
} | javascript | function (name /*:String*/, options /*:Variant*/) /*:Variant*/{
var lang = YAHOO.lang,
converter;
if (lang.isFunction(options)) {
converter = options;
options = {};
} else if (lang.isObject(options)) {
converter = options.converter;
} else {
options = {};
}
var cookies /*:Object*/ = this._parseCookieString(document.cookie, !options.raw);
if (!lang.isString(name) || name === ""){
throw new TypeError("Cookie.get(): Cookie name must be a non-empty string.");
}
if (lang.isUndefined(cookies[name])) {
return null;
}
if (!lang.isFunction(converter)){
return cookies[name];
} else {
return converter(cookies[name]);
}
} | [
"function",
"(",
"name",
"/*:String*/",
",",
"options",
"/*:Variant*/",
")",
"/*:Variant*/",
"{",
"var",
"lang",
"=",
"YAHOO",
".",
"lang",
",",
"converter",
";",
"if",
"(",
"lang",
".",
"isFunction",
"(",
"options",
")",
")",
"{",
"converter",
"=",
"options",
";",
"options",
"=",
"{",
"}",
";",
"}",
"else",
"if",
"(",
"lang",
".",
"isObject",
"(",
"options",
")",
")",
"{",
"converter",
"=",
"options",
".",
"converter",
";",
"}",
"else",
"{",
"options",
"=",
"{",
"}",
";",
"}",
"var",
"cookies",
"/*:Object*/",
"=",
"this",
".",
"_parseCookieString",
"(",
"document",
".",
"cookie",
",",
"!",
"options",
".",
"raw",
")",
";",
"if",
"(",
"!",
"lang",
".",
"isString",
"(",
"name",
")",
"||",
"name",
"===",
"\"\"",
")",
"{",
"throw",
"new",
"TypeError",
"(",
"\"Cookie.get(): Cookie name must be a non-empty string.\"",
")",
";",
"}",
"if",
"(",
"lang",
".",
"isUndefined",
"(",
"cookies",
"[",
"name",
"]",
")",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"!",
"lang",
".",
"isFunction",
"(",
"converter",
")",
")",
"{",
"return",
"cookies",
"[",
"name",
"]",
";",
"}",
"else",
"{",
"return",
"converter",
"(",
"cookies",
"[",
"name",
"]",
")",
";",
"}",
"}"
]
| Returns the cookie value for the given name.
@param {String} name The name of the cookie to retrieve.
@param {Object|Function} options (Optional) An object containing one or more
cookie options: raw (true/false) and converter (a function).
The converter function is run on the value before returning it. The
function is not used if the cookie doesn't exist. The function can be
passed instead of the options object for backwards compatibility.
@return {Variant} If no converter is specified, returns a string or null if
the cookie doesn't exist. If the converter is specified, returns the value
returned from the converter or null if the cookie doesn't exist.
@method get
@static | [
"Returns",
"the",
"cookie",
"value",
"for",
"the",
"given",
"name",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/cookie/cookie.js#L204-L233 |
|
42,289 | neyric/webhookit | public/javascripts/yui/cookie/cookie.js | function (name, subName, converter) {
var lang = YAHOO.lang,
hash = this.getSubs(name);
if (hash !== null) {
if (!lang.isString(subName) || subName === ""){
throw new TypeError("Cookie.getSub(): Subcookie name must be a non-empty string.");
}
if (lang.isUndefined(hash[subName])){
return null;
}
if (!lang.isFunction(converter)){
return hash[subName];
} else {
return converter(hash[subName]);
}
} else {
return null;
}
} | javascript | function (name, subName, converter) {
var lang = YAHOO.lang,
hash = this.getSubs(name);
if (hash !== null) {
if (!lang.isString(subName) || subName === ""){
throw new TypeError("Cookie.getSub(): Subcookie name must be a non-empty string.");
}
if (lang.isUndefined(hash[subName])){
return null;
}
if (!lang.isFunction(converter)){
return hash[subName];
} else {
return converter(hash[subName]);
}
} else {
return null;
}
} | [
"function",
"(",
"name",
",",
"subName",
",",
"converter",
")",
"{",
"var",
"lang",
"=",
"YAHOO",
".",
"lang",
",",
"hash",
"=",
"this",
".",
"getSubs",
"(",
"name",
")",
";",
"if",
"(",
"hash",
"!==",
"null",
")",
"{",
"if",
"(",
"!",
"lang",
".",
"isString",
"(",
"subName",
")",
"||",
"subName",
"===",
"\"\"",
")",
"{",
"throw",
"new",
"TypeError",
"(",
"\"Cookie.getSub(): Subcookie name must be a non-empty string.\"",
")",
";",
"}",
"if",
"(",
"lang",
".",
"isUndefined",
"(",
"hash",
"[",
"subName",
"]",
")",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"!",
"lang",
".",
"isFunction",
"(",
"converter",
")",
")",
"{",
"return",
"hash",
"[",
"subName",
"]",
";",
"}",
"else",
"{",
"return",
"converter",
"(",
"hash",
"[",
"subName",
"]",
")",
";",
"}",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}"
]
| Returns the value of a subcookie.
@param {String} name The name of the cookie to retrieve.
@param {String} subName The name of the subcookie to retrieve.
@param {Function} converter (Optional) A function to run on the value before returning
it. The function is not used if the cookie doesn't exist.
@return {Variant} If the cookie doesn't exist, null is returned. If the subcookie
doesn't exist, null if also returned. If no converter is specified and the
subcookie exists, a string is returned. If a converter is specified and the
subcookie exists, the value returned from the converter is returned.
@method getSub
@static | [
"Returns",
"the",
"value",
"of",
"a",
"subcookie",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/cookie/cookie.js#L248-L272 |
|
42,290 | neyric/webhookit | public/javascripts/yui/cookie/cookie.js | function (name /*:String*/) /*:Object*/ {
var isString = YAHOO.lang.isString;
//check cookie name
if (!isString(name) || name === ""){
throw new TypeError("Cookie.getSubs(): Cookie name must be a non-empty string.");
}
var cookies = this._parseCookieString(document.cookie, false);
if (isString(cookies[name])){
return this._parseCookieHash(cookies[name]);
}
return null;
} | javascript | function (name /*:String*/) /*:Object*/ {
var isString = YAHOO.lang.isString;
//check cookie name
if (!isString(name) || name === ""){
throw new TypeError("Cookie.getSubs(): Cookie name must be a non-empty string.");
}
var cookies = this._parseCookieString(document.cookie, false);
if (isString(cookies[name])){
return this._parseCookieHash(cookies[name]);
}
return null;
} | [
"function",
"(",
"name",
"/*:String*/",
")",
"/*:Object*/",
"{",
"var",
"isString",
"=",
"YAHOO",
".",
"lang",
".",
"isString",
";",
"//check cookie name",
"if",
"(",
"!",
"isString",
"(",
"name",
")",
"||",
"name",
"===",
"\"\"",
")",
"{",
"throw",
"new",
"TypeError",
"(",
"\"Cookie.getSubs(): Cookie name must be a non-empty string.\"",
")",
";",
"}",
"var",
"cookies",
"=",
"this",
".",
"_parseCookieString",
"(",
"document",
".",
"cookie",
",",
"false",
")",
";",
"if",
"(",
"isString",
"(",
"cookies",
"[",
"name",
"]",
")",
")",
"{",
"return",
"this",
".",
"_parseCookieHash",
"(",
"cookies",
"[",
"name",
"]",
")",
";",
"}",
"return",
"null",
";",
"}"
]
| Returns an object containing name-value pairs stored in the cookie with the given name.
@param {String} name The name of the cookie to retrieve.
@return {Object} An object of name-value pairs if the cookie with the given name
exists, null if it does not.
@method getSubs
@static | [
"Returns",
"an",
"object",
"containing",
"name",
"-",
"value",
"pairs",
"stored",
"in",
"the",
"cookie",
"with",
"the",
"given",
"name",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/cookie/cookie.js#L282-L296 |
|
42,291 | neyric/webhookit | public/javascripts/yui/cookie/cookie.js | function (name /*:String*/, options /*:Object*/) /*:String*/ {
//check cookie name
if (!YAHOO.lang.isString(name) || name === ""){
throw new TypeError("Cookie.remove(): Cookie name must be a non-empty string.");
}
//set options - clone options so the original isn't affected
options = YAHOO.lang.merge(options || {}, {
expires: new Date(0)
});
//set cookie
return this.set(name, "", options);
} | javascript | function (name /*:String*/, options /*:Object*/) /*:String*/ {
//check cookie name
if (!YAHOO.lang.isString(name) || name === ""){
throw new TypeError("Cookie.remove(): Cookie name must be a non-empty string.");
}
//set options - clone options so the original isn't affected
options = YAHOO.lang.merge(options || {}, {
expires: new Date(0)
});
//set cookie
return this.set(name, "", options);
} | [
"function",
"(",
"name",
"/*:String*/",
",",
"options",
"/*:Object*/",
")",
"/*:String*/",
"{",
"//check cookie name",
"if",
"(",
"!",
"YAHOO",
".",
"lang",
".",
"isString",
"(",
"name",
")",
"||",
"name",
"===",
"\"\"",
")",
"{",
"throw",
"new",
"TypeError",
"(",
"\"Cookie.remove(): Cookie name must be a non-empty string.\"",
")",
";",
"}",
"//set options - clone options so the original isn't affected",
"options",
"=",
"YAHOO",
".",
"lang",
".",
"merge",
"(",
"options",
"||",
"{",
"}",
",",
"{",
"expires",
":",
"new",
"Date",
"(",
"0",
")",
"}",
")",
";",
"//set cookie",
"return",
"this",
".",
"set",
"(",
"name",
",",
"\"\"",
",",
"options",
")",
";",
"}"
]
| Removes a cookie from the machine by setting its expiration date to
sometime in the past.
@param {String} name The name of the cookie to remove.
@param {Object} options (Optional) An object containing one or more
cookie options: path (a string), domain (a string),
and secure (true/false). The expires option will be overwritten
by the method.
@return {String} The created cookie string.
@method remove
@static | [
"Removes",
"a",
"cookie",
"from",
"the",
"machine",
"by",
"setting",
"its",
"expiration",
"date",
"to",
"sometime",
"in",
"the",
"past",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/cookie/cookie.js#L310-L324 |
|
42,292 | neyric/webhookit | public/javascripts/yui/cookie/cookie.js | function(name /*:String*/, subName /*:String*/, options /*:Object*/) /*:String*/ {
var lang = YAHOO.lang;
options = options || {};
//check cookie name
if (!lang.isString(name) || name === ""){
throw new TypeError("Cookie.removeSub(): Cookie name must be a non-empty string.");
}
//check subcookie name
if (!lang.isString(subName) || subName === ""){
throw new TypeError("Cookie.removeSub(): Subcookie name must be a non-empty string.");
}
//get all subcookies for this cookie
var subs = this.getSubs(name);
//delete the indicated subcookie
if (lang.isObject(subs) && lang.hasOwnProperty(subs, subName)){
delete subs[subName];
if (!options.removeIfEmpty) {
//reset the cookie
return this.setSubs(name, subs, options);
} else {
//reset the cookie if there are subcookies left, else remove
for (var key in subs){
if (lang.hasOwnProperty(subs, key) && !lang.isFunction(subs[key]) && !lang.isUndefined(subs[key])){
return this.setSubs(name, subs, options);
}
}
return this.remove(name, options);
}
} else {
return "";
}
} | javascript | function(name /*:String*/, subName /*:String*/, options /*:Object*/) /*:String*/ {
var lang = YAHOO.lang;
options = options || {};
//check cookie name
if (!lang.isString(name) || name === ""){
throw new TypeError("Cookie.removeSub(): Cookie name must be a non-empty string.");
}
//check subcookie name
if (!lang.isString(subName) || subName === ""){
throw new TypeError("Cookie.removeSub(): Subcookie name must be a non-empty string.");
}
//get all subcookies for this cookie
var subs = this.getSubs(name);
//delete the indicated subcookie
if (lang.isObject(subs) && lang.hasOwnProperty(subs, subName)){
delete subs[subName];
if (!options.removeIfEmpty) {
//reset the cookie
return this.setSubs(name, subs, options);
} else {
//reset the cookie if there are subcookies left, else remove
for (var key in subs){
if (lang.hasOwnProperty(subs, key) && !lang.isFunction(subs[key]) && !lang.isUndefined(subs[key])){
return this.setSubs(name, subs, options);
}
}
return this.remove(name, options);
}
} else {
return "";
}
} | [
"function",
"(",
"name",
"/*:String*/",
",",
"subName",
"/*:String*/",
",",
"options",
"/*:Object*/",
")",
"/*:String*/",
"{",
"var",
"lang",
"=",
"YAHOO",
".",
"lang",
";",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"//check cookie name",
"if",
"(",
"!",
"lang",
".",
"isString",
"(",
"name",
")",
"||",
"name",
"===",
"\"\"",
")",
"{",
"throw",
"new",
"TypeError",
"(",
"\"Cookie.removeSub(): Cookie name must be a non-empty string.\"",
")",
";",
"}",
"//check subcookie name",
"if",
"(",
"!",
"lang",
".",
"isString",
"(",
"subName",
")",
"||",
"subName",
"===",
"\"\"",
")",
"{",
"throw",
"new",
"TypeError",
"(",
"\"Cookie.removeSub(): Subcookie name must be a non-empty string.\"",
")",
";",
"}",
"//get all subcookies for this cookie",
"var",
"subs",
"=",
"this",
".",
"getSubs",
"(",
"name",
")",
";",
"//delete the indicated subcookie",
"if",
"(",
"lang",
".",
"isObject",
"(",
"subs",
")",
"&&",
"lang",
".",
"hasOwnProperty",
"(",
"subs",
",",
"subName",
")",
")",
"{",
"delete",
"subs",
"[",
"subName",
"]",
";",
"if",
"(",
"!",
"options",
".",
"removeIfEmpty",
")",
"{",
"//reset the cookie",
"return",
"this",
".",
"setSubs",
"(",
"name",
",",
"subs",
",",
"options",
")",
";",
"}",
"else",
"{",
"//reset the cookie if there are subcookies left, else remove",
"for",
"(",
"var",
"key",
"in",
"subs",
")",
"{",
"if",
"(",
"lang",
".",
"hasOwnProperty",
"(",
"subs",
",",
"key",
")",
"&&",
"!",
"lang",
".",
"isFunction",
"(",
"subs",
"[",
"key",
"]",
")",
"&&",
"!",
"lang",
".",
"isUndefined",
"(",
"subs",
"[",
"key",
"]",
")",
")",
"{",
"return",
"this",
".",
"setSubs",
"(",
"name",
",",
"subs",
",",
"options",
")",
";",
"}",
"}",
"return",
"this",
".",
"remove",
"(",
"name",
",",
"options",
")",
";",
"}",
"}",
"else",
"{",
"return",
"\"\"",
";",
"}",
"}"
]
| Removes a subcookie with a given name. Removing the last subcookie
won't remove the entire cookie unless options.removeIfEmpty is true.
@param {String} name The name of the cookie in which the subcookie exists.
@param {String} subName The name of the subcookie to remove.
@param {Object} options (Optional) An object containing one or more
cookie options: path (a string), domain (a string), expires (a Date object),
removeIfEmpty (true/false), and secure (true/false). This must be the same
settings as the original subcookie.
@return {String} The created cookie string.
@method removeSub
@static | [
"Removes",
"a",
"subcookie",
"with",
"a",
"given",
"name",
".",
"Removing",
"the",
"last",
"subcookie",
"won",
"t",
"remove",
"the",
"entire",
"cookie",
"unless",
"options",
".",
"removeIfEmpty",
"is",
"true",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/cookie/cookie.js#L339-L380 |
|
42,293 | neyric/webhookit | public/javascripts/yui/cookie/cookie.js | function (name /*:String*/, value /*:Variant*/, options /*:Object*/) /*:String*/ {
var lang = YAHOO.lang;
options = options || {};
if (!lang.isString(name)){
throw new TypeError("Cookie.set(): Cookie name must be a string.");
}
if (lang.isUndefined(value)){
throw new TypeError("Cookie.set(): Value cannot be undefined.");
}
var text /*:String*/ = this._createCookieString(name, value, !options.raw, options);
document.cookie = text;
return text;
} | javascript | function (name /*:String*/, value /*:Variant*/, options /*:Object*/) /*:String*/ {
var lang = YAHOO.lang;
options = options || {};
if (!lang.isString(name)){
throw new TypeError("Cookie.set(): Cookie name must be a string.");
}
if (lang.isUndefined(value)){
throw new TypeError("Cookie.set(): Value cannot be undefined.");
}
var text /*:String*/ = this._createCookieString(name, value, !options.raw, options);
document.cookie = text;
return text;
} | [
"function",
"(",
"name",
"/*:String*/",
",",
"value",
"/*:Variant*/",
",",
"options",
"/*:Object*/",
")",
"/*:String*/",
"{",
"var",
"lang",
"=",
"YAHOO",
".",
"lang",
";",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"if",
"(",
"!",
"lang",
".",
"isString",
"(",
"name",
")",
")",
"{",
"throw",
"new",
"TypeError",
"(",
"\"Cookie.set(): Cookie name must be a string.\"",
")",
";",
"}",
"if",
"(",
"lang",
".",
"isUndefined",
"(",
"value",
")",
")",
"{",
"throw",
"new",
"TypeError",
"(",
"\"Cookie.set(): Value cannot be undefined.\"",
")",
";",
"}",
"var",
"text",
"/*:String*/",
"=",
"this",
".",
"_createCookieString",
"(",
"name",
",",
"value",
",",
"!",
"options",
".",
"raw",
",",
"options",
")",
";",
"document",
".",
"cookie",
"=",
"text",
";",
"return",
"text",
";",
"}"
]
| Sets a cookie with a given name and value.
@param {String} name The name of the cookie to set.
@param {Variant} value The value to set for the cookie.
@param {Object} options (Optional) An object containing one or more
cookie options: path (a string), domain (a string), expires (a Date object),
raw (true/false), and secure (true/false).
@return {String} The created cookie string.
@method set
@static | [
"Sets",
"a",
"cookie",
"with",
"a",
"given",
"name",
"and",
"value",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/cookie/cookie.js#L393-L410 |
|
42,294 | neyric/webhookit | public/javascripts/yui/cookie/cookie.js | function (name /*:String*/, subName /*:String*/, value /*:Variant*/, options /*:Object*/) /*:String*/ {
var lang = YAHOO.lang;
if (!lang.isString(name) || name === ""){
throw new TypeError("Cookie.setSub(): Cookie name must be a non-empty string.");
}
if (!lang.isString(subName) || subName === ""){
throw new TypeError("Cookie.setSub(): Subcookie name must be a non-empty string.");
}
if (lang.isUndefined(value)){
throw new TypeError("Cookie.setSub(): Subcookie value cannot be undefined.");
}
var hash /*:Object*/ = this.getSubs(name);
if (!lang.isObject(hash)){
hash = {};
}
hash[subName] = value;
return this.setSubs(name, hash, options);
} | javascript | function (name /*:String*/, subName /*:String*/, value /*:Variant*/, options /*:Object*/) /*:String*/ {
var lang = YAHOO.lang;
if (!lang.isString(name) || name === ""){
throw new TypeError("Cookie.setSub(): Cookie name must be a non-empty string.");
}
if (!lang.isString(subName) || subName === ""){
throw new TypeError("Cookie.setSub(): Subcookie name must be a non-empty string.");
}
if (lang.isUndefined(value)){
throw new TypeError("Cookie.setSub(): Subcookie value cannot be undefined.");
}
var hash /*:Object*/ = this.getSubs(name);
if (!lang.isObject(hash)){
hash = {};
}
hash[subName] = value;
return this.setSubs(name, hash, options);
} | [
"function",
"(",
"name",
"/*:String*/",
",",
"subName",
"/*:String*/",
",",
"value",
"/*:Variant*/",
",",
"options",
"/*:Object*/",
")",
"/*:String*/",
"{",
"var",
"lang",
"=",
"YAHOO",
".",
"lang",
";",
"if",
"(",
"!",
"lang",
".",
"isString",
"(",
"name",
")",
"||",
"name",
"===",
"\"\"",
")",
"{",
"throw",
"new",
"TypeError",
"(",
"\"Cookie.setSub(): Cookie name must be a non-empty string.\"",
")",
";",
"}",
"if",
"(",
"!",
"lang",
".",
"isString",
"(",
"subName",
")",
"||",
"subName",
"===",
"\"\"",
")",
"{",
"throw",
"new",
"TypeError",
"(",
"\"Cookie.setSub(): Subcookie name must be a non-empty string.\"",
")",
";",
"}",
"if",
"(",
"lang",
".",
"isUndefined",
"(",
"value",
")",
")",
"{",
"throw",
"new",
"TypeError",
"(",
"\"Cookie.setSub(): Subcookie value cannot be undefined.\"",
")",
";",
"}",
"var",
"hash",
"/*:Object*/",
"=",
"this",
".",
"getSubs",
"(",
"name",
")",
";",
"if",
"(",
"!",
"lang",
".",
"isObject",
"(",
"hash",
")",
")",
"{",
"hash",
"=",
"{",
"}",
";",
"}",
"hash",
"[",
"subName",
"]",
"=",
"value",
";",
"return",
"this",
".",
"setSubs",
"(",
"name",
",",
"hash",
",",
"options",
")",
";",
"}"
]
| Sets a sub cookie with a given name to a particular value.
@param {String} name The name of the cookie to set.
@param {String} subName The name of the subcookie to set.
@param {Variant} value The value to set.
@param {Object} options (Optional) An object containing one or more
cookie options: path (a string), domain (a string), expires (a Date object),
and secure (true/false).
@return {String} The created cookie string.
@method setSub
@static | [
"Sets",
"a",
"sub",
"cookie",
"with",
"a",
"given",
"name",
"to",
"a",
"particular",
"value",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/cookie/cookie.js#L424-L450 |
|
42,295 | neyric/webhookit | public/javascripts/yui/cookie/cookie.js | function (name /*:String*/, value /*:Object*/, options /*:Object*/) /*:String*/ {
var lang = YAHOO.lang;
if (!lang.isString(name)){
throw new TypeError("Cookie.setSubs(): Cookie name must be a string.");
}
if (!lang.isObject(value)){
throw new TypeError("Cookie.setSubs(): Cookie value must be an object.");
}
var text /*:String*/ = this._createCookieString(name, this._createCookieHashString(value), false, options);
document.cookie = text;
return text;
} | javascript | function (name /*:String*/, value /*:Object*/, options /*:Object*/) /*:String*/ {
var lang = YAHOO.lang;
if (!lang.isString(name)){
throw new TypeError("Cookie.setSubs(): Cookie name must be a string.");
}
if (!lang.isObject(value)){
throw new TypeError("Cookie.setSubs(): Cookie value must be an object.");
}
var text /*:String*/ = this._createCookieString(name, this._createCookieHashString(value), false, options);
document.cookie = text;
return text;
} | [
"function",
"(",
"name",
"/*:String*/",
",",
"value",
"/*:Object*/",
",",
"options",
"/*:Object*/",
")",
"/*:String*/",
"{",
"var",
"lang",
"=",
"YAHOO",
".",
"lang",
";",
"if",
"(",
"!",
"lang",
".",
"isString",
"(",
"name",
")",
")",
"{",
"throw",
"new",
"TypeError",
"(",
"\"Cookie.setSubs(): Cookie name must be a string.\"",
")",
";",
"}",
"if",
"(",
"!",
"lang",
".",
"isObject",
"(",
"value",
")",
")",
"{",
"throw",
"new",
"TypeError",
"(",
"\"Cookie.setSubs(): Cookie value must be an object.\"",
")",
";",
"}",
"var",
"text",
"/*:String*/",
"=",
"this",
".",
"_createCookieString",
"(",
"name",
",",
"this",
".",
"_createCookieHashString",
"(",
"value",
")",
",",
"false",
",",
"options",
")",
";",
"document",
".",
"cookie",
"=",
"text",
";",
"return",
"text",
";",
"}"
]
| Sets a cookie with a given name to contain a hash of name-value pairs.
@param {String} name The name of the cookie to set.
@param {Object} value An object containing name-value pairs.
@param {Object} options (Optional) An object containing one or more
cookie options: path (a string), domain (a string), expires (a Date object),
and secure (true/false).
@return {String} The created cookie string.
@method setSubs
@static | [
"Sets",
"a",
"cookie",
"with",
"a",
"given",
"name",
"to",
"contain",
"a",
"hash",
"of",
"name",
"-",
"value",
"pairs",
"."
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/cookie/cookie.js#L463-L478 |
|
42,296 | neyric/webhookit | public/javascripts/WireIt/build/wireit-inputex-editor-grouping.js | function(el,style) {
var sStyle = YAHOO.util.Dom.getStyle(el, style);
return parseInt(sStyle.substr(0, sStyle.length-2), 10);
} | javascript | function(el,style) {
var sStyle = YAHOO.util.Dom.getStyle(el, style);
return parseInt(sStyle.substr(0, sStyle.length-2), 10);
} | [
"function",
"(",
"el",
",",
"style",
")",
"{",
"var",
"sStyle",
"=",
"YAHOO",
".",
"util",
".",
"Dom",
".",
"getStyle",
"(",
"el",
",",
"style",
")",
";",
"return",
"parseInt",
"(",
"sStyle",
".",
"substr",
"(",
"0",
",",
"sStyle",
".",
"length",
"-",
"2",
")",
",",
"10",
")",
";",
"}"
]
| Get a css property in pixels and convert it to an integer
@method getIntStyle
@namespace WireIt
@static
@param {HTMLElement} el The element
@param {String} style css-property to get
@return {Integer} integer size | [
"Get",
"a",
"css",
"property",
"in",
"pixels",
"and",
"convert",
"it",
"to",
"an",
"integer"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/WireIt/build/wireit-inputex-editor-grouping.js#L64-L67 |
|
42,297 | neyric/webhookit | public/javascripts/WireIt/build/wireit-inputex-editor-grouping.js | function() {
// Remove the canvas from the dom
this.parentEl.removeChild(this.element);
// Remove the wire reference from the connected terminals
if(this.terminal1 && this.terminal1.removeWire) {
this.terminal1.removeWire(this);
}
if(this.terminal2 && this.terminal2.removeWire) {
this.terminal2.removeWire(this);
}
// Remove references to old terminals
this.terminal1 = null;
this.terminal2 = null;
// Remove Label
if(this.labelEl) {
if(this.labelField) {
this.labelField.destroy();
}
this.labelEl.innerHTML = "";
}
} | javascript | function() {
// Remove the canvas from the dom
this.parentEl.removeChild(this.element);
// Remove the wire reference from the connected terminals
if(this.terminal1 && this.terminal1.removeWire) {
this.terminal1.removeWire(this);
}
if(this.terminal2 && this.terminal2.removeWire) {
this.terminal2.removeWire(this);
}
// Remove references to old terminals
this.terminal1 = null;
this.terminal2 = null;
// Remove Label
if(this.labelEl) {
if(this.labelField) {
this.labelField.destroy();
}
this.labelEl.innerHTML = "";
}
} | [
"function",
"(",
")",
"{",
"// Remove the canvas from the dom",
"this",
".",
"parentEl",
".",
"removeChild",
"(",
"this",
".",
"element",
")",
";",
"// Remove the wire reference from the connected terminals",
"if",
"(",
"this",
".",
"terminal1",
"&&",
"this",
".",
"terminal1",
".",
"removeWire",
")",
"{",
"this",
".",
"terminal1",
".",
"removeWire",
"(",
"this",
")",
";",
"}",
"if",
"(",
"this",
".",
"terminal2",
"&&",
"this",
".",
"terminal2",
".",
"removeWire",
")",
"{",
"this",
".",
"terminal2",
".",
"removeWire",
"(",
"this",
")",
";",
"}",
"// Remove references to old terminals",
"this",
".",
"terminal1",
"=",
"null",
";",
"this",
".",
"terminal2",
"=",
"null",
";",
"// Remove Label",
"if",
"(",
"this",
".",
"labelEl",
")",
"{",
"if",
"(",
"this",
".",
"labelField",
")",
"{",
"this",
".",
"labelField",
".",
"destroy",
"(",
")",
";",
"}",
"this",
".",
"labelEl",
".",
"innerHTML",
"=",
"\"\"",
";",
"}",
"}"
]
| Remove a Wire from the Dom
@method remove | [
"Remove",
"a",
"Wire",
"from",
"the",
"Dom"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/WireIt/build/wireit-inputex-editor-grouping.js#L463-L487 |
|
42,298 | neyric/webhookit | public/javascripts/WireIt/build/wireit-inputex-editor-grouping.js | function() {
var self=this, body=document.body;
if (!body || !body.firstChild) {
window.setTimeout( function() { self.createFrame(); }, 50 );
return;
}
var div=this.getDragEl(), Dom=YAHOO.util.Dom;
if (!div) {
div = document.createElement("div");
div.id = this.dragElId;
var s = div.style;
s.position = "absolute";
s.visibility = "hidden";
s.cursor = "move";
s.border = "2px solid #aaa";
s.zIndex = 999;
var size = this.terminalProxySize+"px";
s.height = size;
s.width = size;
var _data = document.createElement('div');
Dom.setStyle(_data, 'height', '100%');
Dom.setStyle(_data, 'width', '100%');
Dom.setStyle(_data, 'background-color', '#ccc');
Dom.setStyle(_data, 'opacity', '0');
div.appendChild(_data);
body.insertBefore(div, body.firstChild);
}
} | javascript | function() {
var self=this, body=document.body;
if (!body || !body.firstChild) {
window.setTimeout( function() { self.createFrame(); }, 50 );
return;
}
var div=this.getDragEl(), Dom=YAHOO.util.Dom;
if (!div) {
div = document.createElement("div");
div.id = this.dragElId;
var s = div.style;
s.position = "absolute";
s.visibility = "hidden";
s.cursor = "move";
s.border = "2px solid #aaa";
s.zIndex = 999;
var size = this.terminalProxySize+"px";
s.height = size;
s.width = size;
var _data = document.createElement('div');
Dom.setStyle(_data, 'height', '100%');
Dom.setStyle(_data, 'width', '100%');
Dom.setStyle(_data, 'background-color', '#ccc');
Dom.setStyle(_data, 'opacity', '0');
div.appendChild(_data);
body.insertBefore(div, body.firstChild);
}
} | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
",",
"body",
"=",
"document",
".",
"body",
";",
"if",
"(",
"!",
"body",
"||",
"!",
"body",
".",
"firstChild",
")",
"{",
"window",
".",
"setTimeout",
"(",
"function",
"(",
")",
"{",
"self",
".",
"createFrame",
"(",
")",
";",
"}",
",",
"50",
")",
";",
"return",
";",
"}",
"var",
"div",
"=",
"this",
".",
"getDragEl",
"(",
")",
",",
"Dom",
"=",
"YAHOO",
".",
"util",
".",
"Dom",
";",
"if",
"(",
"!",
"div",
")",
"{",
"div",
"=",
"document",
".",
"createElement",
"(",
"\"div\"",
")",
";",
"div",
".",
"id",
"=",
"this",
".",
"dragElId",
";",
"var",
"s",
"=",
"div",
".",
"style",
";",
"s",
".",
"position",
"=",
"\"absolute\"",
";",
"s",
".",
"visibility",
"=",
"\"hidden\"",
";",
"s",
".",
"cursor",
"=",
"\"move\"",
";",
"s",
".",
"border",
"=",
"\"2px solid #aaa\"",
";",
"s",
".",
"zIndex",
"=",
"999",
";",
"var",
"size",
"=",
"this",
".",
"terminalProxySize",
"+",
"\"px\"",
";",
"s",
".",
"height",
"=",
"size",
";",
"s",
".",
"width",
"=",
"size",
";",
"var",
"_data",
"=",
"document",
".",
"createElement",
"(",
"'div'",
")",
";",
"Dom",
".",
"setStyle",
"(",
"_data",
",",
"'height'",
",",
"'100%'",
")",
";",
"Dom",
".",
"setStyle",
"(",
"_data",
",",
"'width'",
",",
"'100%'",
")",
";",
"Dom",
".",
"setStyle",
"(",
"_data",
",",
"'background-color'",
",",
"'#ccc'",
")",
";",
"Dom",
".",
"setStyle",
"(",
"_data",
",",
"'opacity'",
",",
"'0'",
")",
";",
"div",
".",
"appendChild",
"(",
"_data",
")",
";",
"body",
".",
"insertBefore",
"(",
"div",
",",
"body",
".",
"firstChild",
")",
";",
"}",
"}"
]
| Took this method from the YAHOO.util.DDProxy class
to overwrite the creation of the proxy Element with our custom size
@method createFrame | [
"Took",
"this",
"method",
"from",
"the",
"YAHOO",
".",
"util",
".",
"DDProxy",
"class",
"to",
"overwrite",
"the",
"creation",
"of",
"the",
"proxy",
"Element",
"with",
"our",
"custom",
"size"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/WireIt/build/wireit-inputex-editor-grouping.js#L1342-L1369 |
|
42,299 | neyric/webhookit | public/javascripts/WireIt/build/wireit-inputex-editor-grouping.js | function() {
// Display the cut button
this.hideNow();
this.addClass(CSS_PREFIX+"Wire-scissors");
// The scissors are within the terminal element
this.appendTo(this._terminal.container ? this._terminal.container.layer.el : this._terminal.el.parentNode.parentNode);
// Ajoute un listener sur le scissor:
this.on("mouseover", this.show, this, true);
this.on("mouseout", this.hide, this, true);
this.on("click", this.scissorClick, this, true);
// On mouseover/mouseout to display/hide the scissors
Event.addListener(this._terminal.el, "mouseover", this.mouseOver, this, true);
Event.addListener(this._terminal.el, "mouseout", this.hide, this, true);
} | javascript | function() {
// Display the cut button
this.hideNow();
this.addClass(CSS_PREFIX+"Wire-scissors");
// The scissors are within the terminal element
this.appendTo(this._terminal.container ? this._terminal.container.layer.el : this._terminal.el.parentNode.parentNode);
// Ajoute un listener sur le scissor:
this.on("mouseover", this.show, this, true);
this.on("mouseout", this.hide, this, true);
this.on("click", this.scissorClick, this, true);
// On mouseover/mouseout to display/hide the scissors
Event.addListener(this._terminal.el, "mouseover", this.mouseOver, this, true);
Event.addListener(this._terminal.el, "mouseout", this.hide, this, true);
} | [
"function",
"(",
")",
"{",
"// Display the cut button",
"this",
".",
"hideNow",
"(",
")",
";",
"this",
".",
"addClass",
"(",
"CSS_PREFIX",
"+",
"\"Wire-scissors\"",
")",
";",
"// The scissors are within the terminal element",
"this",
".",
"appendTo",
"(",
"this",
".",
"_terminal",
".",
"container",
"?",
"this",
".",
"_terminal",
".",
"container",
".",
"layer",
".",
"el",
":",
"this",
".",
"_terminal",
".",
"el",
".",
"parentNode",
".",
"parentNode",
")",
";",
"// Ajoute un listener sur le scissor:",
"this",
".",
"on",
"(",
"\"mouseover\"",
",",
"this",
".",
"show",
",",
"this",
",",
"true",
")",
";",
"this",
".",
"on",
"(",
"\"mouseout\"",
",",
"this",
".",
"hide",
",",
"this",
",",
"true",
")",
";",
"this",
".",
"on",
"(",
"\"click\"",
",",
"this",
".",
"scissorClick",
",",
"this",
",",
"true",
")",
";",
"// On mouseover/mouseout to display/hide the scissors",
"Event",
".",
"addListener",
"(",
"this",
".",
"_terminal",
".",
"el",
",",
"\"mouseover\"",
",",
"this",
".",
"mouseOver",
",",
"this",
",",
"true",
")",
";",
"Event",
".",
"addListener",
"(",
"this",
".",
"_terminal",
".",
"el",
",",
"\"mouseout\"",
",",
"this",
".",
"hide",
",",
"this",
",",
"true",
")",
";",
"}"
]
| Init the scissors
@method initScissors | [
"Init",
"the",
"scissors"
]
| 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/WireIt/build/wireit-inputex-editor-grouping.js#L1650-L1667 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.