_id
stringlengths
2
6
title
stringlengths
0
58
partition
stringclasses
3 values
text
stringlengths
52
373k
language
stringclasses
1 value
meta_information
dict
q57300
train
function (element, start, end) { if ("selectionStart" in element) { element.selectionStart = start; element.selectionEnd = end; } else { var document = Aria.$window.document; if (document.selection) { var range = element.createTextRange(); range.moveStart('character', start); range.moveEnd('character', -element.value.length + end); range.select(); } } }
javascript
{ "resource": "" }
q57301
train
function (element) { var start = 0; var end = (element.value.length) ? element.value.length : 0; if (end) { this.setPosition(element, start, end); } }
javascript
{ "resource": "" }
q57302
train
function () { if (!this.eventsAlreadyAttached) { this.body = Aria.$window.document.body; var map = this._getInitialListenersList(); for (var i = 0; i < map.length; i++) { this._addListener(map[i].evt, map[i].cb); } this.eventsAlreadyAttached = true; } }
javascript
{ "resource": "" }
q57303
train
function () { var map = this._getInitialListenersList(); for (var i = 0; i < map.length; i++) { this._removeListener(map[i].evt, map[i].cb); } this.eventsAlreadyAttached = false; }
javascript
{ "resource": "" }
q57304
train
function () { var map = this._getAdditionalListenersList(); for (var i = 0; i < map.length; i++) { this._addListener(map[i].evt, map[i].cb); } }
javascript
{ "resource": "" }
q57305
train
function () { var map = this._getAdditionalListenersList(); for (var i = 0; i < map.length; i++) { this._removeListener(map[i].evt, map[i].cb); } }
javascript
{ "resource": "" }
q57306
train
function (event, name, extraData) { var target = (event.target) ? event.target : event.srcElement; var fakeEvent = aria.DomEvent.getFakeEvent(name, target); if (!event.returnValue) { fakeEvent.preventDefault(); } if (event.cancelBubble) { fakeEvent.stopPropagation(); } fakeEvent.pageX = event.pageX; fakeEvent.pageY = event.pageY; fakeEvent.clientX = event.clientX; fakeEvent.clientY = event.clientY; fakeEvent.touches = event.touches; fakeEvent.changedTouches = event.changedTouches; fakeEvent.isPrimary = event.isPrimary; if (this.startData) { if (this.startData.time) { fakeEvent.duration = (new Date()).getTime() - this.startData.time; } } if (!extraData) { extraData = {}; } extraData.startX = this.startData.positions[0].x; extraData.startY = this.startData.positions[0].y; var position = ariaTouchEvent.getPositions(event); extraData.currentX = position[0].x; extraData.currentY = position[0].y; fakeEvent.detail = extraData; ariaUtilsDelegate.delegate(fakeEvent); event.cancelBubble = fakeEvent.hasStopPropagation; event.returnValue = !fakeEvent.hasPreventDefault; return event.returnValue; }
javascript
{ "resource": "" }
q57307
train
function (ioRes) { var downloadFailed = (ioRes.status != '200'); if (downloadFailed) { this.$logError(this.DESCRIPTOR_NOT_LOADED, this._customizationDescriptor); } else { var resJson = ariaUtilsJson.load(ioRes.responseText); if (resJson == null) { // the descriptor was not valid json this.$logError(this.INVALID_DESCRIPTOR, this._customizationDescriptor); this.$raiseEvent("descriptorLoaded"); return; } this._setCustomizationDescriptor(resJson); } this._descriptorLoaded = true; this.$raiseEvent("descriptorLoaded"); }
javascript
{ "resource": "" }
q57308
train
function () { this._isCustomized = (this._customizationDescriptor ? true : false); if (this._isCustomized) { this._descriptorLoaded = false; if (ariaUtilsType.isString(this._customizationDescriptor)) { ariaCoreIO.asyncRequest({ url : this._customizationDescriptor, callback : { fn : this._onDescriptorReceive, onerror : this._onDescriptorReceive, scope : this } }); } else { this._setCustomizationDescriptor(this._customizationDescriptor); this._descriptorLoaded = true; this.$raiseEvent("descriptorLoaded"); } } }
javascript
{ "resource": "" }
q57309
train
function (originalCP) { var newCP = originalCP; if (this._isCustomized) { if (this._customizations.flows[originalCP] != null) { newCP = this._customizations.flows[originalCP]; } } return newCP; }
javascript
{ "resource": "" }
q57310
train
function (originalCP) { var newCP = originalCP; if (this._isCustomized) { if (this._customizations.templates[originalCP] != null) { newCP = this._customizations.templates[originalCP]; } } return newCP; }
javascript
{ "resource": "" }
q57311
getSott
train
function getSott(callback, config, startDate, endDate ) { var cipher = require('./sdk/sott')(config.apisecret, config.apikey, startDate, endDate); cipher.then( function(sott) { return callback(sott); }, function(reason) { console.log(reason); }); }
javascript
{ "resource": "" }
q57312
train
function () { this.cleanCache(); var mapping = this.__delegateMapping; if (mapping) { for (var id in mapping) { if (mapping.hasOwnProperty(id)) { this.remove(id); } } var body = Aria.$window.document.body; var utilEvent = ariaUtilsEvent, index, l; for (index = 0, l = this.delegatedOnBody.length; index < l; index++) { utilEvent.removeListener(body, this.delegatedOnBody[index], { fn : this.delegate }); } for (index = 0, l = this.delegatedOnWindow.length; index < l; index++) { utilEvent.removeListener(this.rootListener, this.delegatedOnWindow[index], { fn : this.delegate }); } this.__delegateMapping = null; // do this after removing listeners as we need it to remove listeners: this.rootListener = null; // nullify dom reference this._focusTracking = null; ariaUtilsAriaWindow.detachWindow(); } }
javascript
{ "resource": "" }
q57313
train
function (handler) { this.cleanCache(); // initialization of delegation manager if (!this.__delegateMapping) { ariaUtilsAriaWindow.attachWindow(); var body = Aria.$window.document.body; this.rootListener = ariaCoreBrowser.isOldIE ? body : Aria.$window; this.__delegateMapping = {}; var utilEvent = ariaUtilsEvent, index, l; for (index = 0, l = this.delegatedOnBody.length; index < l; index++) { utilEvent.addListener(body, this.delegatedOnBody[index], { fn : this.delegate, scope : this }); } for (index = 0, l = this.delegatedOnWindow.length; index < l; index++) { utilEvent.addListener(this.rootListener, this.delegatedOnWindow[index], { fn : this.delegate, scope : this }); } } var id = this.__idMgr.getId(); while (this._changed && this._changed[id]) { this._changed[id] = false; id = this.__idMgr.getId(); } this.__delegateMapping[id] = new ariaUtilsCallback(handler); return id; }
javascript
{ "resource": "" }
q57314
train
function (domElt, id) { domElt.setAttribute(this.delegateExpando, id); // for iOS, refer to method getMarkup if (ariaCoreBrowser.isIOS) { if (domElt.onclick == null) { domElt.onclick = Aria.empty; } } }
javascript
{ "resource": "" }
q57315
train
function (eventName, delegateId, wrapTarget) { if (ariaCoreBrowser.isOldIE) { this.getFallbackMarkup = function (eventName, delegateId, wrapTarget) { wrapTarget = wrapTarget ? "true" : "false"; return " on" + eventName + "=\"aria.utils.Delegate.directCall(event, '" + delegateId + "', " + wrapTarget + ", this)\""; }; } else { this.getFallbackMarkup = function (eventName, delegateId, wrapTarget) { var calledFunction = "directCall"; wrapTarget = wrapTarget ? "true" : "false"; if ('mouseleave' == eventName || 'mouseenter' == eventName) { // Mouseleave/enter exists only in IE, we can emulate them in all other browsers eventName = 'mouseleave' == eventName ? 'mouseout' : 'mouseover'; calledFunction = "mouseMovement"; } return " on" + eventName + "=\"aria.utils.Delegate." + calledFunction + "(event, '" + delegateId + "', " + wrapTarget + ", this)\""; }; } return this.getFallbackMarkup(eventName, delegateId, wrapTarget); }
javascript
{ "resource": "" }
q57316
train
function (event, templatesWrapper) { if (event.$DomEvent) { // It's already wrapped return event; } else { return templatesWrapper ? new aria.templates.DomEventWrapper(event) : new ariaDomEvent(event); } }
javascript
{ "resource": "" }
q57317
train
function (event, delegateId, wrapTarget, container) { this.$assert(286, this.__delegateMapping); var eventWrapper = this.__wrapEvent(event, wrapTarget), result; var callback = this.__delegateMapping[delegateId]; if (callback) { result = callback.call(eventWrapper); } eventWrapper.$dispose(); return result; }
javascript
{ "resource": "" }
q57318
train
function (id) { this.cleanCache(); // store id to identify changes during callback execution if (this._changed) { this._changed[id] = true; } if (this.__delegateMapping) { this.__delegateMapping[id].$dispose(); delete this.__delegateMapping[id]; this.__idMgr.releaseId(id); } }
javascript
{ "resource": "" }
q57319
train
function () { if (this.__stackCache) { for (var key in this.__stackCache) { if (this.__stackCache.hasOwnProperty(key)) { var stack = this.__stackCache[key]; // break dom reference for (var i = 0, l = stack.length; i < l; i++) { stack.target = null; stack.expandoValue = null; delete stack.target; delete stack.expandoValue; } delete this.__stackCache[i]; } } this.__stackCache = null; } }
javascript
{ "resource": "" }
q57320
train
function (label) { var report = new aria.widgets.controllers.reports.DropDownControllerReport(); var newSuggestions = ariaUtilsJson.copy(this.selectedSuggestions, false); var indexToRemove = this._findSuggestion(newSuggestions, { label : label }); if (indexToRemove == -1) { // try to find a free-text option indexToRemove = ariaUtilsArray.indexOf(newSuggestions, label); } if (indexToRemove > -1) { report.removedSuggestion = newSuggestions[indexToRemove]; ariaUtilsArray.removeAt(newSuggestions, indexToRemove); this.selectedSuggestions = newSuggestions; } report.removedSuggestionIndex = indexToRemove; report.value = this.selectedSuggestions; return report; }
javascript
{ "resource": "" }
q57321
train
function (value, removedSuggestionIndex) { var dataModel = this._dataModel; this._editedSuggestionIndex = removedSuggestionIndex; var report = new aria.widgets.controllers.reports.DropDownControllerReport(); dataModel.value = value; dataModel.text = typeUtil.isString(value) ? value : value.label; report.text = dataModel.text; report.caretPosStart = 0; report.caretPosEnd = report.text.length; report.value = this.selectedSuggestions; return report; }
javascript
{ "resource": "" }
q57322
train
function (selectedValues) { var selectedValuesCopy = ariaUtilsJson.copy(selectedValues, false); var selectedSuggestionsCopy = ariaUtilsJson.copy(this.selectedSuggestions, false); for (var i = 0, l = selectedSuggestionsCopy.length; i < l; i++) { var curSelectedSuggestion = selectedSuggestionsCopy[i]; if (typeUtil.isObject(curSelectedSuggestion)) { var index = this._findSuggestion(selectedValuesCopy, curSelectedSuggestion); if (index > -1) { arrayUtil.removeAt(selectedValuesCopy, index); } else { arrayUtil.removeAt(selectedSuggestionsCopy, i); l--; i--; } } } selectedSuggestionsCopy = selectedSuggestionsCopy.concat(selectedValuesCopy); var report = this.checkValue(selectedSuggestionsCopy); this._isExpanded = true; report.repositionDropDown = true; return report; }
javascript
{ "resource": "" }
q57323
train
function (value) { var report = new aria.widgets.controllers.reports.DropDownControllerReport(), dataModel = this._dataModel; if (value == null) { dataModel.text = (this._pendingRequestNb > 0 && dataModel.text) ? dataModel.text : ""; dataModel.value = null; report.ok = true; this.selectedSuggestions = []; } else if (typeUtil.isArray(value)) { if (this._checkWithSuggestionBean(value, this._resourcesHandler.SUGGESTION_BEAN)) { dataModel.text = ""; dataModel.value = null; report.ok = true; this.selectedSuggestions = value; } else { report.ok = false; this.$logError("Value does not match definition for this multiautocomplete: " + this._resourcesHandler.SUGGESTION_BEAN, [], value); } } else { report.ok = false; this.$logError("Wrong multiautocomplete value: " + value, [], value); } report.clearSuggestions = true; report.suggestionsToAdd = report.value = this.selectedSuggestions; report.text = dataModel.text; return report; }
javascript
{ "resource": "" }
q57324
train
function (value) { if (typeUtil.isString(value) || value == null) { return new aria.widgets.controllers.reports.DropDownControllerReport(); } else { var report = new aria.widgets.controllers.reports.DropDownControllerReport(); var dataModel = this._dataModel; var suggestionsToAdd = typeUtil.isArray(value) ? value : [value]; report.suggestionsToAdd = this._checkNewSuggestions(suggestionsToAdd); report.value = this.selectedSuggestions; report.text = ""; dataModel.text = ""; dataModel.value = null; return report; } }
javascript
{ "resource": "" }
q57325
train
function (suggestionToBeAdded) { var allSuggestions = ariaUtilsJson.copy(this.selectedSuggestions, false); var res = []; var maxOptions = this.maxOptions; var length = suggestionToBeAdded.length; if (maxOptions && allSuggestions.length + length > maxOptions) { length = maxOptions - allSuggestions.length; } if (length > 0) { for (var k = 0; k < length; k++) { if (this._editedSuggestionIndex != -1) { allSuggestions.splice(this._editedSuggestionIndex, 0, suggestionToBeAdded[k]); this._editedSuggestionIndex += 1; } else { allSuggestions.push(suggestionToBeAdded[k]); } res[k] = suggestionToBeAdded[k]; } this._editedSuggestionIndex = -1; this.selectedSuggestions = allSuggestions; } return res; }
javascript
{ "resource": "" }
q57326
train
function (suggestions) { var selectedSuggestions = this.selectedSuggestions; var filteredSuggestions = []; for (var i = 0; i < suggestions.length; i++) { var curSuggestion = suggestions[i]; if (this._findSuggestion(selectedSuggestions, curSuggestion) == -1) { filteredSuggestions.push(curSuggestion); } } return filteredSuggestions; }
javascript
{ "resource": "" }
q57327
train
function (suggestionsList, suggestion) { for (var i = 0, l = suggestionsList.length; i < l; i++) { if (suggestion.label == suggestionsList[i].label) { return i; } } return -1; }
javascript
{ "resource": "" }
q57328
train
function (arrayOfSuggestions, beanName) { for (var k = 0, l = arrayOfSuggestions.length; k < l; k++) { var currentSuggestion = arrayOfSuggestions[k]; if (!typeUtil.isString(currentSuggestion) && !ariaCoreJsonValidator.check(currentSuggestion, beanName)) { return false; } } return true; }
javascript
{ "resource": "" }
q57329
train
function (logError) { var handle = this.handle; var cursor = this.cursor; var element; if (!handle) { element = this.getElement(logError); } else { var typeUtils = ariaUtilsType; if (typeUtils.isString(handle)) { handle = ariaUtilsDom.getElementById(handle); } if (typeUtils.isHTMLElement(handle)) { this.handle = handle; element = handle; } else if (logError === true) { this.$logError(this.INVALID_ATTRIBUTE, ["handle", "params"]); } } if (element) { if (cursor) { if (this.originalCursor == null) { this.originalCursor = element.style.cursor; } element.style.cursor = cursor; } return element; } }
javascript
{ "resource": "" }
q57330
train
function (logError) { var element = this.element; if (!element) { element = ariaUtilsDom.getElementById(this.id); if (!element) { if (logError === true) { this.$logError(this.INVALID_ATTRIBUTE, ["id", "constructor"]); } return; } this.element = element; } return element; }
javascript
{ "resource": "" }
q57331
train
function (element) { var position = ariaUtilsDom.getOffset(element); this._elementInitialPosition = position; var style = element.style; style.position = "absolute"; style.left = position.left + "px"; style.top = position.top + "px"; }
javascript
{ "resource": "" }
q57332
train
function (create) { var proxy = this.proxy; if (proxy) { return proxy.overlay; } var params = this.params, config = params.proxy; if (config) { var classpath = "aria.utils.overlay." + config.type; Aria.load({ classes : [classpath], oncomplete : create === false ? null : { fn : this._createProxy, scope : this, args : { classpath : classpath, cfg : config.cfg } }, onerror : { fn : function () { this.$logError(this.INVALID_ATTRIBUTE, ["proxy", "params"]); }, scope : this, override : true } }); // Aria.load might be synchronous and this.proxy could be already available here if (create !== false && !this.proxy) { // this won't cause another Aria.load on next move if the proxy is not ready this.proxy = {}; } if (this.proxy) { return this.proxy.overlay; } else { return this.proxy; } } else { return this.getElement(); } }
javascript
{ "resource": "" }
q57333
train
function (coord) { this.posX = coord.x; this.posY = coord.y; this._mouseInitialPosition = { left : coord.x, top : coord.y }; var element = this.getElement(true), domUtil = ariaUtilsDom; // This will prevent text selection on IE on the element element.onselectstart = Aria.returnFalse; this._setElementStyle(element); this._setBoundary(); var movable = this.getMovable(); if (movable) { // This will prevent text selection on IE on the movable movable.onselectstart = Aria.returnFalse; if (this.dragOverIFrame) { // add overlay here for the visible page this.overlay = new aria.utils.overlay.Overlay(document.body, { className : ' ' }); } this._movableInitialGeometry = domUtil.getGeometry(movable); this._movableGeometry = ariaUtilsJson.copy(this._movableInitialGeometry); var offset = domUtil.getOffset(movable); this._baseMovableOffset = { left : this._movableGeometry.x - offset.left, top : this._movableGeometry.y - offset.top }; this.$raiseEvent("dragstart"); } }
javascript
{ "resource": "" }
q57334
train
function (evt) { var movable = this.getMovable(); var domUtil = ariaUtilsDom; if (movable && movable.style) { var geometry = ariaUtilsJson.copy(this._movableGeometry); var mouseInitPos = this._mouseInitialPosition; var movableInitPos = this._movableInitialGeometry; if (!this._vertical) { geometry.x = movableInitPos.x + evt.clientX - mouseInitPos.left; } if (!this._horizontal) { geometry.y = movableInitPos.y + evt.clientY - mouseInitPos.top; } var pos = (this._boundary) ? domUtil.fitInside(geometry, this._boundary) : { top : geometry.y, left : geometry.x }; movable.style.top = (pos.top - this._baseMovableOffset.top) + "px"; movable.style.left = (pos.left - this._baseMovableOffset.left) + "px"; geometry.y = pos.top; geometry.x = pos.left; this.posY = mouseInitPos.top + geometry.y - movableInitPos.y; this.posX = mouseInitPos.left + geometry.x - movableInitPos.x; this._movableGeometry = geometry; this.$raiseEvent("move"); } }
javascript
{ "resource": "" }
q57335
train
function () { var element = this.getElement(); // This is to handle if there is a scroll element.onselectstart = Aria.returnTrue; if (this.overlay) { // remove overlay here this.overlay.$dispose(); this.overlay = null; } if (this.proxy && this.proxy.overlay) { element.style.top = (this._elementInitialPosition.top + this._movableGeometry.y - this._movableInitialGeometry.y) + "px"; element.style.left = (this._elementInitialPosition.left + this._movableGeometry.x - this._movableInitialGeometry.x) + "px"; this.proxy.$dispose(); this.proxy = null; } this.$raiseEvent("dragend"); }
javascript
{ "resource": "" }
q57336
train
function () { var constrainTo = this.params.constrainTo, domUtil = ariaUtilsDom; if (!constrainTo || constrainTo === domUtil.VIEWPORT) { this._boundary = constrainTo; return; } if (ariaUtilsType.isString(constrainTo)) { constrainTo = domUtil.getElementById(constrainTo); } if (constrainTo) { this._boundary = ariaUtilsDom.getClientGeometry(constrainTo); return; } this._boundary = null; this.$logError(this.INVALID_ATTRIBUTE, ["constrainTo", "params"]); }
javascript
{ "resource": "" }
q57337
train
function (cfg) { var jsonValidator = ariaCoreJsonValidator; this._cfgOk = jsonValidator.validateCfg("aria.html.beans.TemplateCfg.Properties", cfg); if (this._needCreatingModuleCtrl) { this._cfgOk = this._cfgOk && jsonValidator.validateCfg("aria.templates.CfgBeans.InitModuleCtrl", cfg.moduleCtrl); } }
javascript
{ "resource": "" }
q57338
train
function (widgetName, includeLoaded) { var classpath = this.widgets[widgetName]; if (classpath == null) { return null; } if (includeLoaded || Aria.getClassRef(classpath) == null) { return [classpath]; } return []; }
javascript
{ "resource": "" }
q57339
train
function (widgetName, out, cfg, lineNbr) { var classpath = this.widgets[widgetName]; try { if (classpath) { // default object if cfg was null if (!cfg) { cfg = {}; } var widgetClass = Aria.getClassRef(classpath); var instance = new widgetClass(cfg, out.tplCtxt, lineNbr); out.registerBehavior(instance); instance.writeMarkupBegin(out); return instance; } else { // This should normally never happen, as the error will probably be caught after the call // of getWidgetDependencies by the TplClassGenerator (see the "@" statement in // aria.templates.Statements). throw this.UNKWOWN_WIDGET; } } catch (error) { out.write("#Error in widget:" + widgetName + "#"); this.$logError(this.ERROR_WIDGET_INIT, [out.tplCtxt.tplClasspath, lineNbr, widgetName, "writeMarkupBegin"], error); } }
javascript
{ "resource": "" }
q57340
train
function (baseType, args) { jv._logError(jv.INVALID_TYPE_VALUE, [baseType.typeName, args.beanDef[jv._MD_TYPENAME], args.value, args.path]); }
javascript
{ "resource": "" }
q57341
train
function (parentType, childType) { if (!jv._options.checkInheritance) { return true; } var typeRef = childType; while (!typeRef[jv._MD_BUILTIN]) { if (parentType == typeRef) { return true; } typeRef = typeRef[jv._MD_PARENTDEF]; } jv._logError(jv.INHERITANCE_EXPECTED, [childType[jv._MD_TYPENAME], parentType[jv._MD_TYPENAME]]); return false; }
javascript
{ "resource": "" }
q57342
train
function (beanDef, beanName, packageDef) { var contentType = beanDef.$contentType; var parentContentType = null; var parent = beanDef[jv._MD_PARENTDEF]; if (!parent[jv._MD_BUILTIN]) { parentContentType = parent.$contentType; if (contentType == null) { beanDef.$contentType = parentContentType; return; } } else if (contentType == null) { jv._logError(jv.MISSING_CONTENTTYPE, [beanDef[jv._MD_BASETYPE].typeName, beanDef[jv._MD_TYPENAME]]); beanDef[jv._MD_BASETYPE] = jv._typeError; return; } jv._preprocessBean(contentType, beanName + ".$contentType", packageDef); if (parentContentType != null) { __checkInheritance(parentContentType, contentType); } }
javascript
{ "resource": "" }
q57343
train
function (beanDef, beanName, packageDef) { var keyType = beanDef.$keyType; var parentKeyType = null; var parent = beanDef[jv._MD_PARENTDEF]; if (!parent[jv._MD_BUILTIN]) { parentKeyType = parent.$keyType; if (keyType == null) { beanDef.$keyType = parentKeyType; return; } } else if (keyType == null) { // keyType not specified return; } jv._preprocessBean(keyType, beanName + ".$keyType", packageDef); if (parentKeyType != null) { __checkInheritance(parentKeyType, keyType); } // in all cases, keyType must be a sub-type of aria.core.JsonTypes.String if (keyType[jv._MD_BASETYPE].typeName != "String") { jv._logError(jv.INHERITANCE_EXPECTED, [keyType[jv._MD_TYPENAME], jv._BASE_TYPES_PACKAGE + ".String"]); return; } }
javascript
{ "resource": "" }
q57344
train
function (args) { if (typeof(args.value) != 'string') { return __badTypeError(this, args); // this refers to the correct object (a base type) } var beanDef = args.beanDef; while (!beanDef[jv._MD_BUILTIN]) { var regexp = beanDef.$regExp; if (regexp != null) { if (!regexp.test(args.value)) { return jv._logError(jv.REGEXP_FAILED, [args.value, args.path, regexp, beanDef[jv._MD_TYPENAME]]); } } beanDef = beanDef[jv._MD_PARENTDEF]; } }
javascript
{ "resource": "" }
q57345
train
function (beanDef) { var parent = beanDef[jv._MD_PARENTDEF]; if (typeof(parent.$minValue) != "undefined") { if (typeof(beanDef.$minValue) == "undefined") { beanDef.$minValue = parent.$minValue; } else if (beanDef.$minValue < parent.$minValue) { jv._logError(jv.NUMBER_INVALID_INHERITANCE, ["$minValue", beanDef[jv._MD_TYPENAME]]); } } if (typeof(parent.$maxValue) != "undefined") { if (typeof(beanDef.$maxValue) == "undefined") { beanDef.$maxValue = parent.$maxValue; } else if (beanDef.$maxValue > parent.$maxValue) { jv._logError(jv.NUMBER_INVALID_INHERITANCE, ["$maxValue", beanDef[jv._MD_TYPENAME]]); } } if (typeof(beanDef.$minValue) != "undefined" && typeof(beanDef.$maxValue) != "undefined" && beanDef.$minValue > beanDef.$maxValue) { jv._logError(jv.NUMBER_INVALID_RANGE, [beanDef[jv._MD_TYPENAME], beanDef.$minValue, beanDef.$maxValue]); } }
javascript
{ "resource": "" }
q57346
train
function (args) { var v = args.value; var beanDef = args.beanDef; if (typeof(v) != 'number') { return __badTypeError(this, args); } if (typeof(beanDef.$minValue) != "undefined" && v < beanDef.$minValue) { return jv._logError(jv.NUMBER_RANGE, [args.value, args.path, "$minValue", beanDef.$minValue]); } if (typeof(beanDef.$maxValue) != "undefined" && v > beanDef.$maxValue) { return jv._logError(jv.NUMBER_RANGE, [args.value, args.path, "$maxValue", beanDef.$maxValue]); } }
javascript
{ "resource": "" }
q57347
train
function (args, cb) { this.bridge = args.bridge; // add bridge to submodules init parameters for (var i = 0, l = this.subModulesList.length; i < l; i++) { if (!this.subModulesList[i].initArgs) { this.subModulesList[i].initArgs = {}; this.subModulesList[i].initArgs.bridge = this.bridge; } } // load subnodules this.loadSubModules(this.subModulesList, { fn : this.onSubModulesReady, scope : this }); this.$ModuleCtrl.init.call(this, args, cb); }
javascript
{ "resource": "" }
q57348
train
function (options, textFieldValue) { var selectedOptions = []; var trim = ariaUtilsString.trim; var inSplit = textFieldValue.split(this._separator); if (inSplit) { for (var i = 0, inSplitLen = aria.utils.Math.min(inSplit.length, this._maxOptions); i < inSplitLen; i++) { for (var j = 0, optionsLen = options.length; j < optionsLen; j++) { var key = trim(inSplit[i]); options[j].label = options[j].label + ""; options[j].value = options[j].value + ""; key = key + ""; if ((trim(options[j].label.toLowerCase()) == key.toLowerCase() || trim(options[j].value.toLowerCase()) == key.toLowerCase()) && !ariaUtilsArray.contains(selectedOptions, options[j].value) && !options[j].disabled) { selectedOptions.push(options[j].value); } } } } return selectedOptions; }
javascript
{ "resource": "" }
q57349
train
function (selectedValues) { var toDisplay = this._fieldDisplay, options = this._dataModel.listContent; var backUp = (this._fieldDisplay == 'value') ? 'label' : 'value'; var display = [], option; for (var i = 0, l = selectedValues.length; i < l; i++) { option = selectedValues[i]; for (var j = 0, l2 = options.length; j < l2; j++) { if (options[j].value == option) { display.push(options[j][toDisplay] ? options[j][toDisplay] : options[j][backUp]); } } } return display.join(this._separator); }
javascript
{ "resource": "" }
q57350
train
function (value) { var report = new ariaWidgetsControllersReportsDropDownControllerReport(); var dataModel = this._dataModel; if (value === null) { report.ok = true; dataModel.value = null; dataModel.text = ''; } else { if (!ariaUtilsJson.equals(value, dataModel.value)) { // Only update the data-model if there has been a change, otherwise onchange is raised ariaUtilsJson.setValue(dataModel, 'selectedValues', value); dataModel.value = value; } else { if (!ariaUtilsJson.equals(dataModel.selectedValues, dataModel.value)) { // Only update the data-model if there has been a change, otherwise onchange is raised value = dataModel.selectedValues; dataModel.value = value; } } report.ok = true; var text = this._getDisplayValue(value); dataModel.text = text; } if (report.ok) { report.text = dataModel.text; report.value = this._getValue(dataModel.text, dataModel.value); } return report; }
javascript
{ "resource": "" }
q57351
train
function (str) { var dataModel = this._dataModel, options = dataModel.listContent, selectedValues; // retrieve selection from string selectedValues = this._parseInputString(options, str); if (!ariaUtilsJson.equals(selectedValues, dataModel.value)) { ariaUtilsJson.setValue(dataModel, 'value', selectedValues); ariaUtilsJson.setValue(dataModel, 'text', this._getDisplayValue(selectedValues)); ariaUtilsJson.setValue(dataModel, 'selectedValues', selectedValues); } var report = new ariaWidgetsControllersReportsDropDownControllerReport(); report.text = dataModel.text; report.value = this._getValue(dataModel.text, dataModel.value); return report; }
javascript
{ "resource": "" }
q57352
train
function () { var options = this._dataModel.listContent, value; for (var i = 0, len = options.length; i < len; i++) { value = options[i].value + ""; if (value.indexOf(this._separator) != -1) { this.$logError(this.INVALID_MULTISELECT_CONTENT); break; } } }
javascript
{ "resource": "" }
q57353
train
function (text, value) { var cachedValue = this._cacheValues[text]; if (cachedValue) { return cachedValue; } this._cacheValues[text] = value; return value; }
javascript
{ "resource": "" }
q57354
train
function (firstStart) { this._startTime = (firstStart) ? Aria._start : new Date(); if (firstStart) { this._logs = [{ classpath : "Aria", msg : "Framework initialization", start : Aria._start }, { classpath : "Aria", stop : (new Date()).getTime() }]; this._nbLogs = 2; } else { this._logs = []; this._nbLogs = 0; } // map function on JsObject prototype ariaCoreJsObject.prototype.$logTimestamp = function (msg, classpath) { classpath = classpath ? classpath : this.$classpath; aria.utils.Profiling.logTimestamp(classpath, msg); }; ariaCoreJsObject.prototype.$startMeasure = function (msg, classpath) { classpath = classpath ? classpath : this.$classpath; return aria.utils.Profiling.startMeasure(classpath, msg); }; ariaCoreJsObject.prototype.$stopMeasure = function (id, classpath) { classpath = classpath ? classpath : this.$classpath; aria.utils.Profiling.stopMeasure(classpath, id); }; }
javascript
{ "resource": "" }
q57355
train
function () { this._logsPerClasspath = {}; var i, j, iLog, jLog, max, end; max = 0; for (i = 0; i < this._nbLogs; i++) { iLog = this._logs[i]; if (iLog.start && !("length" in iLog)) { for (j = i + 1; j < this._nbLogs; j++) { jLog = this._logs[j]; if (jLog.stop && jLog.classpath == iLog.classpath) { if (!jLog.id || iLog.id === jLog.id) { this._logs.splice(j, 1); this._nbLogs--; iLog.length = jLog.stop - iLog.start; iLog.start = iLog.start - this._startTime; break; } } } if (!("length" in iLog)) { // no matching call to $stopMeasure iLog.length = 0; iLog.start = iLog.start - this._startTime; } } else if (iLog.timestamp) { iLog.start = iLog.timestamp - this._startTime; iLog.length = 0; delete iLog.timestamp; } if (!("msg" in iLog)) { iLog.msg = 'NO MESSAGE'; } end = iLog.start + iLog.length; if (end > max) { max = end; } // add in processed logs object if (!this._logsPerClasspath[iLog.classpath]) { this._logsPerClasspath[iLog.classpath] = {}; } var cpLog = this._logsPerClasspath[iLog.classpath]; if (!cpLog[iLog.msg]) { cpLog[iLog.msg] = [0]; } cpLog[iLog.msg].push(iLog); cpLog[iLog.msg][0] += iLog.length; } this._logsPerClasspath._max = max; }
javascript
{ "resource": "" }
q57356
train
function (div) { if (this._displayDiv != null) { return; } this.process(); var document = Aria.$window.document; this._displayDiv = document.createElement('div'); this._displayDiv.style.cssText = "position:absolute;top:0px;left:0px;width:100%;height:100%; z-index:99999999;overflow:auto;background:white"; document.body.appendChild(this._displayDiv); Aria.loadTemplate({ classpath : 'aria.utils.ProfilingDisplay', div : this._displayDiv, data : ariaUtilsJson.copy(this._logsPerClasspath, true) }); }
javascript
{ "resource": "" }
q57357
train
function () { this._displayDiv.innerHTML = ''; if (this._displayDiv != null) { aria.utils.Dom.removeElement(this._displayDiv); } this._displayDiv = null; }
javascript
{ "resource": "" }
q57358
train
function (classpath, msg) { this._logs[this._nbLogs++] = { classpath : classpath, msg : msg, timestamp : (new Date()).getTime() }; }
javascript
{ "resource": "" }
q57359
train
function (classpath, msg) { this._logs[this._nbLogs++] = { classpath : classpath, msg : msg, id : this._ids, start : (new Date()).getTime() }; return this._ids++; }
javascript
{ "resource": "" }
q57360
train
function (classpath, id) { this._logs[this._nbLogs++] = { classpath : classpath, id : id, stop : (new Date()).getTime() }; }
javascript
{ "resource": "" }
q57361
train
function (name, step) { if (this._counters.hasOwnProperty(name)) { this._counters[name] += (step || 1); } else { this._counters[name] = (step || 1); } }
javascript
{ "resource": "" }
q57362
train
function (name, reason) { if (!this._counters[name]) { return; } if (!this._counterSplits[name]) { this._counterSplits[name] = []; } this._counterSplits[name].push({ value : this._counters[name], reason : reason }); this._counters[name] = 0; }
javascript
{ "resource": "" }
q57363
train
function (name, reason) { if (!this._counterSplits[name]) { return 0; } var total = 0; for (var i = 0, len = this._counterSplits[name].length; i < len; i += 1) { total += this._counterSplits[name][i].value; } return total / len; }
javascript
{ "resource": "" }
q57364
train
function (str) { var xmlDoc; var DOMParser = Aria.$global.DOMParser; if (DOMParser) { var parser = new DOMParser(); xmlDoc = parser.parseFromString(str, "text/xml"); } else { // Internet Explorer var ActiveXObject = Aria.$global.ActiveXObject; xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); xmlDoc.async = "false"; xmlDoc.loadXML(str); } if (xmlDoc.hasChildNodes()) { return this.__parseXmlNode(xmlDoc); } else { return null; } }
javascript
{ "resource": "" }
q57365
train
function (xmlNode) { if (!xmlNode) { return; } var node = {}; for (var i = 0; i < xmlNode.childNodes.length; i++) { var currNode = xmlNode.childNodes[i]; // if it's a text node or a CDATA section use the nodeValue directly if (currNode.nodeType != 3 && currNode.nodeType != 4) { var name = currNode.nodeName; var count = 0; for (var j = 0; j < xmlNode.childNodes.length; j++) { if (xmlNode.childNodes[j].nodeName == name) { if (++count == 2) { break; } } } var el = this.__parseXmlNode(currNode); if (count == 2) { if (node[name] == null) { node[name] = []; } node[name].push(el); } else { node[name] = el; } } else if (xmlNode.childNodes.length == 1) { node = currNode.nodeValue; } } return node; }
javascript
{ "resource": "" }
q57366
train
function (element, overlayId, options) { // ------------------------------------------ input arguments processing if (options == null) { options = {}; } if (ariaUtilsType.isString(options)) { options = {message: options}; } var waiAria = options.waiAria; var message = options.message; this.__text = message; var waiAriaReadInterval = options.waiAriaReadInterval; if (waiAriaReadInterval == null) { waiAriaReadInterval = 2000; } this._waiAriaReadInterval = waiAriaReadInterval; var waiAriaReadOnceFirst = options.waiAriaReadOnceFirst; if (waiAriaReadOnceFirst == null) { waiAriaReadOnceFirst = true; } this._waiAriaReadOnceFirst = waiAriaReadOnceFirst; // ---------------------------------------------------------- processing this.$Overlay.constructor.call(this, element, { id : overlayId, className : "xLDI" }, { waiAria: waiAria }); var browser = aria.core.Browser; // fix 08364518 : if IE<9, the scroll event on an element does not bubble up and trigger the handler // attached to the window if (browser.isIE8 || browser.isIE7) { this._scrollRecListener = true; ariaUtilsEvent.addListenerRecursivelyUp(this.element, "scroll", { fn : this.refreshPosition, scope : this }, true, function (element) { return element.style && element.style.overflow != "hidden"; }); } }
javascript
{ "resource": "" }
q57367
train
function (attributes) { var result = [], whiteList = ariaTemplatesDomElementWrapper.attributesWhiteList; var jsonUtils = ariaUtilsJson; /* * This assumes that white list is performed by config validation, but this is only available in debug mode : * FIXME! */ var stringUtil = ariaUtilsString; for (var key in attributes) { if (attributes.hasOwnProperty(key) && !jsonUtils.isMetadata(key)) { var attribute = attributes[key]; if (key === "classList") { result.push(" class=\""); result.push(stringUtil.encodeForQuotedHTMLAttribute(attribute.join(" "))); result.push("\""); } else if (key === "dataset") { for (var dataKey in attribute) { if (attribute.hasOwnProperty(dataKey) && !jsonUtils.isMetadata(dataKey)) { if (this.datasetRegex.test(dataKey)) { result.push(" data-", stringUtil.camelToDashed(dataKey), "=\""); result.push(stringUtil.encodeForQuotedHTMLAttribute(attribute[dataKey])); result.push("\""); } else { this.$logError(this.INVALID_DATASET_KEY, dataKey); } } } } else if (key === "aria") { for (var ariaKey in attribute) { if (attribute.hasOwnProperty(ariaKey) && !jsonUtils.isMetadata(ariaKey)) { result.push(" aria-", ariaKey, "=\""); result.push(stringUtil.encodeForQuotedHTMLAttribute(attribute[ariaKey])); result.push("\""); } } } else if (whiteList.test(key)) { attribute = (attribute != null) ? attribute + "" : ""; result.push(" ", key, "=\""); result.push(stringUtil.encodeForQuotedHTMLAttribute(attribute)); result.push("\""); } else { this.$logError(this.INVALID_CONFIGURATION, key); } } } return result.join(''); }
javascript
{ "resource": "" }
q57368
train
function (form) { var elements = form.elements, params = [], element, name, value; for (var i = 0, len = elements.length; i < len; i++) { element = elements[i]; if (this._isSerializable(element)) { name = encodeURIComponent(element.name); value = encodeURIComponent(element.value.replace(/\r?\n/g, "\r\n")); params.push(name + "=" + value); } } return params.join("&").replace(/%20/g, "+"); }
javascript
{ "resource": "" }
q57369
train
function (element) { var submittable = /^(?:input|select|textarea|keygen)/i; var submitterTypes = /^(?:submit|button|image|reset|file)$/i; var type = element.type; var checkableTypes = /^(?:checkbox|radio)$/i; return element.name && !element.disabled && submittable.test(element.nodeName) && !submitterTypes.test(type) && (element.checked || !checkableTypes.test(type)); }
javascript
{ "resource": "" }
q57370
train
function (domElement, dataset, remove) { var fullKey, stringUtil = ariaUtilsString; for (var dataKey in dataset) { if (dataset.hasOwnProperty(dataKey) && !ariaUtilsJson.isMetadata(dataKey)) { if (this.datasetRegex.test(dataKey)) { fullKey = "data-" + stringUtil.camelToDashed(dataKey); if (remove) { domElement.removeAttribute(fullKey); } else { domElement.setAttribute(fullKey, dataset[dataKey]); } } else { this.$logError(this.INVALID_DATASET_KEY, dataKey); } } } }
javascript
{ "resource": "" }
q57371
train
function () { if (this._simpleHTML) { return this._skinObj.states[this._state].color; } if (this._isIE7OrLess) { // As "inherit" does not work in this case in IE7, we are obliged to read the property from // the frame state and apply it to the text field directly var state = this._skinObj.states[this._state]; return state.color || state.frame.color; } return "inherit"; }
javascript
{ "resource": "" }
q57372
train
function () { var cfg = this._cfg; // invalid text and value shouldn't be set at the same time var text = cfg.invalidText || ""; if (text && cfg.value) { // There's both a value and an invalid text, prefer the value this.setProperty("invalidText", null); text = ""; } // Validate the value in the configuration var res = this.checkValue({ text : text, value : cfg.value, performCheckOnly : true }); if (res.report) { var report = res.report; if (!text && report.text != null) { text = '' + report.text; // String cast of valid value } report.$dispose(); } if (!text) { text = this._getPrefilledText(cfg.prefill); } return text; }
javascript
{ "resource": "" }
q57373
train
function (value) { if (value == null) { value = this._getText(); } // _getText only handles valid / invalid values and prefills, not the helptext if (!value && !this._isPassword) { // We don't want to handle helptext in password fields, first remove any text this.getTextInputField().value = ""; this.setHelpText(true); } else if (value) { this.setHelpText(false); this.getTextInputField().value = value; } }
javascript
{ "resource": "" }
q57374
train
function (event) { if (this._keepFocus || this._hasFocus) { this._reactToControllerReport(event.report, event.arg); } else if (event.report) { event.report.$dispose(); } }
javascript
{ "resource": "" }
q57375
train
function (report, arg) { var hasChange = false, cfg = this._cfg; if (report) { var resetErrorIfOK = true; var hasFocus = this._hasFocus; var stopValueProp = false; var delayedValidation = false; if (arg) { resetErrorIfOK = (arg.resetErrorIfOK !== false); // true by default if (arg.hasFocus != null) { // replace default hasFocus property hasFocus = arg.hasFocus; } if (arg.stopValueProp) { stopValueProp = arg.stopValueProp; } if (arg.delayedValidation) { delayedValidation = arg.delayedValidation; } } if (report.errorMessages.length && this._cfg.directOnBlurValidation) { this.changeProperty("formatErrorMessages", report.errorMessages); } // if the validation originated from a validation with delay we // do not want to update the input text or // value. The value will be set to 'undefined' though when the // entry is incorrect if (!delayedValidation) { var text = report.text, value = report.value; if (text != null && !this._helpTextSet) { // if text was // an empty string (helpTextSet is 'true') do not update // the display var caretPosition = (report.caretPosStart != null && report.caretPosEnd != null) ? { start : report.caretPosStart, end : report.caretPosEnd } : null; if (ariaCoreBrowser.isModernIE && !caretPosition) { caretPosition = this.getCaretPosition(); } var input = this.getTextInputField(); // This test prevents the normal autofocus from being lost with tab, in some browsers if (input.value != text) { input.value = text; } if (caretPosition) { this.setCaretPosition(caretPosition.start, caretPosition.end); } } if (typeof value != 'undefined' && !stopValueProp && !this._isPropertyEquals("value", value)) { hasChange = this.setProperty("value", value); } } // setProperty on value can dispose the widget if (this._cfg) { if (report.ok) { if (resetErrorIfOK && cfg.directOnBlurValidation) { this.changeProperty("formatError", false); } } else if (report.ok === false) { if (hasFocus && report.matchCorrectValueStart) { // field has the focus and entry could be correct if (cfg.directOnBlurValidation) { this.changeProperty("formatError", false); } } else { if (cfg.directOnBlurValidation) { this.changeProperty("formatError", true); } } // if the text is incorrect, the bound property should // be set to 'undefined' if (!this._isPropertyEquals("value", report.errorValue)) { hasChange = this.setProperty("value", report.errorValue); } } } // do this at the very end if (hasChange && this._cfg) { // When the user modifies the field, we reset the error // state until next validation: this.changeProperty("error", false); this.evalCallback(cfg.onchange); } report.$dispose(); } }
javascript
{ "resource": "" }
q57376
train
function (event) { if (this._cfg.validationDelay) { if (this._valTimer) { ariaCoreTimer.cancelCallback(this._valTimer); } this._valTimer = ariaCoreTimer.addCallback({ fn : this.checkValue, scope : this, args : { delayedValidation : true }, delay : this._cfg.validationDelay }); } }
javascript
{ "resource": "" }
q57377
train
function (domEvent) { if (!!this._cfg.onclick) { var domEvtWrapper; if (domEvent) { domEvtWrapper = new ariaTemplatesDomEventWrapper(domEvent); } this.evalCallback(this._cfg.onclick, domEvtWrapper); if (domEvtWrapper) { domEvtWrapper.$dispose(); } } }
javascript
{ "resource": "" }
q57378
train
function (event, avoidCallback) { this._hasFocus = true; if (!this._keepFocus) { var cfg = this._cfg; if (cfg.readOnly) { return; } this.setHelpText(false); if (this._isPrefilled) { this.setPrefillText(false); this.checkValue({ value : cfg.prefill }); } this.checkValue({ stopValueProp : true }); if (this._cfg) { cfg = this._cfg; if (cfg.validationEvent === 'onFocus' && ((cfg.formatError && cfg.formatErrorMessages.length) || (cfg.error && cfg.errorMessages.length))) { this._validationPopupShow(); } } this._updateState(); } else { // restore selection var caretPosition = this._currentCaretPosition; this._currentCaretPosition = null; if (caretPosition) { this.setCaretPosition(caretPosition.start, caretPosition.end); } } if (!!this._cfg.onfocus && !avoidCallback) { this.evalCallback(this._cfg.onfocus); } // on IE9 and IE10, it is necessary to add some delay before being able to set the selection ariaCoreTimer.addCallback({ fn : this._autoselect, scope : this, delay : 1 }); }
javascript
{ "resource": "" }
q57379
train
function (event, avoidCallback) { if (!this._hasFocus) { return; } if (!this._keepFocus) { var cfg = this._cfg; // , htc = this._skinObj.helpText; this._hasFocus = false; // reinitialize for next time (autoselect feature) this._firstFocus = true; if (cfg.readOnly) { return; } this.checkValue({ "eventName" : "blur" }); // checkvalue might trigger an onchange that disposes the widget, check again this._cfg cfg = this._cfg; if (!cfg) { return; } if (cfg.prefill) { this.setPrefillText(true, cfg.prefill, false); } else { this.setHelpText(true); } this._updateState(); if (cfg.formatError && cfg.validationEvent === 'onBlur') { // show errortip on blur used for debug purposes this._validationPopupShow(); } else { // dispose of error tip this._validationPopupHide(); if (cfg.directOnBlurValidation) { if (cfg.bind) { var bind = cfg.bind.value; if (bind) { var dataholder = bind.inside; var name = bind.to; var groups = cfg.validationGroups; ariaUtilsData.validateValue(dataholder, name, null, groups, 'onblur'); // PTR05705466: validateValue could have triggered widget dispose, need to re-check // this._cfg before continuing if (!this._cfg) { return; } } } } } } else { this._currentCaretPosition = this.getCaretPosition(); // this._hasFocus = false must be after the call of this.getCaretPosition() this._hasFocus = false; } if (this._cfg.onblur && !avoidCallback) { this.evalCallback(this._cfg.onblur); } }
javascript
{ "resource": "" }
q57380
train
function (enable) { var cfg = this._cfg; // check for disposal if (!cfg) { return; } var helpText = cfg.helptext, helpTextConfig = this._skinObj.helpText; // stops if no helptext, or trying to disable an helptext that as // not been set if (!helpText || !this._helpTextSet && !enable || (this._hasFocus || this._keepFocus) && enable) { return; } var field = this.getTextInputField(); // stops if trying to set a helptext in a field with a value if (field.value && enable) { return; } this._helpTextSet = enable; if (!field) { return; } // determine new styles and value var color = enable ? helpTextConfig.color : this._getTextFieldColor(); var value = enable ? helpText : ""; var helpTextClass = "x" + this._skinnableClass + "_" + cfg.sclass + "_helpText"; var classNames = field.className.split(/\s+/); ariaUtilsArray.remove(classNames, helpTextClass); if (enable) { classNames.push(helpTextClass); } field.className = classNames.join(' '); // update styles var style = field.style; style.color = color; // update field value field.value = value; }
javascript
{ "resource": "" }
q57381
train
function (enable, value, updateState) { var cfg = this._cfg, prefillText; // check for disposal if (!cfg) { return; } var field = this.getTextInputField(); if (enable) { if (!field || (field.value && !this._helpTextSet && !this._isPrefilled)) { return; } this.setHelpText(false); if (value == null) { prefillText = ""; } else { prefillText = this._getPrefilledText(value); } if (cfg.prefillError) { prefillText = ""; } if (!prefillText) { field.value = prefillText; this._isPrefilled = false; this.setHelpText(true); this._updateState(); } else { this._isPrefilled = true; // update field value field.value = prefillText; } } else { this._isPrefilled = false; } if (updateState) { if (!(enable && this._state == "prefill")) { this._updateState(); } } }
javascript
{ "resource": "" }
q57382
train
function (idArray, fromSelf) { if (this._cfg.disabled) { return false; } var textInputField = this.getTextInputField(); textInputField.focus(); // IE FIX: requires the value to be reset for the cursor to be positioned // and focused at the end of the textinput.value string if (ariaCoreBrowser.isIE) { textInputField.value = textInputField.value; } }
javascript
{ "resource": "" }
q57383
train
function () { // this._cfg can be null due to the following execution chain: native focus -> native blur -> AutoComplete // bound value update in the data model -> bindRefreshTo section refresh if (this._firstFocus && this._cfg && this._cfg.autoselect) { // this allow to click again and put the cursor at a given position this._firstFocus = false; var field = this.getTextInputField(); var start = 0; var end = (field.value.length) ? field.value.length : 0; if (end) { this.setCaretPosition(start, end); } } }
javascript
{ "resource": "" }
q57384
train
function (processStatement, processErrors) { /** * Callback used to process a single statement in the content * @type aria.core.CfgBeans:Callback * @protected */ this._processStatement = processStatement; /** * Callback used to process errors * @type aria.core.CfgBeans:Callback * @protected */ this._processErrors = processErrors; /** * Current indentation string. Used when writing a line * @type String * @protected */ this._curindent = ''; /** * Text used for indentation (null to disable) * @type String */ this.indentUnit = ' '; /** * Counter for number of variables created. This is increased every time a new var statement is called and is * used as unique key. * @type Number * @protected */ this._varNameNumber = 0; /** * Optional error context to be passed when logging errors * @type Object */ this.errorContext = null; /** * if true, the dependencies section should even contain already loaded dependencies * @type Boolean */ this.allDependencies = null; /** * Stores the template parameter * @type Object */ this.templateParam = null; /** * Stores the parent class type * @type String */ this.parentClassType = "JS"; /** * Stores the parent class name * @type String */ this.parentClassName = null; /** * Stores the parent classpath * @type String */ this.parentClasspath = null; /** * Stores the script class name * @type String */ this.scriptClassName = null; /** * Stores the script classpath * @type String */ this.scriptClasspath = null; /** * Callback to call when generation is finished * @type aria.core.CfgBeans:Callback */ this.callback = null; /** * Direct link to widget libraries * @type Object * * <pre> * { * libName : libClasspath * } * </pre> */ this.wlibs = {}; /** * Map of declared macros * @type Object * * <pre> * { * macroName : { * definition : statement * } * } * </pre> */ this.macros = {}; /** * Map of declared views * @type Object * * <pre> * { * viewName : { * firstDefinition : statement, * nbParams : numberOfParameters * } * } * </pre> */ this.views = {}; /** * Current working output block * @type Object * @protected */ this._curblock = null; /** * Map of possible output block * @type Object * * <pre> * { * blockName : { * curindentnbr : indent, * out : [] * } * } * </pre> * * @protected */ this._blocks = {}; /** * Stack of output blocks * @type Array * @protected */ this._stack = []; /** * Map of dependencies found for the class to be generated * @protected */ this._dependencies = {}; /** * Contains information about errors which occured during the generation process. If the processErrors callback * is provided, the errors property contains a boolean indicating whether errors occurred or not. If the * processErrors callback is not provided, the errors property is null if no error occured, otherwise, it * contains the array of errors. */ this.errors = processErrors ? false : null; /** * Indicates if the writer has a mirror debug writer * @type Boolean */ this.debug = false; /** * Tree structure generated by the parser * @type aria.templates.TreeBeans:Root */ this.tree = null; /** * If set to true, code generation is disabled, only parsing matters. * @type Boolean */ this.parseOnly = false; /** * If set to true, widget libraries will not be loaded during class generation. * @type Boolean */ this.dontLoadWidgetLibs = false; }
javascript
{ "resource": "" }
q57385
train
function (dependencies, extension) { if (dependencies) { for (var i = dependencies.length - 1; i >= 0; i--) { this.addDependency(dependencies[i], extension); } } }
javascript
{ "resource": "" }
q57386
train
function (macroName) { var res = this.macros[macroName]; if (res == null) { res = {}; this.macros[macroName] = res; } return res; }
javascript
{ "resource": "" }
q57387
train
function (viewBaseName) { var res = this.views[viewBaseName]; if (res == null) { res = { baseName: viewBaseName }; this.views[viewBaseName] = res; } return res; }
javascript
{ "resource": "" }
q57388
train
function (statement, msgId, msgArgs) { if (this._processErrors) { this.errors = true; this._processErrors.fn.call(this._processErrors.scope, statement, msgId, msgArgs, this.errorContext); } else { if (!msgArgs) { msgArgs = []; } if (!this.errors) { this.errors = this.logErrors ? true : []; } msgArgs.push(statement.lineNumber); this.errors.push({ msgId : msgId, msgArgs : msgArgs, errorContext : this.errorContext }); } }
javascript
{ "resource": "" }
q57389
train
function () { var out = this._curblock.out; if (this._curindent) { out.push(this._curindent); } out.push.apply(out, arguments); out.push('\n'); }
javascript
{ "resource": "" }
q57390
train
function (exprStr, statement, errorMsg) { var container = this.newVarName(); // stringify the expression for the eval exprStr = this.stringify(exprStr); this.writeln("var " + container + " = null;"); this.writeln("try {"); this.increaseIndent(); // remove quotes exprStr = exprStr.substr(1, exprStr.length - 2); this.writeln('eval( "' + container + '=(' + exprStr + ')" );'); this.decreaseIndent(); this.writeln("} catch (e) {"); this.increaseIndent(); this.writeln("this.$logError(", errorMsg, ",[\"", exprStr, "\",__filename,", statement.lineNumber, ",", this.stringify(statement.name), "], e);"); this.decreaseIndent(); this.writeln("}"); return container; }
javascript
{ "resource": "" }
q57391
train
function () { this.parseOnly = true; // disables functions which are only useful to generate code: var empty = Aria.empty; this.writeDependencies = empty; this.newVarName = empty; this.writeln = empty; this.write = empty; this.wrapExpression = empty; this.trackLine = empty; }
javascript
{ "resource": "" }
q57392
train
function (string) { var params = Array.prototype.slice.call(arguments, 1); params = ariaUtilsArray.flattenDeep(params); string = string.replace(/%[0-9]+/g, function (token) { var replacement = params[parseInt(token.substring(1), 10) - 1]; return typeof replacement !== "undefined" ? replacement : token; }); return string; }
javascript
{ "resource": "" }
q57393
train
function (str, index) { var res = false; for (var i = index - 1; i >= 0; i--) { if (str.charAt(i) == "\\") { res = !res; } else { return res; } } return res; }
javascript
{ "resource": "" }
q57394
train
function (str, findChar, start) { var index = str.indexOf(findChar, start); while (index != -1) { if (!this.isEscaped(str, index)) { return index; } // continue search after escaped character index = str.indexOf(findChar, index + 1); } return -1; }
javascript
{ "resource": "" }
q57395
train
function (str, options, infos) { // -------------------------------------- input arguments processing // options --------------------------------------------------------- if (options == null) { options = true; } if (!ariaUtilsType.isObject(options)) { options = !!options; options = { text: options, attr: options }; } var escapeForHTMLText = !!(options.text); var escapeForHTMLAttr = !!(options.attr); // ------------------------------------------------------ processing var escaped = false; var textEscaped = false; var attrEscaped = false; if (escapeForHTMLText) { escaped = true; textEscaped = true; str = this.escapeHTML(str).replace(/\//g, "&#x2F;"); } if (escapeForHTMLAttr) { escaped = true; attrEscaped = true; str = this.escapeHTMLAttr(str); } // ---------------------------------------------------------- return if (infos != null) { infos.escaped = escaped; infos.text = textEscaped; infos.attr = attrEscaped; } return str; }
javascript
{ "resource": "" }
q57396
train
function (str, start, end, regexp) { var currentCharPos = start, whiteRegexp = regexp || /\s/, currentChar; while (currentCharPos < end) { currentChar = str.charAt(currentCharPos); if (whiteRegexp.test(currentChar)) { return currentCharPos; } currentCharPos++; } return -1; }
javascript
{ "resource": "" }
q57397
train
function (string, size, character, begin) { string = "" + string; var length = string.length; if (length < size) { var padding = []; for (var difference = size - length; difference > 0; difference -= 1) { padding.push(character); } if (begin === true) { string = padding.join("") + string; } else { string = string + padding.join(""); } } return string; }
javascript
{ "resource": "" }
q57398
train
function (string, size, character, begin) { var start, length; if (begin === true) { for (start = 0, length = string.length - size; start < length; start += 1) { if (string.charAt(start) !== character) { break; } } return string.substring(start); } else { for (start = string.length - 1; start >= size; start -= 1) { if (string.charAt(start) !== character) { break; } } return string.substring(0, start + 1); } }
javascript
{ "resource": "" }
q57399
train
function (number, patternString, formatSymbols) { formatSymbols = this._normalizeSymbols(formatSymbols); var patternDescription = this._explode(patternString); if (!patternDescription) { return this.$logError(this.INVALID_FORMAT, ["formatCurrency", this.CURRENCY_BEAN]); } var currencySymbol = this._currency; number = this.formatNumber(number, patternString, formatSymbols); if (patternDescription.currencyBegin) { return currencySymbol + number; } else if (patternDescription.currencyEnd) { return number + currencySymbol; } else { return number; } }
javascript
{ "resource": "" }