_id
stringlengths
2
6
title
stringlengths
0
58
partition
stringclasses
3 values
text
stringlengths
52
373k
language
stringclasses
1 value
meta_information
dict
q56900
train
function (requestPath, params) { if (!params || params.length === 0) { // Nothing to do if there are no parameters return requestPath; } // Flatten the array of global parameters var flat = []; for (var i = 0, len = params.length; i < len; i += 1) { var par = params[i]; // The value is already encoded inside the addParam flat.push(par.name + '=' + par.value); } /* * Just in case we want to change it in the future. W3C recommends to use semi columns instead of ampersand * http://www.w3.org/TR/1999/REC-html401-19991224/appendix/notes.html#h-B.2.2 */ var parametersSeparator = "&"; var flatString = flat.join(parametersSeparator); return this.__appendActionParameters(requestPath, flatString); }
javascript
{ "resource": "" }
q56901
train
function (requestPath, params) { requestPath = requestPath || ""; if (!params) { // Nothing to do if there are no parameters return requestPath; } var idx = requestPath.indexOf('?'); /* * Just in case we want to change it in the future. W3C recommends to use semi columns instead of ampersand * http://www.w3.org/TR/1999/REC-html401-19991224/appendix/notes.html#h-B.2.2 */ var parametersSeparator = "&"; if (idx > -1) { requestPath += parametersSeparator; } else { requestPath += "?"; } return requestPath + params; }
javascript
{ "resource": "" }
q56902
train
function (actionName) { actionName = actionName || ""; var idx = actionName.indexOf("?"); var object = { name : "", params : "" }; if (idx < 0) { object.name = actionName; } else { object = { name : actionName.substring(0, idx), params : actionName.substring(idx + 1) }; } return object; }
javascript
{ "resource": "" }
q56903
train
function () { if (!this._urlService) { var cfg = ariaModulesUrlServiceEnvironmentUrlService.getUrlServiceCfg(), actionUrlPattern = cfg.args[0], i18nUrlPattern = cfg.args[1]; var ClassRef = Aria.getClassRef(cfg.implementation); this._urlService = new (ClassRef)(actionUrlPattern, i18nUrlPattern); } return this._urlService; }
javascript
{ "resource": "" }
q56904
train
function () { if (!this._requestHandler) { var cfg = ariaModulesRequestHandlerEnvironmentRequestHandler.getRequestHandlerCfg(); this._requestHandler = Aria.getClassInstance(cfg.implementation, cfg.args); } return this._requestHandler; }
javascript
{ "resource": "" }
q56905
train
function () { var val = this._value; if (val >= this._switchThreshold) { this._onContainer.style.width = this._cfg.width + "px"; this._onContainer.style.left = "0px"; this._offContainer.style.width = "0px"; this._value = 1; } else { this._offContainer.style.width = this._cfg.width + "px"; this._offContainer.style.left = "0px"; this._onContainer.style.width = "0px"; this._value = 0; } if (val !== this._value) { this._storeValue(); } }
javascript
{ "resource": "" }
q56906
train
function () { var binding = this._binding; if (binding) { ariaUtilsJson.setValue(binding.inside, binding.to, this._value, this._bindingCallback); } }
javascript
{ "resource": "" }
q56907
train
function () { var dragVal = this._slider.offsetLeft; this._onContainer.style.width = (this._sliderWidth + dragVal) + "px"; this._offContainer.style.left = dragVal + "px"; this._offContainer.style.width = (this._cfg.width - dragVal) + "px"; }
javascript
{ "resource": "" }
q56908
train
function () { var pos = this._savedX, newValue = Math.max(pos / this._railWidth, 0); if (newValue !== this._value) { this._value = newValue; this._storeValue(); } else { this._notifyDataChange(); } return; }
javascript
{ "resource": "" }
q56909
train
function (applySwitchMargins) { var value; var binding = this._binding; if (!binding) { return; } value = binding.inside[binding.to]; if (value == null) { value = 0; } if (value < 0) { value = 0; } if (value > 1) { value = 1; } if (this._isSwitch && applySwitchMargins) { if (value >= this._switchThreshold) { value = 1; } else { value = 0; } } this._value = value; this._storeValue(); }
javascript
{ "resource": "" }
q56910
train
function (evt) { if (evt.type === "tap") { var cfg = this._cfg; if (!cfg) { // Widget already disposed return true; } if ((cfg.tapToToggle || cfg.tapToMove) && this._isSwitch) { // With this configuration, on tap we want to toggle the value this._value = this._value >= this._switchThreshold ? 0 : 1; } else if (cfg.tapToMove) { this._savedX = evt.detail.currentX - this._sliderDimension.x - this._sliderWidth / 2; this._savedX = (this._savedX > this._railWidth) ? this._railWidth : this._savedX; this._value = Math.max(this._savedX / this._railWidth, 0); } this._storeValue(); this._setLeftPosition(); this._updateDisplay(); } }
javascript
{ "resource": "" }
q56911
train
function (container, cfg) { var localMapStatus = this.mapManager.getMapStatus(cfg.id); var mapDom = mapDoms[cfg.id]; if (localMapStatus === null) { this._createMap(container, cfg); } else { container.appendChild(mapDom); } localMapStatus = this.mapManager.getMapStatus(cfg.id); if (cfg.loadingIndicator && localMapStatus != this.mapManager.READY) { this._activateLoadingIndicator(container, cfg); } }
javascript
{ "resource": "" }
q56912
train
function (evt) { var args = mapReadyHandlerArgs[evt.mapId]; if (args) { this._triggerLoadingIndicator(args.container, false); delete mapReadyHandlerArgs[evt.mapId]; this._listeners--; if (this._listeners === 0) { this.mapManager.$removeListeners({ "mapReady" : { fn : this._removeLoadingIndicator, scope : this } }); } } }
javascript
{ "resource": "" }
q56913
train
function (container, cfg) { var id = cfg.id; if (cfg.loadingIndicator) { this._triggerLoadingIndicator(container, false); } var mapDom = mapDoms[id]; if (mapDom) { var parent = mapDom.parentNode; if (parent) { parent.removeChild(mapDom); } } }
javascript
{ "resource": "" }
q56914
connectMouseEvents
train
function connectMouseEvents (scope) { var root = (aria.core.Browser.isIE7 || aria.core.Browser.isIE8) ? Aria.$window.document.body : Aria.$window; eventUtil.addListener(root, "mousemove", { fn : scope._onMouseMove, scope : scope }); eventUtil.addListener(root, "mouseup", { fn : scope._onMouseUp, scope : scope }); eventUtil.addListener(root, "touchmove", { fn : scope._onMouseMove, scope : scope }); eventUtil.addListener(root, "touchend", { fn : scope._onMouseUp, scope : scope }); }
javascript
{ "resource": "" }
q56915
disconnectMouseEvents
train
function disconnectMouseEvents (scope) { var root = (aria.core.Browser.isIE7 || aria.core.Browser.isIE8) ? Aria.$window.document.body : Aria.$window; eventUtil.removeListener(root, "mousemove", { fn : scope._onMouseMove, scope : scope }); eventUtil.removeListener(root, "mouseup", { fn : scope._onMouseUp, scope : scope }); eventUtil.removeListener(root, "touchmove", { fn : scope._onMouseMove, scope : scope }); eventUtil.removeListener(root, "touchend", { fn : scope._onMouseUp, scope : scope }); }
javascript
{ "resource": "" }
q56916
findByAttribute
train
function findByAttribute (start, attribute, maxDepth, stopper) { var target = start, expandoValue; while (maxDepth && target && target != stopper) { if (target.attributes) { var expandoValue = target.attributes[attribute]; if (expandoValue) { return expandoValue.nodeValue; } } target = target.parentNode; maxDepth--; } }
javascript
{ "resource": "" }
q56917
train
function () { eventUtil.addListener(Aria.$window.document.body, "mousedown", { fn : this._onMouseDown, scope : this }); eventUtil.addListener(Aria.$window.document.body, "touchstart", { fn : this._onMouseDown, scope : this }); }
javascript
{ "resource": "" }
q56918
train
function () { eventUtil.removeListener(Aria.$window.document.body, "mousedown", { fn : this._onMouseDown, scope : this }); eventUtil.removeListener(Aria.$window.document.body, "touchstart", { fn : this._onMouseDown, scope : this }); disconnectMouseEvents(this); }
javascript
{ "resource": "" }
q56919
train
function (gesture, id) { if (this._idList[gesture]) { var element = this._idList[gesture][id]; if (gesture == "drag" && element && element == this._activeDrag) { // the element being dragged has been disposed, // terminate the drag: this._dragStartPosition = null; disconnectMouseEvents(this); this._candidateForDrag = null; this._activeDrag = null; } delete this._idList[gesture][id]; } }
javascript
{ "resource": "" }
q56920
train
function (evt) { var event = new ariaDomEvent(evt); connectMouseEvents(this); if (evt.type === "touchstart") { // The position of touch events is not determined correctly by clientX/Y var elementPosition = ariaTouchEvent.getPositions(event); event.clientX = elementPosition[0].x; event.clientY = elementPosition[0].y; } if (this._detectDrag(event)) { event.preventDefault(true); } event.$dispose(); return false; }
javascript
{ "resource": "" }
q56921
train
function (evt) { var stopper = Aria.$window.document.body; var elementId = findByAttribute(evt.target, this.DRAGGABLE_ATTRIBUTE, this.maxDepth, stopper); if (!elementId) { return; } var candidate = this._idList.drag[elementId]; this.$assert(211, !!candidate); this._candidateForDrag = candidate; this._dragStartPosition = { x : evt.clientX, y : evt.clientY }; this._dragStarted = false; return true; }
javascript
{ "resource": "" }
q56922
train
function (coordinates) { var element = this._candidateForDrag; if (!element) { return; } this._activeDrag = element; this._dragStarted = true; element.start(coordinates); }
javascript
{ "resource": "" }
q56923
train
function (evt) { var event = new ariaDomEvent(evt); if (event.type === "touchmove") { var elementPosition = ariaTouchEvent.getPositions(evt); if (elementPosition.length === 1) { event.clientX = elementPosition[0].x; event.clientY = elementPosition[0].y; } } if (this._dragStartPosition && !this._dragStarted) { this._startDrag(this._dragStartPosition); } var element = this._activeDrag; if (element) { // IE mouseup check - mouseup happened when mouse was out of window if (evt.type !== "touchmove" && !evt.button) { var browser = ariaCoreBrowser; if (browser.isIE8 || browser.isIE7) { event.$dispose(); return this._onMouseUp(evt); } } element.move(event); } event.$dispose(); }
javascript
{ "resource": "" }
q56924
train
function (evt) { this._dragStartPosition = null; disconnectMouseEvents(this); var element = this._activeDrag; if (element) { element.end(); } this._candidateForDrag = null; this._activeDrag = null; }
javascript
{ "resource": "" }
q56925
train
function (element, overlay) { // --------------------------------------------------- destructuring var window = Aria.$window; var document = window.document; var body = document.body; // ------------------------------------------------- local functions function getStyle(element, property) { return ariaUtilsDom.getStyle(element, property); } function getZIndex(element) { return getStyle(element, 'zIndex'); } function createsANewStackingContext(element) { var zIndex = getZIndex(element); var position = getStyle(element, 'position'); var opacity = getStyle(element, 'opacity'); return (opacity < 1) || ((zIndex !== 'auto') && (position !== 'static')); } // ------------------------------------------------------ processing var zIndexToBeat = null; // building parent branch ------------------------------------------ var ancestors = []; var currentElement = element; while (currentElement !== body && currentElement != null) { ancestors.unshift(currentElement); currentElement = currentElement.parentNode; } // checking parent branch ------------------------------------------ // only the first (top-most) parent has to be taken into account, further children then being contained in its new stacking context for (var index = 0, length = ancestors.length; index < length; index++) { var potentialStackingContextRoot = ancestors[index]; if (createsANewStackingContext(potentialStackingContextRoot)) { zIndexToBeat = getZIndex(potentialStackingContextRoot); break; } } // checking children if necessary ---------------------------------- if (zIndexToBeat == null) { var getMax = function(values) { return values.length === 0 ? null : Math.max.apply(Math, values); }; var isANumber = function(value) { return !isNaN(value); }; var stackingContexts = []; var findChildrenCreatingANewStackingContext = function(root) { var children = root.children; for (var index = 0, length = children.length; index < length; index++) { var child = children[index]; if (createsANewStackingContext(child)) { stackingContexts.push(child); } else { findChildrenCreatingANewStackingContext(child); } } }; findChildrenCreatingANewStackingContext(element); var zIndexes = []; for (var index = 0, length = stackingContexts.length; index < length; index++) { var stackingContext = stackingContexts[index]; var currentZIndex = getZIndex(stackingContext); if (isANumber(currentZIndex)) { zIndexes.push(currentZIndex); } } zIndexToBeat = getMax(zIndexes); } // final zindex application ---------------------------------------- // Our overlay element is put at last in the DOM, so if there is no other stacking context found, there is no need to put a zIndex ourselves since the natural stacking order will apply. // However, still due to the natural stacking order applied within a same stacking context, there's no need to put a higher zIndex than the top-most stacking context's root, putting the same is sufficient if (zIndexToBeat !== null) { overlay.style.zIndex = '' + zIndexToBeat; } }
javascript
{ "resource": "" }
q56926
train
function (className, msg, level) { var logObject = { classpath : className, msg : msg, level : level, time : new Date().getTime() }; this._logStack.push(logObject); this._processStack(); }
javascript
{ "resource": "" }
q56927
train
function () { // The strategy to send logs is either after a certain delay, or when the stack is bigger than ... var now = new Date().getTime(); if (this._logStack.length > this.minimumLogNb && now > this._lastLogSent + this.minimumInterval) { this._lastLogSent = new Date().getTime(); this._sendStack(); this._logStack = []; } }
javascript
{ "resource": "" }
q56928
train
function () { // stringify the json data var data = ariaUtilsJson.convertToJsonString({ logs : this._logStack }, { maxDepth : 4 }); // Send json post request ariaCoreIO.asyncRequest({ sender : { classpath : this.$classpath }, url : this.url, method : "POST", data : data, callback : { fn : this._stackSent, scope : this } }); }
javascript
{ "resource": "" }
q56929
train
function (e) { var str = ""; if (typeof e == 'undefined' || e == null) { return str; } str = "\nException"; str += "\n" + '---------------------------------------------------'; if (e.fileName) str += '\nFile: ' + e.fileName; if (e.lineNumber) str += '\nLine: ' + e.lineNumber; if (e.message) str += '\nMessage: ' + e.message; if (e.name) str += '\nError: ' + e.name; if (e.stack) str += '\nStack:' + "\n" + e.stack.substring(0, 200) + " [...] Truncated stacktrace."; str += "\n" + '---------------------------------------------------' + "\n"; return str; }
javascript
{ "resource": "" }
q56930
train
function (element, orientation) { if (element.style && element.color) { if (orientation == "V") { return element.leftWidth + element.rightWidth; } else if (orientation == "H") { return element.topWidth + element.bottomWidth; } } return 0; }
javascript
{ "resource": "" }
q56931
train
function (allInterceptors, name, scope, fn) { for (var i in allInterceptors[name]) { if (allInterceptors[name].hasOwnProperty(i)) { __removeCallback(allInterceptors[name], i, scope, fn); } } }
javascript
{ "resource": "" }
q56932
train
function (callbacksMap, name, scope, fn, src, firstOnly) { if (callbacksMap == null) { return; // nothing to remove } var arr = callbacksMap[name]; if (arr) { var length = arr.length, removeThis = false, cb; for (var i = 0; i < length; i++) { cb = arr[i]; // determine if callback should be removed, start with // removeThis = true and then set to false if // conditions are not met // check the interface from which we remove the listener removeThis = (!src || cb.src == src) // scope does not match && (!scope || scope == cb.scope) // fn does not match && (!fn || fn == cb.fn); if (removeThis) { // mark the callback as being removed, so that it can either // still be called (in case of CallEnd in // interceptors, if CallBegin has been called) or not called // at all (in other cases) cb.removed = true; arr.splice(i, 1); if (firstOnly) { break; } else { i--; length--; } } } if (arr.length === 0) { // no listener anymore for this event/interface callbacksMap[name] = null; delete callbacksMap[name]; } } }
javascript
{ "resource": "" }
q56933
train
function (info) { var methodName = require("../utils/String").capitalize(info.method); var fctRef = this["on" + methodName + info.step]; if (fctRef) { return fctRef.call(this, info); } fctRef = this["on" + info.method + info.step]; if (fctRef) { return fctRef.call(this, info); } }
javascript
{ "resource": "" }
q56934
train
function (args, commonInfo, interceptorIndex) { if (interceptorIndex >= commonInfo.nbInterceptors) { // end of recursion: call the real method: return this[commonInfo.method].apply(this, args); } var interc = commonInfo.interceptors[interceptorIndex]; if (interc.removed) { // interceptor was removed in the mean time, skip it. return __callWrapper.call(this, info.args, commonInfo, interceptorIndex + 1); } var info = { step : "CallBegin", method : commonInfo.method, args : args, cancelDefault : false, returnValue : null }; var asyncCbParam = commonInfo.asyncCbParam; if (asyncCbParam != null) { var callback = { fn : __callbackWrapper, scope : this, args : { info : info, interc : interc, // save previous callback: origCb : args[asyncCbParam] } }; args[asyncCbParam] = callback; if (args.length <= asyncCbParam) { // We do this check and set the length property because the // "args" object comes // from the JavaScript arguments object, which is not a real // array so that the // length property is not updated automatically by the previous // assignation: args[asyncCbParam] = callback; args.length = asyncCbParam + 1; } info.callback = callback; } this.$callback(interc, info); if (!info.cancelDefault) { // call next wrapper or real method: try { info.returnValue = __callWrapper.call(this, info.args, commonInfo, interceptorIndex + 1); } catch (e) { info.exception = e; } info.step = "CallEnd"; delete info.cancelDefault; // no longer useful in CallEnd // call the interceptor, even if it was removed in the mean time (so // that CallEnd is always called when // CallBegin has been called): this.$callback(interc, info); if ("exception" in info) { throw info.exception; } } return info.returnValue; }
javascript
{ "resource": "" }
q56935
train
function (res, args) { var interc = args.interc; if (interc.removed) { // the interceptor was removed in the mean time, call the original callback directly return this.$callback(args.origCb, res); } var info = args.info; info.step = "Callback"; info.callback = args.origCb; info.callbackResult = res; info.cancelDefault = false; info.returnValue = null; this.$callback(interc, info); if (info.cancelDefault) { return info.returnValue; } return this.$callback(args.origCb, info.callbackResult); }
javascript
{ "resource": "" }
q56936
train
function (interfaceMethods, interceptor, allInterceptors) { var interceptedMethods = allInterceptors || {}; // for a callback, intercept all methods of an interface for (var i in interfaceMethods) { if (interfaceMethods.hasOwnProperty(i)) { (interceptedMethods[i] || (interceptedMethods[i] = [])).push(interceptor); } } return interceptedMethods; }
javascript
{ "resource": "" }
q56937
train
function (interfaceMethods, interceptor, allInterceptors) { var interceptedMethods = allInterceptors || {}; // for a class object, intercept specific methods for (var m in interfaceMethods) { if (interfaceMethods.hasOwnProperty(m) && __hasBeenIntercepted(m, interceptor)) { (interceptedMethods[m] || (interceptedMethods[m] = [])).push({ fn : __callInterceptorMethod, scope : interceptor }); } } return interceptedMethods; }
javascript
{ "resource": "" }
q56938
train
function () { this.$destructor(); // call $destructor // TODO - cleanup object if (this._listeners) { this._listeners = null; delete this._listeners; } if (this.__$interceptors) { this.__$interceptors = null; delete this.__$interceptors; } if (this.__$interfaces) { require("./Interfaces").disposeInterfaces(this); } }
javascript
{ "resource": "" }
q56939
train
function (msg, msgArgs, err) { // replaced by the true logging function when // aria.core.Log is loaded // If it's not replaced because the log is never // downloaded, at least there will be errors in the // console. if (Aria.$global.console) { if (typeof msgArgs === "string") msgArgs = [msgArgs]; Aria.$global.console.error(msg.replace(/%[0-9]+/g, function (token) { return msgArgs[parseInt(token.substring(1), 10) - 1]; }), err); } return ""; }
javascript
{ "resource": "" }
q56940
train
function (cb, res, errorId) { try { if (!cb) { return; // callback is sometimes not used } if (cb.$Callback) { return cb.call(res); } // perf optimisation : duplicated code on purpose var scope = cb.scope, callback; scope = scope ? scope : this; if (!cb.fn) { callback = cb; } else { callback = cb.fn; } if (typeof(callback) == 'string') { callback = scope[callback]; } var args = (cb.apply === true && cb.args && Object.prototype.toString.apply(cb.args) === "[object Array]") ? cb.args.slice() : [cb.args]; var resIndex = (cb.resIndex === undefined) ? 0 : cb.resIndex; if (resIndex > -1) { args.splice(resIndex, 0, res); } return Function.prototype.apply.call(callback, scope, args); } catch (ex) { this.$logError(errorId || this.CALLBACK_ERROR, [this.$classpath, (scope) ? scope.$classpath : ""], ex); } }
javascript
{ "resource": "" }
q56941
train
function (cb) { var scope = cb.scope, callback; scope = scope ? scope : this; if (!cb.fn) { callback = cb; } else { callback = cb.fn; } if (typeof(callback) == 'string') { callback = scope[callback]; } return { fn : callback, scope : scope, args : cb.args, resIndex : cb.resIndex, apply : cb.apply }; }
javascript
{ "resource": "" }
q56942
train
function (itf, interceptor) { // get the interface constructor: var itfCstr = this.$interfaces[itf]; if (!itfCstr) { this.$logError(this.INTERFACE_NOT_SUPPORTED, [itf, this.$classpath]); return; } var allInterceptors = this.__$interceptors; if (allInterceptors == null) { allInterceptors = {}; this.__$interceptors = allInterceptors; } var interceptMethods = ((require("../utils/Type")).isCallback(interceptor)) ? __interceptCallback : __interceptObject; var itfs = itfCstr.prototype.$interfaces; for (var i in itfs) { if (itfs.hasOwnProperty(i)) { var interceptedMethods = interceptMethods(itfs[i].interfaceDefinition.$interface, interceptor, allInterceptors[i]); allInterceptors[i] = interceptedMethods; } } }
javascript
{ "resource": "" }
q56943
train
function (itf, scope, fn) { var itfCstr = this.$interfaces[itf]; var allInterceptors = this.__$interceptors; if (!itfCstr || !allInterceptors) { return; } var itfs = itfCstr.prototype.$interfaces; // also remove the interceptor on all base interfaces of the interface for (var i in itfs) { if (itfs.hasOwnProperty(i)) { __removeInterceptorCallback(allInterceptors, i, scope, fn); } } }
javascript
{ "resource": "" }
q56944
train
function (interfaceName, methodName, args, asyncCbParam) { var interceptors; if (this.__$interceptors == null || this.__$interceptors[interfaceName] == null || (interceptors = this.__$interceptors[interfaceName][methodName]) == null) { // no interceptor for that interface: call the method directly: return this[methodName].apply(this, args); } return __callWrapper.call(this, args, { interceptors : interceptors, nbInterceptors : interceptors.length, method : methodName, asyncCbParam : asyncCbParam }, 0); }
javascript
{ "resource": "" }
q56945
train
function (lstCfg, itfWrap) { if (this._listeners == null) { return; } var defaultScope = (lstCfg.scope) ? lstCfg.scope : null; var lsn; for (var evt in lstCfg) { if (!lstCfg.hasOwnProperty(evt)) { continue; } if (evt == 'scope') { continue; } if (this._listeners[evt]) { var lsnRm = lstCfg[evt]; if (typeof(lsnRm) == 'function') { if (defaultScope == null) { this.$logError(this.MISSING_SCOPE, evt); continue; } __removeCallback(this._listeners, evt, defaultScope, lsnRm, itfWrap); } else { if (lsnRm.scope == null) { lsnRm.scope = defaultScope; } if (lsnRm.scope == null) { this.$logError(this.MISSING_SCOPE, evt); continue; } __removeCallback(this._listeners, evt, lsnRm.scope, lsnRm.fn, itfWrap, lsnRm.firstOnly); } } } defaultScope = lsn = lsnRm = null; }
javascript
{ "resource": "" }
q56946
train
function (scope, itfWrap) { if (this._listeners == null) { return; } // We must check itfWrap == null, so that it is not possible to unregister all the events of an object // from its interface, if they have not been registered through that interface if (scope == null && itfWrap == null) { // remove all events for (var evt in this._listeners) { if (!this._listeners.hasOwnProperty(evt)) { continue; } this._listeners[evt] = null; // remove array delete this._listeners[evt]; } } else { // note that here, scope can be null (if itfWrap != null) we need to filter all events in this case for (var evt in this._listeners) { if (!this._listeners.hasOwnProperty(evt)) { continue; } __removeCallback(this._listeners, evt, scope, null, itfWrap); } } evt = null; }
javascript
{ "resource": "" }
q56947
train
function (position, callback) { var lastPosition = this._lastMousePosition; lastPosition.x = position.x; lastPosition.y = position.y; this._sendEvent('mousemove', position.x, position.y); this._callCallback(callback); }
javascript
{ "resource": "" }
q56948
train
function (from, to, duration, cb) { var translatedFromPosition = this._translateCoordinates(from); var translatedToPosition = this._translateCoordinates(to); this.smoothAbsoluteMouseMove(translatedFromPosition, translatedToPosition, duration, cb); }
javascript
{ "resource": "" }
q56949
train
function (from, to, duration, cb) { this.absoluteMouseMove(from, { fn : this._stepSmoothAbsoluteMouseMove, scope : this, resIndex : -1, args : { from : from, to : to, duration : duration, cb : cb, endTime : new Date().getTime() + duration } }); }
javascript
{ "resource": "" }
q56950
train
function (button, cb) { var lastPosition = this._lastMousePosition; this._sendEvent('mousedown', lastPosition.x, lastPosition.y, this.BUTTONS[button]); this._callCallback(cb); }
javascript
{ "resource": "" }
q56951
train
function (keyCode, cb) { if (keyCode == this.KEYS.VK_SHIFT) { this._keyShift = true; } if (keyCode == this.KEYS.VK_CTRL) { this._keyCtrl = true; } if (typeof keyCode == "string" && this._keyShift) { keyCode = keyCode.toUpperCase(); } if (keyCode == this.KEYS.VK_ALT) { this._keyAlt = true; } this._sendEvent('keydown', keyCode, null, null, this._getModifier()); this._callCallback(cb); }
javascript
{ "resource": "" }
q56952
train
function (skipBorder, icons) { var hasBorder = (skipBorder === false); if (skipBorder == "dependsOnIcon") { hasBorder = (icons.length === 0); } return hasBorder; }
javascript
{ "resource": "" }
q56953
train
function () { var window = Aria.$window; if (typeof(window.orientation) != "undefined") { // check if browser support orientation change this.screenOrientation = window.orientation; this.isPortrait = this.__isPortrait(); // start listening native event orinetationchange. ariaUtilsEvent.addListener(window, "orientationchange", { fn : this._onOrientationChange, scope : this }); } }
javascript
{ "resource": "" }
q56954
train
function () { this.screenOrientation = Aria.$window.orientation; this.isPortrait = this.__isPortrait(); // raise event "change" to notify about orientation change along with properties for current orientation this.$raiseEvent({ name : "change", screenOrientation : this.screenOrientation, isPortrait : this.isPortrait }); }
javascript
{ "resource": "" }
q56955
train
function () { var value, binding = this._binding; if (!binding) { return; } value = binding.inside[binding.to]; if (ariaUtilsType.isArray(value)) { // Constrain values to be between 0 and 1 and the first to be smaller this.value[0] = Math.max(0, Math.min(value[0], value[1], 1)); this.value[1] = Math.min(1, Math.max(value[0], value[1], 0)); } ariaUtilsJson.setValue(binding.inside, binding.to, this.value, this._bindingCallback); }
javascript
{ "resource": "" }
q56956
train
function () { var first = Math.max(0, Math.min(this.value[0], this.value[1], 1)); var second = Math.min(1, Math.max(this.value[0], this.value[1], 0)); this._savedX1 = Math.floor(first * this._railWidth); this._savedX2 = Math.ceil(second * this._railWidth + this._firstWidth); }
javascript
{ "resource": "" }
q56957
train
function () { var left = this._savedX1 + this._firstWidth / 2; var widthHighlight = this._savedX2 + (this._secondWidth / 2) - left; this._highlight.style.left = left + "px"; this._highlight.style.width = widthHighlight + "px"; }
javascript
{ "resource": "" }
q56958
train
function (evt) { this._oldValue = [this.value[0], this.value[1]]; // Just store the initial position of the element to compute the move later this._initialDrag = evt.src.posX; this._initialSavedX = evt.src.id === this._firstDomId ? this._savedX1 : this._savedX2; }
javascript
{ "resource": "" }
q56959
train
function () { var left = this._savedX1, right = this._savedX2; var first = Math.max(left / this._railWidth, 0); var second = Math.min((right - this._firstWidth) / this._railWidth, 1); if (this.value[0] !== first || this.value[1] !== second) { this.value = [first, second]; var binding = this._binding; ariaUtilsJson.setValue(binding.inside, binding.to, this.value); } else { // Trying to go somewhere far, don't update value, but only the display this._notifyDataChange(); } return; }
javascript
{ "resource": "" }
q56960
train
function (frame, cb, options) { this.loadBootstrap({ fn : this._loadATInFrameCb1, scope : this, args : { options : options || {}, frame : frame, cb : cb } }); }
javascript
{ "resource": "" }
q56961
train
function (pattern) { var scripts = Aria.$frameworkWindow.document.getElementsByTagName("script"); for (var i = 0, l = scripts.length; i < l; i++) { var script = scripts[i]; if (script.attributes && script.attributes["src"]) { var src = script.attributes["src"].nodeValue; if (pattern.exec(src)) { return src; } } } this.$logError("Could not find the script corresponding to pattern: %1. Please set the aria.jsunit.FrameATLoader.frameworkHref property manually."); return null; }
javascript
{ "resource": "" }
q56962
train
function (res, cb) { if (res.downloadFailed) { this.__onFailure(res, cb.args); } else { var fileContent = ariaCoreDownloadMgr.getFileContent(res.logicalPaths[0]); var responseJSON = ariaUtilsJson.load(fileContent); if (responseJSON) { this.$callback(cb, responseJSON); } else { this.__onFailure(res, cb.args); } } }
javascript
{ "resource": "" }
q56963
train
function (pageRequest) { var map = this.__urlMap.urlToPageId, pageId = pageRequest.pageId, url = pageRequest.url; if (pageId) { return pageId; } if (url) { var returnUrl = map[url] || map[url + "/"] || map[url.replace(/\/$/, "")]; if (returnUrl) { return returnUrl; } } return this.__config.homePageId; }
javascript
{ "resource": "" }
q56964
train
function (cfg, callback, update) { update = !!update; var keys = ariaUtilsObject.keys(cfg); if (update) { ariaUtilsJson.inject(cfg, this.applicationSettings, true); } else { if (keys.length === 0) { // reset stored application settings this.applicationSettings = {}; keys = null; } else { for (var i = 0; i < keys.length; i++) { var keyName = keys[i]; this.applicationSettings[keyName] = cfg[keyName]; } } } var evt = { name : "changingEnvironment", changedProperties : keys, asyncCalls : 1 }; evt.callback = { fn : function () { evt.asyncCalls--; if (evt.asyncCalls <= 0) { evt.callback.fn = null; evt = null; keys = null; this.$callback(callback); } }, scope : this }; this.$raiseEvent(evt); this.$raiseEvent({ name : "environmentChanged", changedProperties : keys }); this.$callback(evt.callback); }
javascript
{ "resource": "" }
q56965
train
function (textContent) { // String cast if (textContent !== null) { textContent = '' + textContent; } else { textContent = ''; } var dom = this.getDom(); if (dom) { var stringUtils = ariaUtilsString; this.textContent = textContent; dom.style.display = "inline-block"; dom.style.overflow = "hidden"; dom.style.whiteSpace = "nowrap"; dom.style.verticalAlign = "top"; var textWidth, ellipsisElement = ariaUtilsDom.getDomElementChild(dom, 0); if (!ellipsisElement) { dom.innerHTML = '<span class="createdEllipisElement">' + stringUtils.escapeHTML(this.textContent) + '</span>'; ellipsisElement = ariaUtilsDom.getDomElementChild(dom, 0); } if (this._cfg.width > 0) { textWidth = this._cfg.width; dom.style.width = this._cfg.width + "px"; this._ellipsis = new ariaUtilsEllipsis(ellipsisElement, textWidth, this._cfg.ellipsisLocation, this._cfg.ellipsis, this._context, this._cfg.ellipsisEndStyle); if (!this._ellipsis.ellipsesNeeded) { // No ellipsis was done so remove the <span> and put the full text into the text widget itself dom.removeChild(ellipsisElement); dom.innerHTML = stringUtils.escapeHTML(textContent); } } } }
javascript
{ "resource": "" }
q56966
train
function (providerName, provider) { if (providers[providerName]) { this.$logError(this.DUPLICATED_PROVIDER, providerName); } else { if (ariaUtilsType.isObject(provider)) { if (this._isValidProvider(provider)) { providerInstances[providerName] = provider; providers[providerName] = provider; } else { this.$logError(this.INVALID_PROVIDER, providerName); } } else { providers[providerName] = provider; } } }
javascript
{ "resource": "" }
q56967
train
function (providerName) { this.destroyAllMaps(providerName); delete providers[providerName]; if (providerInstancesToDispose[providerName]) { providerInstancesToDispose[providerName].$dispose(); delete providerInstancesToDispose[providerName]; } delete providerInstances[providerName]; }
javascript
{ "resource": "" }
q56968
train
function (provider) { var valid = true, methods = ["load", "getMap", "disposeMap"]; for (var i = 0; i < methods.length; i++) { valid = valid && provider[methods[i]] && ariaUtilsType.isFunction(provider[methods[i]]); } return valid; }
javascript
{ "resource": "" }
q56969
train
function (res, cfg) { var providerInstance = providerInstances[cfg.provider]; providerInstance.load({ fn : this._retrieveMapInstance, scope : this, args : cfg }); }
javascript
{ "resource": "" }
q56970
train
function () { var freeTxtStatus = false, dataListContent = this._dataModel.listContent; for (var i = 0, len = dataListContent.length; i < len; i += 1) { if (this._dataModel.text === dataListContent[i].value.label) { freeTxtStatus = true; break; } } return freeTxtStatus; }
javascript
{ "resource": "" }
q56971
train
function (value) { var report = new ariaWidgetsControllersReportsDropDownControllerReport(), dataModel = this._dataModel; if (value == null) { // can be null either because it bound to null or because a request is in progress dataModel.text = (this._pendingRequestNb > 0 && dataModel.text) ? dataModel.text : ""; dataModel.value = null; report.ok = true; } else if (value && !typeUtil.isString(value)) { if (ariaCoreJsonValidator.check(value, this._resourcesHandler.SUGGESTION_BEAN)) { var text = this._getLabelFromSuggestion(value); dataModel.text = text; dataModel.value = value; report.ok = true; } else { dataModel.value = null; report.ok = false; this.$logError("Value does not match definition for this autocomplete: " + this._resourcesHandler.SUGGESTION_BEAN, [], value); } } else { if (typeUtil.isString(value)) { dataModel.text = value; } if (!this.freeText) { report.ok = false; dataModel.value = null; } else { report.ok = true; dataModel.value = value; } } report.value = dataModel.value; report.text = dataModel.text; return report; }
javascript
{ "resource": "" }
q56972
train
function (suggestions, textEntry) { var matchValueIndex = -1, suggestion; for (var index = 0, len = suggestions.length, label, ariaLabel; index < len; index += 1) { suggestion = suggestions[index]; // if it's the first exact match, store it if (matchValueIndex == -1) { if (suggestion.exactMatch) { matchValueIndex = index; } } label = this._getLabelFromSuggestion(suggestion); ariaLabel = this.waiSuggestionAriaLabelGetter ? this.waiSuggestionAriaLabelGetter({ value: suggestion, index: index, total: len }) : null; var tmp = { entry : textEntry, label : label, ariaLabel : ariaLabel, value : suggestion }; suggestions[index] = tmp; } return this.preselect === "none" ? -1 : matchValueIndex; }
javascript
{ "resource": "" }
q56973
train
function (config, event) { return (event.altKey == !!config.alt) && (event.shiftKey == !!config.shift) && (event.ctrlKey == !!config.ctrl); }
javascript
{ "resource": "" }
q56974
train
function (event) { var specialKey = false, keyCode = event.keyCode; for (var index = 0, keyMap; index < this.selectionKeys.length; index++) { keyMap = this.selectionKeys[index]; if (this._validateModifiers(keyMap, event)) { // case real key defined. For eg: 65 for a if (ariaUtilsType.isNumber(keyMap.key)) { if (keyMap.key === keyCode) { specialKey = true; break; } } else if (typeof(keyMap.key) !== "undefined" && event["KC_" + keyMap.key.toUpperCase()] == keyCode) { specialKey = true; break; } else if (typeof(keyMap.key) !== "undefined" && String.fromCharCode(event.charCode) == keyMap.key) { specialKey = true; break; } } } return specialKey; }
javascript
{ "resource": "" }
q56975
train
function (el) { var document = Aria.$window.document; // Need to make sure the new element has the same exact styling applied as the original element so we use // the same tag, class, style and append it to the same parent var tempSizerEl = document.createElement(el.tagName); tempSizerEl.className = el.className; tempSizerEl.setAttribute("style", el.getAttribute("style")); el.parentNode.appendChild(tempSizerEl); // Now we need to make sure the element displays on one line and is not visible in the page tempSizerEl.style.visibility = "hidden"; tempSizerEl.style.position = "absolute"; tempSizerEl.style.whiteSpace = "nowrap"; return tempSizerEl; }
javascript
{ "resource": "" }
q56976
train
function (relatedTarget) { if (this.callbackID) { ariaCoreTimer.cancelCallback(this.callbackID); } if (this._popup != null) { if (!ariaUtilsDom.isAncestor(relatedTarget, this._popup.domElement)) { if (this._popup) { this._popup.closeOnMouseOut(); } } } this.callbackID = null; }
javascript
{ "resource": "" }
q56977
train
function (fn, context) { var args = []; for (var i = 2; i < arguments.length; i++) { args.push(arguments[i]); } return function () { // need to make a copy each time var finalArgs = args.slice(0); // concat won't work, as arguments is a special array for (var i = 0; i < arguments.length; i++) { finalArgs.push(arguments[i]); } return fn.apply(context, finalArgs); }; }
javascript
{ "resource": "" }
q56978
train
function (src, dest, fnNames, prefix) { if (!prefix) { prefix = ''; } for (var index = 0, l = fnNames.length; index < l; index++) { var key = fnNames[index]; dest[prefix + key] = this.bind(src[key], src); } }
javascript
{ "resource": "" }
q56979
train
function (options) { var dataModel = this._dataModel; // normalize labels to lowerCase var sz = options.length, item; for (var i = 0; sz > i; i++) { item = options[i]; item[this.LABEL_META] = item.label.toLowerCase(); } jsonUtils.setValue(dataModel, 'listContent', options); this._setDisplayIdx(0); }
javascript
{ "resource": "" }
q56980
train
function (includeValue) { var dataModel = this._dataModel; var report = new ariaWidgetsControllersReportsDropDownControllerReport(); report.ok = true; if (includeValue) { report.value = dataModel.value; } report.text = dataModel.displayText; return report; }
javascript
{ "resource": "" }
q56981
train
function (displayIdx) { var dataModel = this._dataModel; var options = dataModel.listContent; if (options.length === 0) { displayIdx = -1; } else if (displayIdx >= options.length) { displayIdx = options.length - 1; } else if (displayIdx < 0) { displayIdx = 0; } if (displayIdx == -1) { jsonUtils.setValue(dataModel, 'selectedIdx', -1); jsonUtils.setValue(dataModel, 'displayIdx', -1); jsonUtils.setValue(dataModel, 'displayText', ''); jsonUtils.setValue(dataModel, 'value', null); } else { jsonUtils.setValue(dataModel, 'selectedIdx', displayIdx); jsonUtils.setValue(dataModel, 'displayIdx', displayIdx); jsonUtils.setValue(dataModel, 'displayText', options[displayIdx].label); jsonUtils.setValue(dataModel, 'value', options[displayIdx].value); } }
javascript
{ "resource": "" }
q56982
train
function (lastTypedKeys, newMatch) { var LABEL_META = this.LABEL_META; var options = this._dataModel.listContent; var keyNbr = lastTypedKeys.length; var index = this._dataModel.selectedIdx + (newMatch ? 1 : 0); // start point to search for a match for (var ct = 0, optionsLength = options.length; ct < optionsLength; ct++, index++) { if (index >= optionsLength) { index = 0; } var opt = options[index]; var prefix = opt[LABEL_META].substr(0, keyNbr); if (prefix == lastTypedKeys) { return index; } } return -1; // not found }
javascript
{ "resource": "" }
q56983
train
function (charCode, keyCode) { var dataModel = this._dataModel; var report; if (domEvent.isNavigationKey(keyCode)) { var newIdx; var validationKey = false; if (keyCode == domEvent.KC_LEFT || keyCode == domEvent.KC_UP) { newIdx = dataModel.selectedIdx - 1; } else if (keyCode == domEvent.KC_RIGHT || keyCode == domEvent.KC_DOWN) { newIdx = dataModel.selectedIdx + 1; } else if (keyCode == domEvent.KC_PAGE_UP) { newIdx = dataModel.selectedIdx - (dataModel.pageSize - 1); } else if (keyCode == domEvent.KC_PAGE_DOWN) { newIdx = dataModel.selectedIdx + (dataModel.pageSize - 1); } else if (keyCode == domEvent.KC_HOME) { newIdx = 0; } else if (keyCode == domEvent.KC_END) { newIdx = dataModel.listContent.length - 1; } else if (keyCode == domEvent.KC_ENTER) { // when pressing enter, the currently highlighted item in the dropdown becomes the current // value: newIdx = dataModel.selectedIdx; validationKey = true; } else if (keyCode == domEvent.KC_ESCAPE) { // pressing escape has no effect if the popup is not open // it only closes the popup when it is open (does not update the data model) if (this._listWidget) { report = this._createReport(false); report.displayDropDown = false; report.cancelKeyStroke = true; jsonUtils.setValue(dataModel, 'selectedIdx', dataModel.displayIdx); } } else if (keyCode == domEvent.KC_TAB) { // when pressing tab, the currently selected item stays the current value: newIdx = dataModel.displayIdx; validationKey = true; } if (newIdx != null) { this._setLastTypedKeys(null); this._setDisplayIdx(newIdx); report = this._createReport(validationKey); // never cancel TAB keystroke, and ENTER should not be canceled when the list widget is no // longer displayed report.cancelKeyStroke = (keyCode != domEvent.KC_TAB && (keyCode != domEvent.KC_ENTER || this._listWidget != null)); if (this._listWidget && validationKey) { report.displayDropDown = false; } } } else { var lastTypedKeys = dataModel.lastTypedKeys; var newMatch = (lastTypedKeys == null); if (newMatch) { lastTypedKeys = ""; } var newLastTypedKeys; if (keyCode == domEvent.KC_BACKSPACE) { newLastTypedKeys = this._getTypedValueOnDelete(keyCode, lastTypedKeys, lastTypedKeys.length, lastTypedKeys.length).nextValue; // we do not look for a new match when pressing backspace, only save the resulting lastTypedKeys } else { newLastTypedKeys = this._getTypedValue(charCode, lastTypedKeys, lastTypedKeys.length, lastTypedKeys.length).nextValue; newLastTypedKeys = newLastTypedKeys.toLowerCase(); var matchingIndex = this._findMatch(newLastTypedKeys, newMatch); if (matchingIndex == -1) { matchingIndex = this._findLetterMatch(newLastTypedKeys); } if (matchingIndex > -1) { this._setDisplayIdx(matchingIndex); } } report = this._createReport(false); report.cancelKeyStroke = true; this._setLastTypedKeys(newLastTypedKeys); } return report; }
javascript
{ "resource": "" }
q56984
train
function (internalValue) { var options = this._dataModel.listContent; var indexFound = -1; for (var i = 0, l = options.length; i < l; i++) { if (options[i].value == internalValue) { indexFound = i; break; } } this._setDisplayIdx(indexFound); return this._createReport(true); }
javascript
{ "resource": "" }
q56985
train
function () { var report = new ariaWidgetsControllersReportsDropDownControllerReport(); report.displayDropDown = (this._listWidget == null); if (this._dataModel && this._dataModel.displayIdx !== this._dataModel.selectedIdx) { this._setDisplayIdx(this._dataModel.displayIdx); } return report; }
javascript
{ "resource": "" }
q56986
train
function (tagName, propertyName) { if (!__properties.hasOwnProperty(propertyName)) { return "--"; } var property = __properties[propertyName]; if (typeof property == "object") { tagName = tagName.toUpperCase(); if (!property.hasOwnProperty(tagName)) { return "--"; } property = property[tagName]; } return property; }
javascript
{ "resource": "" }
q56987
train
function (path, context) { if (!path || typeof(path) != 'string') { Aria.$logError(Aria.NULL_CLASSPATH); return false; } var classpathParts = path.split('.'), nbParts = classpathParts.length; for (var index = 0; index < nbParts - 1; index++) { if (!__checkPackageName(classpathParts[index], context)) { return false; } } if (!__checkClassName(classpathParts[nbParts - 1], context)) { return false; } return true; }
javascript
{ "resource": "" }
q56988
train
function (className, context) { context = context || ''; if (!className || !className.match(/^[_A-Z]\w*$/)) { Aria.$logError(Aria.INVALID_CLASSNAME_FORMAT, [className, context]); return false; } if (Aria.isJsReservedWord(className)) { Aria.$logError(Aria.INVALID_CLASSNAME_RESERVED, [className, context]); return false; } return true; }
javascript
{ "resource": "" }
q56989
train
function (packageName, context) { context = context || ''; if (!packageName) { Aria.$logError(Aria.INVALID_PACKAGENAME_FORMAT, [packageName, context]); return false; } if (Aria.isJsReservedWord(packageName)) { Aria.$logError(Aria.INVALID_PACKAGENAME_RESERVED, [packageName, context]); return false; } if (!packageName.match(/^[a-z]\w*$/)) { Aria.$logInfo(Aria.INVALID_PACKAGENAME_FORMAT, [packageName, context]); } return true; }
javascript
{ "resource": "" }
q56990
train
function (obj, def, superclass, fn, params) { var newcall = (!obj["aria:nextCall"]); if (!newcall && obj["aria:nextCall"] != def.$classpath) { Aria.$logError(Aria.WRONGPARENT_CALLED, [fn, def.$classpath, obj["aria:nextCall"], obj.$classpath]); } obj["aria:nextCall"] = (superclass ? superclass.classDefinition.$classpath : null); if (def[fn]) { def[fn].apply(obj, params); } else if (superclass && fn == "$destructor") { // no destructor: must call the parent destructor, by default superclass.prototype.$destructor.apply(obj, params); } if (obj["aria:nextCall"] && obj["aria:nextCall"] != "aria.core.JsObject") { Aria.$logError(Aria.PARENT_NOTCALLED, [fn, obj["aria:nextCall"], def.$classpath]); } if (newcall) { obj["aria:nextCall"] = undefined; } return newcall; }
javascript
{ "resource": "" }
q56991
train
function (mergeTo, mergeFrom, classpathTo) { var hasEvents = false; for (var k in mergeFrom) { if (mergeFrom.hasOwnProperty(k)) { if (!hasEvents) { hasEvents = true; } // The comparison with null below is important, as an empty string is a valid event description. if (mergeTo[k] != null) { Aria.$logError(Aria.REDECLARED_EVENT, [k, classpathTo]); } else { mergeTo[k] = mergeFrom[k]; } } } return hasEvents; }
javascript
{ "resource": "" }
q56992
train
function (options) { /** * Whether the serializer instance should be disposed when this instance is disposed * @type Boolean * @protected */ this._disposeSerializer = false; /** * Callback for storage events * @type aria.core.CfgBeans:Callback */ this._eventCallback = { fn : this._onStorageEvent, scope : this }; // listen to events raised by other instances on the same window ariaStorageEventBus.$on({ "change" : this._eventCallback }); var serializer = options ? options.serializer : null, create = true; if (serializer) { if ("serialize" in serializer && "parse" in serializer) { // There is a serializer matching the interface, it's the only case where we don't have to create a // new instance create = false; } else { this.$logError(this.INVALID_SERIALIZER); } } if (create) { serializer = new ariaUtilsJsonJsonSerializer(true); this._disposeSerializer = true; } /** * Serializer instance * @type aria.utils.json.ISerializer */ this.serializer = serializer; var nspace = ""; if (options && options.namespace) { if (!ariaUtilsType.isString(options.namespace)) { this.$logError(this.INVALID_NAMESPACE); } else { // The dollar is just there to separate the keys from the namespace nspace = options.namespace + "$"; } } /** * Namespace. It's the prefix used to store keys. It's a sort of security feature altough it doesn't provide * much of it. * @type String */ this.namespace = nspace; }
javascript
{ "resource": "" }
q56993
train
function (event) { if (event.key === null || event.namespace === this.namespace) { var lessDetailedEvent = ariaUtilsJson.copy(event, false, this.EVENT_KEYS); this.$raiseEvent(lessDetailedEvent); } }
javascript
{ "resource": "" }
q56994
train
function (event, widgetDesc) { var widget = widgetDesc.widget; var domElt = widget.getDom(); if (domElt) { this.moduleCtrl.displayHighlight(domElt, "#FF6666"); } this.mouseOver(event); event.stopPropagation(); }
javascript
{ "resource": "" }
q56995
train
function (event) { this.data.showSource = !this.data.showSource; if (this.data.showSource) { this.data.initialSource = true; var filePath = this.data.templateCtxt.tplClasspath.replace(/\./g, "/") + ".tpl"; this.data.source = this.moduleCtrl.getSource(filePath).value; } this.$refresh(); }
javascript
{ "resource": "" }
q56996
train
function (event) { if (this.data.initialSource) { ariaUtilsJson.setValue(this.data, "initialSource", false); this.$refresh({ section : "controls" }); } this.data.tplSrcEdit = event.target.getValue(); }
javascript
{ "resource": "" }
q56997
train
function (template, context, statements, throwErrors) { this.context = context; // Remove comments this._prepare(template, throwErrors); // Preprocess if (!this.__preprocess(statements, throwErrors)) { return null; } // Compute line numbers this._computeLineNumbers(); // Build the tree return this._buildTree(throwErrors); }
javascript
{ "resource": "" }
q56998
train
function (dictionary, throwErrors) { // Everyting starts on the first { var text = this.template, utilString = ariaUtilsString, currentPosition = 0, nextOpening = -1, nextClosing = -1, wholeText = [], nameExtractor = /^\{[\s\/]*?([\w]+)\b/, lastCopiedPosition = 0, textLength = text.length, statementLevel = -1, currentLevel = 0, lastOpenedLevel0 = -1; while (lastCopiedPosition < textLength) { // Update the pointers if (nextOpening < currentPosition) { nextOpening = utilString.indexOfNotEscaped(text, "{", currentPosition); } if (nextClosing < currentPosition) { nextClosing = utilString.indexOfNotEscaped(text, "}", currentPosition); } if (nextOpening > -1 && (nextClosing > nextOpening || nextClosing == -1)) { // found a '{' if (currentLevel === 0) { lastOpenedLevel0 = nextOpening; } currentLevel++; if (statementLevel == -1) { // we are not inside a statement if (text.charAt(nextOpening - 1) == "$") { // we do not prefix in case we have ${...} statementLevel = currentLevel; } else { var tag = text.substring(nextOpening, nextClosing); var currentTagName = nameExtractor.exec(tag); if (currentTagName && dictionary[currentTagName[1]]) { // It's a statement, it shouldn't be escaped // and we should skip everything inside this statement statementLevel = currentLevel; } else { // add a prefix wholeText.push(text.substring(lastCopiedPosition, nextOpening)); wholeText.push('\\{'); lastCopiedPosition = nextOpening + 1; } } } currentPosition = nextOpening + 1; } else if (nextClosing > -1) { // found '}' if (currentLevel === 0) { // missing opening '{' corresponding to '}' this._computeLineNumbers(); this.logOrThrowError(this.MISSING_OPENINGBRACES, [this.positionToLineNumber(nextClosing)], this.context, throwErrors); return false; } if (statementLevel == currentLevel) { statementLevel = -1; // no longer inside a statement } else if (statementLevel == -1) { // add the prefix for the closing } wholeText.push(text.substring(lastCopiedPosition, nextClosing)); wholeText.push('\\}'); lastCopiedPosition = nextClosing + 1; } currentLevel--; currentPosition = nextClosing + 1; } else { this.$assert(94, nextOpening == -1 && nextClosing == -1); // no more '{' or '}' currentPosition = textLength; wholeText.push(text.substring(lastCopiedPosition, textLength)); lastCopiedPosition = textLength; } } if (currentLevel > 0) { // missing opening '{' corresponding to '}' this._computeLineNumbers(); this.logOrThrowError(this.MISSING_CLOSINGBRACES, [this.positionToLineNumber(lastOpenedLevel0)], this.context, throwErrors); return false; } this.template = wholeText.join(""); return true; }
javascript
{ "resource": "" }
q56999
train
function (event) { if (event.type == "tapstart") { this.timerId = ariaCoreTimer.addCallback({ fn : this._delayedHighlightCB, scope : this, delay : this._timeDelay }); } if (event.type == "tapcancel" || event.type == "tap") { if (this.timerId) { ariaCoreTimer.cancelCallback(this.timerId); this.timerId = null; } if (event.type == "tapcancel" || (event.type == "tap" && !this._isLink)) { this._classList.remove("touchLibButtonPressed"); } } }
javascript
{ "resource": "" }