JAVASCRIPT   9

element-styler.js

Guest on 19th July 2021 07:02:09 PM

  1. //noinspection JSUnusedGlobalSymbols
  2. var sfElementStylerExtensions=[];
  3.  
  4. function GetElementStyler(formElement,elementToStyle,attributesCointainer)
  5. {
  6.     if(formElement.Options.ClassName=="rednaotitle")
  7.         return new RedNaoTitleStyler(formElement,elementToStyle,attributesCointainer);
  8.     if(formElement.Options.ClassName=="rednaotextinput")
  9.         return new RedNaoTextInputStyler(formElement,elementToStyle,attributesCointainer);
  10.     if(formElement.Options.ClassName=="rednaoprependedtext")
  11.         return new RedNaoPrependTextInputStyler(formElement,elementToStyle,attributesCointainer);
  12.     if(formElement.Options.ClassName=="rednaoappendedtext")
  13.         return new RedNaoAppendTextInputStyler(formElement,elementToStyle,attributesCointainer);
  14.     if(formElement.Options.ClassName=="rednaoprependedcheckbox")
  15.         return new RedNaoPrependCheckBoxStyler(formElement,elementToStyle,attributesCointainer);
  16.     if(formElement.Options.ClassName=="rednaoappendedcheckbox")
  17.         return new RedNaoAppendCheckBoxStyler(formElement,elementToStyle,attributesCointainer);
  18.     if(formElement.Options.ClassName=="rednaotextarea")
  19.         return new RedNaoTextAreaStyler(formElement,elementToStyle,attributesCointainer);
  20.     if(formElement.Options.ClassName=="rednaodatepicker")
  21.         return new RedNaoTextAreaStyler(formElement,elementToStyle,attributesCointainer);
  22.     if(formElement.Options.ClassName=="rednaoname")
  23.         return new RedNaoNameStyler(formElement,elementToStyle,attributesCointainer);
  24.     if(formElement.Options.ClassName=="rednaophone")
  25.         return new RedNaoPhoneStyler(formElement,elementToStyle,attributesCointainer);
  26.     if(formElement.Options.ClassName=="rednaoemail")
  27.         return new RedNaoTextInputStyler(formElement,elementToStyle,attributesCointainer);
  28.     if(formElement.Options.ClassName=="rednaonumber")
  29.         return new RedNaoTextInputStyler(formElement,elementToStyle,attributesCointainer);
  30.     if(formElement.Options.ClassName=="rednaoaddress")
  31.         return new RedNaoAddressStyler(formElement,elementToStyle,attributesCointainer);
  32.     if(formElement.Options.ClassName=="rednaomultipleradios")
  33.         return new RedNaoRadioStyler(formElement,elementToStyle,attributesCointainer);
  34.     if(formElement.Options.ClassName=="rednaomultiplecheckboxes")
  35.         return new RedNaoCheckBoxStyler(formElement,elementToStyle,attributesCointainer);
  36.     if(formElement.Options.ClassName=="rednaoselectbasic")
  37.         return new RedNaoSelectBasicStyler(formElement,elementToStyle,attributesCointainer);
  38.     if(formElement.Options.ClassName=="rednaosubmissionbutton")
  39.         return new RedNaoSubmissionButtonStyler(formElement,elementToStyle,attributesCointainer);
  40.     if(formElement.Options.ClassName=="sfFileUpload")
  41.         return new RedNaoFileUploadStyler(formElement,elementToStyle,attributesCointainer);
  42.  
  43.     for(var i=0;i<RedNaoBaseElementStyler.Extensions.length;i++)
  44.         if(RedNaoBaseElementStyler.Extensions[i].Name==formElement.Options.ClassName)
  45.             return RedNaoBaseElementStyler.Extensions[i].Create(formElement,elementToStyle,attributesCointainer);
  46.  
  47.     throw 'Element Type Not Found';
  48.  
  49. }
  50.  
  51.  
  52. /************************************************************************************* Base Element Styler ***************************************************************************************************/
  53.  
  54. function RedNaoBaseElementStyler(formElement,elementToStyle,attributesCointainer)
  55. {
  56.     this.FormElement=formElement;
  57.     this.ElementToStyle=elementToStyle;
  58.     this.AttributesCointainer=attributesCointainer;
  59.     this.StyleSets={};
  60.  
  61.     this.SetupSelectableElements();
  62. }
  63.  
  64. RedNaoBaseElementStyler.Extensions=[];
  65.  
  66. RedNaoBaseElementStyler.prototype.SetupSelectableElements=function()
  67. {
  68.  
  69. };
  70.  
  71.  
  72. /************************************************************************************* Title Element Styler ***************************************************************************************************/
  73. function RedNaoTitleStyler(formElement,elementToStyle,attributesCointainer)
  74. {
  75.     RedNaoBaseElementStyler.call(this,formElement,elementToStyle,attributesCointainer);
  76. }
  77. RedNaoTitleStyler.prototype=Object.create(RedNaoBaseElementStyler.prototype);
  78.  
  79.  
  80. RedNaoTitleStyler.prototype.SetupSelectableElements=function()
  81. {
  82.     this.StyleSets.Title=new SmartFormsTitleStyleSet(this.FormElement,this.ElementToStyle,this.AttributesCointainer,"redNaoLegend");
  83. };
  84.  
  85. /************************************************************************************* Text Input Element Styler ***************************************************************************************************/
  86. function RedNaoTextInputStyler(formElement,elementToStyle,attributesCointainer)
  87. {
  88.     RedNaoBaseElementStyler.call(this,formElement,elementToStyle,attributesCointainer);
  89. }
  90. RedNaoTextInputStyler.prototype=Object.create(RedNaoBaseElementStyler.prototype);
  91.  
  92.  
  93. RedNaoTextInputStyler.prototype.SetupSelectableElements=function()
  94. {
  95.     this.StyleSets.Label=new SmartFormsLabelStyleSet(this.FormElement,this.ElementToStyle,this.AttributesCointainer,"rednao_control_label");
  96.     this.StyleSets.Input=new SmartFormsInputStyleSet(this.FormElement,this.ElementToStyle,this.AttributesCointainer,"redNaoInputText");
  97.     this.StyleSets.Prepend=new SmartFormsPrependStyleSet(this.FormElement,this.ElementToStyle,this.AttributesCointainer,"redNaoPrepend");
  98. };
  99.  
  100. /************************************************************************************* PrependTextInput ***************************************************************************************************/
  101. function RedNaoPrependTextInputStyler(formElement,elementToStyle,attributesCointainer)
  102. {
  103.     RedNaoBaseElementStyler.call(this,formElement,elementToStyle,attributesCointainer);
  104. }
  105. RedNaoPrependTextInputStyler.prototype=Object.create(RedNaoBaseElementStyler.prototype);
  106.  
  107.  
  108. RedNaoPrependTextInputStyler.prototype.SetupSelectableElements=function()
  109. {
  110.     this.StyleSets.Label=new SmartFormsLabelStyleSet(this.FormElement,this.ElementToStyle,this.AttributesCointainer,"rednao_control_label");
  111.     this.StyleSets.Input=new SmartFormsInputStyleSet(this.FormElement,this.ElementToStyle,this.AttributesCointainer,"redNaoInputText");
  112.     this.StyleSets.Prepend=new SmartFormsPrependStyleSet(this.FormElement,this.ElementToStyle,this.AttributesCointainer,"redNaoPrepend");
  113. };
  114.  
  115. /************************************************************************************* AppendTextInput ***************************************************************************************************/
  116. function RedNaoAppendTextInputStyler(formElement,elementToStyle,attributesCointainer)
  117. {
  118.     RedNaoBaseElementStyler.call(this,formElement,elementToStyle,attributesCointainer);
  119. }
  120. RedNaoAppendTextInputStyler.prototype=Object.create(RedNaoBaseElementStyler.prototype);
  121.  
  122.  
  123. RedNaoAppendTextInputStyler.prototype.SetupSelectableElements=function()
  124. {
  125.     this.StyleSets.Label=new SmartFormsLabelStyleSet(this.FormElement,this.ElementToStyle,this.AttributesCointainer,"rednao_control_label");
  126.     this.StyleSets.Input=new SmartFormsInputStyleSet(this.FormElement,this.ElementToStyle,this.AttributesCointainer,"redNaoInputText");
  127.     this.StyleSets.Prepend=new SmartFormsPrependStyleSet(this.FormElement,this.ElementToStyle,this.AttributesCointainer,"redNaoAppend");
  128. };
  129.  
  130. /************************************************************************************* PrependCheckBox ***************************************************************************************************/
  131. function RedNaoPrependCheckBoxStyler(formElement,elementToStyle,attributesCointainer)
  132. {
  133.     RedNaoBaseElementStyler.call(this,formElement,elementToStyle,attributesCointainer);
  134. }
  135. RedNaoPrependCheckBoxStyler.prototype=Object.create(RedNaoBaseElementStyler.prototype);
  136.  
  137.  
  138. RedNaoPrependCheckBoxStyler.prototype.SetupSelectableElements=function()
  139. {
  140.     this.StyleSets.Label=new SmartFormsLabelStyleSet(this.FormElement,this.ElementToStyle,this.AttributesCointainer,"rednao_control_label");
  141.     this.StyleSets.Input=new SmartFormsInputStyleSet(this.FormElement,this.ElementToStyle,this.AttributesCointainer,"redNaoInputText");
  142.     this.StyleSets.Prepend=new SmartFormsCheckBoxStyleSet(this.FormElement,this.ElementToStyle,this.AttributesCointainer,"redNaoPrepend");
  143. };
  144.  
  145. /************************************************************************************* AppendCheckBox ***************************************************************************************************/
  146. function RedNaoAppendCheckBoxStyler(formElement,elementToStyle,attributesCointainer)
  147. {
  148.     RedNaoBaseElementStyler.call(this,formElement,elementToStyle,attributesCointainer);
  149. }
  150. RedNaoAppendCheckBoxStyler.prototype=Object.create(RedNaoBaseElementStyler.prototype);
  151.  
  152.  
  153. RedNaoAppendCheckBoxStyler.prototype.SetupSelectableElements=function()
  154. {
  155.     this.StyleSets.Label=new SmartFormsLabelStyleSet(this.FormElement,this.ElementToStyle,this.AttributesCointainer,"rednao_control_label");
  156.     this.StyleSets.Input=new SmartFormsInputStyleSet(this.FormElement,this.ElementToStyle,this.AttributesCointainer,"redNaoInputText");
  157.     this.StyleSets.Prepend=new SmartFormsCheckBoxStyleSet(this.FormElement,this.ElementToStyle,this.AttributesCointainer,"redNaoAppend");
  158. };
  159.  
  160. /************************************************************************************* TextArea ***************************************************************************************************/
  161. function RedNaoTextAreaStyler(formElement,elementToStyle,attributesCointainer)
  162. {
  163.     RedNaoBaseElementStyler.call(this,formElement,elementToStyle,attributesCointainer);
  164. }
  165. RedNaoTextAreaStyler.prototype=Object.create(RedNaoBaseElementStyler.prototype);
  166.  
  167.  
  168. RedNaoTextAreaStyler.prototype.SetupSelectableElements=function()
  169. {
  170.     this.StyleSets.Label=new SmartFormsLabelStyleSet(this.FormElement,this.ElementToStyle,this.AttributesCointainer,"rednao_control_label");
  171.     this.StyleSets.Input=new SmartFormsInputStyleSet(this.FormElement,this.ElementToStyle,this.AttributesCointainer,"redNaoTextAreaInput");
  172. };
  173.  
  174. /************************************************************************************* Date ***************************************************************************************************/
  175. function RedNaoDatePickerStyler(formElement,elementToStyle,attributesCointainer)
  176. {
  177.     RedNaoBaseElementStyler.call(this,formElement,elementToStyle,attributesCointainer);
  178. }
  179. RedNaoDatePickerStyler.prototype=Object.create(RedNaoBaseElementStyler.prototype);
  180.  
  181.  
  182. RedNaoDatePickerStyler.prototype.SetupSelectableElements=function()
  183. {
  184.     this.StyleSets.Label=new SmartFormsLabelStyleSet(this.FormElement,this.ElementToStyle,this.AttributesCointainer,"rednao_control_label");
  185.     this.StyleSets.Input=new SmartFormsInputStyleSet(this.FormElement,this.ElementToStyle,this.AttributesCointainer,"redNaoDatePicker");
  186.     this.StyleSets.Prepend=new SmartFormsPrependStyleSet(this.FormElement,this.ElementToStyle,this.AttributesCointainer,"redNaoPrepend");
  187. };
  188.  
  189. /************************************************************************************* Name ***************************************************************************************************/
  190. function RedNaoNameStyler(formElement,elementToStyle,attributesCointainer)
  191. {
  192.     RedNaoBaseElementStyler.call(this,formElement,elementToStyle,attributesCointainer);
  193. }
  194. RedNaoNameStyler.prototype=Object.create(RedNaoBaseElementStyler.prototype);
  195.  
  196.  
  197. RedNaoNameStyler.prototype.SetupSelectableElements=function()
  198. {
  199.     this.StyleSets.Label=new SmartFormsLabelStyleSet(this.FormElement,this.ElementToStyle,this.AttributesCointainer,"rednao_control_label");
  200.     this.StyleSets.Input=new SmartFormsInputStyleSet(this.FormElement,this.ElementToStyle,this.AttributesCointainer,"redNaoInputFirstName");
  201.     this.StyleSets.LastName=new SmartFormsInputStyleSet(this.FormElement,this.ElementToStyle,this.AttributesCointainer,"redNaoInputLastName");
  202.     this.StyleSets.Prepend=new SmartFormsPrependStyleSet(this.FormElement,this.ElementToStyle,this.AttributesCointainer,"redNaoPrepend");
  203. };
  204.  
  205. /************************************************************************************* Phone ***************************************************************************************************/
  206. function RedNaoPhoneStyler(formElement,elementToStyle,attributesCointainer)
  207. {
  208.     RedNaoBaseElementStyler.call(this,formElement,elementToStyle,attributesCointainer);
  209. }
  210. RedNaoPhoneStyler.prototype=Object.create(RedNaoBaseElementStyler.prototype);
  211.  
  212.  
  213. RedNaoPhoneStyler.prototype.SetupSelectableElements=function()
  214. {
  215.     this.StyleSets.Label=new SmartFormsLabelStyleSet(this.FormElement,this.ElementToStyle,this.AttributesCointainer,"rednao_control_label");
  216.     this.StyleSets.Input=new SmartFormsInputStyleSet(this.FormElement,this.ElementToStyle,this.AttributesCointainer,"redNaoInputArea");
  217.     this.StyleSets.Phone=new SmartFormsInputStyleSet(this.FormElement,this.ElementToStyle,this.AttributesCointainer,"redNaoInputPhone");
  218.     this.StyleSets.Prepend=new SmartFormsPrependStyleSet(this.FormElement,this.ElementToStyle,this.AttributesCointainer,"redNaoPrepend");
  219. };
  220.  
  221. /************************************************************************************* Address ***************************************************************************************************/
  222. function RedNaoAddressStyler(formElement,elementToStyle,attributesCointainer)
  223. {
  224.     RedNaoBaseElementStyler.call(this,formElement,elementToStyle,attributesCointainer);
  225. }
  226. RedNaoAddressStyler.prototype=Object.create(RedNaoBaseElementStyler.prototype);
  227.  
  228.  
  229. RedNaoAddressStyler.prototype.SetupSelectableElements=function()
  230. {
  231.     this.StyleSets.Label=new SmartFormsLabelStyleSet(this.FormElement,this.ElementToStyle,this.AttributesCointainer,"rednao_control_label");
  232.     this.StyleSets.Input=new SmartFormsInputStyleSet(this.FormElement,this.ElementToStyle,this.AttributesCointainer,"redNaoStreetAddress1");
  233.     this.StyleSets.address1=new SmartFormsInputStyleSet(this.FormElement,this.ElementToStyle,this.AttributesCointainer,"redNaoStreetAddress2");
  234.     this.StyleSets.city=new SmartFormsInputStyleSet(this.FormElement,this.ElementToStyle,this.AttributesCointainer,"redNaoCity");
  235.     this.StyleSets.state=new SmartFormsInputStyleSet(this.FormElement,this.ElementToStyle,this.AttributesCointainer,"redNaoState");
  236.     this.StyleSets.zip=new SmartFormsInputStyleSet(this.FormElement,this.ElementToStyle,this.AttributesCointainer,"redNaoZip");
  237.     this.StyleSets.country=new SmartFormsInputStyleSet(this.FormElement,this.ElementToStyle,this.AttributesCointainer,"redNaoCountry");
  238.     this.StyleSets.Prepend=new SmartFormsPrependStyleSet(this.FormElement,this.ElementToStyle,this.AttributesCointainer,"redNaoPrepend");
  239.  
  240. };
  241.  
  242. /************************************************************************************* Multiple Radio ***************************************************************************************************/
  243. function RedNaoRadioStyler(formElement,elementToStyle,attributesCointainer)
  244. {
  245.     RedNaoBaseElementStyler.call(this,formElement,elementToStyle,attributesCointainer);
  246. }
  247. RedNaoRadioStyler.prototype=Object.create(RedNaoBaseElementStyler.prototype);
  248.  
  249.  
  250. RedNaoRadioStyler.prototype.SetupSelectableElements=function()
  251. {
  252.     this.StyleSets.Label=new SmartFormsLabelStyleSet(this.FormElement,this.ElementToStyle,this.AttributesCointainer,"rednao_control_label");
  253.     this.StyleSets.Input=new SmartFormsInputStyleSet(this.FormElement,this.ElementToStyle,this.AttributesCointainer,"redNaoRadio");
  254.  
  255.  
  256. };
  257.  
  258. /************************************************************************************* Multiple Checkbox ***************************************************************************************************/
  259. function RedNaoCheckBoxStyler(formElement,elementToStyle,attributesCointainer)
  260. {
  261.     RedNaoBaseElementStyler.call(this,formElement,elementToStyle,attributesCointainer);
  262. }
  263. RedNaoCheckBoxStyler.prototype=Object.create(RedNaoBaseElementStyler.prototype);
  264.  
  265.  
  266. RedNaoCheckBoxStyler.prototype.SetupSelectableElements=function()
  267. {
  268.     this.StyleSets.Label=new SmartFormsLabelStyleSet(this.FormElement,this.ElementToStyle,this.AttributesCointainer,"rednao_control_label");
  269.     this.StyleSets.Input=new SmartFormsInputStyleSet(this.FormElement,this.ElementToStyle,this.AttributesCointainer,"redNaoCheckBox ");
  270.  
  271.  
  272. };
  273.  
  274. /************************************************************************************* Select Basic ***************************************************************************************************/
  275. function RedNaoSelectBasicStyler(formElement,elementToStyle,attributesCointainer)
  276. {
  277.     RedNaoBaseElementStyler.call(this,formElement,elementToStyle,attributesCointainer);
  278. }
  279. RedNaoSelectBasicStyler.prototype=Object.create(RedNaoBaseElementStyler.prototype);
  280.  
  281.  
  282. RedNaoSelectBasicStyler.prototype.SetupSelectableElements=function()
  283. {
  284.     this.StyleSets.Label=new SmartFormsLabelStyleSet(this.FormElement,this.ElementToStyle,this.AttributesCointainer,"rednao_control_label");
  285.     this.StyleSets.Input=new SmartFormsInputStyleSet(this.FormElement,this.ElementToStyle,this.AttributesCointainer,"redNaoSelect");
  286. };
  287.  
  288. /************************************************************************************* Submission Button ***************************************************************************************************/
  289. function RedNaoSubmissionButtonStyler(formElement,elementToStyle,attributesCointainer)
  290. {
  291.     RedNaoBaseElementStyler.call(this,formElement,elementToStyle,attributesCointainer);
  292. }
  293. RedNaoSubmissionButtonStyler.prototype=Object.create(RedNaoBaseElementStyler.prototype);
  294.  
  295.  
  296. RedNaoSubmissionButtonStyler.prototype.SetupSelectableElements=function()
  297. {
  298.     this.StyleSets.Label=new SmartFormsButtonStyleSet(this.FormElement,this.ElementToStyle,this.AttributesCointainer,"redNaoSubmitButton");
  299. };
  300.  
  301. /************************************************************************************* File Upload Styler ***************************************************************************************************/
  302. function RedNaoFileUploadStyler(formElement,elementToStyle,attributesCointainer)
  303. {
  304.     RedNaoBaseElementStyler.call(this,formElement,elementToStyle,attributesCointainer);
  305. }
  306. RedNaoFileUploadStyler.prototype=Object.create(RedNaoBaseElementStyler.prototype);
  307.  
  308.  
  309. RedNaoFileUploadStyler.prototype.SetupSelectableElements=function()
  310. {
  311.     this.StyleSets.Label=new SmartFormsLabelStyleSet(this.FormElement,this.ElementToStyle,this.AttributesCointainer,"rednao_control_label");
  312.     this.StyleSets.Input=new SmartFormsInputStyleSet(this.FormElement,this.ElementToStyle,this.AttributesCointainer,"sfUploadFilePath");
  313.     this.StyleSets.Button=new SmartFormsFileButtonStyleSet(this.FormElement,this.ElementToStyle,this.AttributesCointainer,"sfUploadFileContainer");
  314.  
  315.  
  316. };

Raw Paste


Login or Register to edit or fork this paste. It's free.