1Type.registerNamespace("Telerik.Sitefinity.Web.UI.Fields"); 2Telerik.Sitefinity.Web.UI.Fields.TextField=function(element){Telerik.Sitefinity.Web.UI.Fields.TextField.initializeBase(this,[element]); 3this._element=element; 4this._labelElement=null; 5this._textBoxElement=null; 6this._expandableExtenderId=null; 7this._expandableExtenderBehavior=null; 8this._conditionalTemplatesContainerId=null; 9this._templatesContainer=null; 10this._hideIfValue=null; 11this._suffix=null; 12this._currentCondition=null; 13this._textBoxId=null; 14this._textLabelId=null; 15this._conditionDictionary=[]; 16this._unit=null; 17this._characterCounterElement=null; 18this._recommendedCharactersCount=0; 19this._trimSpaces=false; 20this._maxChars=0; 21this._allowNulls=false; 22this._readOnlyReplacement=false; 23this._isLocalizable=false; 24this._readOnlyModeOriginalValue=null; 25this._autocompleteServiceUrl=null; 26}; 27Telerik.Sitefinity.Web.UI.Fields.TextField.prototype={initialize:function(){Telerik.Sitefinity.Web.UI.Fields.TextField.callBaseMethod(this,"initialize"); 28if(this.get_displayMode()==Telerik.Sitefinity.Web.UI.Fields.FieldDisplayMode.Write){this._handleKeyDownDelegate=Function.createDelegate(this,this._keyDownHandler); 29$addHandler(this.get_textElement(),"keypress",this._handleKeyDownDelegate); 30this._handleKeyUpDelegate=Function.createDelegate(this,this._keyUpHandler); 31$addHandler(this.get_textElement(),"keyup",this._handleKeyUpDelegate); 32this._handleInputDelegate=Function.createDelegate(this,this._inputHandler); 33$addHandler(this.get_textElement(),"input",this._handleInputDelegate); 34this._handleFocusDelegate=Function.createDelegate(this,this._focusHandler); 35$addHandler(this.get_textElement(),"focus",this._handleFocusDelegate); 36this._handleBlurDelegate=Function.createDelegate(this,this._blurHandler); 37$addHandler(this.get_textElement(),"blur",this._handleBlurDelegate); 38if(this._autocompleteServiceUrl!=null){$("#"+this.get_textElement().id).autocomplete({source:this._autocompleteServiceUrl,minLength:0}).focus(function(){$(this).autocomplete("search",$(this).val()); 39}); 40}}if(this._hideIfValue!=null){this.set_defaultValue(this._hideIfValue); 41}this.calculateCharactersCount(); 42jQuery(this.get_characterCounterElement()).hide(); 43},dispose:function(){if(this._handleKeyDownDelegate){$removeHandler(this.get_textElement(),"keypress",this._handleKeyDownDelegate); 44delete this._handleKeyDownDelegate; 45}if(this._handleKeyUpDelegate){$removeHandler(this.get_textElement(),"keyup",this._handleKeyUpDelegate); 46delete this._handleKeyUpDelegate; 47}if(this._handleInputDelegate){$removeHandler(this.get_textElement(),"input",this._handleInputDelegate); 48delete this._handleInputDelegate; 49}if(this._handleFocusDelegate){$removeHandler(this.get_textElement(),"focus",this._handleFocusDelegate); 50delete this._handleFocusDelegate; 51}if(this._handleBlurDelegate){$removeHandler(this.get_textElement(),"blur",this._handleBlurDelegate); 52delete this._handleBlurDelegate; 53}this._labelElement=null; 54this._textBoxElement=null; 55Telerik.Sitefinity.Web.UI.Fields.TextField.callBaseMethod(this,"dispose"); 56},reset:function(){var defaultValue=this.get_defaultValue(); 57if(defaultValue==undefined){defaultValue=null; 58}this.set_value(defaultValue); 59jQuery(this.get_characterCounterElement()).text(""); 60Telerik.Sitefinity.Web.UI.Fields.TextField.callBaseMethod(this,"reset"); 61},get_value:function(){var val=this._get_textValue(); 62if(this.get_displayMode()==Telerik.Sitefinity.Web.UI.Fields.FieldDisplayMode.Write){if(val==""&&this._hideIfValue!=null){return this._hideIfValue; 63}}if(val==""&&this.get_allowNulls()){return null; 64}return val; 65},set_value:function(value){if(this.get_trimSpaces()){value=jQuery.trim(value); 66}if(this._hideIfValue!=null&&this._hideIfValue==value){if(this.get_displayMode()==Telerik.Sitefinity.Web.UI.Fields.FieldDisplayMode.Write){this._clearTextBox(); 67}else{this._clearLabel(); 68}}else{if(this.get_displayMode()==Telerik.Sitefinity.Web.UI.Fields.FieldDisplayMode.Write){this._set_writeModeValue(value); 69}else{this._set_readModeValue(value); 70}}this._value=value; 71this.raisePropertyChanged("value"); 72this._valueChangedHandler(); 73},isChanged:function(){if(this.get_displayMode()==Telerik.Sitefinity.Web.UI.Fields.FieldDisplayMode.Write&&this._value==null){this._value=""; 74}if(this._value==""&&this.get_allowNulls()){this._value=null; 75}var notChanged=(this._replaceNewLines(this._value," ")==this._replaceNewLines(this.get_value()," ")); 76if(notChanged){return false;
77}else{return true; 78}},calculateCharactersCount:function(){if(this.get_textElement().value==undefined){return; 79}var currentCount=this.get_textElement().value.length; 80if(currentCount==0){jQuery(this.get_characterCounterElement()).text(""); 81}else{jQuery(this.get_characterCounterElement()).text(currentCount); 82}if(this.get_recommendedCharactersCount()!=0){this.colorCharactersCount(currentCount,this.get_recommendedCharactersCount()); 83}jQuery(this.get_characterCounterElement()).show(); 84},colorCharactersCount:function(currentCount,recommendedCount){if(currentCount<=recommendedCount){jQuery(this.get_characterCounterElement()).css("color","Black"); 85}else{jQuery(this.get_characterCounterElement()).css("color","Red"); 86}},_keyDownHandler:function(e){this.focusControlByTabKey(e); 87},_inputHandler:function(e){this._trimChars(); 88this.calculateCharactersCount(); 89},_keyUpHandler:function(e){this._trimChars(); 90this.calculateCharactersCount(); 91},_focusHandler:function(e){jQuery(this.get_characterCounterElement()).show(); 92this.calculateCharactersCount(); 93},_blurHandler:function(e){if(this.get_trimSpaces()){this.get_textElement().value=jQuery.trim(this.get_value()); 94this.calculateCharactersCount(); 95}var currentCount=this.get_textElement().value.length; 96if(currentCount<=this.get_recommendedCharactersCount()){jQuery(this.get_characterCounterElement()).hide(); 97}},_getTemplate:function(templateCondition){var templatesContainer=this._getTemplatesContainer(); 98var template=templatesContainer.find("#"+this._conditionDictionary[templateCondition]); 99return template; 100},_switchToTemplate:function(templateCondition){var currentCondition=this._currentCondition; 101if(currentCondition==templateCondition){return; 102}this._currentCondition=templateCondition; 103var currentElement=jQuery(this._element); 104var templatesContainer=this._getTemplatesContainer(); 105var childsExceptContainer=currentElement.children().not("#"+this._conditionalTemplatesContainerId); 106var hiddenContainer=this._getTemplate(currentCondition); 107if(hiddenContainer.length==0){hiddenContainerID="hiddenContainer"+this._suffix; 108hiddenContainer=jQuery.find("#"+hiddenContainerID); 109if(hiddenContainer.length==0){hiddenContainer=jQuery('<div id="'+hiddenContainerID+'"></div>'); 110}templatesContainer.append(hiddenContainer); 111}childsExceptContainer.each(function(index){hiddenContainer.append(this); 112}); 113var newTemplate=this._getTemplate(templateCondition); 114var cleanHtml=jQuery.trim(newTemplate.html()); 115newTemplate.children().each(function(index){jQuery(this).insertBefore(templatesContainer); 116}); 117},_getTemplatesContainer:function(){if(!this._templatesContainer){this._templatesContainer=jQuery("#"+this._conditionalTemplatesContainerId); 118}return this._templatesContainer; 119},_getElementFromCurrentTemplate:function(selector){return jQuery(this._element).find(selector).not("#"+this._conditionalTemplatesContainerId+" "+selector)[0]; 120},_buildCondition:function(left,operator,right){return String.format("{0}-{1}-{2}",left,operator,right).toLowerCase(); 121},_clearLabel:function(){if(this._labelElement!=null){this._labelElement.innerHTML=""; 122}},_clearTextBox:function(){if(this._textBoxElement!=null){this._textBoxElement.value=""; 123this.calculateCharactersCount(); 124}},_set_writeModeValue:function(value){if(value===undefined||value==null){this._clearTextBox(); 125}else{if(this._textBoxElement!=null){this._textBoxElement.value=value; 126if(value!=this.get_defaultValue()&&jQuery("body").hasClass("sfFormDialog")){this._doExpandHandler(); 127}}if(this._unit!=null&&this._unit.length>0){jQuery(this._element).find("span.sfUnit").remove(); 128jQuery(this._textBoxElement).after('<span class="sfUnit">'+this._unit+"</span>"); 129}}},_set_readModeValue:function(value){this._readOnlyModeOriginalValue=value; 130if(value===undefined||value==null){this._clearLabel(); 131}else{if(this._labelElement!=null){var resultText=null; 132if(this._readOnlyReplacement){var data=JSON.parse(this._readOnlyReplacement); 133if(data&&data.Value&&data.Text){var replacementCondition=data.Value==value; 134var replacementText=data.Text; 135if(replacementCondition&&replacementText){resultText=replacementText; 136}}}if(!resultText){resultText=value; 137if(this._unit!=null&&this._unit.length>0){resultText=resultText.htmlEncode?resultText.htmlEncode():resultText; 138resultText+=' <p class="sfDescription">'+this._unit+"</p>"; 139jQuery(this._labelElement).html(resultText); 140return; 141}}jQuery(this._labelElement).text(resultText); 142}}},_get_writeModeValue:function(){if(this._textBoxElement){return this._textBoxElement.value; 143}return null; 144},_get_textValue:function(){if(this.get_displayMode()==Telerik.Sitefinity.Web.UI.Fields.FieldDisplayMode.Write){return this._get_writeModeValue(); 145}else{return this._readOnlyModeOriginalValue; 146}},_get_ExpandableExtenderBehavior:function(){if(this._expandableExtenderBehavior){return this._expandableExtenderBehavior; 147}
147this._expandableExtenderBehavior=Sys.UI.Behavior.getBehaviorByName(this._element,"ExpandableExtender"); 148return this._expandableExtenderBehavior; 149},_trimChars:function(){if(this._maxChars&&this._maxChars>0){var value=this.get_value(); 150value=value.substring(0,this._maxChars); 151this.set_value(value); 152}},_replaceNewLines:function(value,replacedText){if(value==null){return value; 153}return value.toString().replace(/\r\n/ig,replacedText).replace(/\n/ig,replacedText); 154},get_allowNulls:function(){return this._allowNulls; 155},set_allowNulls:function(value){this._allowNulls=value; 156},get_hideIfValue:function(){return this._hideIfValue; 157},set_hideIfValue:function(value){this._hideIfValue=value; 158},get_textBoxElement:function(){return this._textBoxElement; 159},set_textBoxElement:function(value){this._textBoxElement=value; 160},get_labelElement:function(){return this._labelElement; 161},set_labelElement:function(value){this._labelElement=value; 162},get_textElement:function(){if(this.get_displayMode()==Telerik.Sitefinity.Web.UI.Fields.FieldDisplayMode.Write){return this._textBoxElement; 163}else{return this._labelElement; 164}},set_displayMode:function(mode){var currentValue=this.get_value(); 165if(typeof mode==="string"){mode=parseInt(mode); 166}this._displayMode=mode; 167if(this.get_isInitialized()){switch(mode){case Telerik.Sitefinity.Web.UI.Fields.FieldDisplayMode.Read:var condition=this._buildCondition("DisplayMode","Equal","Read"); 168this._switchToTemplate(condition); 169if(!this._labelElement){this._labelElement=this._getElementFromCurrentTemplate("[id*='"+this._textLabelId+this.get_suffix()+"']"); 170}if(!this._textBoxElement){this._textBoxElement=this._getElementFromCurrentTemplate("[id*='"+this._textBoxId+this.get_suffix()+"']"); 171}if(this._textBoxElement){currentValue=this._textBoxElement.value; 172this.set_value(currentValue); 173}jQuery(this._labelElement).text(currentValue); 174break; 175case Telerik.Sitefinity.Web.UI.Fields.FieldDisplayMode.Write:var condition=this._buildCondition("DisplayMode","Equal","Write"); 176this._switchToTemplate(condition); 177if(!this._textBoxElement){this._textBoxElement=this._getElementFromCurrentTemplate("[id*='"+this._textBoxId+this.get_suffix()+"']"); 178}this._textBoxElement.value=currentValue; 179break; 180}}},set_tabIndex:function(value){this._tabIndex=value; 181jQuery(this.get_textElement()).attr("tabindex",value); 182},get_tabIndex:function(){return jQuery(this.get_textElement()).attr("tabindex"); 183},get_suffix:function(){return this._suffix; 184},set_suffix:function(value){this._suffix=value; 185},focus:function(){var input=this.get_textElement(); 186if(jQuery(input).is(":visible")&&jQuery(input).is(":enabled")){input.focus(); 187}},blur:function(){var behavior=this._get_ExpandableExtenderBehavior(); 188if(behavior!=null&&!behavior.get_originalExpandedState()){var val=this.get_value(); 189if(val==""){behavior.collapse(); 190}}},set_defaultValue:function(value){if(value===null||value===undefined){value=""; 191}this._defaultValue=value; 192},get_element:function(){return this._element; 193},set_element:function(value){this._element=value; 194},get_conditionDictionary:function(){return this._conditionDictionary; 195},set_conditionDictionary:function(value){this._conditionDictionary=value; 196},get_characterCounterElement:function(){return this._characterCounterElement; 197},set_characterCounterElement:function(value){this._characterCounterElement=value; 198},get_recommendedCharactersCount:function(){return this._recommendedCharactersCount; 199},set_recommendedCharactersCount:function(value){this._recommendedCharactersCount=value; 200},get_trimSpaces:function(){return this._trimSpaces; 201},set_trimSpaces:function(value){this._trimSpaces=value; 202},get_isLocalizable:function(){return this._isLocalizable; 203},set_isLocalizable:function(value){this._isLocalizable=value; 204}}; 205Telerik.Sitefinity.Web.UI.Fields.TextField.registerClass("Telerik.Sitefinity.Web.UI.Fields.TextField",Telerik.Sitefinity.Web.UI.Fields.FieldControl);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.