var _____WB$wombat$assign$function_____ = function(name) {return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name)) || self[name]; }; if (!self.__WB_pmw) { self.__WB_pmw = function(obj) { this.__WB_source = obj; return this; } } { let window = _____WB$wombat$assign$function_____("window"); let self = _____WB$wombat$assign$function_____("self"); let document = _____WB$wombat$assign$function_____("document"); let location = _____WB$wombat$assign$function_____("location"); let top = _____WB$wombat$assign$function_____("top"); let parent = _____WB$wombat$assign$function_____("parent"); let frames = _____WB$wombat$assign$function_____("frames"); let opener = _____WB$wombat$assign$function_____("opener"); var __aspxSpindButtonIdPostfix = "_B"; var __aspxNumberDecimalSeparator = ","; __aspxSERepeatBtnMinIntervalDelay = 5; __aspxSERepeatBtnMaxIntervalDelay = 300; ASPxClientSpinEditBase = _aspxCreateClass(ASPxClientButtonEditBase, { constructor: function(name) { this.constructor.prototype.constructor.call(this, name); this.largeDecButtonIndex = -1; this.incButtonIndex = -2; this.decButtonIndex = -3; this.largeIncButtonIndex = -4; this.valueChangedDelay = 0; this.valueChangedTimerID = -1; this.repeatButtonTimerID = -1; this.buttonsHeightCorrected = false; this.loadedSpinButtonImageCount = 0; this.spinButtonImageCount = 0; this.mainCellHeight = 0; this.mainCellHeightCalculated = false; aspxGetSpinEditCollection().Add(this); }, Initialize: function() { this.AssignButtonAttributes(); ASPxClientButtonEditBase.prototype.Initialize.call(this); }, AssignButtonAttributes: function() { var buttons = [ this.GetIncrementButton(), this.GetDecrementButton(), this.GetLargeIncrementButton(), this.GetLargeDecrementButton() ]; for (var i = 0; i < buttons.length; i++) { var button = buttons[i]; if (!_aspxIsExistsElement(button)) continue; _aspxPreventElementDragAndSelect(button, true); button.needClearSelection = true; if (!__aspxNetscapeFamily) button.unselectable = "on"; } }, GetIncrementButton: function() { return this.GetButton(this.incButtonIndex); }, GetDecrementButton: function() { return this.GetButton(this.decButtonIndex); }, GetLargeIncrementButton: function() { return this.GetButton(this.largeIncButtonIndex); }, GetLargeDecrementButton: function() { return this.GetButton(this.largeDecButtonIndex); }, GetButtonNumber: function(id) { var pos = id.lastIndexOf(__aspxSpindButtonIdPostfix); if (pos > -1) return id.substring(pos + __aspxSpindButtonIdPostfix.length, id.length); return null; }, GetSpinButtonCell: function() { return this.GetChild("_SPBtnCell"); }, GetMainTableCellSpacing: function() { var cell = this.GetSpinButtonCell(); var tableElem = _aspxGetParentByTagName(cell, "table"); return __aspxNetscapeFamily ? tableElem.attributes["cellspacing"].value : tableElem.cellSpacing; }, AdjustControlCore: function() { ASPxClientButtonEditBase.prototype.AdjustControlCore.call(this); this.CorrectButtonsHeight(); }, CorrectButtonsHeight: function() { if(!this.mainCellHeightCalculated) if(this.IsDisplayed()) this.UpdateMainCellHeight(); var cell = this.GetSpinButtonCell(); if (cell) { var incButton = this.GetIncrementButton(); var decButton = this.GetDecrementButton(); if (incButton && decButton) { if (__aspxOpera) { var incImg = _aspxGetElementsByTagName(incButton, "img")[0]; var decImg = _aspxGetElementsByTagName(decButton, "img")[0]; if (_aspxIsExists(decImg.isLoaded) || _aspxIsExists(incImg.isLoaded)) this.CorrectSpinButtonsHeightWithImage(); else { if (incImg && !_aspxIsExists(incImg.isLoaded)) this.SubscribeImageLoadEvent(incImg); if (decImg && !_aspxIsExists(decImg.isLoaded)) this.SubscribeImageLoadEvent(decImg); } } else this.CorrectSpinButtonsHeightWithImage(); } else { var largeIncButton = this.GetLargeIncrementButton(); var largeDecButton = this.GetLargeDecrementButton(); if (largeIncButton && largeDecButton) { var h = largeIncButton.offsetHeight; if (__aspxOpera || __aspxWebKitFamily || __aspxIE && h < this.mainCellHeight) this.SetActualElementHeigth(_aspxGetChildByTagName(cell, "table", 0), this.mainCellHeight); } } } this.buttonsHeightCorrected = true; }, CalcMainCellHeight: function() { var ret = 0; var cell = this.GetSpinButtonCell(); if (cell) { ret = cell.clientHeight; var cellSpacing = this.GetMainTableCellSpacing(); if (__aspxOpera) { if (cellSpacing == 0) ret = ret - 1; } } return ret; }, UpdateMainCellHeight: function() { this.mainCellHeight = this.CalcMainCellHeight(); this.mainCellHeightCalculated = true; }, CorrectSpinButtonsHeightWithImage: function() { var cell = this.GetSpinButtonCell(); var incButton = this.GetIncrementButton(); var decButton = this.GetDecrementButton(); var incImg = _aspxGetElementsByTagName(incButton, "img")[0]; if (cell && incImg && this.GetMainTableCellSpacing() == 0) incImg.style.marginTop = "1px"; var h = incButton.offsetHeight + decButton.offsetHeight; if (__aspxOpera || __aspxWebKitFamily || __aspxIE && h < this.mainCellHeight) this.SetActualElementHeigth(_aspxGetChildByTagName(cell, "table", 0), this.mainCellHeight); if (__aspxWebKitFamily || __aspxOpera) this.CorrectIncrementButtonsHeight(); }, CorrectIncrementButtonsHeight: function() { var incButton = this.GetIncrementButton(); var decButton = this.GetDecrementButton(); if(_aspxIsExistsElement(incButton) && _aspxIsExistsElement(decButton)) { var excess = 0; var style = _aspxGetCurrentStyle(incButton); excess += _aspxPxToInt(style.paddingTop) + _aspxPxToInt(style.paddingBottom); if(__aspxWebKitFamily) excess += _aspxPxToInt(style.borderTopWidth) + _aspxPxToInt(style.borderBottomWidth); style = _aspxGetCurrentStyle(decButton); excess += _aspxPxToInt(style.paddingTop) + _aspxPxToInt(style.paddingBottom); if(__aspxWebKitFamily) excess += _aspxPxToInt(style.borderTopWidth) + _aspxPxToInt(style.borderBottomWidth); var difHeight = this.mainCellHeight - excess; var decBtnHeight = Math.floor(difHeight / 2); decButton.style.height = decBtnHeight + "px"; incButton.style.height = difHeight - decBtnHeight + "px"; } }, SubscribeImageLoadEvent: function(imageElement) { this.spinButtonImageCount++; _aspxAttachEventToElement(imageElement, "load", _aspxCreateEventHandlerFunction("aspxSpinImageOnLoad", this.name, false)); }, OnSpinButtonImageLoad: function() { this.loadedSpinButtonImageCount++; if (this.loadedSpinButtonImageCount == this.spinButtonImageCount) { this.UpdateMainCellHeight(); this.CorrectSpinButtonsHeightWithImage(); } }, SetHeight: function(height) { this.mainCellHeightCalculated = false; ASPxClientButtonEditBase.prototype.SetHeight.call(this, value); }, GetNextTimerInterval: function(iterationIndex) { var coef = 1 / iterationIndex; if (coef < 0.13) coef = 0.13; return coef * __aspxSERepeatBtnMaxIntervalDelay; }, DoRepeatButtonClick: function(num, iterationIndex) { this.ProcessInternalButtonClick(num); var timerInterval = this.GetNextTimerInterval(iterationIndex); if (iterationIndex < 50) iterationIndex++; this.SetButtonRepeatClickTimer(num, timerInterval, iterationIndex); }, SetButtonRepeatClickTimer: function(num, timerInterval, iterationIndex) { if(this.repeatButtonTimerIDLocked) return; var str = "aspxSRepeatButtonClick(\"" + this.name + "\"," + num.toString() + "," + iterationIndex.toString() + ")"; this.repeatButtonTimerID = _aspxSetTimeout(str, timerInterval); }, ClearButtonRepeatClickTimer: function() { this.repeatButtonTimerIDLocked = true; this.repeatButtonTimerID = _aspxClearTimer(this.repeatButtonTimerID); window.setTimeout(function () { this.repeatButtonTimerIDLocked = false; }.aspxBind(this), 0); }, ProcessInternalButtonClick: function(buttonIndex) { }, OnAfterSetPressed: function(id) { var num = this.GetButtonNumber(id); if (num != null) this.SetButtonRepeatClickTimer(num, 300, 1); }, OnAfterClearPressed: function(id) { this.ClearButtonRepeatClickTimer(); }, OnButtonMouseDown: function(evt) { if (__aspxNetscapeFamily || ASPxClientTouchUI.isTouchEvent(evt)) evt.preventDefault(); }, OnValueChanged: function() { if (this.valueChangedDelay == 0) this.OnValueChangedTimer(); else { if (this.valueChangedTimerID > -1) { window.clearTimeout(this.valueChangedTimerID); this.valueChangedTimerID = -1; } this.valueChangedTimerID = window.setTimeout("aspxSEValueChanged(\"" + this.name + "\")", this.valueChangedDelay); } }, OnValueChangedTimer: function() { if (this.valueChangedTimerID > -1) { window.clearTimeout(this.valueChangedTimerID); this.valueChangedTimerID = -1; } this.RaisePersonalStandardValidation(); this.InvokeActualOnValueChanged(); }, InvokeActualOnValueChanged: function() { ASPxClientButtonEditBase.prototype.OnValueChanged.call(this); }, ChangeEnabledAttributes: function(enabled) { ASPxClientButtonEditBase.prototype.ChangeEnabledAttributes.call(this, enabled); var btnElement = this.GetIncrementButton(); if (btnElement) this.ChangeButtonEnabledAttributes(btnElement, _aspxChangeAttributesMethod(enabled)); btnElement = this.GetDecrementButton(); if (btnElement) this.ChangeButtonEnabledAttributes(btnElement, _aspxChangeAttributesMethod(enabled)); btnElement = this.GetLargeIncrementButton(); if (btnElement) this.ChangeButtonEnabledAttributes(btnElement, _aspxChangeAttributesMethod(enabled)); btnElement = this.GetLargeDecrementButton(); if (btnElement) this.ChangeButtonEnabledAttributes(btnElement, _aspxChangeAttributesMethod(enabled)); }, ChangeEnabledStateItems: function(enabled) { this.ClearButtonRepeatClickTimer(); ASPxClientButtonEditBase.prototype.ChangeEnabledStateItems.call(this, enabled); var btnElement = this.GetIncrementButton(); if (btnElement) aspxGetStateController().SetElementEnabled(btnElement, enabled); btnElement = this.GetDecrementButton(); if (btnElement) aspxGetStateController().SetElementEnabled(btnElement, enabled); btnElement = this.GetLargeIncrementButton(); if (btnElement) aspxGetStateController().SetElementEnabled(btnElement, enabled); btnElement = this.GetLargeDecrementButton(); if (btnElement) aspxGetStateController().SetElementEnabled(btnElement, enabled); }, SetActualElementHeigth: function(element, expectedHeight) { element.style.height = expectedHeight + "px"; if (__aspxIE) { var actualHeight = element.clientHeight; var d = actualHeight - expectedHeight; if (d > 0) { expectedHeight = expectedHeight - d; element.style.height = expectedHeight + "px"; } } }, OnMouseOver: function(evt) { } }); ASPxClientSpinEditConsts = { INT_32_MAX_VALUE: 2147483647, INT_32_MIN_VALUE: -2147483648, DECIMAL_MIN_VALUE: -79228162514264337593543950335, DECIMAL_MAX_VALUE: 79228162514264337593543950335 }; ASPxClientSpinEdit = _aspxCreateClass(ASPxClientSpinEditBase, { constructor: function(name) { this.constructor.prototype.constructor.call(this, name); this.NumberChanged = new ASPxClientEvent(); this.decimalPlaces = 0; this.number = 0; this.inc = 1; this.largeInc = 10; this.minValue = 0; this.maxValue = 0; this.allowNull = true; this.numberType = "f"; this.maxLength = 0; this.inputValueBeforeFocus = null; this.valueChangedProcsCalledBeforeLostFocus = false; this.lockValueChanged = false; this.isValidating = false; this.pasteTimerID = -1; this.keyUpProcessing = false; this.isChangingCheckProcessed = false; }, Initialize: function() { ASPxClientSpinEditBase.prototype.Initialize.call(this); this.filedsInitialize(); this.GenerateValidationRegExp(); }, InlineInitialize: function() { ASPxClientSpinEditBase.prototype.InlineInitialize.call(this); this.UpdateLastCorrectValueString(); }, filedsInitialize: function() { if(!this.UseRestrictions()) { var isDecimal = this.numberType == "f"; this.minValue = isDecimal ? ASPxClientSpinEditConsts.DECIMAL_MIN_VALUE : ASPxClientSpinEditConsts.INT_32_MIN_VALUE; this.maxValue = isDecimal ? ASPxClientSpinEditConsts.DECIMAL_MAX_VALUE : ASPxClientSpinEditConsts.INT_32_MAX_VALUE; } }, GenerateValidationRegExp: function() { var decimalSeparator = ""; var allowDecimalSeparatorSymbols = ""; if (this.IsFloatNumber()) { decimalSeparator = this.GetDecimalSeparatorRegExpString(__aspxNumberDecimalSeparator); for (var i = 0; i < __aspxPossibleNumberDecimalSeparators.length; i++) allowDecimalSeparatorSymbols += this.GetDecimalSeparatorRegExpString(__aspxPossibleNumberDecimalSeparators[i]); } this.allowSymbolRegExp = new RegExp("[-0-9" + allowDecimalSeparatorSymbols + "]"); this.validNumberRegExp = new RegExp("^[-]?[0-9]*[" + decimalSeparator + "]?[0-9]*([0-9]+)?$"); var validFormattedNumberRegExpString = "^[-]?[0-9]*[" + decimalSeparator + "]?[0-9]"; if (this.decimalPlaces != 0) validFormattedNumberRegExpString += "{0," + this.decimalPlaces + "}$"; else validFormattedNumberRegExpString += "*([0-9]+)?$"; this.validFormattedNumberRegExp = new RegExp(validFormattedNumberRegExpString); }, GetDecimalSeparatorRegExpString: function(decimalSeparator) { return decimalSeparator == "." ? "\\." : decimalSeparator; }, ChangeNumber: function(offset) { if (!this.readOnly) { var newNumber = this.GetValidNumber(_aspxCorrectJSFloatNumber(this.number + offset), this.number); if (newNumber != this.number) { this.SetNumberInternal(newNumber); this.OnValueChanged(); } _aspxSetSelection(this.GetInputElement()); } }, ProcessInternalButtonClick: function(buttonIndex) { var ret = false; this.ParseValueAfterPaste(); if (this.largeDecButtonIndex == buttonIndex) { this.ChangeNumber(-this.largeInc); ret = true; } else if (this.incButtonIndex == buttonIndex) { this.ChangeNumber(this.inc); ret = true; } else if (this.decButtonIndex == buttonIndex) { this.ChangeNumber(-this.inc); ret = true; } else if (this.largeIncButtonIndex == buttonIndex) { this.ChangeNumber(this.largeInc); ret = true; } return ret; }, GetCorrectNumberInRange: function(number) { if (this.UseRestrictions() && number > this.maxValue) number = this.maxValue; if (this.UseRestrictions() && number < this.minValue) number = this.minValue; return number; }, GetValidNumber: function(number, oldNumber) { var validNumber = 0; if (this.UseRestrictions() && number < this.minValue && (this.number == null || number > this.number)) validNumber = this.minValue; else if (this.UseRestrictions() && number > this.maxValue && (this.number == null || number < this.number)) validNumber = this.maxValue; else if ((!this.UseRestrictions() || number <= this.maxValue) && (!this.UseRestrictions() || number >= this.minValue)) validNumber = number; else validNumber = this.number; if (!this.IsFloatNumber()) validNumber = Math.round(validNumber); if ((this.maxLength > 0) && (validNumber.toString().length > this.maxLength)) validNumber = oldNumber; return validNumber; }, GetValueType: function() { return this.IsFloatNumber() ? "Decimal" : "Int"; }, GetFormattedNumber: function(number) { if (number == null) return ""; var value = String(number); if (__aspxNumberDecimalSeparator != ".") { if (value.indexOf(".") != -1) value = value.replace(".", __aspxNumberDecimalSeparator); } value = this.GetCorrectFormattedNumberString(value); return value; }, IsFloatNumber: function() { return this.numberType == "f"; }, Validate: function() { this.isValidating = true; ASPxClientSpinEditBase.prototype.Validate.call(this); this.isValidating = false; }, ParseValue: function(withSelection) { if (!_aspxIsExists(withSelection)) withSelection = true; if(this.isValidating) withSelection = false; var inputElement = this.GetInputWithNumber(); if (_aspxIsExistsElement(inputElement)) { var valueString = inputElement.value; var newNumber = (valueString != "") ? this.ParseValueInternal(valueString) : null; if ((newNumber != null) && !isNaN(newNumber)) { if (newNumber != this.number) { newNumber = this.GetCorrectNumberInRange(newNumber); var isEqual = newNumber == this.number; this.SetNumberInternal(newNumber, withSelection); if (!isEqual) this.OnValueChanged(); } else this.SetFormattedNumberInInput(newNumber, withSelection) } else { if (this.allowNull) this.SetNumberInternal(null, withSelection); else this.SetNumberInternal(this.GetCorrectNumberInRange(0), withSelection); this.OnValueChanged(); } } }, ParseValueAfterPaste: function() { if (this.isChangingCheckProcessed) { this.ParseValue(); this.isChangingCheckProcessed = false; } }, ParseValueOnPaste: function() { var inputElement = this.GetInputElement(); if (_aspxIsExistsElement(inputElement)) { var valueString = inputElement.value; if (valueString != "") { if (!this.IsValidNumberString(valueString)) { valueString = this.lastValue; inputElement.value = this.lastValue; } else this.lastValue = valueString; } var newNumber = (valueString != "") ? this.ParseValueInternal(valueString) : null; if (newNumber != null) this.SetFormattedNumberInInput(newNumber); } }, ParseValueInternal: function(value) { if (value == null || value.toString() == "") return null; if (__aspxNumberDecimalSeparator != ".") { if (value.indexOf(__aspxNumberDecimalSeparator) != -1) value = value.replace(__aspxNumberDecimalSeparator, "."); } if (typeof (value) == "number") return value; return this.ParseNumber(value.toString(), this.GetValueType()); }, ParseNumber: function(value, type) { if (type == "Decimal") return parseFloat(value, 10); return parseInt(value, 10); }, RaiseValueChangedEvent: function() { return this.OnNumberChanged(); }, SetNumberInternal: function(value, withSelection) { if (!_aspxIsExists(withSelection)) withSelection = true; this.number = this.RoundNumber(value); this.SetFormattedNumberInInput(this.number, withSelection); if (this.HasTextDecorators()) this.SyncRawInputValue(); }, RoundNumber: function(number) { if(this.decimalPlaces <= 0 || number == null) return number; var factor = Math.pow(10, this.decimalPlaces); return Math.round(factor * number) / factor; }, SetFormattedNumberInInput: function(number, withSelection) { if (!_aspxIsExists(withSelection)) withSelection = true; var inputElement = this.GetInputElement(); if (inputElement != null) { if (withSelection) this.UpdateSelectionStartAndEndPosition(inputElement); var formattedNumber = this.GetFormattedNumber(number); if (formattedNumber.toString() != inputElement.value) { inputElement.value = formattedNumber; if (this.HasTextDecorators()) this.SyncRawInputValue(); } if (withSelection) _aspxSetSelectionCore(inputElement, inputElement.selectionStart, inputElement.selectionEnd); this.UpdateLastCorrectValueString(); } }, UseRestrictions: function() { return (this.maxValue != 0 || this.minValue != 0); }, UpdateLastCorrectValueString: function() { this.lastValue = this.GetInputWithNumber().value; }, GetValue: function() { var input = this.GetInputWithNumber(); if (!_aspxIsExistsElement(input)) return null; if (input.value == "") return null; else return this.number; }, SetValue: function(number) { this.number = this.RoundNumber(number); ASPxClientSpinEditBase.prototype.SetValue.call(this, this.GetFormattedNumber(this.number)); }, OnKeyPress: function(evt) { ASPxClientSpinEditBase.prototype.OnKeyPress.call(this, evt); if(!this.IsValueChangeAllowed()) return; var inputElement = this.GetInputElement(); if (!inputElement) { if (this.pasteTimerID != -1) this.ClearTextChangingTimer(); return; } this.keyUpProcessing = true; if (!__aspxIE && _aspxIsPasteShortcut(evt)) { this.keyUpProcessing = false; return true; } if (evt.altKey || evt.ctrlKey) return true; if (this.IsSpecialKey(evt, false)) { this.keyUpProcessing = true; return true; } var keyCode = _aspxGetKeyCode(evt); this.UpdateSelectionStartAndEndPosition(inputElement); var selectionStart = inputElement.selectionStart; var selectionEnd = inputElement.selectionEnd; var pressed = String.fromCharCode(keyCode); if (!this.IsAllowableSymbol(pressed) && keyCode !== ASPxKey.Enter) { this.keyUpProcessing = false; return _aspxPreventEvent(evt); } if (this.IsSignSymbol(pressed)) { var isAllowTypeNumberSignSymbol = this.IsAllowTypeNumberSignSymbol(selectionStart, selectionEnd); this.keyUpProcessing = isAllowTypeNumberSignSymbol; return isAllowTypeNumberSignSymbol ? true : _aspxPreventEvent(evt); } if (this.IsDecimalSeparatorSymbol(pressed)) { var isAllowTypeDecimalSeparator = this.IsAllowTypeDecimalSeparatorSymbol(selectionStart, selectionEnd); if (isAllowTypeDecimalSeparator) this.TypeDecimalSeparator(selectionStart, selectionEnd); this.keyUpProcessing = isAllowTypeDecimalSeparator; return _aspxPreventEvent(evt); } if (!this.IsAllowTypeDigitToCurrentPosition(selectionStart, selectionEnd, pressed)) { this.keyUpProcessing = false; return _aspxPreventEvent(evt); } return true; }, OnKeyUp: function(evt) { ASPxClientSpinEditBase.prototype.OnKeyUp.call(this, evt); if (this.keyUpProcessing) { this.UpdateLastCorrectValueString(); this.keyUpProcessing = false; } if (this.IsPageOrArrowKey(evt)) this.OnPageOrArrowKeyUp(); }, OnKeyDown: function(evt) { if (evt.keyCode == ASPxKey.Enter) this.OnTextChanged(); ASPxClientSpinEditBase.prototype.OnKeyDown.call(this, evt); if (this.IsPageOrArrowKey(evt)) this.OnPageOrArrowKeyDown(evt); if ((__aspxIE || __aspxWebKitFamily) && this.IsSpecialKey(evt, true)) this.keyUpProcessing = true; }, OnPageOrArrowKeyDown: function(evt) { var btnIndex = this.GetButtonIndexByKeyCode(_aspxGetKeyCode(evt), evt.ctrlKey); if (__aspxOpera) this.SetButtonRepeatClickTimer(btnIndex, 60, 1); else { this.ProcessInternalButtonClick(btnIndex); _aspxPreventEvent(evt); } }, OnPageOrArrowKeyUp: function(evt) { if (__aspxOpera) this.ClearButtonRepeatClickTimer(); }, IsValueChangeAllowed: function() { return !this.readOnly && this.clientEnabled; }, OnFocus: function() { if(this.IsValueChangeAllowed()) { if (__aspxIE || __aspxFirefox && __aspxBrowserVersion == 2) this.SaveIEOnValueChangedEmulationData(); } ASPxClientSpinEditBase.prototype.OnFocus.call(this); if(this.IsValueChangeAllowed()) this.SetTextChangingTimer(); }, OnLostFocus: function() { if(this.IsValueChangeAllowed()) { if (__aspxFirefox && __aspxBrowserVersion == 2) this.EmulateIEOnValueChanged(); } ASPxClientSpinEditBase.prototype.OnLostFocus.call(this); if(this.IsValueChangeAllowed()) { this.ClearTextChangingTimer(); if (__aspxIE) this.EmulateIEOnValueChanged(); } }, OnLostFocusCore: function() { if(this.lockValueChanged && !this.IsFocusEventsLocked()) ASPxClientSpinEditBase.prototype.OnValueChanged.call(this); ASPxClientSpinEditBase.prototype.OnLostFocusCore.call(this); }, OnNumberChanged: function() { var processOnServer = ASPxClientSpinEditBase.prototype.RaiseValueChangedEvent.call(this); processOnServer = this.RaiseNumberChanged(processOnServer); if (this.focused) this.valueChangedProcsCalledBeforeLostFocus = true; return processOnServer; }, OnValueChanged: function() { if(!this.lockValueChanged) ASPxClientSpinEditBase.prototype.OnValueChanged.call(this); }, OnMouseOver: function(evt) { if (_aspxGetIsLeftButtonPressed(evt) && !this.HasTextDecorators()) this.OnTextChangingCheck(); }, OnMouseWheel: function(evt) { if(!this.allowMouseWheel || !this.GetEnabled()) return; this.ParseValue(); var wheelDelta = _aspxGetWheelDelta(evt); if (wheelDelta > 0) this.ChangeNumber(this.inc); else if (wheelDelta < 0) this.ChangeNumber(-this.inc); _aspxPreventEvent(evt); }, OnTextChangingCheck: function(evt) { var input = this.GetInputWithNumber(); if (!input) return; var curValueString = input.value.toString(); this.isChangingCheckProcessed = true; if ((this.lastValue != curValueString) && !this.keyUpProcessing) this.OnPaste(); }, OnPaste: function() { this.ParseValueOnPaste(); }, OnTextChanged: function() { this.ParseValue(false); }, GetButtonIndexByKeyCode: function(keyCode, ctrl) { var ret = 0; switch (keyCode) { case ASPxKey.Up: ret = ctrl ? this.largeIncButtonIndex : this.incButtonIndex; break; case ASPxKey.Down: ret = ctrl ? this.largeDecButtonIndex : this.decButtonIndex; break; case ASPxKey.PageUp: ret = this.largeIncButtonIndex; break; case ASPxKey.PageDown: ret = this.largeDecButtonIndex; break; } return ret; }, SaveIEOnValueChangedEmulationData: function() { this.valueChangedProcsCalledBeforeLostFocus = false; var input = this.GetInputWithNumber(); if (_aspxIsExistsElement(input)) this.inputValueBeforeFocus = input.value; }, EmulateIEOnValueChanged: function() { if (!this.valueChangedProcsCalledBeforeLostFocus) { var input = this.GetInputWithNumber(); if (_aspxIsExistsElement(input) && input.value != this.inputValueBeforeFocus) { this.OnTextChanged(); this.RaiseValidationInternal(); this.RaisePersonalStandardValidation(); } } }, SetTextChangingTimer: function() { var str = "aspxSETextChangingCheck(\"" + this.name + "\")"; this.pasteTimerID = _aspxSetInterval(str, __aspxPasteCheckInterval); }, ClearTextChangingTimer: function() { this.pasteTimerID = _aspxClearInterval(this.pasteTimerID); }, IsAllowableSymbol: function(symbol) { return this.allowSymbolRegExp.test(symbol); }, IsAllowTypeNumberSignSymbol: function(selectionStart, selectionEnd) { var curValueString = this.GetInputElement().value.toString(); if ((curValueString != null) && this.IsSignSymbol(curValueString.charAt(0))) return (selectionStart == 0) && (selectionEnd > 0); else return (selectionStart == 0); }, IsAllowTypeDecimalSeparatorSymbol: function(selectionStart, selectionEnd) { var unselectedText = this.GetUnselectedText(selectionStart, selectionEnd); var decimalSepIndex = unselectedText.indexOf(__aspxNumberDecimalSeparator); if ((this.decimalPlaces != 0) && (decimalSepIndex == -1)) { var possibleValueString = this.GetPossibleValueString(selectionStart, selectionEnd, __aspxNumberDecimalSeparator); return this.IsValidFormattedNumberString(possibleValueString); } return decimalSepIndex == -1; }, IsAllowTypeDigitToCurrentPosition: function(selectionStart, selectionEnd, pressedSymbol) { var possibleValueString = this.GetPossibleValueString(selectionStart, selectionEnd, pressedSymbol); var decimalSepIndex = possibleValueString.indexOf(__aspxNumberDecimalSeparator); if ((this.decimalPlaces != 0) && (decimalSepIndex != -1)) return this.IsValidFormattedNumberString(possibleValueString); return true; }, IsValidNumberString: function(numString) { return this.validNumberRegExp.test(numString); }, IsValidFormattedNumberString: function(numString) { return this.validFormattedNumberRegExp.test(numString); }, GetCorrectFormattedNumberString: function(numString) { var ret = numString; if (!this.IsValidFormattedNumberString(numString)) { if (numString.toLowerCase().indexOf("e") > -1) numString = ASPxClientSpinEdit.RemoveExponentialNotation(numString); var decimalSepIndex = numString.indexOf(__aspxNumberDecimalSeparator); if (decimalSepIndex > -1) { ret = numString.substring(0, decimalSepIndex); if (this.IsFloatNumber()) { if (this.decimalPlaces > 0) ret += numString.substr(decimalSepIndex, this.decimalPlaces + 1); else ret += numString.substr(decimalSepIndex); } } else ret = numString; } return ret; }, GetPossibleValueString: function(selectionStart, selectionEnd, pressedSymbol) { var curValueString = this.GetInputElement().value.toString(); var newValueString = curValueString.substring(0, selectionStart); newValueString += pressedSymbol; var selectionLength = selectionEnd - selectionStart; newValueString += curValueString.substr(selectionEnd, curValueString.length - selectionLength); return newValueString; }, GetUnselectedText: function (selectionStart, selectionEnd) { return this.GetPossibleValueString(selectionStart, selectionEnd, ""); }, IsDecimalSeparatorSymbol: function(symbol) { for (var i = 0; i < __aspxPossibleNumberDecimalSeparators.length; i++) if (__aspxPossibleNumberDecimalSeparators[i] == symbol) return true; return false; }, IsValidMinMaxValue: function(minValue, maxValue) { if (typeof (maxValue) != "number") maxValue = this.ParseValueInternal(maxValue.toString()); if (typeof (minValue) != "number") minValue = this.ParseValueInternal(minValue.toString()); return (isNaN(maxValue) || isNaN(minValue)) ? false : (maxValue >= minValue); }, IsSpecialKey: function(evt, inKeyDown) { var keyCode = _aspxGetKeyCode(evt); return keyCode == 0 || keyCode == ASPxKey.Backspace || keyCode == ASPxKey.Tab || (inKeyDown && keyCode == ASPxKey.Delete) || keyCode > 60000 ; }, IsPageOrArrowKey: function(evt) { var keyCode = _aspxGetKeyCode(evt); if (__aspxOpera && evt.ctrlKey && (keyCode == ASPxKey.Up || keyCode == ASPxKey.Down)) return false; else return keyCode == ASPxKey.Up || keyCode == ASPxKey.Down || keyCode == ASPxKey.PageUp || keyCode == ASPxKey.PageDown; }, IsSignSymbol: function(symbol) { return symbol == "-"; }, TypeDecimalSeparator: function(selectionStart, selectionEnd) { var possibleValueString = this.GetPossibleValueString(selectionStart, selectionEnd, __aspxNumberDecimalSeparator); var inputElement = this.GetInputElement(); inputElement.value = possibleValueString; var decimalSepIndex = possibleValueString.indexOf(__aspxNumberDecimalSeparator); _aspxSetCaretPosition(inputElement, decimalSepIndex + 1); }, UpdateSelectionStartAndEndPosition: function(inputElement) { if (__aspxIE && __aspxBrowserVersion < 9 && document.selection) { inputElement.selectionStart = 0; inputElement.selectionEnd = 0; var curRange = document.selection.createRange(); var copyRange = curRange.duplicate(); curRange.move('character', -inputElement.value.length); curRange.setEndPoint('EndToStart', copyRange); inputElement.selectionStart = curRange.text.length; inputElement.selectionEnd = inputElement.selectionStart + copyRange.text.length; } }, SetActualElementHeigth: function(element, expectedHeight) { element.style.height = expectedHeight + "px"; if (__aspxIE) { var actualHeight = element.clientHeight; var d = actualHeight - expectedHeight; if (d > 0) { expectedHeight = expectedHeight - d; element.style.height = expectedHeight + "px"; } } }, GetInputWithNumber: function() { if (!this.focused && this.HasTextDecorators()) return this.GetRawInputElement(); return this.GetInputElement(); }, GetDecoratedText: function(value) { if (typeof value == "string" && !!this.displayFormat) value = this.ParseValueInternal(value); var result = ASPxClientSpinEditBase.prototype.GetDecoratedText.call(this, value).toString(); if(!this.displayFormat && __aspxNumberDecimalSeparator !== ".") result = result.replace('.', __aspxNumberDecimalSeparator); return result; }, RaiseNumberChanged: function(processOnServer) { if (!this.NumberChanged.IsEmpty()) { var args = new ASPxClientProcessingModeEventArgs(processOnServer); this.NumberChanged.FireEvent(this, args); processOnServer = args.processOnServer; } return processOnServer; }, SetNumber: function(number) { this.SetValue(number); }, GetNumber: function() { return this.number; }, GetText: function () { if (this.maskInfo != null) return this.maskInfo.GetText(); else { var isNullText = this.number === null && this.nullText !== ""; var inputElementText = this.GetInputElement().value; return isNullText ? "" : this.GetDecoratedText(inputElementText).toString(); } }, SetText: function(text) { ASPxClientSpinEditBase.prototype.SetValue.call(this, text); this.ParseValue(false); }, SetMinValue: function(value) { if (this.IsValidMinMaxValue(value, this.maxValue)) { this.minValue = this.ParseValueInternal(value.toString()); this.EnsureCurrentNumberInBoundries(); } }, GetMinValue: function() { return this.minValue; }, SetMaxValue: function(value) { if (this.IsValidMinMaxValue(this.minValue, value)) { this.maxValue = this.ParseValueInternal(value.toString()); this.EnsureCurrentNumberInBoundries(); } }, GetMaxValue: function() { return this.maxValue; }, EnsureCurrentNumberInBoundries: function() { var value = this.GetValue(); if (value != null) this.SetNumber(this.GetCorrectNumberInRange(value)); }, GetParsedNumber: function() { var inputElement = this.GetInputElement(); var valueString = inputElement.value; var newNumber = valueString != "" ? this.ParseValueInternal(valueString) : null; if ((newNumber != null) && !isNaN(newNumber)) { if (newNumber != this.number) newNumber = this.GetCorrectNumberInRange(newNumber); } else newNumber = this.GetCorrectNumberInRange(0); return newNumber; }, RestoreSelectionStartAndEndPosition: function() { var inputElement = this.GetInputElement(); _aspxSetSelectionCore(inputElement, inputElement.selectionStart, inputElement.selectionEnd); }, SaveSelectionStartAndEndPosition: function() { this.UpdateSelectionStartAndEndPosition(this.GetInputElement()); } }); ASPxClientSpinEdit.Cast = ASPxClientControl.Cast; ASPxClientSpinEdit.RemoveExponentialNotation = function(numString) { var mantissaPossition = numString.toLowerCase().indexOf("e"); var ret = numString; if (mantissaPossition > -1) { var isNegative = numString.indexOf("-") == 0; var isNegativeMantissa = numString.lastIndexOf("-") > 0; var mantissa = numString.replace(new RegExp('^[+-]?([0-9]*\.?[0-9]+|[0-9]+\.?[0-9]*)([eE][+-]?)'), ""); var numberBase = numString.replace(new RegExp('([eE][+-]?[0-9]+)'), ""); numberBase = numberBase.replace("+", ""); numberBase = numberBase.replace("-", ""); var decimalDecimalSeparator = "."; if (numberBase.indexOf(decimalDecimalSeparator) == -1) { numberBase = numberBase.replace(decimalDecimalSeparator, __aspxNumberDecimalSeparator); decimalDecimalSeparator = __aspxNumberDecimalSeparator; } var numberParts = numberBase.split(decimalDecimalSeparator); if (numberParts.length == 1) numberParts[1] = ""; var zeroNumbers = parseInt(mantissa, 10); if (isNegativeMantissa) { zeroNumbers -= 1; ret = "0" + __aspxNumberDecimalSeparator + ASPxClientSpinEdit.GetZeros(zeroNumbers) + numberParts[0] + numberParts[1]; } else { zeroNumbers -= numberParts[0].length + numberParts[1].length - 1; ret = numberParts[0] + numberParts[1] + ASPxClientSpinEdit.GetZeros(zeroNumbers); } if (isNegative) ret = _aspxInsert(ret, "-", 0); } return ret; } ASPxClientSpinEdit.GetZeros = function(length) { var zeros = []; for (var i = 0; i < length; i++) zeros.push('0'); return zeros.join(""); } function aspxSEMouseOver(name, evt) { var edit = aspxGetControlCollection().Get(name); if (edit != null) edit.OnMouseOver(evt); } function aspxSETextChangingCheck(name) { var edit = aspxGetControlCollection().Get(name); if (edit != null) edit.OnTextChangingCheck(); } function aspxSEValueChanged(name) { var spinEdit = aspxGetControlCollection().Get(name); if (spinEdit != null) spinEdit.OnValueChangedTimer(); } function aspxBEMouseDown(name, evt) { var edit = aspxGetControlCollection().Get(name); if (edit != null) edit.OnButtonMouseDown(evt); } function aspxSRepeatButtonClick(name, buttonIndex, iterationIndex) { var spinEdit = aspxGetControlCollection().Get(name); if (spinEdit != null) spinEdit.DoRepeatButtonClick(buttonIndex, iterationIndex); } function aspxSpinImageOnLoad(name) { var spinEdit = aspxGetControlCollection().Get(name); if (spinEdit != null) spinEdit.OnSpinButtonImageLoad(); } (function(){ if(typeof(ASPxStateController) != "undefined") aspxAddAfterSetPressedState(aspxAfterSetPressed); if(typeof(ASPxStateController) != "undefined") aspxAddAfterClearPressedState(aspxAfterClearPressed); })(); function aspxAfterSetPressed(source, args) { var item = args.item; var spinEdit = aspxGetSpinEditCollection().GetSpinEdit(item.name); if (spinEdit != null && item.enabled) spinEdit.OnAfterSetPressed(item.name); } function aspxAfterClearPressed(source, args) { var spinEdit = aspxGetSpinEditCollection().GetSpinEdit(args.item.name); if (spinEdit != null) spinEdit.OnAfterClearPressed(args.item.name); } var __aspxSpinEditCollection = null; function aspxGetSpinEditCollection() { if (__aspxSpinEditCollection == null) __aspxSpinEditCollection = new ASPxClientSpinEditCollection(); return __aspxSpinEditCollection; } ASPxClientSpinEditCollection = _aspxCreateClass(ASPxClientControlCollection, { constructor: function() { this.constructor.prototype.constructor.call(this); }, GetSpinEdit: function(id) { return this.Get(this.GetSpinEditName(id)); }, GetSpinEditName: function(id) { var pos = id.lastIndexOf(__aspxSpindButtonIdPostfix); if (pos > -1) return id.substring(0, pos); pos = id.lastIndexOf(__aspxTEInputSuffix); if (pos > -1) return id.substring(0, pos); return id; } }); ASPxClientTimeEdit = _aspxCreateClass(ASPxClientSpinEditBase, { constructor: function(name) { this.constructor.prototype.constructor.call(this, name); this.date = null; this.DateChanged = new ASPxClientEvent(); }, Initialize: function() { ASPxClientSpinEditBase.prototype.Initialize.call(this); if(!_aspxMaskDateTimeHelper.HasDateParts(this.maskInfo) && this.date == null) { var date = _aspxMaskDateTimeHelper.GetDate(this.maskInfo); this.SetValue(date); } this.SubscribeInputElementClick(); }, SubscribeInputElementClick: function() { var editor = this; _aspxAttachEventToElement(this.GetInputElement().parentNode, "click", function(){ editor.FillMaskInfo(); if(editor.maskInfo.ApplyFixes(null)) editor.ApplyMaskInfo(false); }); }, SetDate: function(date) { this.SetValue(date); }, GetDate: function() { return this.date ? new Date(this.date.valueOf()) : null; }, SetValue: function(date) { this.date = date; _aspxMaskDateTimeHelper.SetDate(this.maskInfo, date); this.ApplyMaskInfo(false); this.SavePrevMaskValue(); }, GetValue: function() { return this.date; }, GetValueString: function() { return this.date != null ? _aspxGetInvariantDateTimeString(this.date) : null; }, ProcessInternalButtonClick: function(buttonIndex) { var delta; var result = false; if(buttonIndex == this.incButtonIndex) { delta = 1; result = true; } else if(buttonIndex == this.decButtonIndex) { delta = -1; result = true; } if(result && !this.readOnly) { _aspxMaskManager.OnMouseWheel(this.maskInfo, delta); this.ApplyMaskInfo(true); } this.SetFocus(); return result; }, ParseValue: function() { var date = _aspxMaskDateTimeHelper.GetDate(this.maskInfo, this.date); var changed = !_aspxAreDatesEqualExact(this.date, date); if(changed) { this.SetValue(date); this.RaisePersonalStandardValidation(); this.OnValueChanged(); } }, OnTextChanged: function() { this.ParseValue(); }, OnMouseWheel: function(evt) { if(!this.allowMouseWheel || !this.GetEnabled()) return; ASPxClientTextEdit.prototype.OnMouseWheel.call(this, evt); }, InvokeActualOnValueChanged: function() { ASPxClientEdit.prototype.OnValueChanged.call(this); }, RaiseValueChangedEvent: function() { if(!this.isInitialized) return false; var processOnServer = ASPxClientEdit.prototype.RaiseValueChangedEvent.call(this); processOnServer = this.RaiseDateChanged(processOnServer); return processOnServer; }, RaiseDateChanged: function(processOnServer) { if(!this.DateChanged.IsEmpty()) { var args = new ASPxClientProcessingModeEventArgs(processOnServer); this.DateChanged.FireEvent(this, args); processOnServer = args.processOnServer; } return processOnServer; }, GetMaskDisplayText: function() { if(!this.focused) { if(_aspxMaskDateTimeHelper.HasDateParts(this.maskInfo) && this.date == null) return this.nullText; if(this.HasTextDecorators()) return this.GetDecoratedText(this.date); } return this.maskInfo.GetText(); }, HasTextDecorators: function() { return this.date == null || ASPxClientSpinEditBase.prototype.HasTextDecorators.call(this); }, SyncRawInputValue: function() { this.GetRawInputElement().value = this.date == null ? "N" : _aspxToLocalTime(this.date).valueOf(); }, DecodeRawInputValue: function(value) { if(value == "N") return null; var date = new Date(); date.setTime(Number(value)); return _aspxToUtcTime(date); }, BeginShowMaskHint: function() { }, OnLostFocusCore: function() { ASPxClientEdit.prototype.OnLostFocusCore.call(this); this.EndShowMaskHint(); this.HideMaskHint(); if(!this.IsFocusEventsLocked()) { if(this.maskInfo.ApplyFixes(null)) this.ApplyMaskInfo(false); this.RaiseStandardOnChange(); } this.ToggleTextDecoration(); } }); ASPxClientTimeEdit.Cast = ASPxClientControl.Cast; } /* playback timings (ms): esindex: 0.014 exclusion.robots.policy: 0.177 captures_list: 95.128 exclusion.robots: 0.191 PetaboxLoader3.datanode: 1362.311 (4) load_resource: 1471.455 RedisCDXSource: 22.221 CDXLines.iter: 20.362 (3) PetaboxLoader3.resolve: 70.367 LoadShardBlock: 48.288 (3) */