Best JavaScript code snippet using storybook-root
functions.js
Source:functions.js
1function $_(idElement){2 return document.getElementById(idElement);3}45function $F_(idElement){6 var element = $_(idElement);7 switch(element.type){8 case 'select-one':9 return element.options[element.selectedIndex].value;10 break;11 case 'radio':12 case 'checkbox':13 return element.checked;14 break;15 case 'text':16 case 'password':17 case 'textarea':18 case 'hidden':19 return element.value;20 break;21 default:22 return element.innerHTML;23 }24}2526function killEvent(elm, evType, fn, useCapture){27 if (elm.removeEventListener) {28 elm.removeEventListener(evType, fn, useCapture);29 return true;30 }else if (elm.detachEvent) {31 var r = elm.detachEvent('on' + evType, fn);32 return r;33 }else{34 elm['on' + evType] = null;35 }36}3738function addEventMy(elm, evType, fn, useCapture) {39 if (elm.addEventListener) {40 elm.addEventListener(evType, fn, useCapture);41 return true;42 }else if (elm.attachEvent) {43 var r = elm.attachEvent('on' + evType, fn);44 return r;45 }else{46 elm['on' + evType] = fn;47 }48}4950function highlightField(field){51 jQuery('#'+field).addClass('fielderror');52}5354function unhighlightField(formName){55 var form = document.forms[formName];56 var countElements = form.length;57 for (i = 0; i < countElements; i++){58 if (form.elements[i].type == 'button' || form.elements[i].type == 'submit' || form.elements[i].type == 'radio' || form.elements[i].type == 'hidden') continue;59 jQuery(form.elements[i]).removeClass('fielderror');60 }61}6263function isEmpty(value){64 var pattern = /\S/;65 return ret = (pattern.test(value)) ? (0) : (1);66}6768function checkMail(value){69 var pattern = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;70 return ret = (pattern.test(value)) ? (1) : (0);71}7273function Equal(value1, value2){74 return (value1 == value2);75}7677function validateRegistrationForm(urlcheckdata, formName){78 79 var arrayId = new Array();80 var arrayType = new Array();81 var arrayParams = new Array();82 var arrayErrorMessages = new Array();8384 var i = 0;8586 if (register_field_require.title){87 arrayId[i] = 'title';88 arrayType[i] = 'notn';89 arrayParams[i] = '';90 arrayErrorMessages[i] = '';91 i++;92 }9394 if (register_field_require.f_name){95 arrayId[i] = 'f_name';96 arrayType[i] = 'nem';97 arrayParams[i] = '';98 arrayErrorMessages[i] = '';99 i++;100 }101 102 if (register_field_require.l_name){103 arrayId[i] = 'l_name';104 arrayType[i] = 'nem';105 arrayParams[i] = '';106 arrayErrorMessages[i] = '';107 i++;108 }109 110 if (register_field_require.m_name){111 arrayId[i] = 'm_name';112 arrayType[i] = 'nem';113 arrayParams[i] = '';114 arrayErrorMessages[i] = '';115 i++;116 }117 118 if (register_field_require.firma_name){119 arrayId[i] = 'firma_name';120 arrayType[i] = 'nem';121 arrayParams[i] = '';122 arrayErrorMessages[i] = '';123 i++;124 }125 126 if (register_field_require.client_type){127 arrayId[i] = 'client_type';128 arrayType[i] = 'notn';129 arrayParams[i] = '';130 arrayErrorMessages[i] = '';131 i++;132 } 133134 if ( (document.forms[formName].client_type && document.forms[formName].client_type.value=="2") || !document.forms[formName].client_type ){135 if (register_field_require.firma_code){136 arrayId[i] = 'firma_code';137 arrayType[i] = 'nem';138 arrayParams[i] = '';139 arrayErrorMessages[i] = '';140 i++;141 }142143 if (register_field_require.tax_number){144 arrayId[i] = 'tax_number';145 arrayType[i] = 'nem';146 arrayParams[i] = '';147 arrayErrorMessages[i] = '';148 i++;149 }150 }151 152 if (register_field_require.email){153 arrayId[i] = 'email';154 arrayType[i] = 'em';155 arrayParams[i] = '';156 arrayErrorMessages[i] = '';157 i++;158 }159 160 if (register_field_require.email2){161 arrayId[i] = 'email';162 arrayType[i] = 'eqne';163 arrayParams[i] = 'email2';164 arrayErrorMessages[i] = '';165 i++;166 }167 168 if (register_field_require.birthday){169 arrayId[i] = 'birthday';170 arrayType[i] = 'nem';171 arrayParams[i] = '';172 arrayErrorMessages[i] = '';173 i++;174 }175 176 if (register_field_require.home){177 arrayId[i] = 'home';178 arrayType[i] = 'nem';179 arrayParams[i] = '';180 arrayErrorMessages[i] = '';181 i++;182 }183 184 if (register_field_require.apartment){185 arrayId[i] = 'apartment';186 arrayType[i] = 'nem';187 arrayParams[i] = '';188 arrayErrorMessages[i] = '';189 i++;190 }191 192 if (register_field_require.street){193 arrayId[i] = 'street';194 arrayType[i] = 'nem';195 arrayParams[i] = '';196 arrayErrorMessages[i] = '';197 i++;198 }199 200 if (register_field_require.street_nr){201 arrayId[i] = 'street_nr';202 arrayType[i] = 'nem';203 arrayParams[i] = '';204 arrayErrorMessages[i] = '';205 i++;206 }207 208 if (register_field_require.zip){209 arrayId[i] = 'zip';210 arrayType[i] = 'zip';211 arrayParams[i] = '';212 arrayErrorMessages[i] = '';213 i++;214 }215 216 if (register_field_require.city){217 arrayId[i] = 'city';218 arrayType[i] = 'nem';219 arrayParams[i] = '';220 arrayErrorMessages[i] = '';221 i++;222 }223 224 if (register_field_require.state){225 arrayId[i] = 'state';226 arrayType[i] = 'nem';227 arrayParams[i] = '';228 arrayErrorMessages[i] = '';229 i++;230 }231 232 if (register_field_require.country){233 arrayId[i] = 'country';234 arrayType[i] = 'notn';235 arrayParams[i] = '';236 arrayErrorMessages[i] = '';237 i++;238 }239 240 if (register_field_require.phone){241 arrayId[i] = 'phone';242 arrayType[i] = 'nem';243 arrayParams[i] = '';244 arrayErrorMessages[i] = '';245 i++;246 }247 248 if (register_field_require.mobil_phone){249 arrayId[i] = 'mobil_phone';250 arrayType[i] = 'nem';251 arrayParams[i] = '';252 arrayErrorMessages[i] = '';253 i++;254 }255 256 if (register_field_require.fax){257 arrayId[i] = 'fax';258 arrayType[i] = 'nem';259 arrayParams[i] = '';260 arrayErrorMessages[i] = '';261 i++;262 }263 264 if (register_field_require.ext_field_1){265 arrayId[i] = 'ext_field_1';266 arrayType[i] = 'nem';267 arrayParams[i] = '';268 arrayErrorMessages[i] = '';269 i++;270 }271272 if (register_field_require.ext_field_2){273 arrayId[i] = 'ext_field_2';274 arrayType[i] = 'nem';275 arrayParams[i] = '';276 arrayErrorMessages[i] = '';277 i++;278 }279280 if (register_field_require.ext_field_3){281 arrayId[i] = 'ext_field_3';282 arrayType[i] = 'nem';283 arrayParams[i] = '';284 arrayErrorMessages[i] = '';285 i++;286 } 287 288 if (register_field_require.u_name){289 arrayId[i] = 'u_name';290 arrayType[i] = 'nem';291 arrayParams[i] = '';292 arrayErrorMessages[i] = '';293 i++; 294 }295 296 if (register_field_require.password && register_field_require.password_2){297 arrayId[i] = 'password';298 arrayType[i] = 'eqne';299 arrayParams[i] = 'password_2';300 arrayErrorMessages[i] = '';301 i++;302 }else if (register_field_require.password){303 arrayId[i] = 'password';304 arrayType[i] = 'nem';305 arrayParams[i] = '';306 arrayErrorMessages[i] = '';307 i++;308 }309 310 if (register_field_require.privacy_statement){311 arrayId[i] = 'privacy_statement';312 arrayType[i] = 'chk';313 arrayParams[i] = '';314 arrayErrorMessages[i] = '';315 i++;316 }317 318 var myForm = new validateForm(formName, arrayId, arrayType, arrayParams, arrayErrorMessages, 2);319 var error = (myForm.validate()) ? (1) : (0);320 if (!error){321 return false;322 }else{323 function showResponse(originalRequest){324 if (originalRequest != 1){325 alert(originalRequest);326 return false;327 } else {328 document.forms[formName].submit();329 }330 } 331 var udata = {"username":jQuery('#u_name').val(),"email":jQuery('#email').val()};332 jQuery.get(urlcheckdata, udata, showResponse);333 return false;334 }335}336337function validateCheckoutAdressForm(livepath, formName){338 339 var typeShowError = 2;340 var arrayId = new Array();341 var arrayType = new Array();342 var arrayParams = new Array();343 var arrayErrorMessages = new Array();344 345 var i = 0;346 347 if (register_field_require.title){348 arrayId[i] = 'title';349 arrayType[i] = 'notn';350 arrayParams[i] = '';351 arrayErrorMessages[i] = '';352 i++;353 }354 355 if (register_field_require.f_name){356 arrayId[i] = 'f_name';357 arrayType[i] = 'nem';358 arrayParams[i] = '';359 arrayErrorMessages[i] = '';360 i++;361 }362 363 if (register_field_require.l_name){364 arrayId[i] = 'l_name';365 arrayType[i] = 'nem';366 arrayParams[i] = '';367 arrayErrorMessages[i] = '';368 i++;369 }370 371 if (register_field_require.m_name){372 arrayId[i] = 'm_name';373 arrayType[i] = 'nem';374 arrayParams[i] = '';375 arrayErrorMessages[i] = '';376 i++;377 }378 379 if (register_field_require.firma_name){380 arrayId[i] = 'firma_name';381 arrayType[i] = 'nem';382 arrayParams[i] = '';383 arrayErrorMessages[i] = '';384 i++;385 }386 387 if (register_field_require.client_type){388 arrayId[i] = 'client_type';389 arrayType[i] = 'notn';390 arrayParams[i] = '';391 arrayErrorMessages[i] = '';392 i++;393 }394395 if ( (document.forms[formName].client_type && document.forms[formName].client_type.value=="2") || !document.forms[formName].client_type ){396 if (register_field_require.firma_code){397 arrayId[i] = 'firma_code';398 arrayType[i] = 'nem';399 arrayParams[i] = '';400 arrayErrorMessages[i] = '';401 i++;402 }403404 if (register_field_require.tax_number){405 arrayId[i] = 'tax_number';406 arrayType[i] = 'nem';407 arrayParams[i] = '';408 arrayErrorMessages[i] = '';409 i++;410 }411 }412 413 if (register_field_require.email){414 arrayId[i] = 'email';415 arrayType[i] = 'em';416 arrayParams[i] = '';417 arrayErrorMessages[i] = '';418 i++;419 }420 421 if (register_field_require.email2){422 arrayId[i] = 'email';423 arrayType[i] = 'eqne';424 arrayParams[i] = 'email2';425 arrayErrorMessages[i] = '';426 i++;427 }428 429 if (register_field_require.birthday){430 arrayId[i] = 'birthday';431 arrayType[i] = 'nem';432 arrayParams[i] = '';433 arrayErrorMessages[i] = '';434 i++;435 }436 437 if (register_field_require.home){438 arrayId[i] = 'home';439 arrayType[i] = 'nem';440 arrayParams[i] = '';441 arrayErrorMessages[i] = '';442 i++;443 }444 445 if (register_field_require.apartment){446 arrayId[i] = 'apartment';447 arrayType[i] = 'nem';448 arrayParams[i] = '';449 arrayErrorMessages[i] = '';450 i++;451 }452 453 if (register_field_require.street){454 arrayId[i] = 'street';455 arrayType[i] = 'nem';456 arrayParams[i] = '';457 arrayErrorMessages[i] = '';458 i++;459 }460 461 if (register_field_require.street_nr){462 arrayId[i] = 'street_nr';463 arrayType[i] = 'nem';464 arrayParams[i] = '';465 arrayErrorMessages[i] = '';466 i++;467 }468 469 if (register_field_require.zip){470 arrayId[i] = 'zip';471 arrayType[i] = 'zip';472 arrayParams[i] = '';473 arrayErrorMessages[i] = '';474 i++;475 }476 477 if (register_field_require.city){478 arrayId[i] = 'city';479 arrayType[i] = 'nem';480 arrayParams[i] = '';481 arrayErrorMessages[i] = '';482 i++;483 }484 485 if (register_field_require.state){486 arrayId[i] = 'state';487 arrayType[i] = 'nem';488 arrayParams[i] = '';489 arrayErrorMessages[i] = '';490 i++;491 }492 493 if (register_field_require.country){494 arrayId[i] = 'country';495 arrayType[i] = 'notn';496 arrayParams[i] = '';497 arrayErrorMessages[i] = '';498 i++;499 }500 501 if (register_field_require.phone){502 arrayId[i] = 'phone';503 arrayType[i] = 'nem';504 arrayParams[i] = '';505 arrayErrorMessages[i] = '';506 i++;507 }508 509 if (register_field_require.mobil_phone){510 arrayId[i] = 'mobil_phone';511 arrayType[i] = 'nem';512 arrayParams[i] = '';513 arrayErrorMessages[i] = '';514 i++;515 }516 517 if (register_field_require.fax){518 arrayId[i] = 'fax';519 arrayType[i] = 'nem';520 arrayParams[i] = '';521 arrayErrorMessages[i] = '';522 i++;523 }524 525 if (register_field_require.ext_field_1){526 arrayId[i] = 'ext_field_1';527 arrayType[i] = 'nem';528 arrayParams[i] = '';529 arrayErrorMessages[i] = '';530 i++;531 }532533 if (register_field_require.ext_field_2){534 arrayId[i] = 'ext_field_2';535 arrayType[i] = 'nem';536 arrayParams[i] = '';537 arrayErrorMessages[i] = '';538 i++;539 }540541 if (register_field_require.ext_field_3){542 arrayId[i] = 'ext_field_3';543 arrayType[i] = 'nem';544 arrayParams[i] = '';545 arrayErrorMessages[i] = '';546 i++;547 }548 549 if (register_field_require.privacy_statement){550 arrayId[i] = 'privacy_statement';551 arrayType[i] = 'chk';552 arrayParams[i] = '';553 arrayErrorMessages[i] = '';554 i++;555 }556 557 if ($_('delivery_adress_2')){558 if ($F_('delivery_adress_2')){559 560 if (register_field_require.d_title){561 arrayId[i] = 'd_title';562 arrayType[i] = 'notn';563 arrayParams[i] = '';564 arrayErrorMessages[i] = '';565 i++;566 }567 568 if (register_field_require.d_f_name){569 arrayId[i] = 'd_f_name';570 arrayType[i] = 'nem';571 arrayParams[i] = '';572 arrayErrorMessages[i] = '';573 i++;574 }575 576 if (register_field_require.d_l_name){577 arrayId[i] = 'd_l_name';578 arrayType[i] = 'nem';579 arrayParams[i] = '';580 arrayErrorMessages[i] = '';581 i++;582 }583 584 if (register_field_require.d_m_name){585 arrayId[i] = 'd_m_name';586 arrayType[i] = 'nem';587 arrayParams[i] = '';588 arrayErrorMessages[i] = '';589 i++;590 }591 592 if (register_field_require.d_firma_name){593 arrayId[i] = 'd_firma_name';594 arrayType[i] = 'nem';595 arrayParams[i] = '';596 arrayErrorMessages[i] = '';597 i++;598 }599 600 if (register_field_require.d_email){601 arrayId[i] = 'd_email';602 arrayType[i] = 'em';603 arrayParams[i] = '';604 arrayErrorMessages[i] = '';605 i++;606 }607 608 if (register_field_require.d_birthday){609 arrayId[i] = 'd_birthday';610 arrayType[i] = 'nem';611 arrayParams[i] = '';612 arrayErrorMessages[i] = '';613 i++;614 }615 616 if (register_field_require.d_home){617 arrayId[i] = 'd_home';618 arrayType[i] = 'nem';619 arrayParams[i] = '';620 arrayErrorMessages[i] = '';621 i++;622 }623 624 if (register_field_require.d_apartment){625 arrayId[i] = 'd_apartment';626 arrayType[i] = 'nem';627 arrayParams[i] = '';628 arrayErrorMessages[i] = '';629 i++;630 }631 632 if (register_field_require.d_street){633 arrayId[i] = 'd_street';634 arrayType[i] = 'nem';635 arrayParams[i] = '';636 arrayErrorMessages[i] = '';637 i++;638 }639 640 if (register_field_require.d_street_nr){641 arrayId[i] = 'd_street_nr';642 arrayType[i] = 'nem';643 arrayParams[i] = '';644 arrayErrorMessages[i] = '';645 i++;646 }647 648 if (register_field_require.d_zip){649 arrayId[i] = 'd_zip';650 arrayType[i] = 'zip';651 arrayParams[i] = '';652 arrayErrorMessages[i] = '';653 i++;654 }655 656 if (register_field_require.d_city){657 arrayId[i] = 'd_city';658 arrayType[i] = 'nem';659 arrayParams[i] = '';660 arrayErrorMessages[i] = '';661 i++;662 }663 664 if (register_field_require.d_state){665 arrayId[i] = 'd_state';666 arrayType[i] = 'nem';667 arrayParams[i] = '';668 arrayErrorMessages[i] = '';669 i++;670 }671 672 if (register_field_require.d_country){673 arrayId[i] = 'd_country';674 arrayType[i] = 'notn';675 arrayParams[i] = '';676 arrayErrorMessages[i] = '';677 i++;678 }679 680 if (register_field_require.d_phone){681 arrayId[i] = 'd_phone';682 arrayType[i] = 'nem';683 arrayParams[i] = '';684 arrayErrorMessages[i] = '';685 i++;686 }687 688 if (register_field_require.d_mobil_phone){689 arrayId[i] = 'd_mobil_phone';690 arrayType[i] = 'nem';691 arrayParams[i] = '';692 arrayErrorMessages[i] = '';693 i++;694 }695 696 if (register_field_require.d_fax){697 arrayId[i] = 'd_fax';698 arrayType[i] = 'nem';699 arrayParams[i] = '';700 arrayErrorMessages[i] = '';701 i++;702 }703 704 if (register_field_require.d_ext_field_1){705 arrayId[i] = 'd_ext_field_1';706 arrayType[i] = 'nem';707 arrayParams[i] = '';708 arrayErrorMessages[i] = '';709 i++;710 }711712 if (register_field_require.d_ext_field_2){713 arrayId[i] = 'd_ext_field_2';714 arrayType[i] = 'nem';715 arrayParams[i] = '';716 arrayErrorMessages[i] = '';717 i++;718 }719720 if (register_field_require.d_ext_field_3){721 arrayId[i] = 'd_ext_field_3';722 arrayType[i] = 'nem';723 arrayParams[i] = '';724 arrayErrorMessages[i] = '';725 i++;726 }727 728 }729 }730 var myForm = new validateForm(formName, arrayId, arrayType, arrayParams, arrayErrorMessages, typeShowError);731return error = myForm.validate();732}733734function validateEditAccountForm(livepath, formName){735 var typeShowError = 2;736 var arrayId = new Array();737 var arrayType = new Array();738 var arrayParams = new Array();739 var arrayErrorMessages = new Array();740 741 var i = 0;742 743 if (register_field_require.title){744 arrayId[i] = 'title';745 arrayType[i] = 'notn';746 arrayParams[i] = '';747 arrayErrorMessages[i] = '';748 i++;749 }750 751 if (register_field_require.f_name){752 arrayId[i] = 'f_name';753 arrayType[i] = 'nem';754 arrayParams[i] = '';755 arrayErrorMessages[i] = '';756 i++;757 }758 759 if (register_field_require.l_name){760 arrayId[i] = 'l_name';761 arrayType[i] = 'nem';762 arrayParams[i] = '';763 arrayErrorMessages[i] = '';764 i++;765 }766 767 if (register_field_require.m_name){768 arrayId[i] = 'm_name';769 arrayType[i] = 'nem';770 arrayParams[i] = '';771 arrayErrorMessages[i] = '';772 i++;773 }774 775 if (register_field_require.firma_name){776 arrayId[i] = 'firma_name';777 arrayType[i] = 'nem';778 arrayParams[i] = '';779 arrayErrorMessages[i] = '';780 i++;781 }782 783 if (register_field_require.client_type){784 arrayId[i] = 'client_type';785 arrayType[i] = 'notn';786 arrayParams[i] = '';787 arrayErrorMessages[i] = '';788 i++;789 }790791 if ( (document.forms[formName].client_type && document.forms[formName].client_type.value=="2") || !document.forms[formName].client_type ){792 if (register_field_require.firma_code){793 arrayId[i] = 'firma_code';794 arrayType[i] = 'nem';795 arrayParams[i] = '';796 arrayErrorMessages[i] = '';797 i++;798 }799800 if (register_field_require.tax_number){801 arrayId[i] = 'tax_number';802 arrayType[i] = 'nem';803 arrayParams[i] = '';804 arrayErrorMessages[i] = '';805 i++;806 }807 }808 809 if (register_field_require.email){810 arrayId[i] = 'email';811 arrayType[i] = 'em';812 arrayParams[i] = '';813 arrayErrorMessages[i] = '';814 i++;815 }816 817 if (register_field_require.birthday){818 arrayId[i] = 'birthday';819 arrayType[i] = 'nem';820 arrayParams[i] = '';821 arrayErrorMessages[i] = '';822 i++;823 }824 825 if (register_field_require.home){826 arrayId[i] = 'home';827 arrayType[i] = 'nem';828 arrayParams[i] = '';829 arrayErrorMessages[i] = '';830 i++;831 }832 833 if (register_field_require.apartment){834 arrayId[i] = 'apartment';835 arrayType[i] = 'nem';836 arrayParams[i] = '';837 arrayErrorMessages[i] = '';838 i++;839 }840 841 if (register_field_require.street){842 arrayId[i] = 'street';843 arrayType[i] = 'nem';844 arrayParams[i] = '';845 arrayErrorMessages[i] = '';846 i++;847 }848 849 if (register_field_require.street_nr){850 arrayId[i] = 'street_nr';851 arrayType[i] = 'nem';852 arrayParams[i] = '';853 arrayErrorMessages[i] = '';854 i++;855 }856 857 if (register_field_require.zip){858 arrayId[i] = 'zip';859 arrayType[i] = 'zip';860 arrayParams[i] = '';861 arrayErrorMessages[i] = '';862 i++;863 }864 865 if (register_field_require.city){866 arrayId[i] = 'city';867 arrayType[i] = 'nem';868 arrayParams[i] = '';869 arrayErrorMessages[i] = '';870 i++;871 }872 873 if (register_field_require.state){874 arrayId[i] = 'state';875 arrayType[i] = 'nem';876 arrayParams[i] = '';877 arrayErrorMessages[i] = '';878 i++;879 }880 881 if (register_field_require.country){882 arrayId[i] = 'country';883 arrayType[i] = 'notn';884 arrayParams[i] = '';885 arrayErrorMessages[i] = '';886 i++;887 }888 889 if (register_field_require.phone){890 arrayId[i] = 'phone';891 arrayType[i] = 'nem';892 arrayParams[i] = '';893 arrayErrorMessages[i] = '';894 i++;895 }896 897 if (register_field_require.mobil_phone){898 arrayId[i] = 'mobil_phone';899 arrayType[i] = 'nem';900 arrayParams[i] = '';901 arrayErrorMessages[i] = '';902 i++;903 } 904 905 if (register_field_require.fax){906 arrayId[i] = 'fax';907 arrayType[i] = 'nem';908 arrayParams[i] = '';909 arrayErrorMessages[i] = '';910 i++;911 }912 913 if (register_field_require.ext_field_1){914 arrayId[i] = 'ext_field_1';915 arrayType[i] = 'nem';916 arrayParams[i] = '';917 arrayErrorMessages[i] = '';918 i++;919 }920921 if (register_field_require.ext_field_2){922 arrayId[i] = 'ext_field_2';923 arrayType[i] = 'nem';924 arrayParams[i] = '';925 arrayErrorMessages[i] = '';926 i++;927 }928929 if (register_field_require.ext_field_3){930 arrayId[i] = 'ext_field_3';931 arrayType[i] = 'nem';932 arrayParams[i] = '';933 arrayErrorMessages[i] = '';934 i++;935 }936 937 if (register_field_require.password){938 arrayId[i] = 'password';939 arrayType[i] = 'nem';940 arrayParams[i] = '';941 arrayErrorMessages[i] = '';942 i++;943 }944 if (register_field_require.password_2){945 arrayId[i] = 'password_2';946 arrayType[i] = 'eqne';947 arrayParams[i] = 'password';948 arrayErrorMessages[i] = '';949 i++;950 }951 952 if (register_field_require.privacy_statement){953 arrayId[i] = 'privacy_statement';954 arrayType[i] = 'chk';955 arrayParams[i] = '';956 arrayErrorMessages[i] = '';957 i++;958 }959 960 if ($_('delivery_adress_2')){961 if ($F_('delivery_adress_2')){962 963 if (register_field_require.d_title){964 arrayId[i] = 'd_title';965 arrayType[i] = 'notn';966 arrayParams[i] = '';967 arrayErrorMessages[i] = '';968 i++;969 }970 971 if (register_field_require.d_f_name){972 arrayId[i] = 'd_f_name';973 arrayType[i] = 'nem';974 arrayParams[i] = '';975 arrayErrorMessages[i] = '';976 i++;977 }978 979 if (register_field_require.d_l_name){980 arrayId[i] = 'd_l_name';981 arrayType[i] = 'nem';982 arrayParams[i] = '';983 arrayErrorMessages[i] = '';984 i++;985 }986 987 if (register_field_require.d_m_name){988 arrayId[i] = 'd_m_name';989 arrayType[i] = 'nem';990 arrayParams[i] = '';991 arrayErrorMessages[i] = '';992 i++;993 }994 995 if (register_field_require.d_firma_name){996 arrayId[i] = 'd_firma_name';997 arrayType[i] = 'nem';998 arrayParams[i] = '';999 arrayErrorMessages[i] = '';1000 i++;1001 }1002 1003 if (register_field_require.d_email){1004 arrayId[i] = 'd_email';1005 arrayType[i] = 'em';1006 arrayParams[i] = '';1007 arrayErrorMessages[i] = '';1008 i++;1009 }1010 1011 if (register_field_require.d_birthday){1012 arrayId[i] = 'd_birthday';1013 arrayType[i] = 'nem';1014 arrayParams[i] = '';1015 arrayErrorMessages[i] = '';1016 i++;1017 }1018 1019 if (register_field_require.d_home){1020 arrayId[i] = 'd_home';1021 arrayType[i] = 'nem';1022 arrayParams[i] = '';1023 arrayErrorMessages[i] = '';1024 i++;1025 }1026 1027 if (register_field_require.d_apartment){1028 arrayId[i] = 'd_apartment';1029 arrayType[i] = 'nem';1030 arrayParams[i] = '';1031 arrayErrorMessages[i] = '';1032 i++;1033 }1034 1035 if (register_field_require.d_street){1036 arrayId[i] = 'd_street';1037 arrayType[i] = 'nem';1038 arrayParams[i] = '';1039 arrayErrorMessages[i] = '';1040 i++;1041 }1042 1043 if (register_field_require.d_street_nr){1044 arrayId[i] = 'd_street_nr';1045 arrayType[i] = 'nem';1046 arrayParams[i] = '';1047 arrayErrorMessages[i] = '';1048 i++;1049 }1050 1051 if (register_field_require.d_zip){1052 arrayId[i] = 'd_zip';1053 arrayType[i] = 'zip';1054 arrayParams[i] = '';1055 arrayErrorMessages[i] = '';1056 i++;1057 }1058 1059 if (register_field_require.d_city){1060 arrayId[i] = 'd_city';1061 arrayType[i] = 'nem';1062 arrayParams[i] = '';1063 arrayErrorMessages[i] = '';1064 i++;1065 }1066 1067 if (register_field_require.d_state){1068 arrayId[i] = 'd_state';1069 arrayType[i] = 'nem';1070 arrayParams[i] = '';1071 arrayErrorMessages[i] = '';1072 i++;1073 }1074 1075 if (register_field_require.d_country){1076 arrayId[i] = 'd_country';1077 arrayType[i] = 'notn';1078 arrayParams[i] = '';1079 arrayErrorMessages[i] = '';1080 i++;1081 }1082 1083 if (register_field_require.d_phone){1084 arrayId[i] = 'd_phone';1085 arrayType[i] = 'nem';1086 arrayParams[i] = '';1087 arrayErrorMessages[i] = '';1088 i++;1089 }1090 1091 if (register_field_require.d_mobil_phone){1092 arrayId[i] = 'd_mobil_phone';1093 arrayType[i] = 'nem';1094 arrayParams[i] = '';1095 arrayErrorMessages[i] = '';1096 i++;1097 } 1098 1099 if (register_field_require.d_fax){1100 arrayId[i] = 'd_fax';1101 arrayType[i] = 'nem';1102 arrayParams[i] = '';1103 arrayErrorMessages[i] = '';1104 i++;1105 }1106 1107 if (register_field_require.d_ext_field_1){1108 arrayId[i] = 'd_ext_field_1';1109 arrayType[i] = 'nem';1110 arrayParams[i] = '';1111 arrayErrorMessages[i] = '';1112 i++;1113 }11141115 if (register_field_require.d_ext_field_2){1116 arrayId[i] = 'd_ext_field_2';1117 arrayType[i] = 'nem';1118 arrayParams[i] = '';1119 arrayErrorMessages[i] = '';1120 i++;1121 }11221123 if (register_field_require.d_ext_field_3){1124 arrayId[i] = 'd_ext_field_3';1125 arrayType[i] = 'nem';1126 arrayParams[i] = '';1127 arrayErrorMessages[i] = '';1128 i++;1129 }1130 1131 }1132 }1133 var myForm = new validateForm(formName, arrayId, arrayType, arrayParams, arrayErrorMessages, typeShowError);1134return error = myForm.validate();1135}11361137function validateFormAdvancedSearch(formName){1138 var arrayId = new Array('date_from', 'date_to', 'price_from', 'price_to');1139 var arrayType = new Array('date|em', 'date|em', 'fl|em|0', 'fl|em');1140 var arrayParams = new Array('', '');1141 var arrayErrorMessages = new Array('', '');1142 var myForm = new validateForm(formName, arrayId, arrayType, arrayParams, arrayErrorMessages, 2);1143 error = myForm.validate(); 1144return error;1145}11461147function validateReviewForm(formName){1148 var arrayId = new Array('review_user_name', 'review_user_email', 'review_review');1149 var arrayType = new Array('nem', 'em', 'nem');1150 var arrayParams = new Array('', '');1151 var arrayErrorMessages = new Array('', '');1152 var myForm = new validateForm(formName, arrayId, arrayType, arrayParams, arrayErrorMessages, 2);1153 error = myForm.validate(); 1154return error;1155}11561157function checkAGBAndNoReturn(agb, no_return){1158 result1=result2=true;1159 if (agb=='1') result1 = checkAGB();1160 if (no_return=='1') result2 = checkNoReturn();1161 if (result1 && result2)1162 return true;1163 else1164 return false; 1165}1166function checkAGB(){1167 if ($_("agb").checked){1168 jQuery(".row_agb").removeClass('fielderror');1169 return true;1170 }else{1171 jQuery(".row_agb").addClass('fielderror');1172 jQuery('#agb').focus();1173 return false;1174 }1175}1176function checkNoReturn(){1177 if ($_("no_return").checked){1178 jQuery(".row_no_return").removeClass('fielderror');1179 return true;1180 }else{1181 jQuery(".row_no_return").addClass('fielderror');1182 jQuery('#no_return').focus();1183 return false;1184 } 1185}11861187var activePaymentMethod = "";1188function showPaymentForm(paymentMethod){1189 activePaymentMethod = paymentMethod;1190 jQuery("*[id^='tr_payment_']").hide();1191 jQuery('#tr_payment_'+paymentMethod).show();1192}11931194function checkPaymentForm(){1195 if (activePaymentMethod){ 1196 if (payment_type_check[activePaymentMethod]=='1'){1197 try {1198 eval("check_"+activePaymentMethod+"();");1199 }catch(exception){1200 console.log(exception);1201 jQuery('#payment_form').submit();1202 }1203 }else{1204 jQuery('#payment_form').submit();1205 }1206 }1207}12081209function isInt_5_8(value){1210 var pattern = /^(\d){5,8}$/;1211 return ret = (pattern.test(value)) ? (1) : (0);1212}12131214function validateShippingMethods(){1215 var tableShip = $_('table_shippings');1216 var inputs = tableShip.getElementsByTagName('input');1217 for (var i=0; i<inputs.length; i++){1218 if (inputs[i].type != 'radio') continue;1219 if (inputs[i].checked) return true;1220 }1221 return false;1222}12231224function showShippingForm(id){1225 jQuery("div.shipping_form").removeClass('shipping_form_active');1226 jQuery("#shipping_form_"+id).addClass('shipping_form_active');1227}12281229function hideElement(idElement){1230 $_(idElement).style.display = 'none';1231}12321233function disableElement(idElement){1234 $_(idElement).disabled = true;1235}12361237function submitListProductFilterSortDirection(){1238 $_('orderby').value = $_('orderby').value ^ 1;1239 submitListProductFilters();1240}12411242function submitListProductFilters(){1243 $_('sort_count').submit();1244}12451246function clearProductListFilter(){1247 jQuery("#manufacturers").val("0");1248 jQuery("#categorys").val("0");1249 jQuery("#price_from").val("");1250 jQuery("#price_to").val("");1251 submitListProductFilters();1252}12531254var joomshoppingVideoHtml5 = 0;1255var joomshoppingVideoHtml5Type = '';1256function showVideo(idElement, width, height){1257 var videofile = jQuery("#"+idElement).attr("href");1258 1259 jQuery('.video_full').hide();1260 jQuery('#hide_' + idElement).attr("href", videofile);1261 jQuery('a.lightbox').hide();1262 jQuery('#main_image').hide();1263 jQuery(".product_label").hide();1264 jQuery("#videoshophtml5").remove();1265 if (!joomshoppingVideoHtml5){1266 jQuery('#hide_' + idElement).show();1267 jQuery('#hide_' + idElement).media( { width: width, height: height} );1268 }else{1269 var videoOptions = {1270 id: 'videoshophtml5',1271 src: videofile, 1272 width: width,1273 height: height,1274 controls: true1275 };1276 if (joomshoppingVideoHtml5Type!=''){1277 videoOptions.type = joomshoppingVideoHtml5Type;1278 }1279 var video = jQuery('<video />', videoOptions);1280 video.appendTo(jQuery('.image_middle'));1281 }1282}12831284function showVideoCode(idElement){1285 jQuery('.video_full:not(#hide_' + idElement + ')').hide();1286 jQuery('a.lightbox').hide();1287 jQuery('#main_image').hide();1288 jQuery(".product_label").hide();1289 jQuery("#videoshophtml5").remove();1290 jQuery('#hide_' + idElement).show();1291}12921293function showImage(id){ 1294 jQuery('.video_full').hide();1295 jQuery("#videoshophtml5").remove();1296 jQuery('a.lightbox').hide();1297 jQuery("#main_image_full_"+id).show();1298 jQuery(".product_label").show();1299}13001301function playMusic(idElement){1302 jQuery('#'+idElement).media( { width: 100, height: 20, autoplay:true } );1303}13041305function showHideReview(){1306 jQuery('#jshop_review_write').show();1307}13081309function formatprice(price){ 1310 if (typeof(decimal_count)==='undefined') decimal_count = 2;1311 if (typeof(decimal_symbol)==='undefined') decimal_symbol = ".";1312 price = price.toFixed(decimal_count).toString();1313 price = price.replace('.',decimal_symbol);1314 res = format_currency.replace("Symb",currency_code);1315 res = res.replace("00",price); 1316return res;1317}13181319var prevAjaxHandler = null;1320var reloadAttribEvents = [];1321var extdataurlupdateattr = {};1322function reloadAttribSelectAndPrice(id_select){1323 var product_id = jQuery("#product_id").val();1324 var qty = jQuery("#quantity").val();1325 var data = {};1326 data["change_attr"] = id_select;1327 data["qty"] = qty; 1328 for(var i=0;i<attr_list.length;i++){1329 var id = attr_list[i];1330 data["attr["+id+"]"] = attr_value[id];1331 }1332 for(extdatakey in extdataurlupdateattr){1333 data[extdatakey] = extdataurlupdateattr[extdatakey];1334 }13351336 if (prevAjaxHandler){1337 prevAjaxHandler.abort();1338 }13391340 prevAjaxHandler = jQuery.getJSON(1341 urlupdateprice,1342 data,1343 function(json){1344 var reload_atribut = 0;1345 for(var i=0;i<attr_list.length;i++){1346 var id = attr_list[i];1347 if (reload_atribut){1348 jQuery("#block_attr_sel_"+id).html(json['id_'+id]);1349 }1350 if (id == id_select) reload_atribut = 1;1351 }1352 1353 jQuery("#block_price").html(json.price);1354 jQuery("#pricefloat").val(json.pricefloat);1355 1356 if (json.basicprice){1357 jQuery("#block_basic_price").html(json.basicprice);1358 }1359 1360 for(key in json){1361 if (key.substr(0,3)=="pq_"){1362 jQuery("#pricelist_from_"+key.substr(3)).html(json[key]);1363 }1364 }13651366 if (json.available=="0"){1367 jQuery("#not_available").html(translate_not_available);1368 }else{1369 jQuery("#not_available").html("");1370 }1371 1372 if (json.displaybuttons=="0"){1373 jQuery(".productfull .prod_buttons").hide();1374 }else{1375 jQuery(".productfull .prod_buttons").show();1376 }13771378 if (json.ean){1379 jQuery("#product_code").html(json.ean);1380 }13811382 if (json.weight){1383 jQuery("#block_weight").html(json.weight);1384 }1385 if (json.pricedefault){1386 jQuery("#pricedefault").html(json.pricedefault);1387 }1388 if (json.qty){1389 jQuery("#product_qty").html(json.qty);1390 }1391 if (json.oldprice){1392 jQuery("#old_price").html(json.oldprice);1393 jQuery(".old_price").show();1394 }else{1395 jQuery(".old_price").hide();1396 }13971398 if (json.images && json.images.length>0){1399 var count_prod_img = json.images.length;1400 var html_thumb_img = "";1401 var html_middle_img = "";1402 var html_zoom_img = '';1403 if (typeof(jshop_product_hide_zoom_image)==='undefined') jshop_product_hide_zoom_image = 0;1404 if (!jshop_product_hide_zoom_image){1405 html_zoom_img = ' <div class="text_zoom"><img alt="zoom" src="'+liveimgpath+'/search.png" /> '+translate_zoom_image+'</div>';1406 }1407 for(var j=0;j<count_prod_img;j++){1408 html_thumb_img+='<img class="jshop_img_thumb" src="'+liveproductimgpath+'/thumb_'+json.images[j]+'" onclick = "showImage('+j+')" />';1409 tmp = 'style="display:none"';1410 if (j==0) tmp = '';1411 html_middle_img+='<a class="lightbox" id="main_image_full_'+j+'" href="'+liveproductimgpath+'/full_'+json.images[j]+'" '+tmp+'><img id="main_image_'+j+'" src="'+liveproductimgpath+'/'+json.images[j]+'" />'+html_zoom_img+'</a>';1412 }1413 if (json.displayimgthumb=="1") 1414 jQuery("#list_product_image_thumb").html(html_thumb_img);1415 else1416 jQuery("#list_product_image_thumb").html("");1417 jQuery("#list_product_image_middle").html(html_middle_img);1418 initJSlightBox();1419 }14201421 if (json.block_image_thumb || json.block_image_middle){1422 jQuery("#list_product_image_thumb").html(json.block_image_thumb); 1423 jQuery("#list_product_image_middle").html(json.block_image_middle);1424 initJSlightBox();1425 }1426 1427 if (typeof(json.demofiles)!='undefined'){1428 jQuery("#list_product_demofiles").html(json.demofiles);1429 }1430 1431 if (json.showdeliverytime){1432 if (json.showdeliverytime=="0"){1433 jQuery(".productfull .deliverytime").hide();1434 }else{1435 jQuery(".productfull .deliverytime").show();1436 }1437 }14381439 jQuery.each(reloadAttribEvents, function(key, handler){1440 handler.call(this, json);1441 });14421443 reloadAttrValue();1444 }1445 );1446}14471448function setAttrValue(id, value){1449 attr_value[id] = value;1450 reloadAttribSelectAndPrice(id);1451 reloadAttribImg(id, value);1452}14531454function reloadAttribImg(id, value){1455 var path = "";1456 var img = "";1457 if (value=="0"){1458 img = "";1459 }else{1460 if (attr_img[value]){1461 img = attr_img[value];1462 }else{1463 img = "";1464 }1465 }1466 1467 if (img==""){1468 path = liveimgpath;1469 img = "blank.gif";1470 }else{1471 path = liveattrpath;1472 }1473 jQuery("#prod_attr_img_"+id).attr('src', path+"/"+img);1474}14751476function reloadAttrValue(){ 1477 for(var id in attr_value){1478 if (jQuery("input[name=jshop_attr_id\\["+id+"\\]]").attr("type")=="radio"){1479 attr_value[id] = jQuery("input[name=jshop_attr_id\\["+id+"\\]]:checked").val();1480 }else{1481 attr_value[id] = jQuery("#jshop_attr_id"+id).val();1482 }1483 }1484}14851486function reloadPrices(){1487 var qty = jQuery("#quantity").val();1488 if (qty!=""){1489 reloadAttribSelectAndPrice(0);1490 }1491}14921493function showHideFieldFirm(type_id){1494 if (type_id=="2"){1495 jQuery("#tr_field_firma_code").show();1496 jQuery('#tr_field_tax_number').show();1497 }else{1498 jQuery("#tr_field_firma_code").hide();1499 jQuery('#tr_field_tax_number').hide();1500 }1501}15021503function updateSearchCharacteristic(url, category_id){1504 function showResponse(data){1505 jQuery("#list_characteristics").html(data);1506 }1507 var data = {"category_id":category_id};1508 jQuery.get(url, data, showResponse);
...
Using AI Code Generation
1import { storiesOf } from '@storybook/react';2import { action } from '@storybook/addon-actions';3import { linkTo } from '@storybook/addon-links';4import { Welcome, Button, Welcome } from '@storybook/react/demo';5storiesOf('Welcome', module).add('to Storybook', () => <Welcome showApp={linkTo('Button')} />);6storiesOf('Button', module)7 .add('with text', () => (8 <Button onClick={action('clicked')}>Hello Button</Button>9 .add('with some emoji', () => (10 <Button onClick={action('clicked')}>😀 😎 👍 💯</Button>11 ));12storiesOf('Welcome', module).add('to Storybook', () => <Welcome showApp={linkTo('Button')} />);13storiesOf('Button', module)14 .add('with text', () => (15 <Button onClick={action('clicked')}>Hello Button</Button>16 .add('with some emoji', () => (17 <Button onClick={action('clicked')}>😀 😎 👍 💯</Button>18 ));19storiesOf('Welcome', module).add('to Storybook', () => <Welcome showApp={linkTo('Button')} />);20storiesOf('Button', module)21 .add('with text', () => (22 <Button onClick={action('clicked')}>Hello Button</Button>23 .add('with some emoji', () => (24 <Button onClick={action('clicked')}>😀 😎 👍 💯</Button>25 ));26storiesOf('Welcome', module).add('to Storybook', () => <Welcome showApp={linkTo('Button')} />);27storiesOf('Button', module)28 .add('with text', () => (29 <Button onClick={action('clicked')}>Hello Button</Button>30 .add('with some emoji', () => (31 <Button onClick={action('clicked')}>😀 😎 👍 💯</Button>32 ));33storiesOf('Welcome', module).add('to Storybook', () => <Welcome showApp={linkTo('Button')} />);34storiesOf('Button', module)35 .add('with text', () => (36 <Button onClick={action('clicked')}>Hello Button</Button>37 .add('with some emoji', () => (
Using AI Code Generation
1const arrayType = require('storybook-root').arrayType;2const arrayType = require('storybook-root').arrayType;3const arrayType = require('storybook-root').arrayType;4const arrayType = require('storybook-root').arrayType;5const arrayType = require('storybook-root').arrayType;6const arrayType = require('storybook-root').arrayType;7const arrayType = require('storybook-root').arrayType;8const arrayType = require('storybook-root').arrayType;9const arrayType = require('storybook-root').arrayType;10const arrayType = require('storybook-root').arrayType;11const arrayType = require('storybook-root').arrayType;12const arrayType = require('storybook-root').arrayType;13const arrayType = require('storybook-root').arrayType;14const arrayType = require('storybook-root').arrayType;15const arrayType = require('storybook-root').arrayType;16const arrayType = require('storybook-root').arrayType;17const arrayType = require('storybook-root').arrayType;18const arrayType = require('storybook-root').arrayType;19const arrayType = require('storybook-root').arrayType;20const arrayType = require('storybook-root').arrayType;
Using AI Code Generation
1import { arrayType } from 'storybook-root';2import { arrayType } from 'storybook-root';3import { arrayType } from 'storybook-root';4import { arrayType } from 'storybook-root';5import { arrayType } from 'storybook-root';6import { arrayType } from 'storybook-root';7import { arrayType } from 'storybook-root';8import { arrayType } from 'storybook-root';9import { arrayType } from 'storybook-root';10import { arrayType } from 'storybook-root';11import { arrayType } from 'storybook-root';12import { arrayType } from 'storybook-root';13import { arrayType } from 'storybook-root';14import { arrayType } from 'storybook-root';15import { arrayType } from 'storybook-root';16import { arrayType } from 'storybook-root';17import { arrayType } from 'storybook-root';18import { arrayType } from 'storybook-root';19import { arrayType } from 'storybook-root';20import { arrayType } from 'storybook-root';
Using AI Code Generation
1const storybookRoot = require('storybook-root');2const arrayType = storybookRoot.arrayType;3const array = [1, 2, 3];4const result = arrayType(array);5const storybookRoot = require('storybook-root');6const arrayType = storybookRoot.arrayType;7const array = [1, 2, 3];8const result = arrayType(array);9const storybookRoot = require('storybook-root');10const arrayType = storybookRoot.arrayType;11const array = [1, 2, 3];12const result = arrayType(array);13const storybookRoot = require('storybook-root');14const arrayType = storybookRoot.arrayType;15const array = [1, 2, 3];16const result = arrayType(array);17const storybookRoot = require('storybook-root');18const arrayType = storybookRoot.arrayType;19const array = [1, 2, 3];20const result = arrayType(array);21const storybookRoot = require('storybook-root');22const arrayType = storybookRoot.arrayType;23const array = [1, 2, 3];24const result = arrayType(array);25const storybookRoot = require('storybook-root');26const arrayType = storybookRoot.arrayType;27const array = [1, 2, 3];28const result = arrayType(array);29const storybookRoot = require('storybook-root');30const arrayType = storybookRoot.arrayType;31const array = [1, 2, 3];32const result = arrayType(array);
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!