_id
stringlengths 2
6
| title
stringlengths 0
58
| partition
stringclasses 3
values | text
stringlengths 52
373k
| language
stringclasses 1
value | meta_information
dict |
|---|---|---|---|---|---|
q56800
|
train
|
function () {
if (!aria.tools.ToolsBridge || !aria.tools.ToolsBridge.isOpen) {
Aria.load({
classes : ['aria.tools.ToolsBridge'],
oncomplete : function () {
aria.tools.ToolsBridge.open();
aria.tools.contextual.ContextualMenu.close();
}
});
}
}
|
javascript
|
{
"resource": ""
}
|
|
q56801
|
train
|
function (cb) {
if (!this._robot) {
this._robot = Aria.$frameworkWindow.top.SeleniumJavaRobot;
this._robot.getOffset({
fn : this._offsetReceived,
scope : this
});
}
if (cb) {
if (this._robotInitialized) {
this.$callback(cb);
} else {
this.$onOnce({
"robotInitialized" : cb
});
}
}
}
|
javascript
|
{
"resource": ""
}
|
|
q56802
|
train
|
function (evt) {
var changedProperties = evt.changedProperties;
var localCfg = this._localDefCfg;
var doUpdate = (changedProperties == null); // always do an update on reset
if (changedProperties) {
// look if the changed keys are part of this local environment
for (var i = 0, l = changedProperties.length; i < l; i++) {
var propName = changedProperties[i];
if (propName in localCfg) {
doUpdate = true;
break;
}
}
}
if (doUpdate) {
evt.asyncCalls++;
this._normAndApplyEnv(evt.callback);
}
}
|
javascript
|
{
"resource": ""
}
|
|
q56803
|
train
|
function (callback) {
var validConfig = ariaCoreJsonValidator.normalize({
json : ariaCoreAppEnvironment.applicationSettings,
beanName : this._cfgPackage
});
if (validConfig) {
this._applyEnvironment(callback);
this.$raiseEvent("environmentChanged");
} else {
this.$callback(callback);
}
}
|
javascript
|
{
"resource": ""
}
|
|
q56804
|
train
|
function () {
this.$Input._init.call(this);
var label = this.getLabel();
if (label) {
ariaUtilsEvent.addListener(label, "click", {
fn : this._onLabelClick,
scope : this
});
}
}
|
javascript
|
{
"resource": ""
}
|
|
q56805
|
train
|
function (out) {
var cfg = this._cfg;
this._frame = ariaWidgetsFramesFrameWithIcons.createFrame({
sclass : cfg.sclass,
id : this._domId,
skinnableClass : this._skinnableClass,
width : this._inputMarkupWidth,
state : this._state,
scrollBarX : false,
scrollBarY : false,
iconsAttributes : this._iconsAttributes,
iconsWaiLabel : this._iconsWaiLabel,
hideIconNames : this._hideIconNames,
inlineBlock : true,
// used for table frame, defaults to false
height : this._inputMarkupHeight,
fullWidth : this._fullWidth
});
this._frame.$on({
"*" : this._frame_events,
scope : this
});
this._frame.writeMarkupBegin(out);
this._inputWithFrameMarkup(out);
this._frame.writeMarkupEnd(out);
}
|
javascript
|
{
"resource": ""
}
|
|
q56806
|
train
|
function (reqId, connection, callback) {
// Interval for processing the response from the server
var scope = this;
connection.onreadystatechange = function () {
if (connection && connection.readyState === 4) {
connection.onreadystatechange = Aria.empty;
if (!ariaCoreIO.pendingRequests[reqId]) {
return;
}
ariaCoreIO.clearTimeout(reqId);
scope._handleTransactionResponse(reqId, connection, callback);
connection = callback = scope = null;
}
};
}
|
javascript
|
{
"resource": ""
}
|
|
q56807
|
train
|
function (reqId, connection, callback) {
var httpStatus, responseObject;
try {
var connectionStatus = connection.status;
if (connectionStatus) {
httpStatus = connectionStatus || 200;
} else if (!connectionStatus && connection.responseText) {
// Local requests done with ActiveX have undefined state
// consider it successfull if it has a response text
httpStatus = 200;
} else if (connectionStatus == 1223) {
// Sometimes IE returns 1223 instead of 204
httpStatus = 204;
} else {
httpStatus = 13030;
}
} catch (e) {
// 13030 is a custom code to indicate the condition -- in Mozilla/FF --
// when the XHR object's status and statusText properties are
// unavailable, and a query attempt throws an exception.
httpStatus = 13030;
}
var error = false;
if (httpStatus >= 200 && httpStatus < 300) {
responseObject = this._createResponse(connection);
} else {
responseObject = {
error : [httpStatus, connection.statusText].join(" "),
responseText : connection.responseText,
responseXML : connection.responseXML
};
error = true;
}
responseObject.status = httpStatus;
callback.fn.call(callback.scope, error, callback.args, responseObject);
connection = null;
responseObject = null;
}
|
javascript
|
{
"resource": ""
}
|
|
q56808
|
train
|
function (connection) {
var headerStr = connection.getAllResponseHeaders(), headers = {};
if (headerStr) {
var headerLines = headerStr.split("\n");
for (var i = 0; i < headerLines.length; i++) {
var delimitPos = headerLines[i].indexOf(":");
if (delimitPos != -1) {
// Trime headers
headers[headerLines[i].substring(0, delimitPos)] = headerLines[i].substring(delimitPos + 2).replace(/^\s+|\s+$/g, "");
}
}
}
var response = {
statusText : (connection.status == 1223) ? "No Content" : connection.statusText,
getResponseHeader : headers,
getAllResponseHeaders : headerLines,
responseText : connection.responseText,
responseXML : connection.responseXML
};
return response;
}
|
javascript
|
{
"resource": ""
}
|
|
q56809
|
train
|
function (reqId, connection) {
connection.onreadystatechange = Aria.empty;
ariaCoreIO.clearTimeout(reqId);
if (this._inProgress(connection)) {
connection.abort();
return true;
} // else the request completed but after the abort timeout (it happens in IE)
return false;
}
|
javascript
|
{
"resource": ""
}
|
|
q56810
|
train
|
function (modifierName, params) {
// IMPORTANT: neither this method, nor any modifier, should assume
// that `this === aria.templates.Modifiers` holds,
// as they're copied in aria.core.Template (so 'this' is most of the time
// an object extending aria.core.Template)
modifierName = "" + modifierName;
var modifier = __modifiers[modifierName.toLowerCase()];
if (modifier) {
// call the modifier with this, so that this.$log is available
return modifier.fn.apply(this, params);
} else {
this.$logError(aria.templates.Modifiers.UNKNOWN_MODIFIER, [modifierName]);
}
}
|
javascript
|
{
"resource": ""
}
|
|
q56811
|
train
|
function (modifierName, out) {
var modifier = __modifiers[modifierName];
if (modifier && modifier.init) {
modifier.init(out);
}
}
|
javascript
|
{
"resource": ""
}
|
|
q56812
|
train
|
function (widgetName, skinClassName, skin, std) {
// must return the normalizer for the frame state
// get the frame type
if (skin.frame == null) {
skin.frame = {};
}
var skinFrame = skin.frame;
std = std || {};
var stdFrame = std.frame || {};
var frameType;
var defaultFrameType = "Simple";
if (skin.simpleHTML) {
frameType = "SimpleHTML";
} else {
var possibleValues = [skinFrame.frameType, stdFrame.frameType, defaultFrameType /* default */];
for (var i = 0, l = possibleValues.length; i < l; i++) {
if (possibleValues[i] != null) {
frameType = possibleValues[i];
break;
}
}
}
var frameNormalizers = this._getFrameNormalizers(widgetName, skinClassName, frameType);
if (frameNormalizers == null) {
// wrong frame type, use the default instead
frameType = defaultFrameType;
frameNormalizers = this._getFrameNormalizers(widgetName, skinClassName, frameType);
}
skinFrame.frameType = frameType;
frameNormalizers.normFrameSkinClass(skin, std);
if (Aria.debug) {
var res = this._check(skinFrame, 'aria.widgets.AriaSkinBeans.' + frameType + 'FrameCfg');
if (!res.result) {
this.$logWarn(this.FRAME_NORMALIZATION_ERROR, [widgetName, skinClassName,
res.message.replace(/\n/g, "\n ")]);
}
}
return frameNormalizers.normFrameState;
}
|
javascript
|
{
"resource": ""
}
|
|
q56813
|
train
|
function (widgetName, skinClassName, stateName, stateFrame, beanName) {
var res = this._check(stateFrame, beanName);
if (!res.result) {
this.$logWarn(this.FRAME_STATE_NORMALIZATION_ERROR, [widgetName, skinClassName, stateName,
res.message.replace(/\n/g, "\n ")]);
}
}
|
javascript
|
{
"resource": ""
}
|
|
q56814
|
train
|
function (widgetName, skinClassName, frameType) {
var res = this._frameNormalizers[frameType];
if (res == null) {
var frameBeanDef = ariaCoreJsonValidator.getBean('aria.widgets.AriaSkinBeans.' + frameType
+ 'FrameCfg');
if (frameBeanDef == null) {
this.$logError(this.INVALID_FRAME_TYPE, [widgetName, skinClassName, frameType]);
return null;
}
res = {
normFrameSkinClass : this._createFrameNormalizer(frameType, frameBeanDef),
normFrameState : this._createFrameStateNormalizer(frameType, 'aria.widgets.AriaSkinBeans.'
+ frameType + 'FrameStateCfg')
};
this._frameNormalizers[frameType] = res;
}
return res;
}
|
javascript
|
{
"resource": ""
}
|
|
q56815
|
train
|
function (skinObject) {
if (skinObject['aria:skinNormalized']) {
return;
}
for (var widget in skinObject) {
if (skinObject.hasOwnProperty(widget) && widget != "general" && widget != "widgets") {
skinObject[widget] = this.normalizeWidget(widget, skinObject[widget]);
}
}
skinObject.general = this.normalizeGeneral(skinObject.general, "PageGeneralCfg");
if (skinObject.widgets) {
skinObject.widgets = this.normalizeGeneral(skinObject.widgets, "WidgetGeneralCfg");
}
skinObject['aria:skinNormalized'] = true;
return skinObject;
}
|
javascript
|
{
"resource": ""
}
|
|
q56816
|
train
|
function (widgetName, beanDef) {
if (widgetName == "Icon") {
// no inheritance, use usual normalization
return function (skinClassName, skin, std) {
beanDef.$fastNorm(skin);
};
}
var hasFrame = (beanDef.$properties.frame != null);
var writer = new ariaUtilsFunctionWriter(["skinClassName", "skin", "std"]);
ariaUtilsInheritanceNormalization.writeInheritanceNormalization({
writer : writer,
beanDef : beanDef,
varToNormalize : "skin",
parentVars : ["std"],
excludes : {
"states" : true,
"frame" : true
}
});
if (hasFrame) {
// uses a frame, let's normalize it
var frameStateNormalizerVar = writer.createTempVariable("this.normFrame(this.widgetName,skinClassName,skin,std)");
}
var states = beanDef.$properties.states;
if (states) {
states = states.$properties;
writer.writeEnsureObjectExists("skin.states");
var skinStatesVar = writer.createTempVariable("skin.states");
var stdStatesVar = writer.createTempVariable("std.states||{}");
var out = writer.out;
for (var curState in states) {
if (states.hasOwnProperty(curState) && curState != "normal") {
var dotState = writer.getDotProperty(curState);
writer.writeEnsureObjectExists(skinStatesVar + dotState);
out.push("this.normState(", skinStatesVar, dotState, ",", stdStatesVar, dotState, ",", skinStatesVar, ".normal,", stdStatesVar, ".normal);");
if (hasFrame) {
// uses a frame, let's normalize it
out.push(frameStateNormalizerVar, ".call(this,skinClassName,", writer.stringify(curState), ",", skinStatesVar, dotState, ",", stdStatesVar, dotState, ",", skinStatesVar, ".normal, ", stdStatesVar, ".normal);");
}
}
}
writer.writeEnsureObjectExists(skinStatesVar + ".normal");
out.push("this.normState(", skinStatesVar, ".normal, ", stdStatesVar, ".normal);");
if (hasFrame) {
// uses a frame, let's normalize it
out.push(frameStateNormalizerVar, '.call(this,skinClassName,"normal",', skinStatesVar, '.normal,', stdStatesVar, '.normal);');
}
}
var res = writer.createFunction();
writer.$dispose();
return res;
}
|
javascript
|
{
"resource": ""
}
|
|
q56817
|
train
|
function (widgetName, beanDef) {
var states = beanDef.$properties.states;
if (states == null) {
return null;
}
var writer = new ariaUtilsFunctionWriter(["state", "stdState", "normal", "stdNormal"]);
ariaUtilsInheritanceNormalization.writeInheritanceNormalization({
writer : writer,
beanDef : states.$properties.normal,
varToNormalize : "state",
parentVars : ["stdState", "normal", "stdNormal"],
excludes : {
"frame" : true
}
});
var res = writer.createFunction();
writer.$dispose();
return res;
}
|
javascript
|
{
"resource": ""
}
|
|
q56818
|
train
|
function (frameType, beanName) {
var beanDef = ariaCoreJsonValidator.getBean(beanName);
var writer = new ariaUtilsFunctionWriter(["skinClassName", "stateName", "state", "stdState", "normal",
"stdNormal"]);
writer.writeEnsureObjectExists("state.frame");
writer.writeEnsureObjectExists("stdState");
writer.writeEnsureObjectExists("normal");
writer.writeEnsureObjectExists("stdNormal");
ariaUtilsInheritanceNormalization.writeInheritanceNormalization({
writer : writer,
beanDef : beanDef,
varToNormalize : "state.frame",
parentVars : ["state", "stdState.frame", "stdState", "normal.frame", "normal", "stdNormal.frame",
"stdNormal"]
});
// remove properties from the direct object in case they are present
var properties = beanDef.$properties;
for (var propName in properties) {
if (properties.hasOwnProperty(propName)) {
writer.out.push("delete state", writer.getDotProperty(propName), ";");
}
}
if (Aria.debug) {
writer.out.push("this.checkFrameState(this.widgetName,skinClassName,stateName,state.frame,", writer.stringify(beanName), ");");
}
var res = writer.createFunction();
writer.$dispose();
return res;
}
|
javascript
|
{
"resource": ""
}
|
|
q56819
|
train
|
function (frameType, beanDef) {
var writer = new ariaUtilsFunctionWriter(["skin", "std"]);
var out = writer.out;
// writer.writeEnsureObjectExists("skin.frame"); // not necessary, already done by normFrame
// writer.writeEnsureObjectExists("std"); // not necessary, already done by normFrame
ariaUtilsInheritanceNormalization.writeInheritanceNormalization({
writer : writer,
beanDef : beanDef,
varToNormalize : "skin.frame",
parentVars : ["skin", "std.frame", "std"]
});
// remove properties from the direct object in case they are present
var properties = beanDef.$properties;
for (var propName in properties) {
if (properties.hasOwnProperty(propName)) {
out.push("delete skin", writer.getDotProperty(propName), ";");
}
}
var res = writer.createFunction();
writer.$dispose();
return res;
}
|
javascript
|
{
"resource": ""
}
|
|
q56820
|
train
|
function (widgetName, widgetSkinObj) {
if (!this.skinnableClasses.hasOwnProperty(widgetName)) {
this.$logError(this.INVALID_SKINNABLE_CLASS, [widgetName]);
return null;
}
if (widgetSkinObj == null) {
widgetSkinObj = {};
}
var widgetNormalizer = this._getWidgetNormalizer(widgetName);
var beanName = "aria.widgets.AriaSkinBeans." + widgetName + "Cfg";
var std = widgetSkinObj.std;
if (std == null) {
this.$logWarn(this.MISSING_STD_SKINCLASS, [widgetName]);
std = {};
widgetSkinObj.std = std;
}
var result = true;
var logs = ariaCoreLog;
var msgs = [];
var checkRes;
// Note that the order of this process is very important (std must be normalized at the end only)
for (var skinClassName in widgetSkinObj) {
if (widgetSkinObj.hasOwnProperty(skinClassName) && skinClassName != "std") {
var skinClass = widgetSkinObj[skinClassName];
widgetNormalizer.normSkinClass(skinClassName, skinClass, std);
checkRes = this._check(skinClass, beanName);
if (!checkRes.result) {
result = false;
}
if (logs && checkRes.message) {
msgs.push(logs.prepareLoggedMessage("In skin class %1:\n %2", [skinClassName,
checkRes.message.replace(/\n/g, "\n ")]));
}
}
}
widgetNormalizer.normSkinClass("std", std, {});
checkRes = this._check(std, beanName);
if (!checkRes.result) {
result = false;
}
if (logs && checkRes.message) {
msgs.push(logs.prepareLoggedMessage("In skin class %1:\n %2", ["std",
checkRes.message.replace(/\n/g, "\n ")]));
}
if (!result) {
this.$logWarn(this.WIDGET_NORMALIZATION_ERROR, [widgetName, msgs.join('\n').replace(/\n/g, "\n ")]);
}
widgetSkinObj['aria:skinNormalized'] = true;
return widgetSkinObj;
}
|
javascript
|
{
"resource": ""
}
|
|
q56821
|
train
|
function (general, beanType) {
if (!general) {
general = {};
}
var param = {
json : general,
beanName : "aria.widgets.AriaSkinBeans." + beanType
};
var normalizationResults = this._normalize(param);
if (!normalizationResults.result) {
this.$logWarn(this.GENERAL_NORMALIZATION_ERROR, [normalizationResults.message.replace(/\n/g, "\n ")]);
}
general['aria:skinNormalized'] = true;
return param.json;
}
|
javascript
|
{
"resource": ""
}
|
|
q56822
|
train
|
function (out) {
var cfg = this._cfg;
var tabIndexString = (cfg.tabIndex != null ? ' tabindex="' + this._calculateTabIndex() + '" ' : '');
var titleString = cfg.tooltip ? ' title="' + ariaUtilsString.escapeHTMLAttr(cfg.tooltip) + '" ' : '';
var isIE7 = ariaCoreBrowser.isIE7;
var ariaTestMode = (Aria.testMode) ? ' id="' + this._domId + '_button" ' : '';
var buttonClass = cfg.disabled ? "xButton xButtonDisabled" : "xButton";
var waiAriaAttributes = this._getWaiAriaMarkup();
var disableMarkup = "";
if (cfg.disabled) {
if (!cfg.focusableWhenDisabled) {
disableMarkup = " disabled ";
} else if (cfg.waiAria) {
disableMarkup = " aria-disabled='true' ";
}
}
if (this._simpleHTML) {
var styleMarkup = cfg.width != "-1" ? " style='width:" + cfg.width + "px;' " : "";
out.write([
'<',
!cfg.waiAria
? 'input type="button" value="' + ariaUtilsString.encodeForQuotedHTMLAttribute(cfg.label) + '"'
: 'button',
waiAriaAttributes,
ariaTestMode,
tabIndexString,
titleString,
disableMarkup,
styleMarkup,
!cfg.waiAria
? '/>'
: '>' + ariaUtilsString.escapeForHTML(cfg.label, {text: true}) + '</button>'
].join(''));
} else {
if (isIE7) {
// FIXME: find a way to put a button also on IE7
// on IE7 the button is having display issues the current frame implementation inside it
out.write(['<span class="' + buttonClass + '" style="margin: 0;"', waiAriaAttributes, tabIndexString, titleString, ariaTestMode,
'>'].join(''));
} else {
out.write([
'<button',
' type="button"',
' class="' + buttonClass + '"',
waiAriaAttributes,
tabIndexString,
titleString,
ariaTestMode,
disableMarkup,
'>'
].join(''));
}
this._frame.writeMarkupBegin(out);
// call the method to write the content of the button - here is is just
// the label cfg attribute, but the method can be overwritten in child classes
this._widgetMarkupContent(out);
this._frame.writeMarkupEnd(out);
if (isIE7) {
out.write('</span>');
} else {
out.write('</button>');
}
}
}
|
javascript
|
{
"resource": ""
}
|
|
q56823
|
train
|
function (domEvt) {
if (domEvt.keyCode == ariaDomEvent.KC_SPACE || domEvt.keyCode == ariaDomEvent.KC_ENTER) {
this._keyPressed = true;
this._updateState();
domEvt.stopPropagation();
return false;
}
return true;
}
|
javascript
|
{
"resource": ""
}
|
|
q56824
|
train
|
function() {
var parts = [
this.vendor(),
this.model()
];
for (var index = parts.length - 1; index >= 0; index--) {
var part = parts[index];
if (part == null || part.length == null || part.length <= 0) {
parts.splice(index, 1);
}
}
var deviceName = parts.join(" - ");
return deviceName;
}
|
javascript
|
{
"resource": ""
}
|
|
q56825
|
train
|
function () {
// -------------------------------------------- result initial value
var result = false;
// -------------------------------------------------- standard check
var deviceType = this.__userAgentWrapper.results.device.type;
if (!result) {
if (deviceType != null) {
result = UserAgent.normalizeName(deviceType) == "mobile";
}
}
// --------------------------------------------------- special cases
if (!result) {
if (!this.isTablet()) {
result = ariaCoreBrowser.isAndroid
|| ariaCoreBrowser.isBlackBerry
|| ariaCoreBrowser.isIOS
|| ariaCoreBrowser.isSymbian
|| ariaCoreBrowser.isWindowsPhone
|| UserAgent.normalizeName(ariaCoreBrowser.osName) == "webos"
;
}
}
// ---------------------------------------------------------- result
return !!result;
}
|
javascript
|
{
"resource": ""
}
|
|
q56826
|
train
|
function () {
var isTouch = false;
if (ariaCoreBrowser.isBlackBerry) {
if (!ariaUtilsArray.contains([9670, 9100, 9105, 9360, 9350, 9330, 9320, 9310, 9300, 9220, 9780, 9700, 9650], +this.model())) {
isTouch = true;
}
} else {
var window = Aria.$window;
if (('ontouchstart' in window) || window.DocumentTouch && window.document instanceof window.DocumentTouch) {
isTouch = true;
}
}
return !!isTouch;
}
|
javascript
|
{
"resource": ""
}
|
|
q56827
|
train
|
function () {
__objCount++;
/**
* Counter to be used as an index in each map. Is incremented each time a new entry is added to the object.
* @protected
* @type Number
*/
this._nextIndex = 0;
/**
* Map to store entries whose keys are of type object or function. Note that, even if null is of type
* object, it cannot store properties, and for this reason, an entry whose key is null is not stored here,
* but in this._otherKeys.
* @protected
* @type Object
*/
this._objectKeys = null;
/**
* Map to store entries whose keys are of type string.
* @protected
* @type Object
*/
this._stringKeys = null;
/**
* Map to store entries whose keys are of type number.
* @protected
* @type Object
*/
this._numberKeys = null;
/**
* Map to store entries whose keys are neither objects (with the exception of null), nor functions, nor
* strings, nor numbers. Sample values for keys here: null and undefined (and maybe some other strange
* type). For keys in that category, performances are very bad (must iterate over the whole _otherKeys stuff
* to find a key).
* @protected
* @type Object
*/
this._otherKeys = null;
/**
* Name of the metadata to use when storing information in object keys. It must be unique.
* @protected
* @type String
*/
this._metaDataName = Aria.FRAMEWORK_PREFIX + "hash::" + __objCount;
}
|
javascript
|
{
"resource": ""
}
|
|
q56828
|
train
|
function (key, value) {
var item = {
key : key,
value : value,
index : this._nextIndex
};
this._nextIndex++;
var map = this._getMap(key, true);
if (map == this._objectKeys) {
// something special in case of objects:
var next = key[this._metaDataName];
if (next) {
// the key is already present
// keep the old value
item.next = next;
// keep the index (so that the removal is unified between objects, strings and numbers)
item.index = next.index;
}
key[this._metaDataName] = item;
} else if (map != this._otherKeys) {
item.index = key; // use the key as index for numbers and strings
item.next = map[item.index]; // keep any existing value
} else {
// we must check for an existing value to define the 'next' property,
// so that the order when removing values is the one of a stack
for (var i in map) {
if (map.hasOwnProperty(i)) {
var elt = map[i];
if (key === elt.key) {
item.index = i;
item.next = elt;
break;
}
}
}
}
map[item.index] = item;
}
|
javascript
|
{
"resource": ""
}
|
|
q56829
|
train
|
function (key) {
var map = this._getMap(key, false);
if (map == null) {
return false;
}
var item;
if (map == this._objectKeys) {
item = key[this._metaDataName];
} else if (map != this._otherKeys) {
item = map[key];
} else {
for (var i in map) {
if (map.hasOwnProperty(i)) {
var elt = map[i];
if (key === elt.key) {
item = elt;
break;
}
}
}
}
if (item) {
return true;
} else {
return false;
}
}
|
javascript
|
{
"resource": ""
}
|
|
q56830
|
train
|
function (key) {
var map = this._getMap(key, false);
if (map == null) {
return undefined;
}
var item;
if (map == this._objectKeys) {
item = key[this._metaDataName];
if (item) {
key[this._metaDataName] = item.next;
if (!item.next) {
delete key[this._metaDataName];
}
}
} else if (map != this._otherKeys) {
item = map[key];
} else {
for (var i in map) {
if (map.hasOwnProperty(i)) {
var elt = map[i];
if (key === elt.key) {
item = elt;
break;
}
}
}
}
if (item) {
var next = item.next;
map[item.index] = next;
if (!next) {
delete map[item.index];
}
item.key = null;
item.next = null;
return item.value;
} else {
return undefined;
}
}
|
javascript
|
{
"resource": ""
}
|
|
q56831
|
train
|
function (map, array) {
if (map == null)
return;
for (var i in map) {
var item = map[i];
var key = item.key;
if (map == this._objectKeys) {
key[this._metaDataName] = null;
delete item.key[this._metaDataName];
}
while (item) {
array.push(item.value);
item.value = null;
item.key = null;
var next = item.next;
item.next = null;
item = next;
}
map[i] = null;
delete map[i];
}
}
|
javascript
|
{
"resource": ""
}
|
|
q56832
|
train
|
function () {
var res = [];
this._removeAllToArray(this._objectKeys, res);
this._objectKeys = null;
this._removeAllToArray(this._stringKeys, res);
this._stringKeys = null;
this._removeAllToArray(this._numberKeys, res);
this._numberKeys = null;
this._removeAllToArray(this._otherKeys, res);
this._otherKeys = null;
return res;
}
|
javascript
|
{
"resource": ""
}
|
|
q56833
|
train
|
function (reqId, callback) {
// PROFILING // this.$stopMeasure(req.profilingId);
// Check if Flash plugin is available
var navigator = Aria.$global.navigator;
if (navigator.plugins && navigator.plugins.length > 0) {
var mime = navigator.mimeTypes, type = "application/x-shockwave-flash";
if (!mime || !mime[type] || !mime[type].enabledPlugin) {
return this.$logError(this.IO_MISSING_FLASH_PLUGIN);
}
} else if (navigator.appVersion.indexOf("Mac") == -1 && Aria.$frameworkWindow.execScript) {
try {
var ActiveXObject = Aria.$global.ActiveXObject;
var obj = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
if (obj.activeXError) {
throw "ActiveXError";
}
} catch (er) {
return this.$logError(this.IO_MISSING_FLASH_PLUGIN);
}
}
// We're not ready, wait for the ready event to reissue the request, but cancel this request on timeout
this._pending[reqId] = ariaCoreTimer.addCallback({
fn : this._swfTimeout,
scope : this,
args : {
reqId : reqId,
cb : callback
},
delay : this.swfTimeout
});
if (!this._transport) {
var swfUri = ariaCoreDownloadMgr.resolveURL('aria/resources/handlers/IO.swf');
// note that the flash transport does not work with Safari if the following line is present in
// parameters:
// '<param name="wmode" value="transparent"/>'
var obj = [
'<object id="xATIOSwf" type="application/x-shockwave-flash" data="',
swfUri,
'" width="1" height="1">',
'<param name="movie" value="' + swfUri + '" />',
'<param name="allowScriptAccess" value="always" />',
'<param name="FlashVars" value="readyCallback=' + this.$classpath + '.onXdrReady&handler='
+ this.$classpath + '.handleXdrResponse" />', '</object>'].join("");
var document = Aria.$frameworkWindow.document;
var container = document.createElement('div');
container.style.cssText = "position:fixed;top:-12000px;left:-12000px";
document.body.appendChild(container);
container.innerHTML = obj;
this._transport = document.getElementById("xATIOSwf");
this._transportContainer = container;
}
}
|
javascript
|
{
"resource": ""
}
|
|
q56834
|
train
|
function () {
this.isReady = true;
for (var id in this._pending) {
if (this._pending.hasOwnProperty(id)) {
ariaCoreTimer.cancelCallback(this._pending[id]);
ariaCoreIO.reissue(id);
}
}
this._pending = {};
}
|
javascript
|
{
"resource": ""
}
|
|
q56835
|
train
|
function (args) {
var reqId = args.reqId;
var callback = args.cb;
delete this._pending[reqId];
var response = {
error : this.LOAD_PLUGIN,
status : 0
};
callback.fn.call(callback.scope, true, callback.args, response);
}
|
javascript
|
{
"resource": ""
}
|
|
q56836
|
train
|
function (connection) {
if (connection) {
// raise global custom event -- startEvent
ariaCoreIO.$raiseEvent({
name : "startEvent",
o : connection
});
if (connection.startEvent) {
// raise transaction custom event -- startEvent
ariaCoreIO.$raiseEvent({
name : connection.startEvent,
o : connection
});
}
}
}
|
javascript
|
{
"resource": ""
}
|
|
q56837
|
train
|
function (reqId, connection, callback) {
var success = connection && connection.statusText === "xdr:success";
if (success) {
connection.status = 200;
} else {
connection.status = 0;
}
callback.fn.call(callback.scope, !success, callback.args, connection);
}
|
javascript
|
{
"resource": ""
}
|
|
q56838
|
train
|
function (unused, req) {
this.$raiseEvent({
name : "request",
req : req
});
req.beginDownload = (new Date()).getTime();
// as postData can possibly be changed by filters, we compute the requestSize only after filters have been
// called:
req.requestSize = ((req.method == "POST" || req.method == "PUT") && req.data) ? req.data.length : 0;
// PROFILING // req.profilingId = this.$startMeasure(req.url);
try {
this._prepareTransport(req);
} catch (ex) {
// There was an error in this method - let's create a callback to notify
// the caller in the same way as for other errors
(require("./Timer")).addCallback({
fn : this._handleResponse,
scope : this,
delay : 10,
args : {
isInternalError : true,
reqId : req.id,
errDescription : ex.description || ex.message || (ex.name + ex.number)
}
});
}
return req.id;
}
|
javascript
|
{
"resource": ""
}
|
|
q56839
|
train
|
function (req) {
// increment before assigning to avoid setting request id 0 (which does not work well with abort)
this.nbRequests++;
req.id = this.nbRequests;
var reqMethods = ["GET", "POST", "PUT", "DELETE", "HEAD", "TRACE", "OPTIONS", "CONNECT", "PATCH", "COPY",
"PROPFIND", "MKCOL", "PROPPATCH", "MOVE", "LOCK", "UNLOCK", "BIND", "UNBIND", "REBIND"];
// Assign a request timeout in order of importance:
// # req.timeout - User specified timeout
// # req.callback.timeout - Timeout of the callback function (might be set by filters)
// # this.defaultTimeout - Default IO timeout
if (req.timeout == null) {
req.timeout = (req.callback == null || req.callback.timeout == null)
? this.defaultTimeout
: req.callback.timeout;
}
if (!req.method) {
req.method = "GET";
} else {
req.method = req.method.toUpperCase();
}
if (!(require("../utils/Array")).contains(reqMethods, req.method)) {
return this.$logWarn("The request method %1 is invalid", [req.method]);
}
var headers = {};
// First take the default IO headers
for (var key in this.headers) {
if (this.headers.hasOwnProperty(key)) {
headers[key] = this.headers[key];
}
}
// Then add POST/PUT-specific headers
if (req.method === "POST" || req.method === "PUT") {
for (var key in this.postHeaders) {
if (this.postHeaders.hasOwnProperty(key)) {
headers[key] = this.postHeaders[key];
}
}
}
// Then the headers from the request object
for (var key in req.headers) {
if (req.headers.hasOwnProperty(key)) {
headers[key] = req.headers[key];
}
}
req.headers = headers;
}
|
javascript
|
{
"resource": ""
}
|
|
q56840
|
train
|
function (error, request, response) {
if (!response) {
response = {};
}
if (!request && error) {
request = this.pendingRequests[error.reqId];
}
this.clearTimeout(request.id);
this._normalizeResponse(error, request, response);
// Extra info for the request object
request.res = response;
request.endDownload = (new Date()).getTime();
request.downloadTime = request.endDownload - request.beginDownload;
request.responseSize = response.responseText.length;
this.trafficDown += request.responseSize;
this.$raiseEvent({
name : "response",
req : request
});
delete this.pendingRequests[request.id];
if (aria.core.IOFiltersMgr) {
aria.core.IOFiltersMgr.callFiltersOnResponse(request, {
fn : this._afterResponseFilters,
scope : this,
args : request
});
} else {
this._afterResponseFilters(null, request);
}
}
|
javascript
|
{
"resource": ""
}
|
|
q56841
|
train
|
function (unused, req) {
var res = req.res, cb = req.callback;
if (!cb) {
this.$logError(this.MISSING_IO_CALLBACK, [res.url]);
} else if (res.error != null) {
// an error occured
// call the error callback
if (cb.onerror == null) {
// Generic IO error mgt
this.$logError(this.IO_REQUEST_FAILED, [res.url, res.error]);
} else {
var scope = cb.onerrorScope;
if (!scope) {
scope = cb.scope;
}
try {
cb.onerror.call(scope, res, cb.args);
} catch (ex) {
this.$logError(this.IO_CALLBACK_ERROR, [res.url], ex);
}
}
} else {
// check the response type to adapt it to the request
if (req.expectedResponseType) {
this._jsonTextConverter(res, req.expectedResponseType);
}
cb.fn.call(cb.scope, res, cb.args);
}
req = cb = null;
}
|
javascript
|
{
"resource": ""
}
|
|
q56842
|
train
|
function (id, timeout, callback) {
if (timeout > 0) {
this._timeOut[id] = setTimeout(function () {
// You won't believe this, but sometimes IE forgets to remove the timeout even if
// we explicitely called a clearTimeout. Double check that the timeout is valid
if ((module.exports)._timeOut[id]) {
(module.exports).abort({
redId : id,
getStatus : callback
}, null, true);
}
}, timeout);
}
}
|
javascript
|
{
"resource": ""
}
|
|
q56843
|
train
|
function (xhrObject, callback, isTimeout) {
if (!xhrObject) {
return false;
}
var transaction = xhrObject.redId || xhrObject;
var request = this.pendingRequests[transaction];
this.clearTimeout(transaction);
var abortStatus = false;
if (xhrObject.getStatus) {
var statusCallback = xhrObject.getStatus;
abortStatus = statusCallback.fn.apply(statusCallback.scope, statusCallback.args);
}
if (request) {
abortStatus = true;
if (xhrObject === transaction) {
xhrObject = {
transaction : transaction
};
} else {
xhrObject.transaction = transaction;
}
}
if (abortStatus === true) {
// Fire global custom event -- abortEvent
this.$raiseEvent({
name : "abortEvent",
o : xhrObject,
req : request
});
var response = {
transaction : request.id,
req : request,
status : isTimeout ? this.COMM_CODE : this.ABORT_CODE,
statusText : isTimeout ? this.TIMEOUT_ERROR : this.ABORT_ERROR
};
this._handleResponse(true, request, response);
}
return abortStatus;
}
|
javascript
|
{
"resource": ""
}
|
|
q56844
|
train
|
function (response, expectedResponseType) {
if (expectedResponseType == "text") {
if (!response.responseText && response.responseJSON != null) {
// convert JSON to text
if (ariaUtilsType.isString(response.responseJSON)) {
// this case is important for JSON-P services which return a simple string
// we simply use that string as text
// (could be useful to load templates through JSON-P, for example)
response.responseText = response.responseJSON;
} else {
// really convert the JSON structure to a string
response.responseText = ariaUtilsJson.convertToJsonString(response.responseJSON);
}
}
} else if (expectedResponseType == "json") {
if (response.responseJSON == null && response.responseText != null) {
// convert text to JSON
var errorMsg = (require("../utils/String")).substitute(this.JSON_PARSING_ERROR, [response.url,
response.responseText]);
if (response.responseText === "") {
var undef;
response.responseJSON = undef;
} else {
response.responseJSON = ariaUtilsJson.load(response.responseText, this, errorMsg);
}
}
}
}
|
javascript
|
{
"resource": ""
}
|
|
q56845
|
train
|
function (e) {
// call unload listeners
// Keep a local copy of the reference to unloadListeners because it is possible that a listener calls
// aria.utils.Event.reset (that's what AriaWindow is doing).
var list = unloadListeners.slice();
for (var i = 0, len = list.length; i < len; ++i) {
var l = list[i];
if (l) {
l[CB].call(this.getEvent(e));
list[i] = null;
l = null;
}
}
list = null;
}
|
javascript
|
{
"resource": ""
}
|
|
q56846
|
train
|
function (element, event, callback, useCapture, filterFunction) {
var added = false;
var parent = element.parentElement || element.parentNode; // Fx < 9 compat
while (parent != null) {
if (!filterFunction || filterFunction(parent)) {
added = this.addListener(parent, event, callback, useCapture) || added;
}
parent = parent.parentElement || parent.parentNode; // Fx < 9 compat
}
return added;
}
|
javascript
|
{
"resource": ""
}
|
|
q56847
|
train
|
function (element, event, callback, filterFunction) {
var removed = false;
var parent = element.parentElement || element.parentNode; // Fx < 9 compat
while (parent != null) {
if (!filterFunction || filterFunction(parent)) {
removed = this.removeListener(parent, event, callback) || removed;
}
parent = parent.parentElement || parent.parentNode; // Fx < 9 compat
}
return removed;
}
|
javascript
|
{
"resource": ""
}
|
|
q56848
|
train
|
function (element, event) {
var normalized = {
element: element,
event: event
};
if ('mousewheel' == event) {
if (this.UA.isIE) {
if (element == Aria.$window) {
normalized.element = element.document;
}
} else if (!(this.UA.isOpera || this.UA.isSafari || this.UA.isWebkit)) {
normalized.event = 'DOMMouseScroll';
}
}
return normalized;
}
|
javascript
|
{
"resource": ""
}
|
|
q56849
|
train
|
function (template, context, statements, throwErrors) {
this.context = context;
this._prepare(template, throwErrors);
this._computeLineNumbers();
return this._buildTree(throwErrors);
}
|
javascript
|
{
"resource": ""
}
|
|
q56850
|
train
|
function () {
var cfg = this._cfg;
var anchorElement = ariaUtilsDom.getDomElementChild(this.getDom(), 0);
var ellipseElement = Aria.$window.document.createElement("span");
ellipseElement.innerHTML = ariaUtilsString.escapeHTML(cfg.label);
this.textContent = cfg.label;
if (ellipseElement.innerHTML) {
anchorElement.insertBefore(ellipseElement, anchorElement.firstChild);
}
var labelWidth = cfg.labelWidth;
if (labelWidth > 0) {
this._ellipsis = new ariaUtilsEllipsis(ellipseElement, labelWidth, cfg.ellipsisLocation, cfg.ellipsis, this._context, cfg.ellipsisEndStyle);
}
if (ellipseElement.innerHTML) {
anchorElement.removeChild(anchorElement.childNodes[1]);
}
}
|
javascript
|
{
"resource": ""
}
|
|
q56851
|
train
|
function (out) {
var cfg = this._cfg;
var tabString = (cfg.tabIndex != null ? ' tabindex="' + this._calculateTabIndex() + '" ' : ' ');
out.write(['<a', Aria.testMode ? ' id="' + this._domId + '_link"' : '',
' class="sortIndicatorLink" href="#"' + tabString + this._getWaiAriaMarkup() + '>' + ariaUtilsString.escapeHTML(cfg.label)].join(""));
this._icon.writeMarkup(out);
out.write('</a>');
}
|
javascript
|
{
"resource": ""
}
|
|
q56852
|
train
|
function (cfg) {
if (cfg.view.sortName == cfg.sortName) {
if (cfg.view.sortOrder == 'A') {
return this.ASCENDING_STATE;
} else if (cfg.view.sortOrder == 'D') {
return this.DESCENDING_STATE;
}
} else {
return this.NORMAL_STATE;
}
}
|
javascript
|
{
"resource": ""
}
|
|
q56853
|
train
|
function () {
var cfg = this._cfg, sortKeyGetter = cfg.sortKeyGetter;
if (sortKeyGetter) {
var view = cfg.view;
view.toggleSortOrder(cfg.sortName, sortKeyGetter);
view.refresh();
}
}
|
javascript
|
{
"resource": ""
}
|
|
q56854
|
train
|
function (domEvt) {
if (this._actingDom && this._hasMouseOver === false) {
this._hasFocus = true;
var offset;
if (ariaCoreBrowser.isFirefox) {
offset = {
left : 1,
top : 2
};
} else {
offset = {
left : 1,
top : 1
};
}
if (this._ellipsis) {
this._ellipsis.displayFullText(offset);
}
}
}
|
javascript
|
{
"resource": ""
}
|
|
q56855
|
train
|
function (domEvt) {
if (this._hasMouseOver === false && this._hasFocus === true) {
this._hasFocus = false;
if (this._ellipsis) {
this._ellipsis._hideFullText(domEvt.relatedTarget);
}
}
}
|
javascript
|
{
"resource": ""
}
|
|
q56856
|
train
|
function (domEvt) {
this._sortList();
// handle an onclick event
this.$ActionWidget._dom_onclick.apply(this, arguments);
if (this._cfg) {
this._updateDisplay();
if (this._cfg.refreshArgs) {
this._doPartialRefresh(this._cfg.refreshArgs);
} else {
this._context.$refresh();
}
}
domEvt.preventDefault();
return false;
}
|
javascript
|
{
"resource": ""
}
|
|
q56857
|
train
|
function () {
var differed = [];
// it is possible, with the dialog, that we insert an already initialized section inside a non
// initialized section
if (this._initWidgetsDone) {
return differed;
}
this._initWidgetsDone = true;
this.html = null; // html should no longer be used once widgets are initialized
var content = this._content;
var contentSize = content.length;
for (var i = 0; i < contentSize; i++) {
var elt = content[i];
// case widget
if (elt._type == TYPE_BEHAVIOR) {
var bhv = elt.behavior;
if (bhv.initWidget) {
try {
bhv.initWidget();
if (bhv.isDiffered) {
differed.push(bhv);
}
} catch (e) {
this.$logError(this.WIDGETCALL_ERROR, [bhv.$classpath, "initWidget"], e);
}
}
} else { // case section
differed = differed.concat(elt.initWidgets());
}
}
// The following line displays the processing indicator on the section (if needed)
this.refreshProcessingIndicator();
return differed;
}
|
javascript
|
{
"resource": ""
}
|
|
q56858
|
train
|
function () {
this.$raiseEvent("beforeRemoveContent");
// so that the children section can see that it is useless to remove themselves from
// their parent:
this._removingContent = true;
var content = this._content;
var contentLength = content.length;
for (var i = 0; i < contentLength; i++) {
var elt = content[i];
if (elt._type == TYPE_BEHAVIOR) {
var bhv = elt.behavior;
if (elt.id && this.idMap) {
this.idMap[elt.id] = null;
delete this.idMap[elt.id];
}
bhv.$dispose();
} else {
elt.$dispose();
}
}
this._content = [];
this._initWidgetsDone = false;
this._removingContent = false;
this.$raiseEvent("afterRemoveContent");
}
|
javascript
|
{
"resource": ""
}
|
|
q56859
|
train
|
function () {
// remove delegation done with "on" statement
if (this.delegateIds) {
for (var i = 0, l = this.delegateIds.length; i < l; i++) {
ariaUtilsDelegate.remove(this.delegateIds[i]);
}
this.delegateIds = [];
}
for (var i = 0, l = this.delegateCallbacks.length; i < l; i++) {
this.delegateCallbacks[i].$dispose();
}
this.delegateCallbacks = [];
}
|
javascript
|
{
"resource": ""
}
|
|
q56860
|
train
|
function (bhv) {
var bhvId = (bhv.getId ? bhv.getId() : null);
var element = {
_type : TYPE_BEHAVIOR,
behavior : bhv,
section : this,
id : bhvId
};
if (bhvId && this.idMap) {
if (this.idMap[bhvId]) {
// TODO: change error message as this may be, in the future, other things than a widget
// TODO: add context info
this.$logError(this.WIDGET_ID_NOT_UNIQUE, [this.tplCtxt.tplClasspath, bhvId, bhv.$class]);
element.id = null;
} else {
this.idMap[bhvId] = element;
}
}
this._content.push(element);
}
|
javascript
|
{
"resource": ""
}
|
|
q56861
|
train
|
function (id) {
var res = this.idMap ? this.idMap[id] : null;
if (res && res._type == TYPE_BEHAVIOR) {
return res.behavior;
}
return null;
}
|
javascript
|
{
"resource": ""
}
|
|
q56862
|
train
|
function (id) {
var res = this.idMap ? this.idMap[id] : null;
if (res && res._type == TYPE_SECTION) {
return res;
}
return null;
}
|
javascript
|
{
"resource": ""
}
|
|
q56863
|
train
|
function (idMap) {
if (this.idMap == idMap) {
// already the same id map (especially useful if both are null)
return;
}
// set child idMap to its parent value
this.idMap = idMap;
var id = this.id;
if (id && idMap) {
if (idMap[id]) {
this.$logError(this.SECTION_ALREADY_EXISTS, [this.tplCtxt.tplClasspath, id]);
} else {
idMap[id] = this;
}
}
var content = this._content;
var contentSize = content.length;
// add the ids found in this section to the parent map:
// and recursively call __updateIdMap
for (var i = 0; i < contentSize; i++) {
var elt = content[i];
if (elt._type == TYPE_SECTION) {
elt.__updateIdMap(idMap);
} else {
id = elt.id;
if (id && idMap) {
if (idMap[id]) {
this.$logError(this.WIDGET_ID_NOT_UNIQUE, [this.tplCtxt.tplClasspath, id,
elt.behavior.$class]);
} else {
idMap[id] = elt;
}
}
}
}
}
|
javascript
|
{
"resource": ""
}
|
|
q56864
|
train
|
function (bind, callback) {
var jsonChangeCallback = null;
// register as listener for the bindings defined for this control:
if (bind) {
jsonChangeCallback = {
fn : callback || this._notifyDataChange,
scope : this,
args : {
tplCtxt : this.tplCtxt,
animate : bind.animate
}
};
// addListener throws errors
try {
// normalize recursive
bind.recursive = bind.recursive !== false;
this.__json.addListener(bind.inside, bind.to, jsonChangeCallback, true, bind.recursive);
// save for disposal
this._bindings.push({
inside : bind.inside,
callback : jsonChangeCallback,
to : bind.to,
recursive : bind.recursive
});
} catch (e) {
this.$logError(this.SECTION_BINDING_ERROR, [bind.inside, bind.to, this.id,
this.tplCtxt.tplClasspath]);
jsonChangeCallback = null;
}
return jsonChangeCallback;
}
}
|
javascript
|
{
"resource": ""
}
|
|
q56865
|
train
|
function (visible, options) {
visible = !!visible;
var alreadyVisible = !!this._overlayId;
if (visible !== alreadyVisible) {
if (visible) {
this._overlayId = ariaUtilsDomOverlay.create(this.getDom(), options);
} else {
this.disposeProcessingIndicator();
}
var processing = this._processing;
if (processing) {
// Update the value in the datamodel (someone else might be listening to it)
this.__skipProcessingChange = true;
this.__json.setValue(processing.inside, processing.to, visible);
this.__skipProcessingChange = false;
}
} else if (visible) {
// refresh the overlay
ariaUtilsDomOverlay.overlays[this._overlayId].refresh();
}
}
|
javascript
|
{
"resource": ""
}
|
|
q56866
|
train
|
function (recursive) {
if (recursive) {
var content = this._content;
for (var i = 0, len = content.length; i < len; i++) {
if (content[i].refreshProcessingIndicator) {
content[i].refreshProcessingIndicator(true);
} else if (content[i].behavior && content[i].behavior.subTplCtxt) {
content[i].behavior.subTplCtxt.refreshProcessingIndicator();
}
}
}
var processing = this._processing, isBound = !!processing;
if (isBound && processing.inside[processing.to]) {
// Display the loading indicator
this._setProcessingIndicatorWithDefaultOptions(true);
}
}
|
javascript
|
{
"resource": ""
}
|
|
q56867
|
train
|
function (attributes) {
var attrBinding = this._attributesBinding;
if (attrBinding) {
this.__json.setValue(attrBinding.inside, attrBinding.to, attributes);
} else {
this._applyNewAttributes(attributes);
}
}
|
javascript
|
{
"resource": ""
}
|
|
q56868
|
train
|
function (newValue) {
var attribute, domElt = this.getDom(), whiteList = ariaTemplatesDomElementWrapper.attributesWhiteList, newAttributeValue;
var oldValue = this.attributes;
// remove old members
for (attribute in oldValue) {
if (oldValue.hasOwnProperty(attribute)) {
if (attribute == "dataset") {
ariaUtilsHtml.removeDataset(domElt, oldValue[attribute]);
} else if (!newValue[attribute]) {
if (attribute == "classList") {
this.getWrapper().classList.setClassName("");
} else {
domElt.removeAttribute(attribute);
}
}
}
}
// add new members
for (attribute in newValue) {
newAttributeValue = newValue[attribute];
if (newValue.hasOwnProperty(attribute) && !this.__json.isMetadata(attribute)
&& newAttributeValue != null) {
if (attribute == "classList") {
this.getWrapper().classList.setClassName(newAttributeValue.join(" "));
} else if (attribute == "dataset") {
ariaUtilsHtml.setDataset(domElt, newAttributeValue);
} else if (whiteList.test(attribute) && newAttributeValue !== oldValue[attribute]) {
domElt.setAttribute(attribute, newAttributeValue);
}
}
}
this.attributes = this.__json.copy(newValue);
}
|
javascript
|
{
"resource": ""
}
|
|
q56869
|
train
|
function (className) {
if (this.attributes && this.attributes.classList) {
this.attributes.classList = className.split(" ");
var attrBinding = this._attributesBinding;
if (attrBinding) {
this.__json.setValue(attrBinding.inside[attrBinding.to], "classList", className.split(" "), this._attributesChangeListener);
}
}
}
|
javascript
|
{
"resource": ""
}
|
|
q56870
|
train
|
function (out) {
if (this.domType) {
// if domType is empty, we do not output anything for the section
// (used in the tooltip)
var attributeList = this.attributes ? ariaUtilsHtml.buildAttributeList(this.attributes) : '';
var h = ['<', this.domType, attributeList, ' id="', this._domId, '" ',
ariaUtilsDelegate.getMarkup(this.delegateId), '>'];
out.write(h.join(''));// opening the section
}
}
|
javascript
|
{
"resource": ""
}
|
|
q56871
|
train
|
function (evt) {
// forward event and configuration to a dedicated handler
this.__navigationManager.handleNavigation(this.keyMap, this.tableNav, evt);
if (this._cfg && this._cfg.on) {
var callback = this._cfg.on[evt.type];
if (callback) {
var wrapped = new ariaTemplatesDomEventWrapper(evt), returnValue;
try {
returnValue = callback.fn.call(callback.scope, wrapped, callback.args);
} catch (e) {
this.$logError(this.SECTION_CALLBACK_ERROR, [this.tplCtxt.tplClasspath, this._cfg.id,
evt.type], e);
}
wrapped.$dispose();
return returnValue;
}
}
}
|
javascript
|
{
"resource": ""
}
|
|
q56872
|
train
|
function () {
var eventListeners = this._cfg ? this._cfg.on : null;
if (eventListeners) {
for (var listener in eventListeners) {
if (eventListeners.hasOwnProperty(listener)) {
eventListeners[listener] = this.$normCallback(eventListeners[listener]);
}
}
}
}
|
javascript
|
{
"resource": ""
}
|
|
q56873
|
train
|
function (targetSection) {
this.$assert(708, targetSection.idMap == null); // check that there is no id map so that it is not a
// problem to change the id
targetSection.id = this.id;
targetSection.domType = this.domType;
targetSection.tableNav = this.tableNav;
targetSection.keyMap = this.keyMap;
targetSection.macro = this.macro;
}
|
javascript
|
{
"resource": ""
}
|
|
q56874
|
train
|
function (args) {
var sectionMacro = this.macro;
if (sectionMacro) {
// a macro is defined in the section, it is the default macro to use when refreshing
if (!args.macro) {
args.macro = sectionMacro;
} else {
var targetMacro = args.macro;
if (ariaUtilsType.isObject(targetMacro) && !targetMacro.name) {
targetMacro.name = sectionMacro.name;
targetMacro.scope = sectionMacro.scope;
if (!targetMacro.args) {
targetMacro.args = sectionMacro.args;
}
}
}
}
// Remove cached reference to the dom element, as it may change during the refresh
// (occurs in tables in IE)
this._domElt = null;
}
|
javascript
|
{
"resource": ""
}
|
|
q56875
|
train
|
function (targetSection) {
var content = this._content;
this.$assert(805, this.idMap == null);
this.$assert(806, content);
var targetContent = targetSection._content;
var targetLength = targetContent.length;
// first move all children from this to target _content array
// updating the parent reference for sections
for (var i = 0, l = content.length; i < l; i++) {
var item = content[i];
targetContent[targetLength + i] = item;
if (item._type == TYPE_SECTION) {
item.parent = targetSection;
}
}
// then register content in the target idMap
this.__updateIdMap(targetSection.idMap);
// move the {on...} statement callbacks:
targetSection.delegateIds = targetSection.delegateIds.concat(this.delegateIds);
targetSection.delegateCallbacks = targetSection.delegateCallbacks.concat(this.delegateCallbacks);
this.delegateIds = [];
this.delegateCallbacks = [];
// and initialize widgets
var res = null;
if (targetSection._initWidgetsDone) {
res = this.initWidgets();
}
// set back idMap to null (may have been changed by __updateIdMap)
this.idMap = null;
// this section becomes empty:
this._content = [];
return res;
}
|
javascript
|
{
"resource": ""
}
|
|
q56876
|
train
|
function () {
var splitted1 = this._cfg.animation.animateIn.split(" ");
var splitted2 = this._cfg.animation.animateOut.split(" ");
return {
animIn : {
type : splitted1[0],
reverse : (splitted1[1] == "right")
},
animOut : {
type : splitted2[0],
reverse : (splitted2[1] == "right")
}
};
}
|
javascript
|
{
"resource": ""
}
|
|
q56877
|
train
|
function (domElt, refreshArgs) {
// lazy processing of animation in/out string
var animation = this._getAnimation();
this._animating = true;
var newSection = this._domElt.cloneNode(false);
domElt.id = null;
newSection.className += " not-visible";
newSection = ariaUtilsDom.replaceHTML(newSection, this.html);
var from = domElt;
var to = newSection;
ariaUtilsDom.insertAdjacentElement(from, "afterEnd", newSection);
this.setDom(newSection);
var animSemaphore = false;
var cfg = {
// from : from,
to : to,
type : 3,
reverse : animation.animIn.reverse,
hiddenClass : 'not-visible'
};
var cfg2 = {
from : from,
// to : to,
type : 3,
reverse : animation.animOut.reverse,
hiddenClass : 'not-visible'
};
var anim = new ariaUtilsCssAnimations();
var anim2 = new ariaUtilsCssAnimations();
var animEnd = {
"animationend" : function () {
if (animSemaphore) {
ariaUtilsDom.removeElement(from);
this._animating = false;
this.tplCtxt.onRefreshAnimationEnd(refreshArgs);
} else {
animSemaphore = true;
}
},
scope : this
};
anim.$on(animEnd);
anim2.$on(animEnd);
anim.start(animation.animIn.type, cfg);
anim2.start(animation.animOut.type, cfg2);
}
|
javascript
|
{
"resource": ""
}
|
|
q56878
|
train
|
function (suggestions) {
if (typesUtil.isArray(suggestions)) {
var newSuggestions = [], suggestionsLabel = this._options.labelKey, suggestionsCode = this._options.codeKey;
if (this._options.sortingMethod && typesUtil.isFunction(this._options.sortingMethod)) {
suggestions.sort(this._options.sortingMethod);
} else {
suggestions.sort(function (a, b) {
return (a[suggestionsLabel] < b[suggestionsLabel])
? 1
: (a[suggestionsLabel] > b[suggestionsLabel]) ? -1 : 0;
});
}
for (var index = 0, l = suggestions.length; index < l; index++) {
var suggestion = suggestions[index], eachSuggestion = {};
if (this.__islabelCode && !jsonValidator.check(suggestion, this.SUGGESTION_BEAN)) {
return this.$logError(this.INVALID_SUGGESTIONS, null, suggestions);
} else if (!(suggestion.hasOwnProperty(suggestionsLabel) && suggestion.hasOwnProperty(suggestionsCode))) {
return this.$logError(this.INVALID_KEYCODE, null, suggestions);
}
eachSuggestion.label = suggestion[suggestionsLabel];
eachSuggestion.code = suggestion[suggestionsCode];
var newSuggestion = {
label : stringUtil.stripAccents(eachSuggestion.label).toLowerCase(),
code : stringUtil.stripAccents(eachSuggestion.code).toLowerCase(),
original : eachSuggestion
};
if (this._labelMatchAtWordBoundaries) {
newSuggestion.wordBoundaries = this.__getWordBoundaries(newSuggestion.label);
}
newSuggestions.push(newSuggestion);
}
this._suggestions = newSuggestions;
} else {
return this.$logError(this.INVALD_SUGGESTION_TYPE, null, suggestions);
}
}
|
javascript
|
{
"resource": ""
}
|
|
q56879
|
train
|
function (callback) {
var originalSuggestions = this._suggestions;
var nbSuggestions = originalSuggestions.length;
var returnedSuggestions = [];
var suggestion;
for (var index = 0; index < nbSuggestions; index++) {
suggestion = originalSuggestions[index];
returnedSuggestions.push(suggestion.original);
}
this.$callback(callback, returnedSuggestions);
}
|
javascript
|
{
"resource": ""
}
|
|
q56880
|
train
|
function (lazy) {
var dependencies = {
templates : [],
classes : [],
modules : {
page : [],
common : []
},
css : []
};
var pageComposition = this._pageConfig.pageComposition;
var placeholders = pageComposition.placeholders || {};
var typeUtils = ariaUtilsType;
if (!lazy) {
this._utils.addIfMissing(pageComposition.template, dependencies.templates);
if (pageComposition.css) {
dependencies.css = pageComposition.css.slice(0);
}
}
for (var placeholderName in placeholders) {
if (placeholders.hasOwnProperty(placeholderName)) {
var singlePlaceholderArray = placeholders[placeholderName];
if (!typeUtils.isArray(singlePlaceholderArray)) {
singlePlaceholderArray = [singlePlaceholderArray];
}
for (var i = 0; i < singlePlaceholderArray.length; i += 1) {
this._addPlaceholderDependencies(singlePlaceholderArray[i], dependencies, lazy);
}
}
}
return dependencies;
}
|
javascript
|
{
"resource": ""
}
|
|
q56881
|
train
|
function (placeholder, dependencies, lazy) {
var modules = this._pageModules, refpath, moduleDesc, typeUtils = ariaUtilsType;
if (!typeUtils.isObject(placeholder)) {
return;
}
var isLazy = (placeholder.lazy);
if ((lazy && !isLazy) || (!lazy && isLazy)) {
return;
}
if ("module" in placeholder) {
refpath = placeholder.module;
if (refpath.match(/^common:/)) {
this._utils.addIfMissing(refpath.replace(/^common:/, ""), dependencies.modules.common);
} else {
moduleDesc = modules[refpath];
if (moduleDesc) {
this._utils.addIfMissing(moduleDesc.classpath, dependencies.classes);
this._utils.addIfMissing(refpath, dependencies.modules.page);
}
}
}
if ("template" in placeholder) {
this._utils.addIfMissing(placeholder.template, dependencies.templates);
}
if ("css" in placeholder) {
this._utils.wiseConcat(dependencies.css, placeholder.css);
}
}
|
javascript
|
{
"resource": ""
}
|
|
q56882
|
train
|
function () {
var output = [], isLazy, typeUtils = ariaUtilsType;
var placeholders = this._pageConfig.pageComposition.placeholders || {};
for (var placeholderName in placeholders) {
if (placeholders.hasOwnProperty(placeholderName)) {
isLazy = false;
var singlePlaceholderArray = placeholders[placeholderName];
if (!typeUtils.isArray(singlePlaceholderArray)) {
singlePlaceholderArray = [singlePlaceholderArray];
}
for (var i = 0; i < singlePlaceholderArray.length; i += 1) {
if (singlePlaceholderArray[i].lazy) {
isLazy = true;
}
}
if (isLazy) {
output.push(placeholderName);
}
}
}
return output;
}
|
javascript
|
{
"resource": ""
}
|
|
q56883
|
rmDirRecursive
|
train
|
function rmDirRecursive(dirPath) {
if(!fs.existsSync(dirPath)){
grunt.log.write('Directory ' + dirPath + ' does not exist. ');
return 0; // fine
}
var files;
try {
files = fs.readdirSync(dirPath);
} catch(e) {
grunt.fatal('Exception when trying to remove folder ' + dirPath);
grunt.log.writeln(e);
}
var count = 0;
if (files.length > 0) {
for (var i = 0; i < files.length; i++) {
var filePath = dirPath + '/' + files[i];
if (fs.statSync(filePath).isFile()) {
fs.unlinkSync(filePath);
} else {
count += rmDirRecursive(filePath);
}
}
}
fs.rmdirSync(dirPath);
count += files.length + 1;
return count;
}
|
javascript
|
{
"resource": ""
}
|
q56884
|
train
|
function (tplCfg) {
if (this._cfgOk) {
var cfg = this._cfg;
for (var i = 0, len = this.__inherithCfg.length; i < len; i += 1) {
var property = this.__inherithCfg[i];
if (!tplCfg.hasOwnProperty(property)) {
tplCfg[property] = cfg[property];
}
}
if (cfg.defaultTemplate) {
// allow the customization of the template:
tplCfg.defaultTemplate = cfg.defaultTemplate;
}
if (cfg.id) {
tplCfg.id = cfg.id + "_t_";
}
var tplWidget = this._tplWidget = new ariaWidgetsTemplate(tplCfg, this._context, this._lineNumber);
var extraAttributes = this._extraAttributes;
if (extraAttributes) {
tplWidget.addExtraAttributes(extraAttributes);
}
tplWidget.tplLoadCallback = {
fn : this._tplLoadCallback,
scope : this
};
}
}
|
javascript
|
{
"resource": ""
}
|
|
q56885
|
train
|
function (args) {
if (args.success) {
this._subTplCtxt = args.templateCtxt;
this._subTplModuleCtrl = args.templateCtxt.moduleCtrl;
this._subTplData = this._subTplCtxt.data;
if (this._subTplModuleCtrl) {
this._subTplModuleCtrl.$on({
'*' : this._onModuleEvent,
scope : this
});
}
// only register the bindings here, when the widget template is totally loaded
this._registerBindings();
// binding registering may refresh the page
if (this._tplWidget) {
this.initWidgetDom(this._tplWidget.getDom());
this.$raiseEvent("widgetContentReady");
}
}
// TODO: if not args.success, need to log something ?
}
|
javascript
|
{
"resource": ""
}
|
|
q56886
|
train
|
function (out) {
if (!this._cfgOk) {
return aria.widgets.TemplateBasedWidget.superclass.writeMarkup.call(this, out);
}
// Prepare delegation id before to have it linked with this widget
this._tplWidget._delegateId = aria.utils.Delegate.add({
fn : this.delegate,
scope : this
});
this._tplWidget.writeMarkup(out);
this._domReady = true;
}
|
javascript
|
{
"resource": ""
}
|
|
q56887
|
setMappedKey
|
train
|
function setMappedKey (generated, original) {
if (generated) {
allKeyMap[original] = generated;
} else {
delete allKeyMap[original];
}
storage.setAttribute("kMap", privateSerializer.serialize(allKeyMap));
storage.save("JSONPersist");
}
|
javascript
|
{
"resource": ""
}
|
q56888
|
getMappedKey
|
train
|
function getMappedKey (key, create) {
allKeyMap = getAllKeys();
if (create && !(key in allKeyMap)) {
var newKey = ("uD" + _UNIQUE_ID++);
setMappedKey(newKey, key);
return newKey;
} else {
return allKeyMap[key];
}
}
|
javascript
|
{
"resource": ""
}
|
q56889
|
train
|
function (key) {
storage.removeAttribute(getMappedKey(key));
setMappedKey(null, key);
storage.save("JSONPersist");
}
|
javascript
|
{
"resource": ""
}
|
|
q56890
|
train
|
function (value, groups, event) {
var validators = this.validators;
if (validators.length) {
var res;
var isMember = false;
for (var i = 0; i < validators.length; i++) {
isMember = this.dataUtils.checkGroup(validators[i].groups, groups);
if (isMember && (this.dataUtils.checkEventToValidate(validators[i].eventToValidate, event))) {
var extraRes = validators[i].validate(value, groups, event);
if (extraRes && extraRes.length > 0) {
if (res == null) {
res = extraRes;
} else {
res = res.concat(extraRes);
}
if (this.breakOnMessage) {
break;
}
}
}
}
if (res && res.length > 0) {
if (this.groupMessages) {
var msgGroup = ariaUtilsJson.copy(this.message);
msgGroup.subMessages = res;
return [msgGroup];
} else {
return res;
}
}
return null;
}
}
|
javascript
|
{
"resource": ""
}
|
|
q56891
|
train
|
function (name, value) {
if (value == null) { // null or undefined
return this.removeParam(name);
}
if (this._params == null) {
this._params = [];
}
for (var i = 0, length = this._params.length; i < length; i++) {
var elt = this._params[i];
if (elt.name === name) {
elt.value = encodeURIComponent(value);
return;
}
}
this._params.push({
name : name,
value : encodeURIComponent(value)
});
}
|
javascript
|
{
"resource": ""
}
|
|
q56892
|
train
|
function (name) {
if (name == null || this._params == null) {
return null;
}
for (var i = 0, length = this._params.length; i < length; i++) {
var elt = this._params[i];
if (elt.name === name) {
return elt.value;
}
}
return null;
}
|
javascript
|
{
"resource": ""
}
|
|
q56893
|
train
|
function (name) {
if (name == null) {
this._params = null;
}
if (this._params == null) {
return;
}
for (var i = 0, length = this._params.length; i < length; i++) {
var elt = this._params[i];
if (elt.name === name) {
this._params.splice(i, 1);
length--;
}
}
}
|
javascript
|
{
"resource": ""
}
|
|
q56894
|
train
|
function (args) {
var req = args.req;
var handler = args.requestHandler;
if (handler == null) {
handler = this.__getRequestHandler();
}
req.data = (req.data == null && req.method == "POST")
? handler.prepareRequestBody(req.jsonData, req.requestObject)
: req.data;
req.headers = handler.getRequestHeaders();
if (req.requestObject.headers) {
req.headers = ariaUtilsJson.copy(req.headers, false);
ariaUtilsJson.inject(req.requestObject.headers, req.headers, false);
}
// call the server
var senderObject = {
classpath : this.$classpath,
requestObject : req.requestObject,
requestData : req.jsonData,
// the following two properties can be used to communicate from the filters to the RequestMgr and bypass
// the handler:
responseData : null,
responseErrorData : null
};
var requestObject = {
sender : senderObject,
url : req.url,
async : (req.requestObject.async !== false),
method : req.method,
data : req.data,
headers : req.headers,
timeout : req.timeout,
callback : {
fn : this._onresponse,
onerror : this._onresponse,
scope : this,
args : {
requestObject : req.requestObject,
senderObject : senderObject,
cb : args.cb,
id : args.id,
session : args.session,
actionQueuing : args.actionQueuing,
requestHandler : handler
}
}
};
if (handler.expectedResponseType) {
requestObject.expectedResponseType = handler.expectedResponseType;
}
ariaCoreIO.asyncRequest(requestObject);
}
|
javascript
|
{
"resource": ""
}
|
|
q56895
|
train
|
function (args) {
// var cb = args.cb;
var res = args.res;
var handler = args.requestHandler;
// http error > use process failure
if (res.error) {
handler.processFailure({
error : res.error,
status : res.status,
responseXML : res.responseXML,
responseText : res.responseText,
responseJSON : res.responseJSON
}, {
url : args.res.url,
session : args.session,
requestObject : args.requestObject
}, {
fn : this._callRequestCallback,
scope : this,
args : args
});
} else {
handler.processSuccess({
responseXML : res.responseXML,
responseText : res.responseText,
responseJSON : res.responseJSON
}, {
url : res.url,
session : args.session,
requestObject : args.requestObject
}, {
fn : this._callRequestCallback,
scope : this,
args : args
});
}
}
|
javascript
|
{
"resource": ""
}
|
|
q56896
|
train
|
function (res, args) {
var resFromFilters = args.res;
// set final error flag
if (resFromFilters.errorData) {
res.error = true;
}
// resFromFilters as precedence over handler response
if (resFromFilters.data) {
res.data = resFromFilters.data;
}
if (resFromFilters.errorData) {
res.errorData = resFromFilters.errorData;
}
if (res.error) {
var errorEvt = {
name : "error",
requestUrl : resFromFilters.requestUrl,
requestObject : args.requestObject,
errorData : res.errorData
};
// add HTTP errors if any
if (resFromFilters.error) {
errorEvt.httpError = {
error : resFromFilters.error,
status : resFromFilters.status
};
}
this.$raiseEvent(errorEvt);
}
// finish by calling the requester callback
this.$callback(args.cb, res, this.CALLBACK_ERROR);
}
|
javascript
|
{
"resource": ""
}
|
|
q56897
|
train
|
function (requestObject, session) {
var typeUtils = ariaUtilsType;
var urlService = requestObject.urlService;
if (!urlService) {
// If no service is set , it takes from app environment
urlService = this.__getUrlService();
}
this.$assert(434, urlService != null);
// If not specified the session is the one stored on this
if (!session) {
session = this.session;
}
// Replace dots by forward slashes in the moduleName passed to actual URL creator
var moduleName = requestObject.moduleName.replace(/\./g, '\/');
var url;
if (typeUtils.isString(requestObject.actionName)) { // We accept also empty strings.
// If in 'action name' mode
/* The actionName from the request object can contain url parameters, this has to handled separately and not
* by the request interface. */
var actionSplit = this.__extractActionName(requestObject.actionName);
// Let the implementation compute the URL
url = urlService.createActionUrl(moduleName, actionSplit.name, session.id);
} else if (requestObject.serviceSpec) {
/* using the 'service specification' mode. No particular URL parameters handling
* here, all is under UrlService responsibility */
url = urlService.createServiceUrl(moduleName, requestObject.serviceSpec, session.id);
} else {
// error : one of serviceSpec or actionName must be present
this.$logError(this.MISSING_SERVICESPEC, [url]);
return null;
}
if (!url || (typeUtils.isObject(url) && !url.url)) {
this.$logError(this.INVALID_BASEURL, [url]);
return null;
}
if (typeUtils.isString(url)) {
// if raw string returned, convert it in structured request here
url = {
url : url
};
}
// if not specified, assume POST method (backward-compatibility)
if (!url.method) {
url.method = "POST";
}
if (requestObject.actionName) {
// If in 'action name' mode, add the action parameters
url.url = this.__appendActionParameters(url.url, actionSplit.params);
}
// Add the global parameters
url.url = this.__appendGlobalParams(url.url, this._params);
return url;
}
|
javascript
|
{
"resource": ""
}
|
|
q56898
|
train
|
function (moduleName, locale, callback) {
var urlServiceCfg = ariaModulesUrlServiceEnvironmentUrlService.getUrlServiceCfg();
Aria.load({
classes : [urlServiceCfg.implementation],
oncomplete : {
fn : this.__onI18nReady,
scope : this,
args : {
moduleName : moduleName,
locale : locale,
callback : callback
}
}
});
}
|
javascript
|
{
"resource": ""
}
|
|
q56899
|
train
|
function (args) {
var urlService = this.__getUrlService();
this.$assert(595, urlService != null);
var url = urlService.createI18nUrl(args.moduleName, this.session.id, args.locale);
// Add the global parameters
url = this.__appendGlobalParams(url, this._params);
// Add the url to the callback
// Changing the callback arguments is BAD. Keeping this only for backward compatibility.
// The right way to pass a result is by using the second parameter of $callback.
args.callback.args = args.callback.args || {};
args.callback.args.full = url;
this.$callback(args.callback, url);
}
|
javascript
|
{
"resource": ""
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.