_id
stringlengths 2
6
| title
stringlengths 0
58
| partition
stringclasses 3
values | text
stringlengths 52
373k
| language
stringclasses 1
value | meta_information
dict |
|---|---|---|---|---|---|
q57100
|
train
|
function (value) {
if (this.options) {
for (var i = 0, l = this.options.length; i < l; i++) {
if (this.options[i].value === value) {
return i;
}
}
}
return -1;
}
|
javascript
|
{
"resource": ""
}
|
|
q57101
|
train
|
function () {
var bind = this._bindingListeners.value;
if (bind) {
var selectedIndex = this._domElt.selectedIndex;
var value = "";
if (selectedIndex != -1) {
value = this.options[this._domElt.selectedIndex].value;
}
var newValue = this._transform(bind.transform, value, "fromWidget");
ariaUtilsJson.setValue(bind.inside, bind.to, newValue, bind.cb);
}
}
|
javascript
|
{
"resource": ""
}
|
|
q57102
|
train
|
function () {
var bind = this._bindingListeners.selectedIndex;
if (bind) {
var newIndex = this._transform(bind.transform, this._domElt.selectedIndex, "fromWidget");
ariaUtilsJson.setValue(bind.inside, bind.to, newIndex, bind.cb);
}
}
|
javascript
|
{
"resource": ""
}
|
|
q57103
|
train
|
function (jsonData, requestObject) {
var reqSerializer = requestObject ? requestObject.requestJsonSerializer : null;
var options = reqSerializer ? reqSerializer.options : null;
var instance = reqSerializer ? reqSerializer.instance : null;
if (instance) {
return ariaUtilsJson.convertToJsonString(jsonData, ariaUtilsJson.copy(options, true), instance);
} else {
options = options || this._requestJsonSerializer.options;
instance = this._requestJsonSerializer.instance;
return ariaUtilsJson.convertToJsonString(jsonData, ariaUtilsJson.copy(options, true), instance);
}
}
|
javascript
|
{
"resource": ""
}
|
|
q57104
|
train
|
function (event) {
this.$AutoComplete._dom_onclick.call(this, event);
var element = event.target;
if (element.className === "closeBtn") {
this._removeMultiselectValue(element, event);
this._textInputField.focus();
}
if (element.className.indexOf("xMultiAutoComplete_Option_Text") != -1) {
var highlightedSuggestions = this.getHighlight();
var index = this._getIndexFromNode(element.parentNode);
if (this.controller.freeText && ariaUtilsJson.equals(highlightedSuggestions, [index])) {
this._editMultiselectValue(element);
} else {
this.highlightOption(index);
}
}
this.__resizeInput();
}
|
javascript
|
{
"resource": ""
}
|
|
q57105
|
train
|
function () {
var skinObj = this._skinObj, frame = this._frame, obj = this._textInputField;
if (obj) {
var frameWidth = frame.innerWidth - skinObj.innerPaddingLeft - skinObj.innerPaddingRight, inputWidth = obj.offsetLeft;
obj.style.width = (frameWidth - inputWidth - 4) + "px";// tolerance of 1 character
}
}
|
javascript
|
{
"resource": ""
}
|
|
q57106
|
train
|
function () {
this.$AutoComplete.initWidget.call(this);
var cfg = this._cfg;
if (cfg.value) {
var report = this.controller.checkValue(cfg.value);
this._reactToControllerReport(report);
}
}
|
javascript
|
{
"resource": ""
}
|
|
q57107
|
train
|
function (value) {
var cfg = this._cfg;
var label = ariaUtilsString.escapeHTML(value.label || value);
return '<div class="xMultiAutoComplete_' + cfg.sclass
+ '_options"><span class="xMultiAutoComplete_Option_Text">' + label
+ '</span><span class="closeBtn"></span></div>';
}
|
javascript
|
{
"resource": ""
}
|
|
q57108
|
train
|
function (input) {
var ellipsisContainer = input.previousSibling, elementoffsetWidth = ellipsisContainer.offsetWidth, frameWidth = this._frame.innerWidth;
// 10 is to consider margin and padding
if (elementoffsetWidth >= (frameWidth - 10)) {
ellipsisContainer.firstChild.className += " ellipsisClass";
var elementWidth = frameWidth - ellipsisContainer.offsetLeft
- (ellipsisContainer.firstChild.offsetLeft + ellipsisContainer.lastChild.offsetWidth) * 2;
ellipsisContainer.firstChild.style.maxWidth = elementWidth + "px";
}
}
|
javascript
|
{
"resource": ""
}
|
|
q57109
|
train
|
function (event) {
if (event.type == "dblclick" && this.controller.freeText) {
var element = event.target;
if (element.className.indexOf("xMultiAutoComplete_Option_Text") != -1) {
this._editMultiselectValue(element, event);
}
}
}
|
javascript
|
{
"resource": ""
}
|
|
q57110
|
train
|
function (event) {
var inputField = this.getTextInputField();
var blurredElement = event.target;
if (blurredElement === inputField) {
if (inputField.nextSibling != null && inputField.value === "") {
this._makeInputFieldLastChild();
}
} else if (blurredElement.parentNode.className.indexOf("highlight") != -1) {
this.unhighlightOption(blurredElement.parentNode);
}
// call TextInput onblur handler with avoidCallback set to true
this.$TextInput._dom_onblur.call(this, event, true);
if (this._cfg.onblur) {
// timeout is needed to retrieve (on every browser) the activeElement
ariaCoreTimer.addCallback({
fn : function () {
var isAncestor = ariaUtilsDom.isAncestor;
var focusedEl = Aria.$window.document.activeElement;
// if onblur is defined and window lost focus ( ==null ) or if focus is not in the widget or
// dropdown element
if (this._cfg
&& (focusedEl == null || ((this._dropdownPopup == null || !isAncestor(focusedEl, this._dropdownPopup.domElement)) && !isAncestor(focusedEl, this._domElt)))) {
this.evalCallback(this._cfg.onblur);
}
},
scope : this,
delay : 100
});
}
}
|
javascript
|
{
"resource": ""
}
|
|
q57111
|
train
|
function (event) {
// flag that avoids to trigger the user callback when browsing the checkbox list
var avoidCallback = (this._hasFocus || this._keepFocus);
this.$TextInput._dom_onfocus.call(this, event, true);
if (this._cfg.onfocus && !avoidCallback) {
this.evalCallback(this._cfg.onfocus);
}
}
|
javascript
|
{
"resource": ""
}
|
|
q57112
|
train
|
function () {
var inputField = this._textInputField;
var inputFieldParent = inputField.parentNode;
if (inputFieldParent.lastChild !== inputField) {
inputFieldParent.removeChild(inputField);
inputFieldParent.appendChild(inputField);
inputField.style.width = "0px";
this.__resizeInput();
}
}
|
javascript
|
{
"resource": ""
}
|
|
q57113
|
train
|
function (domElement, event, isParent) {
var parent = (!isParent) ? domElement.parentNode : domElement;
var domUtil = ariaUtilsDom;
var label = parent.firstChild.textContent || parent.firstChild.innerText;
domUtil.removeElement(parent);
this._removeValue(label);
if (event && event.type == "click") {
this.getTextInputField().focus();
}
}
|
javascript
|
{
"resource": ""
}
|
|
q57114
|
train
|
function (domElement, event) {
var label;
var domUtil = ariaUtilsDom;
label = domElement.textContent || domElement.innerText;
domUtil.replaceDomElement(domElement.parentNode, this._textInputField);
var removedSuggestionInfo = this._removeValue(label);
var removedSuggestion = removedSuggestionInfo.removedSuggestion;
var removedSuggestionIndex = removedSuggestionInfo.removedSuggestionIndex;
this._keepFocus = true;
this._textInputField.focus();
if (removedSuggestion) {
var report = this.controller.editValue(removedSuggestion, removedSuggestionIndex);
this._reactToControllerReport(report);
}
this._restoreKeepFocus();
}
|
javascript
|
{
"resource": ""
}
|
|
q57115
|
train
|
function (label) {
var report = this.controller.removeValue(label);
var removedSuggestion = report.removedSuggestion;
var removedSuggestionIndex = report.removedSuggestionIndex;
this._reactToControllerReport(report);
this._textInputField.style.width = "0px";
this.__resizeInput();
return {
removedSuggestion : removedSuggestion,
removedSuggestionIndex : removedSuggestionIndex
};
}
|
javascript
|
{
"resource": ""
}
|
|
q57116
|
train
|
function (suggestionNode, className) {
var suggestionNodeClassList = new aria.utils.ClassList(suggestionNode);
suggestionNodeClassList.remove(className);
suggestionNodeClassList.$dispose();
}
|
javascript
|
{
"resource": ""
}
|
|
q57117
|
train
|
function (suggestionNode) {
if (suggestionNode == null) {
suggestionNode = Aria.$window.document.activeElement;
if (suggestionNode.className.indexOf("highlight") === -1) {
suggestionNode = this._getSuggestionsContainer().children[this.getHighlightedOptionIndex() - 1];
}
// TODO Get currently focused element and check this is an highlighted option...
}
if (suggestionNode != null) {
this._removeClass(suggestionNode, 'highlight');
suggestionNode.firstChild.removeAttribute('tabindex');
}
}
|
javascript
|
{
"resource": ""
}
|
|
q57118
|
train
|
function (suggestionNode, className) {
var suggestionNodeClassList = new aria.utils.ClassList(suggestionNode);
suggestionNodeClassList.add(className);
suggestionNodeClassList.$dispose();
}
|
javascript
|
{
"resource": ""
}
|
|
q57119
|
train
|
function (index) {
var count = this.insertedOptionsCount();
if (index < 1 || index > count) {
this.$logError(this.INDEX_OUT_OF_BOUNDS, [count, index]);
return;
}
this.removeHighlight();
var suggestionNode = this._getSuggestionsContainer().children[index - 1];
this._addClass(suggestionNode, 'highlight');
suggestionNode.firstChild.setAttribute('tabindex', 0);
suggestionNode.firstChild.focus();
}
|
javascript
|
{
"resource": ""
}
|
|
q57120
|
train
|
function () {
var suggestionContainer = this._textInputField.parentNode;
var highlightedArray = [];
for (var i = 0; i < suggestionContainer.children.length - 1; i++) {
var suggestionNode = suggestionContainer.children[i];
var suggestionNodeClassList = new aria.utils.ClassList(suggestionNode);
if (suggestionNodeClassList.contains("highlight")) {
highlightedArray.push(i + 1);
}
suggestionNodeClassList.$dispose();
}
return highlightedArray;
}
|
javascript
|
{
"resource": ""
}
|
|
q57121
|
train
|
function () {
var maxCount = 0, suggestion = this.controller.selectedSuggestions;
if (suggestion.length < this.controller.maxOptions) {
return this.controller.maxOptions;
} else {
for (var i = 0, len = suggestion.length; i < len; i++) {
if (ariaUtilsType.isObject(suggestion[i])) {
maxCount++;
}
}
return maxCount;
}
}
|
javascript
|
{
"resource": ""
}
|
|
q57122
|
train
|
function () {
var indexes = this.getHighlight();
var rightMostIndex = indexes[indexes.length - 1];
var limit = this.insertedOptionsCount();
var index = rightMostIndex + 1;
if (index <= limit) {
this.highlightOption(index);
} else {
this.removeHighlight();
this._enterInputField();
}
}
|
javascript
|
{
"resource": ""
}
|
|
q57123
|
train
|
function (text, options) {
// -------------------------------------- input arguments processing
var document = Aria.$window.document;
if (options == null) {
options = {};
}
var parent = options.parent;
if (parent == null) {
parent = document.body;
}
var alert = options.alert;
// ------------------------------------------------------ processing
var waiReadTextElt = document.createElement("span");
waiReadTextElt.className = "xSROnly";
waiReadTextElt.setAttribute("role", alert ? "alert" : "status");
waiReadTextElt.setAttribute("aria-live", "assertive");
waiReadTextElt.setAttribute("aria-relevant", "additions");
if (alert) {
waiReadTextElt.style.visibility = "hidden";
}
parent.appendChild(waiReadTextElt);
var textChild = document.createElement("span");
var textNode = document.createTextNode(text);
textChild.appendChild(textNode);
waiReadTextElt.appendChild(textChild);
if (alert) {
waiReadTextElt.style.visibility = "visible";
}
setTimeout(function () {
// remove the node after 10ms
ariaUtilsDom.removeElement(waiReadTextElt);
}, 10);
}
|
javascript
|
{
"resource": ""
}
|
|
q57124
|
fallback
|
train
|
function fallback (self, instance) {
self._get = instance._get;
self._set = instance._set;
self._remove = instance._remove;
self._clear = instance._clear;
self.storage = ariaStorageUserData._STORAGE;
self.__keys = ariaStorageUserData._ALL_KEYS;
}
|
javascript
|
{
"resource": ""
}
|
q57125
|
train
|
function (options) {
var isIE7 = ariaCoreBrowser.isIE7;
// Throw an error only in IE7
this.$HTML5Storage.constructor.call(this, options, "localStorage", !isIE7);
if (!this.storage && isIE7) {
var instance = new ariaStorageUserData(options);
fallback(this, instance);
/**
* Whether or not this instance is using a fallback mechanism for localStorage
* @type aria.storage.UserData
* @protected
*/
this._fallback = instance;
}
}
|
javascript
|
{
"resource": ""
}
|
|
q57126
|
train
|
function (property, recursive) {
var metaName = recursive ? jsonUtils.META_FOR_RECLISTENERS : jsonUtils.META_FOR_LISTENERS;
if (property != null) {// the comparison with null is important, as 0 or "" must be considered as valid
// property names
metaName += "_" + property;
}
return metaName;
}
|
javascript
|
{
"resource": ""
}
|
|
q57127
|
train
|
function (child, parent, oldProperty, newProperty) {
var childParents = child ? child[parProp] : null;
if (childParents) {
for (var index = 0, parentDescription; parentDescription = childParents[index]; index++) {
if (parentDescription.parent == parent && parentDescription.property == oldProperty) {
parentDescription.property = newProperty;
// there should be only one.
break;
}
}
}
}
|
javascript
|
{
"resource": ""
}
|
|
q57128
|
train
|
function (propertyName) {
if (!ariaUtilsType.isString(propertyName)) {
return true;
}
// which property names are included for back references
return (propertyName != jsonUtils.OBJECT_PARENT_PROPERTY &&
propertyName.substr(0, jsonUtils.META_FOR_LISTENERS.length) != jsonUtils.META_FOR_LISTENERS &&
propertyName.substr(0, jsonUtils.META_FOR_RECLISTENERS.length) != jsonUtils.META_FOR_RECLISTENERS);
}
|
javascript
|
{
"resource": ""
}
|
|
q57129
|
train
|
function (node) {
var recMarker = jsonUtils.TEMP_REC_MARKER;
if (node[recMarker]) {
node[recMarker] = false;
delete node[recMarker];
var parents = node[jsonUtils.OBJECT_PARENT_PROPERTY];
if (parents) {
for (var index = 0, l = parents.length; index < l; index++) {
__cleanUpRecMarkers(parents[index].parent);
}
}
}
}
|
javascript
|
{
"resource": ""
}
|
|
q57130
|
train
|
function (newListeners, existingListeners) {
if (newListeners != null) {
if (!existingListeners) {
existingListeners = [];
}
existingListeners.push.apply(existingListeners, newListeners);
}
return existingListeners;
}
|
javascript
|
{
"resource": ""
}
|
|
q57131
|
train
|
function (node, property, recursive, listeners) {
if (property != null) {
// add property specific listeners
listeners = __retrievePropertySpecificListeners(node, property, recursive, listeners);
}
// recursive check
if (node[jsonUtils.TEMP_REC_MARKER]) {
return listeners;
}
// add general listeners
listeners = __retrievePropertySpecificListeners(node, null, recursive, listeners);
// case parent property is defined: look for "recursive" listener in parent nodes
var parents = node[jsonUtils.OBJECT_PARENT_PROPERTY];
if (parents) {
// mark this node has being visited
node[jsonUtils.TEMP_REC_MARKER] = true;
for (var index = 0, parentDesc; parentDesc = parents[index]; index++) {
listeners = __retrieveListeners(parentDesc.parent, parentDesc.property, true, listeners);
}
// at the end, clean recursive markup (only first call will have recursive set to null)
if (!recursive) {
__cleanUpRecMarkers(node);
}
}
return listeners;
}
|
javascript
|
{
"resource": ""
}
|
|
q57132
|
train
|
function (listeners, change, listenerToExclude) {
for (var idx = 0, length = listeners.length; idx < length; idx++) {
var lsn = listeners[idx];
if (lsn == listenerToExclude || !lsn) {
continue;
}
var fn = lsn.fn;
if (fn) {
// note that calling $callback has an impact on performances (x2)
// that's why we don't do it here
fn.call(lsn.scope, change, lsn.args);
}
}
}
|
javascript
|
{
"resource": ""
}
|
|
q57133
|
train
|
function (container, property, change, listenerToExclude) {
// retrieve listeners for this node and its parents
// arguments given to the callback
var listeners = __retrieveListeners(container, property);
if (listeners) {
change.dataHolder = container;
change.dataName = property;
__callListeners(listeners, change, listenerToExclude);
}
}
|
javascript
|
{
"resource": ""
}
|
|
q57134
|
train
|
function (container) {
if (container[parProp]) {
// back references already present, nothing to do
return;
}
// back references are not present yet
container[parProp] = [];
for (var childName in container) {
if (container.hasOwnProperty(childName) && __includePropForBackRef(childName)) {
var childValue = container[childName];
if (__isValidContainer(childValue)) {
this.__checkBackRefs(childValue);
// Add the container reference and property name to the child 'aria:parent' array
childValue[parProp].push({
parent : container,
property : childName
});
this.$raiseEvent({
name : 'aria-parent-metadata-added',
child: childValue,
parent: container,
property: childName
});
}
}
}
}
|
javascript
|
{
"resource": ""
}
|
|
q57135
|
train
|
function (item, options, serializerInstance) {
if (serializerInstance) {
if ("serialize" in serializerInstance) {
return serializerInstance.serialize(item, options);
} else {
this.$logError(this.INVALID_JSON_SERIALIZER_INSTANCE);
return null;
}
}
return this.__defaultJsonSerializer.serialize(item, options);
}
|
javascript
|
{
"resource": ""
}
|
|
q57136
|
train
|
function (str, ctxt, errMsg) {
var JSON = Aria.$global.JSON;
if (ctxt && ctxt.$classpath) {
ctxt = ctxt.$classpath;
}
if (typeof JSON !== "undefined" && typeof JSON.parse === "function") {
try {
return JSON.parse(str);
} catch (ex) {
// Fallback to eval
this.$logWarn(this.INVALID_JSON_SYNTAX, [ctxt, str]);
return this._loadWithEval(str, ctxt, errMsg);
}
}
return this._loadWithEval(str, ctxt, errMsg);
}
|
javascript
|
{
"resource": ""
}
|
|
q57137
|
train
|
function (str, ctxt, errMsg) {
var res = null;
try {
str = ('' + str).replace(/^\s/, ''); // remove first spaces
res = Aria["eval"]('return (' + str + ');');
} catch (ex) {
if (!errMsg) {
errMsg = this.INVALID_JSON_CONTENT;
}
this.$logError(errMsg, [ctxt, str], ex);
}
return res;
}
|
javascript
|
{
"resource": ""
}
|
|
q57138
|
train
|
function (big, small) {
var isBigArray = typeUtils.isArray(big), isBigObject = typeUtils.isObject(big), isSmallArray = typeUtils.isArray(small), isSmallObject = typeUtils.isObject(small);
if (isBigArray && isSmallArray) {
for (var i = 0, l = small.length; i < l; i++) {
if (!this.contains(big[i], small[i])) {
return false;
}
}
} else if (isBigObject && isSmallObject) {
for (var key in small) {
if (small.hasOwnProperty(key)) {
if (key.match(/:/)) {
continue; // meta-data: we don't copy them
}
if (small.hasOwnProperty(key)) {
if (!this.contains(big[key], small[key])) {
return false;
}
}
}
}
} else {
var allTime = (typeUtils.isDate(big) && typeUtils.isDate(small));
if (allTime) {
return (small.getTime() === big.getTime());
} else {
return small === big;
}
}
return true;
}
|
javascript
|
{
"resource": ""
}
|
|
q57139
|
train
|
function (array, item, index) {
if (index == null) {
index = array.length;
}
this.splice(array, index, 0, item);
}
|
javascript
|
{
"resource": ""
}
|
|
q57140
|
train
|
function (container) {
var raw = ariaUtilsObject.keys(container);
return ariaUtilsArray.filter(raw, function (key) {
return !aria.utils.Json.isMetadata(key);
});
}
|
javascript
|
{
"resource": ""
}
|
|
q57141
|
train
|
function (object) {
if (!object || !__isValidContainer(object)) {
return object;
}
var clone = typeUtils.isArray(object) ? [] : {};
for (var key in object) {
if (!this.isMetadata(key)) {
clone[key] = this.removeMetadata(object[key]);
}
}
return clone;
}
|
javascript
|
{
"resource": ""
}
|
|
q57142
|
train
|
function( left, right) {
var isLeftArray = typeUtils.isArray(left),
isLeftObject = typeUtils.isObject(left),
isRightArray = typeUtils.isArray(right),
isRightObject = typeUtils.isObject(right),
leftDiff = null,
rightDiff = null,
__processContainer = function(list, __getKey) {
var key, diff;
for (var i = 0, l = list.length; i < l; i++) {
key = __getKey(i, list);
if ( (key.match && key.match(/:/)) || (left[key] === undefined && right[key] === undefined) ) {
continue;
}
diff = this.equalsDiff(left[key], right[key]);
if (!diff.equals) {
if (!leftDiff && !rightDiff) {
leftDiff = {};
rightDiff = {};
}
leftDiff[key] = diff.left;
rightDiff[key] = diff.right;
}
}
};
if (left === right) {
return {
equals : true,
left : null,
right : null
};
}
else if (isLeftArray && isRightArray) {
var longerList = left.length > right.length ? left : right;
__processContainer.call(this, longerList, function(i) { return i; });
return {
equals : leftDiff === null && rightDiff === null,
left : leftDiff,
right : rightDiff
};
} else if (isLeftObject && isRightObject) {
var allKeys = this.keys(left),
rightKeys = this.keys(right),
key;
for (var i = 0, l = rightKeys.length; i < l; i++) {
key = rightKeys[i];
if (left[key] === undefined) {
allKeys.push(key);
}
}
__processContainer.call(this, allKeys, function(i, keys) { return keys[i]; } );
return {
equals : leftDiff === null && rightDiff === null,
left : leftDiff,
right : rightDiff
};
} else if (typeUtils.isDate(right) && typeUtils.isDate(left)) {
if (left.getTime() === right.getTime()) {
return {
equals : true,
left : null,
right : null
};
}
}
return {
equals : false,
left : left,
right : right
};
}
|
javascript
|
{
"resource": ""
}
|
|
q57143
|
train
|
function () {
var tplDiv = this._subTplDiv; // may be null at this time
if (tplDiv) {
tplDiv.className = "xTplContent"; // remove the loading indicator
ariaUtilsDom.replaceHTML(tplDiv, "#ERROR WHILE LOADING TEMPLATE#");
}
this._deleteTplcfg();
this.$callback(this.tplLoadCallback, {
success : false
});
}
|
javascript
|
{
"resource": ""
}
|
|
q57144
|
train
|
function () {
var tplcfg = this._tplcfg;
var cfg = this._cfg;
if (this._needCreatingModuleCtrl) {
if (!ariaCoreJsonValidator.normalize({
json : cfg.moduleCtrl,
beanName : "aria.templates.CfgBeans.InitModuleCtrl"
})) {
this._cfgOk = false;
return;
}
} else {
/* TODO: check that cfg.moduleCtrl is a module controller if it is not null */
tplcfg.moduleCtrl = cfg.moduleCtrl;
}
if (cfg.width > -1) {
tplcfg.width = cfg.width;
}
if (cfg.height > -1) {
tplcfg.height = cfg.height;
}
tplcfg.printOptions = cfg.printOptions;
tplcfg.baseTabIndex = cfg.baseTabIndex;
}
|
javascript
|
{
"resource": ""
}
|
|
q57145
|
train
|
function (domElt, sectionObject) {
if (domElt) {
while (domElt.nodeType != 1) {
domElt = domElt.parentNode;
}
}
this.$DomElementWrapper.constructor.call(this, domElt, sectionObject.tplCtxt);
/**
* Dynamically insert an adjacent section, without refreshing any other section.
* @param {String} where May be one of: beforeBegin, afterBegin, beforeEnd, afterEnd
* @param {String|aria.templates.CfgBeans:SectionCfg} sectionParam A string containing the new section id, or an
* object containing the new section configuration.
*/
this.insertAdjacentSection = function (where, sectionParam) {
if (where != "beforeBegin" && where != "afterBegin" && where != "beforeEnd" && where != "afterEnd") {
this.$logError(ariaUtilsDom.INSERT_ADJACENT_INVALID_POSITION, [where]);
return;
}
sectionObject.tplCtxt.insertAdjacentSections({
position : where,
refSection : {
domElt : domElt,
object : sectionObject
},
sections : [sectionParam]
});
};
/**
* Remove the section dynamically from the DOM.
*/
this.remove = function () {
sectionObject.$dispose();
var parentNode = domElt.parentNode;
ariaUtilsDom.removeElement(domElt);
ariaUtilsDom.refreshDomElt(parentNode);
this.$dispose();
};
/**
* Set the state of the processing indicator. It updates the datamodel if the section has a processing binding
* @param {Boolean} visible True if the loading indicator should be visible
* @param {String} message Text message to display inside the loading indicator
*/
this.setProcessingIndicator = function (visible, message) {
sectionObject.setProcessingIndicator(visible, message);
};
var parentClassListSetClassName = this.classList.setClassName;
this.classList.setClassName = function (className) {
parentClassListSetClassName.call(this, className);
sectionObject.updateClassList(className);
};
var parentDispose = this._dispose;
/**
* Clean the variables inside the closure.
* @private
*/
this._dispose = function () {
parentDispose.call(this);
sectionObject = null;
parentDispose = null;
};
}
|
javascript
|
{
"resource": ""
}
|
|
q57146
|
train
|
function (tplCtxt) {
this.$assert(133, tplCtxt.$TemplateCtxt);
var toLoad = tplCtxt.getCSSDependencies();
var tplClasspath = tplCtxt.tplClasspath;
var loadResult = this.loadClassPathDependencies(tplClasspath, toLoad, {
isTemplate : true
});
if (loadResult.changes) {
this.$raiseEvent({
name : "styleChange",
templateClasspath : tplClasspath
});
}
this.$raiseEvent({
name : "dependenciesLoaded",
templateClasspath : tplClasspath
});
return loadResult.classes;
}
|
javascript
|
{
"resource": ""
}
|
|
q57147
|
train
|
function (classpath, dependencies) {
if (this.__cssDependencies[classpath]) {
dependencies = this.__cssDependencies[classpath];
} else {
// Look at in the parents for the css inheritance.
var tpl = Aria.getClassRef(classpath);
var css = {};
if (dependencies) {
for (var i = 0, ii = dependencies.length; i < ii; i++) {
css[Aria.getClasspath(dependencies[i])] = true;
}
}
tpl = tpl.superclass;
while (tpl) {
var $css = tpl.$css;
if ($css) {
for (var i = 0, ii = $css.length; i < ii; i++) {
css[Aria.getClasspath($css[i])] = true;
}
}
tpl = tpl.constructor.superclass;
}
dependencies = ariaUtilsObject.keys(css);
// Store the css dependencies for performance reason
this.__cssDependencies[classpath] = dependencies;
}
var contextArgs = {
isWidget : true
};
this.loadClassPathDependencies(classpath, dependencies, contextArgs);
}
|
javascript
|
{
"resource": ""
}
|
|
q57148
|
train
|
function (tplClasspath, cssClasspath, contextArgs) {
this.$assert(195, tplClasspath && cssClasspath);
// Do something only if this CSS class is not yet loaded
var usage = this.__cssUsage[cssClasspath];
if (usage && usage.length) {
usage.push(tplClasspath);
this.__pathsLoaded.push(cssClasspath);
if (!this.__invalidClasspaths[cssClasspath]) {
return [];
}
} else {
this.__cssUsage[cssClasspath] = [tplClasspath];
}
// Starting from here, nobody is using this css, it should also be added to the DOM
// classpath may be invalid but not currently used
delete this.__invalidClasspaths[cssClasspath];
var cssCtxt = ariaTemplatesCSSCtxtManager.getContext(cssClasspath, contextArgs);
// Give a prefix to the Global file in order to have higher priority
if (cssClasspath == "aria.templates.GlobalStyle" || cssClasspath == "aria.templates.LegacyGeneralStyle"
|| cssClasspath == "aria.widgets.GlobalStyle") {
this.__getPrefix(cssClasspath);
}
if (cssCtxt.doPrefixing()) {
var prefixClass = this.__getPrefix(cssClasspath);
cssCtxt.prefixText(prefixClass);
}
// Remember the text to be loaded
this.__textLoaded[cssClasspath] = {
text : cssCtxt.getText(),
lines : cssCtxt.getNumLines()
};
// Build the association between this classpath and a style tag
var styleTag = this.__getStyleTag(cssCtxt);
this.__styleTagAssociation[cssClasspath] = styleTag;
this.__pathsLoaded.push(cssClasspath);
return [styleTag];
}
|
javascript
|
{
"resource": ""
}
|
|
q57149
|
train
|
function (cssCtxt) {
var classpath = cssCtxt.tplClasspath;
var associatedTo = this.__styleTagAssociation[classpath];
if (associatedTo) {
return associatedTo;
}
if (cssCtxt.isTemplate()) {
associatedTo = "tpl";
} else if (cssCtxt.isWidget()) {
associatedTo = "wgt";
} else {
associatedTo = "pool" + this.__NEXT_TAG_INDEX;
this.__NEXT_TAG_INDEX += 1;
}
return associatedTo;
}
|
javascript
|
{
"resource": ""
}
|
|
q57150
|
train
|
function (classpath, dependencies) {
if (this.__cssDependencies[classpath]) {
dependencies = this.__cssDependencies[classpath];
}
this.unloadClassPathDependencies(classpath, dependencies);
}
|
javascript
|
{
"resource": ""
}
|
|
q57151
|
train
|
function (classpath, dependencies) {
if (!dependencies) {
return;
}
for (var i = 0, len = dependencies.length; i < len; i += 1) {
var cssClasspath = Aria.getClasspath(dependencies[i]);
this.__unload(classpath, cssClasspath);
}
}
|
javascript
|
{
"resource": ""
}
|
|
q57152
|
train
|
function (tplCtxt) {
this.$assert(169, tplCtxt.$TemplateCtxt);
var unload = tplCtxt.getCSSDependencies();
var tplClasspath = tplCtxt.tplClasspath;
this.unloadClassPathDependencies(tplClasspath, unload);
this.$raiseEvent({
name : "dependenciesUnloaded",
templateClasspath : tplClasspath
});
}
|
javascript
|
{
"resource": ""
}
|
|
q57153
|
train
|
function (cssClasspath) {
var prefixClass = this.__prefixes[cssClasspath];
if (!prefixClass) {
prefixClass = this.__PREFIX + this.__NEXT_PREFIX_INDEX;
this.__NEXT_PREFIX_INDEX += 1;
this.__prefixes[cssClasspath] = prefixClass;
}
return prefixClass;
}
|
javascript
|
{
"resource": ""
}
|
|
q57154
|
train
|
function (tplClasspath, cssClasspath) {
this.$assert(230, tplClasspath && cssClasspath);
var removeUtil = ariaUtilsArray.remove;
// There should be someone using this css
var usage = this.__cssUsage[cssClasspath];
if (usage && usage.length) {
removeUtil(usage, tplClasspath);
removeUtil(this.__pathsLoaded, cssClasspath);
if (!usage.length) {
// No other templates depend on this class
delete this.__cssUsage[cssClasspath];
delete this.__textLoaded[cssClasspath];
// keep the prefix in case the css comes back
}
} // else should never be reached
}
|
javascript
|
{
"resource": ""
}
|
|
q57155
|
train
|
function (tagName) {
// A pointer to the style might be already there or an element with the correct id might be there
var tag = this.__styleTagPool[tagName];
if (!tag) {
var id = this.__TAG_PREFX + tagName;
tag = ariaUtilsDom.getElementById(id);
if (!tag) {
// If missing, create one
var document = Aria.$window.document;
var head = document.getElementsByTagName("head")[0];
tag = document.createElement("style");
tag.id = id;
tag.type = "text/css";
tag.media = "all"; // needed as the default media is screen in FF but all in IE
head.appendChild(tag);
tag = head.lastChild;
}
this.__styleTagPool[tagName] = tag;
}
return tag;
}
|
javascript
|
{
"resource": ""
}
|
|
q57156
|
train
|
function () {
// Remove the style tags from the DOM
for (var tagName in this.__styleTagPool) {
if (this.__styleTagPool.hasOwnProperty(tagName)) {
this.__styleTagPool[tagName].parentNode.removeChild(this.__styleTagPool[tagName]);
}
}
if (this.__attachedToWindow) {
ariaUtilsAriaWindow.detachWindow();
this.__attachedToWindow = false;
}
this.__styleTagPool = {};
// Reset the variables
this.__textLoaded = {};
this.__pathsLoaded = [];
this.__prefixes = {};
this.__cssUsage = {};
this.__styleTagAssociation = {};
this.__invalidClasspaths = {};
this.__cssDependencies = {};
// Reset also the singletons
this.__PREFIX = this.classDefinition.$statics.__PREFIX;
this.__NEXT_PREFIX_INDEX = this.classDefinition.$statics.__NEXT_PREFIX_INDEX;
this.__NEXT_TAG_INDEX = this.classDefinition.$statics.__NEXT_TAG_INDEX;
this.__TAG_PREFX = this.classDefinition.$statics.__TAG_PREFX;
}
|
javascript
|
{
"resource": ""
}
|
|
q57157
|
train
|
function (classpath, cssTemplates) {
for (var i = 0, length = cssTemplates.length; i < length; i++) {
var cssClasspath = Aria.getClasspath(cssTemplates[i]);
if (!this.__globalUsage[cssClasspath]) {
this.__globalUsage[cssClasspath] = [];
}
this.__globalUsage[cssClasspath].push(classpath);
}
}
|
javascript
|
{
"resource": ""
}
|
|
q57158
|
train
|
function (classpath, cssTemplates, unload, timestampNextTime) {
var array = ariaUtilsArray, classMgr = ariaCoreClassMgr;
for (var i = 0, length = cssTemplates.length; i < length; i++) {
var cssClasspath = Aria.getClasspath(cssTemplates[i]);
var usage = this.__globalUsage[cssClasspath];
array.remove(usage, classpath);
if (unload) {
classMgr.unloadClass(cssClasspath, timestampNextTime);
// only invalidate if someone else is using it
this.invalidate(cssClasspath, usage.length > 0);
}
}
}
|
javascript
|
{
"resource": ""
}
|
|
q57159
|
train
|
function (msg) {
if (this.utilsType.isObject(msg)) {
this.message = msg;
this.localized_message = msg.localizedMessage;
} else if (this.utilsType.isString(msg)) {
this.localized_message = msg;
this.message = ariaUtilsData.createMessage(msg);
}
}
|
javascript
|
{
"resource": ""
}
|
|
q57160
|
makeUseless
|
train
|
function makeUseless (instance) {
instance.writeMarkup = Aria.empty;
instance.writeMarkupBegin = Aria.empty;
instance.writeMarkupEnd = Aria.empty;
instance.initWidget = Aria.empty;
}
|
javascript
|
{
"resource": ""
}
|
q57161
|
train
|
function () {
var eventListeners = this._cfg.on, hasListeners = false, listArray;
var delegateManager = ariaUtilsDelegate;
var delegateFallbackEvents = [];
for (var listener in eventListeners) {
if (eventListeners.hasOwnProperty(listener)) {
hasListeners = true;
if (!delegateManager.isDelegated(listener)) {
delegateFallbackEvents.push(listener);
}
listArray = eventListeners[listener];
if (!ariaUtilsType.isArray(listArray)) {
listArray = [listArray];
}
for (var i = 0, listCount = listArray.length; i < listCount; i++) {
listArray[i] = this.$normCallback.call(this._context._tpl, listArray[i]);
}
eventListeners[listener] = listArray;
}
}
if (hasListeners) {
this.__delegateId = delegateManager.add({
fn : this._delegate,
scope : this
});
this.__delegateFallbackEvents = delegateFallbackEvents;
}
}
|
javascript
|
{
"resource": ""
}
|
|
q57162
|
train
|
function (event) {
var type = event.type, callbackArray = this._cfg.on[type], callback, returnValue;
if (callbackArray) {
var wrapped = new ariaTemplatesDomEventWrapper(event);
for (var i = 0, listCount = callbackArray.length; i < listCount; i++) {
callback = callbackArray[i];
returnValue = callback.fn.call(callback.scope, wrapped, callback.args);
if (returnValue === false) {
break;
}
}
wrapped.$dispose();
return returnValue;
}
}
|
javascript
|
{
"resource": ""
}
|
|
q57163
|
train
|
function (out) {
var cfg = this._cfg;
var attributes = ariaUtilsHtml.buildAttributeList(cfg.attributes);
var markup = ["<", cfg.tagName, " id='", this._id, "' "];
if (attributes) {
markup.push(attributes, " ");
}
var delegateId = this.__delegateId;
if (delegateId) {
var delegateManager = ariaUtilsDelegate;
markup.push(delegateManager.getMarkup(delegateId), " ");
var delegateFallbackEvents = this.__delegateFallbackEvents;
for (var i = 0, l = delegateFallbackEvents.length; i < l; i++) {
markup.push(delegateManager.getFallbackMarkup(delegateFallbackEvents[i], delegateId, false), " ");
}
}
out.write(markup.join(""));
}
|
javascript
|
{
"resource": ""
}
|
|
q57164
|
train
|
function (args, propertyName) {
if (this._cfg) {
this.onbind(propertyName, this._transform(this._cfg.bind[propertyName].transform, args.newValue, "toWidget"), args.oldValue);
}
}
|
javascript
|
{
"resource": ""
}
|
|
q57165
|
train
|
function (listeners, eventType, callback, after) {
var listArray = listeners[eventType] || [];
if (!ariaUtilsType.isArray(listArray)) {
listArray = [listArray];
}
if (after) {
listArray.push(callback);
} else {
listArray.splice(0, 0, callback);
}
listeners[eventType] = listArray;
}
|
javascript
|
{
"resource": ""
}
|
|
q57166
|
train
|
function (args) {
var output = [args.provider, args.caller];
if (args.onLoad) {
output.push(args.onLoad);
}
if (args.handler) {
output.push(args.handler);
}
if (args.resources) {
output.push(args.resources.join("-"));
}
return output.join("-");
}
|
javascript
|
{
"resource": ""
}
|
|
q57167
|
train
|
function (referencePath, baseLogicalPath, callerClasspath, onLoad, handler) {
var args = convertArguments(arguments);
if (args.onLoad) {
asyncRequire(args.provider).spreadSync(function (providerConstr) {
return fetchDataAfterLoading(providerConstr, args);
}).then(function () {
var callerPrototype = Aria.getClassRef(args.caller).prototype;
callerPrototype[args.onLoad].call(callerPrototype);
}).done();
}
return {
provider : getInstanceFromStore(args)
};
}
|
javascript
|
{
"resource": ""
}
|
|
q57168
|
train
|
function (providerConstr, args) {
return new Promise(function (resolve) {
var instance = new providerConstr();
addInstanceToStore(args, instance);
createGetData(instance, args.caller);
if (args.hasOwnProperty("handler")) {
instance.setHandler(args.handler);
}
if (args.hasOwnProperty("resources")) {
instance.setResources(args.resources);
}
instance.fetchData(resolve, args.caller);
});
}
|
javascript
|
{
"resource": ""
}
|
|
q57169
|
train
|
function (errors, throwsErrors) {
if (errors.length === 0) {
return true;
}
if (!throwsErrors) {
for (var i = 0; i < errors.length; i++) {
this.$logError(errors[i].msgId, errors[i].msgArgs);
}
} else {
var error, logs = aria.core.Log;
// aria.core.Log may not be available
if (logs) {
var messages = [];
for (var i = 0; i < errors.length; i++) {
errors[i].message = logs.prepareLoggedMessage(errors[i].msgId, errors[i].msgArgs);
messages.push(errors[i].message);
}
error = new Error(messages.join('\n'));
} else {
error = new Error();
}
error.errors = errors;
throw error;
}
return false;
}
|
javascript
|
{
"resource": ""
}
|
|
q57170
|
train
|
function (packageDef, typeName) {
var path = {
'$properties' : packageDef.$beans
};
var typeParts = typeName.split('.');
for (var i = 0; i < typeParts.length; i++) {
var elt = typeParts[i];
if (elt == '$contentType' && path.$contentType) {
// the content type of an Array or a Map can be used
// as a type elsewhere
path = path.$contentType;
} else if (typeof(path.$properties) == 'object' && path.$properties != null) {
path = path.$properties[elt];
} else {
path = null;
}
if (typeof(path) != 'object' || path == null) {
this._logError(this.INVALID_TYPE_REF, [typeName, this._currentBeanName, packageDef.$package]);
return this._typeRefError;
}
}
return path;
}
|
javascript
|
{
"resource": ""
}
|
|
q57171
|
train
|
function (typeName, packageDef) {
var packageName, otherBP;
var i = typeName.indexOf(':');
// if no semicolumn, type is defined inside this package
if (i == -1) {
packageName = packageDef.$package;
otherBP = packageDef;
} else {
var ns = typeName.substr(0, i);
typeName = typeName.substr(i + 1);
packageName = (packageDef.$namespaces == null ? null : packageDef.$namespaces[ns]);
if (typeUtils.isObject(packageName)) {
packageName = packageName.$package;
}
if (!packageName) {
this._logError(this.UNDEFINED_PREFIX, [ns, this._currentBeanName]);
return this._typeRefError;
}
}
var fullName = packageName + "." + typeName;
var typeRef = this.__processedBeans[fullName];
if (typeRef) {
return typeRef;
}
if (!otherBP) {
otherBP = this.__loadedBeans[packageName];
if (!otherBP) {
this._logError(this.MISSING_BEANSPACKAGE, [packageName, this._currentBeanName]);
return this._typeRefError;
}
}
typeRef = this.__findTypeInBP(otherBP, typeName);
// update this type name with fully qualified name
if (typeRef != this._typeError && !typeRef[this._MD_TYPENAME]) {
typeRef[this._MD_TYPENAME] = fullName;
}
return typeRef;
}
|
javascript
|
{
"resource": ""
}
|
|
q57172
|
train
|
function (def) {
// prepare error stack
this._errors = [];
var beans = def.$beans;
for (var beanName in beans) {
if (!beans.hasOwnProperty(beanName) || beanName.indexOf(':') != -1) {
continue;
}
// check that keys for beans are valid
if (!Aria.checkJsVarName(beanName)) {
this._logError(this.INVALID_NAME, [beanName, this._currentBeanName]);
}
this._preprocessBean(beans[beanName], def.$package + "." + beanName, def);
}
// Generate fast normalization functions at the end:
var toGenerateFastNorm = this.__toGenerateFastNorm;
while (toGenerateFastNorm.length > 0) {
var beanDef = toGenerateFastNorm.shift();
var baseType = beanDef[this._MD_BASETYPE];
if (baseType.makeFastNorm) {
// generate fast normalizer
baseType.makeFastNorm(beanDef);
}
}
return this._errors;
}
|
javascript
|
{
"resource": ""
}
|
|
q57173
|
train
|
function (beanDef) {
var typeDef = this.__baseTypes[beanDef.$type];
this.$assert(298, typeDef != null);
beanDef[this._MD_BUILTIN] = true;
beanDef[this._MD_BASETYPE] = typeDef;
var beanName = beanDef[this._MD_TYPENAME] = [this._BASE_TYPES_PACKAGE, typeDef.typeName].join('.');
this.__processedBeans[beanName] = beanDef;
return typeDef;
}
|
javascript
|
{
"resource": ""
}
|
|
q57174
|
train
|
function (typeDef) {
this.__baseTypes[typeDef.typeName] = typeDef;
if (!(typeDef.dontSkip || this._options.checkEnabled)) {
typeDef.process = null;
typeDef.preprocess = null;
}
}
|
javascript
|
{
"resource": ""
}
|
|
q57175
|
train
|
function (args) {
var beanDef = (args.beanDef ? args.beanDef : this._getBean(args.beanName));
if (!beanDef) {
this._errors = [];
this._logError(this.BEAN_NOT_FOUND, args.beanName);
return this._errors;
}
this._errors = [];
// launching the validation process
this._checkType({
dataHolder : args,
dataName : 'json',
path : 'ROOT',
value : args.json,
beanDef : beanDef
});
return this._errors;
}
|
javascript
|
{
"resource": ""
}
|
|
q57176
|
train
|
function (beanDef) {
if (this._options.checkBeans && (!this._options.checkMultiTypes)
&& this.__loadedBeans[this._BEANS_SCHEMA_PACKAGE]) {
var baseType = beanDef[this._MD_BASETYPE];
if (baseType == this._typeError) {
return false;
}
var beanChecker = this._getBean(this._BEANS_SCHEMA_PACKAGE + '.' + baseType.typeName);
this.$assert(402, beanChecker != null); // every type must be defined in the schema
// make a copy of current errors as normalization will erase them
var currentErrors = this._errors;
var errors = this._processJsonValidation({
beanDef : beanChecker,
json : beanDef
});
// restaure errors
this._errors = currentErrors;
if (errors.length > 0) {
this._logError(this.BEANCHECK_FAILED, [this._currentBeanName, errors]);
return false;
}
}
return true;
}
|
javascript
|
{
"resource": ""
}
|
|
q57177
|
train
|
function (bp) {
var noerrors = true;
// bean definition will be available in the waiting beans
var def = this.__waitingBeans[bp];
delete this.__waitingBeans[bp];
this.$assert(58, def);
var compiled = def.$compiled;
if (compiled) {
def.$beans = compiled(registerBean(def.$package), getBean, require("./JsonTypesCheck").fastNormalizers);
} else {
// validate incoming definition
if (this._options.checkBeans && this.__loadedBeans[this._BEANS_SCHEMA_PACKAGE]) {
var bean = this._getBean(this._BEANS_SCHEMA_PACKAGE + '.Package');
this.$assert(428, bean != null);
noerrors = noerrors && this.__logAllErrors(this._processJsonValidation({
beanDef : bean,
json : def
}));
}
// do not add defaults to default values (to be consistent with fast normalization)
this._options.addDefaults = false;
noerrors = noerrors && this.__logAllErrors(this.__preprocessBP(def));
}
if (noerrors) {
this.__loadedBeans[bp] = def;
return def;
} else {
throw new Error("Error while loading " + bp);
}
}
|
javascript
|
{
"resource": ""
}
|
|
q57178
|
train
|
function (def) {
var bp = def.$package; // beans package
Aria.$classes.push({
$classpath : bp
});
this.__waitingBeans[bp] = def;
var dep = [];
// load missing dependencies
// add $dependencies
var dependencies = def.$dependencies || [];
if (dependencies.length) {
dep = dep.concat(dependencies);
}
// add bean definition from namespaces
for (var key in def.$namespaces) {
if (def.$namespaces.hasOwnProperty(key)) {
dep.push(def.$namespaces[key]);
}
}
return Aria.loadOldDependencies({
classpaths : {
"JS" : dep
},
classDefinition : def,
complete : {
scope : this,
fn : this.__loadBeans,
args : [bp]
}
});
}
|
javascript
|
{
"resource": ""
}
|
|
q57179
|
train
|
function (json, beanName, throwsErrors) {
if (!this._options.checkEnabled) {
return true;
}
this._options.addDefaults = false;
return this.__logAllErrors(this._processJsonValidation({
json : json,
beanName : beanName
}), throwsErrors);
}
|
javascript
|
{
"resource": ""
}
|
|
q57180
|
train
|
function (domElt) {
this.setClassName = function (className) {
domElt.className = className;
};
this.getClassName = function () {
return domElt.className;
};
this._dispose = function () {
domElt = null;
this._dispose = null;
};
}
|
javascript
|
{
"resource": ""
}
|
|
q57181
|
train
|
function (className) {
var classes = this.getClassName().split(" ");
for (var i = 0, ii = classes.length; i < ii; i++) {
if (classes[i] == className) {
return true;
}
}
return false;
}
|
javascript
|
{
"resource": ""
}
|
|
q57182
|
train
|
function (oldClassName, newClassName) {
var rem = [], add = [];
if (!!oldClassName) {
rem = (typeof oldClassName == "string") ? oldClassName.split(" ") : oldClassName;
}
if (!!newClassName) {
add = (typeof newClassName == "string") ? newClassName.split(" ") : newClassName;
}
var classString = this.getClassName(), found = false;
var classes = !!classString ? classString.split(" ") : [];
// Remove oldClassNames
for (var j = classes.length - 1; j >= 0; j -= 1) {
if (!classes[j]) {
classes.splice(j, 1);
continue;
}
// Remove duplicates
for (var d = add.length - 1; d >= 0; d -= 1) {
if (classes[j] == add[d]) {
// Remove it from classes as I'm going to add it again
classes.splice(j, 1);
}
}
for (var k = rem.length - 1; k >= 0; k -= 1) {
if (classes[j] == rem[k]) {
classes.splice(j, 1);
found = true; // Iterate for multiple classes
}
}
}
if (!found && add.length === 0) {
return;
}
classes.push.apply(classes, add);
this.setClassName(classes.join(" "));
}
|
javascript
|
{
"resource": ""
}
|
|
q57183
|
train
|
function () {
return [{
evt : this.touchEventMap.touchmove,
cb : {
fn : this._pinchMove,
scope : this
}
}, {
evt : this.touchEventMap.touchend,
cb : {
fn : this._pinchEnd,
scope : this
}
}];
}
|
javascript
|
{
"resource": ""
}
|
|
q57184
|
train
|
function (x1, y1, x2, y2) {
return Math.atan2(y2 - y1, x2 - x1) * 180 / Math.PI;
}
|
javascript
|
{
"resource": ""
}
|
|
q57185
|
train
|
function (cfg, context, lineNumber) {
this.$BindableWidget.constructor.apply(this, arguments);
this._cfgOk = ariaCoreJsonValidator.validateCfg(this.WIDGET_CFG, cfg);
if (!this._cfgOk) {
return;
}
this._registerBindings();
/**
* Id generated for the button DOM element of the slider.
* @type String
* @protected
*/
this._domId = cfg.id ? context.$getId(cfg.id) : this._createDynamicId();
}
|
javascript
|
{
"resource": ""
}
|
|
q57186
|
train
|
function (out) {
out.write("<div class=\"" + this.CSS_CLASS + "\">");
if (this._cfg.contentMacro) {
out.callMacro(this._cfg.contentMacro);
}
out.write("</div>");
}
|
javascript
|
{
"resource": ""
}
|
|
q57187
|
train
|
function () {
var cfg = this._cfg;
var refreshParams = {
section : "__popup_" + this._domId,
writerCallback : {
fn : this._writerCallback,
scope : this
}
};
var section = this._context.getRefreshedSection(refreshParams);
var popup = new aria.popups.Popup();
this._popup = popup;
popup.$on({
"onAfterClose" : this.disposePopup,
scope : this
});
// default the position to 0,0 if nothing is defined
if (cfg.domReference === null && cfg.referenceId === null && cfg.absolutePosition === null
&& cfg.center === false) {
cfg.absolutePosition = {
top : 0,
left : 0
};
}
var domReference = null;
if (cfg.domReference) {
domReference = cfg.domReference;
} else if (cfg.referenceId) {
domReference = ariaUtilsDom.getElementById(this._context.$getId(cfg.referenceId));
}
popup.open({
section : section,
keepSection : true,
modal : cfg.modal,
maskCssClass : cfg.maskCssClass,
domReference : domReference,
absolutePosition : cfg.absolutePosition,
center : cfg.center,
maximized : cfg.maximized,
closeOnMouseClick : cfg.closeOnMouseClick,
closeOnMouseScroll : cfg.closeOnMouseScroll,
closeOnMouseOut : cfg.closeOnMouseOut,
closeOnMouseOutDelay : cfg.closeOnMouseOutDelay,
preferredPositions : cfg.preferredPositions,
offset : cfg.offset,
ignoreClicksOn : cfg.ignoreClicksOn,
parentDialog : cfg.parentDialog,
zIndexKeepOpenOrder : cfg.zIndexKeepOpenOrder,
preferredWidth : cfg.preferredWidth,
animateOut : cfg.animateOut,
animateIn : cfg.animateIn
});
}
|
javascript
|
{
"resource": ""
}
|
|
q57188
|
train
|
function () {
for (var i = this.openedPopups.length - 1; i >= 0; i--) {
var popup = this.openedPopups[i];
popup.close();
}
}
|
javascript
|
{
"resource": ""
}
|
|
q57189
|
train
|
function (domEvent, popup) {
var documentScroll = ariaUtilsDom._getDocumentScroll();
var clickPosition = {
'top' : domEvent.clientY + documentScroll.scrollTop,
'left' : domEvent.clientX + documentScroll.scrollLeft
};
var popupPosition = {
'top' : popup.computedStyle.top,
'left' : popup.computedStyle.left
};
var popupSize = {
'width' : popup.computedStyle.width,
'height' : popup.computedStyle.height
};
return (clickPosition.top >= popupPosition.top && clickPosition.left >= popupPosition.left
&& clickPosition.top <= popupPosition.top + popupSize.height && clickPosition.left <= popupPosition.left
+ popupSize.width);
}
|
javascript
|
{
"resource": ""
}
|
|
q57190
|
train
|
function () {
for (var i = this.popups.length - 1; i >= 0; i--) {
var popup = this.popups[i];
this.unregisterPopup(popup);
}
}
|
javascript
|
{
"resource": ""
}
|
|
q57191
|
train
|
function () {
this.disconnectEvents();
ariaUtilsAriaWindow.attachWindow();
this._document = Aria.$window.document;
utilsEvent.addListener(this._document, "mousedown", {
fn : this.onDocumentClick,
scope : this
}, true);
utilsEvent.addListener(this._document, "touchend", {
fn : this.onDocumentClick,
scope : this
}, true);
utilsEvent.addListener(this._document, "mouseout", {
fn : this.onDocumentMouseOut,
scope : this
}, true);
utilsEvent.addListener(this._document, "mousewheel", {
fn : this.onDocumentMouseScroll,
scope : this
}, true);
utilsEvent.addListener(this._document.body, "focusin", {
fn : this.onDocumentFocusIn,
scope : this
});
if (ariaCoreBrowser.isOldIE) {
// IE does not support scroll event on the document until IE9
ariaUtilsEvent.addListener(Aria.$window, "mousewheel", {
fn : this._onScroll,
scope : this
}, true);
} else {
// All other browsers support scroll event on the document
ariaUtilsEvent.addListener(Aria.$window, "scroll", {
fn : this._onScroll,
scope : this
}, true);
}
}
|
javascript
|
{
"resource": ""
}
|
|
q57192
|
train
|
function () {
if (this._document) {
utilsEvent.removeListener(this._document, "mousedown", {
fn : this.onDocumentClick
});
utilsEvent.removeListener(this._document, "touchend", {
fn : this.onDocumentClick
});
utilsEvent.removeListener(this._document, "mouseout", {
fn : this.onDocumentMouseOut
});
utilsEvent.removeListener(this._document, "mousewheel", {
fn : this.onDocumentMouseScroll
});
utilsEvent.removeListener(this._document.body, "focusin", {
fn : this.onDocumentFocusIn
});
ariaUtilsAriaWindow.detachWindow();
this._document = null;
if (ariaCoreBrowser.isOldIE) {
ariaUtilsEvent.removeListener(Aria.$window, "mousewheel", {
fn : this._onScroll
});
} else {
ariaUtilsEvent.removeListener(Aria.$window, "scroll", {
fn : this._onScroll
});
}
}
}
|
javascript
|
{
"resource": ""
}
|
|
q57193
|
train
|
function () {
var navManager = ariaTemplatesNavigationManager;
navManager.addGlobalKeyMap({
key : "ESCAPE",
modal : true,
callback : {
fn : this._raiseOnEscapeEvent,
scope : this
}
});
// global navigation is disabled in case of a modal popup
navManager.setModalBehaviour(true);
}
|
javascript
|
{
"resource": ""
}
|
|
q57194
|
train
|
function () {
var navManager = ariaTemplatesNavigationManager;
navManager.removeGlobalKeyMap({
key : "ESCAPE",
modal : true,
callback : {
fn : this._raiseOnEscapeEvent,
scope : this
}
});
// restore globalKeyMap
navManager.setModalBehaviour(false);
}
|
javascript
|
{
"resource": ""
}
|
|
q57195
|
train
|
function () {
for (var i = this.openedPopups.length - 1; i >= 0; i--) {
var popup = this.openedPopups[i];
popup.updatePosition();
}
}
|
javascript
|
{
"resource": ""
}
|
|
q57196
|
train
|
function (event) {
if (event.type === "mousewheel") {
ariaCoreTimer.addCallback({
fn : this.updatePositions,
scope : this
});
} else if (event.type === "scroll") {
this.updatePositions();
}
}
|
javascript
|
{
"resource": ""
}
|
|
q57197
|
train
|
function (target, notifyTargetBehindModalPopup) {
var searchPopup = this._document && target !== this._document.body;
if (searchPopup) {
for (var i = this.openedPopups.length - 1; i >= 0; i--) {
var popup = this.openedPopups[i];
if (utilsDom.isAncestor(target, popup.getDomElement())) {
// the element is in the modal popup, it is fine to focus it
return popup;
}
if (popup.modalMaskDomElement && utilsDom.isAncestor(target, popup.popupContainer.getContainerElt())) {
// the element is inside the container for which there is a modal mask
if (notifyTargetBehindModalPopup) {
return notifyTargetBehindModalPopup(popup);
}
return;
}
}
}
}
|
javascript
|
{
"resource": ""
}
|
|
q57198
|
train
|
function (event) {
var domEvent = new ariaDomEvent(event);
var target = domEvent.target;
var self = this;
var popup = this.findParentPopup(target, function (popup) {
var navigation;
navigation = self._viewportNavigationInterceptor.getNavigationInformation(target);
if (navigation == null) {
navigation = popup.getNavigationInformation(target);
}
var eventObject = {
name: "beforePreventingFocus",
event: domEvent,
modalPopup: popup,
cancel: false,
navigation: navigation
};
self.$raiseEvent(eventObject);
if (!eventObject.cancel) {
var direction;
if (navigation != null) {
direction = navigation.direction;
}
if (direction == null) {
direction = 'forward';
}
var reverse = !!(direction === 'backward');
ariaTemplatesNavigationManager.focusFirst(popup.domElement, reverse);
return popup;
}
// if the focus is allowed, don't return any popup to bring to the front
});
if (popup) {
this.bringToFront(popup);
}
domEvent.$dispose();
}
|
javascript
|
{
"resource": ""
}
|
|
q57199
|
train
|
function () {
var openedPopups = this.openedPopups;
var topPopup = null;
if (openedPopups.length > 0) {
topPopup = openedPopups[openedPopups.length - 1];
var topZIndex = topPopup.getZIndex();
for (var i = openedPopups.length - 2; i >= 0; i--) {
var curPopup = openedPopups[i];
var curZIndex = curPopup.getZIndex();
if (curZIndex > topZIndex) {
topPopup = curPopup;
topZIndex = curZIndex;
}
}
}
return topPopup;
}
|
javascript
|
{
"resource": ""
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.