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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
27,900 | ariatemplates/ariatemplates | src/aria/tools/inspector/InspectorModule.js | function (domElt, color) {
this.clearHightlight();
color = color ? color : "#ACC2FF";
var pos = this.bridge.getAriaPackage().utils.Dom.calculatePosition(domElt);
var marker = this.bridge.getDocument().createElement('div');
marker.style.cssText = ["position:absolute;top:", pos.top, "px;left:", pos.left, "px;width:",
((domElt.offsetWidth - 8 > 0) ? domElt.offsetWidth - 8 : 0), "px;height:",
((domElt.offsetHeight - 8 > 0) ? domElt.offsetHeight - 8 : 0),
"px; border:dashed 4px " + color + ";z-index: 999999999999999;z-index: 999999999999999;"].join('');
this._holder.appendChild(marker);
marker = null;
this._hideTimeout = setTimeout(aria.utils.Function.bind(this.clearHightlight, this), 2000);
} | javascript | function (domElt, color) {
this.clearHightlight();
color = color ? color : "#ACC2FF";
var pos = this.bridge.getAriaPackage().utils.Dom.calculatePosition(domElt);
var marker = this.bridge.getDocument().createElement('div');
marker.style.cssText = ["position:absolute;top:", pos.top, "px;left:", pos.left, "px;width:",
((domElt.offsetWidth - 8 > 0) ? domElt.offsetWidth - 8 : 0), "px;height:",
((domElt.offsetHeight - 8 > 0) ? domElt.offsetHeight - 8 : 0),
"px; border:dashed 4px " + color + ";z-index: 999999999999999;z-index: 999999999999999;"].join('');
this._holder.appendChild(marker);
marker = null;
this._hideTimeout = setTimeout(aria.utils.Function.bind(this.clearHightlight, this), 2000);
} | [
"function",
"(",
"domElt",
",",
"color",
")",
"{",
"this",
".",
"clearHightlight",
"(",
")",
";",
"color",
"=",
"color",
"?",
"color",
":",
"\"#ACC2FF\"",
";",
"var",
"pos",
"=",
"this",
".",
"bridge",
".",
"getAriaPackage",
"(",
")",
".",
"utils",
".",
"Dom",
".",
"calculatePosition",
"(",
"domElt",
")",
";",
"var",
"marker",
"=",
"this",
".",
"bridge",
".",
"getDocument",
"(",
")",
".",
"createElement",
"(",
"'div'",
")",
";",
"marker",
".",
"style",
".",
"cssText",
"=",
"[",
"\"position:absolute;top:\"",
",",
"pos",
".",
"top",
",",
"\"px;left:\"",
",",
"pos",
".",
"left",
",",
"\"px;width:\"",
",",
"(",
"(",
"domElt",
".",
"offsetWidth",
"-",
"8",
">",
"0",
")",
"?",
"domElt",
".",
"offsetWidth",
"-",
"8",
":",
"0",
")",
",",
"\"px;height:\"",
",",
"(",
"(",
"domElt",
".",
"offsetHeight",
"-",
"8",
">",
"0",
")",
"?",
"domElt",
".",
"offsetHeight",
"-",
"8",
":",
"0",
")",
",",
"\"px; border:dashed 4px \"",
"+",
"color",
"+",
"\";z-index: 999999999999999;z-index: 999999999999999;\"",
"]",
".",
"join",
"(",
"''",
")",
";",
"this",
".",
"_holder",
".",
"appendChild",
"(",
"marker",
")",
";",
"marker",
"=",
"null",
";",
"this",
".",
"_hideTimeout",
"=",
"setTimeout",
"(",
"aria",
".",
"utils",
".",
"Function",
".",
"bind",
"(",
"this",
".",
"clearHightlight",
",",
"this",
")",
",",
"2000",
")",
";",
"}"
] | Highlight a dom element with borders
@param {HTMLElement} domElt
@param {String} color. default is #ACC2FF | [
"Highlight",
"a",
"dom",
"element",
"with",
"borders"
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/tools/inspector/InspectorModule.js#L347-L359 | |
27,901 | ariatemplates/ariatemplates | src/aria/tools/inspector/InspectorModule.js | function (templateCtxt, tplSource) {
ariaUtilsJson.setValue(this._data, "locked", true);
if (tplSource) {
tplSource = this._data.selectedTemplate.tplSrcEdit;
}
// do some cleaning
this.clearHightlight();
// do not close if target IS the contextual menu
if (this._mainContextual && templateCtxt.tplClasspath != this._mainContextual.CONTEXTUAL_TEMPLATE_CLASSPATH) {
this._mainContextual.close();
}
// replace in this scope Aria and aria
var oSelf = this;
var doIt = function () {
// var Aria = oSelf.bridge.getAria(), aria = oSelf.bridge.getAriaPackage();
// ... and call for reload
templateCtxt.$reload(tplSource, {
fn : oSelf._unlock,
scope : oSelf
});
};
doIt();
} | javascript | function (templateCtxt, tplSource) {
ariaUtilsJson.setValue(this._data, "locked", true);
if (tplSource) {
tplSource = this._data.selectedTemplate.tplSrcEdit;
}
// do some cleaning
this.clearHightlight();
// do not close if target IS the contextual menu
if (this._mainContextual && templateCtxt.tplClasspath != this._mainContextual.CONTEXTUAL_TEMPLATE_CLASSPATH) {
this._mainContextual.close();
}
// replace in this scope Aria and aria
var oSelf = this;
var doIt = function () {
// var Aria = oSelf.bridge.getAria(), aria = oSelf.bridge.getAriaPackage();
// ... and call for reload
templateCtxt.$reload(tplSource, {
fn : oSelf._unlock,
scope : oSelf
});
};
doIt();
} | [
"function",
"(",
"templateCtxt",
",",
"tplSource",
")",
"{",
"ariaUtilsJson",
".",
"setValue",
"(",
"this",
".",
"_data",
",",
"\"locked\"",
",",
"true",
")",
";",
"if",
"(",
"tplSource",
")",
"{",
"tplSource",
"=",
"this",
".",
"_data",
".",
"selectedTemplate",
".",
"tplSrcEdit",
";",
"}",
"// do some cleaning",
"this",
".",
"clearHightlight",
"(",
")",
";",
"// do not close if target IS the contextual menu",
"if",
"(",
"this",
".",
"_mainContextual",
"&&",
"templateCtxt",
".",
"tplClasspath",
"!=",
"this",
".",
"_mainContextual",
".",
"CONTEXTUAL_TEMPLATE_CLASSPATH",
")",
"{",
"this",
".",
"_mainContextual",
".",
"close",
"(",
")",
";",
"}",
"// replace in this scope Aria and aria",
"var",
"oSelf",
"=",
"this",
";",
"var",
"doIt",
"=",
"function",
"(",
")",
"{",
"// var Aria = oSelf.bridge.getAria(), aria = oSelf.bridge.getAriaPackage();",
"// ... and call for reload",
"templateCtxt",
".",
"$reload",
"(",
"tplSource",
",",
"{",
"fn",
":",
"oSelf",
".",
"_unlock",
",",
"scope",
":",
"oSelf",
"}",
")",
";",
"}",
";",
"doIt",
"(",
")",
";",
"}"
] | Reload a template for given template context
@param {aria.templates.TemplateCtxt} templateCtxt
@source {Boolean} tplSource optional template source provided ? | [
"Reload",
"a",
"template",
"for",
"given",
"template",
"context"
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/tools/inspector/InspectorModule.js#L366-L395 | |
27,902 | ariatemplates/ariatemplates | src/aria/tools/inspector/InspectorModule.js | function (moduleCtrl) {
var moduleFactory = this.bridge.getAriaPackage().templates.ModuleCtrlFactory;
ariaUtilsJson.setValue(this._data, "locked", true);
// do some cleaning
this.clearHightlight();
moduleFactory.reloadModuleCtrl(moduleCtrl, {
fn : this._unlock,
scope : this
});
} | javascript | function (moduleCtrl) {
var moduleFactory = this.bridge.getAriaPackage().templates.ModuleCtrlFactory;
ariaUtilsJson.setValue(this._data, "locked", true);
// do some cleaning
this.clearHightlight();
moduleFactory.reloadModuleCtrl(moduleCtrl, {
fn : this._unlock,
scope : this
});
} | [
"function",
"(",
"moduleCtrl",
")",
"{",
"var",
"moduleFactory",
"=",
"this",
".",
"bridge",
".",
"getAriaPackage",
"(",
")",
".",
"templates",
".",
"ModuleCtrlFactory",
";",
"ariaUtilsJson",
".",
"setValue",
"(",
"this",
".",
"_data",
",",
"\"locked\"",
",",
"true",
")",
";",
"// do some cleaning",
"this",
".",
"clearHightlight",
"(",
")",
";",
"moduleFactory",
".",
"reloadModuleCtrl",
"(",
"moduleCtrl",
",",
"{",
"fn",
":",
"this",
".",
"_unlock",
",",
"scope",
":",
"this",
"}",
")",
";",
"}"
] | Reload a module
@param {aria.templates.ModuleCtrl} moduleCtrl | [
"Reload",
"a",
"module"
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/tools/inspector/InspectorModule.js#L411-L422 | |
27,903 | ariatemplates/ariatemplates | src/aria/tools/inspector/InspectorModule.js | function (templateCtxt) {
var moduleCtrl = templateCtxt.moduleCtrlPrivate;
// find associated module
var modules = this._data.modules, i, l;
for (i = 0, l = modules.length; i < l; i++) {
if (modules[i].moduleCtrl == moduleCtrl) {
this._data.selectedModule = modules[i];
break;
} else {
this._data.selectedModule = null;
}
}
// find associated template description
this._data.selectedTemplate = this._findTemplateDes(this._data.templates, templateCtxt);
} | javascript | function (templateCtxt) {
var moduleCtrl = templateCtxt.moduleCtrlPrivate;
// find associated module
var modules = this._data.modules, i, l;
for (i = 0, l = modules.length; i < l; i++) {
if (modules[i].moduleCtrl == moduleCtrl) {
this._data.selectedModule = modules[i];
break;
} else {
this._data.selectedModule = null;
}
}
// find associated template description
this._data.selectedTemplate = this._findTemplateDes(this._data.templates, templateCtxt);
} | [
"function",
"(",
"templateCtxt",
")",
"{",
"var",
"moduleCtrl",
"=",
"templateCtxt",
".",
"moduleCtrlPrivate",
";",
"// find associated module",
"var",
"modules",
"=",
"this",
".",
"_data",
".",
"modules",
",",
"i",
",",
"l",
";",
"for",
"(",
"i",
"=",
"0",
",",
"l",
"=",
"modules",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
"if",
"(",
"modules",
"[",
"i",
"]",
".",
"moduleCtrl",
"==",
"moduleCtrl",
")",
"{",
"this",
".",
"_data",
".",
"selectedModule",
"=",
"modules",
"[",
"i",
"]",
";",
"break",
";",
"}",
"else",
"{",
"this",
".",
"_data",
".",
"selectedModule",
"=",
"null",
";",
"}",
"}",
"// find associated template description",
"this",
".",
"_data",
".",
"selectedTemplate",
"=",
"this",
".",
"_findTemplateDes",
"(",
"this",
".",
"_data",
".",
"templates",
",",
"templateCtxt",
")",
";",
"}"
] | Set in selected template and moduleCtrl descriptions from a given template context
@protected
@param {aria.templates.TemplateCtxt} templateCtxt | [
"Set",
"in",
"selected",
"template",
"and",
"moduleCtrl",
"descriptions",
"from",
"a",
"given",
"template",
"context"
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/tools/inspector/InspectorModule.js#L451-L466 | |
27,904 | ariatemplates/ariatemplates | src/aria/tools/inspector/InspectorModule.js | function (container, templateCtxt) {
var contentSearch = null, i, l;
for (i = 0, l = container.length; i < l; i++) {
var description = container[i];
if (description.templateCtxt == templateCtxt) {
return description;
} else {
contentSearch = this._findTemplateDes(description.content, templateCtxt);
if (contentSearch) {
return contentSearch;
}
}
}
return null;
} | javascript | function (container, templateCtxt) {
var contentSearch = null, i, l;
for (i = 0, l = container.length; i < l; i++) {
var description = container[i];
if (description.templateCtxt == templateCtxt) {
return description;
} else {
contentSearch = this._findTemplateDes(description.content, templateCtxt);
if (contentSearch) {
return contentSearch;
}
}
}
return null;
} | [
"function",
"(",
"container",
",",
"templateCtxt",
")",
"{",
"var",
"contentSearch",
"=",
"null",
",",
"i",
",",
"l",
";",
"for",
"(",
"i",
"=",
"0",
",",
"l",
"=",
"container",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
"var",
"description",
"=",
"container",
"[",
"i",
"]",
";",
"if",
"(",
"description",
".",
"templateCtxt",
"==",
"templateCtxt",
")",
"{",
"return",
"description",
";",
"}",
"else",
"{",
"contentSearch",
"=",
"this",
".",
"_findTemplateDes",
"(",
"description",
".",
"content",
",",
"templateCtxt",
")",
";",
"if",
"(",
"contentSearch",
")",
"{",
"return",
"contentSearch",
";",
"}",
"}",
"}",
"return",
"null",
";",
"}"
] | Find description linked with given templateCtxt
@protected
@param {Array} container
@param {aria.templates.TemplateCtxt} templateCtxt
@return {Object} | [
"Find",
"description",
"linked",
"with",
"given",
"templateCtxt"
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/tools/inspector/InspectorModule.js#L475-L489 | |
27,905 | ariatemplates/ariatemplates | src/aria/widgets/container/Div.js | function (cfg) {
var hasChanged = false, prefName, newVal;
var prefs = ['maxWidth', 'maxHeight', 'minWidth', 'width', 'height'];
for (var i = 0, len = prefs.length; i < len; i++) {
prefName = prefs[i];
newVal = cfg[prefName];
if (newVal && newVal != this._cfg[prefName]) {
this._cfg[prefName] = newVal;
hasChanged = true;
}
}
if (cfg.maximized !== this._cfg.maximized) {
this._cfg.maximized = cfg.maximized;
hasChanged = true;
}
if (cfg.maximized) {
this._cfg.widthMaximized = cfg.widthMaximized;
this._cfg.heightMaximized = cfg.heightMaximized;
hasChanged = true;
} else {
this._cfg.widthMaximized = null;
this._cfg.heightMaximized = null;
}
if (hasChanged) {
this.$Container._updateSize.call(this);
}
} | javascript | function (cfg) {
var hasChanged = false, prefName, newVal;
var prefs = ['maxWidth', 'maxHeight', 'minWidth', 'width', 'height'];
for (var i = 0, len = prefs.length; i < len; i++) {
prefName = prefs[i];
newVal = cfg[prefName];
if (newVal && newVal != this._cfg[prefName]) {
this._cfg[prefName] = newVal;
hasChanged = true;
}
}
if (cfg.maximized !== this._cfg.maximized) {
this._cfg.maximized = cfg.maximized;
hasChanged = true;
}
if (cfg.maximized) {
this._cfg.widthMaximized = cfg.widthMaximized;
this._cfg.heightMaximized = cfg.heightMaximized;
hasChanged = true;
} else {
this._cfg.widthMaximized = null;
this._cfg.heightMaximized = null;
}
if (hasChanged) {
this.$Container._updateSize.call(this);
}
} | [
"function",
"(",
"cfg",
")",
"{",
"var",
"hasChanged",
"=",
"false",
",",
"prefName",
",",
"newVal",
";",
"var",
"prefs",
"=",
"[",
"'maxWidth'",
",",
"'maxHeight'",
",",
"'minWidth'",
",",
"'width'",
",",
"'height'",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"len",
"=",
"prefs",
".",
"length",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"prefName",
"=",
"prefs",
"[",
"i",
"]",
";",
"newVal",
"=",
"cfg",
"[",
"prefName",
"]",
";",
"if",
"(",
"newVal",
"&&",
"newVal",
"!=",
"this",
".",
"_cfg",
"[",
"prefName",
"]",
")",
"{",
"this",
".",
"_cfg",
"[",
"prefName",
"]",
"=",
"newVal",
";",
"hasChanged",
"=",
"true",
";",
"}",
"}",
"if",
"(",
"cfg",
".",
"maximized",
"!==",
"this",
".",
"_cfg",
".",
"maximized",
")",
"{",
"this",
".",
"_cfg",
".",
"maximized",
"=",
"cfg",
".",
"maximized",
";",
"hasChanged",
"=",
"true",
";",
"}",
"if",
"(",
"cfg",
".",
"maximized",
")",
"{",
"this",
".",
"_cfg",
".",
"widthMaximized",
"=",
"cfg",
".",
"widthMaximized",
";",
"this",
".",
"_cfg",
".",
"heightMaximized",
"=",
"cfg",
".",
"heightMaximized",
";",
"hasChanged",
"=",
"true",
";",
"}",
"else",
"{",
"this",
".",
"_cfg",
".",
"widthMaximized",
"=",
"null",
";",
"this",
".",
"_cfg",
".",
"heightMaximized",
"=",
"null",
";",
"}",
"if",
"(",
"hasChanged",
")",
"{",
"this",
".",
"$Container",
".",
"_updateSize",
".",
"call",
"(",
"this",
")",
";",
"}",
"}"
] | Change the width, height, max width and max height of the configuration, then update the container size
@param {aria.widgets.CfgBeans:DivCfg} cfg the widget configuration (only width, height, maxWidth, maxHeight,
maximized will be used) | [
"Change",
"the",
"width",
"height",
"max",
"width",
"and",
"max",
"height",
"of",
"the",
"configuration",
"then",
"update",
"the",
"container",
"size"
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/container/Div.js#L107-L137 | |
27,906 | ariatemplates/ariatemplates | src/aria/core/TplClassLoader.js | function (args) {
var div = args.cfg.tplDiv;
if (div) {
aria.utils.Dom.replaceHTML(div, "#TEMPLATE ERROR#");
}
this.$callback(args.cb, {
success : false
});
} | javascript | function (args) {
var div = args.cfg.tplDiv;
if (div) {
aria.utils.Dom.replaceHTML(div, "#TEMPLATE ERROR#");
}
this.$callback(args.cb, {
success : false
});
} | [
"function",
"(",
"args",
")",
"{",
"var",
"div",
"=",
"args",
".",
"cfg",
".",
"tplDiv",
";",
"if",
"(",
"div",
")",
"{",
"aria",
".",
"utils",
".",
"Dom",
".",
"replaceHTML",
"(",
"div",
",",
"\"#TEMPLATE ERROR#\"",
")",
";",
"}",
"this",
".",
"$callback",
"(",
"args",
".",
"cb",
",",
"{",
"success",
":",
"false",
"}",
")",
";",
"}"
] | Display an error in the template container and call the callback notifying the error.
@param {Object} args
@private | [
"Display",
"an",
"error",
"in",
"the",
"template",
"container",
"and",
"call",
"the",
"callback",
"notifying",
"the",
"error",
"."
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/core/TplClassLoader.js#L27-L36 | |
27,907 | ariatemplates/ariatemplates | src/aria/core/TplClassLoader.js | function (classes, printOptions) {
classes = classes.replace(/(\s|^)\s*xPrint\w*/g, '');
if (printOptions == "adaptX") {
classes += " xPrintAdaptX";
} else if (printOptions == "adaptY") {
classes += " xPrintAdaptY";
} else if (printOptions == "adaptXY") {
classes += " xPrintAdaptX xPrintAdaptY";
} else if (printOptions == "hidden") {
classes += " xPrintHide";
}
return classes;
} | javascript | function (classes, printOptions) {
classes = classes.replace(/(\s|^)\s*xPrint\w*/g, '');
if (printOptions == "adaptX") {
classes += " xPrintAdaptX";
} else if (printOptions == "adaptY") {
classes += " xPrintAdaptY";
} else if (printOptions == "adaptXY") {
classes += " xPrintAdaptX xPrintAdaptY";
} else if (printOptions == "hidden") {
classes += " xPrintHide";
}
return classes;
} | [
"function",
"(",
"classes",
",",
"printOptions",
")",
"{",
"classes",
"=",
"classes",
".",
"replace",
"(",
"/",
"(\\s|^)\\s*xPrint\\w*",
"/",
"g",
",",
"''",
")",
";",
"if",
"(",
"printOptions",
"==",
"\"adaptX\"",
")",
"{",
"classes",
"+=",
"\" xPrintAdaptX\"",
";",
"}",
"else",
"if",
"(",
"printOptions",
"==",
"\"adaptY\"",
")",
"{",
"classes",
"+=",
"\" xPrintAdaptY\"",
";",
"}",
"else",
"if",
"(",
"printOptions",
"==",
"\"adaptXY\"",
")",
"{",
"classes",
"+=",
"\" xPrintAdaptX xPrintAdaptY\"",
";",
"}",
"else",
"if",
"(",
"printOptions",
"==",
"\"hidden\"",
")",
"{",
"classes",
"+=",
"\" xPrintHide\"",
";",
"}",
"return",
"classes",
";",
"}"
] | Convert print options into a set of CSS classes and add them to the provided set of classes.
@param {String} classes Set of classes separated by a space (e.g. className property). If print options
CSS classes are already present in this string, they will be removed.
@param {aria.templates.CfgBeans:PrintOptions} printOptions print options
@return {String} the updated set of classes. | [
"Convert",
"print",
"options",
"into",
"a",
"set",
"of",
"CSS",
"classes",
"and",
"add",
"them",
"to",
"the",
"provided",
"set",
"of",
"classes",
"."
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/core/TplClassLoader.js#L324-L336 | |
27,908 | ariatemplates/ariatemplates | src/aria/core/TplClassLoader.js | function (cfg, cb) {
var appE = Aria.getClassRef("aria.core.environment.Customizations");
if (appE && appE.isCustomized() && !appE.descriptorLoaded()) {
// the application is customized but the descriptor hasn't been loaded yet: register to the event
appE.$onOnce({
'descriptorLoaded' : {
fn : this._startLoad,
scope : this,
args : {
cfg : cfg,
cb : cb
}
}
});
} else {
// no descriptor was specified, or it has already been loaded: go ahead
this._startLoad(null, {
cfg : cfg,
cb : cb
});
}
} | javascript | function (cfg, cb) {
var appE = Aria.getClassRef("aria.core.environment.Customizations");
if (appE && appE.isCustomized() && !appE.descriptorLoaded()) {
// the application is customized but the descriptor hasn't been loaded yet: register to the event
appE.$onOnce({
'descriptorLoaded' : {
fn : this._startLoad,
scope : this,
args : {
cfg : cfg,
cb : cb
}
}
});
} else {
// no descriptor was specified, or it has already been loaded: go ahead
this._startLoad(null, {
cfg : cfg,
cb : cb
});
}
} | [
"function",
"(",
"cfg",
",",
"cb",
")",
"{",
"var",
"appE",
"=",
"Aria",
".",
"getClassRef",
"(",
"\"aria.core.environment.Customizations\"",
")",
";",
"if",
"(",
"appE",
"&&",
"appE",
".",
"isCustomized",
"(",
")",
"&&",
"!",
"appE",
".",
"descriptorLoaded",
"(",
")",
")",
"{",
"// the application is customized but the descriptor hasn't been loaded yet: register to the event",
"appE",
".",
"$onOnce",
"(",
"{",
"'descriptorLoaded'",
":",
"{",
"fn",
":",
"this",
".",
"_startLoad",
",",
"scope",
":",
"this",
",",
"args",
":",
"{",
"cfg",
":",
"cfg",
",",
"cb",
":",
"cb",
"}",
"}",
"}",
")",
";",
"}",
"else",
"{",
"// no descriptor was specified, or it has already been loaded: go ahead",
"this",
".",
"_startLoad",
"(",
"null",
",",
"{",
"cfg",
":",
"cfg",
",",
"cb",
":",
"cb",
"}",
")",
";",
"}",
"}"
] | Load a template in a div. You should call Aria.loadTemplate, instead of this method.
@param {aria.templates.CfgBeans:LoadTemplateCfg} cfg configuration object
@param {aria.core.CfgBeans:Callback} callback which will be called when the template is loaded or if
there is an error. The first parameter of the callback is a JSON object with the following properties: {
success : {Boolean} true if the template was displayed, false otherwise } Note that the callback is
called when the template is loaded, but sub-templates may still be waiting to be loaded (showing a
loading indicator). Note that success==true means that the template was displayed, but there may be
errors inside some widgets or sub-templates. | [
"Load",
"a",
"template",
"in",
"a",
"div",
".",
"You",
"should",
"call",
"Aria",
".",
"loadTemplate",
"instead",
"of",
"this",
"method",
"."
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/core/TplClassLoader.js#L348-L369 | |
27,909 | ariatemplates/ariatemplates | src/aria/core/TplClassLoader.js | function (div) {
if (typeof(div) == "string") {
div = aria.utils.Dom.getElementById(div);
}
if (aria && aria.utils && aria.utils.Dom) {
return aria.templates.TemplateCtxtManager.disposeFromDom(div);
}
} | javascript | function (div) {
if (typeof(div) == "string") {
div = aria.utils.Dom.getElementById(div);
}
if (aria && aria.utils && aria.utils.Dom) {
return aria.templates.TemplateCtxtManager.disposeFromDom(div);
}
} | [
"function",
"(",
"div",
")",
"{",
"if",
"(",
"typeof",
"(",
"div",
")",
"==",
"\"string\"",
")",
"{",
"div",
"=",
"aria",
".",
"utils",
".",
"Dom",
".",
"getElementById",
"(",
"div",
")",
";",
"}",
"if",
"(",
"aria",
"&&",
"aria",
".",
"utils",
"&&",
"aria",
".",
"utils",
".",
"Dom",
")",
"{",
"return",
"aria",
".",
"templates",
".",
"TemplateCtxtManager",
".",
"disposeFromDom",
"(",
"div",
")",
";",
"}",
"}"
] | Unload a template loaded with Aria.loadTemplate. You should call Aria.disposeTemplate, instead of this
method.
@param {aria.templates.CfgBeans:Div} div The div given to Aria.loadTemplate. | [
"Unload",
"a",
"template",
"loaded",
"with",
"Aria",
".",
"loadTemplate",
".",
"You",
"should",
"call",
"Aria",
".",
"disposeTemplate",
"instead",
"of",
"this",
"method",
"."
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/core/TplClassLoader.js#L406-L413 | |
27,910 | ariatemplates/ariatemplates | src/aria/templates/CSSCtxt.js | function (cfg) {
if (!ariaCoreJsonValidator.normalize({
json : cfg,
beanName : "aria.templates.CfgBeans.InitCSSTemplateCfg"
})) {
return false;
}
this._cfg = cfg;
// Get an insatnce of the CSS template
var tpl = Aria.getClassInstance(cfg.classpath);
if (!tpl) {
this.$logError(this.TEMPLATE_CONSTR_ERROR, [cfg.classpath]);
return false;
}
this._tpl = tpl;
// Main macro (not configurable)
cfg.macro = this.checkMacro({
name : "main",
args : cfg.args
});
this.tplClasspath = cfg.classpath;
// We no longer create new methods in a closure each time a new instance of a template is created,
// instead we use the interface mechanism to expose methods to the template and prevent access to the
// template context
ariaTemplatesICSS.call(tpl, this);
// TEMPORARY PERF IMPROVMENT : interface on these two functions results in poor performances.
// Investigation ongoing on interceptors
var oSelf = this;
tpl.__$write = function () {
return oSelf.__$write.apply(oSelf, arguments);
};
if (!tpl.__$initTemplate()) {
return false;
}
this.__loadLibs(tpl.__$csslibs, "csslibs");
return true;
} | javascript | function (cfg) {
if (!ariaCoreJsonValidator.normalize({
json : cfg,
beanName : "aria.templates.CfgBeans.InitCSSTemplateCfg"
})) {
return false;
}
this._cfg = cfg;
// Get an insatnce of the CSS template
var tpl = Aria.getClassInstance(cfg.classpath);
if (!tpl) {
this.$logError(this.TEMPLATE_CONSTR_ERROR, [cfg.classpath]);
return false;
}
this._tpl = tpl;
// Main macro (not configurable)
cfg.macro = this.checkMacro({
name : "main",
args : cfg.args
});
this.tplClasspath = cfg.classpath;
// We no longer create new methods in a closure each time a new instance of a template is created,
// instead we use the interface mechanism to expose methods to the template and prevent access to the
// template context
ariaTemplatesICSS.call(tpl, this);
// TEMPORARY PERF IMPROVMENT : interface on these two functions results in poor performances.
// Investigation ongoing on interceptors
var oSelf = this;
tpl.__$write = function () {
return oSelf.__$write.apply(oSelf, arguments);
};
if (!tpl.__$initTemplate()) {
return false;
}
this.__loadLibs(tpl.__$csslibs, "csslibs");
return true;
} | [
"function",
"(",
"cfg",
")",
"{",
"if",
"(",
"!",
"ariaCoreJsonValidator",
".",
"normalize",
"(",
"{",
"json",
":",
"cfg",
",",
"beanName",
":",
"\"aria.templates.CfgBeans.InitCSSTemplateCfg\"",
"}",
")",
")",
"{",
"return",
"false",
";",
"}",
"this",
".",
"_cfg",
"=",
"cfg",
";",
"// Get an insatnce of the CSS template",
"var",
"tpl",
"=",
"Aria",
".",
"getClassInstance",
"(",
"cfg",
".",
"classpath",
")",
";",
"if",
"(",
"!",
"tpl",
")",
"{",
"this",
".",
"$logError",
"(",
"this",
".",
"TEMPLATE_CONSTR_ERROR",
",",
"[",
"cfg",
".",
"classpath",
"]",
")",
";",
"return",
"false",
";",
"}",
"this",
".",
"_tpl",
"=",
"tpl",
";",
"// Main macro (not configurable)",
"cfg",
".",
"macro",
"=",
"this",
".",
"checkMacro",
"(",
"{",
"name",
":",
"\"main\"",
",",
"args",
":",
"cfg",
".",
"args",
"}",
")",
";",
"this",
".",
"tplClasspath",
"=",
"cfg",
".",
"classpath",
";",
"// We no longer create new methods in a closure each time a new instance of a template is created,",
"// instead we use the interface mechanism to expose methods to the template and prevent access to the",
"// template context",
"ariaTemplatesICSS",
".",
"call",
"(",
"tpl",
",",
"this",
")",
";",
"// TEMPORARY PERF IMPROVMENT : interface on these two functions results in poor performances.",
"// Investigation ongoing on interceptors",
"var",
"oSelf",
"=",
"this",
";",
"tpl",
".",
"__$write",
"=",
"function",
"(",
")",
"{",
"return",
"oSelf",
".",
"__$write",
".",
"apply",
"(",
"oSelf",
",",
"arguments",
")",
";",
"}",
";",
"if",
"(",
"!",
"tpl",
".",
"__$initTemplate",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"this",
".",
"__loadLibs",
"(",
"tpl",
".",
"__$csslibs",
",",
"\"csslibs\"",
")",
";",
"return",
"true",
";",
"}"
] | Init the CSS template with the given configuration.
@param {aria.templates.CfgBeans:InitCSSTemplateCfg} cfg Template context configuration
@return {Boolean} true if there was no error | [
"Init",
"the",
"CSS",
"template",
"with",
"the",
"given",
"configuration",
"."
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/CSSCtxt.js#L101-L144 | |
27,911 | ariatemplates/ariatemplates | src/aria/templates/CSSCtxt.js | function () {
if (this.__cachedOutput) {
return this.__cachedOutput;
}
// Call the main macro to let the template engine evaluate the text
this.$assert(156, this._out == null);
this._out = [];
this._callMacro(null, "main");
var text = this._out.join("");
if (ariaCoreAppEnvironment.applicationSettings.hasOwnProperty("imgUrlMapping") && ariaCoreAppEnvironment.applicationSettings.imgUrlMapping !== null) {
text = this._prefixCSSImgUrl(text);
}
this._out = null;
this.__cachedOutput = text;
return text;
} | javascript | function () {
if (this.__cachedOutput) {
return this.__cachedOutput;
}
// Call the main macro to let the template engine evaluate the text
this.$assert(156, this._out == null);
this._out = [];
this._callMacro(null, "main");
var text = this._out.join("");
if (ariaCoreAppEnvironment.applicationSettings.hasOwnProperty("imgUrlMapping") && ariaCoreAppEnvironment.applicationSettings.imgUrlMapping !== null) {
text = this._prefixCSSImgUrl(text);
}
this._out = null;
this.__cachedOutput = text;
return text;
} | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"__cachedOutput",
")",
"{",
"return",
"this",
".",
"__cachedOutput",
";",
"}",
"// Call the main macro to let the template engine evaluate the text",
"this",
".",
"$assert",
"(",
"156",
",",
"this",
".",
"_out",
"==",
"null",
")",
";",
"this",
".",
"_out",
"=",
"[",
"]",
";",
"this",
".",
"_callMacro",
"(",
"null",
",",
"\"main\"",
")",
";",
"var",
"text",
"=",
"this",
".",
"_out",
".",
"join",
"(",
"\"\"",
")",
";",
"if",
"(",
"ariaCoreAppEnvironment",
".",
"applicationSettings",
".",
"hasOwnProperty",
"(",
"\"imgUrlMapping\"",
")",
"&&",
"ariaCoreAppEnvironment",
".",
"applicationSettings",
".",
"imgUrlMapping",
"!==",
"null",
")",
"{",
"text",
"=",
"this",
".",
"_prefixCSSImgUrl",
"(",
"text",
")",
";",
"}",
"this",
".",
"_out",
"=",
"null",
";",
"this",
".",
"__cachedOutput",
"=",
"text",
";",
"return",
"text",
";",
"}"
] | Returns the output of the main macro. It only actually calls the main macro the first time, and then only
returns a cached version.
@return {String} | [
"Returns",
"the",
"output",
"of",
"the",
"main",
"macro",
".",
"It",
"only",
"actually",
"calls",
"the",
"main",
"macro",
"the",
"first",
"time",
"and",
"then",
"only",
"returns",
"a",
"cached",
"version",
"."
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/CSSCtxt.js#L180-L197 | |
27,912 | ariatemplates/ariatemplates | src/aria/templates/CSSCtxt.js | function (classPrefix) {
var text = this._getOutput();
// Format the prefix for the CSS text
var prefix = "." + classPrefix + " ";
var prefixed = this.__prefixingAlgorithm(text, prefix);
this.__prefixedText = prefixed.text;
this.__numSelectors = prefixed.selectors;
} | javascript | function (classPrefix) {
var text = this._getOutput();
// Format the prefix for the CSS text
var prefix = "." + classPrefix + " ";
var prefixed = this.__prefixingAlgorithm(text, prefix);
this.__prefixedText = prefixed.text;
this.__numSelectors = prefixed.selectors;
} | [
"function",
"(",
"classPrefix",
")",
"{",
"var",
"text",
"=",
"this",
".",
"_getOutput",
"(",
")",
";",
"// Format the prefix for the CSS text",
"var",
"prefix",
"=",
"\".\"",
"+",
"classPrefix",
"+",
"\" \"",
";",
"var",
"prefixed",
"=",
"this",
".",
"__prefixingAlgorithm",
"(",
"text",
",",
"prefix",
")",
";",
"this",
".",
"__prefixedText",
"=",
"prefixed",
".",
"text",
";",
"this",
".",
"__numSelectors",
"=",
"prefixed",
".",
"selectors",
";",
"}"
] | Prefix the CSS text
@param {String} classPrefix class prefix for each selector | [
"Prefix",
"the",
"CSS",
"text"
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/CSSCtxt.js#L203-L212 | |
27,913 | ariatemplates/ariatemplates | src/aria/templates/CSSCtxt.js | function (cssText) {
cssText = cssText.replace(/\burl\s*\(\s*["']?([^"'\r\n,]+|[^'\r\n,]+|[^"\r\n,]+)["']?\s*\)/gi, ariaUtilsFunction.bind(function (match, urlpart) {
var prefixedUrl = ariaCoreAppEnvironment.applicationSettings.imgUrlMapping(urlpart, this.tplClasspath);
return this._parseImgUrl(prefixedUrl);
}, this));
return cssText;
} | javascript | function (cssText) {
cssText = cssText.replace(/\burl\s*\(\s*["']?([^"'\r\n,]+|[^'\r\n,]+|[^"\r\n,]+)["']?\s*\)/gi, ariaUtilsFunction.bind(function (match, urlpart) {
var prefixedUrl = ariaCoreAppEnvironment.applicationSettings.imgUrlMapping(urlpart, this.tplClasspath);
return this._parseImgUrl(prefixedUrl);
}, this));
return cssText;
} | [
"function",
"(",
"cssText",
")",
"{",
"cssText",
"=",
"cssText",
".",
"replace",
"(",
"/",
"\\burl\\s*\\(\\s*[\"']?([^\"'\\r\\n,]+|[^'\\r\\n,]+|[^\"\\r\\n,]+)[\"']?\\s*\\)",
"/",
"gi",
",",
"ariaUtilsFunction",
".",
"bind",
"(",
"function",
"(",
"match",
",",
"urlpart",
")",
"{",
"var",
"prefixedUrl",
"=",
"ariaCoreAppEnvironment",
".",
"applicationSettings",
".",
"imgUrlMapping",
"(",
"urlpart",
",",
"this",
".",
"tplClasspath",
")",
";",
"return",
"this",
".",
"_parseImgUrl",
"(",
"prefixedUrl",
")",
";",
"}",
",",
"this",
")",
")",
";",
"return",
"cssText",
";",
"}"
] | Prefix the image URLs calling the method set inside the app environment
@param {String} cssText CSS text
@return {String} | [
"Prefix",
"the",
"image",
"URLs",
"calling",
"the",
"method",
"set",
"inside",
"the",
"app",
"environment"
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/CSSCtxt.js#L219-L226 | |
27,914 | ariatemplates/ariatemplates | src/aria/templates/CSSCtxt.js | function (url) {
var tmp = url.replace(/\burl\s*/gi, ""); // removing url word
tmp = tmp.charAt(0) === "(" ? tmp.substring(1, tmp.length - 1) : tmp; // removing brackets
tmp = tmp.charAt(0) === "\'" || tmp.charAt(0) === "\"" ? tmp.substring(1, tmp.length - 1) : tmp; // removing quotes
return tmp;
} | javascript | function (url) {
var tmp = url.replace(/\burl\s*/gi, ""); // removing url word
tmp = tmp.charAt(0) === "(" ? tmp.substring(1, tmp.length - 1) : tmp; // removing brackets
tmp = tmp.charAt(0) === "\'" || tmp.charAt(0) === "\"" ? tmp.substring(1, tmp.length - 1) : tmp; // removing quotes
return tmp;
} | [
"function",
"(",
"url",
")",
"{",
"var",
"tmp",
"=",
"url",
".",
"replace",
"(",
"/",
"\\burl\\s*",
"/",
"gi",
",",
"\"\"",
")",
";",
"// removing url word",
"tmp",
"=",
"tmp",
".",
"charAt",
"(",
"0",
")",
"===",
"\"(\"",
"?",
"tmp",
".",
"substring",
"(",
"1",
",",
"tmp",
".",
"length",
"-",
"1",
")",
":",
"tmp",
";",
"// removing brackets",
"tmp",
"=",
"tmp",
".",
"charAt",
"(",
"0",
")",
"===",
"\"\\'\"",
"||",
"tmp",
".",
"charAt",
"(",
"0",
")",
"===",
"\"\\\"\"",
"?",
"tmp",
".",
"substring",
"(",
"1",
",",
"tmp",
".",
"length",
"-",
"1",
")",
":",
"tmp",
";",
"// removing quotes",
"return",
"tmp",
";",
"}"
] | Clean the url removing brackets, quotes, etc.
@param {String} url URL
@return {String} | [
"Clean",
"the",
"url",
"removing",
"brackets",
"quotes",
"etc",
"."
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/CSSCtxt.js#L242-L247 | |
27,915 | ariatemplates/ariatemplates | src/aria/widgets/form/RadioButton.js | function (event) {
if (event.keyCode == aria.DomEvent.KC_SPACE) {
this._setRadioValue();
event.preventDefault(true);
} else if (event.keyCode == aria.DomEvent.KC_LEFT) {
this._navigate(-1);
event.preventDefault(true);
} else if (event.keyCode == aria.DomEvent.KC_RIGHT) {
this._navigate(+1);
event.preventDefault(true);
} else if (event.keyCode == aria.DomEvent.KC_DOWN) {
this._navigate(+1);
event.preventDefault(true);
} else if (event.keyCode == aria.DomEvent.KC_UP) {
this._navigate(-1);
event.preventDefault(true);
}
} | javascript | function (event) {
if (event.keyCode == aria.DomEvent.KC_SPACE) {
this._setRadioValue();
event.preventDefault(true);
} else if (event.keyCode == aria.DomEvent.KC_LEFT) {
this._navigate(-1);
event.preventDefault(true);
} else if (event.keyCode == aria.DomEvent.KC_RIGHT) {
this._navigate(+1);
event.preventDefault(true);
} else if (event.keyCode == aria.DomEvent.KC_DOWN) {
this._navigate(+1);
event.preventDefault(true);
} else if (event.keyCode == aria.DomEvent.KC_UP) {
this._navigate(-1);
event.preventDefault(true);
}
} | [
"function",
"(",
"event",
")",
"{",
"if",
"(",
"event",
".",
"keyCode",
"==",
"aria",
".",
"DomEvent",
".",
"KC_SPACE",
")",
"{",
"this",
".",
"_setRadioValue",
"(",
")",
";",
"event",
".",
"preventDefault",
"(",
"true",
")",
";",
"}",
"else",
"if",
"(",
"event",
".",
"keyCode",
"==",
"aria",
".",
"DomEvent",
".",
"KC_LEFT",
")",
"{",
"this",
".",
"_navigate",
"(",
"-",
"1",
")",
";",
"event",
".",
"preventDefault",
"(",
"true",
")",
";",
"}",
"else",
"if",
"(",
"event",
".",
"keyCode",
"==",
"aria",
".",
"DomEvent",
".",
"KC_RIGHT",
")",
"{",
"this",
".",
"_navigate",
"(",
"+",
"1",
")",
";",
"event",
".",
"preventDefault",
"(",
"true",
")",
";",
"}",
"else",
"if",
"(",
"event",
".",
"keyCode",
"==",
"aria",
".",
"DomEvent",
".",
"KC_DOWN",
")",
"{",
"this",
".",
"_navigate",
"(",
"+",
"1",
")",
";",
"event",
".",
"preventDefault",
"(",
"true",
")",
";",
"}",
"else",
"if",
"(",
"event",
".",
"keyCode",
"==",
"aria",
".",
"DomEvent",
".",
"KC_UP",
")",
"{",
"this",
".",
"_navigate",
"(",
"-",
"1",
")",
";",
"event",
".",
"preventDefault",
"(",
"true",
")",
";",
"}",
"}"
] | Toggle value on SPACE key down
@param {aria.DomEvent} event | [
"Toggle",
"value",
"on",
"SPACE",
"key",
"down"
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/RadioButton.js#L128-L145 | |
27,916 | ariatemplates/ariatemplates | src/aria/widgets/form/RadioButton.js | function (direction) {
if (!this._cfg || !this._cfg.bind || !this._cfg.bind.value) {
// no binding for the value : return
return;
}
var currentBinding = this._cfg.bind.value;
var index = ariaUtilsArray.indexOf(this._instances, this), radioButtonNb = this._instances.length;
var bindings, next, nextBinding;
var waiAria = this._cfg.waiAria;
while (index >= 0 && index < radioButtonNb) {
index = index + direction;
if (waiAria) {
if (index < 0) {
index = radioButtonNb - 1;
} else if (index >= radioButtonNb) {
index = 0;
}
} else if (index < 0 || index >= radioButtonNb) {
break;
}
next = this._instances[index];
bindings = next._cfg.bind;
if (!next.getProperty("disabled") && bindings) {
nextBinding = bindings.value;
if (nextBinding) {
// next radio button needs to be bound to the same data. Otherwise, continue.
if (currentBinding.inside === nextBinding.inside && currentBinding.to === nextBinding.to) {
next._setRadioValue();
next._focus();
break;
}
}
}
}
} | javascript | function (direction) {
if (!this._cfg || !this._cfg.bind || !this._cfg.bind.value) {
// no binding for the value : return
return;
}
var currentBinding = this._cfg.bind.value;
var index = ariaUtilsArray.indexOf(this._instances, this), radioButtonNb = this._instances.length;
var bindings, next, nextBinding;
var waiAria = this._cfg.waiAria;
while (index >= 0 && index < radioButtonNb) {
index = index + direction;
if (waiAria) {
if (index < 0) {
index = radioButtonNb - 1;
} else if (index >= radioButtonNb) {
index = 0;
}
} else if (index < 0 || index >= radioButtonNb) {
break;
}
next = this._instances[index];
bindings = next._cfg.bind;
if (!next.getProperty("disabled") && bindings) {
nextBinding = bindings.value;
if (nextBinding) {
// next radio button needs to be bound to the same data. Otherwise, continue.
if (currentBinding.inside === nextBinding.inside && currentBinding.to === nextBinding.to) {
next._setRadioValue();
next._focus();
break;
}
}
}
}
} | [
"function",
"(",
"direction",
")",
"{",
"if",
"(",
"!",
"this",
".",
"_cfg",
"||",
"!",
"this",
".",
"_cfg",
".",
"bind",
"||",
"!",
"this",
".",
"_cfg",
".",
"bind",
".",
"value",
")",
"{",
"// no binding for the value : return",
"return",
";",
"}",
"var",
"currentBinding",
"=",
"this",
".",
"_cfg",
".",
"bind",
".",
"value",
";",
"var",
"index",
"=",
"ariaUtilsArray",
".",
"indexOf",
"(",
"this",
".",
"_instances",
",",
"this",
")",
",",
"radioButtonNb",
"=",
"this",
".",
"_instances",
".",
"length",
";",
"var",
"bindings",
",",
"next",
",",
"nextBinding",
";",
"var",
"waiAria",
"=",
"this",
".",
"_cfg",
".",
"waiAria",
";",
"while",
"(",
"index",
">=",
"0",
"&&",
"index",
"<",
"radioButtonNb",
")",
"{",
"index",
"=",
"index",
"+",
"direction",
";",
"if",
"(",
"waiAria",
")",
"{",
"if",
"(",
"index",
"<",
"0",
")",
"{",
"index",
"=",
"radioButtonNb",
"-",
"1",
";",
"}",
"else",
"if",
"(",
"index",
">=",
"radioButtonNb",
")",
"{",
"index",
"=",
"0",
";",
"}",
"}",
"else",
"if",
"(",
"index",
"<",
"0",
"||",
"index",
">=",
"radioButtonNb",
")",
"{",
"break",
";",
"}",
"next",
"=",
"this",
".",
"_instances",
"[",
"index",
"]",
";",
"bindings",
"=",
"next",
".",
"_cfg",
".",
"bind",
";",
"if",
"(",
"!",
"next",
".",
"getProperty",
"(",
"\"disabled\"",
")",
"&&",
"bindings",
")",
"{",
"nextBinding",
"=",
"bindings",
".",
"value",
";",
"if",
"(",
"nextBinding",
")",
"{",
"// next radio button needs to be bound to the same data. Otherwise, continue.",
"if",
"(",
"currentBinding",
".",
"inside",
"===",
"nextBinding",
".",
"inside",
"&&",
"currentBinding",
".",
"to",
"===",
"nextBinding",
".",
"to",
")",
"{",
"next",
".",
"_setRadioValue",
"(",
")",
";",
"next",
".",
"_focus",
"(",
")",
";",
"break",
";",
"}",
"}",
"}",
"}",
"}"
] | Find next valid radio button to activate
@protected
@param {Number} direction, 1 or -1 | [
"Find",
"next",
"valid",
"radio",
"button",
"to",
"activate"
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/RadioButton.js#L168-L203 | |
27,917 | ariatemplates/ariatemplates | src/aria/widgets/form/RadioButton.js | function () {
var newValue = this._cfg.keyValue;
this._cfg.value = newValue;
this.setProperty("value", newValue);
// setProperty on value might destroy the widget
if (this._cfg) {
this._setState();
this._updateDomForState();
if (this._cfg.onchange) {
this.evalCallback(this._cfg.onchange);
}
}
} | javascript | function () {
var newValue = this._cfg.keyValue;
this._cfg.value = newValue;
this.setProperty("value", newValue);
// setProperty on value might destroy the widget
if (this._cfg) {
this._setState();
this._updateDomForState();
if (this._cfg.onchange) {
this.evalCallback(this._cfg.onchange);
}
}
} | [
"function",
"(",
")",
"{",
"var",
"newValue",
"=",
"this",
".",
"_cfg",
".",
"keyValue",
";",
"this",
".",
"_cfg",
".",
"value",
"=",
"newValue",
";",
"this",
".",
"setProperty",
"(",
"\"value\"",
",",
"newValue",
")",
";",
"// setProperty on value might destroy the widget",
"if",
"(",
"this",
".",
"_cfg",
")",
"{",
"this",
".",
"_setState",
"(",
")",
";",
"this",
".",
"_updateDomForState",
"(",
")",
";",
"if",
"(",
"this",
".",
"_cfg",
".",
"onchange",
")",
"{",
"this",
".",
"evalCallback",
"(",
"this",
".",
"_cfg",
".",
"onchange",
")",
";",
"}",
"}",
"}"
] | Sets the value property to the key value of this radio button and updates state, dom etc. Typically
called when user "selects" the radio button | [
"Sets",
"the",
"value",
"property",
"to",
"the",
"key",
"value",
"of",
"this",
"radio",
"button",
"and",
"updates",
"state",
"dom",
"etc",
".",
"Typically",
"called",
"when",
"user",
"selects",
"the",
"radio",
"button"
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/RadioButton.js#L234-L246 | |
27,918 | ariatemplates/ariatemplates | src/aria/core/Log.js | function (className) {
var loggingLevel = this._loggingLevels[className];
if (!!loggingLevel) {
// If there is a logging level stored for the exact classname passed in parameter
return loggingLevel;
} else {
// Else, look for package names
var str = className;
while (str.indexOf(".") != -1) {
str = str.substring(0, str.lastIndexOf("."));
if (this._loggingLevels[str]) {
return this._loggingLevels[str];
} else if (this._loggingLevels[str + ".*"]) {
return this._loggingLevels[str + ".*"];
}
}
return this._loggingLevels["*"] || false;
}
} | javascript | function (className) {
var loggingLevel = this._loggingLevels[className];
if (!!loggingLevel) {
// If there is a logging level stored for the exact classname passed in parameter
return loggingLevel;
} else {
// Else, look for package names
var str = className;
while (str.indexOf(".") != -1) {
str = str.substring(0, str.lastIndexOf("."));
if (this._loggingLevels[str]) {
return this._loggingLevels[str];
} else if (this._loggingLevels[str + ".*"]) {
return this._loggingLevels[str + ".*"];
}
}
return this._loggingLevels["*"] || false;
}
} | [
"function",
"(",
"className",
")",
"{",
"var",
"loggingLevel",
"=",
"this",
".",
"_loggingLevels",
"[",
"className",
"]",
";",
"if",
"(",
"!",
"!",
"loggingLevel",
")",
"{",
"// If there is a logging level stored for the exact classname passed in parameter",
"return",
"loggingLevel",
";",
"}",
"else",
"{",
"// Else, look for package names",
"var",
"str",
"=",
"className",
";",
"while",
"(",
"str",
".",
"indexOf",
"(",
"\".\"",
")",
"!=",
"-",
"1",
")",
"{",
"str",
"=",
"str",
".",
"substring",
"(",
"0",
",",
"str",
".",
"lastIndexOf",
"(",
"\".\"",
")",
")",
";",
"if",
"(",
"this",
".",
"_loggingLevels",
"[",
"str",
"]",
")",
"{",
"return",
"this",
".",
"_loggingLevels",
"[",
"str",
"]",
";",
"}",
"else",
"if",
"(",
"this",
".",
"_loggingLevels",
"[",
"str",
"+",
"\".*\"",
"]",
")",
"{",
"return",
"this",
".",
"_loggingLevels",
"[",
"str",
"+",
"\".*\"",
"]",
";",
"}",
"}",
"return",
"this",
".",
"_loggingLevels",
"[",
"\"*\"",
"]",
"||",
"false",
";",
"}",
"}"
] | Get the currently allowed logging level for a particular className
@param {String} className
@return {Number} level or false if no logging level is defined | [
"Get",
"the",
"currently",
"allowed",
"logging",
"level",
"for",
"a",
"particular",
"className"
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/core/Log.js#L207-L227 | |
27,919 | ariatemplates/ariatemplates | src/aria/core/Log.js | function (appender) {
var apps = this._appenders;
for (var i = 0, l = apps.length; i < l; i++) {
if (!appender || apps[i] === appender) {
apps[i].$dispose();
apps.splice(i, 1);
i--;
l--;
}
}
} | javascript | function (appender) {
var apps = this._appenders;
for (var i = 0, l = apps.length; i < l; i++) {
if (!appender || apps[i] === appender) {
apps[i].$dispose();
apps.splice(i, 1);
i--;
l--;
}
}
} | [
"function",
"(",
"appender",
")",
"{",
"var",
"apps",
"=",
"this",
".",
"_appenders",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"l",
"=",
"apps",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
"if",
"(",
"!",
"appender",
"||",
"apps",
"[",
"i",
"]",
"===",
"appender",
")",
"{",
"apps",
"[",
"i",
"]",
".",
"$dispose",
"(",
")",
";",
"apps",
".",
"splice",
"(",
"i",
",",
"1",
")",
";",
"i",
"--",
";",
"l",
"--",
";",
"}",
"}",
"}"
] | Remove all appenders in the logging system, if an appender is passed then will remove just a specific
appender instance
@param {aria.core.log.DefaultAppender} appender An instance of appender to be removed (must implement the
same methods as aria.core.log.DefaultAppender) | [
"Remove",
"all",
"appenders",
"in",
"the",
"logging",
"system",
"if",
"an",
"appender",
"is",
"passed",
"then",
"will",
"remove",
"just",
"a",
"specific",
"appender",
"instance"
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/core/Log.js#L277-L287 | |
27,920 | ariatemplates/ariatemplates | src/aria/core/Log.js | function (classpath) {
var apps = this._appenders;
if (classpath) {
apps = [];
for (var i = 0; i < this._appenders.length; i++) {
if (this._appenders[i].$classpath == classpath) {
apps.push(this._appenders[i]);
}
}
}
return apps;
} | javascript | function (classpath) {
var apps = this._appenders;
if (classpath) {
apps = [];
for (var i = 0; i < this._appenders.length; i++) {
if (this._appenders[i].$classpath == classpath) {
apps.push(this._appenders[i]);
}
}
}
return apps;
} | [
"function",
"(",
"classpath",
")",
"{",
"var",
"apps",
"=",
"this",
".",
"_appenders",
";",
"if",
"(",
"classpath",
")",
"{",
"apps",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"_appenders",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"this",
".",
"_appenders",
"[",
"i",
"]",
".",
"$classpath",
"==",
"classpath",
")",
"{",
"apps",
".",
"push",
"(",
"this",
".",
"_appenders",
"[",
"i",
"]",
")",
";",
"}",
"}",
"}",
"return",
"apps",
";",
"}"
] | Get the list of current appenders
@param {String} classpath Optional argument, if passed, only the appenders of the given classpath will be
returned
@return {Array} The list of appenders | [
"Get",
"the",
"list",
"of",
"current",
"appenders"
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/core/Log.js#L302-L315 | |
27,921 | ariatemplates/ariatemplates | src/aria/core/Log.js | function (msg, msgArgs, errorContext) {
if (msgArgs) {
msg = ariaUtilsString.substitute(msg, msgArgs);
}
for (var error in errorContext) {
if (errorContext.hasOwnProperty(error)) {
msg += "\n" + error + " : " + errorContext[error] + "\n";
}
}
return msg;
} | javascript | function (msg, msgArgs, errorContext) {
if (msgArgs) {
msg = ariaUtilsString.substitute(msg, msgArgs);
}
for (var error in errorContext) {
if (errorContext.hasOwnProperty(error)) {
msg += "\n" + error + " : " + errorContext[error] + "\n";
}
}
return msg;
} | [
"function",
"(",
"msg",
",",
"msgArgs",
",",
"errorContext",
")",
"{",
"if",
"(",
"msgArgs",
")",
"{",
"msg",
"=",
"ariaUtilsString",
".",
"substitute",
"(",
"msg",
",",
"msgArgs",
")",
";",
"}",
"for",
"(",
"var",
"error",
"in",
"errorContext",
")",
"{",
"if",
"(",
"errorContext",
".",
"hasOwnProperty",
"(",
"error",
")",
")",
"{",
"msg",
"+=",
"\"\\n\"",
"+",
"error",
"+",
"\" : \"",
"+",
"errorContext",
"[",
"error",
"]",
"+",
"\"\\n\"",
";",
"}",
"}",
"return",
"msg",
";",
"}"
] | Prepare a message to be logged from a message text and an optional array of arguments
@param {String} msg Message text (which may contain %n)
@param {Array} msgArgs optional list of arguments to be replaced in the message with %n
@param {Object} errorContext Optional object passed in case of template parsing error only
@return {String} The message | [
"Prepare",
"a",
"message",
"to",
"be",
"logged",
"from",
"a",
"message",
"text",
"and",
"an",
"optional",
"array",
"of",
"arguments"
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/core/Log.js#L324-L334 | |
27,922 | ariatemplates/ariatemplates | src/aria/core/Log.js | function (className, msg, msgArgs, o) {
this.log(className, this.LEVEL_INFO, msgArgs, msg, o);
} | javascript | function (className, msg, msgArgs, o) {
this.log(className, this.LEVEL_INFO, msgArgs, msg, o);
} | [
"function",
"(",
"className",
",",
"msg",
",",
"msgArgs",
",",
"o",
")",
"{",
"this",
".",
"log",
"(",
"className",
",",
"this",
".",
"LEVEL_INFO",
",",
"msgArgs",
",",
"msg",
",",
"o",
")",
";",
"}"
] | Log an info message
@param {String} className The classname for which the log is to be done
@param {String} msg the message text
@param {Array} msgArgs An array of arguments to be used for string replacement in the message text
@param {Object} o An optional object to inspect | [
"Log",
"an",
"info",
"message"
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/core/Log.js#L354-L356 | |
27,923 | ariatemplates/ariatemplates | src/aria/core/Log.js | function (className, msg, msgArgs, o) {
this.log(className, this.LEVEL_WARN, msgArgs, msg, o);
} | javascript | function (className, msg, msgArgs, o) {
this.log(className, this.LEVEL_WARN, msgArgs, msg, o);
} | [
"function",
"(",
"className",
",",
"msg",
",",
"msgArgs",
",",
"o",
")",
"{",
"this",
".",
"log",
"(",
"className",
",",
"this",
".",
"LEVEL_WARN",
",",
"msgArgs",
",",
"msg",
",",
"o",
")",
";",
"}"
] | Log a warning message
@param {String} className The classname for which the log is to be done
@param {String} msg the message text
@param {Array} msgArgs An array of arguments to be used for string replacement in the message text
@param {Object} o An optional object to inspect | [
"Log",
"a",
"warning",
"message"
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/core/Log.js#L365-L367 | |
27,924 | ariatemplates/ariatemplates | src/aria/core/Log.js | function (className, level, msgArgs, msgText, objOrErr) {
if (!this.isValidLevel(level)) {
this.error(this.$classpath, "Invalid level passed for logging the message");
} else {
if (this.isLogEnabled(level, className)) {
var msg = this.prepareLoggedMessage(msgText, msgArgs);
var apps = this.getAppenders();
for (var i = 0; i < apps.length; i++) {
if (level == this.LEVEL_DEBUG) {
apps[i].debug(className, msg, msgText, objOrErr);
}
if (level == this.LEVEL_INFO) {
apps[i].info(className, msg, msgText, objOrErr);
}
if (level == this.LEVEL_WARN) {
apps[i].warn(className, msg, msgText, objOrErr);
}
if (level == this.LEVEL_ERROR) {
apps[i].error(className, msg, msgText, objOrErr);
}
}
}
}
} | javascript | function (className, level, msgArgs, msgText, objOrErr) {
if (!this.isValidLevel(level)) {
this.error(this.$classpath, "Invalid level passed for logging the message");
} else {
if (this.isLogEnabled(level, className)) {
var msg = this.prepareLoggedMessage(msgText, msgArgs);
var apps = this.getAppenders();
for (var i = 0; i < apps.length; i++) {
if (level == this.LEVEL_DEBUG) {
apps[i].debug(className, msg, msgText, objOrErr);
}
if (level == this.LEVEL_INFO) {
apps[i].info(className, msg, msgText, objOrErr);
}
if (level == this.LEVEL_WARN) {
apps[i].warn(className, msg, msgText, objOrErr);
}
if (level == this.LEVEL_ERROR) {
apps[i].error(className, msg, msgText, objOrErr);
}
}
}
}
} | [
"function",
"(",
"className",
",",
"level",
",",
"msgArgs",
",",
"msgText",
",",
"objOrErr",
")",
"{",
"if",
"(",
"!",
"this",
".",
"isValidLevel",
"(",
"level",
")",
")",
"{",
"this",
".",
"error",
"(",
"this",
".",
"$classpath",
",",
"\"Invalid level passed for logging the message\"",
")",
";",
"}",
"else",
"{",
"if",
"(",
"this",
".",
"isLogEnabled",
"(",
"level",
",",
"className",
")",
")",
"{",
"var",
"msg",
"=",
"this",
".",
"prepareLoggedMessage",
"(",
"msgText",
",",
"msgArgs",
")",
";",
"var",
"apps",
"=",
"this",
".",
"getAppenders",
"(",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"apps",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"level",
"==",
"this",
".",
"LEVEL_DEBUG",
")",
"{",
"apps",
"[",
"i",
"]",
".",
"debug",
"(",
"className",
",",
"msg",
",",
"msgText",
",",
"objOrErr",
")",
";",
"}",
"if",
"(",
"level",
"==",
"this",
".",
"LEVEL_INFO",
")",
"{",
"apps",
"[",
"i",
"]",
".",
"info",
"(",
"className",
",",
"msg",
",",
"msgText",
",",
"objOrErr",
")",
";",
"}",
"if",
"(",
"level",
"==",
"this",
".",
"LEVEL_WARN",
")",
"{",
"apps",
"[",
"i",
"]",
".",
"warn",
"(",
"className",
",",
"msg",
",",
"msgText",
",",
"objOrErr",
")",
";",
"}",
"if",
"(",
"level",
"==",
"this",
".",
"LEVEL_ERROR",
")",
"{",
"apps",
"[",
"i",
"]",
".",
"error",
"(",
"className",
",",
"msg",
",",
"msgText",
",",
"objOrErr",
")",
";",
"}",
"}",
"}",
"}",
"}"
] | Actually do the logging to the current appenders
@param {String} className The className that is logging
@param {String} level The level to log the message
@param {Array} msgArgs An array of arguments to be used for string replacement in the message text
@param {String} msg The message text
@param {Object} objOrErr Either an option object to be logged or an error message in case of error or fatal
levels | [
"Actually",
"do",
"the",
"logging",
"to",
"the",
"current",
"appenders"
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/core/Log.js#L389-L412 | |
27,925 | ariatemplates/ariatemplates | src/aria/core/IOFilter.js | function (req, jsonData) {
var sender = req.sender;
req.data = (sender && sender.classpath == "aria.modules.RequestMgr")
? sender.requestObject.requestHandler.prepareRequestBody(jsonData, sender.requestObject)
: ariaUtilsJson.convertToJsonString(jsonData);
} | javascript | function (req, jsonData) {
var sender = req.sender;
req.data = (sender && sender.classpath == "aria.modules.RequestMgr")
? sender.requestObject.requestHandler.prepareRequestBody(jsonData, sender.requestObject)
: ariaUtilsJson.convertToJsonString(jsonData);
} | [
"function",
"(",
"req",
",",
"jsonData",
")",
"{",
"var",
"sender",
"=",
"req",
".",
"sender",
";",
"req",
".",
"data",
"=",
"(",
"sender",
"&&",
"sender",
".",
"classpath",
"==",
"\"aria.modules.RequestMgr\"",
")",
"?",
"sender",
".",
"requestObject",
".",
"requestHandler",
".",
"prepareRequestBody",
"(",
"jsonData",
",",
"sender",
".",
"requestObject",
")",
":",
"ariaUtilsJson",
".",
"convertToJsonString",
"(",
"jsonData",
")",
";",
"}"
] | Helper method to set a json object as the POST data in a request.
@param {aria.core.CfgBeans:IOAsyncRequestCfg} req
@param {Object} jsonData | [
"Helper",
"method",
"to",
"set",
"a",
"json",
"object",
"as",
"the",
"POST",
"data",
"in",
"a",
"request",
"."
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/core/IOFilter.js#L73-L79 | |
27,926 | ariatemplates/ariatemplates | src/aria/core/IOFilter.js | function (req, path, preventTimestamp) {
if (path) {
// change request url and method to target the requested file:
req.url = ariaCoreDownloadMgr.resolveURL(path, true);
if (preventTimestamp !== true) {
req.url = ariaCoreDownloadMgr.getURLWithTimestamp(req.url, true);
}
req.method = "GET";
req.jsonp = null; // not a json-p request
}
} | javascript | function (req, path, preventTimestamp) {
if (path) {
// change request url and method to target the requested file:
req.url = ariaCoreDownloadMgr.resolveURL(path, true);
if (preventTimestamp !== true) {
req.url = ariaCoreDownloadMgr.getURLWithTimestamp(req.url, true);
}
req.method = "GET";
req.jsonp = null; // not a json-p request
}
} | [
"function",
"(",
"req",
",",
"path",
",",
"preventTimestamp",
")",
"{",
"if",
"(",
"path",
")",
"{",
"// change request url and method to target the requested file:",
"req",
".",
"url",
"=",
"ariaCoreDownloadMgr",
".",
"resolveURL",
"(",
"path",
",",
"true",
")",
";",
"if",
"(",
"preventTimestamp",
"!==",
"true",
")",
"{",
"req",
".",
"url",
"=",
"ariaCoreDownloadMgr",
".",
"getURLWithTimestamp",
"(",
"req",
".",
"url",
",",
"true",
")",
";",
"}",
"req",
".",
"method",
"=",
"\"GET\"",
";",
"req",
".",
"jsonp",
"=",
"null",
";",
"// not a json-p request",
"}",
"}"
] | Helper method to help redirecting a request to a file
@param {aria.core.CfgBeans:IOAsyncRequestCfg} req the filter request object
@param {String} path the file logical path or full URL. It can be null or empty and in this case the request
is not redirected. It is passed to aria.core.DownloadMgr.resolveURL(path,true), to build the url, taking root
maps into account. If it's a full URL it just returns.
@param {Boolean} preventTimestamp By default, a timestamp is added to the url to get this file. If this
parameter is true, no timestamp will be added. | [
"Helper",
"method",
"to",
"help",
"redirecting",
"a",
"request",
"to",
"a",
"file"
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/core/IOFilter.js#L90-L100 | |
27,927 | ariatemplates/ariatemplates | src/aria/ext/StressCss.js | function (force, cssText) {
if (force !== true) {
aria.templates.CSSMgr.__textToDOM(ariaUtilsObject.keys(aria.templates.CSSMgr.__styleTagPool));
} else {
// Having an empty text to dom go deeper in the CSSMgr to force a reload
var styleBuilder = {};
for (var id in aria.templates.CSSMgr.__styleTagPool) {
if (aria.templates.CSSMgr.__styleTagPool.hasOwnProperty(id)) {
styleBuilder[id] = (id === "tpl" && cssText) ? [cssText] : [];
}
}
aria.templates.CSSMgr.__reloadStyleTags(styleBuilder);
}
} | javascript | function (force, cssText) {
if (force !== true) {
aria.templates.CSSMgr.__textToDOM(ariaUtilsObject.keys(aria.templates.CSSMgr.__styleTagPool));
} else {
// Having an empty text to dom go deeper in the CSSMgr to force a reload
var styleBuilder = {};
for (var id in aria.templates.CSSMgr.__styleTagPool) {
if (aria.templates.CSSMgr.__styleTagPool.hasOwnProperty(id)) {
styleBuilder[id] = (id === "tpl" && cssText) ? [cssText] : [];
}
}
aria.templates.CSSMgr.__reloadStyleTags(styleBuilder);
}
} | [
"function",
"(",
"force",
",",
"cssText",
")",
"{",
"if",
"(",
"force",
"!==",
"true",
")",
"{",
"aria",
".",
"templates",
".",
"CSSMgr",
".",
"__textToDOM",
"(",
"ariaUtilsObject",
".",
"keys",
"(",
"aria",
".",
"templates",
".",
"CSSMgr",
".",
"__styleTagPool",
")",
")",
";",
"}",
"else",
"{",
"// Having an empty text to dom go deeper in the CSSMgr to force a reload",
"var",
"styleBuilder",
"=",
"{",
"}",
";",
"for",
"(",
"var",
"id",
"in",
"aria",
".",
"templates",
".",
"CSSMgr",
".",
"__styleTagPool",
")",
"{",
"if",
"(",
"aria",
".",
"templates",
".",
"CSSMgr",
".",
"__styleTagPool",
".",
"hasOwnProperty",
"(",
"id",
")",
")",
"{",
"styleBuilder",
"[",
"id",
"]",
"=",
"(",
"id",
"===",
"\"tpl\"",
"&&",
"cssText",
")",
"?",
"[",
"cssText",
"]",
":",
"[",
"]",
";",
"}",
"}",
"aria",
".",
"templates",
".",
"CSSMgr",
".",
"__reloadStyleTags",
"(",
"styleBuilder",
")",
";",
"}",
"}"
] | Trigger a refresh of the style tags in the page
@param {Boolean} force If true forces a reload with empty text
@param {String} cssText If force is true, this is the only text added to the style tag "tpl" all the others will
be empty | [
"Trigger",
"a",
"refresh",
"of",
"the",
"style",
"tags",
"in",
"the",
"page"
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/ext/StressCss.js#L60-L73 | |
27,928 | ariatemplates/ariatemplates | src/aria/ext/StressCss.js | function () {
var scope = aria.ext.StressCss;
scope.original__load = aria.templates.CSSMgr.__load;
scope.original__unload = aria.templates.CSSMgr.__unload;
aria.templates.CSSMgr.__load = function () {
return [];
};
aria.templates.CSSMgr.__unload = function () {};
// and force a refresh
refreshCSS();
} | javascript | function () {
var scope = aria.ext.StressCss;
scope.original__load = aria.templates.CSSMgr.__load;
scope.original__unload = aria.templates.CSSMgr.__unload;
aria.templates.CSSMgr.__load = function () {
return [];
};
aria.templates.CSSMgr.__unload = function () {};
// and force a refresh
refreshCSS();
} | [
"function",
"(",
")",
"{",
"var",
"scope",
"=",
"aria",
".",
"ext",
".",
"StressCss",
";",
"scope",
".",
"original__load",
"=",
"aria",
".",
"templates",
".",
"CSSMgr",
".",
"__load",
";",
"scope",
".",
"original__unload",
"=",
"aria",
".",
"templates",
".",
"CSSMgr",
".",
"__unload",
";",
"aria",
".",
"templates",
".",
"CSSMgr",
".",
"__load",
"=",
"function",
"(",
")",
"{",
"return",
"[",
"]",
";",
"}",
";",
"aria",
".",
"templates",
".",
"CSSMgr",
".",
"__unload",
"=",
"function",
"(",
")",
"{",
"}",
";",
"// and force a refresh",
"refreshCSS",
"(",
")",
";",
"}"
] | Prevent the CSSMgr to change the page while doing the loop. | [
"Prevent",
"the",
"CSSMgr",
"to",
"change",
"the",
"page",
"while",
"doing",
"the",
"loop",
"."
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/ext/StressCss.js#L78-L88 | |
27,929 | ariatemplates/ariatemplates | src/aria/ext/StressCss.js | function () {
var scope = aria.ext.StressCss;
aria.templates.CSSMgr.__load = scope.original__load;
aria.templates.CSSMgr.__unload = scope.original__unload;
refreshCSS();
} | javascript | function () {
var scope = aria.ext.StressCss;
aria.templates.CSSMgr.__load = scope.original__load;
aria.templates.CSSMgr.__unload = scope.original__unload;
refreshCSS();
} | [
"function",
"(",
")",
"{",
"var",
"scope",
"=",
"aria",
".",
"ext",
".",
"StressCss",
";",
"aria",
".",
"templates",
".",
"CSSMgr",
".",
"__load",
"=",
"scope",
".",
"original__load",
";",
"aria",
".",
"templates",
".",
"CSSMgr",
".",
"__unload",
"=",
"scope",
".",
"original__unload",
";",
"refreshCSS",
"(",
")",
";",
"}"
] | Unlock the CSSMgr bringing it to its default state. | [
"Unlock",
"the",
"CSSMgr",
"bringing",
"it",
"to",
"its",
"default",
"state",
"."
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/ext/StressCss.js#L93-L98 | |
27,930 | ariatemplates/ariatemplates | src/aria/ext/StressCss.js | function (includeWidgetCSS) {
// __textLoaded contains a copy of what is inside the DOM
var cm = aria.templates.CSSMgr, all = cm.__textLoaded;
var selectors = [];
for (var path in all) {
if (all.hasOwnProperty(path)) {
if (includeWidgetCSS !== true && cm.__styleTagAssociation[path] === "wgt") {
continue;
}
selectors = selectors.concat(extractSelectors(all[path].text, path));
}
}
return selectors;
} | javascript | function (includeWidgetCSS) {
// __textLoaded contains a copy of what is inside the DOM
var cm = aria.templates.CSSMgr, all = cm.__textLoaded;
var selectors = [];
for (var path in all) {
if (all.hasOwnProperty(path)) {
if (includeWidgetCSS !== true && cm.__styleTagAssociation[path] === "wgt") {
continue;
}
selectors = selectors.concat(extractSelectors(all[path].text, path));
}
}
return selectors;
} | [
"function",
"(",
"includeWidgetCSS",
")",
"{",
"// __textLoaded contains a copy of what is inside the DOM",
"var",
"cm",
"=",
"aria",
".",
"templates",
".",
"CSSMgr",
",",
"all",
"=",
"cm",
".",
"__textLoaded",
";",
"var",
"selectors",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"path",
"in",
"all",
")",
"{",
"if",
"(",
"all",
".",
"hasOwnProperty",
"(",
"path",
")",
")",
"{",
"if",
"(",
"includeWidgetCSS",
"!==",
"true",
"&&",
"cm",
".",
"__styleTagAssociation",
"[",
"path",
"]",
"===",
"\"wgt\"",
")",
"{",
"continue",
";",
"}",
"selectors",
"=",
"selectors",
".",
"concat",
"(",
"extractSelectors",
"(",
"all",
"[",
"path",
"]",
".",
"text",
",",
"path",
")",
")",
";",
"}",
"}",
"return",
"selectors",
";",
"}"
] | Get the list of CSS selectors in the page.
@return {Array} List of CSS selectors to test | [
"Get",
"the",
"list",
"of",
"CSS",
"selectors",
"in",
"the",
"page",
"."
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/ext/StressCss.js#L130-L144 | |
27,931 | ariatemplates/ariatemplates | src/aria/ext/StressCss.js | function (selector, incremental) {
if (!selector) {
// This is a baseline
if (incremental) {
// Everything should be removed
refreshCSS(true);
} else {
// Nothing should be removed
return;
}
} else {
var textLoaded = aria.templates.CSSMgr.__textLoaded[selector.location];
// remember the original text
selector.original = textLoaded.text;
if (incremental) {
// Keep only the selector
refreshCSS(true, selector.descriptor);
} else {
// Remove the selector
textLoaded.text = textLoaded.text.replace(selector.descriptor, "");
refreshCSS();
}
}
} | javascript | function (selector, incremental) {
if (!selector) {
// This is a baseline
if (incremental) {
// Everything should be removed
refreshCSS(true);
} else {
// Nothing should be removed
return;
}
} else {
var textLoaded = aria.templates.CSSMgr.__textLoaded[selector.location];
// remember the original text
selector.original = textLoaded.text;
if (incremental) {
// Keep only the selector
refreshCSS(true, selector.descriptor);
} else {
// Remove the selector
textLoaded.text = textLoaded.text.replace(selector.descriptor, "");
refreshCSS();
}
}
} | [
"function",
"(",
"selector",
",",
"incremental",
")",
"{",
"if",
"(",
"!",
"selector",
")",
"{",
"// This is a baseline",
"if",
"(",
"incremental",
")",
"{",
"// Everything should be removed",
"refreshCSS",
"(",
"true",
")",
";",
"}",
"else",
"{",
"// Nothing should be removed",
"return",
";",
"}",
"}",
"else",
"{",
"var",
"textLoaded",
"=",
"aria",
".",
"templates",
".",
"CSSMgr",
".",
"__textLoaded",
"[",
"selector",
".",
"location",
"]",
";",
"// remember the original text",
"selector",
".",
"original",
"=",
"textLoaded",
".",
"text",
";",
"if",
"(",
"incremental",
")",
"{",
"// Keep only the selector",
"refreshCSS",
"(",
"true",
",",
"selector",
".",
"descriptor",
")",
";",
"}",
"else",
"{",
"// Remove the selector",
"textLoaded",
".",
"text",
"=",
"textLoaded",
".",
"text",
".",
"replace",
"(",
"selector",
".",
"descriptor",
",",
"\"\"",
")",
";",
"refreshCSS",
"(",
")",
";",
"}",
"}",
"}"
] | Remove a selector from the page.
@param {Object} selector CSS selector as returned by
@param {Boolean} incremental If true all selectors except "selector" are removed, otherwise only "selector" is
removed
@see extractSelectors | [
"Remove",
"a",
"selector",
"from",
"the",
"page",
"."
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/ext/StressCss.js#L153-L176 | |
27,932 | ariatemplates/ariatemplates | src/aria/ext/StressCss.js | function (selector, incremental) {
if (!selector) {
if (incremental) {
// Everything was removed
refreshCSS();
} else {
// Nothing was be removed
return;
}
} else {
// Simply put back the original style
aria.templates.CSSMgr.__textLoaded[selector.location].text = selector.original;
refreshCSS();
}
} | javascript | function (selector, incremental) {
if (!selector) {
if (incremental) {
// Everything was removed
refreshCSS();
} else {
// Nothing was be removed
return;
}
} else {
// Simply put back the original style
aria.templates.CSSMgr.__textLoaded[selector.location].text = selector.original;
refreshCSS();
}
} | [
"function",
"(",
"selector",
",",
"incremental",
")",
"{",
"if",
"(",
"!",
"selector",
")",
"{",
"if",
"(",
"incremental",
")",
"{",
"// Everything was removed",
"refreshCSS",
"(",
")",
";",
"}",
"else",
"{",
"// Nothing was be removed",
"return",
";",
"}",
"}",
"else",
"{",
"// Simply put back the original style",
"aria",
".",
"templates",
".",
"CSSMgr",
".",
"__textLoaded",
"[",
"selector",
".",
"location",
"]",
".",
"text",
"=",
"selector",
".",
"original",
";",
"refreshCSS",
"(",
")",
";",
"}",
"}"
] | Add back a selector to the page.
@param {Object} selector CSS selector as returned by extractSelectors | [
"Add",
"back",
"a",
"selector",
"to",
"the",
"page",
"."
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/ext/StressCss.js#L182-L196 | |
27,933 | ariatemplates/ariatemplates | src/aria/ext/StressCss.js | function (test) {
if (test.callback) {
test.callback.fn.apply(test.callback.scope, test.callback.args);
}
} | javascript | function (test) {
if (test.callback) {
test.callback.fn.apply(test.callback.scope, test.callback.args);
}
} | [
"function",
"(",
"test",
")",
"{",
"if",
"(",
"test",
".",
"callback",
")",
"{",
"test",
".",
"callback",
".",
"fn",
".",
"apply",
"(",
"test",
".",
"callback",
".",
"scope",
",",
"test",
".",
"callback",
".",
"args",
")",
";",
"}",
"}"
] | Run the next test.
@param {Object} test Current test object | [
"Run",
"the",
"next",
"test",
"."
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/ext/StressCss.js#L202-L206 | |
27,934 | ariatemplates/ariatemplates | src/aria/ext/StressCss.js | function (test) {
var end = +(new Date());
test.runTime = end - test.start;
results[test.name] = {
name : test.name,
runTime : test.runTime,
baseline : results["__baseline__"] ? (results["__baseline__"].runTime - test.runTime) : NaN
};
addSelector(test.selector, test.cfg.incremental);
// Yeld before calling the callback
setTimeout(function () {
next(test);
}, 15);
} | javascript | function (test) {
var end = +(new Date());
test.runTime = end - test.start;
results[test.name] = {
name : test.name,
runTime : test.runTime,
baseline : results["__baseline__"] ? (results["__baseline__"].runTime - test.runTime) : NaN
};
addSelector(test.selector, test.cfg.incremental);
// Yeld before calling the callback
setTimeout(function () {
next(test);
}, 15);
} | [
"function",
"(",
"test",
")",
"{",
"var",
"end",
"=",
"+",
"(",
"new",
"Date",
"(",
")",
")",
";",
"test",
".",
"runTime",
"=",
"end",
"-",
"test",
".",
"start",
";",
"results",
"[",
"test",
".",
"name",
"]",
"=",
"{",
"name",
":",
"test",
".",
"name",
",",
"runTime",
":",
"test",
".",
"runTime",
",",
"baseline",
":",
"results",
"[",
"\"__baseline__\"",
"]",
"?",
"(",
"results",
"[",
"\"__baseline__\"",
"]",
".",
"runTime",
"-",
"test",
".",
"runTime",
")",
":",
"NaN",
"}",
";",
"addSelector",
"(",
"test",
".",
"selector",
",",
"test",
".",
"cfg",
".",
"incremental",
")",
";",
"// Yeld before calling the callback",
"setTimeout",
"(",
"function",
"(",
")",
"{",
"next",
"(",
"test",
")",
";",
"}",
",",
"15",
")",
";",
"}"
] | Complete the test execution. This function measures the run time
@param {Object} test Test object | [
"Complete",
"the",
"test",
"execution",
".",
"This",
"function",
"measures",
"the",
"run",
"time"
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/ext/StressCss.js#L212-L229 | |
27,935 | ariatemplates/ariatemplates | src/aria/ext/StressCss.js | function (test) {
if (test.iteration >= test.cfg.repeat) {
return completeTest(test);
}
test.iteration += 1;
test.cfg.action.call(null, test.name, test.iteration - 1, generateTestCallback(test, this));
} | javascript | function (test) {
if (test.iteration >= test.cfg.repeat) {
return completeTest(test);
}
test.iteration += 1;
test.cfg.action.call(null, test.name, test.iteration - 1, generateTestCallback(test, this));
} | [
"function",
"(",
"test",
")",
"{",
"if",
"(",
"test",
".",
"iteration",
">=",
"test",
".",
"cfg",
".",
"repeat",
")",
"{",
"return",
"completeTest",
"(",
"test",
")",
";",
"}",
"test",
".",
"iteration",
"+=",
"1",
";",
"test",
".",
"cfg",
".",
"action",
".",
"call",
"(",
"null",
",",
"test",
".",
"name",
",",
"test",
".",
"iteration",
"-",
"1",
",",
"generateTestCallback",
"(",
"test",
",",
"this",
")",
")",
";",
"}"
] | Execute a single iteration of the test.
@param {Object} test Test object | [
"Execute",
"a",
"single",
"iteration",
"of",
"the",
"test",
"."
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/ext/StressCss.js#L251-L258 | |
27,936 | ariatemplates/ariatemplates | src/aria/ext/StressCss.js | function (elm, properties) {
for (var prop in properties) {
if (properties.hasOwnProperty(prop)) {
try {
var name = prop.replace(/\-([a-z])/ig, innerReplaceRule);
var value = properties[prop];
elm.style[name] = (typeof value == 'number' && name != 'zIndex') ? (value + 'px') : value;
} catch (ex) {}
}
}
} | javascript | function (elm, properties) {
for (var prop in properties) {
if (properties.hasOwnProperty(prop)) {
try {
var name = prop.replace(/\-([a-z])/ig, innerReplaceRule);
var value = properties[prop];
elm.style[name] = (typeof value == 'number' && name != 'zIndex') ? (value + 'px') : value;
} catch (ex) {}
}
}
} | [
"function",
"(",
"elm",
",",
"properties",
")",
"{",
"for",
"(",
"var",
"prop",
"in",
"properties",
")",
"{",
"if",
"(",
"properties",
".",
"hasOwnProperty",
"(",
"prop",
")",
")",
"{",
"try",
"{",
"var",
"name",
"=",
"prop",
".",
"replace",
"(",
"/",
"\\-([a-z])",
"/",
"ig",
",",
"innerReplaceRule",
")",
";",
"var",
"value",
"=",
"properties",
"[",
"prop",
"]",
";",
"elm",
".",
"style",
"[",
"name",
"]",
"=",
"(",
"typeof",
"value",
"==",
"'number'",
"&&",
"name",
"!=",
"'zIndex'",
")",
"?",
"(",
"value",
"+",
"'px'",
")",
":",
"value",
";",
"}",
"catch",
"(",
"ex",
")",
"{",
"}",
"}",
"}",
"}"
] | Apply style information to an HTML Object
@param {HTMLElement} elm DOM element
@param {Object} properties Map of key value properties to be added | [
"Apply",
"style",
"information",
"to",
"an",
"HTML",
"Object"
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/ext/StressCss.js#L272-L282 | |
27,937 | ariatemplates/ariatemplates | src/aria/ext/StressCss.js | function () {
var document = Aria.$window.document;
reportHolder = document.createElement('iframe');
var block = document.createElement('iframe');
reportHolder.scrolling = 'no';
reportHolder.frameBorder = 'no';
document.body.appendChild(reportHolder);
reportHolder.doc = reportHolder.contentDocument || reportHolder.contentWindow.document;
reportHolder.doc.write('<html><head></head><body></body></html>');
reportHolder.doc.close();
logHolder = reportHolder.doc.createElement('div');
var close = reportHolder.doc.createElement('a');
reportHolder.resize = function () {
if (reportHolder) {
var body = reportHolder.doc.body;
style(reportHolder, {
width : body.scrollWidth,
height : body.scrollHeight
});
}
};
resizeInterval = setInterval(reportHolder.resize, 100);
style(reportHolder, {
position : 'fixed',
top : 10,
right : 10,
zIndex : 10000,
background : 'white',
padding : 2,
border : 'solid 2px #aaa',
width : 250,
height : 60,
borderRadius : 4,
boxShadow : '0 0 8px #eee'
});
style(reportHolder.doc.body, {
'font' : '12px Helvetica,Arials,sans-serif',
color : '#444'
});
style(logHolder, {
whiteSpace : 'nowrap'
});
close.innerHTML = '×';
style(close, {
position : 'absolute',
top : 0,
right : 0,
textDecoration : 'none',
fontWeight : 'bold',
cursor : 'pointer',
color : 'red',
fontSize : '1.3em',
lineHeight : 8
});
close.onclick = function () {
close.onclick = null;
clearInterval(resizeInterval);
close = null;
block.parentNode.removeChild(block);
return closeReport();
};
style(block, {
height : Aria.$window.screen.height * 2,
width : Aria.$window.screen.width,
position : 'absolute',
top : 0,
left : 0,
visible : 'hidden',
display : 'none',
zIndex : 0
});
document.body.appendChild(block);
reportHolder.doc.body.appendChild(close);
reportHolder.doc.body.appendChild(logHolder);
} | javascript | function () {
var document = Aria.$window.document;
reportHolder = document.createElement('iframe');
var block = document.createElement('iframe');
reportHolder.scrolling = 'no';
reportHolder.frameBorder = 'no';
document.body.appendChild(reportHolder);
reportHolder.doc = reportHolder.contentDocument || reportHolder.contentWindow.document;
reportHolder.doc.write('<html><head></head><body></body></html>');
reportHolder.doc.close();
logHolder = reportHolder.doc.createElement('div');
var close = reportHolder.doc.createElement('a');
reportHolder.resize = function () {
if (reportHolder) {
var body = reportHolder.doc.body;
style(reportHolder, {
width : body.scrollWidth,
height : body.scrollHeight
});
}
};
resizeInterval = setInterval(reportHolder.resize, 100);
style(reportHolder, {
position : 'fixed',
top : 10,
right : 10,
zIndex : 10000,
background : 'white',
padding : 2,
border : 'solid 2px #aaa',
width : 250,
height : 60,
borderRadius : 4,
boxShadow : '0 0 8px #eee'
});
style(reportHolder.doc.body, {
'font' : '12px Helvetica,Arials,sans-serif',
color : '#444'
});
style(logHolder, {
whiteSpace : 'nowrap'
});
close.innerHTML = '×';
style(close, {
position : 'absolute',
top : 0,
right : 0,
textDecoration : 'none',
fontWeight : 'bold',
cursor : 'pointer',
color : 'red',
fontSize : '1.3em',
lineHeight : 8
});
close.onclick = function () {
close.onclick = null;
clearInterval(resizeInterval);
close = null;
block.parentNode.removeChild(block);
return closeReport();
};
style(block, {
height : Aria.$window.screen.height * 2,
width : Aria.$window.screen.width,
position : 'absolute',
top : 0,
left : 0,
visible : 'hidden',
display : 'none',
zIndex : 0
});
document.body.appendChild(block);
reportHolder.doc.body.appendChild(close);
reportHolder.doc.body.appendChild(logHolder);
} | [
"function",
"(",
")",
"{",
"var",
"document",
"=",
"Aria",
".",
"$window",
".",
"document",
";",
"reportHolder",
"=",
"document",
".",
"createElement",
"(",
"'iframe'",
")",
";",
"var",
"block",
"=",
"document",
".",
"createElement",
"(",
"'iframe'",
")",
";",
"reportHolder",
".",
"scrolling",
"=",
"'no'",
";",
"reportHolder",
".",
"frameBorder",
"=",
"'no'",
";",
"document",
".",
"body",
".",
"appendChild",
"(",
"reportHolder",
")",
";",
"reportHolder",
".",
"doc",
"=",
"reportHolder",
".",
"contentDocument",
"||",
"reportHolder",
".",
"contentWindow",
".",
"document",
";",
"reportHolder",
".",
"doc",
".",
"write",
"(",
"'<html><head></head><body></body></html>'",
")",
";",
"reportHolder",
".",
"doc",
".",
"close",
"(",
")",
";",
"logHolder",
"=",
"reportHolder",
".",
"doc",
".",
"createElement",
"(",
"'div'",
")",
";",
"var",
"close",
"=",
"reportHolder",
".",
"doc",
".",
"createElement",
"(",
"'a'",
")",
";",
"reportHolder",
".",
"resize",
"=",
"function",
"(",
")",
"{",
"if",
"(",
"reportHolder",
")",
"{",
"var",
"body",
"=",
"reportHolder",
".",
"doc",
".",
"body",
";",
"style",
"(",
"reportHolder",
",",
"{",
"width",
":",
"body",
".",
"scrollWidth",
",",
"height",
":",
"body",
".",
"scrollHeight",
"}",
")",
";",
"}",
"}",
";",
"resizeInterval",
"=",
"setInterval",
"(",
"reportHolder",
".",
"resize",
",",
"100",
")",
";",
"style",
"(",
"reportHolder",
",",
"{",
"position",
":",
"'fixed'",
",",
"top",
":",
"10",
",",
"right",
":",
"10",
",",
"zIndex",
":",
"10000",
",",
"background",
":",
"'white'",
",",
"padding",
":",
"2",
",",
"border",
":",
"'solid 2px #aaa'",
",",
"width",
":",
"250",
",",
"height",
":",
"60",
",",
"borderRadius",
":",
"4",
",",
"boxShadow",
":",
"'0 0 8px #eee'",
"}",
")",
";",
"style",
"(",
"reportHolder",
".",
"doc",
".",
"body",
",",
"{",
"'font'",
":",
"'12px Helvetica,Arials,sans-serif'",
",",
"color",
":",
"'#444'",
"}",
")",
";",
"style",
"(",
"logHolder",
",",
"{",
"whiteSpace",
":",
"'nowrap'",
"}",
")",
";",
"close",
".",
"innerHTML",
"=",
"'×'",
";",
"style",
"(",
"close",
",",
"{",
"position",
":",
"'absolute'",
",",
"top",
":",
"0",
",",
"right",
":",
"0",
",",
"textDecoration",
":",
"'none'",
",",
"fontWeight",
":",
"'bold'",
",",
"cursor",
":",
"'pointer'",
",",
"color",
":",
"'red'",
",",
"fontSize",
":",
"'1.3em'",
",",
"lineHeight",
":",
"8",
"}",
")",
";",
"close",
".",
"onclick",
"=",
"function",
"(",
")",
"{",
"close",
".",
"onclick",
"=",
"null",
";",
"clearInterval",
"(",
"resizeInterval",
")",
";",
"close",
"=",
"null",
";",
"block",
".",
"parentNode",
".",
"removeChild",
"(",
"block",
")",
";",
"return",
"closeReport",
"(",
")",
";",
"}",
";",
"style",
"(",
"block",
",",
"{",
"height",
":",
"Aria",
".",
"$window",
".",
"screen",
".",
"height",
"*",
"2",
",",
"width",
":",
"Aria",
".",
"$window",
".",
"screen",
".",
"width",
",",
"position",
":",
"'absolute'",
",",
"top",
":",
"0",
",",
"left",
":",
"0",
",",
"visible",
":",
"'hidden'",
",",
"display",
":",
"'none'",
",",
"zIndex",
":",
"0",
"}",
")",
";",
"document",
".",
"body",
".",
"appendChild",
"(",
"block",
")",
";",
"reportHolder",
".",
"doc",
".",
"body",
".",
"appendChild",
"(",
"close",
")",
";",
"reportHolder",
".",
"doc",
".",
"body",
".",
"appendChild",
"(",
"logHolder",
")",
";",
"}"
] | Create the report holder to display log information about the tests while running the stress test. | [
"Create",
"the",
"report",
"holder",
"to",
"display",
"log",
"information",
"about",
"the",
"tests",
"while",
"running",
"the",
"stress",
"test",
"."
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/ext/StressCss.js#L298-L379 | |
27,938 | ariatemplates/ariatemplates | src/aria/ext/StressCss.js | function (test) {
var baseline = !(test.selector && test.selector.name !== "*");
if (!logHolder) {
return; // logging was not enabled
}
var remaining = test.cfg.allSelectors.length;
var heading = 'Testing <strong>' + (baseline ? test.name : test.selector.name) + '</strong>';
var message = '<br />' + (baseline ? 'baseline' : test.selector.location);
var footer = '<br />' + remaining + ' remaining test' + (remaining === 1 ? '' : 's');
logHolder.innerHTML = heading + message + footer;
} | javascript | function (test) {
var baseline = !(test.selector && test.selector.name !== "*");
if (!logHolder) {
return; // logging was not enabled
}
var remaining = test.cfg.allSelectors.length;
var heading = 'Testing <strong>' + (baseline ? test.name : test.selector.name) + '</strong>';
var message = '<br />' + (baseline ? 'baseline' : test.selector.location);
var footer = '<br />' + remaining + ' remaining test' + (remaining === 1 ? '' : 's');
logHolder.innerHTML = heading + message + footer;
} | [
"function",
"(",
"test",
")",
"{",
"var",
"baseline",
"=",
"!",
"(",
"test",
".",
"selector",
"&&",
"test",
".",
"selector",
".",
"name",
"!==",
"\"*\"",
")",
";",
"if",
"(",
"!",
"logHolder",
")",
"{",
"return",
";",
"// logging was not enabled",
"}",
"var",
"remaining",
"=",
"test",
".",
"cfg",
".",
"allSelectors",
".",
"length",
";",
"var",
"heading",
"=",
"'Testing <strong>'",
"+",
"(",
"baseline",
"?",
"test",
".",
"name",
":",
"test",
".",
"selector",
".",
"name",
")",
"+",
"'</strong>'",
";",
"var",
"message",
"=",
"'<br />'",
"+",
"(",
"baseline",
"?",
"'baseline'",
":",
"test",
".",
"selector",
".",
"location",
")",
";",
"var",
"footer",
"=",
"'<br />'",
"+",
"remaining",
"+",
"' remaining test'",
"+",
"(",
"remaining",
"===",
"1",
"?",
"''",
":",
"'s'",
")",
";",
"logHolder",
".",
"innerHTML",
"=",
"heading",
"+",
"message",
"+",
"footer",
";",
"}"
] | Log some test information in the report holder
@param {Object} test Test object | [
"Log",
"some",
"test",
"information",
"in",
"the",
"report",
"holder"
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/ext/StressCss.js#L385-L397 | |
27,939 | ariatemplates/ariatemplates | src/aria/ext/StressCss.js | function (incremental) {
if (!reportHolder || !results) {
return; // logging was not enabled
}
var table = '<table><thead><tr><th>Selector</th><th> </th><th>ms</th><th>Total</th></tr></thead><tbody>';
// Extract the 10 slowest results
var resultsArray = [];
for (var res in results) {
if (results.hasOwnProperty(res) && res !== "__baseline__") {
resultsArray.push(results[res]);
}
}
var sorted = resultsArray.sort(function (a, b) {
if (a.baseline === b.baseline) {
return 0;
}
if (incremental) {
return a.baseline > b.baseline ? 1 : -1;
} else {
return a.baseline > b.baseline ? -1 : 1;
}
}).slice(0, 20);
for (var i = 0, len = sorted.length; i < len; i += 1) {
var item = sorted[i];
table += '<tr><td style="font:11px monospace">Removing <strong>'
+ item.name
+ '</strong></td><td style="text-align:right">'
+ (item.baseline > 0
? '<span style="color:green">saves</span>'
: '<span style="color:red">adds</span>')
+ '</td><td style="text-align:right; font:11px monospace">' + Math.abs(item.baseline) + 'ms</td>'
+ '<td style="text-align:right; font:11px monospace">' + item.runTime + 'ms</td></tr>\n';
}
table += '</tbody></table><hr/>';
// Summary
table += '<table><tr><td style="text-align:right; font:10px monospace">Selectors Tested:</td><td style="font:10px monospace">'
+ resultsArray.length
+ '</td></tr>'
+ '<tr><td style="text-align:right; font:10px monospace">Baseline Time:</td><td style="font:10px monospace">'
+ results["__baseline__"].runTime + 'ms</td></tr>';
style(reportHolder, {
width : 600
});
logHolder.innerHTML = table;
} | javascript | function (incremental) {
if (!reportHolder || !results) {
return; // logging was not enabled
}
var table = '<table><thead><tr><th>Selector</th><th> </th><th>ms</th><th>Total</th></tr></thead><tbody>';
// Extract the 10 slowest results
var resultsArray = [];
for (var res in results) {
if (results.hasOwnProperty(res) && res !== "__baseline__") {
resultsArray.push(results[res]);
}
}
var sorted = resultsArray.sort(function (a, b) {
if (a.baseline === b.baseline) {
return 0;
}
if (incremental) {
return a.baseline > b.baseline ? 1 : -1;
} else {
return a.baseline > b.baseline ? -1 : 1;
}
}).slice(0, 20);
for (var i = 0, len = sorted.length; i < len; i += 1) {
var item = sorted[i];
table += '<tr><td style="font:11px monospace">Removing <strong>'
+ item.name
+ '</strong></td><td style="text-align:right">'
+ (item.baseline > 0
? '<span style="color:green">saves</span>'
: '<span style="color:red">adds</span>')
+ '</td><td style="text-align:right; font:11px monospace">' + Math.abs(item.baseline) + 'ms</td>'
+ '<td style="text-align:right; font:11px monospace">' + item.runTime + 'ms</td></tr>\n';
}
table += '</tbody></table><hr/>';
// Summary
table += '<table><tr><td style="text-align:right; font:10px monospace">Selectors Tested:</td><td style="font:10px monospace">'
+ resultsArray.length
+ '</td></tr>'
+ '<tr><td style="text-align:right; font:10px monospace">Baseline Time:</td><td style="font:10px monospace">'
+ results["__baseline__"].runTime + 'ms</td></tr>';
style(reportHolder, {
width : 600
});
logHolder.innerHTML = table;
} | [
"function",
"(",
"incremental",
")",
"{",
"if",
"(",
"!",
"reportHolder",
"||",
"!",
"results",
")",
"{",
"return",
";",
"// logging was not enabled",
"}",
"var",
"table",
"=",
"'<table><thead><tr><th>Selector</th><th> </th><th>ms</th><th>Total</th></tr></thead><tbody>'",
";",
"// Extract the 10 slowest results",
"var",
"resultsArray",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"res",
"in",
"results",
")",
"{",
"if",
"(",
"results",
".",
"hasOwnProperty",
"(",
"res",
")",
"&&",
"res",
"!==",
"\"__baseline__\"",
")",
"{",
"resultsArray",
".",
"push",
"(",
"results",
"[",
"res",
"]",
")",
";",
"}",
"}",
"var",
"sorted",
"=",
"resultsArray",
".",
"sort",
"(",
"function",
"(",
"a",
",",
"b",
")",
"{",
"if",
"(",
"a",
".",
"baseline",
"===",
"b",
".",
"baseline",
")",
"{",
"return",
"0",
";",
"}",
"if",
"(",
"incremental",
")",
"{",
"return",
"a",
".",
"baseline",
">",
"b",
".",
"baseline",
"?",
"1",
":",
"-",
"1",
";",
"}",
"else",
"{",
"return",
"a",
".",
"baseline",
">",
"b",
".",
"baseline",
"?",
"-",
"1",
":",
"1",
";",
"}",
"}",
")",
".",
"slice",
"(",
"0",
",",
"20",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"len",
"=",
"sorted",
".",
"length",
";",
"i",
"<",
"len",
";",
"i",
"+=",
"1",
")",
"{",
"var",
"item",
"=",
"sorted",
"[",
"i",
"]",
";",
"table",
"+=",
"'<tr><td style=\"font:11px monospace\">Removing <strong>'",
"+",
"item",
".",
"name",
"+",
"'</strong></td><td style=\"text-align:right\">'",
"+",
"(",
"item",
".",
"baseline",
">",
"0",
"?",
"'<span style=\"color:green\">saves</span>'",
":",
"'<span style=\"color:red\">adds</span>'",
")",
"+",
"'</td><td style=\"text-align:right; font:11px monospace\">'",
"+",
"Math",
".",
"abs",
"(",
"item",
".",
"baseline",
")",
"+",
"'ms</td>'",
"+",
"'<td style=\"text-align:right; font:11px monospace\">'",
"+",
"item",
".",
"runTime",
"+",
"'ms</td></tr>\\n'",
";",
"}",
"table",
"+=",
"'</tbody></table><hr/>'",
";",
"// Summary",
"table",
"+=",
"'<table><tr><td style=\"text-align:right; font:10px monospace\">Selectors Tested:</td><td style=\"font:10px monospace\">'",
"+",
"resultsArray",
".",
"length",
"+",
"'</td></tr>'",
"+",
"'<tr><td style=\"text-align:right; font:10px monospace\">Baseline Time:</td><td style=\"font:10px monospace\">'",
"+",
"results",
"[",
"\"__baseline__\"",
"]",
".",
"runTime",
"+",
"'ms</td></tr>'",
";",
"style",
"(",
"reportHolder",
",",
"{",
"width",
":",
"600",
"}",
")",
";",
"logHolder",
".",
"innerHTML",
"=",
"table",
";",
"}"
] | Log the CSS stress test results in the report holder
@param {Boolean} incremental Type of test. If incremental we are interested in the selectors that make us waste
more, otherwise in the ones that make us gain more | [
"Log",
"the",
"CSS",
"stress",
"test",
"results",
"in",
"the",
"report",
"holder"
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/ext/StressCss.js#L404-L456 | |
27,940 | ariatemplates/ariatemplates | src/aria/ext/StressCss.js | function (test) {
test.iteration = 0;
removeSelector(test.selector, test.cfg.incremental);
log(test);
test.start = +(new Date());
executeAction(test);
} | javascript | function (test) {
test.iteration = 0;
removeSelector(test.selector, test.cfg.incremental);
log(test);
test.start = +(new Date());
executeAction(test);
} | [
"function",
"(",
"test",
")",
"{",
"test",
".",
"iteration",
"=",
"0",
";",
"removeSelector",
"(",
"test",
".",
"selector",
",",
"test",
".",
"cfg",
".",
"incremental",
")",
";",
"log",
"(",
"test",
")",
";",
"test",
".",
"start",
"=",
"+",
"(",
"new",
"Date",
"(",
")",
")",
";",
"executeAction",
"(",
"test",
")",
";",
"}"
] | Start a test
@param {Object} test Test object | [
"Start",
"a",
"test"
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/ext/StressCss.js#L462-L470 | |
27,941 | ariatemplates/ariatemplates | src/aria/ext/StressCss.js | function (cfg, callback) {
if (cfg.allSelectors.length > 0) {
var selector = cfg.allSelectors.splice(0, 1)[0];
var one = {
name : selector.name,
cfg : cfg,
selector : selector,
callback : {
fn : allTests,
scope : this,
args : [cfg, callback]
}
};
runTest(one);
} else {
logResults(cfg.incremental);
aria.ext.StressCss.__callback(callback);
}
} | javascript | function (cfg, callback) {
if (cfg.allSelectors.length > 0) {
var selector = cfg.allSelectors.splice(0, 1)[0];
var one = {
name : selector.name,
cfg : cfg,
selector : selector,
callback : {
fn : allTests,
scope : this,
args : [cfg, callback]
}
};
runTest(one);
} else {
logResults(cfg.incremental);
aria.ext.StressCss.__callback(callback);
}
} | [
"function",
"(",
"cfg",
",",
"callback",
")",
"{",
"if",
"(",
"cfg",
".",
"allSelectors",
".",
"length",
">",
"0",
")",
"{",
"var",
"selector",
"=",
"cfg",
".",
"allSelectors",
".",
"splice",
"(",
"0",
",",
"1",
")",
"[",
"0",
"]",
";",
"var",
"one",
"=",
"{",
"name",
":",
"selector",
".",
"name",
",",
"cfg",
":",
"cfg",
",",
"selector",
":",
"selector",
",",
"callback",
":",
"{",
"fn",
":",
"allTests",
",",
"scope",
":",
"this",
",",
"args",
":",
"[",
"cfg",
",",
"callback",
"]",
"}",
"}",
";",
"runTest",
"(",
"one",
")",
";",
"}",
"else",
"{",
"logResults",
"(",
"cfg",
".",
"incremental",
")",
";",
"aria",
".",
"ext",
".",
"StressCss",
".",
"__callback",
"(",
"callback",
")",
";",
"}",
"}"
] | Run the tests on all selectors in the page, removing them one by one and comparing with the baselines
@param {Object} cfg User defined configuration parameters
@param {Object} callback Function to be executed after this measure. | [
"Run",
"the",
"tests",
"on",
"all",
"selectors",
"in",
"the",
"page",
"removing",
"them",
"one",
"by",
"one",
"and",
"comparing",
"with",
"the",
"baselines"
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/ext/StressCss.js#L477-L496 | |
27,942 | ariatemplates/ariatemplates | src/aria/ext/StressCss.js | function (cfg, callback) {
results = {};
// Generate a test targeting any CSS
var all = {
name : "__baseline__",
cfg : cfg,
selector : null,
callback : {
fn : allTests,
scope : this,
args : [cfg, callback]
}
};
runTest(all);
} | javascript | function (cfg, callback) {
results = {};
// Generate a test targeting any CSS
var all = {
name : "__baseline__",
cfg : cfg,
selector : null,
callback : {
fn : allTests,
scope : this,
args : [cfg, callback]
}
};
runTest(all);
} | [
"function",
"(",
"cfg",
",",
"callback",
")",
"{",
"results",
"=",
"{",
"}",
";",
"// Generate a test targeting any CSS",
"var",
"all",
"=",
"{",
"name",
":",
"\"__baseline__\"",
",",
"cfg",
":",
"cfg",
",",
"selector",
":",
"null",
",",
"callback",
":",
"{",
"fn",
":",
"allTests",
",",
"scope",
":",
"this",
",",
"args",
":",
"[",
"cfg",
",",
"callback",
"]",
"}",
"}",
";",
"runTest",
"(",
"all",
")",
";",
"}"
] | Get the test results for the baseline containing all selectors.
@param {Object} cfg User defined configuration parameters
@param {Object} callback Function to be executed after this measure. | [
"Get",
"the",
"test",
"results",
"for",
"the",
"baseline",
"containing",
"all",
"selectors",
"."
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/ext/StressCss.js#L503-L519 | |
27,943 | ariatemplates/ariatemplates | src/aria/ext/StressCss.js | function (cfg) {
cfg = cfg || {};
for (var prop in defaults) {
if (defaults.hasOwnProperty(prop) && !(prop in cfg)) {
cfg[prop] = defaults[prop];
}
}
cfg.allSelectors = getAllSelectors(cfg.widget);
return cfg;
} | javascript | function (cfg) {
cfg = cfg || {};
for (var prop in defaults) {
if (defaults.hasOwnProperty(prop) && !(prop in cfg)) {
cfg[prop] = defaults[prop];
}
}
cfg.allSelectors = getAllSelectors(cfg.widget);
return cfg;
} | [
"function",
"(",
"cfg",
")",
"{",
"cfg",
"=",
"cfg",
"||",
"{",
"}",
";",
"for",
"(",
"var",
"prop",
"in",
"defaults",
")",
"{",
"if",
"(",
"defaults",
".",
"hasOwnProperty",
"(",
"prop",
")",
"&&",
"!",
"(",
"prop",
"in",
"cfg",
")",
")",
"{",
"cfg",
"[",
"prop",
"]",
"=",
"defaults",
"[",
"prop",
"]",
";",
"}",
"}",
"cfg",
".",
"allSelectors",
"=",
"getAllSelectors",
"(",
"cfg",
".",
"widget",
")",
";",
"return",
"cfg",
";",
"}"
] | Normalize the user defined configuration object. It will add default values from
@see defaults and generate the whole list of selectors to be tested.
@param {Object} cfg Configuration information
@return {Object} Normalized configuration object | [
"Normalize",
"the",
"user",
"defined",
"configuration",
"object",
".",
"It",
"will",
"add",
"default",
"values",
"from"
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/ext/StressCss.js#L553-L565 | |
27,944 | ariatemplates/ariatemplates | src/aria/pageEngine/utils/PageEngineUtils.js | function (item, container) {
if (item && !ariaUtilsArray.contains(container, item)) {
container.push(item);
}
} | javascript | function (item, container) {
if (item && !ariaUtilsArray.contains(container, item)) {
container.push(item);
}
} | [
"function",
"(",
"item",
",",
"container",
")",
"{",
"if",
"(",
"item",
"&&",
"!",
"ariaUtilsArray",
".",
"contains",
"(",
"container",
",",
"item",
")",
")",
"{",
"container",
".",
"push",
"(",
"item",
")",
";",
"}",
"}"
] | Add an item inside a container only if it is not already there
@param {MultiTypes} item
@param {Array} container | [
"Add",
"an",
"item",
"inside",
"a",
"container",
"only",
"if",
"it",
"is",
"not",
"already",
"there"
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/pageEngine/utils/PageEngineUtils.js#L33-L37 | |
27,945 | ariatemplates/ariatemplates | src/aria/pageEngine/utils/PageEngineUtils.js | function (container, toAdd) {
var entry;
for (var i = 0, len = toAdd.length; i < len; i++) {
entry = toAdd[i];
this.addIfMissing(entry, container);
}
} | javascript | function (container, toAdd) {
var entry;
for (var i = 0, len = toAdd.length; i < len; i++) {
entry = toAdd[i];
this.addIfMissing(entry, container);
}
} | [
"function",
"(",
"container",
",",
"toAdd",
")",
"{",
"var",
"entry",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"len",
"=",
"toAdd",
".",
"length",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"entry",
"=",
"toAdd",
"[",
"i",
"]",
";",
"this",
".",
"addIfMissing",
"(",
"entry",
",",
"container",
")",
";",
"}",
"}"
] | Add all the entries of the array toAdd into the array container only if container does not already have them
@param {Array} container
@param {Array} toAdd | [
"Add",
"all",
"the",
"entries",
"of",
"the",
"array",
"toAdd",
"into",
"the",
"array",
"container",
"only",
"if",
"container",
"does",
"not",
"already",
"have",
"them"
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/pageEngine/utils/PageEngineUtils.js#L44-L50 | |
27,946 | ariatemplates/ariatemplates | src/aria/pageEngine/utils/PageEngineUtils.js | function (container, property) {
var output = [], entry;
for (var i = 0, len = container.length; i < len; i++) {
entry = container[i];
if (entry[property]) {
output.push(entry[property]);
}
}
return output;
} | javascript | function (container, property) {
var output = [], entry;
for (var i = 0, len = container.length; i < len; i++) {
entry = container[i];
if (entry[property]) {
output.push(entry[property]);
}
}
return output;
} | [
"function",
"(",
"container",
",",
"property",
")",
"{",
"var",
"output",
"=",
"[",
"]",
",",
"entry",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"len",
"=",
"container",
".",
"length",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"entry",
"=",
"container",
"[",
"i",
"]",
";",
"if",
"(",
"entry",
"[",
"property",
"]",
")",
"{",
"output",
".",
"push",
"(",
"entry",
"[",
"property",
"]",
")",
";",
"}",
"}",
"return",
"output",
";",
"}"
] | Extract a certain property from all the elements of the container array
@param {Array} container
@param {String} property
@return {Array} | [
"Extract",
"a",
"certain",
"property",
"from",
"all",
"the",
"elements",
"of",
"the",
"container",
"array"
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/pageEngine/utils/PageEngineUtils.js#L58-L67 | |
27,947 | ariatemplates/ariatemplates | src/aria/pageEngine/utils/PageEngineUtils.js | function (container, keyName) {
for (var element in container) {
if (container.hasOwnProperty(element)) {
container[element][keyName] = element;
}
}
} | javascript | function (container, keyName) {
for (var element in container) {
if (container.hasOwnProperty(element)) {
container[element][keyName] = element;
}
}
} | [
"function",
"(",
"container",
",",
"keyName",
")",
"{",
"for",
"(",
"var",
"element",
"in",
"container",
")",
"{",
"if",
"(",
"container",
".",
"hasOwnProperty",
"(",
"element",
")",
")",
"{",
"container",
"[",
"element",
"]",
"[",
"keyName",
"]",
"=",
"element",
";",
"}",
"}",
"}"
] | Go through all the values of an object and adds the corresponding value inside its entries using the provided
keyName
@param {Object} container
@param {String} keyName | [
"Go",
"through",
"all",
"the",
"values",
"of",
"an",
"object",
"and",
"adds",
"the",
"corresponding",
"value",
"inside",
"its",
"entries",
"using",
"the",
"provided",
"keyName"
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/pageEngine/utils/PageEngineUtils.js#L75-L81 | |
27,948 | ariatemplates/ariatemplates | src/aria/pageEngine/utils/PageEngineUtils.js | function (msg, errors, scope) {
scope.$logError.apply(scope, [msg + ":"]);
for (var i = 0, len = errors.length; i < len; i++) {
scope.$logError.apply(scope, [(i + 1) + " - " + errors[i].msgId, errors[i].msgArgs]);
}
} | javascript | function (msg, errors, scope) {
scope.$logError.apply(scope, [msg + ":"]);
for (var i = 0, len = errors.length; i < len; i++) {
scope.$logError.apply(scope, [(i + 1) + " - " + errors[i].msgId, errors[i].msgArgs]);
}
} | [
"function",
"(",
"msg",
",",
"errors",
",",
"scope",
")",
"{",
"scope",
".",
"$logError",
".",
"apply",
"(",
"scope",
",",
"[",
"msg",
"+",
"\":\"",
"]",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"len",
"=",
"errors",
".",
"length",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"scope",
".",
"$logError",
".",
"apply",
"(",
"scope",
",",
"[",
"(",
"i",
"+",
"1",
")",
"+",
"\" - \"",
"+",
"errors",
"[",
"i",
"]",
".",
"msgId",
",",
"errors",
"[",
"i",
"]",
".",
"msgArgs",
"]",
")",
";",
"}",
"}"
] | Log multiple errors to the default logger
@param {String} msg The global error message
@param {Array} errors List of all errors in this batch
@param {Object} scope Scope of the $logError method | [
"Log",
"multiple",
"errors",
"to",
"the",
"default",
"logger"
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/pageEngine/utils/PageEngineUtils.js#L104-L109 | |
27,949 | ariatemplates/ariatemplates | src/aria/widgets/form/InputValidationHandler.js | function (errorMessage) {
var msg = null;
for (var i = 0; i < errorMessage.length; i++) {
if (msg === null && errorMessage[i]) {
msg = errorMessage[i];
}
}
return msg;
} | javascript | function (errorMessage) {
var msg = null;
for (var i = 0; i < errorMessage.length; i++) {
if (msg === null && errorMessage[i]) {
msg = errorMessage[i];
}
}
return msg;
} | [
"function",
"(",
"errorMessage",
")",
"{",
"var",
"msg",
"=",
"null",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"errorMessage",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"msg",
"===",
"null",
"&&",
"errorMessage",
"[",
"i",
"]",
")",
"{",
"msg",
"=",
"errorMessage",
"[",
"i",
"]",
";",
"}",
"}",
"return",
"msg",
";",
"}"
] | Error messages can be declared in the template or within the widget via the framework itself. Need to
determine which is which.
@param {Array} errorMessage
@private | [
"Error",
"messages",
"can",
"be",
"declared",
"in",
"the",
"template",
"or",
"within",
"the",
"widget",
"via",
"the",
"framework",
"itself",
".",
"Need",
"to",
"determine",
"which",
"is",
"which",
"."
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/InputValidationHandler.js#L88-L99 | |
27,950 | ariatemplates/ariatemplates | src/aria/widgets/form/InputValidationHandler.js | function (out) {
var errorMessage;
if (this._WidgetCfg.formatError) {// framework errors
errorMessage = this._WidgetCfg.formatErrorMessages;
} else if (this._WidgetCfg.error) {// template errors
errorMessage = this._WidgetCfg.errorMessages;
}
var div = new ariaWidgetsContainerDiv({
sclass : "errortip",
width : 289,
margins : "0 0 0 0"
}, this._context);
var msg = this._checkErrorMessage(errorMessage);
if (this._WidgetCfg.waiAria) {
div.addExtraAttributes('aria-hidden="true"');
this._widget.waiReadText(msg, {
alert: true
});
}
out.registerBehavior(div);
div.writeMarkupBegin(out);
out.write(msg);
div.writeMarkupEnd(out);
this._div = div;
} | javascript | function (out) {
var errorMessage;
if (this._WidgetCfg.formatError) {// framework errors
errorMessage = this._WidgetCfg.formatErrorMessages;
} else if (this._WidgetCfg.error) {// template errors
errorMessage = this._WidgetCfg.errorMessages;
}
var div = new ariaWidgetsContainerDiv({
sclass : "errortip",
width : 289,
margins : "0 0 0 0"
}, this._context);
var msg = this._checkErrorMessage(errorMessage);
if (this._WidgetCfg.waiAria) {
div.addExtraAttributes('aria-hidden="true"');
this._widget.waiReadText(msg, {
alert: true
});
}
out.registerBehavior(div);
div.writeMarkupBegin(out);
out.write(msg);
div.writeMarkupEnd(out);
this._div = div;
} | [
"function",
"(",
"out",
")",
"{",
"var",
"errorMessage",
";",
"if",
"(",
"this",
".",
"_WidgetCfg",
".",
"formatError",
")",
"{",
"// framework errors",
"errorMessage",
"=",
"this",
".",
"_WidgetCfg",
".",
"formatErrorMessages",
";",
"}",
"else",
"if",
"(",
"this",
".",
"_WidgetCfg",
".",
"error",
")",
"{",
"// template errors",
"errorMessage",
"=",
"this",
".",
"_WidgetCfg",
".",
"errorMessages",
";",
"}",
"var",
"div",
"=",
"new",
"ariaWidgetsContainerDiv",
"(",
"{",
"sclass",
":",
"\"errortip\"",
",",
"width",
":",
"289",
",",
"margins",
":",
"\"0 0 0 0\"",
"}",
",",
"this",
".",
"_context",
")",
";",
"var",
"msg",
"=",
"this",
".",
"_checkErrorMessage",
"(",
"errorMessage",
")",
";",
"if",
"(",
"this",
".",
"_WidgetCfg",
".",
"waiAria",
")",
"{",
"div",
".",
"addExtraAttributes",
"(",
"'aria-hidden=\"true\"'",
")",
";",
"this",
".",
"_widget",
".",
"waiReadText",
"(",
"msg",
",",
"{",
"alert",
":",
"true",
"}",
")",
";",
"}",
"out",
".",
"registerBehavior",
"(",
"div",
")",
";",
"div",
".",
"writeMarkupBegin",
"(",
"out",
")",
";",
"out",
".",
"write",
"(",
"msg",
")",
";",
"div",
".",
"writeMarkupEnd",
"(",
"out",
")",
";",
"this",
".",
"_div",
"=",
"div",
";",
"}"
] | Creates the container markup with the error message
@param {aria.templates.MarkupWriter} out Markup writer which should receive the content of the popup.
@private | [
"Creates",
"the",
"container",
"markup",
"with",
"the",
"error",
"message"
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/InputValidationHandler.js#L106-L135 | |
27,951 | ariatemplates/ariatemplates | src/aria/widgets/form/InputValidationHandler.js | function () {
if (this._validationPopup) {
return;
}
// create the section
var section = this._context.createSection({
fn : this._renderValidationContent,
scope : this
});
// we no longer store the section in this._section as the section is properly disposed by the popup when it
// is disposed
var popup = new ariaPopupsPopup();
this._validationPopup = popup;
this._validationPopup.$on({
"onAfterClose" : this._afterValidationClose,
"onPositioned" : this._onTooltipPositioned,
scope : this
});
ariaTemplatesLayout.$on({
"viewportResized" : this._onViewportResized,
scope : this
});
this._validationPopup.open({
section : section,
domReference : this._field,
preferredPositions : this._getPreferredPositions(),
closeOnMouseClick : true,
closeOnMouseScroll : false,
waiAria: this._WidgetCfg.waiAria
});
} | javascript | function () {
if (this._validationPopup) {
return;
}
// create the section
var section = this._context.createSection({
fn : this._renderValidationContent,
scope : this
});
// we no longer store the section in this._section as the section is properly disposed by the popup when it
// is disposed
var popup = new ariaPopupsPopup();
this._validationPopup = popup;
this._validationPopup.$on({
"onAfterClose" : this._afterValidationClose,
"onPositioned" : this._onTooltipPositioned,
scope : this
});
ariaTemplatesLayout.$on({
"viewportResized" : this._onViewportResized,
scope : this
});
this._validationPopup.open({
section : section,
domReference : this._field,
preferredPositions : this._getPreferredPositions(),
closeOnMouseClick : true,
closeOnMouseScroll : false,
waiAria: this._WidgetCfg.waiAria
});
} | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"_validationPopup",
")",
"{",
"return",
";",
"}",
"// create the section",
"var",
"section",
"=",
"this",
".",
"_context",
".",
"createSection",
"(",
"{",
"fn",
":",
"this",
".",
"_renderValidationContent",
",",
"scope",
":",
"this",
"}",
")",
";",
"// we no longer store the section in this._section as the section is properly disposed by the popup when it",
"// is disposed",
"var",
"popup",
"=",
"new",
"ariaPopupsPopup",
"(",
")",
";",
"this",
".",
"_validationPopup",
"=",
"popup",
";",
"this",
".",
"_validationPopup",
".",
"$on",
"(",
"{",
"\"onAfterClose\"",
":",
"this",
".",
"_afterValidationClose",
",",
"\"onPositioned\"",
":",
"this",
".",
"_onTooltipPositioned",
",",
"scope",
":",
"this",
"}",
")",
";",
"ariaTemplatesLayout",
".",
"$on",
"(",
"{",
"\"viewportResized\"",
":",
"this",
".",
"_onViewportResized",
",",
"scope",
":",
"this",
"}",
")",
";",
"this",
".",
"_validationPopup",
".",
"open",
"(",
"{",
"section",
":",
"section",
",",
"domReference",
":",
"this",
".",
"_field",
",",
"preferredPositions",
":",
"this",
".",
"_getPreferredPositions",
"(",
")",
",",
"closeOnMouseClick",
":",
"true",
",",
"closeOnMouseScroll",
":",
"false",
",",
"waiAria",
":",
"this",
".",
"_WidgetCfg",
".",
"waiAria",
"}",
")",
";",
"}"
] | Internal method called when the validation must be open
@private | [
"Internal",
"method",
"called",
"when",
"the",
"validation",
"must",
"be",
"open"
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/InputValidationHandler.js#L141-L172 | |
27,952 | ariatemplates/ariatemplates | src/aria/widgets/form/InputValidationHandler.js | function () {
var errorTipPosition = this._WidgetCfg.errorTipPosition;
var preferredPositions = [this._preferredPositions[errorTipPosition]];
for (var i in this._preferredPositions) {
if (this._preferredPositions.hasOwnProperty(i) && errorTipPosition != i) {
preferredPositions.push(this._preferredPositions[i]);
}
}
return preferredPositions;
} | javascript | function () {
var errorTipPosition = this._WidgetCfg.errorTipPosition;
var preferredPositions = [this._preferredPositions[errorTipPosition]];
for (var i in this._preferredPositions) {
if (this._preferredPositions.hasOwnProperty(i) && errorTipPosition != i) {
preferredPositions.push(this._preferredPositions[i]);
}
}
return preferredPositions;
} | [
"function",
"(",
")",
"{",
"var",
"errorTipPosition",
"=",
"this",
".",
"_WidgetCfg",
".",
"errorTipPosition",
";",
"var",
"preferredPositions",
"=",
"[",
"this",
".",
"_preferredPositions",
"[",
"errorTipPosition",
"]",
"]",
";",
"for",
"(",
"var",
"i",
"in",
"this",
".",
"_preferredPositions",
")",
"{",
"if",
"(",
"this",
".",
"_preferredPositions",
".",
"hasOwnProperty",
"(",
"i",
")",
"&&",
"errorTipPosition",
"!=",
"i",
")",
"{",
"preferredPositions",
".",
"push",
"(",
"this",
".",
"_preferredPositions",
"[",
"i",
"]",
")",
";",
"}",
"}",
"return",
"preferredPositions",
";",
"}"
] | Creates an array of preferred positions, will first get the preferred position specified in the widgets
errorTipPosition property.
@return {Array} Returns an array of preferred positions. | [
"Creates",
"an",
"array",
"of",
"preferred",
"positions",
"will",
"first",
"get",
"the",
"preferred",
"position",
"specified",
"in",
"the",
"widgets",
"errorTipPosition",
"property",
"."
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/InputValidationHandler.js#L179-L188 | |
27,953 | ariatemplates/ariatemplates | src/aria/widgets/form/InputValidationHandler.js | function (evt) {
var position = evt.position;
if (position) {
// state is named after the position, except for topRight where it is named normal
var state = position.reference.replace(" right", "Right").replace(" left", "Left");
if (state === 'topRight') {
state = 'normal';
}
var div = this._div, frame = div._frame;
// Make sure that the div is initialised (only once),
// as _onTooltipPositioned can be called several times for the same popup
div.getDom();
// this is backward compatibility for skin without errortooltip position states
if (frame.checkState(state)) {
frame.changeState(state);
}
}
} | javascript | function (evt) {
var position = evt.position;
if (position) {
// state is named after the position, except for topRight where it is named normal
var state = position.reference.replace(" right", "Right").replace(" left", "Left");
if (state === 'topRight') {
state = 'normal';
}
var div = this._div, frame = div._frame;
// Make sure that the div is initialised (only once),
// as _onTooltipPositioned can be called several times for the same popup
div.getDom();
// this is backward compatibility for skin without errortooltip position states
if (frame.checkState(state)) {
frame.changeState(state);
}
}
} | [
"function",
"(",
"evt",
")",
"{",
"var",
"position",
"=",
"evt",
".",
"position",
";",
"if",
"(",
"position",
")",
"{",
"// state is named after the position, except for topRight where it is named normal",
"var",
"state",
"=",
"position",
".",
"reference",
".",
"replace",
"(",
"\" right\"",
",",
"\"Right\"",
")",
".",
"replace",
"(",
"\" left\"",
",",
"\"Left\"",
")",
";",
"if",
"(",
"state",
"===",
"'topRight'",
")",
"{",
"state",
"=",
"'normal'",
";",
"}",
"var",
"div",
"=",
"this",
".",
"_div",
",",
"frame",
"=",
"div",
".",
"_frame",
";",
"// Make sure that the div is initialised (only once),",
"// as _onTooltipPositioned can be called several times for the same popup",
"div",
".",
"getDom",
"(",
")",
";",
"// this is backward compatibility for skin without errortooltip position states",
"if",
"(",
"frame",
".",
"checkState",
"(",
"state",
")",
")",
"{",
"frame",
".",
"changeState",
"(",
"state",
")",
";",
"}",
"}",
"}"
] | Raised by the popup when its positioned. Needed to change the skin of the popup to place the arrow properly.
@param {Object} evt | [
"Raised",
"by",
"the",
"popup",
"when",
"its",
"positioned",
".",
"Needed",
"to",
"change",
"the",
"skin",
"of",
"the",
"popup",
"to",
"place",
"the",
"arrow",
"properly",
"."
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/InputValidationHandler.js#L218-L236 | |
27,954 | ariatemplates/ariatemplates | src/aria/utils/FireDomEvent.js | function (target, options) {
if (ariaCoreBrowser.isOldIE || ariaCoreBrowser.isSafari) {
this.fireKeydownEventAdaptedForKeyNav = function (target, options) {
// For IE and Safari:
simulate(target, "keydown", options);
};
} else {
this.fireKeydownEventAdaptedForKeyNav = function (target, options) {
// For other browsers than IE and Safari:
// Shitty implementation for keynav:
// Other browser that safari and IE need to listen to keydown
// and keypress, so we need to simulate both of them for these browser (firefox for instance)
simulate(target, "keydown", options);
simulate(target, "keypress", options);
};
}
this.fireKeydownEventAdaptedForKeyNav(target, options);
} | javascript | function (target, options) {
if (ariaCoreBrowser.isOldIE || ariaCoreBrowser.isSafari) {
this.fireKeydownEventAdaptedForKeyNav = function (target, options) {
// For IE and Safari:
simulate(target, "keydown", options);
};
} else {
this.fireKeydownEventAdaptedForKeyNav = function (target, options) {
// For other browsers than IE and Safari:
// Shitty implementation for keynav:
// Other browser that safari and IE need to listen to keydown
// and keypress, so we need to simulate both of them for these browser (firefox for instance)
simulate(target, "keydown", options);
simulate(target, "keypress", options);
};
}
this.fireKeydownEventAdaptedForKeyNav(target, options);
} | [
"function",
"(",
"target",
",",
"options",
")",
"{",
"if",
"(",
"ariaCoreBrowser",
".",
"isOldIE",
"||",
"ariaCoreBrowser",
".",
"isSafari",
")",
"{",
"this",
".",
"fireKeydownEventAdaptedForKeyNav",
"=",
"function",
"(",
"target",
",",
"options",
")",
"{",
"// For IE and Safari:",
"simulate",
"(",
"target",
",",
"\"keydown\"",
",",
"options",
")",
";",
"}",
";",
"}",
"else",
"{",
"this",
".",
"fireKeydownEventAdaptedForKeyNav",
"=",
"function",
"(",
"target",
",",
"options",
")",
"{",
"// For other browsers than IE and Safari:",
"// Shitty implementation for keynav:",
"// Other browser that safari and IE need to listen to keydown",
"// and keypress, so we need to simulate both of them for these browser (firefox for instance)",
"simulate",
"(",
"target",
",",
"\"keydown\"",
",",
"options",
")",
";",
"simulate",
"(",
"target",
",",
"\"keypress\"",
",",
"options",
")",
";",
"}",
";",
"}",
"this",
".",
"fireKeydownEventAdaptedForKeyNav",
"(",
"target",
",",
"options",
")",
";",
"}"
] | Simulate a keydown event used inside key navigation.
@method | [
"Simulate",
"a",
"keydown",
"event",
"used",
"inside",
"key",
"navigation",
"."
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/FireDomEvent.js#L645-L662 | |
27,955 | ariatemplates/ariatemplates | src/aria/core/environment/Environment.js | function (mode) {
var debug = this.isDebug();
if (debug !== mode && (mode === true || mode === false)) {
ariaCoreAppEnvironment.setEnvironment({
"appSettings" : {
"debug" : mode
}
}, null, true);
}
} | javascript | function (mode) {
var debug = this.isDebug();
if (debug !== mode && (mode === true || mode === false)) {
ariaCoreAppEnvironment.setEnvironment({
"appSettings" : {
"debug" : mode
}
}, null, true);
}
} | [
"function",
"(",
"mode",
")",
"{",
"var",
"debug",
"=",
"this",
".",
"isDebug",
"(",
")",
";",
"if",
"(",
"debug",
"!==",
"mode",
"&&",
"(",
"mode",
"===",
"true",
"||",
"mode",
"===",
"false",
")",
")",
"{",
"ariaCoreAppEnvironment",
".",
"setEnvironment",
"(",
"{",
"\"appSettings\"",
":",
"{",
"\"debug\"",
":",
"mode",
"}",
"}",
",",
"null",
",",
"true",
")",
";",
"}",
"}"
] | Enable debug mode, and notify listeners.
@public
@param {Boolean} mode | [
"Enable",
"debug",
"mode",
"and",
"notify",
"listeners",
"."
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/core/environment/Environment.js#L136-L145 | |
27,956 | ariatemplates/ariatemplates | src/aria/core/environment/Environment.js | function (mode) {
var dev = this.isDevMode();
if (dev !== mode && (mode === true || mode === false)) {
ariaCoreAppEnvironment.setEnvironment({
"appSettings" : {
"devMode" : mode
}
}, null, true);
}
} | javascript | function (mode) {
var dev = this.isDevMode();
if (dev !== mode && (mode === true || mode === false)) {
ariaCoreAppEnvironment.setEnvironment({
"appSettings" : {
"devMode" : mode
}
}, null, true);
}
} | [
"function",
"(",
"mode",
")",
"{",
"var",
"dev",
"=",
"this",
".",
"isDevMode",
"(",
")",
";",
"if",
"(",
"dev",
"!==",
"mode",
"&&",
"(",
"mode",
"===",
"true",
"||",
"mode",
"===",
"false",
")",
")",
"{",
"ariaCoreAppEnvironment",
".",
"setEnvironment",
"(",
"{",
"\"appSettings\"",
":",
"{",
"\"devMode\"",
":",
"mode",
"}",
"}",
",",
"null",
",",
"true",
")",
";",
"}",
"}"
] | Enable dev mode, and notify listeners.
@public
@param {Boolean} mode | [
"Enable",
"dev",
"mode",
"and",
"notify",
"listeners",
"."
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/core/environment/Environment.js#L152-L161 | |
27,957 | ariatemplates/ariatemplates | src/aria/core/environment/Environment.js | function (escape) {
var currentValue = this.hasEscapeHtmlByDefault();
if (currentValue !== escape && (escape === true || escape === false)) {
aria.core.AppEnvironment.setEnvironment({
"templateSettings" : {
"escapeHtmlByDefault" : escape
}
}, null, true);
}
} | javascript | function (escape) {
var currentValue = this.hasEscapeHtmlByDefault();
if (currentValue !== escape && (escape === true || escape === false)) {
aria.core.AppEnvironment.setEnvironment({
"templateSettings" : {
"escapeHtmlByDefault" : escape
}
}, null, true);
}
} | [
"function",
"(",
"escape",
")",
"{",
"var",
"currentValue",
"=",
"this",
".",
"hasEscapeHtmlByDefault",
"(",
")",
";",
"if",
"(",
"currentValue",
"!==",
"escape",
"&&",
"(",
"escape",
"===",
"true",
"||",
"escape",
"===",
"false",
")",
")",
"{",
"aria",
".",
"core",
".",
"AppEnvironment",
".",
"setEnvironment",
"(",
"{",
"\"templateSettings\"",
":",
"{",
"\"escapeHtmlByDefault\"",
":",
"escape",
"}",
"}",
",",
"null",
",",
"true",
")",
";",
"}",
"}"
] | Turn on or off auto-escaping of HTML in statements
@public
@param {Boolean} escape | [
"Turn",
"on",
"or",
"off",
"auto",
"-",
"escaping",
"of",
"HTML",
"in",
"statements"
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/core/environment/Environment.js#L204-L213 | |
27,958 | ariatemplates/ariatemplates | src/aria/pageEngine/PageEngine.js | function (config) {
this._config = config;
this._pageProvider = config.pageProvider;
ariaEmbedPlaceholderManager.register(this);
this._pageProvider.$addListeners({
"pageDefinitionChange" : this._onPageDefinitionChangeListener
});
this._pageProvider.loadSiteConfig({
onsuccess : {
fn : this._loadRootModule,
scope : this
},
onfailure : this._getErrorCallbackConfig([this.SITE_CONFIG_NOT_AVAILABLE])
});
} | javascript | function (config) {
this._config = config;
this._pageProvider = config.pageProvider;
ariaEmbedPlaceholderManager.register(this);
this._pageProvider.$addListeners({
"pageDefinitionChange" : this._onPageDefinitionChangeListener
});
this._pageProvider.loadSiteConfig({
onsuccess : {
fn : this._loadRootModule,
scope : this
},
onfailure : this._getErrorCallbackConfig([this.SITE_CONFIG_NOT_AVAILABLE])
});
} | [
"function",
"(",
"config",
")",
"{",
"this",
".",
"_config",
"=",
"config",
";",
"this",
".",
"_pageProvider",
"=",
"config",
".",
"pageProvider",
";",
"ariaEmbedPlaceholderManager",
".",
"register",
"(",
"this",
")",
";",
"this",
".",
"_pageProvider",
".",
"$addListeners",
"(",
"{",
"\"pageDefinitionChange\"",
":",
"this",
".",
"_onPageDefinitionChangeListener",
"}",
")",
";",
"this",
".",
"_pageProvider",
".",
"loadSiteConfig",
"(",
"{",
"onsuccess",
":",
"{",
"fn",
":",
"this",
".",
"_loadRootModule",
",",
"scope",
":",
"this",
"}",
",",
"onfailure",
":",
"this",
".",
"_getErrorCallbackConfig",
"(",
"[",
"this",
".",
"SITE_CONFIG_NOT_AVAILABLE",
"]",
")",
"}",
")",
";",
"}"
] | Start the page engine by loading the site configuration
@param {aria.pageEngine.CfgBeans:Start} config json configuration | [
"Start",
"the",
"page",
"engine",
"by",
"loading",
"the",
"site",
"configuration"
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/pageEngine/PageEngine.js#L260-L277 | |
27,959 | ariatemplates/ariatemplates | src/aria/pageEngine/PageEngine.js | function (siteConfig) {
var valid = this.isConfigValid(siteConfig, "aria.pageEngine.CfgBeans.Site", this.INVALID_SITE_CONFIGURATION);
if (!valid) {
return;
}
var helper = new ariaPageEngineUtilsSiteConfigHelper(siteConfig);
this._siteConfigHelper = helper;
// Initialization
var appData = helper.getAppData();
appData.menus = appData.menus || {};
var initArgs = {
appData : appData,
pageEngine : this._wrapper
};
var rootModuleConfig = this._config.rootModule;
if (rootModuleConfig) {
var customControllerClasspath = rootModuleConfig.classpath;
if (rootModuleConfig.initArgs) {
ariaUtilsJson.inject(initArgs, rootModuleConfig.initArgs);
}
var that = this;
Aria.load({
classes : [customControllerClasspath],
oncomplete : function () {
if (Aria.getClassRef(customControllerClasspath).classDefinition.$extends !== "aria.pageEngine.SiteRootModule") {
that._errorCallback([that.INVALID_ROOTMODULE_PARENT]);
return;
}
that._createModuleCtrl(rootModuleConfig);
},
onerror : this._getErrorCallbackConfig([this.MISSING_DEPENDENCIES])
});
} else {
this._createModuleCtrl({
classpath : "aria.pageEngine.SiteRootModule",
initArgs : initArgs
});
}
} | javascript | function (siteConfig) {
var valid = this.isConfigValid(siteConfig, "aria.pageEngine.CfgBeans.Site", this.INVALID_SITE_CONFIGURATION);
if (!valid) {
return;
}
var helper = new ariaPageEngineUtilsSiteConfigHelper(siteConfig);
this._siteConfigHelper = helper;
// Initialization
var appData = helper.getAppData();
appData.menus = appData.menus || {};
var initArgs = {
appData : appData,
pageEngine : this._wrapper
};
var rootModuleConfig = this._config.rootModule;
if (rootModuleConfig) {
var customControllerClasspath = rootModuleConfig.classpath;
if (rootModuleConfig.initArgs) {
ariaUtilsJson.inject(initArgs, rootModuleConfig.initArgs);
}
var that = this;
Aria.load({
classes : [customControllerClasspath],
oncomplete : function () {
if (Aria.getClassRef(customControllerClasspath).classDefinition.$extends !== "aria.pageEngine.SiteRootModule") {
that._errorCallback([that.INVALID_ROOTMODULE_PARENT]);
return;
}
that._createModuleCtrl(rootModuleConfig);
},
onerror : this._getErrorCallbackConfig([this.MISSING_DEPENDENCIES])
});
} else {
this._createModuleCtrl({
classpath : "aria.pageEngine.SiteRootModule",
initArgs : initArgs
});
}
} | [
"function",
"(",
"siteConfig",
")",
"{",
"var",
"valid",
"=",
"this",
".",
"isConfigValid",
"(",
"siteConfig",
",",
"\"aria.pageEngine.CfgBeans.Site\"",
",",
"this",
".",
"INVALID_SITE_CONFIGURATION",
")",
";",
"if",
"(",
"!",
"valid",
")",
"{",
"return",
";",
"}",
"var",
"helper",
"=",
"new",
"ariaPageEngineUtilsSiteConfigHelper",
"(",
"siteConfig",
")",
";",
"this",
".",
"_siteConfigHelper",
"=",
"helper",
";",
"// Initialization",
"var",
"appData",
"=",
"helper",
".",
"getAppData",
"(",
")",
";",
"appData",
".",
"menus",
"=",
"appData",
".",
"menus",
"||",
"{",
"}",
";",
"var",
"initArgs",
"=",
"{",
"appData",
":",
"appData",
",",
"pageEngine",
":",
"this",
".",
"_wrapper",
"}",
";",
"var",
"rootModuleConfig",
"=",
"this",
".",
"_config",
".",
"rootModule",
";",
"if",
"(",
"rootModuleConfig",
")",
"{",
"var",
"customControllerClasspath",
"=",
"rootModuleConfig",
".",
"classpath",
";",
"if",
"(",
"rootModuleConfig",
".",
"initArgs",
")",
"{",
"ariaUtilsJson",
".",
"inject",
"(",
"initArgs",
",",
"rootModuleConfig",
".",
"initArgs",
")",
";",
"}",
"var",
"that",
"=",
"this",
";",
"Aria",
".",
"load",
"(",
"{",
"classes",
":",
"[",
"customControllerClasspath",
"]",
",",
"oncomplete",
":",
"function",
"(",
")",
"{",
"if",
"(",
"Aria",
".",
"getClassRef",
"(",
"customControllerClasspath",
")",
".",
"classDefinition",
".",
"$extends",
"!==",
"\"aria.pageEngine.SiteRootModule\"",
")",
"{",
"that",
".",
"_errorCallback",
"(",
"[",
"that",
".",
"INVALID_ROOTMODULE_PARENT",
"]",
")",
";",
"return",
";",
"}",
"that",
".",
"_createModuleCtrl",
"(",
"rootModuleConfig",
")",
";",
"}",
",",
"onerror",
":",
"this",
".",
"_getErrorCallbackConfig",
"(",
"[",
"this",
".",
"MISSING_DEPENDENCIES",
"]",
")",
"}",
")",
";",
"}",
"else",
"{",
"this",
".",
"_createModuleCtrl",
"(",
"{",
"classpath",
":",
"\"aria.pageEngine.SiteRootModule\"",
",",
"initArgs",
":",
"initArgs",
"}",
")",
";",
"}",
"}"
] | Callback for the site configuration module controller. Initialize whatever is needed by the root module
controller, like the data model and the router
@param {aria.pageEngine.CfgBeans:Site} siteConfig Site configuration | [
"Callback",
"for",
"the",
"site",
"configuration",
"module",
"controller",
".",
"Initialize",
"whatever",
"is",
"needed",
"by",
"the",
"root",
"module",
"controller",
"like",
"the",
"data",
"model",
"and",
"the",
"router"
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/pageEngine/PageEngine.js#L284-L326 | |
27,960 | ariatemplates/ariatemplates | src/aria/pageEngine/PageEngine.js | function (loadModule) {
this._rootModule = loadModule.moduleCtrlPrivate;
this._data = this._rootModule.getData().storage;
var siteHelper = this._siteConfigHelper;
ariaUtilsCSSLoader.add(siteHelper.getSiteCss());
var classesToLoad = siteHelper.getListOfContentProcessors();
var navigationManagerClass = siteHelper.getNavigationManagerClass();
if (navigationManagerClass) {
classesToLoad.push(navigationManagerClass);
}
if (siteHelper.siteConfig.animations) {
classesToLoad.push("aria.pageEngine.utils.AnimationsManager");
}
var commonModulesToLoad = siteHelper.getCommonModulesDescription({
priority : 1
});
this._utils.wiseConcat(classesToLoad, this._utils.extractPropertyFromArrayElements(commonModulesToLoad, "classpath"));
Aria.load({
classes : classesToLoad,
oncomplete : {
fn : this._loadGlobalModules,
scope : this,
args : commonModulesToLoad
},
onerror : this._getErrorCallbackConfig([this.MISSING_DEPENDENCIES])
});
} | javascript | function (loadModule) {
this._rootModule = loadModule.moduleCtrlPrivate;
this._data = this._rootModule.getData().storage;
var siteHelper = this._siteConfigHelper;
ariaUtilsCSSLoader.add(siteHelper.getSiteCss());
var classesToLoad = siteHelper.getListOfContentProcessors();
var navigationManagerClass = siteHelper.getNavigationManagerClass();
if (navigationManagerClass) {
classesToLoad.push(navigationManagerClass);
}
if (siteHelper.siteConfig.animations) {
classesToLoad.push("aria.pageEngine.utils.AnimationsManager");
}
var commonModulesToLoad = siteHelper.getCommonModulesDescription({
priority : 1
});
this._utils.wiseConcat(classesToLoad, this._utils.extractPropertyFromArrayElements(commonModulesToLoad, "classpath"));
Aria.load({
classes : classesToLoad,
oncomplete : {
fn : this._loadGlobalModules,
scope : this,
args : commonModulesToLoad
},
onerror : this._getErrorCallbackConfig([this.MISSING_DEPENDENCIES])
});
} | [
"function",
"(",
"loadModule",
")",
"{",
"this",
".",
"_rootModule",
"=",
"loadModule",
".",
"moduleCtrlPrivate",
";",
"this",
".",
"_data",
"=",
"this",
".",
"_rootModule",
".",
"getData",
"(",
")",
".",
"storage",
";",
"var",
"siteHelper",
"=",
"this",
".",
"_siteConfigHelper",
";",
"ariaUtilsCSSLoader",
".",
"add",
"(",
"siteHelper",
".",
"getSiteCss",
"(",
")",
")",
";",
"var",
"classesToLoad",
"=",
"siteHelper",
".",
"getListOfContentProcessors",
"(",
")",
";",
"var",
"navigationManagerClass",
"=",
"siteHelper",
".",
"getNavigationManagerClass",
"(",
")",
";",
"if",
"(",
"navigationManagerClass",
")",
"{",
"classesToLoad",
".",
"push",
"(",
"navigationManagerClass",
")",
";",
"}",
"if",
"(",
"siteHelper",
".",
"siteConfig",
".",
"animations",
")",
"{",
"classesToLoad",
".",
"push",
"(",
"\"aria.pageEngine.utils.AnimationsManager\"",
")",
";",
"}",
"var",
"commonModulesToLoad",
"=",
"siteHelper",
".",
"getCommonModulesDescription",
"(",
"{",
"priority",
":",
"1",
"}",
")",
";",
"this",
".",
"_utils",
".",
"wiseConcat",
"(",
"classesToLoad",
",",
"this",
".",
"_utils",
".",
"extractPropertyFromArrayElements",
"(",
"commonModulesToLoad",
",",
"\"classpath\"",
")",
")",
";",
"Aria",
".",
"load",
"(",
"{",
"classes",
":",
"classesToLoad",
",",
"oncomplete",
":",
"{",
"fn",
":",
"this",
".",
"_loadGlobalModules",
",",
"scope",
":",
"this",
",",
"args",
":",
"commonModulesToLoad",
"}",
",",
"onerror",
":",
"this",
".",
"_getErrorCallbackConfig",
"(",
"[",
"this",
".",
"MISSING_DEPENDENCIES",
"]",
")",
"}",
")",
";",
"}"
] | Load any dependency global for the site, like common modules. This is a callback of a createModuleCtrl
@param {Object} loadModule Module controller description | [
"Load",
"any",
"dependency",
"global",
"for",
"the",
"site",
"like",
"common",
"modules",
".",
"This",
"is",
"a",
"callback",
"of",
"a",
"createModuleCtrl"
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/pageEngine/PageEngine.js#L344-L376 | |
27,961 | ariatemplates/ariatemplates | src/aria/pageEngine/PageEngine.js | function (commonModulesToLoad) {
this._rootModule.loadModules(null, {
page : [],
common : commonModulesToLoad
}, {
fn : this._onSiteReady,
scope : this
});
} | javascript | function (commonModulesToLoad) {
this._rootModule.loadModules(null, {
page : [],
common : commonModulesToLoad
}, {
fn : this._onSiteReady,
scope : this
});
} | [
"function",
"(",
"commonModulesToLoad",
")",
"{",
"this",
".",
"_rootModule",
".",
"loadModules",
"(",
"null",
",",
"{",
"page",
":",
"[",
"]",
",",
"common",
":",
"commonModulesToLoad",
"}",
",",
"{",
"fn",
":",
"this",
".",
"_onSiteReady",
",",
"scope",
":",
"this",
"}",
")",
";",
"}"
] | Load the global modules with priority 1
@param {Array} commonModulesToLoad Array containing objects of type
aria.templates.ModuleCtrl.SubModuleDefinition
@protected | [
"Load",
"the",
"global",
"modules",
"with",
"priority",
"1"
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/pageEngine/PageEngine.js#L384-L392 | |
27,962 | ariatemplates/ariatemplates | src/aria/pageEngine/PageEngine.js | function () {
var helper = this._siteConfigHelper;
this.contentProcessors = helper.getContentProcessorInstances();
this._firstDiv = helper.getRootDiv();
if (!this._animationsDisabled && helper.siteConfig.animations) {
this._animationsManager = new aria.pageEngine.utils.AnimationsManager();
this._secondDiv = this._animationsManager.createHiddenDiv(this._firstDiv);
}
this._navigationManager = helper.getNavigationManager({
fn : "navigate",
scope : this
}, helper.siteConfig.storage);
this.navigate({
url : this._navigationManager ? this._navigationManager.getUrl() : null,
pageId : this._navigationManager ? this._navigationManager.getPageId() : null,
replace : true
}, this._config.oncomplete);
} | javascript | function () {
var helper = this._siteConfigHelper;
this.contentProcessors = helper.getContentProcessorInstances();
this._firstDiv = helper.getRootDiv();
if (!this._animationsDisabled && helper.siteConfig.animations) {
this._animationsManager = new aria.pageEngine.utils.AnimationsManager();
this._secondDiv = this._animationsManager.createHiddenDiv(this._firstDiv);
}
this._navigationManager = helper.getNavigationManager({
fn : "navigate",
scope : this
}, helper.siteConfig.storage);
this.navigate({
url : this._navigationManager ? this._navigationManager.getUrl() : null,
pageId : this._navigationManager ? this._navigationManager.getPageId() : null,
replace : true
}, this._config.oncomplete);
} | [
"function",
"(",
")",
"{",
"var",
"helper",
"=",
"this",
".",
"_siteConfigHelper",
";",
"this",
".",
"contentProcessors",
"=",
"helper",
".",
"getContentProcessorInstances",
"(",
")",
";",
"this",
".",
"_firstDiv",
"=",
"helper",
".",
"getRootDiv",
"(",
")",
";",
"if",
"(",
"!",
"this",
".",
"_animationsDisabled",
"&&",
"helper",
".",
"siteConfig",
".",
"animations",
")",
"{",
"this",
".",
"_animationsManager",
"=",
"new",
"aria",
".",
"pageEngine",
".",
"utils",
".",
"AnimationsManager",
"(",
")",
";",
"this",
".",
"_secondDiv",
"=",
"this",
".",
"_animationsManager",
".",
"createHiddenDiv",
"(",
"this",
".",
"_firstDiv",
")",
";",
"}",
"this",
".",
"_navigationManager",
"=",
"helper",
".",
"getNavigationManager",
"(",
"{",
"fn",
":",
"\"navigate\"",
",",
"scope",
":",
"this",
"}",
",",
"helper",
".",
"siteConfig",
".",
"storage",
")",
";",
"this",
".",
"navigate",
"(",
"{",
"url",
":",
"this",
".",
"_navigationManager",
"?",
"this",
".",
"_navigationManager",
".",
"getUrl",
"(",
")",
":",
"null",
",",
"pageId",
":",
"this",
".",
"_navigationManager",
"?",
"this",
".",
"_navigationManager",
".",
"getPageId",
"(",
")",
":",
"null",
",",
"replace",
":",
"true",
"}",
",",
"this",
".",
"_config",
".",
"oncomplete",
")",
";",
"}"
] | Trigger the navigation to the first page
@protected | [
"Trigger",
"the",
"navigation",
"to",
"the",
"first",
"page"
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/pageEngine/PageEngine.js#L398-L415 | |
27,963 | ariatemplates/ariatemplates | src/aria/pageEngine/PageEngine.js | function (pageRequest, cb) {
var pageId = pageRequest.pageId;
var forceReload = pageRequest.forceReload;
if (!forceReload && pageId && pageId == this.currentPageId) {
this.$callback(cb);
if (this._navigationManager) {
this._navigationManager.update(pageRequest);
ariaUtilsJson.setValue(this._data, "pageInfo", pageRequest);
}
} else {
this._previousPageCSS = this._currentPageCSS;
this._currentPageCSS = [];
this._pageProvider.loadPageDefinition(pageRequest, {
onsuccess : {
fn : this._getPageDependencies,
scope : this,
args : {
pageRequest : pageRequest,
cb : cb
}
},
onfailure : this._getErrorCallbackConfig([this.PAGE_NOT_AVAILABLE, pageId])
});
}
} | javascript | function (pageRequest, cb) {
var pageId = pageRequest.pageId;
var forceReload = pageRequest.forceReload;
if (!forceReload && pageId && pageId == this.currentPageId) {
this.$callback(cb);
if (this._navigationManager) {
this._navigationManager.update(pageRequest);
ariaUtilsJson.setValue(this._data, "pageInfo", pageRequest);
}
} else {
this._previousPageCSS = this._currentPageCSS;
this._currentPageCSS = [];
this._pageProvider.loadPageDefinition(pageRequest, {
onsuccess : {
fn : this._getPageDependencies,
scope : this,
args : {
pageRequest : pageRequest,
cb : cb
}
},
onfailure : this._getErrorCallbackConfig([this.PAGE_NOT_AVAILABLE, pageId])
});
}
} | [
"function",
"(",
"pageRequest",
",",
"cb",
")",
"{",
"var",
"pageId",
"=",
"pageRequest",
".",
"pageId",
";",
"var",
"forceReload",
"=",
"pageRequest",
".",
"forceReload",
";",
"if",
"(",
"!",
"forceReload",
"&&",
"pageId",
"&&",
"pageId",
"==",
"this",
".",
"currentPageId",
")",
"{",
"this",
".",
"$callback",
"(",
"cb",
")",
";",
"if",
"(",
"this",
".",
"_navigationManager",
")",
"{",
"this",
".",
"_navigationManager",
".",
"update",
"(",
"pageRequest",
")",
";",
"ariaUtilsJson",
".",
"setValue",
"(",
"this",
".",
"_data",
",",
"\"pageInfo\"",
",",
"pageRequest",
")",
";",
"}",
"}",
"else",
"{",
"this",
".",
"_previousPageCSS",
"=",
"this",
".",
"_currentPageCSS",
";",
"this",
".",
"_currentPageCSS",
"=",
"[",
"]",
";",
"this",
".",
"_pageProvider",
".",
"loadPageDefinition",
"(",
"pageRequest",
",",
"{",
"onsuccess",
":",
"{",
"fn",
":",
"this",
".",
"_getPageDependencies",
",",
"scope",
":",
"this",
",",
"args",
":",
"{",
"pageRequest",
":",
"pageRequest",
",",
"cb",
":",
"cb",
"}",
"}",
",",
"onfailure",
":",
"this",
".",
"_getErrorCallbackConfig",
"(",
"[",
"this",
".",
"PAGE_NOT_AVAILABLE",
",",
"pageId",
"]",
")",
"}",
")",
";",
"}",
"}"
] | Navigate to a specific page
@param {aria.pageEngine.CfgBeans:PageNavigationInformation} pageRequest
@param {aria.core.CfgBeans:Callback} cb To be called when the navigation is complete | [
"Navigate",
"to",
"a",
"specific",
"page"
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/pageEngine/PageEngine.js#L422-L446 | |
27,964 | ariatemplates/ariatemplates | src/aria/pageEngine/PageEngine.js | function (cfg, args) {
var valid = this.isConfigValid(cfg, "aria.pageEngine.CfgBeans.PageDefinition", this.INVALID_PAGE_DEFINITION);
if (!valid) {
this.$callback(args.cb);
return;
}
var pageConfigHelper = this._getPageConfigHelper(cfg);
ariaUtilsJson.inject(pageConfigHelper.getMenus(), this._siteConfigHelper.getAppData().menus);
this._pageConfigHelper = pageConfigHelper;
this._lazyContent = true;
this._loadPageDependencies({
lazy : false,
pageId : cfg.pageId,
cb : {
fn : this._displayPage,
scope : this,
args : {
cb : args.cb,
pageConfig : cfg,
pageRequest : args.pageRequest
}
}
});
} | javascript | function (cfg, args) {
var valid = this.isConfigValid(cfg, "aria.pageEngine.CfgBeans.PageDefinition", this.INVALID_PAGE_DEFINITION);
if (!valid) {
this.$callback(args.cb);
return;
}
var pageConfigHelper = this._getPageConfigHelper(cfg);
ariaUtilsJson.inject(pageConfigHelper.getMenus(), this._siteConfigHelper.getAppData().menus);
this._pageConfigHelper = pageConfigHelper;
this._lazyContent = true;
this._loadPageDependencies({
lazy : false,
pageId : cfg.pageId,
cb : {
fn : this._displayPage,
scope : this,
args : {
cb : args.cb,
pageConfig : cfg,
pageRequest : args.pageRequest
}
}
});
} | [
"function",
"(",
"cfg",
",",
"args",
")",
"{",
"var",
"valid",
"=",
"this",
".",
"isConfigValid",
"(",
"cfg",
",",
"\"aria.pageEngine.CfgBeans.PageDefinition\"",
",",
"this",
".",
"INVALID_PAGE_DEFINITION",
")",
";",
"if",
"(",
"!",
"valid",
")",
"{",
"this",
".",
"$callback",
"(",
"args",
".",
"cb",
")",
";",
"return",
";",
"}",
"var",
"pageConfigHelper",
"=",
"this",
".",
"_getPageConfigHelper",
"(",
"cfg",
")",
";",
"ariaUtilsJson",
".",
"inject",
"(",
"pageConfigHelper",
".",
"getMenus",
"(",
")",
",",
"this",
".",
"_siteConfigHelper",
".",
"getAppData",
"(",
")",
".",
"menus",
")",
";",
"this",
".",
"_pageConfigHelper",
"=",
"pageConfigHelper",
";",
"this",
".",
"_lazyContent",
"=",
"true",
";",
"this",
".",
"_loadPageDependencies",
"(",
"{",
"lazy",
":",
"false",
",",
"pageId",
":",
"cfg",
".",
"pageId",
",",
"cb",
":",
"{",
"fn",
":",
"this",
".",
"_displayPage",
",",
"scope",
":",
"this",
",",
"args",
":",
"{",
"cb",
":",
"args",
".",
"cb",
",",
"pageConfig",
":",
"cfg",
",",
"pageRequest",
":",
"args",
".",
"pageRequest",
"}",
"}",
"}",
")",
";",
"}"
] | Callback for loading the page dependencies after loading the page description while doing navigation.
@param {aria.pageEngine.CfgBeans:PageDefinition} cfg Page configuration
@param {Object} args Contains the pageId and the callback | [
"Callback",
"for",
"loading",
"the",
"page",
"dependencies",
"after",
"loading",
"the",
"page",
"description",
"while",
"doing",
"navigation",
"."
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/pageEngine/PageEngine.js#L453-L478 | |
27,965 | ariatemplates/ariatemplates | src/aria/pageEngine/PageEngine.js | function (args) {
var subModules = args.subModules;
this._rootModule.loadModules(args.pageId, subModules, args.cb);
} | javascript | function (args) {
var subModules = args.subModules;
this._rootModule.loadModules(args.pageId, subModules, args.cb);
} | [
"function",
"(",
"args",
")",
"{",
"var",
"subModules",
"=",
"args",
".",
"subModules",
";",
"this",
".",
"_rootModule",
".",
"loadModules",
"(",
"args",
".",
"pageId",
",",
"subModules",
",",
"args",
".",
"cb",
")",
";",
"}"
] | Load any module that is needed by the page
@param {Object} args Contains the pageId and the callback
@protected | [
"Load",
"any",
"module",
"that",
"is",
"needed",
"by",
"the",
"page"
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/pageEngine/PageEngine.js#L541-L544 | |
27,966 | ariatemplates/ariatemplates | src/aria/pageEngine/PageEngine.js | function (cfg, beanName, error) {
try {
ariaCoreJsonValidator.normalize({
json : cfg,
beanName : beanName
}, true);
} catch (ex) {
this._utils.logMultipleErrors(error, ex.errors, this);
if (this._config.onerror) {
this.$callback(this._config.onerror, [error]);
}
return false;
}
return true;
} | javascript | function (cfg, beanName, error) {
try {
ariaCoreJsonValidator.normalize({
json : cfg,
beanName : beanName
}, true);
} catch (ex) {
this._utils.logMultipleErrors(error, ex.errors, this);
if (this._config.onerror) {
this.$callback(this._config.onerror, [error]);
}
return false;
}
return true;
} | [
"function",
"(",
"cfg",
",",
"beanName",
",",
"error",
")",
"{",
"try",
"{",
"ariaCoreJsonValidator",
".",
"normalize",
"(",
"{",
"json",
":",
"cfg",
",",
"beanName",
":",
"beanName",
"}",
",",
"true",
")",
";",
"}",
"catch",
"(",
"ex",
")",
"{",
"this",
".",
"_utils",
".",
"logMultipleErrors",
"(",
"error",
",",
"ex",
".",
"errors",
",",
"this",
")",
";",
"if",
"(",
"this",
".",
"_config",
".",
"onerror",
")",
"{",
"this",
".",
"$callback",
"(",
"this",
".",
"_config",
".",
"onerror",
",",
"[",
"error",
"]",
")",
";",
"}",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}"
] | Normalize a configuration. It logs an error in case of validation failure
@param {Object} cfg Configuration to validate
@param {String} beanName name of the bean
@param {String} error Error message to log along with the validation errors
@return {Boolean} | [
"Normalize",
"a",
"configuration",
".",
"It",
"logs",
"an",
"error",
"in",
"case",
"of",
"validation",
"failure"
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/pageEngine/PageEngine.js#L553-L567 | |
27,967 | ariatemplates/ariatemplates | src/aria/pageEngine/PageEngine.js | function (args) {
if (!this._pageConfigHelper) {
this.$callback(args.cb);
return;
}
var pageConfig = args.pageConfig, cfg = pageConfig.pageComposition, pageId = pageConfig.pageId;
this.$raiseEvent({
name : "beforePageTransition",
from : this.currentPageId,
to : pageId
});
this.currentPageId = pageId;
this._pageConfigs[pageId] = pageConfig;
var pageRequest = args.pageRequest;
pageRequest.url = pageConfig.url;
pageRequest.pageId = pageConfig.pageId;
pageRequest.title = pageConfig.title;
var json = ariaUtilsJson;
json.setValue(this._data, "pageData", cfg.pageData);
json.setValue(this._data, "pageInfo", pageRequest);
var cfgTemplate = {
classpath : cfg.template,
div : this._getContainer(!pageConfig.animation),
moduleCtrl : this._rootModule
};
this._modulesInPage = [];
// if the div does not change, let's dispose the previous template first
if (cfgTemplate.div == this._getContainer() && this._isTemplateLoaded) {
Aria.disposeTemplate(this._getContainer());
}
Aria.loadTemplate(cfgTemplate, {
fn : this._afterTemplateLoaded,
scope : this,
args : {
pageConfig : pageConfig,
cb : args.cb,
div : cfgTemplate.div,
pageRequest : pageRequest
}
});
} | javascript | function (args) {
if (!this._pageConfigHelper) {
this.$callback(args.cb);
return;
}
var pageConfig = args.pageConfig, cfg = pageConfig.pageComposition, pageId = pageConfig.pageId;
this.$raiseEvent({
name : "beforePageTransition",
from : this.currentPageId,
to : pageId
});
this.currentPageId = pageId;
this._pageConfigs[pageId] = pageConfig;
var pageRequest = args.pageRequest;
pageRequest.url = pageConfig.url;
pageRequest.pageId = pageConfig.pageId;
pageRequest.title = pageConfig.title;
var json = ariaUtilsJson;
json.setValue(this._data, "pageData", cfg.pageData);
json.setValue(this._data, "pageInfo", pageRequest);
var cfgTemplate = {
classpath : cfg.template,
div : this._getContainer(!pageConfig.animation),
moduleCtrl : this._rootModule
};
this._modulesInPage = [];
// if the div does not change, let's dispose the previous template first
if (cfgTemplate.div == this._getContainer() && this._isTemplateLoaded) {
Aria.disposeTemplate(this._getContainer());
}
Aria.loadTemplate(cfgTemplate, {
fn : this._afterTemplateLoaded,
scope : this,
args : {
pageConfig : pageConfig,
cb : args.cb,
div : cfgTemplate.div,
pageRequest : pageRequest
}
});
} | [
"function",
"(",
"args",
")",
"{",
"if",
"(",
"!",
"this",
".",
"_pageConfigHelper",
")",
"{",
"this",
".",
"$callback",
"(",
"args",
".",
"cb",
")",
";",
"return",
";",
"}",
"var",
"pageConfig",
"=",
"args",
".",
"pageConfig",
",",
"cfg",
"=",
"pageConfig",
".",
"pageComposition",
",",
"pageId",
"=",
"pageConfig",
".",
"pageId",
";",
"this",
".",
"$raiseEvent",
"(",
"{",
"name",
":",
"\"beforePageTransition\"",
",",
"from",
":",
"this",
".",
"currentPageId",
",",
"to",
":",
"pageId",
"}",
")",
";",
"this",
".",
"currentPageId",
"=",
"pageId",
";",
"this",
".",
"_pageConfigs",
"[",
"pageId",
"]",
"=",
"pageConfig",
";",
"var",
"pageRequest",
"=",
"args",
".",
"pageRequest",
";",
"pageRequest",
".",
"url",
"=",
"pageConfig",
".",
"url",
";",
"pageRequest",
".",
"pageId",
"=",
"pageConfig",
".",
"pageId",
";",
"pageRequest",
".",
"title",
"=",
"pageConfig",
".",
"title",
";",
"var",
"json",
"=",
"ariaUtilsJson",
";",
"json",
".",
"setValue",
"(",
"this",
".",
"_data",
",",
"\"pageData\"",
",",
"cfg",
".",
"pageData",
")",
";",
"json",
".",
"setValue",
"(",
"this",
".",
"_data",
",",
"\"pageInfo\"",
",",
"pageRequest",
")",
";",
"var",
"cfgTemplate",
"=",
"{",
"classpath",
":",
"cfg",
".",
"template",
",",
"div",
":",
"this",
".",
"_getContainer",
"(",
"!",
"pageConfig",
".",
"animation",
")",
",",
"moduleCtrl",
":",
"this",
".",
"_rootModule",
"}",
";",
"this",
".",
"_modulesInPage",
"=",
"[",
"]",
";",
"// if the div does not change, let's dispose the previous template first",
"if",
"(",
"cfgTemplate",
".",
"div",
"==",
"this",
".",
"_getContainer",
"(",
")",
"&&",
"this",
".",
"_isTemplateLoaded",
")",
"{",
"Aria",
".",
"disposeTemplate",
"(",
"this",
".",
"_getContainer",
"(",
")",
")",
";",
"}",
"Aria",
".",
"loadTemplate",
"(",
"cfgTemplate",
",",
"{",
"fn",
":",
"this",
".",
"_afterTemplateLoaded",
",",
"scope",
":",
"this",
",",
"args",
":",
"{",
"pageConfig",
":",
"pageConfig",
",",
"cb",
":",
"args",
".",
"cb",
",",
"div",
":",
"cfgTemplate",
".",
"div",
",",
"pageRequest",
":",
"pageRequest",
"}",
"}",
")",
";",
"}"
] | Load the page page template in the DOM
@param {Object} args Contains the pageId and the callback
@protected | [
"Load",
"the",
"page",
"page",
"template",
"in",
"the",
"DOM"
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/pageEngine/PageEngine.js#L574-L617 | |
27,968 | ariatemplates/ariatemplates | src/aria/pageEngine/PageEngine.js | function (success, args) {
if (this._navigationManager) {
this._navigationManager.update(args.pageRequest);
}
var browser = ariaCoreBrowser;
if (browser.isOldIE && browser.majorVersion < 8) {
ariaCoreTimer.addCallback({
fn : function () {
args.div.style.zoom = 0;
args.div.style.zoom = 1;
args.div = null;
},
scope : this,
delay : 0
});
}
this._isTemplateLoaded = true;
if (this._animationsManager && args.pageConfig.animation) {
this._animationsManager.$on({
"animationend" : {
fn : this._pageTransitionComplete,
args : args
},
scope : this
});
this._animationsManager.startPageTransition(this._getContainer(false), this._getContainer(), args.pageConfig.animation);
} else {
this._finishDisplay(args);
}
} | javascript | function (success, args) {
if (this._navigationManager) {
this._navigationManager.update(args.pageRequest);
}
var browser = ariaCoreBrowser;
if (browser.isOldIE && browser.majorVersion < 8) {
ariaCoreTimer.addCallback({
fn : function () {
args.div.style.zoom = 0;
args.div.style.zoom = 1;
args.div = null;
},
scope : this,
delay : 0
});
}
this._isTemplateLoaded = true;
if (this._animationsManager && args.pageConfig.animation) {
this._animationsManager.$on({
"animationend" : {
fn : this._pageTransitionComplete,
args : args
},
scope : this
});
this._animationsManager.startPageTransition(this._getContainer(false), this._getContainer(), args.pageConfig.animation);
} else {
this._finishDisplay(args);
}
} | [
"function",
"(",
"success",
",",
"args",
")",
"{",
"if",
"(",
"this",
".",
"_navigationManager",
")",
"{",
"this",
".",
"_navigationManager",
".",
"update",
"(",
"args",
".",
"pageRequest",
")",
";",
"}",
"var",
"browser",
"=",
"ariaCoreBrowser",
";",
"if",
"(",
"browser",
".",
"isOldIE",
"&&",
"browser",
".",
"majorVersion",
"<",
"8",
")",
"{",
"ariaCoreTimer",
".",
"addCallback",
"(",
"{",
"fn",
":",
"function",
"(",
")",
"{",
"args",
".",
"div",
".",
"style",
".",
"zoom",
"=",
"0",
";",
"args",
".",
"div",
".",
"style",
".",
"zoom",
"=",
"1",
";",
"args",
".",
"div",
"=",
"null",
";",
"}",
",",
"scope",
":",
"this",
",",
"delay",
":",
"0",
"}",
")",
";",
"}",
"this",
".",
"_isTemplateLoaded",
"=",
"true",
";",
"if",
"(",
"this",
".",
"_animationsManager",
"&&",
"args",
".",
"pageConfig",
".",
"animation",
")",
"{",
"this",
".",
"_animationsManager",
".",
"$on",
"(",
"{",
"\"animationend\"",
":",
"{",
"fn",
":",
"this",
".",
"_pageTransitionComplete",
",",
"args",
":",
"args",
"}",
",",
"scope",
":",
"this",
"}",
")",
";",
"this",
".",
"_animationsManager",
".",
"startPageTransition",
"(",
"this",
".",
"_getContainer",
"(",
"false",
")",
",",
"this",
".",
"_getContainer",
"(",
")",
",",
"args",
".",
"pageConfig",
".",
"animation",
")",
";",
"}",
"else",
"{",
"this",
".",
"_finishDisplay",
"(",
"args",
")",
";",
"}",
"}"
] | Callback called after template is loaded inside the DOM
@param {Object} success Status about the loadTemplate action
@param {Object} args Contains params about the page
@protected | [
"Callback",
"called",
"after",
"template",
"is",
"loaded",
"inside",
"the",
"DOM"
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/pageEngine/PageEngine.js#L625-L657 | |
27,969 | ariatemplates/ariatemplates | src/aria/pageEngine/PageEngine.js | function (args, params) {
this._animationsManager.$removeListeners({
"animationend" : this._pageTransitionComplete,
scope : this
});
this._activeDiv = (this._activeDiv + 1) % 2;
Aria.disposeTemplate(this._getContainer(false));
this._finishDisplay(params);
} | javascript | function (args, params) {
this._animationsManager.$removeListeners({
"animationend" : this._pageTransitionComplete,
scope : this
});
this._activeDiv = (this._activeDiv + 1) % 2;
Aria.disposeTemplate(this._getContainer(false));
this._finishDisplay(params);
} | [
"function",
"(",
"args",
",",
"params",
")",
"{",
"this",
".",
"_animationsManager",
".",
"$removeListeners",
"(",
"{",
"\"animationend\"",
":",
"this",
".",
"_pageTransitionComplete",
",",
"scope",
":",
"this",
"}",
")",
";",
"this",
".",
"_activeDiv",
"=",
"(",
"this",
".",
"_activeDiv",
"+",
"1",
")",
"%",
"2",
";",
"Aria",
".",
"disposeTemplate",
"(",
"this",
".",
"_getContainer",
"(",
"false",
")",
")",
";",
"this",
".",
"_finishDisplay",
"(",
"params",
")",
";",
"}"
] | Callback called after page transition is completed
@param {Object} args Contains params about the page
@param {Object} params Contains params about the page
@protected | [
"Callback",
"called",
"after",
"page",
"transition",
"is",
"completed"
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/pageEngine/PageEngine.js#L665-L673 | |
27,970 | ariatemplates/ariatemplates | src/aria/pageEngine/PageEngine.js | function (params) {
ariaUtilsCSSLoader.remove(this._previousPageCSS);
this.$raiseEvent({
name : "pageReady",
pageId : params.pageConfig.pageId
});
if (params.cb) {
this.$callback(params.cb);
}
this._loadPageDependencies({
lazy : true,
pageId : params.pageConfig.pageId,
cb : {
fn : this._afterLazyDependenciesLoad,
scope : this
}
});
} | javascript | function (params) {
ariaUtilsCSSLoader.remove(this._previousPageCSS);
this.$raiseEvent({
name : "pageReady",
pageId : params.pageConfig.pageId
});
if (params.cb) {
this.$callback(params.cb);
}
this._loadPageDependencies({
lazy : true,
pageId : params.pageConfig.pageId,
cb : {
fn : this._afterLazyDependenciesLoad,
scope : this
}
});
} | [
"function",
"(",
"params",
")",
"{",
"ariaUtilsCSSLoader",
".",
"remove",
"(",
"this",
".",
"_previousPageCSS",
")",
";",
"this",
".",
"$raiseEvent",
"(",
"{",
"name",
":",
"\"pageReady\"",
",",
"pageId",
":",
"params",
".",
"pageConfig",
".",
"pageId",
"}",
")",
";",
"if",
"(",
"params",
".",
"cb",
")",
"{",
"this",
".",
"$callback",
"(",
"params",
".",
"cb",
")",
";",
"}",
"this",
".",
"_loadPageDependencies",
"(",
"{",
"lazy",
":",
"true",
",",
"pageId",
":",
"params",
".",
"pageConfig",
".",
"pageId",
",",
"cb",
":",
"{",
"fn",
":",
"this",
".",
"_afterLazyDependenciesLoad",
",",
"scope",
":",
"this",
"}",
"}",
")",
";",
"}"
] | Raise the page ready event and starts the load of the dependencies
@param {Object} params Contains params about the page
@protected | [
"Raise",
"the",
"page",
"ready",
"event",
"and",
"starts",
"the",
"load",
"of",
"the",
"dependencies"
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/pageEngine/PageEngine.js#L680-L697 | |
27,971 | ariatemplates/ariatemplates | src/aria/pageEngine/PageEngine.js | function (active) {
if (!this._animationsManager) {
return this._firstDiv;
}
active = !(active === false);
if (active) {
return this._activeDiv === 0 ? this._firstDiv : this._secondDiv;
} else {
return this._activeDiv === 1 ? this._firstDiv : this._secondDiv;
}
} | javascript | function (active) {
if (!this._animationsManager) {
return this._firstDiv;
}
active = !(active === false);
if (active) {
return this._activeDiv === 0 ? this._firstDiv : this._secondDiv;
} else {
return this._activeDiv === 1 ? this._firstDiv : this._secondDiv;
}
} | [
"function",
"(",
"active",
")",
"{",
"if",
"(",
"!",
"this",
".",
"_animationsManager",
")",
"{",
"return",
"this",
".",
"_firstDiv",
";",
"}",
"active",
"=",
"!",
"(",
"active",
"===",
"false",
")",
";",
"if",
"(",
"active",
")",
"{",
"return",
"this",
".",
"_activeDiv",
"===",
"0",
"?",
"this",
".",
"_firstDiv",
":",
"this",
".",
"_secondDiv",
";",
"}",
"else",
"{",
"return",
"this",
".",
"_activeDiv",
"===",
"1",
"?",
"this",
".",
"_firstDiv",
":",
"this",
".",
"_secondDiv",
";",
"}",
"}"
] | Return the element in which the page is shown right now or the other one, according to the argument
@param {Boolean} active Whether the active HEMLElement should be returned, namely the element in which the
page is loaded. It defaults to true
@return {HTMLElement} Container of a page
@protected | [
"Return",
"the",
"element",
"in",
"which",
"the",
"page",
"is",
"shown",
"right",
"now",
"or",
"the",
"other",
"one",
"according",
"to",
"the",
"argument"
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/pageEngine/PageEngine.js#L706-L716 | |
27,972 | ariatemplates/ariatemplates | src/aria/pageEngine/PageEngine.js | function () {
if (!this._pageConfigHelper) {
return;
}
var lazyPlaceholders = this._pageConfigHelper.getLazyPlaceholdersIds();
this._lazyContent = false;
this.$raiseEvent({
name : "contentChange",
contentPaths : lazyPlaceholders
});
this._pageConfigHelper.$dispose();
} | javascript | function () {
if (!this._pageConfigHelper) {
return;
}
var lazyPlaceholders = this._pageConfigHelper.getLazyPlaceholdersIds();
this._lazyContent = false;
this.$raiseEvent({
name : "contentChange",
contentPaths : lazyPlaceholders
});
this._pageConfigHelper.$dispose();
} | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"_pageConfigHelper",
")",
"{",
"return",
";",
"}",
"var",
"lazyPlaceholders",
"=",
"this",
".",
"_pageConfigHelper",
".",
"getLazyPlaceholdersIds",
"(",
")",
";",
"this",
".",
"_lazyContent",
"=",
"false",
";",
"this",
".",
"$raiseEvent",
"(",
"{",
"name",
":",
"\"contentChange\"",
",",
"contentPaths",
":",
"lazyPlaceholders",
"}",
")",
";",
"this",
".",
"_pageConfigHelper",
".",
"$dispose",
"(",
")",
";",
"}"
] | Trigger a content change in order to notify placeholder widgets
@protected | [
"Trigger",
"a",
"content",
"change",
"in",
"order",
"to",
"notify",
"placeholder",
"widgets"
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/pageEngine/PageEngine.js#L722-L734 | |
27,973 | ariatemplates/ariatemplates | src/aria/pageEngine/PageEngine.js | function (placeholderPath) {
var outputContent;
var typeUtil = ariaUtilsType;
var pageConfig = this._pageConfigs[this.currentPageId];
if (pageConfig) {
var placeholders = pageConfig.pageComposition.placeholders;
var content = placeholders[placeholderPath] || [];
outputContent = [];
var plainContent;
if (!typeUtil.isArray(content)) {
content = [content];
}
for (var i = 0, ii = content.length; i < ii; i++) {
var item = content[i];
if (typeUtil.isObject(item)) {
if (this._lazyContent && item.lazy) {
outputContent.push({
loading : true,
width : item.lazy.width || null,
height : item.lazy.height || null,
color : item.lazy.color || null,
innerHTML : item.lazy.innerHTML || null
});
} else {
if (item.template) {
outputContent.push(this._getTemplateCfg(item, pageConfig));
} else if (item.contentId) {
plainContent = this._getPlaceholderContents(pageConfig, item.contentId);
outputContent = outputContent.concat(plainContent);
}
}
} else {
outputContent.push(item);
}
}
}
return outputContent;
} | javascript | function (placeholderPath) {
var outputContent;
var typeUtil = ariaUtilsType;
var pageConfig = this._pageConfigs[this.currentPageId];
if (pageConfig) {
var placeholders = pageConfig.pageComposition.placeholders;
var content = placeholders[placeholderPath] || [];
outputContent = [];
var plainContent;
if (!typeUtil.isArray(content)) {
content = [content];
}
for (var i = 0, ii = content.length; i < ii; i++) {
var item = content[i];
if (typeUtil.isObject(item)) {
if (this._lazyContent && item.lazy) {
outputContent.push({
loading : true,
width : item.lazy.width || null,
height : item.lazy.height || null,
color : item.lazy.color || null,
innerHTML : item.lazy.innerHTML || null
});
} else {
if (item.template) {
outputContent.push(this._getTemplateCfg(item, pageConfig));
} else if (item.contentId) {
plainContent = this._getPlaceholderContents(pageConfig, item.contentId);
outputContent = outputContent.concat(plainContent);
}
}
} else {
outputContent.push(item);
}
}
}
return outputContent;
} | [
"function",
"(",
"placeholderPath",
")",
"{",
"var",
"outputContent",
";",
"var",
"typeUtil",
"=",
"ariaUtilsType",
";",
"var",
"pageConfig",
"=",
"this",
".",
"_pageConfigs",
"[",
"this",
".",
"currentPageId",
"]",
";",
"if",
"(",
"pageConfig",
")",
"{",
"var",
"placeholders",
"=",
"pageConfig",
".",
"pageComposition",
".",
"placeholders",
";",
"var",
"content",
"=",
"placeholders",
"[",
"placeholderPath",
"]",
"||",
"[",
"]",
";",
"outputContent",
"=",
"[",
"]",
";",
"var",
"plainContent",
";",
"if",
"(",
"!",
"typeUtil",
".",
"isArray",
"(",
"content",
")",
")",
"{",
"content",
"=",
"[",
"content",
"]",
";",
"}",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"ii",
"=",
"content",
".",
"length",
";",
"i",
"<",
"ii",
";",
"i",
"++",
")",
"{",
"var",
"item",
"=",
"content",
"[",
"i",
"]",
";",
"if",
"(",
"typeUtil",
".",
"isObject",
"(",
"item",
")",
")",
"{",
"if",
"(",
"this",
".",
"_lazyContent",
"&&",
"item",
".",
"lazy",
")",
"{",
"outputContent",
".",
"push",
"(",
"{",
"loading",
":",
"true",
",",
"width",
":",
"item",
".",
"lazy",
".",
"width",
"||",
"null",
",",
"height",
":",
"item",
".",
"lazy",
".",
"height",
"||",
"null",
",",
"color",
":",
"item",
".",
"lazy",
".",
"color",
"||",
"null",
",",
"innerHTML",
":",
"item",
".",
"lazy",
".",
"innerHTML",
"||",
"null",
"}",
")",
";",
"}",
"else",
"{",
"if",
"(",
"item",
".",
"template",
")",
"{",
"outputContent",
".",
"push",
"(",
"this",
".",
"_getTemplateCfg",
"(",
"item",
",",
"pageConfig",
")",
")",
";",
"}",
"else",
"if",
"(",
"item",
".",
"contentId",
")",
"{",
"plainContent",
"=",
"this",
".",
"_getPlaceholderContents",
"(",
"pageConfig",
",",
"item",
".",
"contentId",
")",
";",
"outputContent",
"=",
"outputContent",
".",
"concat",
"(",
"plainContent",
")",
";",
"}",
"}",
"}",
"else",
"{",
"outputContent",
".",
"push",
"(",
"item",
")",
";",
"}",
"}",
"}",
"return",
"outputContent",
";",
"}"
] | Main content provider method
@param {String} placeholderPath path of the placeholder
@return {Array} List of content descriptions accepted by placeholders | [
"Main",
"content",
"provider",
"method"
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/pageEngine/PageEngine.js#L741-L779 | |
27,974 | ariatemplates/ariatemplates | src/aria/pageEngine/PageEngine.js | function (item, pageConfig) {
var templateCfg = {
classpath : item.template
};
var args = item.args || [];
var extraArg = {};
if (item.contentId) {
extraArg.contents = this._getPlaceholderContents(pageConfig, item.contentId);
}
args.push(extraArg);
templateCfg.args = args;
if (item.module) {
var module = this._rootModule.getPageModule(this.currentPageId, item.module);
templateCfg.moduleCtrl = module;
this._modulesInPage.push(module);
}
if (item.data) {
templateCfg.data = item.data;
}
return templateCfg;
} | javascript | function (item, pageConfig) {
var templateCfg = {
classpath : item.template
};
var args = item.args || [];
var extraArg = {};
if (item.contentId) {
extraArg.contents = this._getPlaceholderContents(pageConfig, item.contentId);
}
args.push(extraArg);
templateCfg.args = args;
if (item.module) {
var module = this._rootModule.getPageModule(this.currentPageId, item.module);
templateCfg.moduleCtrl = module;
this._modulesInPage.push(module);
}
if (item.data) {
templateCfg.data = item.data;
}
return templateCfg;
} | [
"function",
"(",
"item",
",",
"pageConfig",
")",
"{",
"var",
"templateCfg",
"=",
"{",
"classpath",
":",
"item",
".",
"template",
"}",
";",
"var",
"args",
"=",
"item",
".",
"args",
"||",
"[",
"]",
";",
"var",
"extraArg",
"=",
"{",
"}",
";",
"if",
"(",
"item",
".",
"contentId",
")",
"{",
"extraArg",
".",
"contents",
"=",
"this",
".",
"_getPlaceholderContents",
"(",
"pageConfig",
",",
"item",
".",
"contentId",
")",
";",
"}",
"args",
".",
"push",
"(",
"extraArg",
")",
";",
"templateCfg",
".",
"args",
"=",
"args",
";",
"if",
"(",
"item",
".",
"module",
")",
"{",
"var",
"module",
"=",
"this",
".",
"_rootModule",
".",
"getPageModule",
"(",
"this",
".",
"currentPageId",
",",
"item",
".",
"module",
")",
";",
"templateCfg",
".",
"moduleCtrl",
"=",
"module",
";",
"this",
".",
"_modulesInPage",
".",
"push",
"(",
"module",
")",
";",
"}",
"if",
"(",
"item",
".",
"data",
")",
"{",
"templateCfg",
".",
"data",
"=",
"item",
".",
"data",
";",
"}",
"return",
"templateCfg",
";",
"}"
] | Extract the template configuration to be given to the Placeholder widget
@param {aria.pageEngine.CfgBeans:Placeholder} item
@param {aria.pageEngine.CfgBeans:PageDefinition} pageConfig
@return {aria.html.beans.TemplateCfg:Properties}
@protected | [
"Extract",
"the",
"template",
"configuration",
"to",
"be",
"given",
"to",
"the",
"Placeholder",
"widget"
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/pageEngine/PageEngine.js#L788-L809 | |
27,975 | ariatemplates/ariatemplates | src/aria/pageEngine/PageEngine.js | function (pageConfig, contentId) {
var outputContent = [];
var content = pageConfig.contents.placeholderContents
? pageConfig.contents.placeholderContents[contentId]
: null;
if (!content) {
return outputContent;
}
if (!ariaUtilsType.isArray(content)) {
content = [content];
}
for (var i = 0, length = content.length; i < length; i++) {
outputContent = outputContent.concat(this.processContent(content[i]));
}
return outputContent;
} | javascript | function (pageConfig, contentId) {
var outputContent = [];
var content = pageConfig.contents.placeholderContents
? pageConfig.contents.placeholderContents[contentId]
: null;
if (!content) {
return outputContent;
}
if (!ariaUtilsType.isArray(content)) {
content = [content];
}
for (var i = 0, length = content.length; i < length; i++) {
outputContent = outputContent.concat(this.processContent(content[i]));
}
return outputContent;
} | [
"function",
"(",
"pageConfig",
",",
"contentId",
")",
"{",
"var",
"outputContent",
"=",
"[",
"]",
";",
"var",
"content",
"=",
"pageConfig",
".",
"contents",
".",
"placeholderContents",
"?",
"pageConfig",
".",
"contents",
".",
"placeholderContents",
"[",
"contentId",
"]",
":",
"null",
";",
"if",
"(",
"!",
"content",
")",
"{",
"return",
"outputContent",
";",
"}",
"if",
"(",
"!",
"ariaUtilsType",
".",
"isArray",
"(",
"content",
")",
")",
"{",
"content",
"=",
"[",
"content",
"]",
";",
"}",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"length",
"=",
"content",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"outputContent",
"=",
"outputContent",
".",
"concat",
"(",
"this",
".",
"processContent",
"(",
"content",
"[",
"i",
"]",
")",
")",
";",
"}",
"return",
"outputContent",
";",
"}"
] | Retrieve the contents corresponding to a certain contentId from the page definition
@param {aria.pageEngine.CfgBeans:PageDefinition} pageConfig
@param {String} contentId
@return {Array} Array of strings corresponding to processed content
@protected | [
"Retrieve",
"the",
"contents",
"corresponding",
"to",
"a",
"certain",
"contentId",
"from",
"the",
"page",
"definition"
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/pageEngine/PageEngine.js#L818-L833 | |
27,976 | ariatemplates/ariatemplates | src/aria/pageEngine/PageEngine.js | function (content) {
var contentType = content.contentType;
if (contentType && contentType in this.contentProcessors) {
return this.processContent(this.contentProcessors[contentType].processContent(content));
}
return content.value || "";
} | javascript | function (content) {
var contentType = content.contentType;
if (contentType && contentType in this.contentProcessors) {
return this.processContent(this.contentProcessors[contentType].processContent(content));
}
return content.value || "";
} | [
"function",
"(",
"content",
")",
"{",
"var",
"contentType",
"=",
"content",
".",
"contentType",
";",
"if",
"(",
"contentType",
"&&",
"contentType",
"in",
"this",
".",
"contentProcessors",
")",
"{",
"return",
"this",
".",
"processContent",
"(",
"this",
".",
"contentProcessors",
"[",
"contentType",
"]",
".",
"processContent",
"(",
"content",
")",
")",
";",
"}",
"return",
"content",
".",
"value",
"||",
"\"\"",
";",
"}"
] | Process according to the content type
@param {aria.pageEngine.CfgBeans:Content} content
@return {String} processed content | [
"Process",
"according",
"to",
"the",
"content",
"type"
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/pageEngine/PageEngine.js#L840-L847 | |
27,977 | ariatemplates/ariatemplates | src/aria/pageEngine/PageEngine.js | function (msg) {
var config = this._config;
this.$logError.apply(this, msg);
if (config.onerror) {
this.$callback(config.onerror, msg);
}
} | javascript | function (msg) {
var config = this._config;
this.$logError.apply(this, msg);
if (config.onerror) {
this.$callback(config.onerror, msg);
}
} | [
"function",
"(",
"msg",
")",
"{",
"var",
"config",
"=",
"this",
".",
"_config",
";",
"this",
".",
"$logError",
".",
"apply",
"(",
"this",
",",
"msg",
")",
";",
"if",
"(",
"config",
".",
"onerror",
")",
"{",
"this",
".",
"$callback",
"(",
"config",
".",
"onerror",
",",
"msg",
")",
";",
"}",
"}"
] | Logs an error and calls the onerror callback if specified in the configuration
@param {Array} msg Parameters to pass to the $logError method or to the error method provided in the
configuration
@protected | [
"Logs",
"an",
"error",
"and",
"calls",
"the",
"onerror",
"callback",
"if",
"specified",
"in",
"the",
"configuration"
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/pageEngine/PageEngine.js#L855-L861 | |
27,978 | ariatemplates/ariatemplates | src/aria/pageEngine/PageEngine.js | function (event) {
var pageId = event.pageId;
if (this.currentPageId == pageId) {
this._rootModule.unloadPageModules(pageId);
this.navigate({
pageId : pageId,
url : this._navigationManager ? this._navigationManager.getUrl() : null,
forceReload : true
});
}
} | javascript | function (event) {
var pageId = event.pageId;
if (this.currentPageId == pageId) {
this._rootModule.unloadPageModules(pageId);
this.navigate({
pageId : pageId,
url : this._navigationManager ? this._navigationManager.getUrl() : null,
forceReload : true
});
}
} | [
"function",
"(",
"event",
")",
"{",
"var",
"pageId",
"=",
"event",
".",
"pageId",
";",
"if",
"(",
"this",
".",
"currentPageId",
"==",
"pageId",
")",
"{",
"this",
".",
"_rootModule",
".",
"unloadPageModules",
"(",
"pageId",
")",
";",
"this",
".",
"navigate",
"(",
"{",
"pageId",
":",
"pageId",
",",
"url",
":",
"this",
".",
"_navigationManager",
"?",
"this",
".",
"_navigationManager",
".",
"getUrl",
"(",
")",
":",
"null",
",",
"forceReload",
":",
"true",
"}",
")",
";",
"}",
"}"
] | Actual method called after a pageChange event is raised by the page provider
@param {Object} event
@protected | [
"Actual",
"method",
"called",
"after",
"a",
"pageChange",
"event",
"is",
"raised",
"by",
"the",
"page",
"provider"
] | 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/pageEngine/PageEngine.js#L882-L892 | |
27,979 | throneless-tech/libsignal-service-javascript | examples/LocalSignalProtocolStore.js | function() {
var groupId = getString(libsignal.crypto.getRandomBytes(16));
return this.getGroup(groupId).then(function(group) {
if (group === undefined) {
return groupId;
} else {
console.warn("group id collision"); // probably a bad sign.
return this.generateNewGroupId();
}
});
} | javascript | function() {
var groupId = getString(libsignal.crypto.getRandomBytes(16));
return this.getGroup(groupId).then(function(group) {
if (group === undefined) {
return groupId;
} else {
console.warn("group id collision"); // probably a bad sign.
return this.generateNewGroupId();
}
});
} | [
"function",
"(",
")",
"{",
"var",
"groupId",
"=",
"getString",
"(",
"libsignal",
".",
"crypto",
".",
"getRandomBytes",
"(",
"16",
")",
")",
";",
"return",
"this",
".",
"getGroup",
"(",
"groupId",
")",
".",
"then",
"(",
"function",
"(",
"group",
")",
"{",
"if",
"(",
"group",
"===",
"undefined",
")",
"{",
"return",
"groupId",
";",
"}",
"else",
"{",
"console",
".",
"warn",
"(",
"\"group id collision\"",
")",
";",
"// probably a bad sign.",
"return",
"this",
".",
"generateNewGroupId",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | create a random group id that we haven't seen before. | [
"create",
"a",
"random",
"group",
"id",
"that",
"we",
"haven",
"t",
"seen",
"before",
"."
] | 50cf3f681b6c98290ef8c38431e93436c83bfe56 | https://github.com/throneless-tech/libsignal-service-javascript/blob/50cf3f681b6c98290ef8c38431e93436c83bfe56/examples/LocalSignalProtocolStore.js#L136-L146 | |
27,980 | throneless-tech/libsignal-service-javascript | examples/LocalSignalProtocolStore.js | function() {
var collection = [];
for (let id of this.store._keys) {
if (id.startsWith("unprocessed")) {
collection.push(this.get(id));
}
}
return Promise.resolve(collection);
} | javascript | function() {
var collection = [];
for (let id of this.store._keys) {
if (id.startsWith("unprocessed")) {
collection.push(this.get(id));
}
}
return Promise.resolve(collection);
} | [
"function",
"(",
")",
"{",
"var",
"collection",
"=",
"[",
"]",
";",
"for",
"(",
"let",
"id",
"of",
"this",
".",
"store",
".",
"_keys",
")",
"{",
"if",
"(",
"id",
".",
"startsWith",
"(",
"\"unprocessed\"",
")",
")",
"{",
"collection",
".",
"push",
"(",
"this",
".",
"get",
"(",
"id",
")",
")",
";",
"}",
"}",
"return",
"Promise",
".",
"resolve",
"(",
"collection",
")",
";",
"}"
] | Not yet processed messages - for resiliency | [
"Not",
"yet",
"processed",
"messages",
"-",
"for",
"resiliency"
] | 50cf3f681b6c98290ef8c38431e93436c83bfe56 | https://github.com/throneless-tech/libsignal-service-javascript/blob/50cf3f681b6c98290ef8c38431e93436c83bfe56/examples/LocalSignalProtocolStore.js#L440-L448 | |
27,981 | anthonynichols/node-include | include.js | findProjectRoot | function findProjectRoot(currentPath) {
var result = undefined;
try {
var packageStats = lstatSync(path.join(currentPath, 'package.json'));
if (packageStats.isFile()) {
result = currentPath;
}
} catch (error) {
if (currentPath !== path.resolve('/')) {
result = findProjectRoot(path.join(currentPath, '..'));
}
}
return result;
} | javascript | function findProjectRoot(currentPath) {
var result = undefined;
try {
var packageStats = lstatSync(path.join(currentPath, 'package.json'));
if (packageStats.isFile()) {
result = currentPath;
}
} catch (error) {
if (currentPath !== path.resolve('/')) {
result = findProjectRoot(path.join(currentPath, '..'));
}
}
return result;
} | [
"function",
"findProjectRoot",
"(",
"currentPath",
")",
"{",
"var",
"result",
"=",
"undefined",
";",
"try",
"{",
"var",
"packageStats",
"=",
"lstatSync",
"(",
"path",
".",
"join",
"(",
"currentPath",
",",
"'package.json'",
")",
")",
";",
"if",
"(",
"packageStats",
".",
"isFile",
"(",
")",
")",
"{",
"result",
"=",
"currentPath",
";",
"}",
"}",
"catch",
"(",
"error",
")",
"{",
"if",
"(",
"currentPath",
"!==",
"path",
".",
"resolve",
"(",
"'/'",
")",
")",
"{",
"result",
"=",
"findProjectRoot",
"(",
"path",
".",
"join",
"(",
"currentPath",
",",
"'..'",
")",
")",
";",
"}",
"}",
"return",
"result",
";",
"}"
] | Attempts to find the project root by finding the nearest package.json file.
@private
@param {String} currentPath - Path of the file doing the including.
@return {String?} | [
"Attempts",
"to",
"find",
"the",
"project",
"root",
"by",
"finding",
"the",
"nearest",
"package",
".",
"json",
"file",
"."
] | d17bbe7f196f26c863ee6aca44e431c3d5168635 | https://github.com/anthonynichols/node-include/blob/d17bbe7f196f26c863ee6aca44e431c3d5168635/include.js#L13-L29 |
27,982 | material-foundation/material-remixer-js | examples/src/demo-app.js | loadTemplate | function loadTemplate() {
generateData();
return new Promise(function(resolve, reject) {
// Load handlebars page template.
$.get('src/demo-template.html', function(response) {
template = response;
render();
resolve();
}).fail(function() {
reject();
});
});
} | javascript | function loadTemplate() {
generateData();
return new Promise(function(resolve, reject) {
// Load handlebars page template.
$.get('src/demo-template.html', function(response) {
template = response;
render();
resolve();
}).fail(function() {
reject();
});
});
} | [
"function",
"loadTemplate",
"(",
")",
"{",
"generateData",
"(",
")",
";",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"// Load handlebars page template.",
"$",
".",
"get",
"(",
"'src/demo-template.html'",
",",
"function",
"(",
"response",
")",
"{",
"template",
"=",
"response",
";",
"render",
"(",
")",
";",
"resolve",
"(",
")",
";",
"}",
")",
".",
"fail",
"(",
"function",
"(",
")",
"{",
"reject",
"(",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}"
] | Loads the demo template.
@return {Promise} Returns promise for loading template as successful/failure. | [
"Loads",
"the",
"demo",
"template",
"."
] | 9ecd2cda79f68a307ac57f17e66b46f080afa3d0 | https://github.com/material-foundation/material-remixer-js/blob/9ecd2cda79f68a307ac57f17e66b46f080afa3d0/examples/src/demo-app.js#L27-L41 |
27,983 | material-foundation/material-remixer-js | examples/src/demo-app.js | generateData | function generateData() {
var totalTransactions = 20;
var totalAmount = 0;
var transactions = [];
// Generate transactions
for (var i = 0; i < totalTransactions; i++) {
// Transactions
var transaction = faker.helpers.createTransaction();
transaction.date = getDate();
totalAmount += parseFloat(transaction.amount);
// Other transactions
transaction.other = [];
for (var j = 0; j < totalTransactions; j++) {
other = faker.helpers.createTransaction();
other.date = getDate();
transaction.other.push(other);
}
transactions.push(transaction);
}
dataView.transactions = transactions.sort(compare);
dataView.selectedTransaction = transactions[0];
dataView.totalAmount = toCurrency(totalAmount);
} | javascript | function generateData() {
var totalTransactions = 20;
var totalAmount = 0;
var transactions = [];
// Generate transactions
for (var i = 0; i < totalTransactions; i++) {
// Transactions
var transaction = faker.helpers.createTransaction();
transaction.date = getDate();
totalAmount += parseFloat(transaction.amount);
// Other transactions
transaction.other = [];
for (var j = 0; j < totalTransactions; j++) {
other = faker.helpers.createTransaction();
other.date = getDate();
transaction.other.push(other);
}
transactions.push(transaction);
}
dataView.transactions = transactions.sort(compare);
dataView.selectedTransaction = transactions[0];
dataView.totalAmount = toCurrency(totalAmount);
} | [
"function",
"generateData",
"(",
")",
"{",
"var",
"totalTransactions",
"=",
"20",
";",
"var",
"totalAmount",
"=",
"0",
";",
"var",
"transactions",
"=",
"[",
"]",
";",
"// Generate transactions",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"totalTransactions",
";",
"i",
"++",
")",
"{",
"// Transactions",
"var",
"transaction",
"=",
"faker",
".",
"helpers",
".",
"createTransaction",
"(",
")",
";",
"transaction",
".",
"date",
"=",
"getDate",
"(",
")",
";",
"totalAmount",
"+=",
"parseFloat",
"(",
"transaction",
".",
"amount",
")",
";",
"// Other transactions",
"transaction",
".",
"other",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"j",
"=",
"0",
";",
"j",
"<",
"totalTransactions",
";",
"j",
"++",
")",
"{",
"other",
"=",
"faker",
".",
"helpers",
".",
"createTransaction",
"(",
")",
";",
"other",
".",
"date",
"=",
"getDate",
"(",
")",
";",
"transaction",
".",
"other",
".",
"push",
"(",
"other",
")",
";",
"}",
"transactions",
".",
"push",
"(",
"transaction",
")",
";",
"}",
"dataView",
".",
"transactions",
"=",
"transactions",
".",
"sort",
"(",
"compare",
")",
";",
"dataView",
".",
"selectedTransaction",
"=",
"transactions",
"[",
"0",
"]",
";",
"dataView",
".",
"totalAmount",
"=",
"toCurrency",
"(",
"totalAmount",
")",
";",
"}"
] | Generates fake data using faker.js script. | [
"Generates",
"fake",
"data",
"using",
"faker",
".",
"js",
"script",
"."
] | 9ecd2cda79f68a307ac57f17e66b46f080afa3d0 | https://github.com/material-foundation/material-remixer-js/blob/9ecd2cda79f68a307ac57f17e66b46f080afa3d0/examples/src/demo-app.js#L44-L70 |
27,984 | material-foundation/material-remixer-js | examples/src/demo-app.js | compare | function compare(a, b) {
var date1 = new Date(a.date);
var date2 = new Date(b.date);
if (date1 < date2) {
return -1;
}
if (date1 > date2) {
return 1;
}
return 0;
} | javascript | function compare(a, b) {
var date1 = new Date(a.date);
var date2 = new Date(b.date);
if (date1 < date2) {
return -1;
}
if (date1 > date2) {
return 1;
}
return 0;
} | [
"function",
"compare",
"(",
"a",
",",
"b",
")",
"{",
"var",
"date1",
"=",
"new",
"Date",
"(",
"a",
".",
"date",
")",
";",
"var",
"date2",
"=",
"new",
"Date",
"(",
"b",
".",
"date",
")",
";",
"if",
"(",
"date1",
"<",
"date2",
")",
"{",
"return",
"-",
"1",
";",
"}",
"if",
"(",
"date1",
">",
"date2",
")",
"{",
"return",
"1",
";",
"}",
"return",
"0",
";",
"}"
] | Sorts by date. | [
"Sorts",
"by",
"date",
"."
] | 9ecd2cda79f68a307ac57f17e66b46f080afa3d0 | https://github.com/material-foundation/material-remixer-js/blob/9ecd2cda79f68a307ac57f17e66b46f080afa3d0/examples/src/demo-app.js#L73-L83 |
27,985 | material-foundation/material-remixer-js | examples/src/demo-app.js | addClickHandler | function addClickHandler() {
$('.transaction-list-item').click(function() {
var index = $('.transaction-list-item').index(this);
dataView.selectedTransaction = dataView.transactions[index];
render();
});
} | javascript | function addClickHandler() {
$('.transaction-list-item').click(function() {
var index = $('.transaction-list-item').index(this);
dataView.selectedTransaction = dataView.transactions[index];
render();
});
} | [
"function",
"addClickHandler",
"(",
")",
"{",
"$",
"(",
"'.transaction-list-item'",
")",
".",
"click",
"(",
"function",
"(",
")",
"{",
"var",
"index",
"=",
"$",
"(",
"'.transaction-list-item'",
")",
".",
"index",
"(",
"this",
")",
";",
"dataView",
".",
"selectedTransaction",
"=",
"dataView",
".",
"transactions",
"[",
"index",
"]",
";",
"render",
"(",
")",
";",
"}",
")",
";",
"}"
] | Adds a click listener for transaction list items. | [
"Adds",
"a",
"click",
"listener",
"for",
"transaction",
"list",
"items",
"."
] | 9ecd2cda79f68a307ac57f17e66b46f080afa3d0 | https://github.com/material-foundation/material-remixer-js/blob/9ecd2cda79f68a307ac57f17e66b46f080afa3d0/examples/src/demo-app.js#L136-L142 |
27,986 | ciena-frost/ember-frost-bunsen | addon/components/array-container.js | clearSubObject | function clearSubObject (object, path, pathIndex) {
const key = path[pathIndex]
if (path.length < pathIndex + 2) {
delete object[key]
return true
}
const subObj = object[key]
const didClear = clearSubObject(subObj, path, pathIndex + 1)
if (didClear && keys(subObj).length <= 0) {
delete object[key]
return true
}
return false
} | javascript | function clearSubObject (object, path, pathIndex) {
const key = path[pathIndex]
if (path.length < pathIndex + 2) {
delete object[key]
return true
}
const subObj = object[key]
const didClear = clearSubObject(subObj, path, pathIndex + 1)
if (didClear && keys(subObj).length <= 0) {
delete object[key]
return true
}
return false
} | [
"function",
"clearSubObject",
"(",
"object",
",",
"path",
",",
"pathIndex",
")",
"{",
"const",
"key",
"=",
"path",
"[",
"pathIndex",
"]",
"if",
"(",
"path",
".",
"length",
"<",
"pathIndex",
"+",
"2",
")",
"{",
"delete",
"object",
"[",
"key",
"]",
"return",
"true",
"}",
"const",
"subObj",
"=",
"object",
"[",
"key",
"]",
"const",
"didClear",
"=",
"clearSubObject",
"(",
"subObj",
",",
"path",
",",
"pathIndex",
"+",
"1",
")",
"if",
"(",
"didClear",
"&&",
"keys",
"(",
"subObj",
")",
".",
"length",
"<=",
"0",
")",
"{",
"delete",
"object",
"[",
"key",
"]",
"return",
"true",
"}",
"return",
"false",
"}"
] | Recursively clears empty objects based on a path
@param {Object} object Hash containing object
@param {String[]} path Array of path segments to the desired value to clear
@param {Number} pathIndex Index of the path segment to use as a key
@returns {Boolean} True if a key was deleted from the passed in object | [
"Recursively",
"clears",
"empty",
"objects",
"based",
"on",
"a",
"path"
] | 0a4d323484e49aca86404204e4139a64d43829ad | https://github.com/ciena-frost/ember-frost-bunsen/blob/0a4d323484e49aca86404204e4139a64d43829ad/addon/components/array-container.js#L34-L47 |
27,987 | ciena-frost/ember-frost-bunsen | addon/utils.js | removeChildInternals | function removeChildInternals (withoutInternal) {
return _.chain(withoutInternal)
.map((item, key) => {
const withoutInternal = removeInternalValues(item)
if (withoutInternal !== undefined && withoutInternal !== item) {
return [key, withoutInternal]
}
})
.filter()
.fromPairs()
.value()
} | javascript | function removeChildInternals (withoutInternal) {
return _.chain(withoutInternal)
.map((item, key) => {
const withoutInternal = removeInternalValues(item)
if (withoutInternal !== undefined && withoutInternal !== item) {
return [key, withoutInternal]
}
})
.filter()
.fromPairs()
.value()
} | [
"function",
"removeChildInternals",
"(",
"withoutInternal",
")",
"{",
"return",
"_",
".",
"chain",
"(",
"withoutInternal",
")",
".",
"map",
"(",
"(",
"item",
",",
"key",
")",
"=>",
"{",
"const",
"withoutInternal",
"=",
"removeInternalValues",
"(",
"item",
")",
"if",
"(",
"withoutInternal",
"!==",
"undefined",
"&&",
"withoutInternal",
"!==",
"item",
")",
"{",
"return",
"[",
"key",
",",
"withoutInternal",
"]",
"}",
"}",
")",
".",
"filter",
"(",
")",
".",
"fromPairs",
"(",
")",
".",
"value",
"(",
")",
"}"
] | Removes nested _internal keys from an object
@param {Object} withoutInternal Object to remove nested _internal keys from
@returns {Object} Copy of the object with no _internal keys | [
"Removes",
"nested",
"_internal",
"keys",
"from",
"an",
"object"
] | 0a4d323484e49aca86404204e4139a64d43829ad | https://github.com/ciena-frost/ember-frost-bunsen/blob/0a4d323484e49aca86404204e4139a64d43829ad/addon/utils.js#L431-L442 |
27,988 | ciena-frost/ember-frost-bunsen | addon/utils.js | maybeMerge | function maybeMerge (first, second) {
if (Object.keys(second).length > 0) {
return Object.assign({}, first, second) // don't mutate the object
}
return first
} | javascript | function maybeMerge (first, second) {
if (Object.keys(second).length > 0) {
return Object.assign({}, first, second) // don't mutate the object
}
return first
} | [
"function",
"maybeMerge",
"(",
"first",
",",
"second",
")",
"{",
"if",
"(",
"Object",
".",
"keys",
"(",
"second",
")",
".",
"length",
">",
"0",
")",
"{",
"return",
"Object",
".",
"assign",
"(",
"{",
"}",
",",
"first",
",",
"second",
")",
"// don't mutate the object",
"}",
"return",
"first",
"}"
] | Merges properties from an object into another if the second object has enumerable properties
@param {Object} first Object
@param {Object} second Object with properties to merge into the first
@returns {Object} The merged object if the second object has enumerable properties or the first
object otherwise | [
"Merges",
"properties",
"from",
"an",
"object",
"into",
"another",
"if",
"the",
"second",
"object",
"has",
"enumerable",
"properties"
] | 0a4d323484e49aca86404204e4139a64d43829ad | https://github.com/ciena-frost/ember-frost-bunsen/blob/0a4d323484e49aca86404204e4139a64d43829ad/addon/utils.js#L452-L457 |
27,989 | winjs/react-winjs | react-winjs.js | typeToPropType | function typeToPropType(typeInfo) {
if (typeInfo.type === "string") {
return React.PropTypes.string;
} else if (typeInfo.type === "boolean") {
return React.PropTypes.bool;
} else if (typeInfo.type === "number") {
return React.PropTypes.number;
} else if (typeInfo.type === "enum") {
return React.PropTypes.oneOf(typeInfo.values);
} else if (typeInfo.type === "any") {
return React.PropTypes.any;
} else if (typeInfo.type === "reference") {
if (typeInfo.name === "Function") {
return React.PropTypes.func;
} else if (typeInfo.name === "Array") {
var itemPropType = typeToPropType(typeInfo.typeArguments[0]);
return itemPropType ? React.PropTypes.arrayOf(itemPropType) : React.PropTypes.array;
} else if (getIn(window, typeInfo.name)) {
var instance = getIn(window, typeInfo.name);
return React.PropTypes.instanceOf(instance);
}
} else {
console.warn("react-winjs typeToPropType: unable to find propType for type: " + JSON.stringify(typeInfo, null, 2));
}
} | javascript | function typeToPropType(typeInfo) {
if (typeInfo.type === "string") {
return React.PropTypes.string;
} else if (typeInfo.type === "boolean") {
return React.PropTypes.bool;
} else if (typeInfo.type === "number") {
return React.PropTypes.number;
} else if (typeInfo.type === "enum") {
return React.PropTypes.oneOf(typeInfo.values);
} else if (typeInfo.type === "any") {
return React.PropTypes.any;
} else if (typeInfo.type === "reference") {
if (typeInfo.name === "Function") {
return React.PropTypes.func;
} else if (typeInfo.name === "Array") {
var itemPropType = typeToPropType(typeInfo.typeArguments[0]);
return itemPropType ? React.PropTypes.arrayOf(itemPropType) : React.PropTypes.array;
} else if (getIn(window, typeInfo.name)) {
var instance = getIn(window, typeInfo.name);
return React.PropTypes.instanceOf(instance);
}
} else {
console.warn("react-winjs typeToPropType: unable to find propType for type: " + JSON.stringify(typeInfo, null, 2));
}
} | [
"function",
"typeToPropType",
"(",
"typeInfo",
")",
"{",
"if",
"(",
"typeInfo",
".",
"type",
"===",
"\"string\"",
")",
"{",
"return",
"React",
".",
"PropTypes",
".",
"string",
";",
"}",
"else",
"if",
"(",
"typeInfo",
".",
"type",
"===",
"\"boolean\"",
")",
"{",
"return",
"React",
".",
"PropTypes",
".",
"bool",
";",
"}",
"else",
"if",
"(",
"typeInfo",
".",
"type",
"===",
"\"number\"",
")",
"{",
"return",
"React",
".",
"PropTypes",
".",
"number",
";",
"}",
"else",
"if",
"(",
"typeInfo",
".",
"type",
"===",
"\"enum\"",
")",
"{",
"return",
"React",
".",
"PropTypes",
".",
"oneOf",
"(",
"typeInfo",
".",
"values",
")",
";",
"}",
"else",
"if",
"(",
"typeInfo",
".",
"type",
"===",
"\"any\"",
")",
"{",
"return",
"React",
".",
"PropTypes",
".",
"any",
";",
"}",
"else",
"if",
"(",
"typeInfo",
".",
"type",
"===",
"\"reference\"",
")",
"{",
"if",
"(",
"typeInfo",
".",
"name",
"===",
"\"Function\"",
")",
"{",
"return",
"React",
".",
"PropTypes",
".",
"func",
";",
"}",
"else",
"if",
"(",
"typeInfo",
".",
"name",
"===",
"\"Array\"",
")",
"{",
"var",
"itemPropType",
"=",
"typeToPropType",
"(",
"typeInfo",
".",
"typeArguments",
"[",
"0",
"]",
")",
";",
"return",
"itemPropType",
"?",
"React",
".",
"PropTypes",
".",
"arrayOf",
"(",
"itemPropType",
")",
":",
"React",
".",
"PropTypes",
".",
"array",
";",
"}",
"else",
"if",
"(",
"getIn",
"(",
"window",
",",
"typeInfo",
".",
"name",
")",
")",
"{",
"var",
"instance",
"=",
"getIn",
"(",
"window",
",",
"typeInfo",
".",
"name",
")",
";",
"return",
"React",
".",
"PropTypes",
".",
"instanceOf",
"(",
"instance",
")",
";",
"}",
"}",
"else",
"{",
"console",
".",
"warn",
"(",
"\"react-winjs typeToPropType: unable to find propType for type: \"",
"+",
"JSON",
".",
"stringify",
"(",
"typeInfo",
",",
"null",
",",
"2",
")",
")",
";",
"}",
"}"
] | Given a type from RawControlApis returns a React propType. | [
"Given",
"a",
"type",
"from",
"RawControlApis",
"returns",
"a",
"React",
"propType",
"."
] | 1a117744f24cbeb1729f38debde43550e34affeb | https://github.com/winjs/react-winjs/blob/1a117744f24cbeb1729f38debde43550e34affeb/react-winjs.js#L1725-L1749 |
27,990 | winjs/react-winjs | react-winjs.js | function (propType) {
return {
propType: propType,
preCtorInit: function property_preCtorInit(element, options, data, displayName, propName, value) {
options[propName] = value;
},
update: function property_update(winjsComponent, propName, oldValue, newValue) {
if (oldValue !== newValue) {
winjsComponent.winControl[propName] = newValue;
}
}
};
} | javascript | function (propType) {
return {
propType: propType,
preCtorInit: function property_preCtorInit(element, options, data, displayName, propName, value) {
options[propName] = value;
},
update: function property_update(winjsComponent, propName, oldValue, newValue) {
if (oldValue !== newValue) {
winjsComponent.winControl[propName] = newValue;
}
}
};
} | [
"function",
"(",
"propType",
")",
"{",
"return",
"{",
"propType",
":",
"propType",
",",
"preCtorInit",
":",
"function",
"property_preCtorInit",
"(",
"element",
",",
"options",
",",
"data",
",",
"displayName",
",",
"propName",
",",
"value",
")",
"{",
"options",
"[",
"propName",
"]",
"=",
"value",
";",
"}",
",",
"update",
":",
"function",
"property_update",
"(",
"winjsComponent",
",",
"propName",
",",
"oldValue",
",",
"newValue",
")",
"{",
"if",
"(",
"oldValue",
"!==",
"newValue",
")",
"{",
"winjsComponent",
".",
"winControl",
"[",
"propName",
"]",
"=",
"newValue",
";",
"}",
"}",
"}",
";",
"}"
] | Maps to a property on the winControl. | [
"Maps",
"to",
"a",
"property",
"on",
"the",
"winControl",
"."
] | 1a117744f24cbeb1729f38debde43550e34affeb | https://github.com/winjs/react-winjs/blob/1a117744f24cbeb1729f38debde43550e34affeb/react-winjs.js#L1938-L1950 | |
27,991 | winjs/react-winjs | react-winjs.js | function (propType) {
return {
propType: propType,
preCtorInit: function focusProperty_preCtorInit(element, options, data, displayName, propName, value) {
options[propName] = value;
},
update: function focusProperty_update(winjsComponent, propName, oldValue, newValue) {
if (oldValue !== newValue) {
var asyncToken = winjsComponent.data[propName];
asyncToken && clearImmediate(asyncToken);
asyncToken = setImmediate(function () {
winjsComponent.data[propName] = null;
winjsComponent.winControl[propName] = newValue;
});
}
},
dispose: function focusProperty_dispose(winjsComponent, propName) {
var asyncToken = winjsComponent.data[propName];
asyncToken && clearImmediate(asyncToken);
}
};
} | javascript | function (propType) {
return {
propType: propType,
preCtorInit: function focusProperty_preCtorInit(element, options, data, displayName, propName, value) {
options[propName] = value;
},
update: function focusProperty_update(winjsComponent, propName, oldValue, newValue) {
if (oldValue !== newValue) {
var asyncToken = winjsComponent.data[propName];
asyncToken && clearImmediate(asyncToken);
asyncToken = setImmediate(function () {
winjsComponent.data[propName] = null;
winjsComponent.winControl[propName] = newValue;
});
}
},
dispose: function focusProperty_dispose(winjsComponent, propName) {
var asyncToken = winjsComponent.data[propName];
asyncToken && clearImmediate(asyncToken);
}
};
} | [
"function",
"(",
"propType",
")",
"{",
"return",
"{",
"propType",
":",
"propType",
",",
"preCtorInit",
":",
"function",
"focusProperty_preCtorInit",
"(",
"element",
",",
"options",
",",
"data",
",",
"displayName",
",",
"propName",
",",
"value",
")",
"{",
"options",
"[",
"propName",
"]",
"=",
"value",
";",
"}",
",",
"update",
":",
"function",
"focusProperty_update",
"(",
"winjsComponent",
",",
"propName",
",",
"oldValue",
",",
"newValue",
")",
"{",
"if",
"(",
"oldValue",
"!==",
"newValue",
")",
"{",
"var",
"asyncToken",
"=",
"winjsComponent",
".",
"data",
"[",
"propName",
"]",
";",
"asyncToken",
"&&",
"clearImmediate",
"(",
"asyncToken",
")",
";",
"asyncToken",
"=",
"setImmediate",
"(",
"function",
"(",
")",
"{",
"winjsComponent",
".",
"data",
"[",
"propName",
"]",
"=",
"null",
";",
"winjsComponent",
".",
"winControl",
"[",
"propName",
"]",
"=",
"newValue",
";",
"}",
")",
";",
"}",
"}",
",",
"dispose",
":",
"function",
"focusProperty_dispose",
"(",
"winjsComponent",
",",
"propName",
")",
"{",
"var",
"asyncToken",
"=",
"winjsComponent",
".",
"data",
"[",
"propName",
"]",
";",
"asyncToken",
"&&",
"clearImmediate",
"(",
"asyncToken",
")",
";",
"}",
"}",
";",
"}"
] | Maps to a property on the winControl which involves setting focus. Such properties are set outside of componentWillReceiveProps to prevent React from undoing the focus move. | [
"Maps",
"to",
"a",
"property",
"on",
"the",
"winControl",
"which",
"involves",
"setting",
"focus",
".",
"Such",
"properties",
"are",
"set",
"outside",
"of",
"componentWillReceiveProps",
"to",
"prevent",
"React",
"from",
"undoing",
"the",
"focus",
"move",
"."
] | 1a117744f24cbeb1729f38debde43550e34affeb | https://github.com/winjs/react-winjs/blob/1a117744f24cbeb1729f38debde43550e34affeb/react-winjs.js#L1955-L1976 | |
27,992 | winjs/react-winjs | react-winjs.js | function (propType) {
return {
propType: propType,
preCtorInit: function domProperty_preCtorInit(element, options, data, displayName, propName, value) {
element[propName] = value;
},
update: function domProperty_update(winjsComponent, propName, oldValue, newValue) {
if (oldValue !== newValue) {
winjsComponent.element[propName] = newValue;
}
}
};
} | javascript | function (propType) {
return {
propType: propType,
preCtorInit: function domProperty_preCtorInit(element, options, data, displayName, propName, value) {
element[propName] = value;
},
update: function domProperty_update(winjsComponent, propName, oldValue, newValue) {
if (oldValue !== newValue) {
winjsComponent.element[propName] = newValue;
}
}
};
} | [
"function",
"(",
"propType",
")",
"{",
"return",
"{",
"propType",
":",
"propType",
",",
"preCtorInit",
":",
"function",
"domProperty_preCtorInit",
"(",
"element",
",",
"options",
",",
"data",
",",
"displayName",
",",
"propName",
",",
"value",
")",
"{",
"element",
"[",
"propName",
"]",
"=",
"value",
";",
"}",
",",
"update",
":",
"function",
"domProperty_update",
"(",
"winjsComponent",
",",
"propName",
",",
"oldValue",
",",
"newValue",
")",
"{",
"if",
"(",
"oldValue",
"!==",
"newValue",
")",
"{",
"winjsComponent",
".",
"element",
"[",
"propName",
"]",
"=",
"newValue",
";",
"}",
"}",
"}",
";",
"}"
] | Maps to a property on the winControl's element. | [
"Maps",
"to",
"a",
"property",
"on",
"the",
"winControl",
"s",
"element",
"."
] | 1a117744f24cbeb1729f38debde43550e34affeb | https://github.com/winjs/react-winjs/blob/1a117744f24cbeb1729f38debde43550e34affeb/react-winjs.js#L1979-L1991 | |
27,993 | winjs/react-winjs | react-winjs.js | function (propType) {
return {
propType: propType,
update: function domAttribute_update(winjsComponent, propName, oldValue, newValue) {
if (oldValue !== newValue) {
if (newValue !== null && newValue !== undefined) {
winjsComponent.element.setAttribute(propName, "" + newValue);
} else {
winjsComponent.element.removeAttribute(propName);
}
}
}
};
} | javascript | function (propType) {
return {
propType: propType,
update: function domAttribute_update(winjsComponent, propName, oldValue, newValue) {
if (oldValue !== newValue) {
if (newValue !== null && newValue !== undefined) {
winjsComponent.element.setAttribute(propName, "" + newValue);
} else {
winjsComponent.element.removeAttribute(propName);
}
}
}
};
} | [
"function",
"(",
"propType",
")",
"{",
"return",
"{",
"propType",
":",
"propType",
",",
"update",
":",
"function",
"domAttribute_update",
"(",
"winjsComponent",
",",
"propName",
",",
"oldValue",
",",
"newValue",
")",
"{",
"if",
"(",
"oldValue",
"!==",
"newValue",
")",
"{",
"if",
"(",
"newValue",
"!==",
"null",
"&&",
"newValue",
"!==",
"undefined",
")",
"{",
"winjsComponent",
".",
"element",
".",
"setAttribute",
"(",
"propName",
",",
"\"\"",
"+",
"newValue",
")",
";",
"}",
"else",
"{",
"winjsComponent",
".",
"element",
".",
"removeAttribute",
"(",
"propName",
")",
";",
"}",
"}",
"}",
"}",
";",
"}"
] | Maps to an attribute on the winControl's element. | [
"Maps",
"to",
"an",
"attribute",
"on",
"the",
"winControl",
"s",
"element",
"."
] | 1a117744f24cbeb1729f38debde43550e34affeb | https://github.com/winjs/react-winjs/blob/1a117744f24cbeb1729f38debde43550e34affeb/react-winjs.js#L1994-L2007 | |
27,994 | winjs/react-winjs | react-winjs.js | event_update | function event_update(winjsComponent, propName, oldValue, newValue) {
if (oldValue !== newValue) {
winjsComponent.winControl[propName.toLowerCase()] = newValue;
}
} | javascript | function event_update(winjsComponent, propName, oldValue, newValue) {
if (oldValue !== newValue) {
winjsComponent.winControl[propName.toLowerCase()] = newValue;
}
} | [
"function",
"event_update",
"(",
"winjsComponent",
",",
"propName",
",",
"oldValue",
",",
"newValue",
")",
"{",
"if",
"(",
"oldValue",
"!==",
"newValue",
")",
"{",
"winjsComponent",
".",
"winControl",
"[",
"propName",
".",
"toLowerCase",
"(",
")",
"]",
"=",
"newValue",
";",
"}",
"}"
] | Can't set options in preCtorInit for events. The problem is WinJS control options use a different code path to hook up events than the event property setters. Consequently, setting an event property will not automatically unhook the event listener that was specified in the options during initialization. To avoid this problem, always go thru the event property setters. | [
"Can",
"t",
"set",
"options",
"in",
"preCtorInit",
"for",
"events",
".",
"The",
"problem",
"is",
"WinJS",
"control",
"options",
"use",
"a",
"different",
"code",
"path",
"to",
"hook",
"up",
"events",
"than",
"the",
"event",
"property",
"setters",
".",
"Consequently",
"setting",
"an",
"event",
"property",
"will",
"not",
"automatically",
"unhook",
"the",
"event",
"listener",
"that",
"was",
"specified",
"in",
"the",
"options",
"during",
"initialization",
".",
"To",
"avoid",
"this",
"problem",
"always",
"go",
"thru",
"the",
"event",
"property",
"setters",
"."
] | 1a117744f24cbeb1729f38debde43550e34affeb | https://github.com/winjs/react-winjs/blob/1a117744f24cbeb1729f38debde43550e34affeb/react-winjs.js#L2017-L2021 |
27,995 | winjs/react-winjs | react-winjs.js | PropHandlers_warn | function PropHandlers_warn(warnMessage) {
return {
// Don't need preCtorInit because this prop handler doesn't have any side
// effects on the WinJS control. update also runs during initialization so
// update is just as good as preCtorInit for our use case.
update: function warn_update(winjsComponent, propName, oldValue, newValue) {
console.warn(winjsComponent.displayName + ": " + warnMessage);
}
};
} | javascript | function PropHandlers_warn(warnMessage) {
return {
// Don't need preCtorInit because this prop handler doesn't have any side
// effects on the WinJS control. update also runs during initialization so
// update is just as good as preCtorInit for our use case.
update: function warn_update(winjsComponent, propName, oldValue, newValue) {
console.warn(winjsComponent.displayName + ": " + warnMessage);
}
};
} | [
"function",
"PropHandlers_warn",
"(",
"warnMessage",
")",
"{",
"return",
"{",
"// Don't need preCtorInit because this prop handler doesn't have any side",
"// effects on the WinJS control. update also runs during initialization so",
"// update is just as good as preCtorInit for our use case.",
"update",
":",
"function",
"warn_update",
"(",
"winjsComponent",
",",
"propName",
",",
"oldValue",
",",
"newValue",
")",
"{",
"console",
".",
"warn",
"(",
"winjsComponent",
".",
"displayName",
"+",
"\": \"",
"+",
"warnMessage",
")",
";",
"}",
"}",
";",
"}"
] | Emits a warning to the console whenever prop gets used. | [
"Emits",
"a",
"warning",
"to",
"the",
"console",
"whenever",
"prop",
"gets",
"used",
"."
] | 1a117744f24cbeb1729f38debde43550e34affeb | https://github.com/winjs/react-winjs/blob/1a117744f24cbeb1729f38debde43550e34affeb/react-winjs.js#L2101-L2110 |
27,996 | winjs/react-winjs | react-winjs.js | PropHandlers_mountTo | function PropHandlers_mountTo(getMountPoint) {
return {
propType: React.PropTypes.element,
// Can't use preCtorInit because the mount point may not exist until the
// constructor has run.
update: function mountTo_update(winjsComponent, propName, oldValue, newValue) {
var data = winjsComponent.data[propName] || {};
var version = (data.version || 0) + 1;
winjsComponent.data[propName] = {
// *mountComponent* may run asynchronously and we may queue it multiple
// times before it runs. *version* allows us to ensure only the latest
// version runs and the others are no ops.
version: version,
// *element* is the element to which we last mounted the component.
element: data.element
};
var mountComponent = function () {
if (version === winjsComponent.data[propName].version) {
var oldElement = winjsComponent.data[propName].element;
if (newValue) {
var newElement = getMountPoint(winjsComponent);
if (oldElement && oldElement !== newElement) {
ReactDOM.unmountComponentAtNode(oldElement);
}
ReactDOM.render(newValue, newElement);
winjsComponent.data[propName].element = newElement;
} else if (oldValue) {
oldElement && ReactDOM.unmountComponentAtNode(oldElement);
winjsComponent.data[propName].element = null;
}
}
};
// *isDeclarativeControlContainer* is a hook some WinJS controls provide
// (e.g. HubSection, PivotItem) to ensure that processing runs on the
// control only when the control is ready for it. This enables lazy loading
// of HubSections/PivotItems (e.g. load off screen items asynchronously in
// batches). Additionally, doing processing thru this hook guarantees that
// the processing won't run until the control is in the DOM.
var winControl = winjsComponent.winControl;
var queueProcessing = winControl.constructor.isDeclarativeControlContainer;
if (queueProcessing && typeof queueProcessing === "function") {
queueProcessing(winControl, mountComponent);
} else {
mountComponent();
}
},
dispose: function mountTo_dispose(winjsComponent, propName) {
var data = winjsComponent.data[propName] || {};
var element = data.element;
element && ReactDOM.unmountComponentAtNode(element);
}
};
} | javascript | function PropHandlers_mountTo(getMountPoint) {
return {
propType: React.PropTypes.element,
// Can't use preCtorInit because the mount point may not exist until the
// constructor has run.
update: function mountTo_update(winjsComponent, propName, oldValue, newValue) {
var data = winjsComponent.data[propName] || {};
var version = (data.version || 0) + 1;
winjsComponent.data[propName] = {
// *mountComponent* may run asynchronously and we may queue it multiple
// times before it runs. *version* allows us to ensure only the latest
// version runs and the others are no ops.
version: version,
// *element* is the element to which we last mounted the component.
element: data.element
};
var mountComponent = function () {
if (version === winjsComponent.data[propName].version) {
var oldElement = winjsComponent.data[propName].element;
if (newValue) {
var newElement = getMountPoint(winjsComponent);
if (oldElement && oldElement !== newElement) {
ReactDOM.unmountComponentAtNode(oldElement);
}
ReactDOM.render(newValue, newElement);
winjsComponent.data[propName].element = newElement;
} else if (oldValue) {
oldElement && ReactDOM.unmountComponentAtNode(oldElement);
winjsComponent.data[propName].element = null;
}
}
};
// *isDeclarativeControlContainer* is a hook some WinJS controls provide
// (e.g. HubSection, PivotItem) to ensure that processing runs on the
// control only when the control is ready for it. This enables lazy loading
// of HubSections/PivotItems (e.g. load off screen items asynchronously in
// batches). Additionally, doing processing thru this hook guarantees that
// the processing won't run until the control is in the DOM.
var winControl = winjsComponent.winControl;
var queueProcessing = winControl.constructor.isDeclarativeControlContainer;
if (queueProcessing && typeof queueProcessing === "function") {
queueProcessing(winControl, mountComponent);
} else {
mountComponent();
}
},
dispose: function mountTo_dispose(winjsComponent, propName) {
var data = winjsComponent.data[propName] || {};
var element = data.element;
element && ReactDOM.unmountComponentAtNode(element);
}
};
} | [
"function",
"PropHandlers_mountTo",
"(",
"getMountPoint",
")",
"{",
"return",
"{",
"propType",
":",
"React",
".",
"PropTypes",
".",
"element",
",",
"// Can't use preCtorInit because the mount point may not exist until the",
"// constructor has run.",
"update",
":",
"function",
"mountTo_update",
"(",
"winjsComponent",
",",
"propName",
",",
"oldValue",
",",
"newValue",
")",
"{",
"var",
"data",
"=",
"winjsComponent",
".",
"data",
"[",
"propName",
"]",
"||",
"{",
"}",
";",
"var",
"version",
"=",
"(",
"data",
".",
"version",
"||",
"0",
")",
"+",
"1",
";",
"winjsComponent",
".",
"data",
"[",
"propName",
"]",
"=",
"{",
"// *mountComponent* may run asynchronously and we may queue it multiple",
"// times before it runs. *version* allows us to ensure only the latest",
"// version runs and the others are no ops.",
"version",
":",
"version",
",",
"// *element* is the element to which we last mounted the component.",
"element",
":",
"data",
".",
"element",
"}",
";",
"var",
"mountComponent",
"=",
"function",
"(",
")",
"{",
"if",
"(",
"version",
"===",
"winjsComponent",
".",
"data",
"[",
"propName",
"]",
".",
"version",
")",
"{",
"var",
"oldElement",
"=",
"winjsComponent",
".",
"data",
"[",
"propName",
"]",
".",
"element",
";",
"if",
"(",
"newValue",
")",
"{",
"var",
"newElement",
"=",
"getMountPoint",
"(",
"winjsComponent",
")",
";",
"if",
"(",
"oldElement",
"&&",
"oldElement",
"!==",
"newElement",
")",
"{",
"ReactDOM",
".",
"unmountComponentAtNode",
"(",
"oldElement",
")",
";",
"}",
"ReactDOM",
".",
"render",
"(",
"newValue",
",",
"newElement",
")",
";",
"winjsComponent",
".",
"data",
"[",
"propName",
"]",
".",
"element",
"=",
"newElement",
";",
"}",
"else",
"if",
"(",
"oldValue",
")",
"{",
"oldElement",
"&&",
"ReactDOM",
".",
"unmountComponentAtNode",
"(",
"oldElement",
")",
";",
"winjsComponent",
".",
"data",
"[",
"propName",
"]",
".",
"element",
"=",
"null",
";",
"}",
"}",
"}",
";",
"// *isDeclarativeControlContainer* is a hook some WinJS controls provide",
"// (e.g. HubSection, PivotItem) to ensure that processing runs on the",
"// control only when the control is ready for it. This enables lazy loading",
"// of HubSections/PivotItems (e.g. load off screen items asynchronously in",
"// batches). Additionally, doing processing thru this hook guarantees that",
"// the processing won't run until the control is in the DOM.",
"var",
"winControl",
"=",
"winjsComponent",
".",
"winControl",
";",
"var",
"queueProcessing",
"=",
"winControl",
".",
"constructor",
".",
"isDeclarativeControlContainer",
";",
"if",
"(",
"queueProcessing",
"&&",
"typeof",
"queueProcessing",
"===",
"\"function\"",
")",
"{",
"queueProcessing",
"(",
"winControl",
",",
"mountComponent",
")",
";",
"}",
"else",
"{",
"mountComponent",
"(",
")",
";",
"}",
"}",
",",
"dispose",
":",
"function",
"mountTo_dispose",
"(",
"winjsComponent",
",",
"propName",
")",
"{",
"var",
"data",
"=",
"winjsComponent",
".",
"data",
"[",
"propName",
"]",
"||",
"{",
"}",
";",
"var",
"element",
"=",
"data",
".",
"element",
";",
"element",
"&&",
"ReactDOM",
".",
"unmountComponentAtNode",
"(",
"element",
")",
";",
"}",
"}",
";",
"}"
] | Mounts a React component on whatever element gets returned by getMountPoint. | [
"Mounts",
"a",
"React",
"component",
"on",
"whatever",
"element",
"gets",
"returned",
"by",
"getMountPoint",
"."
] | 1a117744f24cbeb1729f38debde43550e34affeb | https://github.com/winjs/react-winjs/blob/1a117744f24cbeb1729f38debde43550e34affeb/react-winjs.js#L2150-L2206 |
27,997 | winjs/react-winjs | react-winjs.js | mountTo_update | function mountTo_update(winjsComponent, propName, oldValue, newValue) {
var data = winjsComponent.data[propName] || {};
var version = (data.version || 0) + 1;
winjsComponent.data[propName] = {
// *mountComponent* may run asynchronously and we may queue it multiple
// times before it runs. *version* allows us to ensure only the latest
// version runs and the others are no ops.
version: version,
// *element* is the element to which we last mounted the component.
element: data.element
};
var mountComponent = function () {
if (version === winjsComponent.data[propName].version) {
var oldElement = winjsComponent.data[propName].element;
if (newValue) {
var newElement = getMountPoint(winjsComponent);
if (oldElement && oldElement !== newElement) {
ReactDOM.unmountComponentAtNode(oldElement);
}
ReactDOM.render(newValue, newElement);
winjsComponent.data[propName].element = newElement;
} else if (oldValue) {
oldElement && ReactDOM.unmountComponentAtNode(oldElement);
winjsComponent.data[propName].element = null;
}
}
};
// *isDeclarativeControlContainer* is a hook some WinJS controls provide
// (e.g. HubSection, PivotItem) to ensure that processing runs on the
// control only when the control is ready for it. This enables lazy loading
// of HubSections/PivotItems (e.g. load off screen items asynchronously in
// batches). Additionally, doing processing thru this hook guarantees that
// the processing won't run until the control is in the DOM.
var winControl = winjsComponent.winControl;
var queueProcessing = winControl.constructor.isDeclarativeControlContainer;
if (queueProcessing && typeof queueProcessing === "function") {
queueProcessing(winControl, mountComponent);
} else {
mountComponent();
}
} | javascript | function mountTo_update(winjsComponent, propName, oldValue, newValue) {
var data = winjsComponent.data[propName] || {};
var version = (data.version || 0) + 1;
winjsComponent.data[propName] = {
// *mountComponent* may run asynchronously and we may queue it multiple
// times before it runs. *version* allows us to ensure only the latest
// version runs and the others are no ops.
version: version,
// *element* is the element to which we last mounted the component.
element: data.element
};
var mountComponent = function () {
if (version === winjsComponent.data[propName].version) {
var oldElement = winjsComponent.data[propName].element;
if (newValue) {
var newElement = getMountPoint(winjsComponent);
if (oldElement && oldElement !== newElement) {
ReactDOM.unmountComponentAtNode(oldElement);
}
ReactDOM.render(newValue, newElement);
winjsComponent.data[propName].element = newElement;
} else if (oldValue) {
oldElement && ReactDOM.unmountComponentAtNode(oldElement);
winjsComponent.data[propName].element = null;
}
}
};
// *isDeclarativeControlContainer* is a hook some WinJS controls provide
// (e.g. HubSection, PivotItem) to ensure that processing runs on the
// control only when the control is ready for it. This enables lazy loading
// of HubSections/PivotItems (e.g. load off screen items asynchronously in
// batches). Additionally, doing processing thru this hook guarantees that
// the processing won't run until the control is in the DOM.
var winControl = winjsComponent.winControl;
var queueProcessing = winControl.constructor.isDeclarativeControlContainer;
if (queueProcessing && typeof queueProcessing === "function") {
queueProcessing(winControl, mountComponent);
} else {
mountComponent();
}
} | [
"function",
"mountTo_update",
"(",
"winjsComponent",
",",
"propName",
",",
"oldValue",
",",
"newValue",
")",
"{",
"var",
"data",
"=",
"winjsComponent",
".",
"data",
"[",
"propName",
"]",
"||",
"{",
"}",
";",
"var",
"version",
"=",
"(",
"data",
".",
"version",
"||",
"0",
")",
"+",
"1",
";",
"winjsComponent",
".",
"data",
"[",
"propName",
"]",
"=",
"{",
"// *mountComponent* may run asynchronously and we may queue it multiple",
"// times before it runs. *version* allows us to ensure only the latest",
"// version runs and the others are no ops.",
"version",
":",
"version",
",",
"// *element* is the element to which we last mounted the component.",
"element",
":",
"data",
".",
"element",
"}",
";",
"var",
"mountComponent",
"=",
"function",
"(",
")",
"{",
"if",
"(",
"version",
"===",
"winjsComponent",
".",
"data",
"[",
"propName",
"]",
".",
"version",
")",
"{",
"var",
"oldElement",
"=",
"winjsComponent",
".",
"data",
"[",
"propName",
"]",
".",
"element",
";",
"if",
"(",
"newValue",
")",
"{",
"var",
"newElement",
"=",
"getMountPoint",
"(",
"winjsComponent",
")",
";",
"if",
"(",
"oldElement",
"&&",
"oldElement",
"!==",
"newElement",
")",
"{",
"ReactDOM",
".",
"unmountComponentAtNode",
"(",
"oldElement",
")",
";",
"}",
"ReactDOM",
".",
"render",
"(",
"newValue",
",",
"newElement",
")",
";",
"winjsComponent",
".",
"data",
"[",
"propName",
"]",
".",
"element",
"=",
"newElement",
";",
"}",
"else",
"if",
"(",
"oldValue",
")",
"{",
"oldElement",
"&&",
"ReactDOM",
".",
"unmountComponentAtNode",
"(",
"oldElement",
")",
";",
"winjsComponent",
".",
"data",
"[",
"propName",
"]",
".",
"element",
"=",
"null",
";",
"}",
"}",
"}",
";",
"// *isDeclarativeControlContainer* is a hook some WinJS controls provide",
"// (e.g. HubSection, PivotItem) to ensure that processing runs on the",
"// control only when the control is ready for it. This enables lazy loading",
"// of HubSections/PivotItems (e.g. load off screen items asynchronously in",
"// batches). Additionally, doing processing thru this hook guarantees that",
"// the processing won't run until the control is in the DOM.",
"var",
"winControl",
"=",
"winjsComponent",
".",
"winControl",
";",
"var",
"queueProcessing",
"=",
"winControl",
".",
"constructor",
".",
"isDeclarativeControlContainer",
";",
"if",
"(",
"queueProcessing",
"&&",
"typeof",
"queueProcessing",
"===",
"\"function\"",
")",
"{",
"queueProcessing",
"(",
"winControl",
",",
"mountComponent",
")",
";",
"}",
"else",
"{",
"mountComponent",
"(",
")",
";",
"}",
"}"
] | Can't use preCtorInit because the mount point may not exist until the constructor has run. | [
"Can",
"t",
"use",
"preCtorInit",
"because",
"the",
"mount",
"point",
"may",
"not",
"exist",
"until",
"the",
"constructor",
"has",
"run",
"."
] | 1a117744f24cbeb1729f38debde43550e34affeb | https://github.com/winjs/react-winjs/blob/1a117744f24cbeb1729f38debde43550e34affeb/react-winjs.js#L2155-L2199 |
27,998 | winjs/react-winjs | react-winjs.js | PropHandlers_syncChildrenWithBindingList | function PropHandlers_syncChildrenWithBindingList(bindingListName) {
return {
preCtorInit: function syncChildrenWithBindingList_preCtorInit(element, options, data, displayName, propName, value) {
var latest = processChildren(displayName, value, {});
data[propName] = {
winjsChildComponents: latest.childComponents,
winjsChildComponentsMap: latest.childComponentsMap
};
options[bindingListName] = new WinJS.Binding.List(
latest.childComponents.map(function (winjsChildComponent) {
return winjsChildComponent.winControl;
})
);
},
update: function syncChildrenWithBindingList_update(winjsComponent, propName, oldValue, newValue) {
var data = winjsComponent.data[propName] || {};
var oldChildComponents = data.winjsChildComponents || [];
var oldChildComponentsMap = data.winjsChildComponentsMap || {};
var latest = processChildren(winjsComponent.displayName, newValue, oldChildComponentsMap);
var bindingList = winjsComponent.winControl[bindingListName];
if (bindingList) {
applyEditsToBindingList(
bindingList,
diffArraysByKey(oldChildComponents, latest.childComponents)
);
} else {
winjsComponent.winControl[bindingListName] = new WinJS.Binding.List(latest.childComponents.map(function (winjsChildComponent) {
return winjsChildComponent.winControl;
}));
}
winjsComponent.data[propName] = {
winjsChildComponents: latest.childComponents,
winjsChildComponentsMap: latest.childComponentsMap
};
},
dispose: function syncChildrenWithBindingList_dispose(winjsComponent, propName) {
var data = winjsComponent.data[propName] || {};
var childComponents = data.winjsChildComponents || [];
childComponents.forEach(function (winjsChildComponent) {
winjsChildComponent.dispose();
});
}
}
} | javascript | function PropHandlers_syncChildrenWithBindingList(bindingListName) {
return {
preCtorInit: function syncChildrenWithBindingList_preCtorInit(element, options, data, displayName, propName, value) {
var latest = processChildren(displayName, value, {});
data[propName] = {
winjsChildComponents: latest.childComponents,
winjsChildComponentsMap: latest.childComponentsMap
};
options[bindingListName] = new WinJS.Binding.List(
latest.childComponents.map(function (winjsChildComponent) {
return winjsChildComponent.winControl;
})
);
},
update: function syncChildrenWithBindingList_update(winjsComponent, propName, oldValue, newValue) {
var data = winjsComponent.data[propName] || {};
var oldChildComponents = data.winjsChildComponents || [];
var oldChildComponentsMap = data.winjsChildComponentsMap || {};
var latest = processChildren(winjsComponent.displayName, newValue, oldChildComponentsMap);
var bindingList = winjsComponent.winControl[bindingListName];
if (bindingList) {
applyEditsToBindingList(
bindingList,
diffArraysByKey(oldChildComponents, latest.childComponents)
);
} else {
winjsComponent.winControl[bindingListName] = new WinJS.Binding.List(latest.childComponents.map(function (winjsChildComponent) {
return winjsChildComponent.winControl;
}));
}
winjsComponent.data[propName] = {
winjsChildComponents: latest.childComponents,
winjsChildComponentsMap: latest.childComponentsMap
};
},
dispose: function syncChildrenWithBindingList_dispose(winjsComponent, propName) {
var data = winjsComponent.data[propName] || {};
var childComponents = data.winjsChildComponents || [];
childComponents.forEach(function (winjsChildComponent) {
winjsChildComponent.dispose();
});
}
}
} | [
"function",
"PropHandlers_syncChildrenWithBindingList",
"(",
"bindingListName",
")",
"{",
"return",
"{",
"preCtorInit",
":",
"function",
"syncChildrenWithBindingList_preCtorInit",
"(",
"element",
",",
"options",
",",
"data",
",",
"displayName",
",",
"propName",
",",
"value",
")",
"{",
"var",
"latest",
"=",
"processChildren",
"(",
"displayName",
",",
"value",
",",
"{",
"}",
")",
";",
"data",
"[",
"propName",
"]",
"=",
"{",
"winjsChildComponents",
":",
"latest",
".",
"childComponents",
",",
"winjsChildComponentsMap",
":",
"latest",
".",
"childComponentsMap",
"}",
";",
"options",
"[",
"bindingListName",
"]",
"=",
"new",
"WinJS",
".",
"Binding",
".",
"List",
"(",
"latest",
".",
"childComponents",
".",
"map",
"(",
"function",
"(",
"winjsChildComponent",
")",
"{",
"return",
"winjsChildComponent",
".",
"winControl",
";",
"}",
")",
")",
";",
"}",
",",
"update",
":",
"function",
"syncChildrenWithBindingList_update",
"(",
"winjsComponent",
",",
"propName",
",",
"oldValue",
",",
"newValue",
")",
"{",
"var",
"data",
"=",
"winjsComponent",
".",
"data",
"[",
"propName",
"]",
"||",
"{",
"}",
";",
"var",
"oldChildComponents",
"=",
"data",
".",
"winjsChildComponents",
"||",
"[",
"]",
";",
"var",
"oldChildComponentsMap",
"=",
"data",
".",
"winjsChildComponentsMap",
"||",
"{",
"}",
";",
"var",
"latest",
"=",
"processChildren",
"(",
"winjsComponent",
".",
"displayName",
",",
"newValue",
",",
"oldChildComponentsMap",
")",
";",
"var",
"bindingList",
"=",
"winjsComponent",
".",
"winControl",
"[",
"bindingListName",
"]",
";",
"if",
"(",
"bindingList",
")",
"{",
"applyEditsToBindingList",
"(",
"bindingList",
",",
"diffArraysByKey",
"(",
"oldChildComponents",
",",
"latest",
".",
"childComponents",
")",
")",
";",
"}",
"else",
"{",
"winjsComponent",
".",
"winControl",
"[",
"bindingListName",
"]",
"=",
"new",
"WinJS",
".",
"Binding",
".",
"List",
"(",
"latest",
".",
"childComponents",
".",
"map",
"(",
"function",
"(",
"winjsChildComponent",
")",
"{",
"return",
"winjsChildComponent",
".",
"winControl",
";",
"}",
")",
")",
";",
"}",
"winjsComponent",
".",
"data",
"[",
"propName",
"]",
"=",
"{",
"winjsChildComponents",
":",
"latest",
".",
"childComponents",
",",
"winjsChildComponentsMap",
":",
"latest",
".",
"childComponentsMap",
"}",
";",
"}",
",",
"dispose",
":",
"function",
"syncChildrenWithBindingList_dispose",
"(",
"winjsComponent",
",",
"propName",
")",
"{",
"var",
"data",
"=",
"winjsComponent",
".",
"data",
"[",
"propName",
"]",
"||",
"{",
"}",
";",
"var",
"childComponents",
"=",
"data",
".",
"winjsChildComponents",
"||",
"[",
"]",
";",
"childComponents",
".",
"forEach",
"(",
"function",
"(",
"winjsChildComponent",
")",
"{",
"winjsChildComponent",
".",
"dispose",
"(",
")",
";",
"}",
")",
";",
"}",
"}",
"}"
] | Uses the Binding.List's editing APIs to make it match the children prop. Does this to the Binding.List stored in the winControl's property called bindingListName. | [
"Uses",
"the",
"Binding",
".",
"List",
"s",
"editing",
"APIs",
"to",
"make",
"it",
"match",
"the",
"children",
"prop",
".",
"Does",
"this",
"to",
"the",
"Binding",
".",
"List",
"stored",
"in",
"the",
"winControl",
"s",
"property",
"called",
"bindingListName",
"."
] | 1a117744f24cbeb1729f38debde43550e34affeb | https://github.com/winjs/react-winjs/blob/1a117744f24cbeb1729f38debde43550e34affeb/react-winjs.js#L2210-L2256 |
27,999 | winjs/react-winjs | react-winjs.js | function (winjsComponent, propName, oldValue, newValue) {
// TODO: dispose
ReactDOM.render(React.DOM.div(null, newValue), winjsComponent.winControl.element);
} | javascript | function (winjsComponent, propName, oldValue, newValue) {
// TODO: dispose
ReactDOM.render(React.DOM.div(null, newValue), winjsComponent.winControl.element);
} | [
"function",
"(",
"winjsComponent",
",",
"propName",
",",
"oldValue",
",",
"newValue",
")",
"{",
"// TODO: dispose",
"ReactDOM",
".",
"render",
"(",
"React",
".",
"DOM",
".",
"div",
"(",
"null",
",",
"newValue",
")",
",",
"winjsComponent",
".",
"winControl",
".",
"element",
")",
";",
"}"
] | children propHandler looks like this rather than using mountTo on winControl.element because this enables props.children to have multiple components whereas the other technique restricts it to one. | [
"children",
"propHandler",
"looks",
"like",
"this",
"rather",
"than",
"using",
"mountTo",
"on",
"winControl",
".",
"element",
"because",
"this",
"enables",
"props",
".",
"children",
"to",
"have",
"multiple",
"components",
"whereas",
"the",
"other",
"technique",
"restricts",
"it",
"to",
"one",
"."
] | 1a117744f24cbeb1729f38debde43550e34affeb | https://github.com/winjs/react-winjs/blob/1a117744f24cbeb1729f38debde43550e34affeb/react-winjs.js#L2626-L2629 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.